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.
Files changed (213) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +11 -7
  3. package/dist/react-bootstrap.js +13464 -13723
  4. package/dist/react-bootstrap.min.js +10 -18464
  5. package/es/Accordion.js +13 -16
  6. package/es/Alert.js +26 -31
  7. package/es/Badge.js +21 -31
  8. package/es/Breadcrumb.js +17 -20
  9. package/es/BreadcrumbItem.js +30 -30
  10. package/es/Button.js +23 -27
  11. package/es/ButtonGroup.js +20 -22
  12. package/es/ButtonToolbar.js +16 -18
  13. package/es/Carousel.js +120 -157
  14. package/es/CarouselCaption.js +18 -21
  15. package/es/CarouselItem.js +34 -33
  16. package/es/Checkbox.js +43 -54
  17. package/es/Clearfix.js +24 -24
  18. package/es/CloseButton.js +21 -30
  19. package/es/Col.js +42 -26
  20. package/es/Collapse.js +68 -68
  21. package/es/ControlLabel.js +19 -24
  22. package/es/Dropdown.js +93 -91
  23. package/es/DropdownButton.js +25 -35
  24. package/es/DropdownMenu.js +65 -65
  25. package/es/DropdownToggle.js +28 -40
  26. package/es/Fade.js +26 -29
  27. package/es/Form.js +22 -22
  28. package/es/FormControl.js +32 -33
  29. package/es/FormControlFeedback.js +21 -21
  30. package/es/FormControlStatic.js +18 -21
  31. package/es/FormGroup.js +27 -34
  32. package/es/Glyphicon.js +18 -19
  33. package/es/Grid.js +20 -22
  34. package/es/HelpBlock.js +17 -17
  35. package/es/Image.js +19 -24
  36. package/es/InputGroup.js +17 -18
  37. package/es/InputGroupAddon.js +17 -17
  38. package/es/InputGroupButton.js +17 -17
  39. package/es/Jumbotron.js +18 -21
  40. package/es/Label.js +21 -27
  41. package/es/ListGroup.js +24 -29
  42. package/es/ListGroupItem.js +30 -48
  43. package/es/Media.js +18 -22
  44. package/es/MediaBody.js +19 -22
  45. package/es/MediaHeading.js +18 -21
  46. package/es/MediaLeft.js +18 -19
  47. package/es/MediaList.js +17 -17
  48. package/es/MediaListItem.js +17 -17
  49. package/es/MediaRight.js +18 -19
  50. package/es/MenuItem.js +44 -49
  51. package/es/Modal.js +63 -74
  52. package/es/ModalBody.js +18 -21
  53. package/es/ModalDialog.js +31 -39
  54. package/es/ModalFooter.js +18 -21
  55. package/es/ModalHeader.js +25 -35
  56. package/es/ModalTitle.js +18 -21
  57. package/es/Nav.js +73 -92
  58. package/es/NavDropdown.js +40 -52
  59. package/es/NavItem.js +34 -38
  60. package/es/Navbar.js +62 -73
  61. package/es/NavbarBrand.js +20 -24
  62. package/es/NavbarCollapse.js +21 -28
  63. package/es/NavbarHeader.js +19 -20
  64. package/es/NavbarToggle.js +30 -38
  65. package/es/Overlay.js +21 -25
  66. package/es/OverlayTrigger.js +71 -68
  67. package/es/PageHeader.js +18 -26
  68. package/es/PageItem.js +0 -1
  69. package/es/Pager.js +23 -30
  70. package/es/PagerItem.js +36 -40
  71. package/es/Pagination.js +18 -24
  72. package/es/PaginationItem.js +47 -57
  73. package/es/Panel.js +51 -54
  74. package/es/PanelBody.js +18 -29
  75. package/es/PanelCollapse.js +20 -23
  76. package/es/PanelFooter.js +16 -23
  77. package/es/PanelGroup.js +44 -45
  78. package/es/PanelHeading.js +19 -28
  79. package/es/PanelTitle.js +22 -34
  80. package/es/PanelToggle.js +21 -24
  81. package/es/Popover.js +36 -46
  82. package/es/ProgressBar.js +59 -62
  83. package/es/Radio.js +43 -54
  84. package/es/ResponsiveEmbed.js +27 -32
  85. package/es/Row.js +18 -21
  86. package/es/SafeAnchor.js +32 -32
  87. package/es/SplitButton.js +33 -46
  88. package/es/SplitToggle.js +14 -13
  89. package/es/Tab.js +12 -18
  90. package/es/TabContainer.js +24 -30
  91. package/es/TabContent.js +36 -43
  92. package/es/TabPane.js +58 -68
  93. package/es/Table.js +25 -29
  94. package/es/Tabs.js +56 -71
  95. package/es/Thumbnail.js +34 -34
  96. package/es/ToggleButton.js +32 -37
  97. package/es/ToggleButtonGroup.js +45 -57
  98. package/es/Tooltip.js +33 -40
  99. package/es/Well.js +17 -17
  100. package/es/index.js +2 -0
  101. package/es/utils/PropTypes.js +13 -19
  102. package/es/utils/StyleConfig.js +0 -4
  103. package/es/utils/ValidComponentChildren.js +11 -20
  104. package/es/utils/bootstrapUtils.js +17 -31
  105. package/es/utils/createChainedFunction.js +2 -2
  106. package/es/utils/deprecationWarning.js +28 -30
  107. package/es/utils/splitComponentProps.js +1 -2
  108. package/lib/Accordion.js +23 -36
  109. package/lib/Alert.js +43 -65
  110. package/lib/Badge.js +36 -56
  111. package/lib/Breadcrumb.js +32 -47
  112. package/lib/BreadcrumbItem.js +48 -63
  113. package/lib/Button.js +49 -71
  114. package/lib/ButtonGroup.js +39 -57
  115. package/lib/ButtonToolbar.js +29 -42
  116. package/lib/Carousel.js +161 -214
  117. package/lib/CarouselCaption.js +32 -46
  118. package/lib/CarouselItem.js +54 -73
  119. package/lib/Checkbox.js +64 -87
  120. package/lib/Clearfix.js +45 -58
  121. package/lib/CloseButton.js +33 -50
  122. package/lib/Col.js +78 -73
  123. package/lib/Collapse.js +104 -125
  124. package/lib/ControlLabel.js +38 -59
  125. package/lib/Dropdown.js +153 -192
  126. package/lib/DropdownButton.js +44 -70
  127. package/lib/DropdownMenu.js +96 -120
  128. package/lib/DropdownToggle.js +48 -77
  129. package/lib/Fade.js +49 -68
  130. package/lib/Form.js +39 -52
  131. package/lib/FormControl.js +58 -79
  132. package/lib/FormControlFeedback.js +42 -54
  133. package/lib/FormControlStatic.js +32 -46
  134. package/lib/FormGroup.js +47 -67
  135. package/lib/Glyphicon.js +33 -46
  136. package/lib/Grid.js +36 -51
  137. package/lib/HelpBlock.js +29 -40
  138. package/lib/Image.js +37 -53
  139. package/lib/InputGroup.js +34 -49
  140. package/lib/InputGroupAddon.js +29 -40
  141. package/lib/InputGroupButton.js +29 -40
  142. package/lib/Jumbotron.js +32 -46
  143. package/lib/Label.js +35 -53
  144. package/lib/ListGroup.js +45 -61
  145. package/lib/ListGroupItem.js +55 -85
  146. package/lib/Media.js +43 -70
  147. package/lib/MediaBody.js +37 -55
  148. package/lib/MediaHeading.js +32 -46
  149. package/lib/MediaLeft.js +34 -48
  150. package/lib/MediaList.js +29 -40
  151. package/lib/MediaListItem.js +29 -40
  152. package/lib/MediaRight.js +34 -48
  153. package/lib/MenuItem.js +70 -92
  154. package/lib/Modal.js +130 -186
  155. package/lib/ModalBody.js +32 -46
  156. package/lib/ModalDialog.js +47 -69
  157. package/lib/ModalFooter.js +32 -46
  158. package/lib/ModalHeader.js +43 -70
  159. package/lib/ModalTitle.js +32 -46
  160. package/lib/Nav.js +122 -160
  161. package/lib/NavDropdown.js +63 -97
  162. package/lib/NavItem.js +54 -77
  163. package/lib/Navbar.js +115 -152
  164. package/lib/NavbarBrand.js +37 -55
  165. package/lib/NavbarCollapse.js +36 -57
  166. package/lib/NavbarHeader.js +33 -48
  167. package/lib/NavbarToggle.js +52 -77
  168. package/lib/Overlay.js +50 -75
  169. package/lib/OverlayTrigger.js +114 -129
  170. package/lib/PageHeader.js +30 -49
  171. package/lib/PageItem.js +9 -10
  172. package/lib/Pager.js +41 -63
  173. package/lib/PagerItem.js +55 -78
  174. package/lib/Pagination.js +32 -50
  175. package/lib/PaginationItem.js +67 -91
  176. package/lib/Panel.js +93 -127
  177. package/lib/PanelBody.js +35 -57
  178. package/lib/PanelCollapse.js +44 -56
  179. package/lib/PanelFooter.js +31 -48
  180. package/lib/PanelGroup.js +73 -88
  181. package/lib/PanelHeading.js +37 -59
  182. package/lib/PanelTitle.js +41 -68
  183. package/lib/PanelToggle.js +45 -66
  184. package/lib/Popover.js +59 -84
  185. package/lib/ProgressBar.js +86 -103
  186. package/lib/Radio.js +64 -87
  187. package/lib/ResponsiveEmbed.js +45 -63
  188. package/lib/Row.js +32 -46
  189. package/lib/SafeAnchor.js +53 -69
  190. package/lib/SplitButton.js +57 -90
  191. package/lib/SplitToggle.js +25 -34
  192. package/lib/Tab.js +32 -55
  193. package/lib/TabContainer.js +45 -61
  194. package/lib/TabContent.js +67 -87
  195. package/lib/TabPane.js +103 -131
  196. package/lib/Table.js +44 -59
  197. package/lib/Tabs.js +82 -119
  198. package/lib/Thumbnail.js +55 -67
  199. package/lib/ToggleButton.js +49 -68
  200. package/lib/ToggleButtonGroup.js +67 -104
  201. package/lib/Tooltip.js +55 -77
  202. package/lib/Well.js +30 -41
  203. package/lib/index.js +147 -214
  204. package/lib/utils/PropTypes.js +24 -31
  205. package/lib/utils/StyleConfig.js +13 -11
  206. package/lib/utils/ValidComponentChildren.js +34 -29
  207. package/lib/utils/bootstrapUtils.js +41 -52
  208. package/lib/utils/capitalize.js +2 -0
  209. package/lib/utils/createChainedFunction.js +8 -5
  210. package/lib/utils/deprecationWarning.js +37 -47
  211. package/lib/utils/index.js +11 -15
  212. package/lib/utils/splitComponentProps.js +5 -10
  213. package/package.json +58 -50
