react-bootstrap 0.30.6 → 0.30.10

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 (138) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/LICENSE +2 -2
  3. package/dist/react-bootstrap.js +3161 -1664
  4. package/dist/react-bootstrap.min.js +9 -9
  5. package/dist/react-bootstrap.min.js.map +1 -1
  6. package/es/Alert.js +3 -2
  7. package/es/Badge.js +2 -1
  8. package/es/BreadcrumbItem.js +5 -4
  9. package/es/Button.js +7 -6
  10. package/es/ButtonGroup.js +4 -3
  11. package/es/Carousel.js +17 -16
  12. package/es/CarouselItem.js +7 -6
  13. package/es/Checkbox.js +5 -4
  14. package/es/Clearfix.js +5 -4
  15. package/es/Col.js +21 -20
  16. package/es/Collapse.js +20 -13
  17. package/es/ControlLabel.js +4 -3
  18. package/es/Dropdown.js +34 -22
  19. package/es/DropdownButton.js +6 -5
  20. package/es/DropdownMenu.js +19 -14
  21. package/es/DropdownToggle.js +5 -4
  22. package/es/Fade.js +17 -10
  23. package/es/Form.js +3 -2
  24. package/es/FormControl.js +27 -6
  25. package/es/FormControlFeedback.js +2 -1
  26. package/es/FormGroup.js +4 -3
  27. package/es/Glyphicon.js +3 -2
  28. package/es/Grid.js +2 -1
  29. package/es/Image.js +5 -4
  30. package/es/ListGroupItem.js +8 -7
  31. package/es/MediaLeft.js +2 -1
  32. package/es/MediaRight.js +2 -1
  33. package/es/MenuItem.js +9 -8
  34. package/es/Modal.js +22 -15
  35. package/es/ModalBody.js +15 -2
  36. package/es/ModalDialog.js +2 -1
  37. package/es/ModalFooter.js +15 -2
  38. package/es/ModalHeader.js +7 -6
  39. package/es/ModalTitle.js +15 -2
  40. package/es/Nav.js +20 -19
  41. package/es/NavDropdown.js +5 -4
  42. package/es/NavItem.js +8 -7
  43. package/es/Navbar.js +17 -15
  44. package/es/NavbarBrand.js +3 -2
  45. package/es/NavbarCollapse.js +2 -1
  46. package/es/NavbarHeader.js +3 -2
  47. package/es/NavbarToggle.js +2 -1
  48. package/es/Overlay.js +18 -11
  49. package/es/OverlayTrigger.js +20 -18
  50. package/es/Pager.js +2 -1
  51. package/es/PagerItem.js +7 -6
  52. package/es/Pagination.js +54 -60
  53. package/es/PaginationButton.js +7 -6
  54. package/es/Panel.js +17 -20
  55. package/es/PanelGroup.js +6 -5
  56. package/es/Popover.js +8 -7
  57. package/es/ProgressBar.js +2 -1
  58. package/es/Radio.js +5 -4
  59. package/es/ResponsiveEmbed.js +2 -1
  60. package/es/SafeAnchor.js +6 -5
  61. package/es/SplitButton.js +8 -7
  62. package/es/Tab.js +4 -3
  63. package/es/TabContainer.js +3 -2
  64. package/es/TabContent.js +12 -2
  65. package/es/TabPane.js +15 -5
  66. package/es/Table.js +6 -5
  67. package/es/Tabs.js +16 -7
  68. package/es/Thumbnail.js +4 -3
  69. package/es/Tooltip.js +7 -6
  70. package/es/index.js +2 -0
  71. package/es/utils/bootstrapUtils.js +1 -1
  72. package/lib/Alert.js +6 -2
  73. package/lib/Badge.js +5 -1
  74. package/lib/BreadcrumbItem.js +8 -4
  75. package/lib/Button.js +10 -6
  76. package/lib/ButtonGroup.js +7 -3
  77. package/lib/Carousel.js +20 -16
  78. package/lib/CarouselItem.js +10 -6
  79. package/lib/Checkbox.js +8 -4
  80. package/lib/Clearfix.js +8 -4
  81. package/lib/Col.js +24 -20
  82. package/lib/Collapse.js +23 -13
  83. package/lib/ControlLabel.js +7 -3
  84. package/lib/Dropdown.js +37 -22
  85. package/lib/DropdownButton.js +9 -5
  86. package/lib/DropdownMenu.js +21 -13
  87. package/lib/DropdownToggle.js +8 -4
  88. package/lib/Fade.js +20 -10
  89. package/lib/Form.js +6 -2
  90. package/lib/FormControl.js +29 -5
  91. package/lib/FormControlFeedback.js +5 -1
  92. package/lib/FormGroup.js +7 -3
  93. package/lib/Glyphicon.js +6 -2
  94. package/lib/Grid.js +5 -1
  95. package/lib/Image.js +8 -4
  96. package/lib/ListGroupItem.js +11 -7
  97. package/lib/MediaLeft.js +5 -1
  98. package/lib/MediaRight.js +5 -1
  99. package/lib/MenuItem.js +12 -8
  100. package/lib/Modal.js +25 -15
  101. package/lib/ModalBody.js +18 -2
  102. package/lib/ModalDialog.js +5 -1
  103. package/lib/ModalFooter.js +18 -2
  104. package/lib/ModalHeader.js +10 -6
  105. package/lib/ModalTitle.js +18 -2
  106. package/lib/Nav.js +23 -19
  107. package/lib/NavDropdown.js +8 -4
  108. package/lib/NavItem.js +11 -7
  109. package/lib/Navbar.js +27 -25
  110. package/lib/NavbarBrand.js +6 -2
  111. package/lib/NavbarCollapse.js +7 -3
  112. package/lib/NavbarHeader.js +6 -2
  113. package/lib/NavbarToggle.js +10 -6
  114. package/lib/Overlay.js +21 -11
  115. package/lib/OverlayTrigger.js +23 -18
  116. package/lib/Pager.js +5 -1
  117. package/lib/PagerItem.js +10 -6
  118. package/lib/Pagination.js +58 -61
  119. package/lib/PaginationButton.js +10 -6
  120. package/lib/Panel.js +20 -20
  121. package/lib/PanelGroup.js +9 -5
  122. package/lib/Popover.js +11 -7
  123. package/lib/ProgressBar.js +12 -8
  124. package/lib/Radio.js +8 -4
  125. package/lib/ResponsiveEmbed.js +7 -3
  126. package/lib/SafeAnchor.js +9 -5
  127. package/lib/SplitButton.js +11 -7
  128. package/lib/Tab.js +7 -3
  129. package/lib/TabContainer.js +13 -9
  130. package/lib/TabContent.js +26 -13
  131. package/lib/TabPane.js +38 -25
  132. package/lib/Table.js +9 -5
  133. package/lib/Tabs.js +19 -7
  134. package/lib/Thumbnail.js +7 -3
  135. package/lib/Tooltip.js +10 -6
  136. package/lib/index.js +6 -1
  137. package/lib/utils/bootstrapUtils.js +6 -4
  138. package/package.json +10 -8
