react-bootstrap 0.32.0 → 0.32.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/README.md +11 -7
- package/dist/react-bootstrap.js +13464 -13723
- package/dist/react-bootstrap.min.js +10 -18464
- package/es/Accordion.js +13 -16
- package/es/Alert.js +26 -31
- package/es/Badge.js +21 -31
- package/es/Breadcrumb.js +17 -20
- package/es/BreadcrumbItem.js +30 -30
- package/es/Button.js +23 -27
- package/es/ButtonGroup.js +20 -22
- package/es/ButtonToolbar.js +16 -18
- package/es/Carousel.js +120 -157
- package/es/CarouselCaption.js +18 -21
- package/es/CarouselItem.js +34 -33
- package/es/Checkbox.js +43 -54
- package/es/Clearfix.js +24 -24
- package/es/CloseButton.js +21 -30
- package/es/Col.js +42 -26
- package/es/Collapse.js +68 -68
- package/es/ControlLabel.js +19 -24
- package/es/Dropdown.js +93 -91
- package/es/DropdownButton.js +25 -35
- package/es/DropdownMenu.js +65 -65
- package/es/DropdownToggle.js +28 -40
- package/es/Fade.js +26 -29
- package/es/Form.js +22 -22
- package/es/FormControl.js +32 -33
- package/es/FormControlFeedback.js +21 -21
- package/es/FormControlStatic.js +18 -21
- package/es/FormGroup.js +27 -34
- package/es/Glyphicon.js +18 -19
- package/es/Grid.js +20 -22
- package/es/HelpBlock.js +17 -17
- package/es/Image.js +19 -24
- package/es/InputGroup.js +17 -18
- package/es/InputGroupAddon.js +17 -17
- package/es/InputGroupButton.js +17 -17
- package/es/Jumbotron.js +18 -21
- package/es/Label.js +21 -27
- package/es/ListGroup.js +24 -29
- package/es/ListGroupItem.js +30 -48
- package/es/Media.js +18 -22
- package/es/MediaBody.js +19 -22
- package/es/MediaHeading.js +18 -21
- package/es/MediaLeft.js +18 -19
- package/es/MediaList.js +17 -17
- package/es/MediaListItem.js +17 -17
- package/es/MediaRight.js +18 -19
- package/es/MenuItem.js +44 -49
- package/es/Modal.js +63 -74
- package/es/ModalBody.js +18 -21
- package/es/ModalDialog.js +31 -39
- package/es/ModalFooter.js +18 -21
- package/es/ModalHeader.js +25 -35
- package/es/ModalTitle.js +18 -21
- package/es/Nav.js +73 -92
- package/es/NavDropdown.js +40 -52
- package/es/NavItem.js +34 -38
- package/es/Navbar.js +62 -73
- package/es/NavbarBrand.js +20 -24
- package/es/NavbarCollapse.js +21 -28
- package/es/NavbarHeader.js +19 -20
- package/es/NavbarToggle.js +30 -38
- package/es/Overlay.js +21 -25
- package/es/OverlayTrigger.js +71 -68
- package/es/PageHeader.js +18 -26
- package/es/PageItem.js +0 -1
- package/es/Pager.js +23 -30
- package/es/PagerItem.js +36 -40
- package/es/Pagination.js +18 -24
- package/es/PaginationItem.js +47 -57
- package/es/Panel.js +51 -54
- package/es/PanelBody.js +18 -29
- package/es/PanelCollapse.js +20 -23
- package/es/PanelFooter.js +16 -23
- package/es/PanelGroup.js +44 -45
- package/es/PanelHeading.js +19 -28
- package/es/PanelTitle.js +22 -34
- package/es/PanelToggle.js +21 -24
- package/es/Popover.js +36 -46
- package/es/ProgressBar.js +59 -62
- package/es/Radio.js +43 -54
- package/es/ResponsiveEmbed.js +27 -32
- package/es/Row.js +18 -21
- package/es/SafeAnchor.js +32 -32
- package/es/SplitButton.js +33 -46
- package/es/SplitToggle.js +14 -13
- package/es/Tab.js +12 -18
- package/es/TabContainer.js +24 -30
- package/es/TabContent.js +36 -43
- package/es/TabPane.js +58 -68
- package/es/Table.js +25 -29
- package/es/Tabs.js +56 -71
- package/es/Thumbnail.js +34 -34
- package/es/ToggleButton.js +32 -37
- package/es/ToggleButtonGroup.js +45 -57
- package/es/Tooltip.js +33 -40
- package/es/Well.js +17 -17
- package/es/index.js +2 -0
- package/es/utils/PropTypes.js +13 -19
- package/es/utils/StyleConfig.js +0 -4
- package/es/utils/ValidComponentChildren.js +11 -20
- package/es/utils/bootstrapUtils.js +17 -31
- package/es/utils/createChainedFunction.js +2 -2
- package/es/utils/deprecationWarning.js +28 -30
- package/es/utils/splitComponentProps.js +1 -2
- package/lib/Accordion.js +23 -36
- package/lib/Alert.js +43 -65
- package/lib/Badge.js +36 -56
- package/lib/Breadcrumb.js +32 -47
- package/lib/BreadcrumbItem.js +48 -63
- package/lib/Button.js +49 -71
- package/lib/ButtonGroup.js +39 -57
- package/lib/ButtonToolbar.js +29 -42
- package/lib/Carousel.js +161 -214
- package/lib/CarouselCaption.js +32 -46
- package/lib/CarouselItem.js +54 -73
- package/lib/Checkbox.js +64 -87
- package/lib/Clearfix.js +45 -58
- package/lib/CloseButton.js +33 -50
- package/lib/Col.js +78 -73
- package/lib/Collapse.js +104 -125
- package/lib/ControlLabel.js +38 -59
- package/lib/Dropdown.js +153 -192
- package/lib/DropdownButton.js +44 -70
- package/lib/DropdownMenu.js +96 -120
- package/lib/DropdownToggle.js +48 -77
- package/lib/Fade.js +49 -68
- package/lib/Form.js +39 -52
- package/lib/FormControl.js +58 -79
- package/lib/FormControlFeedback.js +42 -54
- package/lib/FormControlStatic.js +32 -46
- package/lib/FormGroup.js +47 -67
- package/lib/Glyphicon.js +33 -46
- package/lib/Grid.js +36 -51
- package/lib/HelpBlock.js +29 -40
- package/lib/Image.js +37 -53
- package/lib/InputGroup.js +34 -49
- package/lib/InputGroupAddon.js +29 -40
- package/lib/InputGroupButton.js +29 -40
- package/lib/Jumbotron.js +32 -46
- package/lib/Label.js +35 -53
- package/lib/ListGroup.js +45 -61
- package/lib/ListGroupItem.js +55 -85
- package/lib/Media.js +43 -70
- package/lib/MediaBody.js +37 -55
- package/lib/MediaHeading.js +32 -46
- package/lib/MediaLeft.js +34 -48
- package/lib/MediaList.js +29 -40
- package/lib/MediaListItem.js +29 -40
- package/lib/MediaRight.js +34 -48
- package/lib/MenuItem.js +70 -92
- package/lib/Modal.js +130 -186
- package/lib/ModalBody.js +32 -46
- package/lib/ModalDialog.js +47 -69
- package/lib/ModalFooter.js +32 -46
- package/lib/ModalHeader.js +43 -70
- package/lib/ModalTitle.js +32 -46
- package/lib/Nav.js +122 -160
- package/lib/NavDropdown.js +63 -97
- package/lib/NavItem.js +54 -77
- package/lib/Navbar.js +115 -152
- package/lib/NavbarBrand.js +37 -55
- package/lib/NavbarCollapse.js +36 -57
- package/lib/NavbarHeader.js +33 -48
- package/lib/NavbarToggle.js +52 -77
- package/lib/Overlay.js +50 -75
- package/lib/OverlayTrigger.js +114 -129
- package/lib/PageHeader.js +30 -49
- package/lib/PageItem.js +9 -10
- package/lib/Pager.js +41 -63
- package/lib/PagerItem.js +55 -78
- package/lib/Pagination.js +32 -50
- package/lib/PaginationItem.js +67 -91
- package/lib/Panel.js +93 -127
- package/lib/PanelBody.js +35 -57
- package/lib/PanelCollapse.js +44 -56
- package/lib/PanelFooter.js +31 -48
- package/lib/PanelGroup.js +73 -88
- package/lib/PanelHeading.js +37 -59
- package/lib/PanelTitle.js +41 -68
- package/lib/PanelToggle.js +45 -66
- package/lib/Popover.js +59 -84
- package/lib/ProgressBar.js +86 -103
- package/lib/Radio.js +64 -87
- package/lib/ResponsiveEmbed.js +45 -63
- package/lib/Row.js +32 -46
- package/lib/SafeAnchor.js +53 -69
- package/lib/SplitButton.js +57 -90
- package/lib/SplitToggle.js +25 -34
- package/lib/Tab.js +32 -55
- package/lib/TabContainer.js +45 -61
- package/lib/TabContent.js +67 -87
- package/lib/TabPane.js +103 -131
- package/lib/Table.js +44 -59
- package/lib/Tabs.js +82 -119
- package/lib/Thumbnail.js +55 -67
- package/lib/ToggleButton.js +49 -68
- package/lib/ToggleButtonGroup.js +67 -104
- package/lib/Tooltip.js +55 -77
- package/lib/Well.js +30 -41
- package/lib/index.js +147 -214
- package/lib/utils/PropTypes.js +24 -31
- package/lib/utils/StyleConfig.js +13 -11
- package/lib/utils/ValidComponentChildren.js +34 -29
- package/lib/utils/bootstrapUtils.js +41 -52
- package/lib/utils/capitalize.js +2 -0
- package/lib/utils/createChainedFunction.js +8 -5
- package/lib/utils/deprecationWarning.js +37 -47
- package/lib/utils/index.js +11 -15
- package/lib/utils/splitComponentProps.js +5 -10
- package/package.json +58 -50
package/es/Nav.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import _extends from
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
|
|
5
|
-
import _inherits from 'babel-runtime/helpers/inherits';
|
|
1
|
+
import _extends from "@babel/runtime-corejs2/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime-corejs2/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
import _inheritsLoose from "@babel/runtime-corejs2/helpers/esm/inheritsLoose";
|
|
6
4
|
import classNames from 'classnames';
|
|
7
5
|
import keycode from 'keycode';
|
|
8
6
|
import React, { cloneElement } from 'react';
|
|
@@ -10,15 +8,10 @@ import PropTypes from 'prop-types';
|
|
|
10
8
|
import ReactDOM from 'react-dom';
|
|
11
9
|
import all from 'prop-types-extra/lib/all';
|
|
12
10
|
import warning from 'warning';
|
|
13
|
-
|
|
14
11
|
import { bsClass, bsStyles, getClassSet, prefix, splitBsProps } from './utils/bootstrapUtils';
|
|
15
12
|
import createChainedFunction from './utils/createChainedFunction';
|
|
16
|
-
import ValidComponentChildren from './utils/ValidComponentChildren';
|
|
17
|
-
|
|
18
|
-
// TODO: Should we expose `<NavItem>` as `<Nav.Item>`?
|
|
19
|
-
|
|
13
|
+
import ValidComponentChildren from './utils/ValidComponentChildren'; // TODO: Should we expose `<NavItem>` as `<Nav.Item>`?
|
|
20
14
|
// TODO: This `bsStyle` is very unlike the others. Should we rename it?
|
|
21
|
-
|
|
22
15
|
// TODO: `pullRight` and `pullLeft` don't render right outside of `navbar`.
|
|
23
16
|
// Consider renaming or replacing them.
|
|
24
17
|
|
|
@@ -38,7 +31,6 @@ var propTypes = {
|
|
|
38
31
|
* NavItems are be positioned vertically.
|
|
39
32
|
*/
|
|
40
33
|
stacked: PropTypes.bool,
|
|
41
|
-
|
|
42
34
|
justified: all(PropTypes.bool, function (_ref) {
|
|
43
35
|
var justified = _ref.justified,
|
|
44
36
|
navbar = _ref.navbar;
|
|
@@ -85,20 +77,17 @@ var propTypes = {
|
|
|
85
77
|
*/
|
|
86
78
|
pullLeft: PropTypes.bool
|
|
87
79
|
};
|
|
88
|
-
|
|
89
80
|
var defaultProps = {
|
|
90
81
|
justified: false,
|
|
91
82
|
pullRight: false,
|
|
92
83
|
pullLeft: false,
|
|
93
84
|
stacked: false
|
|
94
85
|
};
|
|
95
|
-
|
|
96
86
|
var contextTypes = {
|
|
97
87
|
$bs_navbar: PropTypes.shape({
|
|
98
88
|
bsClass: PropTypes.string,
|
|
99
89
|
onSelect: PropTypes.func
|
|
100
90
|
}),
|
|
101
|
-
|
|
102
91
|
$bs_tabContainer: PropTypes.shape({
|
|
103
92
|
activeKey: PropTypes.any,
|
|
104
93
|
onSelect: PropTypes.func.isRequired,
|
|
@@ -107,37 +96,36 @@ var contextTypes = {
|
|
|
107
96
|
})
|
|
108
97
|
};
|
|
109
98
|
|
|
110
|
-
var Nav =
|
|
111
|
-
|
|
99
|
+
var Nav =
|
|
100
|
+
/*#__PURE__*/
|
|
101
|
+
function (_React$Component) {
|
|
102
|
+
_inheritsLoose(Nav, _React$Component);
|
|
112
103
|
|
|
113
104
|
function Nav() {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
|
105
|
+
return _React$Component.apply(this, arguments) || this;
|
|
117
106
|
}
|
|
118
107
|
|
|
119
|
-
Nav.prototype
|
|
120
|
-
|
|
108
|
+
var _proto = Nav.prototype;
|
|
109
|
+
|
|
110
|
+
_proto.componentDidUpdate = function componentDidUpdate() {
|
|
111
|
+
var _this = this;
|
|
121
112
|
|
|
122
113
|
if (!this._needsRefocus) {
|
|
123
114
|
return;
|
|
124
115
|
}
|
|
125
116
|
|
|
126
117
|
this._needsRefocus = false;
|
|
127
|
-
|
|
128
118
|
var children = this.props.children;
|
|
129
119
|
|
|
130
|
-
var
|
|
131
|
-
activeKey =
|
|
132
|
-
activeHref =
|
|
120
|
+
var _this$getActiveProps = this.getActiveProps(),
|
|
121
|
+
activeKey = _this$getActiveProps.activeKey,
|
|
122
|
+
activeHref = _this$getActiveProps.activeHref;
|
|
133
123
|
|
|
134
124
|
var activeChild = ValidComponentChildren.find(children, function (child) {
|
|
135
|
-
return
|
|
125
|
+
return _this.isActive(child, activeKey, activeHref);
|
|
136
126
|
});
|
|
137
|
-
|
|
138
127
|
var childrenArray = ValidComponentChildren.toArray(children);
|
|
139
128
|
var activeChildIndex = childrenArray.indexOf(activeChild);
|
|
140
|
-
|
|
141
129
|
var childNodes = ReactDOM.findDOMNode(this).children;
|
|
142
130
|
var activeNode = childNodes && childNodes[activeChildIndex];
|
|
143
131
|
|
|
@@ -148,37 +136,35 @@ var Nav = function (_React$Component) {
|
|
|
148
136
|
activeNode.firstChild.focus();
|
|
149
137
|
};
|
|
150
138
|
|
|
151
|
-
|
|
139
|
+
_proto.getActiveProps = function getActiveProps() {
|
|
152
140
|
var tabContainer = this.context.$bs_tabContainer;
|
|
153
141
|
|
|
154
142
|
if (tabContainer) {
|
|
155
|
-
process.env.NODE_ENV !==
|
|
156
|
-
|
|
143
|
+
process.env.NODE_ENV !== "production" ? warning(this.props.activeKey == null && !this.props.activeHref, 'Specifying a `<Nav>` `activeKey` or `activeHref` in the context of ' + 'a `<TabContainer>` is not supported. Instead use `<TabContainer ' + ("activeKey={" + this.props.activeKey + "} />`.")) : void 0;
|
|
157
144
|
return tabContainer;
|
|
158
145
|
}
|
|
159
146
|
|
|
160
147
|
return this.props;
|
|
161
148
|
};
|
|
162
149
|
|
|
163
|
-
|
|
164
|
-
var
|
|
150
|
+
_proto.getNextActiveChild = function getNextActiveChild(offset) {
|
|
151
|
+
var _this2 = this;
|
|
165
152
|
|
|
166
153
|
var children = this.props.children;
|
|
167
|
-
|
|
168
154
|
var validChildren = children.filter(function (child) {
|
|
169
155
|
return child.props.eventKey != null && !child.props.disabled;
|
|
170
156
|
});
|
|
171
157
|
|
|
172
|
-
var
|
|
173
|
-
activeKey =
|
|
174
|
-
activeHref =
|
|
158
|
+
var _this$getActiveProps2 = this.getActiveProps(),
|
|
159
|
+
activeKey = _this$getActiveProps2.activeKey,
|
|
160
|
+
activeHref = _this$getActiveProps2.activeHref;
|
|
175
161
|
|
|
176
162
|
var activeChild = ValidComponentChildren.find(children, function (child) {
|
|
177
|
-
return
|
|
178
|
-
});
|
|
163
|
+
return _this2.isActive(child, activeKey, activeHref);
|
|
164
|
+
}); // This assumes the active child is not disabled.
|
|
179
165
|
|
|
180
|
-
// This assumes the active child is not disabled.
|
|
181
166
|
var activeChildIndex = validChildren.indexOf(activeChild);
|
|
167
|
+
|
|
182
168
|
if (activeChildIndex === -1) {
|
|
183
169
|
// Something has gone wrong. Select the first valid child we can find.
|
|
184
170
|
return validChildren[0];
|
|
@@ -196,8 +182,8 @@ var Nav = function (_React$Component) {
|
|
|
196
182
|
return validChildren[nextIndex];
|
|
197
183
|
};
|
|
198
184
|
|
|
199
|
-
|
|
200
|
-
var
|
|
185
|
+
_proto.getTabProps = function getTabProps(child, tabContainer, navRole, active, onSelect) {
|
|
186
|
+
var _this3 = this;
|
|
201
187
|
|
|
202
188
|
if (!tabContainer && navRole !== 'tablist') {
|
|
203
189
|
// No tab props here.
|
|
@@ -212,10 +198,8 @@ var Nav = function (_React$Component) {
|
|
|
212
198
|
onKeyDown = _child$props.onKeyDown,
|
|
213
199
|
tabIndex = _child$props.tabIndex;
|
|
214
200
|
|
|
215
|
-
|
|
216
201
|
if (tabContainer) {
|
|
217
|
-
process.env.NODE_ENV !==
|
|
218
|
-
|
|
202
|
+
process.env.NODE_ENV !== "production" ? warning(!id && !controls, 'In the context of a `<TabContainer>`, `<NavItem>`s are given ' + 'generated `id` and `aria-controls` attributes for the sake of ' + 'proper component accessibility. Any provided ones will be ignored. ' + 'To control these attributes directly, provide a `generateChildId` ' + 'prop to the parent `<TabContainer>`.') : void 0;
|
|
219
203
|
id = tabContainer.getTabId(eventKey);
|
|
220
204
|
controls = tabContainer.getPaneId(eventKey);
|
|
221
205
|
}
|
|
@@ -223,7 +207,7 @@ var Nav = function (_React$Component) {
|
|
|
223
207
|
if (navRole === 'tablist') {
|
|
224
208
|
role = role || 'tab';
|
|
225
209
|
onKeyDown = createChainedFunction(function (event) {
|
|
226
|
-
return
|
|
210
|
+
return _this3.handleTabKeyDown(onSelect, event);
|
|
227
211
|
}, onKeyDown);
|
|
228
212
|
tabIndex = active ? tabIndex : -1;
|
|
229
213
|
}
|
|
@@ -237,18 +221,20 @@ var Nav = function (_React$Component) {
|
|
|
237
221
|
};
|
|
238
222
|
};
|
|
239
223
|
|
|
240
|
-
|
|
241
|
-
var nextActiveChild
|
|
224
|
+
_proto.handleTabKeyDown = function handleTabKeyDown(onSelect, event) {
|
|
225
|
+
var nextActiveChild;
|
|
242
226
|
|
|
243
227
|
switch (event.keyCode) {
|
|
244
228
|
case keycode.codes.left:
|
|
245
229
|
case keycode.codes.up:
|
|
246
230
|
nextActiveChild = this.getNextActiveChild(-1);
|
|
247
231
|
break;
|
|
232
|
+
|
|
248
233
|
case keycode.codes.right:
|
|
249
234
|
case keycode.codes.down:
|
|
250
235
|
nextActiveChild = this.getNextActiveChild(1);
|
|
251
236
|
break;
|
|
237
|
+
|
|
252
238
|
default:
|
|
253
239
|
// It was a different key; don't handle this keypress.
|
|
254
240
|
return;
|
|
@@ -263,7 +249,7 @@ var Nav = function (_React$Component) {
|
|
|
263
249
|
this._needsRefocus = true;
|
|
264
250
|
};
|
|
265
251
|
|
|
266
|
-
|
|
252
|
+
_proto.isActive = function isActive(_ref2, activeKey, activeHref) {
|
|
267
253
|
var props = _ref2.props;
|
|
268
254
|
|
|
269
255
|
if (props.active || activeKey != null && props.eventKey === activeKey || activeHref && props.href === activeHref) {
|
|
@@ -273,30 +259,31 @@ var Nav = function (_React$Component) {
|
|
|
273
259
|
return props.active;
|
|
274
260
|
};
|
|
275
261
|
|
|
276
|
-
|
|
262
|
+
_proto.render = function render() {
|
|
277
263
|
var _extends2,
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
var
|
|
281
|
-
stacked =
|
|
282
|
-
justified =
|
|
283
|
-
onSelect =
|
|
284
|
-
propsRole =
|
|
285
|
-
propsNavbar =
|
|
286
|
-
pullRight =
|
|
287
|
-
pullLeft =
|
|
288
|
-
className =
|
|
289
|
-
children =
|
|
290
|
-
props =
|
|
264
|
+
_this4 = this;
|
|
265
|
+
|
|
266
|
+
var _this$props = this.props,
|
|
267
|
+
stacked = _this$props.stacked,
|
|
268
|
+
justified = _this$props.justified,
|
|
269
|
+
onSelect = _this$props.onSelect,
|
|
270
|
+
propsRole = _this$props.role,
|
|
271
|
+
propsNavbar = _this$props.navbar,
|
|
272
|
+
pullRight = _this$props.pullRight,
|
|
273
|
+
pullLeft = _this$props.pullLeft,
|
|
274
|
+
className = _this$props.className,
|
|
275
|
+
children = _this$props.children,
|
|
276
|
+
props = _objectWithoutPropertiesLoose(_this$props, ["stacked", "justified", "onSelect", "role", "navbar", "pullRight", "pullLeft", "className", "children"]);
|
|
291
277
|
|
|
292
278
|
var tabContainer = this.context.$bs_tabContainer;
|
|
293
279
|
var role = propsRole || (tabContainer ? 'tablist' : null);
|
|
294
280
|
|
|
295
|
-
var
|
|
296
|
-
activeKey =
|
|
297
|
-
activeHref =
|
|
281
|
+
var _this$getActiveProps3 = this.getActiveProps(),
|
|
282
|
+
activeKey = _this$getActiveProps3.activeKey,
|
|
283
|
+
activeHref = _this$getActiveProps3.activeHref;
|
|
298
284
|
|
|
299
285
|
delete props.activeKey; // Accessed via this.getActiveProps().
|
|
286
|
+
|
|
300
287
|
delete props.activeHref; // Accessed via this.getActiveProps().
|
|
301
288
|
|
|
302
289
|
var _splitBsProps = splitBsProps(props),
|
|
@@ -306,14 +293,14 @@ var Nav = function (_React$Component) {
|
|
|
306
293
|
var classes = _extends({}, getClassSet(bsProps), (_extends2 = {}, _extends2[prefix(bsProps, 'stacked')] = stacked, _extends2[prefix(bsProps, 'justified')] = justified, _extends2));
|
|
307
294
|
|
|
308
295
|
var navbar = propsNavbar != null ? propsNavbar : this.context.$bs_navbar;
|
|
309
|
-
var pullLeftClassName
|
|
310
|
-
var pullRightClassName
|
|
296
|
+
var pullLeftClassName;
|
|
297
|
+
var pullRightClassName;
|
|
311
298
|
|
|
312
299
|
if (navbar) {
|
|
313
|
-
var navbarProps = this.context.$bs_navbar || {
|
|
314
|
-
|
|
300
|
+
var navbarProps = this.context.$bs_navbar || {
|
|
301
|
+
bsClass: 'navbar'
|
|
302
|
+
};
|
|
315
303
|
classes[prefix(navbarProps, 'nav')] = true;
|
|
316
|
-
|
|
317
304
|
pullRightClassName = prefix(navbarProps, 'right');
|
|
318
305
|
pullLeftClassName = prefix(navbarProps, 'left');
|
|
319
306
|
} else {
|
|
@@ -323,25 +310,20 @@ var Nav = function (_React$Component) {
|
|
|
323
310
|
|
|
324
311
|
classes[pullRightClassName] = pullRight;
|
|
325
312
|
classes[pullLeftClassName] = pullLeft;
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
activeHref: activeHref,
|
|
341
|
-
onSelect: childOnSelect
|
|
342
|
-
}));
|
|
343
|
-
})
|
|
344
|
-
);
|
|
313
|
+
return React.createElement("ul", _extends({}, elementProps, {
|
|
314
|
+
role: role,
|
|
315
|
+
className: classNames(className, classes)
|
|
316
|
+
}), ValidComponentChildren.map(children, function (child) {
|
|
317
|
+
var active = _this4.isActive(child, activeKey, activeHref);
|
|
318
|
+
|
|
319
|
+
var childOnSelect = createChainedFunction(child.props.onSelect, onSelect, navbar && navbar.onSelect, tabContainer && tabContainer.onSelect);
|
|
320
|
+
return cloneElement(child, _extends({}, _this4.getTabProps(child, tabContainer, role, active, childOnSelect), {
|
|
321
|
+
active: active,
|
|
322
|
+
activeKey: activeKey,
|
|
323
|
+
activeHref: activeHref,
|
|
324
|
+
onSelect: childOnSelect
|
|
325
|
+
}));
|
|
326
|
+
}));
|
|
345
327
|
};
|
|
346
328
|
|
|
347
329
|
return Nav;
|
|
@@ -350,5 +332,4 @@ var Nav = function (_React$Component) {
|
|
|
350
332
|
Nav.propTypes = propTypes;
|
|
351
333
|
Nav.defaultProps = defaultProps;
|
|
352
334
|
Nav.contextTypes = contextTypes;
|
|
353
|
-
|
|
354
335
|
export default bsClass('nav', bsStyles(['tabs', 'pills'], Nav));
|
package/es/NavDropdown.js
CHANGED
|
@@ -1,52 +1,50 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import _inherits from 'babel-runtime/helpers/inherits';
|
|
5
|
-
import _extends from 'babel-runtime/helpers/extends';
|
|
1
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime-corejs2/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
|
+
import _inheritsLoose from "@babel/runtime-corejs2/helpers/esm/inheritsLoose";
|
|
3
|
+
import _extends from "@babel/runtime-corejs2/helpers/esm/extends";
|
|
6
4
|
import classNames from 'classnames';
|
|
7
5
|
import React from 'react';
|
|
8
6
|
import PropTypes from 'prop-types';
|
|
9
|
-
|
|
10
7
|
import Dropdown from './Dropdown';
|
|
11
8
|
import splitComponentProps from './utils/splitComponentProps';
|
|
12
9
|
import ValidComponentChildren from './utils/ValidComponentChildren';
|
|
13
10
|
|
|
14
11
|
var propTypes = _extends({}, Dropdown.propTypes, {
|
|
15
|
-
|
|
16
12
|
// Toggle props.
|
|
17
13
|
title: PropTypes.node.isRequired,
|
|
18
14
|
noCaret: PropTypes.bool,
|
|
19
15
|
active: PropTypes.bool,
|
|
20
16
|
activeKey: PropTypes.any,
|
|
21
17
|
activeHref: PropTypes.string,
|
|
22
|
-
|
|
23
18
|
// Override generated docs from <Dropdown>.
|
|
19
|
+
|
|
24
20
|
/**
|
|
25
21
|
* @private
|
|
26
22
|
*/
|
|
27
23
|
children: PropTypes.node
|
|
28
24
|
});
|
|
29
25
|
|
|
30
|
-
var NavDropdown =
|
|
31
|
-
|
|
26
|
+
var NavDropdown =
|
|
27
|
+
/*#__PURE__*/
|
|
28
|
+
function (_React$Component) {
|
|
29
|
+
_inheritsLoose(NavDropdown, _React$Component);
|
|
32
30
|
|
|
33
31
|
function NavDropdown() {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
|
32
|
+
return _React$Component.apply(this, arguments) || this;
|
|
37
33
|
}
|
|
38
34
|
|
|
39
|
-
NavDropdown.prototype
|
|
40
|
-
var props = _ref.props;
|
|
35
|
+
var _proto = NavDropdown.prototype;
|
|
41
36
|
|
|
42
|
-
|
|
37
|
+
_proto.isActive = function isActive(_ref, activeKey, activeHref) {
|
|
38
|
+
var _this = this;
|
|
39
|
+
|
|
40
|
+
var props = _ref.props;
|
|
43
41
|
|
|
44
42
|
if (props.active || activeKey != null && props.eventKey === activeKey || activeHref && props.href === activeHref) {
|
|
45
43
|
return true;
|
|
46
44
|
}
|
|
47
45
|
|
|
48
46
|
if (ValidComponentChildren.some(props.children, function (child) {
|
|
49
|
-
return
|
|
47
|
+
return _this.isActive(child, activeKey, activeHref);
|
|
50
48
|
})) {
|
|
51
49
|
return true;
|
|
52
50
|
}
|
|
@@ -54,56 +52,46 @@ var NavDropdown = function (_React$Component) {
|
|
|
54
52
|
return props.active;
|
|
55
53
|
};
|
|
56
54
|
|
|
57
|
-
|
|
58
|
-
var
|
|
55
|
+
_proto.render = function render() {
|
|
56
|
+
var _this2 = this;
|
|
59
57
|
|
|
60
|
-
var
|
|
61
|
-
title =
|
|
62
|
-
activeKey =
|
|
63
|
-
activeHref =
|
|
64
|
-
className =
|
|
65
|
-
style =
|
|
66
|
-
children =
|
|
67
|
-
props =
|
|
58
|
+
var _this$props = this.props,
|
|
59
|
+
title = _this$props.title,
|
|
60
|
+
activeKey = _this$props.activeKey,
|
|
61
|
+
activeHref = _this$props.activeHref,
|
|
62
|
+
className = _this$props.className,
|
|
63
|
+
style = _this$props.style,
|
|
64
|
+
children = _this$props.children,
|
|
65
|
+
props = _objectWithoutPropertiesLoose(_this$props, ["title", "activeKey", "activeHref", "className", "style", "children"]);
|
|
68
66
|
|
|
69
67
|
var active = this.isActive(this, activeKey, activeHref);
|
|
70
68
|
delete props.active; // Accessed via this.isActive().
|
|
69
|
+
|
|
71
70
|
delete props.eventKey; // Accessed via this.isActive().
|
|
72
71
|
|
|
73
72
|
var _splitComponentProps = splitComponentProps(props, Dropdown.ControlledComponent),
|
|
74
73
|
dropdownProps = _splitComponentProps[0],
|
|
75
|
-
toggleProps = _splitComponentProps[1];
|
|
76
|
-
|
|
77
|
-
// Unlike for the other dropdowns, styling needs to go to the `<Dropdown>`
|
|
74
|
+
toggleProps = _splitComponentProps[1]; // Unlike for the other dropdowns, styling needs to go to the `<Dropdown>`
|
|
78
75
|
// rather than the `<Dropdown.Toggle>`.
|
|
79
76
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
style: style
|
|
77
|
+
|
|
78
|
+
return React.createElement(Dropdown, _extends({}, dropdownProps, {
|
|
79
|
+
componentClass: "li",
|
|
80
|
+
className: classNames(className, {
|
|
81
|
+
active: active
|
|
86
82
|
}),
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
ValidComponentChildren.map(children, function (child) {
|
|
96
|
-
return React.cloneElement(child, {
|
|
97
|
-
active: _this3.isActive(child, activeKey, activeHref)
|
|
98
|
-
});
|
|
99
|
-
})
|
|
100
|
-
)
|
|
101
|
-
);
|
|
83
|
+
style: style
|
|
84
|
+
}), React.createElement(Dropdown.Toggle, _extends({}, toggleProps, {
|
|
85
|
+
useAnchor: true
|
|
86
|
+
}), title), React.createElement(Dropdown.Menu, null, ValidComponentChildren.map(children, function (child) {
|
|
87
|
+
return React.cloneElement(child, {
|
|
88
|
+
active: _this2.isActive(child, activeKey, activeHref)
|
|
89
|
+
});
|
|
90
|
+
})));
|
|
102
91
|
};
|
|
103
92
|
|
|
104
93
|
return NavDropdown;
|
|
105
94
|
}(React.Component);
|
|
106
95
|
|
|
107
96
|
NavDropdown.propTypes = propTypes;
|
|
108
|
-
|
|
109
97
|
export default NavDropdown;
|
package/es/NavItem.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import _extends from
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import _inherits from 'babel-runtime/helpers/inherits';
|
|
1
|
+
import _extends from "@babel/runtime-corejs2/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime-corejs2/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
import _inheritsLoose from "@babel/runtime-corejs2/helpers/esm/inheritsLoose";
|
|
4
|
+
import _assertThisInitialized from "@babel/runtime-corejs2/helpers/esm/assertThisInitialized";
|
|
6
5
|
import classNames from 'classnames';
|
|
7
6
|
import React from 'react';
|
|
8
7
|
import PropTypes from 'prop-types';
|
|
9
|
-
|
|
10
8
|
import SafeAnchor from './SafeAnchor';
|
|
11
9
|
import createChainedFunction from './utils/createChainedFunction';
|
|
12
|
-
|
|
13
10
|
var propTypes = {
|
|
14
11
|
active: PropTypes.bool,
|
|
15
12
|
disabled: PropTypes.bool,
|
|
@@ -19,25 +16,27 @@ var propTypes = {
|
|
|
19
16
|
onSelect: PropTypes.func,
|
|
20
17
|
eventKey: PropTypes.any
|
|
21
18
|
};
|
|
22
|
-
|
|
23
19
|
var defaultProps = {
|
|
24
20
|
active: false,
|
|
25
21
|
disabled: false
|
|
26
22
|
};
|
|
27
23
|
|
|
28
|
-
var NavItem =
|
|
29
|
-
|
|
24
|
+
var NavItem =
|
|
25
|
+
/*#__PURE__*/
|
|
26
|
+
function (_React$Component) {
|
|
27
|
+
_inheritsLoose(NavItem, _React$Component);
|
|
30
28
|
|
|
31
29
|
function NavItem(props, context) {
|
|
32
|
-
|
|
30
|
+
var _this;
|
|
33
31
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
_this.handleClick = _this.handleClick.bind(_this);
|
|
32
|
+
_this = _React$Component.call(this, props, context) || this;
|
|
33
|
+
_this.handleClick = _this.handleClick.bind(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
37
34
|
return _this;
|
|
38
35
|
}
|
|
39
36
|
|
|
40
|
-
NavItem.prototype
|
|
37
|
+
var _proto = NavItem.prototype;
|
|
38
|
+
|
|
39
|
+
_proto.handleClick = function handleClick(e) {
|
|
41
40
|
if (this.props.disabled) {
|
|
42
41
|
e.preventDefault();
|
|
43
42
|
return;
|
|
@@ -48,19 +47,18 @@ var NavItem = function (_React$Component) {
|
|
|
48
47
|
}
|
|
49
48
|
};
|
|
50
49
|
|
|
51
|
-
|
|
52
|
-
var
|
|
53
|
-
active =
|
|
54
|
-
disabled =
|
|
55
|
-
onClick =
|
|
56
|
-
className =
|
|
57
|
-
style =
|
|
58
|
-
props =
|
|
50
|
+
_proto.render = function render() {
|
|
51
|
+
var _this$props = this.props,
|
|
52
|
+
active = _this$props.active,
|
|
53
|
+
disabled = _this$props.disabled,
|
|
54
|
+
onClick = _this$props.onClick,
|
|
55
|
+
className = _this$props.className,
|
|
56
|
+
style = _this$props.style,
|
|
57
|
+
props = _objectWithoutPropertiesLoose(_this$props, ["active", "disabled", "onClick", "className", "style"]);
|
|
59
58
|
|
|
60
59
|
delete props.onSelect;
|
|
61
|
-
delete props.eventKey;
|
|
60
|
+
delete props.eventKey; // These are injected down by `<Nav>` for building `<SubNav>`s.
|
|
62
61
|
|
|
63
|
-
// These are injected down by `<Nav>` for building `<SubNav>`s.
|
|
64
62
|
delete props.activeKey;
|
|
65
63
|
delete props.activeHref;
|
|
66
64
|
|
|
@@ -72,18 +70,17 @@ var NavItem = function (_React$Component) {
|
|
|
72
70
|
props['aria-selected'] = active;
|
|
73
71
|
}
|
|
74
72
|
|
|
75
|
-
return React.createElement(
|
|
76
|
-
|
|
77
|
-
{
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
);
|
|
73
|
+
return React.createElement("li", {
|
|
74
|
+
role: "presentation",
|
|
75
|
+
className: classNames(className, {
|
|
76
|
+
active: active,
|
|
77
|
+
disabled: disabled
|
|
78
|
+
}),
|
|
79
|
+
style: style
|
|
80
|
+
}, React.createElement(SafeAnchor, _extends({}, props, {
|
|
81
|
+
disabled: disabled,
|
|
82
|
+
onClick: createChainedFunction(onClick, this.handleClick)
|
|
83
|
+
})));
|
|
87
84
|
};
|
|
88
85
|
|
|
89
86
|
return NavItem;
|
|
@@ -91,5 +88,4 @@ var NavItem = function (_React$Component) {
|
|
|
91
88
|
|
|
92
89
|
NavItem.propTypes = propTypes;
|
|
93
90
|
NavItem.defaultProps = defaultProps;
|
|
94
|
-
|
|
95
91
|
export default NavItem;
|