react-bootstrap 0.31.3 → 0.32.1
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 +57 -0
- package/README.md +1 -0
- package/dist/react-bootstrap.js +14493 -17076
- package/dist/react-bootstrap.min.js +18479 -16
- package/es/Alert.js +1 -4
- package/es/Badge.js +1 -3
- package/es/ButtonGroup.js +1 -3
- package/es/Carousel.js +79 -79
- package/es/CarouselCaption.js +1 -3
- package/es/CarouselItem.js +3 -9
- package/es/Checkbox.js +7 -1
- package/es/Clearfix.js +1 -3
- package/es/CloseButton.js +1 -5
- package/es/Col.js +1 -3
- package/es/Collapse.js +58 -65
- package/es/Dropdown.js +66 -55
- package/es/DropdownButton.js +2 -8
- package/es/DropdownMenu.js +28 -28
- package/es/Fade.js +25 -10
- package/es/Form.js +1 -3
- package/es/FormControl.js +1 -2
- package/es/FormControlStatic.js +1 -3
- package/es/FormGroup.js +1 -3
- package/es/Glyphicon.js +1 -3
- package/es/Grid.js +1 -3
- package/es/HelpBlock.js +1 -3
- package/es/InputGroup.js +1 -3
- package/es/InputGroupAddon.js +1 -3
- package/es/InputGroupButton.js +1 -3
- package/es/Jumbotron.js +1 -3
- package/es/Label.js +1 -3
- package/es/ListGroup.js +1 -3
- package/es/Media.js +1 -3
- package/es/MediaBody.js +16 -5
- package/es/MediaHeading.js +1 -3
- package/es/MediaLeft.js +1 -3
- package/es/MediaList.js +1 -3
- package/es/MediaListItem.js +1 -3
- package/es/MediaRight.js +1 -3
- package/es/Modal.js +30 -19
- package/es/ModalBody.js +1 -3
- package/es/ModalFooter.js +1 -3
- package/es/ModalHeader.js +2 -4
- package/es/ModalTitle.js +1 -3
- package/es/Nav.js +44 -44
- package/es/NavDropdown.js +2 -0
- package/es/NavItem.js +5 -4
- package/es/Navbar.js +5 -7
- package/es/Overlay.js +1 -3
- package/es/OverlayTrigger.js +43 -43
- package/es/PageHeader.js +1 -3
- package/es/Pager.js +1 -3
- package/es/PagerItem.js +1 -4
- package/es/Pagination.js +15 -224
- package/es/PaginationItem.js +102 -0
- package/es/Panel.js +114 -173
- package/es/PanelBody.js +84 -0
- package/es/PanelCollapse.js +94 -0
- package/es/PanelFooter.js +53 -0
- package/es/PanelGroup.js +95 -52
- package/es/PanelHeading.js +75 -0
- package/es/PanelTitle.js +83 -0
- package/es/PanelToggle.js +94 -0
- package/es/ProgressBar.js +12 -8
- package/es/Radio.js +7 -1
- package/es/Row.js +1 -3
- package/es/SplitButton.js +1 -4
- package/es/SplitToggle.js +1 -4
- package/es/TabContent.js +7 -7
- package/es/TabPane.js +18 -18
- package/es/Table.js +1 -3
- package/es/Tabs.js +4 -10
- package/es/Thumbnail.js +3 -3
- package/es/ToggleButton.js +1 -4
- package/es/Well.js +1 -3
- package/es/index.js +0 -2
- package/es/utils/PropTypes.js +26 -4
- package/es/utils/ValidComponentChildren.js +1 -1
- package/es/utils/bootstrapUtils.js +5 -3
- package/lib/Accordion.js +9 -9
- package/lib/Alert.js +14 -17
- package/lib/Badge.js +12 -14
- package/lib/Breadcrumb.js +10 -10
- package/lib/BreadcrumbItem.js +14 -14
- package/lib/Button.js +20 -20
- package/lib/ButtonGroup.js +12 -14
- package/lib/ButtonToolbar.js +9 -9
- package/lib/Carousel.js +121 -121
- package/lib/CarouselCaption.js +9 -11
- package/lib/CarouselItem.js +17 -22
- package/lib/Checkbox.js +25 -21
- package/lib/Clearfix.js +14 -16
- package/lib/CloseButton.js +12 -16
- package/lib/Col.js +29 -31
- package/lib/Collapse.js +84 -92
- package/lib/ControlLabel.js +14 -14
- package/lib/Dropdown.js +106 -95
- package/lib/DropdownButton.js +22 -28
- package/lib/DropdownMenu.js +51 -51
- package/lib/DropdownToggle.js +16 -16
- package/lib/Fade.js +43 -25
- package/lib/Form.js +11 -13
- package/lib/FormControl.js +17 -17
- package/lib/FormControlFeedback.js +13 -13
- package/lib/FormControlStatic.js +9 -11
- package/lib/FormGroup.js +14 -16
- package/lib/Glyphicon.js +10 -12
- package/lib/Grid.js +10 -12
- package/lib/HelpBlock.js +8 -10
- package/lib/Image.js +13 -13
- package/lib/InputGroup.js +10 -12
- package/lib/InputGroupAddon.js +8 -10
- package/lib/InputGroupButton.js +8 -10
- package/lib/Jumbotron.js +9 -11
- package/lib/Label.js +11 -13
- package/lib/ListGroup.js +15 -17
- package/lib/ListGroupItem.js +22 -22
- package/lib/Media.js +15 -17
- package/lib/MediaBody.js +28 -11
- package/lib/MediaHeading.js +9 -11
- package/lib/MediaLeft.js +10 -12
- package/lib/MediaList.js +8 -10
- package/lib/MediaListItem.js +8 -10
- package/lib/MediaRight.js +10 -12
- package/lib/MenuItem.js +23 -23
- package/lib/Modal.js +80 -69
- package/lib/ModalBody.js +9 -11
- package/lib/ModalDialog.js +16 -16
- package/lib/ModalFooter.js +9 -11
- package/lib/ModalHeader.js +20 -22
- package/lib/ModalTitle.js +9 -11
- package/lib/Nav.js +81 -81
- package/lib/NavDropdown.js +27 -25
- package/lib/NavItem.js +23 -22
- package/lib/Navbar.js +46 -48
- package/lib/NavbarBrand.js +14 -14
- package/lib/NavbarCollapse.js +14 -14
- package/lib/NavbarHeader.js +10 -10
- package/lib/NavbarToggle.js +22 -22
- package/lib/Overlay.js +25 -27
- package/lib/OverlayTrigger.js +79 -79
- package/lib/PageHeader.js +10 -12
- package/lib/PageItem.js +2 -2
- package/lib/Pager.js +13 -15
- package/lib/PagerItem.js +18 -21
- package/lib/Pagination.js +25 -240
- package/lib/PaginationItem.js +135 -0
- package/lib/Panel.js +142 -180
- package/lib/PanelBody.js +114 -0
- package/lib/PanelCollapse.js +120 -0
- package/lib/PanelFooter.js +80 -0
- package/lib/PanelGroup.js +111 -70
- package/lib/PanelHeading.js +107 -0
- package/lib/PanelTitle.js +118 -0
- package/lib/PanelToggle.js +130 -0
- package/lib/Popover.js +22 -22
- package/lib/ProgressBar.js +39 -35
- package/lib/Radio.js +25 -21
- package/lib/ResponsiveEmbed.js +17 -17
- package/lib/Row.js +9 -11
- package/lib/SafeAnchor.js +17 -17
- package/lib/SplitButton.js +26 -29
- package/lib/SplitToggle.js +8 -11
- package/lib/Tab.js +15 -15
- package/lib/TabContainer.js +17 -17
- package/lib/TabContent.js +31 -31
- package/lib/TabPane.js +59 -59
- package/lib/Table.js +15 -17
- package/lib/Tabs.js +29 -35
- package/lib/Thumbnail.js +18 -20
- package/lib/ToggleButton.js +17 -20
- package/lib/ToggleButtonGroup.js +20 -20
- package/lib/Tooltip.js +20 -20
- package/lib/Well.js +8 -10
- package/lib/index.js +74 -79
- package/lib/utils/PropTypes.js +35 -9
- package/lib/utils/ValidComponentChildren.js +19 -19
- package/lib/utils/bootstrapUtils.js +13 -11
- package/lib/utils/capitalize.js +1 -1
- package/lib/utils/createChainedFunction.js +1 -1
- package/lib/utils/deprecationWarning.js +7 -7
- package/lib/utils/index.js +4 -4
- package/lib/utils/splitComponentProps.js +3 -3
- package/package.json +54 -64
- package/dist/react-bootstrap.min.js.map +0 -1
- package/es/PaginationButton.js +0 -98
- package/es/utils/TransitionEvents.js +0 -109
- package/lib/PaginationButton.js +0 -137
- package/lib/utils/TransitionEvents.js +0 -113
package/lib/ModalTitle.js
CHANGED
|
@@ -36,10 +36,10 @@ var _elementType2 = _interopRequireDefault(_elementType);
|
|
|
36
36
|
|
|
37
37
|
var _bootstrapUtils = require('./utils/bootstrapUtils');
|
|
38
38
|
|
|
39
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : {
|
|
39
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
40
40
|
|
|
41
41
|
var propTypes = {
|
|
42
|
-
componentClass: _elementType2
|
|
42
|
+
componentClass: _elementType2.default
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
var defaultProps = {
|
|
@@ -47,18 +47,18 @@ var defaultProps = {
|
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
var ModalTitle = function (_React$Component) {
|
|
50
|
-
(0, _inherits3
|
|
50
|
+
(0, _inherits3.default)(ModalTitle, _React$Component);
|
|
51
51
|
|
|
52
52
|
function ModalTitle() {
|
|
53
|
-
(0, _classCallCheck3
|
|
54
|
-
return (0, _possibleConstructorReturn3
|
|
53
|
+
(0, _classCallCheck3.default)(this, ModalTitle);
|
|
54
|
+
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
ModalTitle.prototype.render = function render() {
|
|
58
58
|
var _props = this.props,
|
|
59
59
|
Component = _props.componentClass,
|
|
60
60
|
className = _props.className,
|
|
61
|
-
props = (0, _objectWithoutProperties3
|
|
61
|
+
props = (0, _objectWithoutProperties3.default)(_props, ['componentClass', 'className']);
|
|
62
62
|
|
|
63
63
|
var _splitBsProps = (0, _bootstrapUtils.splitBsProps)(props),
|
|
64
64
|
bsProps = _splitBsProps[0],
|
|
@@ -66,16 +66,14 @@ var ModalTitle = function (_React$Component) {
|
|
|
66
66
|
|
|
67
67
|
var classes = (0, _bootstrapUtils.getClassSet)(bsProps);
|
|
68
68
|
|
|
69
|
-
return _react2
|
|
70
|
-
className: (0, _classnames2['default'])(className, classes)
|
|
71
|
-
}));
|
|
69
|
+
return _react2.default.createElement(Component, (0, _extends3.default)({}, elementProps, { className: (0, _classnames2.default)(className, classes) }));
|
|
72
70
|
};
|
|
73
71
|
|
|
74
72
|
return ModalTitle;
|
|
75
|
-
}(_react2
|
|
73
|
+
}(_react2.default.Component);
|
|
76
74
|
|
|
77
75
|
ModalTitle.propTypes = propTypes;
|
|
78
76
|
ModalTitle.defaultProps = defaultProps;
|
|
79
77
|
|
|
80
|
-
exports
|
|
78
|
+
exports.default = (0, _bootstrapUtils.bsClass)('modal-title', ModalTitle);
|
|
81
79
|
module.exports = exports['default'];
|
package/lib/Nav.js
CHANGED
|
@@ -60,7 +60,7 @@ var _ValidComponentChildren = require('./utils/ValidComponentChildren');
|
|
|
60
60
|
|
|
61
61
|
var _ValidComponentChildren2 = _interopRequireDefault(_ValidComponentChildren);
|
|
62
62
|
|
|
63
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : {
|
|
63
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
64
64
|
|
|
65
65
|
// TODO: Should we expose `<NavItem>` as `<Nav.Item>`?
|
|
66
66
|
|
|
@@ -74,19 +74,19 @@ var propTypes = {
|
|
|
74
74
|
* Marks the NavItem with a matching `eventKey` as active. Has a
|
|
75
75
|
* higher precedence over `activeHref`.
|
|
76
76
|
*/
|
|
77
|
-
activeKey: _propTypes2
|
|
77
|
+
activeKey: _propTypes2.default.any,
|
|
78
78
|
|
|
79
79
|
/**
|
|
80
80
|
* Marks the child NavItem with a matching `href` prop as active.
|
|
81
81
|
*/
|
|
82
|
-
activeHref: _propTypes2
|
|
82
|
+
activeHref: _propTypes2.default.string,
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
85
|
* NavItems are be positioned vertically.
|
|
86
86
|
*/
|
|
87
|
-
stacked: _propTypes2
|
|
87
|
+
stacked: _propTypes2.default.bool,
|
|
88
88
|
|
|
89
|
-
justified: (0, _all2
|
|
89
|
+
justified: (0, _all2.default)(_propTypes2.default.bool, function (_ref) {
|
|
90
90
|
var justified = _ref.justified,
|
|
91
91
|
navbar = _ref.navbar;
|
|
92
92
|
return justified && navbar ? Error('justified navbar `Nav`s are not supported') : null;
|
|
@@ -97,12 +97,12 @@ var propTypes = {
|
|
|
97
97
|
*
|
|
98
98
|
* ```js
|
|
99
99
|
* function (
|
|
100
|
-
*
|
|
101
|
-
*
|
|
100
|
+
* Any eventKey,
|
|
101
|
+
* SyntheticEvent event?
|
|
102
102
|
* )
|
|
103
103
|
* ```
|
|
104
104
|
*/
|
|
105
|
-
onSelect: _propTypes2
|
|
105
|
+
onSelect: _propTypes2.default.func,
|
|
106
106
|
|
|
107
107
|
/**
|
|
108
108
|
* ARIA role for the Nav, in the context of a TabContainer, the default will
|
|
@@ -112,25 +112,25 @@ var propTypes = {
|
|
|
112
112
|
* the ARIA authoring practices for tabs:
|
|
113
113
|
* https://www.w3.org/TR/2013/WD-wai-aria-practices-20130307/#tabpanel
|
|
114
114
|
*/
|
|
115
|
-
role: _propTypes2
|
|
115
|
+
role: _propTypes2.default.string,
|
|
116
116
|
|
|
117
117
|
/**
|
|
118
118
|
* Apply styling an alignment for use in a Navbar. This prop will be set
|
|
119
119
|
* automatically when the Nav is used inside a Navbar.
|
|
120
120
|
*/
|
|
121
|
-
navbar: _propTypes2
|
|
121
|
+
navbar: _propTypes2.default.bool,
|
|
122
122
|
|
|
123
123
|
/**
|
|
124
124
|
* Float the Nav to the right. When `navbar` is `true` the appropriate
|
|
125
125
|
* contextual classes are added as well.
|
|
126
126
|
*/
|
|
127
|
-
pullRight: _propTypes2
|
|
127
|
+
pullRight: _propTypes2.default.bool,
|
|
128
128
|
|
|
129
129
|
/**
|
|
130
130
|
* Float the Nav to the left. When `navbar` is `true` the appropriate
|
|
131
131
|
* contextual classes are added as well.
|
|
132
132
|
*/
|
|
133
|
-
pullLeft: _propTypes2
|
|
133
|
+
pullLeft: _propTypes2.default.bool
|
|
134
134
|
};
|
|
135
135
|
|
|
136
136
|
var defaultProps = {
|
|
@@ -141,25 +141,25 @@ var defaultProps = {
|
|
|
141
141
|
};
|
|
142
142
|
|
|
143
143
|
var contextTypes = {
|
|
144
|
-
$bs_navbar: _propTypes2
|
|
145
|
-
bsClass: _propTypes2
|
|
146
|
-
onSelect: _propTypes2
|
|
144
|
+
$bs_navbar: _propTypes2.default.shape({
|
|
145
|
+
bsClass: _propTypes2.default.string,
|
|
146
|
+
onSelect: _propTypes2.default.func
|
|
147
147
|
}),
|
|
148
148
|
|
|
149
|
-
$bs_tabContainer: _propTypes2
|
|
150
|
-
activeKey: _propTypes2
|
|
151
|
-
onSelect: _propTypes2
|
|
152
|
-
getTabId: _propTypes2
|
|
153
|
-
getPaneId: _propTypes2
|
|
149
|
+
$bs_tabContainer: _propTypes2.default.shape({
|
|
150
|
+
activeKey: _propTypes2.default.any,
|
|
151
|
+
onSelect: _propTypes2.default.func.isRequired,
|
|
152
|
+
getTabId: _propTypes2.default.func.isRequired,
|
|
153
|
+
getPaneId: _propTypes2.default.func.isRequired
|
|
154
154
|
})
|
|
155
155
|
};
|
|
156
156
|
|
|
157
157
|
var Nav = function (_React$Component) {
|
|
158
|
-
(0, _inherits3
|
|
158
|
+
(0, _inherits3.default)(Nav, _React$Component);
|
|
159
159
|
|
|
160
160
|
function Nav() {
|
|
161
|
-
(0, _classCallCheck3
|
|
162
|
-
return (0, _possibleConstructorReturn3
|
|
161
|
+
(0, _classCallCheck3.default)(this, Nav);
|
|
162
|
+
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
Nav.prototype.componentDidUpdate = function componentDidUpdate() {
|
|
@@ -177,14 +177,14 @@ var Nav = function (_React$Component) {
|
|
|
177
177
|
activeKey = _getActiveProps.activeKey,
|
|
178
178
|
activeHref = _getActiveProps.activeHref;
|
|
179
179
|
|
|
180
|
-
var activeChild = _ValidComponentChildren2
|
|
180
|
+
var activeChild = _ValidComponentChildren2.default.find(children, function (child) {
|
|
181
181
|
return _this2.isActive(child, activeKey, activeHref);
|
|
182
182
|
});
|
|
183
183
|
|
|
184
|
-
var childrenArray = _ValidComponentChildren2
|
|
184
|
+
var childrenArray = _ValidComponentChildren2.default.toArray(children);
|
|
185
185
|
var activeChildIndex = childrenArray.indexOf(activeChild);
|
|
186
186
|
|
|
187
|
-
var childNodes = _reactDom2
|
|
187
|
+
var childNodes = _reactDom2.default.findDOMNode(this).children;
|
|
188
188
|
var activeNode = childNodes && childNodes[activeChildIndex];
|
|
189
189
|
|
|
190
190
|
if (!activeNode || !activeNode.firstChild) {
|
|
@@ -194,30 +194,16 @@ var Nav = function (_React$Component) {
|
|
|
194
194
|
activeNode.firstChild.focus();
|
|
195
195
|
};
|
|
196
196
|
|
|
197
|
-
Nav.prototype.
|
|
198
|
-
var
|
|
199
|
-
|
|
200
|
-
switch (event.keyCode) {
|
|
201
|
-
case _keycode2['default'].codes.left:
|
|
202
|
-
case _keycode2['default'].codes.up:
|
|
203
|
-
nextActiveChild = this.getNextActiveChild(-1);
|
|
204
|
-
break;
|
|
205
|
-
case _keycode2['default'].codes.right:
|
|
206
|
-
case _keycode2['default'].codes.down:
|
|
207
|
-
nextActiveChild = this.getNextActiveChild(1);
|
|
208
|
-
break;
|
|
209
|
-
default:
|
|
210
|
-
// It was a different key; don't handle this keypress.
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
197
|
+
Nav.prototype.getActiveProps = function getActiveProps() {
|
|
198
|
+
var tabContainer = this.context.$bs_tabContainer;
|
|
213
199
|
|
|
214
|
-
|
|
200
|
+
if (tabContainer) {
|
|
201
|
+
process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(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;
|
|
215
202
|
|
|
216
|
-
|
|
217
|
-
onSelect(nextActiveChild.props.eventKey);
|
|
203
|
+
return tabContainer;
|
|
218
204
|
}
|
|
219
205
|
|
|
220
|
-
this.
|
|
206
|
+
return this.props;
|
|
221
207
|
};
|
|
222
208
|
|
|
223
209
|
Nav.prototype.getNextActiveChild = function getNextActiveChild(offset) {
|
|
@@ -233,7 +219,7 @@ var Nav = function (_React$Component) {
|
|
|
233
219
|
activeKey = _getActiveProps2.activeKey,
|
|
234
220
|
activeHref = _getActiveProps2.activeHref;
|
|
235
221
|
|
|
236
|
-
var activeChild = _ValidComponentChildren2
|
|
222
|
+
var activeChild = _ValidComponentChildren2.default.find(children, function (child) {
|
|
237
223
|
return _this3.isActive(child, activeKey, activeHref);
|
|
238
224
|
});
|
|
239
225
|
|
|
@@ -256,28 +242,6 @@ var Nav = function (_React$Component) {
|
|
|
256
242
|
return validChildren[nextIndex];
|
|
257
243
|
};
|
|
258
244
|
|
|
259
|
-
Nav.prototype.getActiveProps = function getActiveProps() {
|
|
260
|
-
var tabContainer = this.context.$bs_tabContainer;
|
|
261
|
-
|
|
262
|
-
if (tabContainer) {
|
|
263
|
-
process.env.NODE_ENV !== 'production' ? (0, _warning2['default'])(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;
|
|
264
|
-
|
|
265
|
-
return tabContainer;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
return this.props;
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
Nav.prototype.isActive = function isActive(_ref2, activeKey, activeHref) {
|
|
272
|
-
var props = _ref2.props;
|
|
273
|
-
|
|
274
|
-
if (props.active || activeKey != null && props.eventKey === activeKey || activeHref && props.href === activeHref) {
|
|
275
|
-
return true;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
return props.active;
|
|
279
|
-
};
|
|
280
|
-
|
|
281
245
|
Nav.prototype.getTabProps = function getTabProps(child, tabContainer, navRole, active, onSelect) {
|
|
282
246
|
var _this4 = this;
|
|
283
247
|
|
|
@@ -296,7 +260,7 @@ var Nav = function (_React$Component) {
|
|
|
296
260
|
|
|
297
261
|
|
|
298
262
|
if (tabContainer) {
|
|
299
|
-
process.env.NODE_ENV !== 'production' ? (0, _warning2
|
|
263
|
+
process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(!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;
|
|
300
264
|
|
|
301
265
|
id = tabContainer.getTabId(eventKey);
|
|
302
266
|
controls = tabContainer.getPaneId(eventKey);
|
|
@@ -304,7 +268,7 @@ var Nav = function (_React$Component) {
|
|
|
304
268
|
|
|
305
269
|
if (navRole === 'tablist') {
|
|
306
270
|
role = role || 'tab';
|
|
307
|
-
onKeyDown = (0, _createChainedFunction2
|
|
271
|
+
onKeyDown = (0, _createChainedFunction2.default)(function (event) {
|
|
308
272
|
return _this4.handleTabKeyDown(onSelect, event);
|
|
309
273
|
}, onKeyDown);
|
|
310
274
|
tabIndex = active ? tabIndex : -1;
|
|
@@ -319,6 +283,42 @@ var Nav = function (_React$Component) {
|
|
|
319
283
|
};
|
|
320
284
|
};
|
|
321
285
|
|
|
286
|
+
Nav.prototype.handleTabKeyDown = function handleTabKeyDown(onSelect, event) {
|
|
287
|
+
var nextActiveChild = void 0;
|
|
288
|
+
|
|
289
|
+
switch (event.keyCode) {
|
|
290
|
+
case _keycode2.default.codes.left:
|
|
291
|
+
case _keycode2.default.codes.up:
|
|
292
|
+
nextActiveChild = this.getNextActiveChild(-1);
|
|
293
|
+
break;
|
|
294
|
+
case _keycode2.default.codes.right:
|
|
295
|
+
case _keycode2.default.codes.down:
|
|
296
|
+
nextActiveChild = this.getNextActiveChild(1);
|
|
297
|
+
break;
|
|
298
|
+
default:
|
|
299
|
+
// It was a different key; don't handle this keypress.
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
event.preventDefault();
|
|
304
|
+
|
|
305
|
+
if (onSelect && nextActiveChild && nextActiveChild.props.eventKey != null) {
|
|
306
|
+
onSelect(nextActiveChild.props.eventKey);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
this._needsRefocus = true;
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
Nav.prototype.isActive = function isActive(_ref2, activeKey, activeHref) {
|
|
313
|
+
var props = _ref2.props;
|
|
314
|
+
|
|
315
|
+
if (props.active || activeKey != null && props.eventKey === activeKey || activeHref && props.href === activeHref) {
|
|
316
|
+
return true;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
return props.active;
|
|
320
|
+
};
|
|
321
|
+
|
|
322
322
|
Nav.prototype.render = function render() {
|
|
323
323
|
var _extends2,
|
|
324
324
|
_this5 = this;
|
|
@@ -333,7 +333,7 @@ var Nav = function (_React$Component) {
|
|
|
333
333
|
pullLeft = _props.pullLeft,
|
|
334
334
|
className = _props.className,
|
|
335
335
|
children = _props.children,
|
|
336
|
-
props = (0, _objectWithoutProperties3
|
|
336
|
+
props = (0, _objectWithoutProperties3.default)(_props, ['stacked', 'justified', 'onSelect', 'role', 'navbar', 'pullRight', 'pullLeft', 'className', 'children']);
|
|
337
337
|
|
|
338
338
|
|
|
339
339
|
var tabContainer = this.context.$bs_tabContainer;
|
|
@@ -350,7 +350,7 @@ var Nav = function (_React$Component) {
|
|
|
350
350
|
bsProps = _splitBsProps[0],
|
|
351
351
|
elementProps = _splitBsProps[1];
|
|
352
352
|
|
|
353
|
-
var classes = (0, _extends4
|
|
353
|
+
var classes = (0, _extends4.default)({}, (0, _bootstrapUtils.getClassSet)(bsProps), (_extends2 = {}, _extends2[(0, _bootstrapUtils.prefix)(bsProps, 'stacked')] = stacked, _extends2[(0, _bootstrapUtils.prefix)(bsProps, 'justified')] = justified, _extends2));
|
|
354
354
|
|
|
355
355
|
var navbar = propsNavbar != null ? propsNavbar : this.context.$bs_navbar;
|
|
356
356
|
var pullLeftClassName = void 0;
|
|
@@ -371,17 +371,17 @@ var Nav = function (_React$Component) {
|
|
|
371
371
|
classes[pullRightClassName] = pullRight;
|
|
372
372
|
classes[pullLeftClassName] = pullLeft;
|
|
373
373
|
|
|
374
|
-
return _react2
|
|
374
|
+
return _react2.default.createElement(
|
|
375
375
|
'ul',
|
|
376
|
-
(0, _extends4
|
|
376
|
+
(0, _extends4.default)({}, elementProps, {
|
|
377
377
|
role: role,
|
|
378
|
-
className: (0, _classnames2
|
|
378
|
+
className: (0, _classnames2.default)(className, classes)
|
|
379
379
|
}),
|
|
380
|
-
_ValidComponentChildren2
|
|
380
|
+
_ValidComponentChildren2.default.map(children, function (child) {
|
|
381
381
|
var active = _this5.isActive(child, activeKey, activeHref);
|
|
382
|
-
var childOnSelect = (0, _createChainedFunction2
|
|
382
|
+
var childOnSelect = (0, _createChainedFunction2.default)(child.props.onSelect, onSelect, navbar && navbar.onSelect, tabContainer && tabContainer.onSelect);
|
|
383
383
|
|
|
384
|
-
return (0, _react.cloneElement)(child, (0, _extends4
|
|
384
|
+
return (0, _react.cloneElement)(child, (0, _extends4.default)({}, _this5.getTabProps(child, tabContainer, role, active, childOnSelect), {
|
|
385
385
|
active: active,
|
|
386
386
|
activeKey: activeKey,
|
|
387
387
|
activeHref: activeHref,
|
|
@@ -392,11 +392,11 @@ var Nav = function (_React$Component) {
|
|
|
392
392
|
};
|
|
393
393
|
|
|
394
394
|
return Nav;
|
|
395
|
-
}(_react2
|
|
395
|
+
}(_react2.default.Component);
|
|
396
396
|
|
|
397
397
|
Nav.propTypes = propTypes;
|
|
398
398
|
Nav.defaultProps = defaultProps;
|
|
399
399
|
Nav.contextTypes = contextTypes;
|
|
400
400
|
|
|
401
|
-
exports
|
|
401
|
+
exports.default = (0, _bootstrapUtils.bsClass)('nav', (0, _bootstrapUtils.bsStyles)(['tabs', 'pills'], Nav));
|
|
402
402
|
module.exports = exports['default'];
|
package/lib/NavDropdown.js
CHANGED
|
@@ -46,28 +46,30 @@ var _ValidComponentChildren = require('./utils/ValidComponentChildren');
|
|
|
46
46
|
|
|
47
47
|
var _ValidComponentChildren2 = _interopRequireDefault(_ValidComponentChildren);
|
|
48
48
|
|
|
49
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : {
|
|
49
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
50
50
|
|
|
51
|
-
var propTypes = (0, _extends3
|
|
51
|
+
var propTypes = (0, _extends3.default)({}, _Dropdown2.default.propTypes, {
|
|
52
52
|
|
|
53
53
|
// Toggle props.
|
|
54
|
-
title: _propTypes2
|
|
55
|
-
noCaret: _propTypes2
|
|
56
|
-
active: _propTypes2
|
|
54
|
+
title: _propTypes2.default.node.isRequired,
|
|
55
|
+
noCaret: _propTypes2.default.bool,
|
|
56
|
+
active: _propTypes2.default.bool,
|
|
57
|
+
activeKey: _propTypes2.default.any,
|
|
58
|
+
activeHref: _propTypes2.default.string,
|
|
57
59
|
|
|
58
60
|
// Override generated docs from <Dropdown>.
|
|
59
61
|
/**
|
|
60
62
|
* @private
|
|
61
63
|
*/
|
|
62
|
-
children: _propTypes2
|
|
64
|
+
children: _propTypes2.default.node
|
|
63
65
|
});
|
|
64
66
|
|
|
65
67
|
var NavDropdown = function (_React$Component) {
|
|
66
|
-
(0, _inherits3
|
|
68
|
+
(0, _inherits3.default)(NavDropdown, _React$Component);
|
|
67
69
|
|
|
68
70
|
function NavDropdown() {
|
|
69
|
-
(0, _classCallCheck3
|
|
70
|
-
return (0, _possibleConstructorReturn3
|
|
71
|
+
(0, _classCallCheck3.default)(this, NavDropdown);
|
|
72
|
+
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
NavDropdown.prototype.isActive = function isActive(_ref, activeKey, activeHref) {
|
|
@@ -79,7 +81,7 @@ var NavDropdown = function (_React$Component) {
|
|
|
79
81
|
return true;
|
|
80
82
|
}
|
|
81
83
|
|
|
82
|
-
if (_ValidComponentChildren2
|
|
84
|
+
if (_ValidComponentChildren2.default.some(props.children, function (child) {
|
|
83
85
|
return _this2.isActive(child, activeKey, activeHref);
|
|
84
86
|
})) {
|
|
85
87
|
return true;
|
|
@@ -98,37 +100,37 @@ var NavDropdown = function (_React$Component) {
|
|
|
98
100
|
className = _props.className,
|
|
99
101
|
style = _props.style,
|
|
100
102
|
children = _props.children,
|
|
101
|
-
props = (0, _objectWithoutProperties3
|
|
103
|
+
props = (0, _objectWithoutProperties3.default)(_props, ['title', 'activeKey', 'activeHref', 'className', 'style', 'children']);
|
|
102
104
|
|
|
103
105
|
|
|
104
106
|
var active = this.isActive(this, activeKey, activeHref);
|
|
105
107
|
delete props.active; // Accessed via this.isActive().
|
|
106
108
|
delete props.eventKey; // Accessed via this.isActive().
|
|
107
109
|
|
|
108
|
-
var _splitComponentProps = (0, _splitComponentProps3
|
|
110
|
+
var _splitComponentProps = (0, _splitComponentProps3.default)(props, _Dropdown2.default.ControlledComponent),
|
|
109
111
|
dropdownProps = _splitComponentProps[0],
|
|
110
112
|
toggleProps = _splitComponentProps[1];
|
|
111
113
|
|
|
112
114
|
// Unlike for the other dropdowns, styling needs to go to the `<Dropdown>`
|
|
113
115
|
// rather than the `<Dropdown.Toggle>`.
|
|
114
116
|
|
|
115
|
-
return _react2
|
|
116
|
-
_Dropdown2
|
|
117
|
-
(0, _extends3
|
|
117
|
+
return _react2.default.createElement(
|
|
118
|
+
_Dropdown2.default,
|
|
119
|
+
(0, _extends3.default)({}, dropdownProps, {
|
|
118
120
|
componentClass: 'li',
|
|
119
|
-
className: (0, _classnames2
|
|
121
|
+
className: (0, _classnames2.default)(className, { active: active }),
|
|
120
122
|
style: style
|
|
121
123
|
}),
|
|
122
|
-
_react2
|
|
123
|
-
_Dropdown2
|
|
124
|
-
(0, _extends3
|
|
124
|
+
_react2.default.createElement(
|
|
125
|
+
_Dropdown2.default.Toggle,
|
|
126
|
+
(0, _extends3.default)({}, toggleProps, { useAnchor: true }),
|
|
125
127
|
title
|
|
126
128
|
),
|
|
127
|
-
_react2
|
|
128
|
-
_Dropdown2
|
|
129
|
+
_react2.default.createElement(
|
|
130
|
+
_Dropdown2.default.Menu,
|
|
129
131
|
null,
|
|
130
|
-
_ValidComponentChildren2
|
|
131
|
-
return _react2
|
|
132
|
+
_ValidComponentChildren2.default.map(children, function (child) {
|
|
133
|
+
return _react2.default.cloneElement(child, {
|
|
132
134
|
active: _this3.isActive(child, activeKey, activeHref)
|
|
133
135
|
});
|
|
134
136
|
})
|
|
@@ -137,9 +139,9 @@ var NavDropdown = function (_React$Component) {
|
|
|
137
139
|
};
|
|
138
140
|
|
|
139
141
|
return NavDropdown;
|
|
140
|
-
}(_react2
|
|
142
|
+
}(_react2.default.Component);
|
|
141
143
|
|
|
142
144
|
NavDropdown.propTypes = propTypes;
|
|
143
145
|
|
|
144
|
-
exports
|
|
146
|
+
exports.default = NavDropdown;
|
|
145
147
|
module.exports = exports['default'];
|
package/lib/NavItem.js
CHANGED
|
@@ -42,16 +42,16 @@ var _createChainedFunction = require('./utils/createChainedFunction');
|
|
|
42
42
|
|
|
43
43
|
var _createChainedFunction2 = _interopRequireDefault(_createChainedFunction);
|
|
44
44
|
|
|
45
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : {
|
|
45
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
46
46
|
|
|
47
47
|
var propTypes = {
|
|
48
|
-
active: _propTypes2
|
|
49
|
-
disabled: _propTypes2
|
|
50
|
-
role: _propTypes2
|
|
51
|
-
href: _propTypes2
|
|
52
|
-
onClick: _propTypes2
|
|
53
|
-
onSelect: _propTypes2
|
|
54
|
-
eventKey: _propTypes2
|
|
48
|
+
active: _propTypes2.default.bool,
|
|
49
|
+
disabled: _propTypes2.default.bool,
|
|
50
|
+
role: _propTypes2.default.string,
|
|
51
|
+
href: _propTypes2.default.string,
|
|
52
|
+
onClick: _propTypes2.default.func,
|
|
53
|
+
onSelect: _propTypes2.default.func,
|
|
54
|
+
eventKey: _propTypes2.default.any
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
var defaultProps = {
|
|
@@ -60,24 +60,25 @@ var defaultProps = {
|
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
var NavItem = function (_React$Component) {
|
|
63
|
-
(0, _inherits3
|
|
63
|
+
(0, _inherits3.default)(NavItem, _React$Component);
|
|
64
64
|
|
|
65
65
|
function NavItem(props, context) {
|
|
66
|
-
(0, _classCallCheck3
|
|
66
|
+
(0, _classCallCheck3.default)(this, NavItem);
|
|
67
67
|
|
|
68
|
-
var _this = (0, _possibleConstructorReturn3
|
|
68
|
+
var _this = (0, _possibleConstructorReturn3.default)(this, _React$Component.call(this, props, context));
|
|
69
69
|
|
|
70
70
|
_this.handleClick = _this.handleClick.bind(_this);
|
|
71
71
|
return _this;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
NavItem.prototype.handleClick = function handleClick(e) {
|
|
75
|
-
if (this.props.
|
|
75
|
+
if (this.props.disabled) {
|
|
76
76
|
e.preventDefault();
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
77
79
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
80
|
+
if (this.props.onSelect) {
|
|
81
|
+
this.props.onSelect(this.props.eventKey, e);
|
|
81
82
|
}
|
|
82
83
|
};
|
|
83
84
|
|
|
@@ -88,7 +89,7 @@ var NavItem = function (_React$Component) {
|
|
|
88
89
|
onClick = _props.onClick,
|
|
89
90
|
className = _props.className,
|
|
90
91
|
style = _props.style,
|
|
91
|
-
props = (0, _objectWithoutProperties3
|
|
92
|
+
props = (0, _objectWithoutProperties3.default)(_props, ['active', 'disabled', 'onClick', 'className', 'style']);
|
|
92
93
|
|
|
93
94
|
|
|
94
95
|
delete props.onSelect;
|
|
@@ -106,25 +107,25 @@ var NavItem = function (_React$Component) {
|
|
|
106
107
|
props['aria-selected'] = active;
|
|
107
108
|
}
|
|
108
109
|
|
|
109
|
-
return _react2
|
|
110
|
+
return _react2.default.createElement(
|
|
110
111
|
'li',
|
|
111
112
|
{
|
|
112
113
|
role: 'presentation',
|
|
113
|
-
className: (0, _classnames2
|
|
114
|
+
className: (0, _classnames2.default)(className, { active: active, disabled: disabled }),
|
|
114
115
|
style: style
|
|
115
116
|
},
|
|
116
|
-
_react2
|
|
117
|
+
_react2.default.createElement(_SafeAnchor2.default, (0, _extends3.default)({}, props, {
|
|
117
118
|
disabled: disabled,
|
|
118
|
-
onClick: (0, _createChainedFunction2
|
|
119
|
+
onClick: (0, _createChainedFunction2.default)(onClick, this.handleClick)
|
|
119
120
|
}))
|
|
120
121
|
);
|
|
121
122
|
};
|
|
122
123
|
|
|
123
124
|
return NavItem;
|
|
124
|
-
}(_react2
|
|
125
|
+
}(_react2.default.Component);
|
|
125
126
|
|
|
126
127
|
NavItem.propTypes = propTypes;
|
|
127
128
|
NavItem.defaultProps = defaultProps;
|
|
128
129
|
|
|
129
|
-
exports
|
|
130
|
+
exports.default = NavItem;
|
|
130
131
|
module.exports = exports['default'];
|