package/es/Dropdown.js CHANGED
@@ -8,6 +8,7 @@ import activeElement from 'dom-helpers/activeElement';
8
8
  import contains from 'dom-helpers/query/contains';
9
9
  import keycode from 'keycode';
10
10
  import React, { cloneElement } from 'react';
11
+ import PropTypes from 'prop-types';
11
12
  import ReactDOM from 'react-dom';
12
13
  import all from 'react-prop-types/lib/all';
13
14
  import elementType from 'react-prop-types/lib/elementType';
@@ -30,14 +31,14 @@ var propTypes = {
30
31
  /**
31
32
  * The menu will open above the dropdown button, instead of below it.
32
33
  */
33
- dropup: React.PropTypes.bool,
34
+ dropup: PropTypes.bool,
34
35
 
35
36
  /**
36
37
  * An html id attribute, necessary for assistive technologies, such as screen readers.
37
38
  * @type {string|number}
38
39
  * @required
39
40
  */
40
- id: isRequiredForA11y(React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.number])),
41
+ id: isRequiredForA11y(PropTypes.oneOfType([PropTypes.string, PropTypes.number])),
41
42
 
42
43
  componentClass: elementType,
43
44
 
@@ -50,35 +51,35 @@ var propTypes = {
50
51
  /**
51
52
  * Whether or not component is disabled.
52
53
  */
53
- disabled: React.PropTypes.bool,
54
+ disabled: PropTypes.bool,
54
55
 
55
56
  /**
56
57
  * Align the menu to the right side of the Dropdown toggle
57
58
  */
58
- pullRight: React.PropTypes.bool,
59
+ pullRight: PropTypes.bool,
59
60
 
60
61
  /**
61
62
  * Whether or not the Dropdown is visible.
62
63
  *
63
64
  * @controllable onToggle
64
65
  */
65
- open: React.PropTypes.bool,
66
+ open: PropTypes.bool,
66
67
 
67
68
  /**
68
69
  * A callback fired when the Dropdown closes.
69
70
  */
70
- onClose: React.PropTypes.func,
71
+ onClose: PropTypes.func,
71
72
 
72
73
  /**
73
74
  * A callback fired when the Dropdown wishes to change visibility. Called with the requested
74
- * `open` value.
75
+ * `open` value, the DOM event, and the source that fired it: `'click'`,`'keydown'`,`'rootClose'`, or `'select'`.
75
76
  *
76
77
  * ```js
77
- * function(Boolean isOpen) {}
78
+ * function(Boolean isOpen, Object event, { String source }) {}
78
79
  * ```
79
80
  * @controllable open
80
81
  */
81
- onToggle: React.PropTypes.func,
82
+ onToggle: PropTypes.func,
82
83
 
83
84
  /**
84
85
  * A callback fired when a menu item is selected.
@@ -87,18 +88,27 @@ var propTypes = {
87
88
  * (eventKey: any, event: Object) => any
88
89
  * ```
89
90
  */
90
- onSelect: React.PropTypes.func,
91
+ onSelect: PropTypes.func,
91
92
 
92
93
  /**
93
94
  * If `'menuitem'`, causes the dropdown to behave like a menu item rather than
94
95
  * a menu button.
95
96
  */
96
- role: React.PropTypes.string,
97
+ role: PropTypes.string,
97
98
 
98
99
  /**
99
100
  * Which event when fired outside the component will cause it to be closed
100
101
  */
101
- rootCloseEvent: React.PropTypes.oneOf(['click', 'mousedown'])
102
+ rootCloseEvent: PropTypes.oneOf(['click', 'mousedown']),
103
+
104
+ /**
105
+ * @private
106
+ */
107
+ onMouseEnter: PropTypes.func,
108
+ /**
109
+ * @private
110
+ */
111
+ onMouseLeave: PropTypes.func
102
112
  };
