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.
Files changed (189) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/README.md +1 -0
  3. package/dist/react-bootstrap.js +14493 -17076
  4. package/dist/react-bootstrap.min.js +18479 -16
  5. package/es/Alert.js +1 -4
  6. package/es/Badge.js +1 -3
  7. package/es/ButtonGroup.js +1 -3
  8. package/es/Carousel.js +79 -79
  9. package/es/CarouselCaption.js +1 -3
  10. package/es/CarouselItem.js +3 -9
  11. package/es/Checkbox.js +7 -1
  12. package/es/Clearfix.js +1 -3
  13. package/es/CloseButton.js +1 -5
  14. package/es/Col.js +1 -3
  15. package/es/Collapse.js +58 -65
  16. package/es/Dropdown.js +66 -55
  17. package/es/DropdownButton.js +2 -8
  18. package/es/DropdownMenu.js +28 -28
  19. package/es/Fade.js +25 -10
  20. package/es/Form.js +1 -3
  21. package/es/FormControl.js +1 -2
  22. package/es/FormControlStatic.js +1 -3
  23. package/es/FormGroup.js +1 -3
  24. package/es/Glyphicon.js +1 -3
  25. package/es/Grid.js +1 -3
  26. package/es/HelpBlock.js +1 -3
  27. package/es/InputGroup.js +1 -3
  28. package/es/InputGroupAddon.js +1 -3
  29. package/es/InputGroupButton.js +1 -3
  30. package/es/Jumbotron.js +1 -3
  31. package/es/Label.js +1 -3
  32. package/es/ListGroup.js +1 -3
  33. package/es/Media.js +1 -3
  34. package/es/MediaBody.js +16 -5
  35. package/es/MediaHeading.js +1 -3
  36. package/es/MediaLeft.js +1 -3
  37. package/es/MediaList.js +1 -3
  38. package/es/MediaListItem.js +1 -3
  39. package/es/MediaRight.js +1 -3
  40. package/es/Modal.js +30 -19
  41. package/es/ModalBody.js +1 -3
  42. package/es/ModalFooter.js +1 -3
  43. package/es/ModalHeader.js +2 -4
  44. package/es/ModalTitle.js +1 -3
  45. package/es/Nav.js +44 -44
  46. package/es/NavDropdown.js +2 -0
  47. package/es/NavItem.js +5 -4
  48. package/es/Navbar.js +5 -7
  49. package/es/Overlay.js +1 -3
  50. package/es/OverlayTrigger.js +43 -43
  51. package/es/PageHeader.js +1 -3
  52. package/es/Pager.js +1 -3
  53. package/es/PagerItem.js +1 -4
  54. package/es/Pagination.js +15 -224
  55. package/es/PaginationItem.js +102 -0
  56. package/es/Panel.js +114 -173
  57. package/es/PanelBody.js +84 -0
  58. package/es/PanelCollapse.js +94 -0
  59. package/es/PanelFooter.js +53 -0
  60. package/es/PanelGroup.js +95 -52
  61. package/es/PanelHeading.js +75 -0
  62. package/es/PanelTitle.js +83 -0
  63. package/es/PanelToggle.js +94 -0
  64. package/es/ProgressBar.js +12 -8
  65. package/es/Radio.js +7 -1
  66. package/es/Row.js +1 -3
  67. package/es/SplitButton.js +1 -4
  68. package/es/SplitToggle.js +1 -4
  69. package/es/TabContent.js +7 -7
  70. package/es/TabPane.js +18 -18
  71. package/es/Table.js +1 -3
  72. package/es/Tabs.js +4 -10
  73. package/es/Thumbnail.js +3 -3
  74. package/es/ToggleButton.js +1 -4
  75. package/es/Well.js +1 -3
  76. package/es/index.js +0 -2
  77. package/es/utils/PropTypes.js +26 -4
  78. package/es/utils/ValidComponentChildren.js +1 -1
  79. package/es/utils/bootstrapUtils.js +5 -3
  80. package/lib/Accordion.js +9 -9
  81. package/lib/Alert.js +14 -17
  82. package/lib/Badge.js +12 -14
  83. package/lib/Breadcrumb.js +10 -10
  84. package/lib/BreadcrumbItem.js +14 -14
  85. package/lib/Button.js +20 -20
  86. package/lib/ButtonGroup.js +12 -14
  87. package/lib/ButtonToolbar.js +9 -9
  88. package/lib/Carousel.js +121 -121
  89. package/lib/CarouselCaption.js +9 -11
  90. package/lib/CarouselItem.js +17 -22
  91. package/lib/Checkbox.js +25 -21
  92. package/lib/Clearfix.js +14 -16
  93. package/lib/CloseButton.js +12 -16
  94. package/lib/Col.js +29 -31
  95. package/lib/Collapse.js +84 -92
  96. package/lib/ControlLabel.js +14 -14
  97. package/lib/Dropdown.js +106 -95
  98. package/lib/DropdownButton.js +22 -28
  99. package/lib/DropdownMenu.js +51 -51
  100. package/lib/DropdownToggle.js +16 -16
  101. package/lib/Fade.js +43 -25
  102. package/lib/Form.js +11 -13
  103. package/lib/FormControl.js +17 -17
  104. package/lib/FormControlFeedback.js +13 -13
  105. package/lib/FormControlStatic.js +9 -11
  106. package/lib/FormGroup.js +14 -16
  107. package/lib/Glyphicon.js +10 -12
  108. package/lib/Grid.js +10 -12
  109. package/lib/HelpBlock.js +8 -10
  110. package/lib/Image.js +13 -13
  111. package/lib/InputGroup.js +10 -12
  112. package/lib/InputGroupAddon.js +8 -10
  113. package/lib/InputGroupButton.js +8 -10
  114. package/lib/Jumbotron.js +9 -11
  115. package/lib/Label.js +11 -13
  116. package/lib/ListGroup.js +15 -17
  117. package/lib/ListGroupItem.js +22 -22
  118. package/lib/Media.js +15 -17
  119. package/lib/MediaBody.js +28 -11
  120. package/lib/MediaHeading.js +9 -11
  121. package/lib/MediaLeft.js +10 -12
  122. package/lib/MediaList.js +8 -10
  123. package/lib/MediaListItem.js +8 -10
  124. package/lib/MediaRight.js +10 -12
  125. package/lib/MenuItem.js +23 -23
  126. package/lib/Modal.js +80 -69
  127. package/lib/ModalBody.js +9 -11
  128. package/lib/ModalDialog.js +16 -16
  129. package/lib/ModalFooter.js +9 -11
  130. package/lib/ModalHeader.js +20 -22
  131. package/lib/ModalTitle.js +9 -11
  132. package/lib/Nav.js +81 -81
  133. package/lib/NavDropdown.js +27 -25
  134. package/lib/NavItem.js +23 -22
  135. package/lib/Navbar.js +46 -48
  136. package/lib/NavbarBrand.js +14 -14
  137. package/lib/NavbarCollapse.js +14 -14
  138. package/lib/NavbarHeader.js +10 -10
  139. package/lib/NavbarToggle.js +22 -22
  140. package/lib/Overlay.js +25 -27
  141. package/lib/OverlayTrigger.js +79 -79
  142. package/lib/PageHeader.js +10 -12
  143. package/lib/PageItem.js +2 -2
  144. package/lib/Pager.js +13 -15
  145. package/lib/PagerItem.js +18 -21
  146. package/lib/Pagination.js +25 -240
  147. package/lib/PaginationItem.js +135 -0
  148. package/lib/Panel.js +142 -180
  149. package/lib/PanelBody.js +114 -0
  150. package/lib/PanelCollapse.js +120 -0
  151. package/lib/PanelFooter.js +80 -0
  152. package/lib/PanelGroup.js +111 -70
  153. package/lib/PanelHeading.js +107 -0
  154. package/lib/PanelTitle.js +118 -0
  155. package/lib/PanelToggle.js +130 -0
  156. package/lib/Popover.js +22 -22
  157. package/lib/ProgressBar.js +39 -35
  158. package/lib/Radio.js +25 -21
  159. package/lib/ResponsiveEmbed.js +17 -17
  160. package/lib/Row.js +9 -11
  161. package/lib/SafeAnchor.js +17 -17
  162. package/lib/SplitButton.js +26 -29
  163. package/lib/SplitToggle.js +8 -11
  164. package/lib/Tab.js +15 -15
  165. package/lib/TabContainer.js +17 -17
  166. package/lib/TabContent.js +31 -31
  167. package/lib/TabPane.js +59 -59
  168. package/lib/Table.js +15 -17
  169. package/lib/Tabs.js +29 -35
  170. package/lib/Thumbnail.js +18 -20
  171. package/lib/ToggleButton.js +17 -20
  172. package/lib/ToggleButtonGroup.js +20 -20
  173. package/lib/Tooltip.js +20 -20
  174. package/lib/Well.js +8 -10
  175. package/lib/index.js +74 -79
  176. package/lib/utils/PropTypes.js +35 -9
  177. package/lib/utils/ValidComponentChildren.js +19 -19
  178. package/lib/utils/bootstrapUtils.js +13 -11
  179. package/lib/utils/capitalize.js +1 -1
  180. package/lib/utils/createChainedFunction.js +1 -1
  181. package/lib/utils/deprecationWarning.js +7 -7
  182. package/lib/utils/index.js +4 -4
  183. package/lib/utils/splitComponentProps.js +3 -3
  184. package/package.json +54 -64
  185. package/dist/react-bootstrap.min.js.map +0 -1
  186. package/es/PaginationButton.js +0 -98
  187. package/es/utils/TransitionEvents.js +0 -109
  188. package/lib/PaginationButton.js +0 -137
  189. 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 : { 'default': obj }; }