package/es/Nav.js CHANGED
@@ -1,8 +1,6 @@
1
- import _extends from 'babel-runtime/helpers/extends';
2
- import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
3
- import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
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 = function (_React$Component) {
111
- _inherits(Nav, _React$Component);
99
+ var Nav =
100
+ /*#__PURE__*/
101
+ function (_React$Component) {
102
+ _inheritsLoose(Nav, _React$Component);
112
103
 
113
104
  function Nav() {
114
- _classCallCheck(this, Nav);
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.componentDidUpdate = function componentDidUpdate() {
120
- var _this2 = this;
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 _getActiveProps = this.getActiveProps(),
131
- activeKey = _getActiveProps.activeKey,
132
- activeHref = _getActiveProps.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 _this2.isActive(child, activeKey, activeHref);
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
- Nav.prototype.getActiveProps = function getActiveProps() {
139
+ _proto.getActiveProps = function getActiveProps() {
152
140
  var tabContainer = this.context.$bs_tabContainer;
153
141
 
154
142
  if (tabContainer) {
155
- 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;
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
- Nav.prototype.getNextActiveChild = function getNextActiveChild(offset) {
164
- var _this3 = this;
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 _getActiveProps2 = this.getActiveProps(),
173
- activeKey = _getActiveProps2.activeKey,
174
- activeHref = _getActiveProps2.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 _this3.isActive(child, activeKey, activeHref);
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
- Nav.prototype.getTabProps = function getTabProps(child, tabContainer, navRole, active, onSelect) {
200
- var _this4 = this;
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 !== '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;
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 _this4.handleTabKeyDown(onSelect, event);
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
- Nav.prototype.handleTabKeyDown = function handleTabKeyDown(onSelect, event) {
241
- var nextActiveChild = void 0;
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
- Nav.prototype.isActive = function isActive(_ref2, activeKey, activeHref) {
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
- Nav.prototype.render = function render() {
262
+ _proto.render = function render() {
277
263
  var _extends2,
278
- _this5 = this;
279
-
280
- var _props = this.props,
281
- stacked = _props.stacked,
282
- justified = _props.justified,
283
- onSelect = _props.onSelect,
284
- propsRole = _props.role,
285
- propsNavbar = _props.navbar,
286
- pullRight = _props.pullRight,
287
- pullLeft = _props.pullLeft,
288
- className = _props.className,
289
- children = _props.children,
290
- props = _objectWithoutProperties(_props, ['stacked', 'justified', 'onSelect', 'role', 'navbar', 'pullRight', 'pullLeft', 'className', 'children']);
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 _getActiveProps3 = this.getActiveProps(),
296
- activeKey = _getActiveProps3.activeKey,
297
- activeHref = _getActiveProps3.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 = void 0;
310
- var pullRightClassName = void 0;
296
+ var pullLeftClassName;
297
+ var pullRightClassName;
311
298
 
312
299
  if (navbar) {
313
- var navbarProps = this.context.$bs_navbar || { bsClass: '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
- return React.createElement(
328
- 'ul',
329
- _extends({}, elementProps, {
330
- role: role,
331
- className: classNames(className, classes)
332
- }),
333
- ValidComponentChildren.map(children, function (child) {
334
- var active = _this5.isActive(child, activeKey, activeHref);
335
- var childOnSelect = createChainedFunction(child.props.onSelect, onSelect, navbar && navbar.onSelect, tabContainer && tabContainer.onSelect);
336
-
337
- return cloneElement(child, _extends({}, _this5.getTabProps(child, tabContainer, role, active, childOnSelect), {
338
- active: active,
339
- activeKey: activeKey,
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 _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
2
- import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
3
- import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
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 = function (_React$Component) {
31
- _inherits(NavDropdown, _React$Component);
26
+ var NavDropdown =
27
+ /*#__PURE__*/
28
+ function (_React$Component) {
29
+ _inheritsLoose(NavDropdown, _React$Component);
32
30
 
33
31
  function NavDropdown() {
34
- _classCallCheck(this, NavDropdown);
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.isActive = function isActive(_ref, activeKey, activeHref) {
40
- var props = _ref.props;
35
+ var _proto = NavDropdown.prototype;
41
36
 
42
- var _this2 = this;
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 _this2.isActive(child, activeKey, activeHref);
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
- NavDropdown.prototype.render = function render() {
58
- var _this3 = this;
55
+ _proto.render = function render() {
56
+ var _this2 = this;
59
57
 
60
- var _props = this.props,
61
- title = _props.title,
62
- activeKey = _props.activeKey,
63
- activeHref = _props.activeHref,
64
- className = _props.className,
65
- style = _props.style,
66
- children = _props.children,
67
- props = _objectWithoutProperties(_props, ['title', 'activeKey', 'activeHref', 'className', 'style', 'children']);
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
- return React.createElement(
81
- Dropdown,
82
- _extends({}, dropdownProps, {
83
- componentClass: 'li',
84
- className: classNames(className, { active: active }),
85
- style: style
77
+
78
+ return React.createElement(Dropdown, _extends({}, dropdownProps, {
79
+ componentClass: "li",
80
+ className: classNames(className, {
81
+ active: active
86
82
  }),
87
- React.createElement(
88
- Dropdown.Toggle,
89
- _extends({}, toggleProps, { useAnchor: true }),
90
- title
91
- ),
92
- React.createElement(
93
- Dropdown.Menu,
94
- null,
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 'babel-runtime/helpers/extends';
2
- import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
3
- import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
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";
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 = function (_React$Component) {
29
- _inherits(NavItem, _React$Component);
24
+ var NavItem =
25
+ /*#__PURE__*/
26
+ function (_React$Component) {
27
+ _inheritsLoose(NavItem, _React$Component);
30
28
 
31
29
  function NavItem(props, context) {
32
- _classCallCheck(this, NavItem);
30
+ var _this;
33
31
 
34
- var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
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.handleClick = function handleClick(e) {
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
- NavItem.prototype.render = function render() {
52
- var _props = this.props,
53
- active = _props.active,
54
- disabled = _props.disabled,
55
- onClick = _props.onClick,
56
- className = _props.className,
57
- style = _props.style,
58
- props = _objectWithoutProperties(_props, ['active', 'disabled', 'onClick', 'className', 'style']);
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
- 'li',
77
- {
78
- role: 'presentation',
79
- className: classNames(className, { active: active, disabled: disabled }),
80
- style: style
81
- },
82
- React.createElement(SafeAnchor, _extends({}, props, {
83
- disabled: disabled,
84
- onClick: createChainedFunction(onClick, this.handleClick)
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;