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/es/Alert.js CHANGED
@@ -53,10 +53,7 @@ var Alert = function (_React$Component) {
53
53
  role: 'alert',
54
54
  className: classNames(className, classes)
55
55
  }),
56
- dismissable && React.createElement(CloseButton, {
57
- onClick: onDismiss,
58
- label: closeLabel
59
- }),
56
+ dismissable && React.createElement(CloseButton, { onClick: onDismiss, label: closeLabel }),
60
57
  children
61
58
  );
62
59
  };
package/es/Badge.js CHANGED
@@ -64,9 +64,7 @@ var Badge = function (_React$Component) {
64
64
 
65
65
  return React.createElement(
66
66
  'span',
67
- _extends({}, elementProps, {
68
- className: classNames(className, classes)
69
- }),
67
+ _extends({}, elementProps, { className: classNames(className, classes) }),
70
68
  children
71
69
  );
72
70
  };
package/es/ButtonGroup.js CHANGED
@@ -57,9 +57,7 @@ var ButtonGroup = function (_React$Component) {
57
57
 
58
58
  var classes = _extends({}, getClassSet(bsProps), (_extends2 = {}, _extends2[prefix(bsProps)] = !vertical, _extends2[prefix(bsProps, 'vertical')] = vertical, _extends2[prefix(bsProps, 'justified')] = justified, _extends2[prefix(Button.defaultProps, 'block')] = block, _extends2));
59
59
 
60
- return React.createElement('div', _extends({}, elementProps, {
61
- className: classNames(className, classes)
62
- }));
60
+ return React.createElement('div', _extends({}, elementProps, { className: classNames(className, classes) }));
63
61
  };
64
62
 
65
63
  return ButtonGroup;
package/es/Carousel.js CHANGED
@@ -33,7 +33,7 @@ var propTypes = {
33
33
  * Callback fired when the active item changes.
34
34
  *
35
35
  * ```js
36
- * (eventKey: any) => any | (eventKey: any, event: Object) => any
36
+ * (eventKey: any, ?event: Object) => any
37
37
  * ```
38
38
  *
39
39
  * If this callback takes two or more arguments, the second argument will
@@ -101,6 +101,10 @@ var Carousel = function (_React$Component) {
101
101
  return _this;
102
102
  }
103
103
 
104
+ Carousel.prototype.componentDidMount = function componentDidMount() {
105
+ this.waitForNext();
106
+ };
107
+
104
108
  Carousel.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
105
109
  var activeIndex = this.getActiveIndex();
106
110
 
@@ -122,19 +126,37 @@ var Carousel = function (_React$Component) {
122
126
  }
123
127
  };
124
128
 
125
- Carousel.prototype.componentDidMount = function componentDidMount() {
126
- this.waitForNext();
127
- };
128
-
129
129
  Carousel.prototype.componentWillUnmount = function componentWillUnmount() {
130
130
  clearTimeout(this.timeout);
131
131
  this.isUnmounted = true;
132
132
  };
133
133
 