39
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
40
40
 
41
41
  var propTypes = {
42
- componentClass: _elementType2['default']
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['default'])(ModalTitle, _React$Component);
50
+ (0, _inherits3.default)(ModalTitle, _React$Component);
51
51
 
52
52
  function ModalTitle() {
53
- (0, _classCallCheck3['default'])(this, ModalTitle);
54
- return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
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['default'])(_props, ['componentClass', 'className']);
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['default'].createElement(Component, (0, _extends3['default'])({}, elementProps, {
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['default'].Component);
73
+ }(_react2.default.Component);
76
74
 
77
75
  ModalTitle.propTypes = propTypes;
78
76
  ModalTitle.defaultProps = defaultProps;
79
77
 
80
- exports['default'] = (0, _bootstrapUtils.bsClass)('modal-title', ModalTitle);
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 : { 'default': 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['default'].any,
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['default'].string,
82
+ activeHref: _propTypes2.default.string,
83
83
 
84
84
  /**
85
85
  * NavItems are be positioned vertically.
86
86
  */
87
- stacked: _propTypes2['default'].bool,
87
+ stacked: _propTypes2.default.bool,
88
88
 
89
- justified: (0, _all2['default'])(_propTypes2['default'].bool, function (_ref) {
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
- * Any eventKey,
101
- * SyntheticEvent event?
100
+ * Any eventKey,
101
+ * SyntheticEvent event?
102
102
  * )
103
103
  * ```
104
104
  */
105
- onSelect: _propTypes2['default'].func,
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['default'].string,
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['default'].bool,
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['default'].bool,
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['default'].bool
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['default'].shape({
145
- bsClass: _propTypes2['default'].string,
146
- onSelect: _propTypes2['default'].func
144
+ $bs_navbar: _propTypes2.default.shape({
145
+ bsClass: _propTypes2.default.string,
146
+ onSelect: _propTypes2.default.func
147
147
  }),
148
148
 
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
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['default'])(Nav, _React$Component);
158
+ (0, _inherits3.default)(Nav, _React$Component);
159
159
 
160
160
  function Nav() {
161
- (0, _classCallCheck3['default'])(this, Nav);
162
- return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
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['default'].find(children, function (child) {
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['default'].toArray(children);
184
+ var childrenArray = _ValidComponentChildren2.default.toArray(children);
185
185
  var activeChildIndex = childrenArray.indexOf(activeChild);
186
186
 
187
- var childNodes = _reactDom2['default'].findDOMNode(this).children;
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.handleTabKeyDown = function handleTabKeyDown(onSelect, event) {
198
- var nextActiveChild = void 0;
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
- event.preventDefault();
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
- if (onSelect && nextActiveChild && nextActiveChild.props.eventKey != null) {
217
- onSelect(nextActiveChild.props.eventKey);
203
+ return tabContainer;
218
204
  }
219
205
 
220
- this._needsRefocus = true;
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['default'].find(children, function (child) {
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['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;
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['default'])(function (event) {
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['default'])(_props, ['stacked', 'justified', 'onSelect', 'role', 'navbar', 'pullRight', 'pullLeft', 'className', 'children']);
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['default'])({}, (0, _bootstrapUtils.getClassSet)(bsProps), (_extends2 = {}, _extends2[(0, _bootstrapUtils.prefix)(bsProps, 'stacked')] = stacked, _extends2[(0, _bootstrapUtils.prefix)(bsProps, 'justified')] = justified, _extends2));
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['default'].createElement(
374
+ return _react2.default.createElement(
375
375
  'ul',
376
- (0, _extends4['default'])({}, elementProps, {
376
+ (0, _extends4.default)({}, elementProps, {
377
377
  role: role,
378
- className: (0, _classnames2['default'])(className, classes)
378
+ className: (0, _classnames2.default)(className, classes)
379
379
  }),
380
- _ValidComponentChildren2['default'].map(children, function (child) {
380
+ _ValidComponentChildren2.default.map(children, function (child) {
381
381
  var active = _this5.isActive(child, activeKey, activeHref);
382
- var childOnSelect = (0, _createChainedFunction2['default'])(child.props.onSelect, onSelect, navbar && navbar.onSelect, tabContainer && tabContainer.onSelect);
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['default'])({}, _this5.getTabProps(child, tabContainer, role, active, childOnSelect), {
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['default'].Component);
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['default'] = (0, _bootstrapUtils.bsClass)('nav', (0, _bootstrapUtils.bsStyles)(['tabs', 'pills'], Nav));
401
+ exports.default = (0, _bootstrapUtils.bsClass)('nav', (0, _bootstrapUtils.bsStyles)(['tabs', 'pills'], Nav));
402
402
  module.exports = exports['default'];
@@ -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 : { 'default': obj }; }
49
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
50
50
 
51
- var propTypes = (0, _extends3['default'])({}, _Dropdown2['default'].propTypes, {
51
+ var propTypes = (0, _extends3.default)({}, _Dropdown2.default.propTypes, {
52
52
 
53
53
  // Toggle props.
54
- title: _propTypes2['default'].node.isRequired,
55
- noCaret: _propTypes2['default'].bool,
56
- active: _propTypes2['default'].bool,
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['default'].node
64
+ children: _propTypes2.default.node
63
65
  });
64
66
 
65
67
  var NavDropdown = function (_React$Component) {
66
- (0, _inherits3['default'])(NavDropdown, _React$Component);
68
+ (0, _inherits3.default)(NavDropdown, _React$Component);
67
69
 
68
70
  function NavDropdown() {
69
- (0, _classCallCheck3['default'])(this, NavDropdown);
70
- return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
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['default'].some(props.children, function (child) {
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['default'])(_props, ['title', 'activeKey', 'activeHref', 'className', 'style', 'children']);
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['default'])(props, _Dropdown2['default'].ControlledComponent),
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['default'].createElement(
116
- _Dropdown2['default'],
117
- (0, _extends3['default'])({}, dropdownProps, {
117
+ return _react2.default.createElement(
118
+ _Dropdown2.default,
119
+ (0, _extends3.default)({}, dropdownProps, {
118
120
  componentClass: 'li',
119
- className: (0, _classnames2['default'])(className, { active: active }),
121
+ className: (0, _classnames2.default)(className, { active: active }),
120
122
  style: style
121
123
  }),
122
- _react2['default'].createElement(
123
- _Dropdown2['default'].Toggle,
124
- (0, _extends3['default'])({}, toggleProps, { useAnchor: true }),
124
+ _react2.default.createElement(
125
+ _Dropdown2.default.Toggle,
126
+ (0, _extends3.default)({}, toggleProps, { useAnchor: true }),
125
127
  title
126
128
  ),
127
- _react2['default'].createElement(
128
- _Dropdown2['default'].Menu,
129
+ _react2.default.createElement(
130
+ _Dropdown2.default.Menu,
129
131
  null,
130
- _ValidComponentChildren2['default'].map(children, function (child) {
131
- return _react2['default'].cloneElement(child, {
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['default'].Component);
142
+ }(_react2.default.Component);
141
143
 
142
144
  NavDropdown.propTypes = propTypes;
143
145
 
144
- exports['default'] = NavDropdown;
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 : { 'default': obj }; }
45
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
46
46
 
47
47
  var propTypes = {
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
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['default'])(NavItem, _React$Component);
63
+ (0, _inherits3.default)(NavItem, _React$Component);
64
64
 
65
65
  function NavItem(props, context) {
66
- (0, _classCallCheck3['default'])(this, NavItem);
66
+ (0, _classCallCheck3.default)(this, NavItem);
67
67
 
68
- var _this = (0, _possibleConstructorReturn3['default'])(this, _React$Component.call(this, props, context));
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.onSelect) {
75
+ if (this.props.disabled) {
76
76
  e.preventDefault();
77
+ return;
78
+ }
77
79
 
78
- if (!this.props.disabled) {
79
- this.props.onSelect(this.props.eventKey, e);
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['default'])(_props, ['active', 'disabled', 'onClick', 'className', 'style']);
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['default'].createElement(
110
+ return _react2.default.createElement(
110
111
  'li',
111
112
  {
112
113
  role: 'presentation',
113
- className: (0, _classnames2['default'])(className, { active: active, disabled: disabled }),
114
+ className: (0, _classnames2.default)(className, { active: active, disabled: disabled }),
114
115
  style: style
115
116
  },
116
- _react2['default'].createElement(_SafeAnchor2['default'], (0, _extends3['default'])({}, props, {
117
+ _react2.default.createElement(_SafeAnchor2.default, (0, _extends3.default)({}, props, {
117
118
  disabled: disabled,
118
- onClick: (0, _createChainedFunction2['default'])(onClick, this.handleClick)
119
+ onClick: (0, _createChainedFunction2.default)(onClick, this.handleClick)
119
120
  }))
120
121
  );
121
122
  };
122
123
 
123
124
  return NavItem;
124
- }(_react2['default'].Component);
125
+ }(_react2.default.Component);
125
126
 
126
127
  NavItem.propTypes = propTypes;
127
128
  NavItem.defaultProps = defaultProps;
128
129
 
129
- exports['default'] = NavItem;
130
+ exports.default = NavItem;
130
131
  module.exports = exports['default'];