react-bootstrap 0.31.1 → 0.31.5

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 (131) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/dist/react-bootstrap.js +4811 -4179
  3. package/dist/react-bootstrap.min.js +9 -9
  4. package/dist/react-bootstrap.min.js.map +1 -1
  5. package/es/ButtonToolbar.js +2 -3
  6. package/es/Carousel.js +85 -77
  7. package/es/Checkbox.js +2 -0
  8. package/es/CloseButton.js +1 -1
  9. package/es/Collapse.js +18 -18
  10. package/es/Dropdown.js +50 -50
  11. package/es/DropdownMenu.js +28 -28
  12. package/es/Fade.js +2 -2
  13. package/es/FormControl.js +1 -2
  14. package/es/MediaBody.js +15 -2
  15. package/es/Modal.js +23 -15
  16. package/es/Nav.js +44 -44
  17. package/es/Navbar.js +4 -4
  18. package/es/OverlayTrigger.js +39 -39
  19. package/es/Panel.js +44 -44
  20. package/es/Radio.js +2 -0
  21. package/es/SafeAnchor.js +15 -2
  22. package/es/TabContent.js +5 -5
  23. package/es/TabPane.js +16 -16
  24. package/es/Tabs.js +2 -2
  25. package/es/Thumbnail.js +2 -0
  26. package/es/ToggleButton.js +8 -0
  27. package/es/ToggleButtonGroup.js +11 -6
  28. package/es/index.js +4 -0
  29. package/es/utils/TransitionEvents.js +11 -10
  30. package/es/utils/ValidComponentChildren.js +1 -1
  31. package/es/utils/bootstrapUtils.js +2 -1
  32. package/lib/Accordion.js +9 -9
  33. package/lib/Alert.js +14 -14
  34. package/lib/Badge.js +13 -13
  35. package/lib/Breadcrumb.js +10 -10
  36. package/lib/BreadcrumbItem.js +14 -14
  37. package/lib/Button.js +20 -20
  38. package/lib/ButtonGroup.js +13 -13
  39. package/lib/ButtonToolbar.js +9 -13
  40. package/lib/Carousel.js +127 -119
  41. package/lib/CarouselCaption.js +10 -10
  42. package/lib/CarouselItem.js +16 -16
  43. package/lib/Checkbox.js +21 -21
  44. package/lib/Clearfix.js +15 -15
  45. package/lib/CloseButton.js +12 -14
  46. package/lib/Col.js +30 -30
  47. package/lib/Collapse.js +47 -47
  48. package/lib/ControlLabel.js +14 -14
  49. package/lib/Dropdown.js +92 -92
  50. package/lib/DropdownButton.js +22 -22
  51. package/lib/DropdownMenu.js +51 -51
  52. package/lib/DropdownToggle.js +16 -16
  53. package/lib/Fade.js +20 -20
  54. package/lib/Form.js +12 -12
  55. package/lib/FormControl.js +17 -17
  56. package/lib/FormControlFeedback.js +13 -13
  57. package/lib/FormControlStatic.js +10 -10
  58. package/lib/FormGroup.js +15 -15
  59. package/lib/Glyphicon.js +11 -11
  60. package/lib/Grid.js +11 -11
  61. package/lib/HelpBlock.js +9 -9
  62. package/lib/Image.js +13 -13
  63. package/lib/InputGroup.js +11 -11
  64. package/lib/InputGroupAddon.js +9 -9
  65. package/lib/InputGroupButton.js +9 -9
  66. package/lib/Jumbotron.js +10 -10
  67. package/lib/Label.js +12 -12
  68. package/lib/ListGroup.js +16 -16
  69. package/lib/ListGroupItem.js +22 -22
  70. package/lib/Media.js +16 -16
  71. package/lib/MediaBody.js +29 -10
  72. package/lib/MediaHeading.js +10 -10
  73. package/lib/MediaLeft.js +11 -11
  74. package/lib/MediaList.js +9 -9
  75. package/lib/MediaListItem.js +9 -9
  76. package/lib/MediaRight.js +11 -11
  77. package/lib/MenuItem.js +23 -23
  78. package/lib/Modal.js +73 -65
  79. package/lib/ModalBody.js +10 -10
  80. package/lib/ModalDialog.js +16 -16
  81. package/lib/ModalFooter.js +10 -10
  82. package/lib/ModalHeader.js +17 -17
  83. package/lib/ModalTitle.js +10 -10
  84. package/lib/Nav.js +81 -81
  85. package/lib/NavDropdown.js +25 -25
  86. package/lib/NavItem.js +18 -18
  87. package/lib/Navbar.js +47 -47
  88. package/lib/NavbarBrand.js +14 -14
  89. package/lib/NavbarCollapse.js +14 -14
  90. package/lib/NavbarHeader.js +10 -10
  91. package/lib/NavbarToggle.js +22 -22
  92. package/lib/Overlay.js +25 -25
  93. package/lib/OverlayTrigger.js +75 -75
  94. package/lib/PageHeader.js +11 -11
  95. package/lib/PageItem.js +2 -2
  96. package/lib/Pager.js +14 -14
  97. package/lib/PagerItem.js +17 -17
  98. package/lib/Pagination.js +52 -52
  99. package/lib/PaginationButton.js +20 -20
  100. package/lib/Panel.js +76 -76
  101. package/lib/PanelGroup.js +18 -18
  102. package/lib/Popover.js +22 -22
  103. package/lib/ProgressBar.js +29 -29
  104. package/lib/Radio.js +21 -21
  105. package/lib/ResponsiveEmbed.js +17 -17
  106. package/lib/Row.js +10 -10
  107. package/lib/SafeAnchor.js +31 -16
  108. package/lib/SplitButton.js +26 -26
  109. package/lib/SplitToggle.js +8 -8
  110. package/lib/Tab.js +15 -15
  111. package/lib/TabContainer.js +17 -17
  112. package/lib/TabContent.js +29 -29
  113. package/lib/TabPane.js +57 -57
  114. package/lib/Table.js +16 -16
  115. package/lib/Tabs.js +28 -28
  116. package/lib/Thumbnail.js +19 -19
  117. package/lib/ToggleButton.js +23 -16
  118. package/lib/ToggleButtonGroup.js +38 -26
  119. package/lib/Tooltip.js +20 -20
  120. package/lib/Well.js +9 -9
  121. package/lib/index.js +83 -73
  122. package/lib/utils/PropTypes.js +5 -5
  123. package/lib/utils/TransitionEvents.js +12 -11
  124. package/lib/utils/ValidComponentChildren.js +19 -19
  125. package/lib/utils/bootstrapUtils.js +11 -10
  126. package/lib/utils/capitalize.js +1 -1
  127. package/lib/utils/createChainedFunction.js +1 -1
  128. package/lib/utils/deprecationWarning.js +7 -7
  129. package/lib/utils/index.js +4 -4
  130. package/lib/utils/splitComponentProps.js +3 -3
  131. package/package.json +20 -18
