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/Pagination.js CHANGED
@@ -1,77 +1,14 @@
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';
6
6
  import classNames from 'classnames';
7
7
  import React from 'react';
8
- import PropTypes from 'prop-types';
9
- import elementType from 'prop-types-extra/lib/elementType';
10
8
 
11
- import PaginationButton from './PaginationButton';
9
+ import PaginationItem, { First, Prev, Ellipsis, Next, Last } from './PaginationItem';
12
10
  import { bsClass, getClassSet, splitBsProps } from './utils/bootstrapUtils';
13
11
 
14
- var propTypes = {
15
- activePage: PropTypes.number,
16
- items: PropTypes.number,
17
- maxButtons: PropTypes.number,
18
-
19
- /**
20
- * When `true`, will display the first and the last button page when
21
- * displaying ellipsis.
22
- */
23
- boundaryLinks: PropTypes.bool,
24
-
25
- /**
26
- * When `true`, will display the default node value ('…').
27
- * Otherwise, will display provided node (when specified).
28
- */
29
- ellipsis: PropTypes.oneOfType([PropTypes.bool, PropTypes.node]),
30
-
31
- /**
32
- * When `true`, will display the default node value ('«').
33
- * Otherwise, will display provided node (when specified).
34
- */
35
- first: PropTypes.oneOfType([PropTypes.bool, PropTypes.node]),
36
-
37
- /**
38
- * When `true`, will display the default node value ('»').
39
- * Otherwise, will display provided node (when specified).
40
- */
41
- last: PropTypes.oneOfType([PropTypes.bool, PropTypes.node]),
42
-
43
- /**
44
- * When `true`, will display the default node value ('‹').
45
- * Otherwise, will display provided node (when specified).
46
- */
47
- prev: PropTypes.oneOfType([PropTypes.bool, PropTypes.node]),
48
-
49
- /**
50
- * When `true`, will display the default node value ('›').
51
- * Otherwise, will display provided node (when specified).
52
- */
53
- next: PropTypes.oneOfType([PropTypes.bool, PropTypes.node]),
54
-
55
- onSelect: PropTypes.func,
56
-
57
- /**
58
- * You can use a custom element for the buttons
59
- */
60
- buttonComponentClass: elementType
61
- };
62
-
63
- var defaultProps = {
64
- activePage: 1,
65
- items: 1,
66
- maxButtons: 0,
67
- first: false,
68
- last: false,
69
- prev: false,
70
- next: false,
71
- ellipsis: true,
72
- boundaryLinks: false
73
- };
74
-
75
12
  var Pagination = function (_React$Component) {
76
13
  _inherits(Pagination, _React$Component);
77
14
 
@@ -81,108 +18,11 @@ var Pagination = function (_React$Component) {
81
18
  return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
82
19
  }
83
20
 
84
- Pagination.prototype.renderPageButtons = function renderPageButtons(activePage, items, maxButtons, boundaryLinks, ellipsis, buttonProps) {
85
- var pageButtons = [];
86
-
87
- var startPage = void 0;
88
- var endPage = void 0;
89
-
90
- if (maxButtons && maxButtons < items) {
91
- startPage = Math.max(Math.min(activePage - Math.floor(maxButtons / 2, 10), items - maxButtons + 1), 1);
92
- endPage = startPage + maxButtons - 1;
93
- } else {
94
- startPage = 1;
95
- endPage = items;
96
- }
97
-
98
- for (var page = startPage; page <= endPage; ++page) {
99
- pageButtons.push(React.createElement(
100
- PaginationButton,
101
- _extends({}, buttonProps, {
102
- key: page,
103
- eventKey: page,
104
- active: page === activePage
105
- }),
106
- page
107
- ));
108
- }
109
-
110
- if (ellipsis && boundaryLinks && startPage > 1) {
111
- if (startPage > 2) {
112
- pageButtons.unshift(React.createElement(
113
- PaginationButton,
114
- {
115
- key: 'ellipsisFirst',
116
- disabled: true,
117
- componentClass: buttonProps.componentClass
118
- },
119
- React.createElement(
120
- 'span',
121
- { 'aria-label': 'More' },
122
- ellipsis === true ? '\u2026' : ellipsis
123
- )
124
- ));
125
- }
126
-
127
- pageButtons.unshift(React.createElement(
128
- PaginationButton,
129
- _extends({}, buttonProps, {
130
- key: 1,
131
- eventKey: 1,
132
- active: false
133
- }),
134
- '1'
135
- ));
136
- }
137
-
138
- if (ellipsis && endPage < items) {
139
- if (!boundaryLinks || endPage < items - 1) {
140
- pageButtons.push(React.createElement(
141
- PaginationButton,
142
- {
143
- key: 'ellipsis',
144
- disabled: true,
145
- componentClass: buttonProps.componentClass
146
- },
147
- React.createElement(
148
- 'span',
149
- { 'aria-label': 'More' },
150
- ellipsis === true ? '\u2026' : ellipsis
151
- )
152
- ));
153
- }
154
-
155
- if (boundaryLinks) {
156
- pageButtons.push(React.createElement(
157
- PaginationButton,
158
- _extends({}, buttonProps, {
159
- key: items,
160
- eventKey: items,
161
- active: false
162
- }),
163
- items
164
- ));
165
- }
166
- }
167
-
168
- return pageButtons;
169
- };
170
-
171
21
  Pagination.prototype.render = function render() {
172
22
  var _props = this.props,
173
- activePage = _props.activePage,
174
- items = _props.items,
175
- maxButtons = _props.maxButtons,
176
- boundaryLinks = _props.boundaryLinks,
177
- ellipsis = _props.ellipsis,
178
- first = _props.first,
179
- last = _props.last,
180
- prev = _props.prev,
181
- next = _props.next,
182
- onSelect = _props.onSelect,
183
- buttonComponentClass = _props.buttonComponentClass,
184
23
  className = _props.className,
185
- props = _objectWithoutProperties(_props, ['activePage', 'items', 'maxButtons', 'boundaryLinks', 'ellipsis', 'first', 'last', 'prev', 'next', 'onSelect', 'buttonComponentClass', 'className']);
24
+ children = _props.children,
25
+ props = _objectWithoutProperties(_props, ['className', 'children']);
186
26
 
187
27
  var _splitBsProps = splitBsProps(props),
188
28
  bsProps = _splitBsProps[0],
@@ -190,72 +30,23 @@ var Pagination = function (_React$Component) {
190
30
 
191
31
  var classes = getClassSet(bsProps);
192
32
 
193
- var buttonProps = {
194
- onSelect: onSelect,
195
- componentClass: buttonComponentClass
196
- };
197
-
198
33
  return React.createElement(
199
34
  'ul',
200
- _extends({}, elementProps, {
201
- className: classNames(className, classes)
202
- }),
203
- first && React.createElement(
204
- PaginationButton,
205
- _extends({}, buttonProps, {
206
- eventKey: 1,
207
- disabled: activePage === 1
208
- }),
209
- React.createElement(
210
- 'span',
211
- { 'aria-label': 'First' },
212
- first === true ? '\xAB' : first
213
- )
214
- ),
215
- prev && React.createElement(
216
- PaginationButton,
217
- _extends({}, buttonProps, {
218
- eventKey: activePage - 1,
219
- disabled: activePage === 1
220
- }),
221
- React.createElement(
222
- 'span',
223
- { 'aria-label': 'Previous' },
224
- prev === true ? '\u2039' : prev
225
- )
226
- ),
227
- this.renderPageButtons(activePage, items, maxButtons, boundaryLinks, ellipsis, buttonProps),
228
- next && React.createElement(
229
- PaginationButton,
230
- _extends({}, buttonProps, {
231
- eventKey: activePage + 1,
232
- disabled: activePage >= items
233
- }),
234
- React.createElement(
235
- 'span',
236
- { 'aria-label': 'Next' },
237
- next === true ? '\u203A' : next
238
- )
239
- ),
240
- last && React.createElement(
241
- PaginationButton,
242
- _extends({}, buttonProps, {
243
- eventKey: items,
244
- disabled: activePage >= items
245
- }),
246
- React.createElement(
247
- 'span',
248
- { 'aria-label': 'Last' },
249
- last === true ? '\xBB' : last
250
- )
251
- )
35
+ _extends({}, elementProps, { className: classNames(className, classes) }),
36
+ children
252
37
  );
253
38
  };
254
39
 
255
40
  return Pagination;
256
41
  }(React.Component);
257
42
 
258
- Pagination.propTypes = propTypes;
259
- Pagination.defaultProps = defaultProps;
43
+ bsClass('pagination', Pagination);
44
+
45
+ Pagination.First = First;
46
+ Pagination.Prev = Prev;
47
+ Pagination.Ellipsis = Ellipsis;
48
+ Pagination.Item = PaginationItem;
49
+ Pagination.Next = Next;
50
+ Pagination.Last = Last;
260
51
 
261
- export default bsClass('pagination', Pagination);
52
+ export default Pagination;
@@ -0,0 +1,102 @@
1
+ import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
2
+ import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
3
+ import _inherits from 'babel-runtime/helpers/inherits';
4
+ import _extends from 'babel-runtime/helpers/extends';
5
+ import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
6
+ /* eslint-disable react/no-multi-comp */
7
+ import classNames from 'classnames';
8
+ import PropTypes from 'prop-types';
9
+ import React from 'react';
10
+
11
+ import SafeAnchor from './SafeAnchor';
12
+
13
+ var propTypes = {
14
+ eventKey: PropTypes.any,
15
+ className: PropTypes.string,
16
+ onSelect: PropTypes.func,
17
+ disabled: PropTypes.bool,
18
+ active: PropTypes.bool,
19
+ activeLabel: PropTypes.string.isRequired
20
+ };
21
+
22
+ var defaultProps = {
23
+ active: false,
24
+ disabled: false,
25
+ activeLabel: '(current)'
26
+ };
27
+
28
+ export default function PaginationItem(_ref) {
29
+ var active = _ref.active,
30
+ disabled = _ref.disabled,
31
+ className = _ref.className,
32
+ style = _ref.style,
33
+ activeLabel = _ref.activeLabel,
34
+ children = _ref.children,
35
+ props = _objectWithoutProperties(_ref, ['active', 'disabled', 'className', 'style', 'activeLabel', 'children']);
36
+
37
+ var Component = active || disabled ? 'span' : SafeAnchor;
38
+ return React.createElement(
39
+ 'li',
40
+ { style: style, className: classNames(className, { active: active, disabled: disabled }) },
41
+ React.createElement(
42
+ Component,
43
+ _extends({ disabled: disabled }, props),
44
+ children,
45
+ active && React.createElement(
46
+ 'span',
47
+ { className: 'sr-only' },
48
+ activeLabel
49
+ )
50
+ )
51
+ );
52
+ }
53
+
54
+ PaginationItem.propTypes = propTypes;
55
+ PaginationItem.defaultProps = defaultProps;
56
+
57
+ function createButton(name, defaultValue) {
58
+ var _class, _temp;
59
+
60
+ var label = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : name;
61
+
62
+ return _temp = _class = function (_React$Component) {
63
+ _inherits(_class, _React$Component);
64
+
65
+ function _class() {
66
+ _classCallCheck(this, _class);
67
+
68
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
69
+ }
70
+
71
+ _class.prototype.render = function render() {
72
+ var _props = this.props,
73
+ disabled = _props.disabled,
74
+ children = _props.children,
75
+ className = _props.className,
76
+ props = _objectWithoutProperties(_props, ['disabled', 'children', 'className']);
77
+
78
+ var Component = disabled ? 'span' : SafeAnchor;
79
+
80
+ return React.createElement(
81
+ 'li',
82
+ _extends({
83
+ 'aria-label': label,
84
+ className: classNames(className, { disabled: disabled })
85
+ }, props),
86
+ React.createElement(
87
+ Component,
88
+ null,
89
+ children || defaultValue
90
+ )
91
+ );
92
+ };
93
+
94
+ return _class;
95
+ }(React.Component), _class.displayName = name, _class.propTypes = { disabled: PropTypes.bool }, _temp;
96
+ }
97
+
98
+ export var First = createButton('First', '\xAB');
99
+ export var Prev = createButton('Prev', '\u2039');
100
+ export var Ellipsis = createButton('Ellipsis', '\u2026', 'More');
101
+ export var Next = createButton('Next', '\u203A');
102
+ export var Last = createButton('Last', '\xBB');