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.
- package/CHANGELOG.md +57 -0
- package/README.md +1 -0
- package/dist/react-bootstrap.js +14493 -17076
- package/dist/react-bootstrap.min.js +18479 -16
- package/es/Alert.js +1 -4
- package/es/Badge.js +1 -3
- package/es/ButtonGroup.js +1 -3
- package/es/Carousel.js +79 -79
- package/es/CarouselCaption.js +1 -3
- package/es/CarouselItem.js +3 -9
- package/es/Checkbox.js +7 -1
- package/es/Clearfix.js +1 -3
- package/es/CloseButton.js +1 -5
- package/es/Col.js +1 -3
- package/es/Collapse.js +58 -65
- package/es/Dropdown.js +66 -55
- package/es/DropdownButton.js +2 -8
- package/es/DropdownMenu.js +28 -28
- package/es/Fade.js +25 -10
- package/es/Form.js +1 -3
- package/es/FormControl.js +1 -2
- package/es/FormControlStatic.js +1 -3
- package/es/FormGroup.js +1 -3
- package/es/Glyphicon.js +1 -3
- package/es/Grid.js +1 -3
- package/es/HelpBlock.js +1 -3
- package/es/InputGroup.js +1 -3
- package/es/InputGroupAddon.js +1 -3
- package/es/InputGroupButton.js +1 -3
- package/es/Jumbotron.js +1 -3
- package/es/Label.js +1 -3
- package/es/ListGroup.js +1 -3
- package/es/Media.js +1 -3
- package/es/MediaBody.js +16 -5
- package/es/MediaHeading.js +1 -3
- package/es/MediaLeft.js +1 -3
- package/es/MediaList.js +1 -3
- package/es/MediaListItem.js +1 -3
- package/es/MediaRight.js +1 -3
- package/es/Modal.js +30 -19
- package/es/ModalBody.js +1 -3
- package/es/ModalFooter.js +1 -3
- package/es/ModalHeader.js +2 -4
- package/es/ModalTitle.js +1 -3
- package/es/Nav.js +44 -44
- package/es/NavDropdown.js +2 -0
- package/es/NavItem.js +5 -4
- package/es/Navbar.js +5 -7
- package/es/Overlay.js +1 -3
- package/es/OverlayTrigger.js +43 -43
- package/es/PageHeader.js +1 -3
- package/es/Pager.js +1 -3
- package/es/PagerItem.js +1 -4
- package/es/Pagination.js +15 -224
- package/es/PaginationItem.js +102 -0
- package/es/Panel.js +114 -173
- package/es/PanelBody.js +84 -0
- package/es/PanelCollapse.js +94 -0
- package/es/PanelFooter.js +53 -0
- package/es/PanelGroup.js +95 -52
- package/es/PanelHeading.js +75 -0
- package/es/PanelTitle.js +83 -0
- package/es/PanelToggle.js +94 -0
- package/es/ProgressBar.js +12 -8
- package/es/Radio.js +7 -1
- package/es/Row.js +1 -3
- package/es/SplitButton.js +1 -4
- package/es/SplitToggle.js +1 -4
- package/es/TabContent.js +7 -7
- package/es/TabPane.js +18 -18
- package/es/Table.js +1 -3
- package/es/Tabs.js +4 -10
- package/es/Thumbnail.js +3 -3
- package/es/ToggleButton.js +1 -4
- package/es/Well.js +1 -3
- package/es/index.js +0 -2
- package/es/utils/PropTypes.js +26 -4
- package/es/utils/ValidComponentChildren.js +1 -1
- package/es/utils/bootstrapUtils.js +5 -3
- package/lib/Accordion.js +9 -9
- package/lib/Alert.js +14 -17
- package/lib/Badge.js +12 -14
- package/lib/Breadcrumb.js +10 -10
- package/lib/BreadcrumbItem.js +14 -14
- package/lib/Button.js +20 -20
- package/lib/ButtonGroup.js +12 -14
- package/lib/ButtonToolbar.js +9 -9
- package/lib/Carousel.js +121 -121
- package/lib/CarouselCaption.js +9 -11
- package/lib/CarouselItem.js +17 -22
- package/lib/Checkbox.js +25 -21
- package/lib/Clearfix.js +14 -16
- package/lib/CloseButton.js +12 -16
- package/lib/Col.js +29 -31
- package/lib/Collapse.js +84 -92
- package/lib/ControlLabel.js +14 -14
- package/lib/Dropdown.js +106 -95
- package/lib/DropdownButton.js +22 -28
- package/lib/DropdownMenu.js +51 -51
- package/lib/DropdownToggle.js +16 -16
- package/lib/Fade.js +43 -25
- package/lib/Form.js +11 -13
- package/lib/FormControl.js +17 -17
- package/lib/FormControlFeedback.js +13 -13
- package/lib/FormControlStatic.js +9 -11
- package/lib/FormGroup.js +14 -16
- package/lib/Glyphicon.js +10 -12
- package/lib/Grid.js +10 -12
- package/lib/HelpBlock.js +8 -10
- package/lib/Image.js +13 -13
- package/lib/InputGroup.js +10 -12
- package/lib/InputGroupAddon.js +8 -10
- package/lib/InputGroupButton.js +8 -10
- package/lib/Jumbotron.js +9 -11
- package/lib/Label.js +11 -13
- package/lib/ListGroup.js +15 -17
- package/lib/ListGroupItem.js +22 -22
- package/lib/Media.js +15 -17
- package/lib/MediaBody.js +28 -11
- package/lib/MediaHeading.js +9 -11
- package/lib/MediaLeft.js +10 -12
- package/lib/MediaList.js +8 -10
- package/lib/MediaListItem.js +8 -10
- package/lib/MediaRight.js +10 -12
- package/lib/MenuItem.js +23 -23
- package/lib/Modal.js +80 -69
- package/lib/ModalBody.js +9 -11
- package/lib/ModalDialog.js +16 -16
- package/lib/ModalFooter.js +9 -11
- package/lib/ModalHeader.js +20 -22
- package/lib/ModalTitle.js +9 -11
- package/lib/Nav.js +81 -81
- package/lib/NavDropdown.js +27 -25
- package/lib/NavItem.js +23 -22
- package/lib/Navbar.js +46 -48
- package/lib/NavbarBrand.js +14 -14
- package/lib/NavbarCollapse.js +14 -14
- package/lib/NavbarHeader.js +10 -10
- package/lib/NavbarToggle.js +22 -22
- package/lib/Overlay.js +25 -27
- package/lib/OverlayTrigger.js +79 -79
- package/lib/PageHeader.js +10 -12
- package/lib/PageItem.js +2 -2
- package/lib/Pager.js +13 -15
- package/lib/PagerItem.js +18 -21
- package/lib/Pagination.js +25 -240
- package/lib/PaginationItem.js +135 -0
- package/lib/Panel.js +142 -180
- package/lib/PanelBody.js +114 -0
- package/lib/PanelCollapse.js +120 -0
- package/lib/PanelFooter.js +80 -0
- package/lib/PanelGroup.js +111 -70
- package/lib/PanelHeading.js +107 -0
- package/lib/PanelTitle.js +118 -0
- package/lib/PanelToggle.js +130 -0
- package/lib/Popover.js +22 -22
- package/lib/ProgressBar.js +39 -35
- package/lib/Radio.js +25 -21
- package/lib/ResponsiveEmbed.js +17 -17
- package/lib/Row.js +9 -11
- package/lib/SafeAnchor.js +17 -17
- package/lib/SplitButton.js +26 -29
- package/lib/SplitToggle.js +8 -11
- package/lib/Tab.js +15 -15
- package/lib/TabContainer.js +17 -17
- package/lib/TabContent.js +31 -31
- package/lib/TabPane.js +59 -59
- package/lib/Table.js +15 -17
- package/lib/Tabs.js +29 -35
- package/lib/Thumbnail.js +18 -20
- package/lib/ToggleButton.js +17 -20
- package/lib/ToggleButtonGroup.js +20 -20
- package/lib/Tooltip.js +20 -20
- package/lib/Well.js +8 -10
- package/lib/index.js +74 -79
- package/lib/utils/PropTypes.js +35 -9
- package/lib/utils/ValidComponentChildren.js +19 -19
- package/lib/utils/bootstrapUtils.js +13 -11
- package/lib/utils/capitalize.js +1 -1
- package/lib/utils/createChainedFunction.js +1 -1
- package/lib/utils/deprecationWarning.js +7 -7
- package/lib/utils/index.js +4 -4
- package/lib/utils/splitComponentProps.js +3 -3
- package/package.json +54 -64
- package/dist/react-bootstrap.min.js.map +0 -1
- package/es/PaginationButton.js +0 -98
- package/es/utils/TransitionEvents.js +0 -109
- package/lib/PaginationButton.js +0 -137
- package/lib/utils/TransitionEvents.js +0 -113
package/lib/Pagination.js
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
|
|
5
|
-
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
|
|
6
|
-
|
|
7
|
-
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
|
|
8
|
-
|
|
9
5
|
var _extends2 = require('babel-runtime/helpers/extends');
|
|
10
6
|
|
|
11
7
|
var _extends3 = _interopRequireDefault(_extends2);
|
|
12
8
|
|
|
9
|
+
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
|
|
10
|
+
|
|
11
|
+
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
|
|
12
|
+
|
|
13
13
|
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
|
|
14
14
|
|
|
15
15
|
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
|
@@ -30,193 +30,27 @@ var _react = require('react');
|
|
|
30
30
|
|
|
31
31
|
var _react2 = _interopRequireDefault(_react);
|
|
32
32
|
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
var _propTypes2 = _interopRequireDefault(_propTypes);
|
|
33
|
+
var _PaginationItem = require('./PaginationItem');
|
|
36
34
|
|
|
37
|
-
var
|
|
38
|
-
|
|
39
|
-
var _elementType2 = _interopRequireDefault(_elementType);
|
|
40
|
-
|
|
41
|
-
var _PaginationButton = require('./PaginationButton');
|
|
42
|
-
|
|
43
|
-
var _PaginationButton2 = _interopRequireDefault(_PaginationButton);
|
|
35
|
+
var _PaginationItem2 = _interopRequireDefault(_PaginationItem);
|
|
44
36
|
|
|
45
37
|
var _bootstrapUtils = require('./utils/bootstrapUtils');
|
|
46
38
|
|
|
47
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : {
|
|
48
|
-
|
|
49
|
-
var propTypes = {
|
|
50
|
-
activePage: _propTypes2['default'].number,
|
|
51
|
-
items: _propTypes2['default'].number,
|
|
52
|
-
maxButtons: _propTypes2['default'].number,
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* When `true`, will display the first and the last button page when
|
|
56
|
-
* displaying ellipsis.
|
|
57
|
-
*/
|
|
58
|
-
boundaryLinks: _propTypes2['default'].bool,
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* When `true`, will display the default node value ('…').
|
|
62
|
-
* Otherwise, will display provided node (when specified).
|
|
63
|
-
*/
|
|
64
|
-
ellipsis: _propTypes2['default'].oneOfType([_propTypes2['default'].bool, _propTypes2['default'].node]),
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* When `true`, will display the default node value ('«').
|
|
68
|
-
* Otherwise, will display provided node (when specified).
|
|
69
|
-
*/
|
|
70
|
-
first: _propTypes2['default'].oneOfType([_propTypes2['default'].bool, _propTypes2['default'].node]),
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* When `true`, will display the default node value ('»').
|
|
74
|
-
* Otherwise, will display provided node (when specified).
|
|
75
|
-
*/
|
|
76
|
-
last: _propTypes2['default'].oneOfType([_propTypes2['default'].bool, _propTypes2['default'].node]),
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* When `true`, will display the default node value ('‹').
|
|
80
|
-
* Otherwise, will display provided node (when specified).
|
|
81
|
-
*/
|
|
82
|
-
prev: _propTypes2['default'].oneOfType([_propTypes2['default'].bool, _propTypes2['default'].node]),
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* When `true`, will display the default node value ('›').
|
|
86
|
-
* Otherwise, will display provided node (when specified).
|
|
87
|
-
*/
|
|
88
|
-
next: _propTypes2['default'].oneOfType([_propTypes2['default'].bool, _propTypes2['default'].node]),
|
|
89
|
-
|
|
90
|
-
onSelect: _propTypes2['default'].func,
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* You can use a custom element for the buttons
|
|
94
|
-
*/
|
|
95
|
-
buttonComponentClass: _elementType2['default']
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
var defaultProps = {
|
|
99
|
-
activePage: 1,
|
|
100
|
-
items: 1,
|
|
101
|
-
maxButtons: 0,
|
|
102
|
-
first: false,
|
|
103
|
-
last: false,
|
|
104
|
-
prev: false,
|
|
105
|
-
next: false,
|
|
106
|
-
ellipsis: true,
|
|
107
|
-
boundaryLinks: false
|
|
108
|
-
};
|
|
39
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
109
40
|
|
|
110
41
|
var Pagination = function (_React$Component) {
|
|
111
|
-
(0, _inherits3
|
|
42
|
+
(0, _inherits3.default)(Pagination, _React$Component);
|
|
112
43
|
|
|
113
44
|
function Pagination() {
|
|
114
|
-
(0, _classCallCheck3
|
|
115
|
-
return (0, _possibleConstructorReturn3
|
|
45
|
+
(0, _classCallCheck3.default)(this, Pagination);
|
|
46
|
+
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
|
|
116
47
|
}
|
|
117
48
|
|
|
118
|
-
Pagination.prototype.renderPageButtons = function renderPageButtons(activePage, items, maxButtons, boundaryLinks, ellipsis, buttonProps) {
|
|
119
|
-
var pageButtons = [];
|
|
120
|
-
|
|
121
|
-
var startPage = void 0;
|
|
122
|
-
var endPage = void 0;
|
|
123
|
-
|
|
124
|
-
if (maxButtons && maxButtons < items) {
|
|
125
|
-
startPage = Math.max(Math.min(activePage - Math.floor(maxButtons / 2, 10), items - maxButtons + 1), 1);
|
|
126
|
-
endPage = startPage + maxButtons - 1;
|
|
127
|
-
} else {
|
|
128
|
-
startPage = 1;
|
|
129
|
-
endPage = items;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
for (var page = startPage; page <= endPage; ++page) {
|
|
133
|
-
pageButtons.push(_react2['default'].createElement(
|
|
134
|
-
_PaginationButton2['default'],
|
|
135
|
-
(0, _extends3['default'])({}, buttonProps, {
|
|
136
|
-
key: page,
|
|
137
|
-
eventKey: page,
|
|
138
|
-
active: page === activePage
|
|
139
|
-
}),
|
|
140
|
-
page
|
|
141
|
-
));
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
if (ellipsis && boundaryLinks && startPage > 1) {
|
|
145
|
-
if (startPage > 2) {
|
|
146
|
-
pageButtons.unshift(_react2['default'].createElement(
|
|
147
|
-
_PaginationButton2['default'],
|
|
148
|
-
{
|
|
149
|
-
key: 'ellipsisFirst',
|
|
150
|
-
disabled: true,
|
|
151
|
-
componentClass: buttonProps.componentClass
|
|
152
|
-
},
|
|
153
|
-
_react2['default'].createElement(
|
|
154
|
-
'span',
|
|
155
|
-
{ 'aria-label': 'More' },
|
|
156
|
-
ellipsis === true ? '\u2026' : ellipsis
|
|
157
|
-
)
|
|
158
|
-
));
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
pageButtons.unshift(_react2['default'].createElement(
|
|
162
|
-
_PaginationButton2['default'],
|
|
163
|
-
(0, _extends3['default'])({}, buttonProps, {
|
|
164
|
-
key: 1,
|
|
165
|
-
eventKey: 1,
|
|
166
|
-
active: false
|
|
167
|
-
}),
|
|
168
|
-
'1'
|
|
169
|
-
));
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
if (ellipsis && endPage < items) {
|
|
173
|
-
if (!boundaryLinks || endPage < items - 1) {
|
|
174
|
-
pageButtons.push(_react2['default'].createElement(
|
|
175
|
-
_PaginationButton2['default'],
|
|
176
|
-
{
|
|
177
|
-
key: 'ellipsis',
|
|
178
|
-
disabled: true,
|
|
179
|
-
componentClass: buttonProps.componentClass
|
|
180
|
-
},
|
|
181
|
-
_react2['default'].createElement(
|
|
182
|
-
'span',
|
|
183
|
-
{ 'aria-label': 'More' },
|
|
184
|
-
ellipsis === true ? '\u2026' : ellipsis
|
|
185
|
-
)
|
|
186
|
-
));
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
if (boundaryLinks) {
|
|
190
|
-
pageButtons.push(_react2['default'].createElement(
|
|
191
|
-
_PaginationButton2['default'],
|
|
192
|
-
(0, _extends3['default'])({}, buttonProps, {
|
|
193
|
-
key: items,
|
|
194
|
-
eventKey: items,
|
|
195
|
-
active: false
|
|
196
|
-
}),
|
|
197
|
-
items
|
|
198
|
-
));
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
return pageButtons;
|
|
203
|
-
};
|
|
204
|
-
|
|
205
49
|
Pagination.prototype.render = function render() {
|
|
206
50
|
var _props = this.props,
|
|
207
|
-
activePage = _props.activePage,
|
|
208
|
-
items = _props.items,
|
|
209
|
-
maxButtons = _props.maxButtons,
|
|
210
|
-
boundaryLinks = _props.boundaryLinks,
|
|
211
|
-
ellipsis = _props.ellipsis,
|
|
212
|
-
first = _props.first,
|
|
213
|
-
last = _props.last,
|
|
214
|
-
prev = _props.prev,
|
|
215
|
-
next = _props.next,
|
|
216
|
-
onSelect = _props.onSelect,
|
|
217
|
-
buttonComponentClass = _props.buttonComponentClass,
|
|
218
51
|
className = _props.className,
|
|
219
|
-
|
|
52
|
+
children = _props.children,
|
|
53
|
+
props = (0, _objectWithoutProperties3.default)(_props, ['className', 'children']);
|
|
220
54
|
|
|
221
55
|
var _splitBsProps = (0, _bootstrapUtils.splitBsProps)(props),
|
|
222
56
|
bsProps = _splitBsProps[0],
|
|
@@ -224,73 +58,24 @@ var Pagination = function (_React$Component) {
|
|
|
224
58
|
|
|
225
59
|
var classes = (0, _bootstrapUtils.getClassSet)(bsProps);
|
|
226
60
|
|
|
227
|
-
|
|
228
|
-
onSelect: onSelect,
|
|
229
|
-
componentClass: buttonComponentClass
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
return _react2['default'].createElement(
|
|
61
|
+
return _react2.default.createElement(
|
|
233
62
|
'ul',
|
|
234
|
-
(0, _extends3
|
|
235
|
-
|
|
236
|
-
}),
|
|
237
|
-
first && _react2['default'].createElement(
|
|
238
|
-
_PaginationButton2['default'],
|
|
239
|
-
(0, _extends3['default'])({}, buttonProps, {
|
|
240
|
-
eventKey: 1,
|
|
241
|
-
disabled: activePage === 1
|
|
242
|
-
}),
|
|
243
|
-
_react2['default'].createElement(
|
|
244
|
-
'span',
|
|
245
|
-
{ 'aria-label': 'First' },
|
|
246
|
-
first === true ? '\xAB' : first
|
|
247
|
-
)
|
|
248
|
-
),
|
|
249
|
-
prev && _react2['default'].createElement(
|
|
250
|
-
_PaginationButton2['default'],
|
|
251
|
-
(0, _extends3['default'])({}, buttonProps, {
|
|
252
|
-
eventKey: activePage - 1,
|
|
253
|
-
disabled: activePage === 1
|
|
254
|
-
}),
|
|
255
|
-
_react2['default'].createElement(
|
|
256
|
-
'span',
|
|
257
|
-
{ 'aria-label': 'Previous' },
|
|
258
|
-
prev === true ? '\u2039' : prev
|
|
259
|
-
)
|
|
260
|
-
),
|
|
261
|
-
this.renderPageButtons(activePage, items, maxButtons, boundaryLinks, ellipsis, buttonProps),
|
|
262
|
-
next && _react2['default'].createElement(
|
|
263
|
-
_PaginationButton2['default'],
|
|
264
|
-
(0, _extends3['default'])({}, buttonProps, {
|
|
265
|
-
eventKey: activePage + 1,
|
|
266
|
-
disabled: activePage >= items
|
|
267
|
-
}),
|
|
268
|
-
_react2['default'].createElement(
|
|
269
|
-
'span',
|
|
270
|
-
{ 'aria-label': 'Next' },
|
|
271
|
-
next === true ? '\u203A' : next
|
|
272
|
-
)
|
|
273
|
-
),
|
|
274
|
-
last && _react2['default'].createElement(
|
|
275
|
-
_PaginationButton2['default'],
|
|
276
|
-
(0, _extends3['default'])({}, buttonProps, {
|
|
277
|
-
eventKey: items,
|
|
278
|
-
disabled: activePage >= items
|
|
279
|
-
}),
|
|
280
|
-
_react2['default'].createElement(
|
|
281
|
-
'span',
|
|
282
|
-
{ 'aria-label': 'Last' },
|
|
283
|
-
last === true ? '\xBB' : last
|
|
284
|
-
)
|
|
285
|
-
)
|
|
63
|
+
(0, _extends3.default)({}, elementProps, { className: (0, _classnames2.default)(className, classes) }),
|
|
64
|
+
children
|
|
286
65
|
);
|
|
287
66
|
};
|
|
288
67
|
|
|
289
68
|
return Pagination;
|
|
290
|
-
}(_react2
|
|
69
|
+
}(_react2.default.Component);
|
|
70
|
+
|
|
71
|
+
(0, _bootstrapUtils.bsClass)('pagination', Pagination);
|
|
291
72
|
|
|
292
|
-
Pagination.
|
|
293
|
-
Pagination.
|
|
73
|
+
Pagination.First = _PaginationItem.First;
|
|
74
|
+
Pagination.Prev = _PaginationItem.Prev;
|
|
75
|
+
Pagination.Ellipsis = _PaginationItem.Ellipsis;
|
|
76
|
+
Pagination.Item = _PaginationItem2.default;
|
|
77
|
+
Pagination.Next = _PaginationItem.Next;
|
|
78
|
+
Pagination.Last = _PaginationItem.Last;
|
|
294
79
|
|
|
295
|
-
exports
|
|
80
|
+
exports.default = Pagination;
|
|
296
81
|
module.exports = exports['default'];
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.Last = exports.Next = exports.Ellipsis = exports.Prev = exports.First = undefined;
|
|
5
|
+
|
|
6
|
+
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
|
|
7
|
+
|
|
8
|
+
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
|
9
|
+
|
|
10
|
+
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
|
|
11
|
+
|
|
12
|
+
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
|
13
|
+
|
|
14
|
+
var _inherits2 = require('babel-runtime/helpers/inherits');
|
|
15
|
+
|
|
16
|
+
var _inherits3 = _interopRequireDefault(_inherits2);
|
|
17
|
+
|
|
18
|
+
var _extends2 = require('babel-runtime/helpers/extends');
|
|
19
|
+
|
|
20
|
+
var _extends3 = _interopRequireDefault(_extends2);
|
|
21
|
+
|
|
22
|
+
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
|
|
23
|
+
|
|
24
|
+
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
|
|
25
|
+
|
|
26
|
+
exports.default = PaginationItem;
|
|
27
|
+
|
|
28
|
+
var _classnames = require('classnames');
|
|
29
|
+
|
|
30
|
+
var _classnames2 = _interopRequireDefault(_classnames);
|
|
31
|
+
|
|
32
|
+
var _propTypes = require('prop-types');
|
|
33
|
+
|
|
34
|
+
var _propTypes2 = _interopRequireDefault(_propTypes);
|
|
35
|
+
|
|
36
|
+
var _react = require('react');
|
|
37
|
+
|
|
38
|
+
var _react2 = _interopRequireDefault(_react);
|
|
39
|
+
|
|
40
|
+
var _SafeAnchor = require('./SafeAnchor');
|
|
41
|
+
|
|
42
|
+
var _SafeAnchor2 = _interopRequireDefault(_SafeAnchor);
|
|
43
|
+
|
|
44
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
45
|
+
|
|
46
|
+
/* eslint-disable react/no-multi-comp */
|
|
47
|
+
var propTypes = {
|
|
48
|
+
eventKey: _propTypes2.default.any,
|
|
49
|
+
className: _propTypes2.default.string,
|
|
50
|
+
onSelect: _propTypes2.default.func,
|
|
51
|
+
disabled: _propTypes2.default.bool,
|
|
52
|
+
active: _propTypes2.default.bool,
|
|
53
|
+
activeLabel: _propTypes2.default.string.isRequired
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
var defaultProps = {
|
|
57
|
+
active: false,
|
|
58
|
+
disabled: false,
|
|
59
|
+
activeLabel: '(current)'
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
function PaginationItem(_ref) {
|
|
63
|
+
var active = _ref.active,
|
|
64
|
+
disabled = _ref.disabled,
|
|
65
|
+
className = _ref.className,
|
|
66
|
+
style = _ref.style,
|
|
67
|
+
activeLabel = _ref.activeLabel,
|
|
68
|
+
children = _ref.children,
|
|
69
|
+
props = (0, _objectWithoutProperties3.default)(_ref, ['active', 'disabled', 'className', 'style', 'activeLabel', 'children']);
|
|
70
|
+
|
|
71
|
+
var Component = active || disabled ? 'span' : _SafeAnchor2.default;
|
|
72
|
+
return _react2.default.createElement(
|
|
73
|
+
'li',
|
|
74
|
+
{ style: style, className: (0, _classnames2.default)(className, { active: active, disabled: disabled }) },
|
|
75
|
+
_react2.default.createElement(
|
|
76
|
+
Component,
|
|
77
|
+
(0, _extends3.default)({ disabled: disabled }, props),
|
|
78
|
+
children,
|
|
79
|
+
active && _react2.default.createElement(
|
|
80
|
+
'span',
|
|
81
|
+
{ className: 'sr-only' },
|
|
82
|
+
activeLabel
|
|
83
|
+
)
|
|
84
|
+
)
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
PaginationItem.propTypes = propTypes;
|
|
89
|
+
PaginationItem.defaultProps = defaultProps;
|
|
90
|
+
|
|
91
|
+
function createButton(name, defaultValue) {
|
|
92
|
+
var _class, _temp;
|
|
93
|
+
|
|
94
|
+
var label = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : name;
|
|
95
|
+
|
|
96
|
+
return _temp = _class = function (_React$Component) {
|
|
97
|
+
(0, _inherits3.default)(_class, _React$Component);
|
|
98
|
+
|
|
99
|
+
function _class() {
|
|
100
|
+
(0, _classCallCheck3.default)(this, _class);
|
|
101
|
+
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
_class.prototype.render = function render() {
|
|
105
|
+
var _props = this.props,
|
|
106
|
+
disabled = _props.disabled,
|
|
107
|
+
children = _props.children,
|
|
108
|
+
className = _props.className,
|
|
109
|
+
props = (0, _objectWithoutProperties3.default)(_props, ['disabled', 'children', 'className']);
|
|
110
|
+
|
|
111
|
+
var Component = disabled ? 'span' : _SafeAnchor2.default;
|
|
112
|
+
|
|
113
|
+
return _react2.default.createElement(
|
|
114
|
+
'li',
|
|
115
|
+
(0, _extends3.default)({
|
|
116
|
+
'aria-label': label,
|
|
117
|
+
className: (0, _classnames2.default)(className, { disabled: disabled })
|
|
118
|
+
}, props),
|
|
119
|
+
_react2.default.createElement(
|
|
120
|
+
Component,
|
|
121
|
+
null,
|
|
122
|
+
children || defaultValue
|
|
123
|
+
)
|
|
124
|
+
);
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
return _class;
|
|
128
|
+
}(_react2.default.Component), _class.displayName = name, _class.propTypes = { disabled: _propTypes2.default.bool }, _temp;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
var First = exports.First = createButton('First', '\xAB');
|
|
132
|
+
var Prev = exports.Prev = createButton('Prev', '\u2039');
|
|
133
|
+
var Ellipsis = exports.Ellipsis = createButton('Ellipsis', '\u2026', 'More');
|
|
134
|
+
var Next = exports.Next = createButton('Next', '\u203A');
|
|
135
|
+
var Last = exports.Last = createButton('Last', '\xBB');
|