103
113
 
104
114
  var defaultProps = {
@@ -151,12 +161,12 @@ var Dropdown = function (_React$Component) {
151
161
  }
152
162
  };
153
163
 
154
- Dropdown.prototype.handleClick = function handleClick() {
164
+ Dropdown.prototype.handleClick = function handleClick(event) {
155
165
  if (this.props.disabled) {
156
166
  return;
157
167
  }
158
168
 
159
- this.toggleOpen('click');
169
+ this.toggleOpen(event, { source: 'click' });
160
170
  };
161
171
 
162
172
  Dropdown.prototype.handleKeyDown = function handleKeyDown(event) {
@@ -167,7 +177,7 @@ var Dropdown = function (_React$Component) {
167
177
  switch (event.keyCode) {
168
178
  case keycode.codes.down:
169
179
  if (!this.props.open) {
170
- this.toggleOpen('keydown');
180
+ this.toggleOpen(event, { source: 'keydown' });
171
181
  } else if (this.menu.focusNext) {
172
182
  this.menu.focusNext();
173
183
  }
@@ -175,30 +185,30 @@ var Dropdown = function (_React$Component) {
175
185
  break;
176
186
  case keycode.codes.esc:
177
187
  case keycode.codes.tab:
178
- this.handleClose(event);
188
+ this.handleClose(event, { source: 'keydown' });
179
189
  break;
180
190
  default:
181
191
  }
182
192
  };
183
193
 
184
- Dropdown.prototype.toggleOpen = function toggleOpen(eventType) {
194
+ Dropdown.prototype.toggleOpen = function toggleOpen(event, eventDetails) {
185
195
  var open = !this.props.open;
186
196
 
187
197
  if (open) {
188
- this.lastOpenEventType = eventType;
198
+ this.lastOpenEventType = eventDetails.source;
189
199
  }
190
200
 
191
201
  if (this.props.onToggle) {
192
- this.props.onToggle(open);
202
+ this.props.onToggle(open, event, eventDetails);
193
203
  }
194
204
  };
195
205
 
196
- Dropdown.prototype.handleClose = function handleClose() {
206
+ Dropdown.prototype.handleClose = function handleClose(event, eventDetails) {
197
207
  if (!this.props.open) {
198
208
  return;
199
209
  }
200
210
 
201
- this.toggleOpen(null);
211
+ this.toggleOpen(event, eventDetails);
202
212
  };
203
213
 
204
214
  Dropdown.prototype.focusNextOnOpen = function focusNextOnOpen() {
@@ -266,7 +276,9 @@ var Dropdown = function (_React$Component) {
266
276
  labelledBy: id,
267
277
  bsClass: prefix(props, 'menu'),
268
278
  onClose: createChainedFunction(child.props.onClose, onClose, this.handleClose),
269
- onSelect: createChainedFunction(child.props.onSelect, onSelect, this.handleClose),
279
+ onSelect: createChainedFunction(child.props.onSelect, onSelect, function (key, event) {
280
+ return _this3.handleClose(event, { source: 'select' });
281
+ }),
270
282
  rootCloseEvent: rootCloseEvent
271
283
  }));
272
284
  };
@@ -4,6 +4,7 @@ import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructo
4
4
  import _inherits from 'babel-runtime/helpers/inherits';
5
5
  import _extends from 'babel-runtime/helpers/extends';
6
6
  import React from 'react';
7
+ import PropTypes from 'prop-types';
7
8
 
8
9
  import Dropdown from './Dropdown';
9
10
  import splitComponentProps from './utils/splitComponentProps';
@@ -11,16 +12,16 @@ import splitComponentProps from './utils/splitComponentProps';
11
12
  var propTypes = _extends({}, Dropdown.propTypes, {
12
13
 
13
14
  // Toggle props.
14
- bsStyle: React.PropTypes.string,
15
- bsSize: React.PropTypes.string,
16
- title: React.PropTypes.node.isRequired,
17
- noCaret: React.PropTypes.bool,
15
+ bsStyle: PropTypes.string,
16
+ bsSize: PropTypes.string,
17
+ title: PropTypes.node.isRequired,
18
+ noCaret: PropTypes.bool,
18
19
 
19
20
  // Override generated docs from <Dropdown>.
20
21
  /**
21
22
  * @private
22
23
  */
23
- children: React.PropTypes.node
24
+ children: PropTypes.node
24
25
  });
25
26
 
26
27
  var DropdownButton = function (_React$Component) {
@@ -7,20 +7,21 @@ import _inherits from 'babel-runtime/helpers/inherits';
7
7
  import classNames from 'classnames';
8
8
  import keycode from 'keycode';
9
9
  import React from 'react';
10
+ import PropTypes from 'prop-types';
10
11
  import ReactDOM from 'react-dom';
11
12
  import RootCloseWrapper from 'react-overlays/lib/RootCloseWrapper';
12
13
 
13
- import { bsClass, getClassSet, prefix, splitBsProps } from './utils/bootstrapUtils';
14
+ import { bsClass, getClassSet, prefix, splitBsPropsAndOmit } from './utils/bootstrapUtils';
14
15
  import createChainedFunction from './utils/createChainedFunction';
15
16
  import ValidComponentChildren from './utils/ValidComponentChildren';
16
17
 
17
18
  var propTypes = {
18
- open: React.PropTypes.bool,
19
- pullRight: React.PropTypes.bool,
20
- onClose: React.PropTypes.func,
21
- labelledBy: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.number]),
22
- onSelect: React.PropTypes.func,
23
- rootCloseEvent: React.PropTypes.oneOf(['click', 'mousedown'])
19
+ open: PropTypes.bool,
20
+ pullRight: PropTypes.bool,
21
+ onClose: PropTypes.func,
22
+ labelledBy: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
23
+ onSelect: PropTypes.func,
24
+ rootCloseEvent: PropTypes.oneOf(['click', 'mousedown'])
24
25
  };
25
26
 
26
27
  var defaultProps = {
@@ -36,10 +37,15 @@ var DropdownMenu = function (_React$Component) {
36
37
 
37
38
  var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
38
39
 
40
+ _this.handleRootClose = _this.handleRootClose.bind(_this);
39
41
  _this.handleKeyDown = _this.handleKeyDown.bind(_this);
40
42
  return _this;
41
43
  }
42
44
 
45
+ DropdownMenu.prototype.handleRootClose = function handleRootClose(event) {
46
+ this.props.onClose(event, { source: 'rootClose' });
47
+ };
48
+
43
49
  DropdownMenu.prototype.handleKeyDown = function handleKeyDown(event) {
44
50
  switch (event.keyCode) {
45
51
  case keycode.codes.down:
@@ -52,7 +58,7 @@ var DropdownMenu = function (_React$Component) {
52
58
  break;
53
59
  case keycode.codes.esc:
54
60
  case keycode.codes.tab:
55
- this.props.onClose(event);
61
+ this.props.onClose(event, { source: 'keydown' });
56
62
  break;
57
63
  default:
58
64
  }
@@ -107,17 +113,16 @@ var DropdownMenu = function (_React$Component) {
107
113
  var _props = this.props,
108
114
  open = _props.open,
109
115
  pullRight = _props.pullRight,
110
- onClose = _props.onClose,
111
116
  labelledBy = _props.labelledBy,
112
117
  onSelect = _props.onSelect,
113
118
  className = _props.className,
114
119
  rootCloseEvent = _props.rootCloseEvent,
115
120
  children = _props.children,
116
- props = _objectWithoutProperties(_props, ['open', 'pullRight', 'onClose', 'labelledBy', 'onSelect', 'className', 'rootCloseEvent', 'children']);
121
+ props = _objectWithoutProperties(_props, ['open', 'pullRight', 'labelledBy', 'onSelect', 'className', 'rootCloseEvent', 'children']);
117
122
 
118
- var _splitBsProps = splitBsProps(props),
119
- bsProps = _splitBsProps[0],
120
- elementProps = _splitBsProps[1];
123
+ var _splitBsPropsAndOmit = splitBsPropsAndOmit(props, ['onClose']),
124
+ bsProps = _splitBsPropsAndOmit[0],
125
+ elementProps = _splitBsPropsAndOmit[1];
121
126
 
122
127
  var classes = _extends({}, getClassSet(bsProps), (_extends2 = {}, _extends2[prefix(bsProps, 'right')] = pullRight, _extends2));
123
128
 
@@ -125,7 +130,7 @@ var DropdownMenu = function (_React$Component) {
125
130
  RootCloseWrapper,
126
131
  {
127
132
  disabled: !open,
128
- onRootClose: onClose,
133
+ onRootClose: this.handleRootClose,
129
134
  event: rootCloseEvent
130
135
  },
131
136
  React.createElement(
@@ -4,6 +4,7 @@ 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
6
  import React from 'react';
7
+ import PropTypes from 'prop-types';
7
8
  import classNames from 'classnames';
8
9
  import Button from './Button';
9
10
  import SafeAnchor from './SafeAnchor';
@@ -11,10 +12,10 @@ import SafeAnchor from './SafeAnchor';
11
12
  import { bsClass as setBsClass } from './utils/bootstrapUtils';
12
13
 
13
14
  var propTypes = {
14
- noCaret: React.PropTypes.bool,
15
- open: React.PropTypes.bool,
16
- title: React.PropTypes.string,
17
- useAnchor: React.PropTypes.bool
15
+ noCaret: PropTypes.bool,
16
+ open: PropTypes.bool,
17
+ title: PropTypes.string,
18
+ useAnchor: PropTypes.bool
18
19
  };
19
20
 
20
21
  var defaultProps = {
package/es/Fade.js CHANGED
@@ -4,61 +4,68 @@ import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructo
4
4
  import _inherits from 'babel-runtime/helpers/inherits';
5
5
  import classNames from 'classnames';
6
6
  import React from 'react';
7
+ import PropTypes from 'prop-types';
7
8
  import Transition from 'react-overlays/lib/Transition';
8
9
 
9
10
  var propTypes = {
10
11
  /**
11
12
  * Show the component; triggers the fade in or fade out animation
12
13
  */
13
- 'in': React.PropTypes.bool,
14
+ 'in': PropTypes.bool,
15
+
16
+ /**
17
+ * Wait until the first "enter" transition to mount the component (add it to the DOM)
18
+ */
19
+ mountOnEnter: PropTypes.bool,
14
20
 
15
21
  /**
16
22
  * Unmount the component (remove it from the DOM) when it is faded out
17
23
  */
18
- unmountOnExit: React.PropTypes.bool,
24
+ unmountOnExit: PropTypes.bool,
19
25
 
20
26
  /**
21
27
  * Run the fade in animation when the component mounts, if it is initially
22
28
  * shown
23
29
  */
24
- transitionAppear: React.PropTypes.bool,
30
+ transitionAppear: PropTypes.bool,
25
31
 
26
32
  /**
27
33
  * Duration of the fade animation in milliseconds, to ensure that finishing
28
34
  * callbacks are fired even if the original browser transition end events are
29
35
  * canceled
30
36
  */
31
- timeout: React.PropTypes.number,
37
+ timeout: PropTypes.number,
32
38
 
33
39
  /**
34
40
  * Callback fired before the component fades in
35
41
  */
36
- onEnter: React.PropTypes.func,
42
+ onEnter: PropTypes.func,
37
43
  /**
38
44
  * Callback fired after the component starts to fade in
39
45
  */
40
- onEntering: React.PropTypes.func,
46
+ onEntering: PropTypes.func,
41
47
  /**
42
48
  * Callback fired after the has component faded in
43
49
  */
44
- onEntered: React.PropTypes.func,
50
+ onEntered: PropTypes.func,
45
51
  /**
46
52
  * Callback fired before the component fades out
47
53
  */
48
- onExit: React.PropTypes.func,
54
+ onExit: PropTypes.func,
49
55
  /**
50
56
  * Callback fired after the component starts to fade out
51
57
  */
52
- onExiting: React.PropTypes.func,
58
+ onExiting: PropTypes.func,
53
59
  /**
54
60
  * Callback fired after the component has faded out
55
61
  */
56
- onExited: React.PropTypes.func
62
+ onExited: PropTypes.func
57
63
  };
58
64
 
59
65
  var defaultProps = {
60
66
  'in': false,
61
67
  timeout: 300,
68
+ mountOnEnter: false,
62
69
  unmountOnExit: false,
63
70
  transitionAppear: false
64
71
  };
package/es/Form.js CHANGED
@@ -5,13 +5,14 @@ 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 'react-prop-types/lib/elementType';
9
10
 
10
11
  import { bsClass, prefix, splitBsProps } from './utils/bootstrapUtils';
11
12
 
12
13
  var propTypes = {
13
- horizontal: React.PropTypes.bool,
14
- inline: React.PropTypes.bool,
14
+ horizontal: PropTypes.bool,
15
+ inline: PropTypes.bool,
15
16
  componentClass: elementType
16
17
  };
17
18
 
package/es/FormControl.js CHANGED
@@ -5,23 +5,34 @@ 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 'react-prop-types/lib/elementType';
9
10
  import warning from 'warning';
10
11
 
11
12
  import FormControlFeedback from './FormControlFeedback';
12
13
  import FormControlStatic from './FormControlStatic';
13
- import { bsClass, getClassSet, splitBsProps } from './utils/bootstrapUtils';
14
+ import { bsClass, getClassSet, splitBsProps, bsSizes } from './utils/bootstrapUtils';
15
+ import { SIZE_MAP, Size } from './utils/StyleConfig';
16
+ import { prefix } from './utils/bootstrapUtils';
14
17
 
15
18
  var propTypes = {
16
19
  componentClass: elementType,
17
20
  /**
18
21
  * Only relevant if `componentClass` is `'input'`.
19
22
  */
20
- type: React.PropTypes.string,
23
+ type: PropTypes.string,
21
24
  /**
22
25
  * Uses `controlId` from `<FormGroup>` if not explicitly specified.
23
26
  */
24
- id: React.PropTypes.string
27
+ id: PropTypes.string,
28
+ /**
29
+ * Attaches a ref to the `<input>` element. Only functions can be used here.
30
+ *
31
+ * ```js
32
+ * <FormControl inputRef={ref => { this.input = ref; }} />
33
+ * ```
34
+ */
35
+ inputRef: PropTypes.func
25
36
  };
26
37
 
27
38
  var defaultProps = {
@@ -29,7 +40,7 @@ var defaultProps = {
29
40
  };
30
41
 
31
42
  var contextTypes = {
32
- $bs_formGroup: React.PropTypes.object
43
+ $bs_formGroup: PropTypes.object
33
44
  };
34
45
 
35
46
  var FormControl = function (_React$Component) {
@@ -50,8 +61,10 @@ var FormControl = function (_React$Component) {
50
61
  type = _props.type,
51
62
  _props$id = _props.id,
52
63
  id = _props$id === undefined ? controlId : _props$id,
64
+ inputRef = _props.inputRef,
53
65
  className = _props.className,
54
- props = _objectWithoutProperties(_props, ['componentClass', 'type', 'id', 'className']);
66
+ bsSize = _props.bsSize,
67
+ props = _objectWithoutProperties(_props, ['componentClass', 'type', 'id', 'inputRef', 'className', 'bsSize']);
55
68
 
56
69
  var _splitBsProps = splitBsProps(props),
57
70
  bsProps = _splitBsProps[0],
@@ -65,9 +78,17 @@ var FormControl = function (_React$Component) {
65
78
  classes = getClassSet(bsProps);
66
79
  }
67
80
 
81
+ // If user provides a size, make sure to append it to classes as input-
82
+ // e.g. if bsSize is small, it will append input-sm
83
+ if (bsSize) {
84
+ var size = SIZE_MAP[bsSize] || bsSize;
85
+ classes[prefix({ bsClass: 'input' }, size)] = true;
86
+ }
87
+
68
88
  return React.createElement(Component, _extends({}, elementProps, {
69
89
  type: type,
70
90
  id: id,
91
+ ref: inputRef,
71
92
  className: classNames(className, classes)
72
93
  }));
73
94
  };
@@ -82,4 +103,4 @@ FormControl.contextTypes = contextTypes;
82
103
  FormControl.Feedback = FormControlFeedback;
83
104
  FormControl.Static = FormControlStatic;
84
105
 
85
- export default bsClass('form-control', FormControl);
106
+ export default bsClass('form-control', bsSizes([Size.SMALL, Size.LARGE], FormControl));
@@ -5,6 +5,7 @@ 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
 
9
10
  import Glyphicon from './Glyphicon';
10
11
  import { bsClass, getClassSet, splitBsProps } from './utils/bootstrapUtils';
@@ -14,7 +15,7 @@ var defaultProps = {
14
15
  };
15
16
 
16
17
  var contextTypes = {
17
- $bs_formGroup: React.PropTypes.object
18
+ $bs_formGroup: PropTypes.object
18
19
  };
19
20
 
20
21
  var FormControlFeedback = function (_React$Component) {
package/es/FormGroup.js CHANGED
@@ -5,6 +5,7 @@ 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
 
9
10
  import { bsClass, bsSizes, getClassSet, splitBsPropsAndOmit } from './utils/bootstrapUtils';
10
11
  import { Size } from './utils/StyleConfig';
@@ -14,12 +15,12 @@ var propTypes = {
14
15
  /**
15
16
  * Sets `id` on `<FormControl>` and `htmlFor` on `<FormGroup.Label>`.
16
17
  */
17
- controlId: React.PropTypes.string,
18
- validationState: React.PropTypes.oneOf(['success', 'warning', 'error'])
18
+ controlId: PropTypes.string,
19
+ validationState: PropTypes.oneOf(['success', 'warning', 'error', null])
19
20
  };
20
21
 
21
22
  var childContextTypes = {
22
- $bs_formGroup: React.PropTypes.object.isRequired
23
+ $bs_formGroup: PropTypes.object.isRequired
23
24
  };
24
25
 
25
26
  var FormGroup = function (_React$Component) {
package/es/Glyphicon.js CHANGED
@@ -5,14 +5,15 @@ 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
 
9
10
  import { bsClass, getClassSet, prefix, splitBsProps } from './utils/bootstrapUtils';
10
11
 
11
12
  var propTypes = {
12
13
  /**
13
- * An icon name. See e.g. http://getbootstrap.com/components/#glyphicons
14
+ * An icon name without "glyphicon-" prefix. See e.g. http://getbootstrap.com/components/#glyphicons
14
15
  */
15
- glyph: React.PropTypes.string.isRequired
16
+ glyph: PropTypes.string.isRequired
16
17
  };
17
18
 
18
19
  var Glyphicon = function (_React$Component) {
package/es/Grid.js CHANGED
@@ -5,6 +5,7 @@ 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 'react-prop-types/lib/elementType';
9
10
 
10
11
  import { bsClass, prefix, splitBsProps } from './utils/bootstrapUtils';
@@ -15,7 +16,7 @@ var propTypes = {
15
16
  *
16
17
  * Adds `container-fluid` class.
17
18
  */
18
- fluid: React.PropTypes.bool,
19
+ fluid: PropTypes.bool,
19
20
  /**
20
21
  * You can use a custom element for this component
21
22
  */
package/es/Image.js CHANGED
@@ -5,6 +5,7 @@ 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
 
9
10
  import { bsClass, prefix, splitBsProps } from './utils/bootstrapUtils';
10
11
 
@@ -12,22 +13,22 @@ var propTypes = {
12
13
  /**
13
14
  * Sets image as responsive image
14
15
  */
15
- responsive: React.PropTypes.bool,
16
+ responsive: PropTypes.bool,
16
17
 
17
18
  /**
18
19
  * Sets image shape as rounded
19
20
  */
20
- rounded: React.PropTypes.bool,
21
+ rounded: PropTypes.bool,
21
22
 
22
23
  /**
23
24
  * Sets image shape as circle
24
25
  */
25
- circle: React.PropTypes.bool,
26
+ circle: PropTypes.bool,
26
27
 
27
28
  /**
28
29
  * Sets image shape as thumbnail
29
30
  */
30
- thumbnail: React.PropTypes.bool
31
+ thumbnail: PropTypes.bool
31
32
  };
32
33
 
33
34
  var defaultProps = {
@@ -6,18 +6,19 @@ import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructo
6
6
  import _inherits from 'babel-runtime/helpers/inherits';
7
7
  import classNames from 'classnames';
8
8
  import React, { cloneElement } from 'react';
9
+ import PropTypes from 'prop-types';
9
10
 
10
11
  import { bsClass, bsStyles, getClassSet, prefix, splitBsProps } from './utils/bootstrapUtils';
11
12
  import { State } from './utils/StyleConfig';
12
13
 
13
14
  var propTypes = {
14
- active: React.PropTypes.any,
15
- disabled: React.PropTypes.any,
16
- header: React.PropTypes.node,
17
- listItem: React.PropTypes.bool,
18
- onClick: React.PropTypes.func,
19
- href: React.PropTypes.string,
20
- type: React.PropTypes.string
15
+ active: PropTypes.any,
16
+ disabled: PropTypes.any,
17
+ header: PropTypes.node,
18
+ listItem: PropTypes.bool,
19
+ onClick: PropTypes.func,
20
+ href: PropTypes.string,
21
+ type: PropTypes.string
21
22
  };
22
23
 
23
24
  var defaultProps = {
package/es/MediaLeft.js CHANGED
@@ -5,6 +5,7 @@ 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
 
9
10
  import Media from './Media';
10
11
  import { bsClass, getClassSet, prefix, splitBsProps } from './utils/bootstrapUtils';
@@ -13,7 +14,7 @@ var propTypes = {
13
14
  /**
14
15
  * Align the media to the top, middle, or bottom of the media object.
15
16
  */
16
- align: React.PropTypes.oneOf(['top', 'middle', 'bottom'])
17
+ align: PropTypes.oneOf(['top', 'middle', 'bottom'])
17
18
  };
18
19
 
19
20
  var MediaLeft = function (_React$Component) {
package/es/MediaRight.js CHANGED
@@ -5,6 +5,7 @@ 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
 
9
10
  import Media from './Media';
10
11
  import { bsClass, getClassSet, prefix, splitBsProps } from './utils/bootstrapUtils';
@@ -13,7 +14,7 @@ var propTypes = {
13
14
  /**
14
15
  * Align the media to the top, middle, or bottom of the media object.
15
16
  */
16
- align: React.PropTypes.oneOf(['top', 'middle', 'bottom'])
17
+ align: PropTypes.oneOf(['top', 'middle', 'bottom'])
17
18
  };
18
19
 
19
20
  var MediaRight = function (_React$Component) {