@@ -6,8 +6,7 @@ import _inherits from 'babel-runtime/helpers/inherits';
6
6
  import classNames from 'classnames';
7
7
  import React from 'react';
8
8
 
9
- import Button from './Button';
10
- import { bsClass, bsSizes, getClassSet, splitBsProps } from './utils/bootstrapUtils';
9
+ import { bsClass, getClassSet, splitBsProps } from './utils/bootstrapUtils';
11
10
 
12
11
  var ButtonToolbar = function (_React$Component) {
13
12
  _inherits(ButtonToolbar, _React$Component);
@@ -38,4 +37,4 @@ var ButtonToolbar = function (_React$Component) {
38
37
  return ButtonToolbar;
39
38
  }(React.Component);
40
39
 
41
- export default bsClass('btn-toolbar', bsSizes(Button.SIZES, ButtonToolbar));
40
+ export default bsClass('btn-toolbar', ButtonToolbar);
package/es/Carousel.js CHANGED
@@ -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
 
@@ -112,10 +116,14 @@ var Carousel = function (_React$Component) {
112
116
  direction: nextProps.direction != null ? nextProps.direction : this.getDirection(activeIndex, nextProps.activeIndex)
113
117
  });
114
118
  }
115
- };
116
119
 
117
- Carousel.prototype.componentDidMount = function componentDidMount() {
118
- this.waitForNext();
120
+ if (nextProps.activeIndex == null && this.state.activeIndex >= nextProps.children.length) {
121
+ this.setState({
122
+ activeIndex: 0,
123
+ previousActiveIndex: null,
124
+ direction: null
125
+ });
126
+ }
119
127
  };
120
128
 