134
- Carousel.prototype.handleMouseOver = function handleMouseOver() {
135
- if (this.props.pauseOnHover) {
136
- this.pause();
134
+ Carousel.prototype.getActiveIndex = function getActiveIndex() {
135
+ var activeIndexProp = this.props.activeIndex;
136
+ return activeIndexProp != null ? activeIndexProp : this.state.activeIndex;
137
+ };
138
+
139
+ Carousel.prototype.getDirection = function getDirection(prevIndex, index) {
140
+ if (prevIndex === index) {
141
+ return null;
137
142
  }
143
+
144
+ return prevIndex > index ? 'prev' : 'next';
145
+ };
146
+
147
+ Carousel.prototype.handleItemAnimateOutEnd = function handleItemAnimateOutEnd() {
148
+ var _this2 = this;
149
+
150
+ this.setState({
151
+ previousActiveIndex: null,
152
+ direction: null
153
+ }, function () {
154
+ _this2.waitForNext();
155
+
156
+ if (_this2.props.onSlideEnd) {
157
+ _this2.props.onSlideEnd();
158
+ }
159
+ });
138
160
  };
139
161
 
140
162
  Carousel.prototype.handleMouseOut = function handleMouseOut() {
@@ -143,17 +165,10 @@ var Carousel = function (_React$Component) {
143
165
  }
144
166
  };
145
167
 
146
- Carousel.prototype.handlePrev = function handlePrev(e) {
147
- var index = this.getActiveIndex() - 1;
148
-
149
- if (index < 0) {
150
- if (!this.props.wrap) {
151
- return;
152
- }
153
- index = ValidComponentChildren.count(this.props.children) - 1;
168
+ Carousel.prototype.handleMouseOver = function handleMouseOver() {
169
+ if (this.props.pauseOnHover) {
170
+ this.pause();
154
171
  }
155
-
156
- this.select(index, e, 'prev');
157
172
  };
158
173
 
159
174
  Carousel.prototype.handleNext = function handleNext(e) {
@@ -170,32 +185,33 @@ var Carousel = function (_React$Component) {
170
185
  this.select(index, e, 'next');
171
186
  };
172
187
 
173
- Carousel.prototype.handleItemAnimateOutEnd = function handleItemAnimateOutEnd() {
174
- var _this2 = this;
175
-
176
- this.setState({
177
- previousActiveIndex: null,
178
- direction: null
179
- }, function () {
180
- _this2.waitForNext();
188
+ Carousel.prototype.handlePrev = function handlePrev(e) {
189
+ var index = this.getActiveIndex() - 1;
181
190
 
182
- if (_this2.props.onSlideEnd) {
183
- _this2.props.onSlideEnd();
191
+ if (index < 0) {
192
+ if (!this.props.wrap) {
193
+ return;
184
194
  }
185
- });
195
+ index = ValidComponentChildren.count(this.props.children) - 1;
196
+ }
197
+
198
+ this.select(index, e, 'prev');
186
199
  };
187
200
 
188
- Carousel.prototype.getActiveIndex = function getActiveIndex() {
189
- var activeIndexProp = this.props.activeIndex;
190
- return activeIndexProp != null ? activeIndexProp : this.state.activeIndex;
201
+ // This might be a public API.
202
+
203
+
204
+ Carousel.prototype.pause = function pause() {
205
+ this.isPaused = true;
206
+ clearTimeout(this.timeout);
191
207
  };
192
208
 
193
- Carousel.prototype.getDirection = function getDirection(prevIndex, index) {
194
- if (prevIndex === index) {
195
- return null;
196
- }
209
+ // This might be a public API.
197
210
 
198
- return prevIndex > index ? 'prev' : 'next';
211
+
212
+ Carousel.prototype.play = function play() {
213
+ this.isPaused = false;
214
+ this.waitForNext();
199
215
  };
200
216
 
201
217
  Carousel.prototype.select = function select(index, e, direction) {
@@ -260,48 +276,6 @@ var Carousel = function (_React$Component) {
260
276
  }
261
277
  };
262
278
 
263
- // This might be a public API.
264
-
265
-
266
- Carousel.prototype.pause = function pause() {
267
- this.isPaused = true;
268
- clearTimeout(this.timeout);
269
- };
270
-
271
- // This might be a public API.
272
-
273
-
274
- Carousel.prototype.play = function play() {
275
- this.isPaused = false;
276
- this.waitForNext();
277
- };
278
-
279
- Carousel.prototype.renderIndicators = function renderIndicators(children, activeIndex, bsProps) {
280
- var _this3 = this;
281
-
282
- var indicators = [];
283
-
284
- ValidComponentChildren.forEach(children, function (child, index) {
285
- indicators.push(React.createElement('li', {
286
- key: index,
287
- className: index === activeIndex ? 'active' : null,
288
- onClick: function onClick(e) {
289
- return _this3.select(index, e);
290
- }
291
- }),
292
-
293
- // Force whitespace between indicator elements. Bootstrap requires
294
- // this for correct spacing of elements.
295
- ' ');
296
- });
297
-
298
- return React.createElement(
299
- 'ol',
300
- { className: prefix(bsProps, 'indicators') },
301
- indicators
302
- );
303
- };
304
-
305
279
  Carousel.prototype.renderControls = function renderControls(properties) {
306
280
  var wrap = properties.wrap,
307
281
  children = properties.children,
@@ -344,6 +318,32 @@ var Carousel = function (_React$Component) {
344
318
  )];
345
319
  };
346
320
 
321
+ Carousel.prototype.renderIndicators = function renderIndicators(children, activeIndex, bsProps) {
322
+ var _this3 = this;
323
+
324
+ var indicators = [];
325
+
326
+ ValidComponentChildren.forEach(children, function (child, index) {
327
+ indicators.push(React.createElement('li', {
328
+ key: index,
329
+ className: index === activeIndex ? 'active' : null,
330
+ onClick: function onClick(e) {
331
+ return _this3.select(index, e);
332
+ }
333
+ }),
334
+
335
+ // Force whitespace between indicator elements. Bootstrap requires
336
+ // this for correct spacing of elements.
337
+ ' ');
338
+ });
339
+
340
+ return React.createElement(
341
+ 'ol',
342
+ { className: prefix(bsProps, 'indicators') },
343
+ indicators
344
+ );
345
+ };
346
+
347
347
  Carousel.prototype.render = function render() {
348
348
  var _this4 = this;
349
349
 
@@ -38,9 +38,7 @@ var CarouselCaption = function (_React$Component) {
38
38
 
39
39
  var classes = getClassSet(bsProps);
40
40
 
41
- return React.createElement(Component, _extends({}, elementProps, {
42
- className: classNames(className, classes)
43
- }));
41
+ return React.createElement(Component, _extends({}, elementProps, { className: classNames(className, classes) }));
44
42
  };
45
43
 
46
44
  return CarouselCaption;
@@ -7,11 +7,7 @@ import classNames from 'classnames';
7
7
  import React from 'react';
8
8
  import PropTypes from 'prop-types';
9
9
  import ReactDOM from 'react-dom';
10
-
11
- import TransitionEvents from './utils/TransitionEvents';
12
-
13
- // TODO: This should use a timeout instead of TransitionEvents, or else just
14
- // not wait until transition end to trigger continuing animations.
10
+ import transition from 'dom-helpers/transition';
15
11
 
16
12
  var propTypes = {
17
13
  direction: PropTypes.oneOf(['prev', 'next']),
@@ -60,7 +56,7 @@ var CarouselItem = function (_React$Component) {
60
56
  var prevActive = prevProps.active;
61
57
 
62
58
  if (!active && prevActive) {
63
- TransitionEvents.addEndEventListener(ReactDOM.findDOMNode(this), this.handleAnimateOutEnd);
59
+ transition.end(ReactDOM.findDOMNode(this), this.handleAnimateOutEnd);
64
60
  }
65
61
 
66
62
  if (active !== prevActive) {
@@ -117,9 +113,7 @@ var CarouselItem = function (_React$Component) {
117
113
  classes[this.state.direction] = true;
118
114
  }
119
115
 
120
- return React.createElement('div', _extends({}, props, {
121
- className: classNames(className, classes)
122
- }));
116
+ return React.createElement('div', _extends({}, props, { className: classNames(className, classes) }));
123
117
  };
124
118
 
125
119
  return CarouselItem;
package/es/Checkbox.js CHANGED
@@ -3,6 +3,8 @@ import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutPropert
3
3
  import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
4
4
  import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
5
5
  import _inherits from 'babel-runtime/helpers/inherits';
6
+ /* eslint-disable jsx-a11y/label-has-for */
7
+
6
8
  import classNames from 'classnames';
7
9
  import React from 'react';
8
10
  import PropTypes from 'prop-types';
@@ -76,7 +78,11 @@ var Checkbox = function (_React$Component) {
76
78
 
77
79
  return React.createElement(
78
80
  'label',
79
- { className: classNames(className, _classes), style: style, title: title },
81
+ {
82
+ className: classNames(className, _classes),
83
+ style: style,
84
+ title: title
85
+ },
80
86
  input,
81
87
  children
82
88
  );
package/es/Clearfix.js CHANGED
@@ -83,9 +83,7 @@ var Clearfix = function (_React$Component) {
83
83
  delete elementProps[propName];
84
84
  });
85
85
 
86
- return React.createElement(Component, _extends({}, elementProps, {
87
- className: classNames(className, classes)
88
- }));
86
+ return React.createElement(Component, _extends({}, elementProps, { className: classNames(className, classes) }));
89
87
  };
90
88
 
91
89
  return Clearfix;
package/es/CloseButton.js CHANGED
@@ -29,11 +29,7 @@ var CloseButton = function (_React$Component) {
29
29
 
30
30
  return React.createElement(
31
31
  'button',
32
- {
33
- type: 'button',
34
- className: 'close',
35
- onClick: onClick
36
- },
32
+ { type: 'button', className: 'close', onClick: onClick },
37
33
  React.createElement(
38
34
  'span',
39
35
  { 'aria-hidden': 'true' },
package/es/Col.js CHANGED
@@ -225,9 +225,7 @@ var Col = function (_React$Component) {
225
225
  delete elementProps[hiddenPropName];
226
226
  });
227
227
 
228
- return React.createElement(Component, _extends({}, elementProps, {
229
- className: classNames(className, classes)
230
- }));
228
+ return React.createElement(Component, _extends({}, elementProps, { className: classNames(className, classes) }));
231
229
  };
232
230
 
233
231
  return Col;
package/es/Collapse.js CHANGED
@@ -3,11 +3,14 @@ import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutPropert
3
3
  import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
4
4
  import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
5
5
  import _inherits from 'babel-runtime/helpers/inherits';
6
+
7
+ var _collapseStyles;
8
+
6
9
  import classNames from 'classnames';
7
10
  import css from 'dom-helpers/style';
8
11
  import React from 'react';
9
12
  import PropTypes from 'prop-types';
10
- import Transition from 'react-overlays/lib/Transition';
13
+ import Transition, { EXITED, ENTERED, ENTERING, EXITING } from 'react-transition-group/Transition';
11
14
 
12
15
  import capitalize from './utils/capitalize';
13
16
  import createChainedFunction from './utils/createChainedFunction';
@@ -30,11 +33,13 @@ function getDimensionValue(dimension, elem) {
30
33
  return value + parseInt(css(elem, margins[0]), 10) + parseInt(css(elem, margins[1]), 10);
31
34
  }
32
35
 
36
+ var collapseStyles = (_collapseStyles = {}, _collapseStyles[EXITED] = 'collapse', _collapseStyles[EXITING] = 'collapsing', _collapseStyles[ENTERING] = 'collapsing', _collapseStyles[ENTERED] = 'collapse in', _collapseStyles);
37
+
33
38
  var propTypes = {
34
39
  /**
35
40
  * Show the component; triggers the expand or collapse animation
36
41
  */
37
- 'in': PropTypes.bool,
42
+ in: PropTypes.bool,
38
43
 
39
44
  /**
40
45
  * Wait until the first "enter" transition to mount the component (add it to the DOM)
@@ -50,7 +55,7 @@ var propTypes = {
50
55
  * Run the expand animation when the component mounts, if it is initially
51
56
  * shown
52
57
  */
53
- transitionAppear: PropTypes.bool,
58
+ appear: PropTypes.bool,
54
59
 
55
60
  /**
56
61
  * Duration of the collapse animation in milliseconds, to ensure that
@@ -109,11 +114,11 @@ var propTypes = {
109
114
  };
110
115
 
111
116
  var defaultProps = {
112
- 'in': false,
117
+ in: false,
113
118
  timeout: 300,
114
119
  mountOnEnter: false,
115
120
  unmountOnExit: false,
116
- transitionAppear: false,
121
+ appear: false,
117
122
 
118
123
  dimension: 'height',
119
124
  getDimensionValue: getDimensionValue
@@ -122,52 +127,32 @@ var defaultProps = {
122
127
  var Collapse = function (_React$Component) {
123
128
  _inherits(Collapse, _React$Component);
124
129
 
125
- function Collapse(props, context) {
126
- _classCallCheck(this, Collapse);
130
+ function Collapse() {
131
+ var _temp, _this, _ret;
127
132
 
128
- var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
133
+ _classCallCheck(this, Collapse);
129
134
 
130
- _this.handleEnter = _this.handleEnter.bind(_this);
131
- _this.handleEntering = _this.handleEntering.bind(_this);
132
- _this.handleEntered = _this.handleEntered.bind(_this);
133
- _this.handleExit = _this.handleExit.bind(_this);
134
- _this.handleExiting = _this.handleExiting.bind(_this);
135
- return _this;
135
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
136
+ args[_key] = arguments[_key];
137
+ }
138
+
139
+ return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleEnter = function (elem) {
140
+ elem.style[_this.getDimension()] = '0';
141
+ }, _this.handleEntering = function (elem) {
142
+ var dimension = _this.getDimension();
143
+ elem.style[dimension] = _this._getScrollDimensionValue(elem, dimension);
144
+ }, _this.handleEntered = function (elem) {
145
+ elem.style[_this.getDimension()] = null;
146
+ }, _this.handleExit = function (elem) {
147
+ var dimension = _this.getDimension();
148
+ elem.style[dimension] = _this.props.getDimensionValue(dimension, elem) + 'px';
149
+ triggerBrowserReflow(elem);
150
+ }, _this.handleExiting = function (elem) {
151
+ elem.style[_this.getDimension()] = '0';
152
+ }, _temp), _possibleConstructorReturn(_this, _ret);
136
153
  }
137
154
 
138
- /* -- Expanding -- */
139
-
140
-
141
- Collapse.prototype.handleEnter = function handleEnter(elem) {
142
- var dimension = this._dimension();
143
- elem.style[dimension] = '0';
144
- };
145
-
146
- Collapse.prototype.handleEntering = function handleEntering(elem) {
147
- var dimension = this._dimension();
148
- elem.style[dimension] = this._getScrollDimensionValue(elem, dimension);
149
- };
150
-
151
- Collapse.prototype.handleEntered = function handleEntered(elem) {
152
- var dimension = this._dimension();
153
- elem.style[dimension] = null;
154
- };
155
-
156
- /* -- Collapsing -- */
157
-
158
-
159
- Collapse.prototype.handleExit = function handleExit(elem) {
160
- var dimension = this._dimension();
161
- elem.style[dimension] = this.props.getDimensionValue(dimension, elem) + 'px';
162
- triggerBrowserReflow(elem);
163
- };
164
-
165
- Collapse.prototype.handleExiting = function handleExiting(elem) {
166
- var dimension = this._dimension();
167
- elem.style[dimension] = '0';
168
- };
169
-
170
- Collapse.prototype._dimension = function _dimension() {
155
+ Collapse.prototype.getDimension = function getDimension() {
171
156
  return typeof this.props.dimension === 'function' ? this.props.dimension() : this.props.dimension;
172
157
  };
173
158
 
@@ -178,7 +163,15 @@ var Collapse = function (_React$Component) {
178
163
  return elem['scroll' + capitalize(dimension)] + 'px';
179
164
  };
180
165
 
166
+ /* -- Expanding -- */
167
+
168
+
169
+ /* -- Collapsing -- */
170
+
171
+
181
172
  Collapse.prototype.render = function render() {
173
+ var _this2 = this;
174
+
182
175
  var _props = this.props,
183
176
  onEnter = _props.onEnter,
184
177
  onEntering = _props.onEntering,
@@ -186,7 +179,8 @@ var Collapse = function (_React$Component) {
186
179
  onExit = _props.onExit,
187
180
  onExiting = _props.onExiting,
188
181
  className = _props.className,
189
- props = _objectWithoutProperties(_props, ['onEnter', 'onEntering', 'onEntered', 'onExit', 'onExiting', 'className']);
182
+ children = _props.children,
183
+ props = _objectWithoutProperties(_props, ['onEnter', 'onEntering', 'onEntered', 'onExit', 'onExiting', 'className', 'children']);
190
184
 
191
185
  delete props.dimension;
192
186
  delete props.getDimensionValue;
@@ -197,23 +191,22 @@ var Collapse = function (_React$Component) {
197
191
  var handleExit = createChainedFunction(this.handleExit, onExit);
198
192
  var handleExiting = createChainedFunction(this.handleExiting, onExiting);
199
193
 
200
- var classes = {
201
- width: this._dimension() === 'width'
202
- };
203
-
204
- return React.createElement(Transition, _extends({}, props, {
205
- 'aria-expanded': props.role ? props['in'] : null,
206
- className: classNames(className, classes),
207
- exitedClassName: 'collapse',
208
- exitingClassName: 'collapsing',
209
- enteredClassName: 'collapse in',
210
- enteringClassName: 'collapsing',
211
- onEnter: handleEnter,
212
- onEntering: handleEntering,
213
- onEntered: handleEntered,
214
- onExit: handleExit,
215
- onExiting: handleExiting
216
- }));
194
+ return React.createElement(
195
+ Transition,
196
+ _extends({}, props, {
197
+ 'aria-expanded': props.role ? props.in : null,
198
+ onEnter: handleEnter,
199
+ onEntering: handleEntering,
200
+ onEntered: handleEntered,
201
+ onExit: handleExit,
202
+ onExiting: handleExiting
203
+ }),
204
+ function (state, innerProps) {
205
+ return React.cloneElement(children, _extends({}, innerProps, {
206
+ className: classNames(className, children.props.className, collapseStyles[state], _this2.getDimension() === 'width' && 'width')
207
+ }));
208
+ }
209
+ );
217
210
  };
218
211
 
219
212
  return Collapse;