121
129
  Carousel.prototype.componentWillUnmount = function componentWillUnmount() {
@@ -123,10 +131,32 @@ var Carousel = function (_React$Component) {
123
131
  this.isUnmounted = true;
124
132
  };
125
133
 
126
- Carousel.prototype.handleMouseOver = function handleMouseOver() {
127
- if (this.props.pauseOnHover) {
128
- 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;
129
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
+ });
130
160
  };
131
161
 
132
162
  Carousel.prototype.handleMouseOut = function handleMouseOut() {
@@ -135,17 +165,10 @@ var Carousel = function (_React$Component) {
135
165
  }
136
166
  };
137
167
 
138
- Carousel.prototype.handlePrev = function handlePrev(e) {
139
- var index = this.getActiveIndex() - 1;
140
-
141
- if (index < 0) {
142
- if (!this.props.wrap) {
143
- return;
144
- }
145
- index = ValidComponentChildren.count(this.props.children) - 1;
168
+ Carousel.prototype.handleMouseOver = function handleMouseOver() {
169
+ if (this.props.pauseOnHover) {
170
+ this.pause();
146
171
  }
147
-
148
- this.select(index, e, 'prev');
149
172
  };
150
173
 
151
174
  Carousel.prototype.handleNext = function handleNext(e) {
@@ -162,32 +185,33 @@ var Carousel = function (_React$Component) {
162
185
  this.select(index, e, 'next');
163
186
  };
164
187
 
165
- Carousel.prototype.handleItemAnimateOutEnd = function handleItemAnimateOutEnd() {
166
- var _this2 = this;
167
-
168
- this.setState({
169
- previousActiveIndex: null,
170
- direction: null
171
- }, function () {
172
- _this2.waitForNext();
188
+ Carousel.prototype.handlePrev = function handlePrev(e) {
189
+ var index = this.getActiveIndex() - 1;
173
190
 
174
- if (_this2.props.onSlideEnd) {
175
- _this2.props.onSlideEnd();
191
+ if (index < 0) {
192
+ if (!this.props.wrap) {
193
+ return;
176
194
  }
177
- });
195
+ index = ValidComponentChildren.count(this.props.children) - 1;
196
+ }
197
+
198
+ this.select(index, e, 'prev');
178
199
  };
179
200
 
180
- Carousel.prototype.getActiveIndex = function getActiveIndex() {
181
- var activeIndexProp = this.props.activeIndex;
182
- 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);
183
207
  };
184
208
 
185
- Carousel.prototype.getDirection = function getDirection(prevIndex, index) {
186
- if (prevIndex === index) {
187
- return null;
188
- }
209
+ // This might be a public API.
189
210
 
190
- return prevIndex > index ? 'prev' : 'next';
211
+
212
+ Carousel.prototype.play = function play() {
213
+ this.isPaused = false;
214
+ this.waitForNext();
191
215
  };
192
216
 
193
217
  Carousel.prototype.select = function select(index, e, direction) {
@@ -252,48 +276,6 @@ var Carousel = function (_React$Component) {
252
276
  }
253
277
  };
254
278
 
255
- // This might be a public API.
256
-
257
-
258
- Carousel.prototype.pause = function pause() {
259
- this.isPaused = true;
260
- clearTimeout(this.timeout);
261
- };
262
-
263
- // This might be a public API.
264
-
265
-
266
- Carousel.prototype.play = function play() {
267
- this.isPaused = false;
268
- this.waitForNext();
269
- };
270
-
271
- Carousel.prototype.renderIndicators = function renderIndicators(children, activeIndex, bsProps) {
272
- var _this3 = this;
273
-
274
- var indicators = [];
275
-
276
- ValidComponentChildren.forEach(children, function (child, index) {
277
- indicators.push(React.createElement('li', {
278
- key: index,
279
- className: index === activeIndex ? 'active' : null,
280
- onClick: function onClick(e) {
281
- return _this3.select(index, e);
282
- }
283
- }),
284
-
285
- // Force whitespace between indicator elements. Bootstrap requires
286
- // this for correct spacing of elements.
287
- ' ');
288
- });
289
-
290
- return React.createElement(
291
- 'ol',
292
- { className: prefix(bsProps, 'indicators') },
293
- indicators
294
- );
295
- };
296
-
297
279
  Carousel.prototype.renderControls = function renderControls(properties) {
298
280
  var wrap = properties.wrap,
299
281
  children = properties.children,
@@ -336,6 +318,32 @@ var Carousel = function (_React$Component) {
336
318
  )];
337
319
  };
338
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
+
339
347
  Carousel.prototype.render = function render() {
340
348
  var _this4 = this;
341
349
 
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';
package/es/CloseButton.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
2
2
  import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
3
3
  import _inherits from 'babel-runtime/helpers/inherits';
4
- import * as PropTypes from 'prop-types';
4
+ import PropTypes from 'prop-types';
5
5
  import React from 'react';
6
6
 
7
7
  var propTypes = {
package/es/Collapse.js CHANGED
@@ -34,7 +34,7 @@ var propTypes = {
34
34
  /**
35
35
  * Show the component; triggers the expand or collapse animation
36
36
  */
37
- 'in': PropTypes.bool,
37
+ in: PropTypes.bool,
38
38
 
39
39
  /**
40
40
  * Wait until the first "enter" transition to mount the component (add it to the DOM)
@@ -109,7 +109,7 @@ var propTypes = {
109
109
  };
110
110
 
111
111
  var defaultProps = {
112
- 'in': false,
112
+ in: false,
113
113
  timeout: 300,
114
114
  mountOnEnter: false,
115
115
  unmountOnExit: false,
@@ -135,6 +135,17 @@ var Collapse = function (_React$Component) {
135
135
  return _this;
136
136
  }
137
137
 
138
+ Collapse.prototype._dimension = function _dimension() {
139
+ return typeof this.props.dimension === 'function' ? this.props.dimension() : this.props.dimension;
140
+ };
141
+
142
+ // for testing
143
+
144
+
145
+ Collapse.prototype._getScrollDimensionValue = function _getScrollDimensionValue(elem, dimension) {
146
+ return elem['scroll' + capitalize(dimension)] + 'px';
147
+ };
148
+
138
149
  /* -- Expanding -- */
139
150
 
140
151
 
@@ -143,14 +154,14 @@ var Collapse = function (_React$Component) {
143
154
  elem.style[dimension] = '0';
144
155
  };
145
156
 
146
- Collapse.prototype.handleEntering = function handleEntering(elem) {
157
+ Collapse.prototype.handleEntered = function handleEntered(elem) {
147
158
  var dimension = this._dimension();
148
- elem.style[dimension] = this._getScrollDimensionValue(elem, dimension);
159
+ elem.style[dimension] = null;
149
160
  };
150
161
 
151
- Collapse.prototype.handleEntered = function handleEntered(elem) {
162
+ Collapse.prototype.handleEntering = function handleEntering(elem) {
152
163
  var dimension = this._dimension();
153
- elem.style[dimension] = null;
164
+ elem.style[dimension] = this._getScrollDimensionValue(elem, dimension);
154
165
  };
155
166
 
156
167
  /* -- Collapsing -- */
@@ -167,17 +178,6 @@ var Collapse = function (_React$Component) {
167
178
  elem.style[dimension] = '0';
168
179
  };
169
180
 
170
- Collapse.prototype._dimension = function _dimension() {
171
- return typeof this.props.dimension === 'function' ? this.props.dimension() : this.props.dimension;
172
- };
173
-
174
- // for testing
175
-
176
-
177
- Collapse.prototype._getScrollDimensionValue = function _getScrollDimensionValue(elem, dimension) {
178
- return elem['scroll' + capitalize(dimension)] + 'px';
179
- };
180
-
181
181
  Collapse.prototype.render = function render() {
182
182
  var _props = this.props,
183
183
  onEnter = _props.onEnter,
@@ -202,7 +202,7 @@ var Collapse = function (_React$Component) {
202
202
  };
203
203
 
204
204
  return React.createElement(Transition, _extends({}, props, {
205
- 'aria-expanded': props.role ? props['in'] : null,
205
+ 'aria-expanded': props.role ? props.in : null,
206
206
  className: classNames(className, classes),
207
207
  exitedClassName: 'collapse',
208
208
  exitingClassName: 'collapsing',
package/es/Dropdown.js CHANGED
@@ -1,5 +1,5 @@
1
- import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
2
1
  import _extends from 'babel-runtime/helpers/extends';
2
+ import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
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';
@@ -158,6 +158,26 @@ var Dropdown = function (_React$Component) {
158
158
  }
159
159
  };
160
160
 
161
+ Dropdown.prototype.focus = function focus() {
162
+ var toggle = ReactDOM.findDOMNode(this.toggle);
163
+
164
+ if (toggle && toggle.focus) {
165
+ toggle.focus();
166
+ }
167
+ };
168
+
169
+ Dropdown.prototype.focusNextOnOpen = function focusNextOnOpen() {
170
+ var menu = this.menu;
171
+
172
+ if (!menu.focusNext) {
173
+ return;
174
+ }
175
+
176
+ if (this.lastOpenEventType === 'keydown' || this.props.role === 'menuitem') {
177
+ menu.focusNext();
178
+ }
179
+ };
180
+
161
181
  Dropdown.prototype.handleClick = function handleClick(event) {
162
182
  if (this.props.disabled) {
163
183
  return;
@@ -166,6 +186,14 @@ var Dropdown = function (_React$Component) {
166
186
  this.toggleOpen(event, { source: 'click' });
167
187
  };
168
188
 
189
+ Dropdown.prototype.handleClose = function handleClose(event, eventDetails) {
190
+ if (!this.props.open) {
191
+ return;
192
+ }
193
+
194
+ this.toggleOpen(event, eventDetails);
195
+ };
196
+
169
197
  Dropdown.prototype.handleKeyDown = function handleKeyDown(event) {
170
198
  if (this.props.disabled) {
171
199
  return;
@@ -200,82 +228,54 @@ var Dropdown = function (_React$Component) {
200
228
  }
201
229
  };
202
230
 
203
- Dropdown.prototype.handleClose = function handleClose(event, eventDetails) {
204
- if (!this.props.open) {
205
- return;
206
- }
207
-
208
- this.toggleOpen(event, eventDetails);
209
- };
210
-
211
- Dropdown.prototype.focusNextOnOpen = function focusNextOnOpen() {
212
- var menu = this.menu;
213
-
214
- if (!menu.focusNext) {
215
- return;
216
- }
217
-
218
- if (this.lastOpenEventType === 'keydown' || this.props.role === 'menuitem') {
219
- menu.focusNext();
220
- }
221
- };
222
-
223
- Dropdown.prototype.focus = function focus() {
224
- var toggle = ReactDOM.findDOMNode(this.toggle);
225
-
226
- if (toggle && toggle.focus) {
227
- toggle.focus();
228
- }
229
- };
230
-
231
- Dropdown.prototype.renderToggle = function renderToggle(child, props) {
231
+ Dropdown.prototype.renderMenu = function renderMenu(child, _ref) {
232
232
  var _this2 = this;
233
233
 
234
+ var id = _ref.id,
235
+ onSelect = _ref.onSelect,
236
+ rootCloseEvent = _ref.rootCloseEvent,
237
+ props = _objectWithoutProperties(_ref, ['id', 'onSelect', 'rootCloseEvent']);
238
+
234
239
  var ref = function ref(c) {
235
- _this2.toggle = c;
240
+ _this2.menu = c;
236
241
  };
237
242
 
238
243
  if (typeof child.ref === 'string') {
239
- process.env.NODE_ENV !== 'production' ? warning(false, 'String refs are not supported on `<Dropdown.Toggle>` components. ' + 'To apply a ref to the component use the callback signature:\n\n ' + 'https://facebook.github.io/react/docs/more-about-refs.html#the-ref-callback-attribute') : void 0;
244
+ process.env.NODE_ENV !== 'production' ? warning(false, 'String refs are not supported on `<Dropdown.Menu>` components. ' + 'To apply a ref to the component use the callback signature:\n\n ' + 'https://facebook.github.io/react/docs/more-about-refs.html#the-ref-callback-attribute') : void 0;
240
245
  } else {
241
246
  ref = createChainedFunction(child.ref, ref);
242
247
  }
243
248
 
244
249
  return cloneElement(child, _extends({}, props, {
245
250
  ref: ref,
246
- bsClass: prefix(props, 'toggle'),
247
- onClick: createChainedFunction(child.props.onClick, this.handleClick),
248
- onKeyDown: createChainedFunction(child.props.onKeyDown, this.handleKeyDown)
251
+ labelledBy: id,
252
+ bsClass: prefix(props, 'menu'),
253
+ onClose: createChainedFunction(child.props.onClose, this.handleClose),
254
+ onSelect: createChainedFunction(child.props.onSelect, onSelect, function (key, event) {
255
+ return _this2.handleClose(event, { source: 'select' });
256
+ }),
257
+ rootCloseEvent: rootCloseEvent
249
258
  }));
250
259
  };
251
260
 
252
- Dropdown.prototype.renderMenu = function renderMenu(child, _ref) {
261
+ Dropdown.prototype.renderToggle = function renderToggle(child, props) {
253
262
  var _this3 = this;
254
263
 
255
- var id = _ref.id,
256
- onSelect = _ref.onSelect,
257
- rootCloseEvent = _ref.rootCloseEvent,
258
- props = _objectWithoutProperties(_ref, ['id', 'onSelect', 'rootCloseEvent']);
259
-
260
264
  var ref = function ref(c) {
261
- _this3.menu = c;
265
+ _this3.toggle = c;
262
266
  };
263
267
 
264
268
  if (typeof child.ref === 'string') {
265
- process.env.NODE_ENV !== 'production' ? warning(false, 'String refs are not supported on `<Dropdown.Menu>` components. ' + 'To apply a ref to the component use the callback signature:\n\n ' + 'https://facebook.github.io/react/docs/more-about-refs.html#the-ref-callback-attribute') : void 0;
269
+ process.env.NODE_ENV !== 'production' ? warning(false, 'String refs are not supported on `<Dropdown.Toggle>` components. ' + 'To apply a ref to the component use the callback signature:\n\n ' + 'https://facebook.github.io/react/docs/more-about-refs.html#the-ref-callback-attribute') : void 0;
266
270
  } else {
267
271
  ref = createChainedFunction(child.ref, ref);
268
272
  }
269
273
 
270
274
  return cloneElement(child, _extends({}, props, {
271
275
  ref: ref,
272
- labelledBy: id,
273
- bsClass: prefix(props, 'menu'),
274
- onClose: createChainedFunction(child.props.onClose, this.handleClose),
275
- onSelect: createChainedFunction(child.props.onSelect, onSelect, function (key, event) {
276
- return _this3.handleClose(event, { source: 'select' });
277
- }),
278
- rootCloseEvent: rootCloseEvent
276
+ bsClass: prefix(props, 'toggle'),
277
+ onClick: createChainedFunction(child.props.onClick, this.handleClick),
278
+ onKeyDown: createChainedFunction(child.props.onKeyDown, this.handleKeyDown)
279
279
  }));
280
280
  };
281
281
 
@@ -42,26 +42,13 @@ var DropdownMenu = function (_React$Component) {
42
42
  return _this;
43
43
  }
44
44
 
45
- DropdownMenu.prototype.handleRootClose = function handleRootClose(event) {
46
- this.props.onClose(event, { source: 'rootClose' });
47
- };
48
-
49
- DropdownMenu.prototype.handleKeyDown = function handleKeyDown(event) {
50
- switch (event.keyCode) {
51
- case keycode.codes.down:
52
- this.focusNext();
53
- event.preventDefault();
54
- break;
55
- case keycode.codes.up:
56
- this.focusPrevious();
57
- event.preventDefault();
58
- break;
59
- case keycode.codes.esc:
60
- case keycode.codes.tab:
61
- this.props.onClose(event, { source: 'keydown' });
62
- break;
63
- default:
45
+ DropdownMenu.prototype.getFocusableMenuItems = function getFocusableMenuItems() {
46
+ var node = ReactDOM.findDOMNode(this);
47
+ if (!node) {
48
+ return [];
64
49
  }
50
+
51
+ return _Array$from(node.querySelectorAll('[tabIndex="-1"]'));
65
52
  };
66
53
 
67
54
  DropdownMenu.prototype.getItemsAndActiveIndex = function getItemsAndActiveIndex() {
@@ -71,15 +58,6 @@ var DropdownMenu = function (_React$Component) {
71
58
  return { items: items, activeIndex: activeIndex };
72
59
  };
73
60
 
74
- DropdownMenu.prototype.getFocusableMenuItems = function getFocusableMenuItems() {
75
- var node = ReactDOM.findDOMNode(this);
76
- if (!node) {
77
- return [];
78
- }
79
-
80
- return _Array$from(node.querySelectorAll('[tabIndex="-1"]'));
81
- };
82
-
83
61
  DropdownMenu.prototype.focusNext = function focusNext() {
84
62
  var _getItemsAndActiveInd = this.getItemsAndActiveIndex(),
85
63
  items = _getItemsAndActiveInd.items,
@@ -106,6 +84,28 @@ var DropdownMenu = function (_React$Component) {
106
84
  items[prevIndex].focus();
107
85
  };
108
86
 
87
+ DropdownMenu.prototype.handleKeyDown = function handleKeyDown(event) {
88
+ switch (event.keyCode) {
89
+ case keycode.codes.down:
90
+ this.focusNext();
91
+ event.preventDefault();
92
+ break;
93
+ case keycode.codes.up:
94
+ this.focusPrevious();
95
+ event.preventDefault();
96
+ break;
97
+ case keycode.codes.esc:
98
+ case keycode.codes.tab:
99
+ this.props.onClose(event, { source: 'keydown' });
100
+ break;
101
+ default:
102
+ }
103
+ };
104
+
105
+ DropdownMenu.prototype.handleRootClose = function handleRootClose(event) {
106
+ this.props.onClose(event, { source: 'rootClose' });
107
+ };
108
+
109
109
  DropdownMenu.prototype.render = function render() {
110
110
  var _extends2,
111
111
  _this2 = this;
package/es/Fade.js CHANGED
@@ -11,7 +11,7 @@ var propTypes = {
11
11
  /**
12
12
  * Show the component; triggers the fade in or fade out animation
13
13
  */
14
- 'in': PropTypes.bool,
14
+ in: PropTypes.bool,
15
15
 
16
16
  /**
17
17
  * Wait until the first "enter" transition to mount the component (add it to the DOM)
@@ -63,7 +63,7 @@ var propTypes = {
63
63
  };
64
64
 
65
65
  var defaultProps = {
66
- 'in': false,
66
+ in: false,
67
67
  timeout: 300,
68
68
  mountOnEnter: false,
69
69
  unmountOnExit: false,
package/es/FormControl.js CHANGED
@@ -11,9 +11,8 @@ import warning from 'warning';
11
11
 
12
12
  import FormControlFeedback from './FormControlFeedback';
13
13
  import FormControlStatic from './FormControlStatic';
14
- import { bsClass, getClassSet, splitBsProps, bsSizes } from './utils/bootstrapUtils';
14
+ import { prefix, bsClass, getClassSet, splitBsProps, bsSizes } from './utils/bootstrapUtils';
15
15
  import { SIZE_MAP, Size } from './utils/StyleConfig';
16
- import { prefix } from './utils/bootstrapUtils';
17
16
 
18
17
  var propTypes = {
19
18
  componentClass: elementType,
package/es/MediaBody.js CHANGED
@@ -5,11 +5,18 @@ import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructo
5
5
  import _inherits from 'babel-runtime/helpers/inherits';
6
6
  import classNames from 'classnames';
7
7
  import React from 'react';
8
+ import PropTypes from 'prop-types';
8
9
  import elementType from 'prop-types-extra/lib/elementType';
9
10
 
10
- import { bsClass, getClassSet, splitBsProps } from './utils/bootstrapUtils';
11
+ import Media from './Media';
12
+ import { bsClass, getClassSet, prefix, splitBsProps } from './utils/bootstrapUtils';
11
13
 
12
14
  var propTypes = {
15
+ /**
16
+ * Align the media to the top, middle, or bottom of the media object.
17
+ */
18
+ align: PropTypes.oneOf(['top', 'middle', 'bottom']),
19
+
13
20
  componentClass: elementType
14
21
  };
15
22
 
@@ -29,8 +36,9 @@ var MediaBody = function (_React$Component) {
29
36
  MediaBody.prototype.render = function render() {
30
37
  var _props = this.props,
31
38
  Component = _props.componentClass,
39
+ align = _props.align,
32
40
  className = _props.className,
33
- props = _objectWithoutProperties(_props, ['componentClass', 'className']);
41
+ props = _objectWithoutProperties(_props, ['componentClass', 'align', 'className']);
34
42
 
35
43
  var _splitBsProps = splitBsProps(props),
36
44
  bsProps = _splitBsProps[0],
@@ -38,6 +46,11 @@ var MediaBody = function (_React$Component) {
38
46
 
39
47
  var classes = getClassSet(bsProps);
40
48
 
49
+ if (align) {
50
+ // The class is e.g. `media-top`, not `media-left-top`.
51
+ classes[prefix(Media.defaultProps, align)] = true;
52
+ }
53
+
41
54
  return React.createElement(Component, _extends({}, elementProps, {
42
55
  className: classNames(className, classes)
43
56
  }));