react-bootstrap 0.32.0 → 0.32.4
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 +38 -0
- package/README.md +11 -7
- package/dist/react-bootstrap.js +13464 -13723
- package/dist/react-bootstrap.min.js +10 -18464
- package/es/Accordion.js +13 -16
- package/es/Alert.js +26 -31
- package/es/Badge.js +21 -31
- package/es/Breadcrumb.js +17 -20
- package/es/BreadcrumbItem.js +30 -30
- package/es/Button.js +23 -27
- package/es/ButtonGroup.js +20 -22
- package/es/ButtonToolbar.js +16 -18
- package/es/Carousel.js +120 -157
- package/es/CarouselCaption.js +18 -21
- package/es/CarouselItem.js +34 -33
- package/es/Checkbox.js +43 -54
- package/es/Clearfix.js +24 -24
- package/es/CloseButton.js +21 -30
- package/es/Col.js +42 -26
- package/es/Collapse.js +68 -68
- package/es/ControlLabel.js +19 -24
- package/es/Dropdown.js +93 -91
- package/es/DropdownButton.js +25 -35
- package/es/DropdownMenu.js +65 -65
- package/es/DropdownToggle.js +28 -40
- package/es/Fade.js +26 -29
- package/es/Form.js +22 -22
- package/es/FormControl.js +32 -33
- package/es/FormControlFeedback.js +21 -21
- package/es/FormControlStatic.js +18 -21
- package/es/FormGroup.js +27 -34
- package/es/Glyphicon.js +18 -19
- package/es/Grid.js +20 -22
- package/es/HelpBlock.js +17 -17
- package/es/Image.js +19 -24
- package/es/InputGroup.js +17 -18
- package/es/InputGroupAddon.js +17 -17
- package/es/InputGroupButton.js +17 -17
- package/es/Jumbotron.js +18 -21
- package/es/Label.js +21 -27
- package/es/ListGroup.js +24 -29
- package/es/ListGroupItem.js +30 -48
- package/es/Media.js +18 -22
- package/es/MediaBody.js +19 -22
- package/es/MediaHeading.js +18 -21
- package/es/MediaLeft.js +18 -19
- package/es/MediaList.js +17 -17
- package/es/MediaListItem.js +17 -17
- package/es/MediaRight.js +18 -19
- package/es/MenuItem.js +44 -49
- package/es/Modal.js +63 -74
- package/es/ModalBody.js +18 -21
- package/es/ModalDialog.js +31 -39
- package/es/ModalFooter.js +18 -21
- package/es/ModalHeader.js +25 -35
- package/es/ModalTitle.js +18 -21
- package/es/Nav.js +73 -92
- package/es/NavDropdown.js +40 -52
- package/es/NavItem.js +34 -38
- package/es/Navbar.js +62 -73
- package/es/NavbarBrand.js +20 -24
- package/es/NavbarCollapse.js +21 -28
- package/es/NavbarHeader.js +19 -20
- package/es/NavbarToggle.js +30 -38
- package/es/Overlay.js +21 -25
- package/es/OverlayTrigger.js +71 -68
- package/es/PageHeader.js +18 -26
- package/es/PageItem.js +0 -1
- package/es/Pager.js +23 -30
- package/es/PagerItem.js +36 -40
- package/es/Pagination.js +18 -24
- package/es/PaginationItem.js +47 -57
- package/es/Panel.js +51 -54
- package/es/PanelBody.js +18 -29
- package/es/PanelCollapse.js +20 -23
- package/es/PanelFooter.js +16 -23
- package/es/PanelGroup.js +44 -45
- package/es/PanelHeading.js +19 -28
- package/es/PanelTitle.js +22 -34
- package/es/PanelToggle.js +21 -24
- package/es/Popover.js +36 -46
- package/es/ProgressBar.js +59 -62
- package/es/Radio.js +43 -54
- package/es/ResponsiveEmbed.js +27 -32
- package/es/Row.js +18 -21
- package/es/SafeAnchor.js +32 -32
- package/es/SplitButton.js +33 -46
- package/es/SplitToggle.js +14 -13
- package/es/Tab.js +12 -18
- package/es/TabContainer.js +24 -30
- package/es/TabContent.js +36 -43
- package/es/TabPane.js +58 -68
- package/es/Table.js +25 -29
- package/es/Tabs.js +56 -71
- package/es/Thumbnail.js +34 -34
- package/es/ToggleButton.js +32 -37
- package/es/ToggleButtonGroup.js +45 -57
- package/es/Tooltip.js +33 -40
- package/es/Well.js +17 -17
- package/es/index.js +2 -0
- package/es/utils/PropTypes.js +13 -19
- package/es/utils/StyleConfig.js +0 -4
- package/es/utils/ValidComponentChildren.js +11 -20
- package/es/utils/bootstrapUtils.js +17 -31
- package/es/utils/createChainedFunction.js +2 -2
- package/es/utils/deprecationWarning.js +28 -30
- package/es/utils/splitComponentProps.js +1 -2
- package/lib/Accordion.js +23 -36
- package/lib/Alert.js +43 -65
- package/lib/Badge.js +36 -56
- package/lib/Breadcrumb.js +32 -47
- package/lib/BreadcrumbItem.js +48 -63
- package/lib/Button.js +49 -71
- package/lib/ButtonGroup.js +39 -57
- package/lib/ButtonToolbar.js +29 -42
- package/lib/Carousel.js +161 -214
- package/lib/CarouselCaption.js +32 -46
- package/lib/CarouselItem.js +54 -73
- package/lib/Checkbox.js +64 -87
- package/lib/Clearfix.js +45 -58
- package/lib/CloseButton.js +33 -50
- package/lib/Col.js +78 -73
- package/lib/Collapse.js +104 -125
- package/lib/ControlLabel.js +38 -59
- package/lib/Dropdown.js +153 -192
- package/lib/DropdownButton.js +44 -70
- package/lib/DropdownMenu.js +96 -120
- package/lib/DropdownToggle.js +48 -77
- package/lib/Fade.js +49 -68
- package/lib/Form.js +39 -52
- package/lib/FormControl.js +58 -79
- package/lib/FormControlFeedback.js +42 -54
- package/lib/FormControlStatic.js +32 -46
- package/lib/FormGroup.js +47 -67
- package/lib/Glyphicon.js +33 -46
- package/lib/Grid.js +36 -51
- package/lib/HelpBlock.js +29 -40
- package/lib/Image.js +37 -53
- package/lib/InputGroup.js +34 -49
- package/lib/InputGroupAddon.js +29 -40
- package/lib/InputGroupButton.js +29 -40
- package/lib/Jumbotron.js +32 -46
- package/lib/Label.js +35 -53
- package/lib/ListGroup.js +45 -61
- package/lib/ListGroupItem.js +55 -85
- package/lib/Media.js +43 -70
- package/lib/MediaBody.js +37 -55
- package/lib/MediaHeading.js +32 -46
- package/lib/MediaLeft.js +34 -48
- package/lib/MediaList.js +29 -40
- package/lib/MediaListItem.js +29 -40
- package/lib/MediaRight.js +34 -48
- package/lib/MenuItem.js +70 -92
- package/lib/Modal.js +130 -186
- package/lib/ModalBody.js +32 -46
- package/lib/ModalDialog.js +47 -69
- package/lib/ModalFooter.js +32 -46
- package/lib/ModalHeader.js +43 -70
- package/lib/ModalTitle.js +32 -46
- package/lib/Nav.js +122 -160
- package/lib/NavDropdown.js +63 -97
- package/lib/NavItem.js +54 -77
- package/lib/Navbar.js +115 -152
- package/lib/NavbarBrand.js +37 -55
- package/lib/NavbarCollapse.js +36 -57
- package/lib/NavbarHeader.js +33 -48
- package/lib/NavbarToggle.js +52 -77
- package/lib/Overlay.js +50 -75
- package/lib/OverlayTrigger.js +114 -129
- package/lib/PageHeader.js +30 -49
- package/lib/PageItem.js +9 -10
- package/lib/Pager.js +41 -63
- package/lib/PagerItem.js +55 -78
- package/lib/Pagination.js +32 -50
- package/lib/PaginationItem.js +67 -91
- package/lib/Panel.js +93 -127
- package/lib/PanelBody.js +35 -57
- package/lib/PanelCollapse.js +44 -56
- package/lib/PanelFooter.js +31 -48
- package/lib/PanelGroup.js +73 -88
- package/lib/PanelHeading.js +37 -59
- package/lib/PanelTitle.js +41 -68
- package/lib/PanelToggle.js +45 -66
- package/lib/Popover.js +59 -84
- package/lib/ProgressBar.js +86 -103
- package/lib/Radio.js +64 -87
- package/lib/ResponsiveEmbed.js +45 -63
- package/lib/Row.js +32 -46
- package/lib/SafeAnchor.js +53 -69
- package/lib/SplitButton.js +57 -90
- package/lib/SplitToggle.js +25 -34
- package/lib/Tab.js +32 -55
- package/lib/TabContainer.js +45 -61
- package/lib/TabContent.js +67 -87
- package/lib/TabPane.js +103 -131
- package/lib/Table.js +44 -59
- package/lib/Tabs.js +82 -119
- package/lib/Thumbnail.js +55 -67
- package/lib/ToggleButton.js +49 -68
- package/lib/ToggleButtonGroup.js +67 -104
- package/lib/Tooltip.js +55 -77
- package/lib/Well.js +30 -41
- package/lib/index.js +147 -214
- package/lib/utils/PropTypes.js +24 -31
- package/lib/utils/StyleConfig.js +13 -11
- package/lib/utils/ValidComponentChildren.js +34 -29
- package/lib/utils/bootstrapUtils.js +41 -52
- package/lib/utils/capitalize.js +2 -0
- package/lib/utils/createChainedFunction.js +8 -5
- package/lib/utils/deprecationWarning.js +37 -47
- package/lib/utils/index.js +11 -15
- package/lib/utils/splitComponentProps.js +5 -10
- package/package.json +58 -50
package/es/Carousel.js
CHANGED
|
@@ -1,26 +1,22 @@
|
|
|
1
|
-
import _extends from
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import _inherits from 'babel-runtime/helpers/inherits';
|
|
1
|
+
import _extends from "@babel/runtime-corejs2/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime-corejs2/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
import _inheritsLoose from "@babel/runtime-corejs2/helpers/esm/inheritsLoose";
|
|
4
|
+
import _assertThisInitialized from "@babel/runtime-corejs2/helpers/esm/assertThisInitialized";
|
|
6
5
|
import classNames from 'classnames';
|
|
7
6
|
import React, { cloneElement } from 'react';
|
|
8
7
|
import PropTypes from 'prop-types';
|
|
9
|
-
|
|
10
8
|
import CarouselCaption from './CarouselCaption';
|
|
11
9
|
import CarouselItem from './CarouselItem';
|
|
12
10
|
import Glyphicon from './Glyphicon';
|
|
13
11
|
import SafeAnchor from './SafeAnchor';
|
|
14
12
|
import { bsClass, getClassSet, prefix, splitBsPropsAndOmit } from './utils/bootstrapUtils';
|
|
15
|
-
import ValidComponentChildren from './utils/ValidComponentChildren';
|
|
16
|
-
|
|
17
|
-
// TODO: `slide` should be `animate`.
|
|
18
|
-
|
|
13
|
+
import ValidComponentChildren from './utils/ValidComponentChildren'; // TODO: `slide` should be `animate`.
|
|
19
14
|
// TODO: Use uncontrollable.
|
|
20
15
|
|
|
21
16
|
var propTypes = {
|
|
22
17
|
slide: PropTypes.bool,
|
|
23
18
|
indicators: PropTypes.bool,
|
|
19
|
+
|
|
24
20
|
/**
|
|
25
21
|
* The amount of time to delay between automatically cycling an item.
|
|
26
22
|
* If `null`, carousel will not automatically cycle.
|
|
@@ -29,6 +25,7 @@ var propTypes = {
|
|
|
29
25
|
controls: PropTypes.bool,
|
|
30
26
|
pauseOnHover: PropTypes.bool,
|
|
31
27
|
wrap: PropTypes.bool,
|
|
28
|
+
|
|
32
29
|
/**
|
|
33
30
|
* Callback fired when the active item changes.
|
|
34
31
|
*
|
|
@@ -46,6 +43,7 @@ var propTypes = {
|
|
|
46
43
|
defaultActiveIndex: PropTypes.number,
|
|
47
44
|
direction: PropTypes.oneOf(['prev', 'next']),
|
|
48
45
|
prevIcon: PropTypes.node,
|
|
46
|
+
|
|
49
47
|
/**
|
|
50
48
|
* Label shown to screen readers only, can be used to show the previous element
|
|
51
49
|
* in the carousel.
|
|
@@ -53,6 +51,7 @@ var propTypes = {
|
|
|
53
51
|
*/
|
|
54
52
|
prevLabel: PropTypes.string,
|
|
55
53
|
nextIcon: PropTypes.node,
|
|
54
|
+
|
|
56
55
|
/**
|
|
57
56
|
* Label shown to screen readers only, can be used to show the next element
|
|
58
57
|
* in the carousel.
|
|
@@ -60,7 +59,6 @@ var propTypes = {
|
|
|
60
59
|
*/
|
|
61
60
|
nextLabel: PropTypes.string
|
|
62
61
|
};
|
|
63
|
-
|
|
64
62
|
var defaultProps = {
|
|
65
63
|
slide: true,
|
|
66
64
|
interval: 5000,
|
|
@@ -68,49 +66,51 @@ var defaultProps = {
|
|
|
68
66
|
wrap: true,
|
|
69
67
|
indicators: true,
|
|
70
68
|
controls: true,
|
|
71
|
-
prevIcon: React.createElement(Glyphicon, {
|
|
69
|
+
prevIcon: React.createElement(Glyphicon, {
|
|
70
|
+
glyph: "chevron-left"
|
|
71
|
+
}),
|
|
72
72
|
prevLabel: 'Previous',
|
|
73
|
-
nextIcon: React.createElement(Glyphicon, {
|
|
73
|
+
nextIcon: React.createElement(Glyphicon, {
|
|
74
|
+
glyph: "chevron-right"
|
|
75
|
+
}),
|
|
74
76
|
nextLabel: 'Next'
|
|
75
77
|
};
|
|
76
78
|
|
|
77
|
-
var Carousel =
|
|
78
|
-
|
|
79
|
+
var Carousel =
|
|
80
|
+
/*#__PURE__*/
|
|
81
|
+
function (_React$Component) {
|
|
82
|
+
_inheritsLoose(Carousel, _React$Component);
|
|
79
83
|
|
|
80
84
|
function Carousel(props, context) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
_this.
|
|
86
|
-
_this.
|
|
87
|
-
_this.
|
|
88
|
-
_this.
|
|
89
|
-
_this.handleItemAnimateOutEnd = _this.handleItemAnimateOutEnd.bind(_this);
|
|
90
|
-
|
|
85
|
+
var _this;
|
|
86
|
+
|
|
87
|
+
_this = _React$Component.call(this, props, context) || this;
|
|
88
|
+
_this.handleMouseOver = _this.handleMouseOver.bind(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
89
|
+
_this.handleMouseOut = _this.handleMouseOut.bind(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
90
|
+
_this.handlePrev = _this.handlePrev.bind(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
91
|
+
_this.handleNext = _this.handleNext.bind(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
92
|
+
_this.handleItemAnimateOutEnd = _this.handleItemAnimateOutEnd.bind(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
91
93
|
var defaultActiveIndex = props.defaultActiveIndex;
|
|
92
|
-
|
|
93
|
-
|
|
94
94
|
_this.state = {
|
|
95
95
|
activeIndex: defaultActiveIndex != null ? defaultActiveIndex : 0,
|
|
96
96
|
previousActiveIndex: null,
|
|
97
97
|
direction: null
|
|
98
98
|
};
|
|
99
|
-
|
|
100
99
|
_this.isUnmounted = false;
|
|
101
100
|
return _this;
|
|
102
101
|
}
|
|
103
102
|
|
|
104
|
-
Carousel.prototype
|
|
103
|
+
var _proto = Carousel.prototype;
|
|
104
|
+
|
|
105
|
+
_proto.componentDidMount = function componentDidMount() {
|
|
105
106
|
this.waitForNext();
|
|
106
107
|
};
|
|
107
108
|
|
|
108
|
-
|
|
109
|
+
_proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
|
109
110
|
var activeIndex = this.getActiveIndex();
|
|
110
111
|
|
|
111
112
|
if (nextProps.activeIndex != null && nextProps.activeIndex !== activeIndex) {
|
|
112
113
|
clearTimeout(this.timeout);
|
|
113
|
-
|
|
114
114
|
this.setState({
|
|
115
115
|
previousActiveIndex: activeIndex,
|
|
116
116
|
direction: nextProps.direction != null ? nextProps.direction : this.getDirection(activeIndex, nextProps.activeIndex)
|
|
@@ -126,17 +126,17 @@ var Carousel = function (_React$Component) {
|
|
|
126
126
|
}
|
|
127
127
|
};
|
|
128
128
|
|
|
129
|
-
|
|
129
|
+
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
130
130
|
clearTimeout(this.timeout);
|
|
131
131
|
this.isUnmounted = true;
|
|
132
132
|
};
|
|
133
133
|
|
|
134
|
-
|
|
134
|
+
_proto.getActiveIndex = function getActiveIndex() {
|
|
135
135
|
var activeIndexProp = this.props.activeIndex;
|
|
136
136
|
return activeIndexProp != null ? activeIndexProp : this.state.activeIndex;
|
|
137
137
|
};
|
|
138
138
|
|
|
139
|
-
|
|
139
|
+
_proto.getDirection = function getDirection(prevIndex, index) {
|
|
140
140
|
if (prevIndex === index) {
|
|
141
141
|
return null;
|
|
142
142
|
}
|
|
@@ -144,7 +144,7 @@ var Carousel = function (_React$Component) {
|
|
|
144
144
|
return prevIndex > index ? 'prev' : 'next';
|
|
145
145
|
};
|
|
146
146
|
|
|
147
|
-
|
|
147
|
+
_proto.handleItemAnimateOutEnd = function handleItemAnimateOutEnd() {
|
|
148
148
|
var _this2 = this;
|
|
149
149
|
|
|
150
150
|
this.setState({
|
|
@@ -159,19 +159,19 @@ var Carousel = function (_React$Component) {
|
|
|
159
159
|
});
|
|
160
160
|
};
|
|
161
161
|
|
|
162
|
-
|
|
162
|
+
_proto.handleMouseOut = function handleMouseOut() {
|
|
163
163
|
if (this.isPaused) {
|
|
164
164
|
this.play();
|
|
165
165
|
}
|
|
166
166
|
};
|
|
167
167
|
|
|
168
|
-
|
|
168
|
+
_proto.handleMouseOver = function handleMouseOver() {
|
|
169
169
|
if (this.props.pauseOnHover) {
|
|
170
170
|
this.pause();
|
|
171
171
|
}
|
|
172
172
|
};
|
|
173
173
|
|
|
174
|
-
|
|
174
|
+
_proto.handleNext = function handleNext(e) {
|
|
175
175
|
var index = this.getActiveIndex() + 1;
|
|
176
176
|
var count = ValidComponentChildren.count(this.props.children);
|
|
177
177
|
|
|
@@ -179,56 +179,51 @@ var Carousel = function (_React$Component) {
|
|
|
179
179
|
if (!this.props.wrap) {
|
|
180
180
|
return;
|
|
181
181
|
}
|
|
182
|
+
|
|
182
183
|
index = 0;
|
|
183
184
|
}
|
|
184
185
|
|
|
185
186
|
this.select(index, e, 'next');
|
|
186
187
|
};
|
|
187
188
|
|
|
188
|
-
|
|
189
|
+
_proto.handlePrev = function handlePrev(e) {
|
|
189
190
|
var index = this.getActiveIndex() - 1;
|
|
190
191
|
|
|
191
192
|
if (index < 0) {
|
|
192
193
|
if (!this.props.wrap) {
|
|
193
194
|
return;
|
|
194
195
|
}
|
|
196
|
+
|
|
195
197
|
index = ValidComponentChildren.count(this.props.children) - 1;
|
|
196
198
|
}
|
|
197
199
|
|
|
198
200
|
this.select(index, e, 'prev');
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
// This might be a public API.
|
|
201
|
+
}; // This might be a public API.
|
|
202
202
|
|
|
203
203
|
|
|
204
|
-
|
|
204
|
+
_proto.pause = function pause() {
|
|
205
205
|
this.isPaused = true;
|
|
206
206
|
clearTimeout(this.timeout);
|
|
207
|
-
};
|
|
207
|
+
}; // This might be a public API.
|
|
208
208
|
|
|
209
|
-
// This might be a public API.
|
|
210
209
|
|
|
211
|
-
|
|
212
|
-
Carousel.prototype.play = function play() {
|
|
210
|
+
_proto.play = function play() {
|
|
213
211
|
this.isPaused = false;
|
|
214
212
|
this.waitForNext();
|
|
215
213
|
};
|
|
216
214
|
|
|
217
|
-
|
|
218
|
-
clearTimeout(this.timeout);
|
|
219
|
-
|
|
220
|
-
// TODO: Is this necessary? Seems like the only risk is if the component
|
|
215
|
+
_proto.select = function select(index, e, direction) {
|
|
216
|
+
clearTimeout(this.timeout); // TODO: Is this necessary? Seems like the only risk is if the component
|
|
221
217
|
// unmounts while handleItemAnimateOutEnd fires.
|
|
218
|
+
|
|
222
219
|
if (this.isUnmounted) {
|
|
223
220
|
return;
|
|
224
221
|
}
|
|
225
222
|
|
|
226
223
|
var previousActiveIndex = this.props.slide ? this.getActiveIndex() : null;
|
|
227
224
|
direction = direction || this.getDirection(previousActiveIndex, index);
|
|
228
|
-
|
|
229
225
|
var onSelect = this.props.onSelect;
|
|
230
226
|
|
|
231
|
-
|
|
232
227
|
if (onSelect) {
|
|
233
228
|
if (onSelect.length > 1) {
|
|
234
229
|
// React SyntheticEvents are pooled, so we need to remove this event
|
|
@@ -239,7 +234,9 @@ var Carousel = function (_React$Component) {
|
|
|
239
234
|
e.persist();
|
|
240
235
|
e.direction = direction;
|
|
241
236
|
} else {
|
|
242
|
-
e = {
|
|
237
|
+
e = {
|
|
238
|
+
direction: direction
|
|
239
|
+
};
|
|
243
240
|
}
|
|
244
241
|
|
|
245
242
|
onSelect(index, e);
|
|
@@ -264,19 +261,18 @@ var Carousel = function (_React$Component) {
|
|
|
264
261
|
}
|
|
265
262
|
};
|
|
266
263
|
|
|
267
|
-
|
|
268
|
-
var
|
|
269
|
-
slide =
|
|
270
|
-
interval =
|
|
271
|
-
activeIndexProp =
|
|
272
|
-
|
|
264
|
+
_proto.waitForNext = function waitForNext() {
|
|
265
|
+
var _this$props = this.props,
|
|
266
|
+
slide = _this$props.slide,
|
|
267
|
+
interval = _this$props.interval,
|
|
268
|
+
activeIndexProp = _this$props.activeIndex;
|
|
273
269
|
|
|
274
270
|
if (!this.isPaused && slide && interval && activeIndexProp == null) {
|
|
275
271
|
this.timeout = setTimeout(this.handleNext, interval);
|
|
276
272
|
}
|
|
277
273
|
};
|
|
278
274
|
|
|
279
|
-
|
|
275
|
+
_proto.renderControls = function renderControls(properties) {
|
|
280
276
|
var wrap = properties.wrap,
|
|
281
277
|
children = properties.children,
|
|
282
278
|
activeIndex = properties.activeIndex,
|
|
@@ -285,84 +281,62 @@ var Carousel = function (_React$Component) {
|
|
|
285
281
|
bsProps = properties.bsProps,
|
|
286
282
|
prevLabel = properties.prevLabel,
|
|
287
283
|
nextLabel = properties.nextLabel;
|
|
288
|
-
|
|
289
284
|
var controlClassName = prefix(bsProps, 'control');
|
|
290
285
|
var count = ValidComponentChildren.count(children);
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
)
|
|
305
|
-
), (wrap || activeIndex !== count - 1) && React.createElement(
|
|
306
|
-
SafeAnchor,
|
|
307
|
-
{
|
|
308
|
-
key: 'next',
|
|
309
|
-
className: classNames(controlClassName, 'right'),
|
|
310
|
-
onClick: this.handleNext
|
|
311
|
-
},
|
|
312
|
-
nextIcon,
|
|
313
|
-
nextLabel && React.createElement(
|
|
314
|
-
'span',
|
|
315
|
-
{ className: 'sr-only' },
|
|
316
|
-
nextLabel
|
|
317
|
-
)
|
|
318
|
-
)];
|
|
286
|
+
return [(wrap || activeIndex !== 0) && React.createElement(SafeAnchor, {
|
|
287
|
+
key: "prev",
|
|
288
|
+
className: classNames(controlClassName, 'left'),
|
|
289
|
+
onClick: this.handlePrev
|
|
290
|
+
}, prevIcon, prevLabel && React.createElement("span", {
|
|
291
|
+
className: "sr-only"
|
|
292
|
+
}, prevLabel)), (wrap || activeIndex !== count - 1) && React.createElement(SafeAnchor, {
|
|
293
|
+
key: "next",
|
|
294
|
+
className: classNames(controlClassName, 'right'),
|
|
295
|
+
onClick: this.handleNext
|
|
296
|
+
}, nextIcon, nextLabel && React.createElement("span", {
|
|
297
|
+
className: "sr-only"
|
|
298
|
+
}, nextLabel))];
|
|
319
299
|
};
|
|
320
300
|
|
|
321
|
-
|
|
301
|
+
_proto.renderIndicators = function renderIndicators(children, activeIndex, bsProps) {
|
|
322
302
|
var _this3 = this;
|
|
323
303
|
|
|
324
304
|
var indicators = [];
|
|
325
|
-
|
|
326
305
|
ValidComponentChildren.forEach(children, function (child, index) {
|
|
327
|
-
indicators.push(React.createElement(
|
|
306
|
+
indicators.push(React.createElement("li", {
|
|
328
307
|
key: index,
|
|
329
308
|
className: index === activeIndex ? 'active' : null,
|
|
330
309
|
onClick: function onClick(e) {
|
|
331
310
|
return _this3.select(index, e);
|
|
332
311
|
}
|
|
333
|
-
}),
|
|
334
|
-
|
|
335
|
-
// Force whitespace between indicator elements. Bootstrap requires
|
|
312
|
+
}), // Force whitespace between indicator elements. Bootstrap requires
|
|
336
313
|
// this for correct spacing of elements.
|
|
337
314
|
' ');
|
|
338
315
|
});
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
{ className: prefix(bsProps, 'indicators') },
|
|
343
|
-
indicators
|
|
344
|
-
);
|
|
316
|
+
return React.createElement("ol", {
|
|
317
|
+
className: prefix(bsProps, 'indicators')
|
|
318
|
+
}, indicators);
|
|
345
319
|
};
|
|
346
320
|
|
|
347
|
-
|
|
321
|
+
_proto.render = function render() {
|
|
348
322
|
var _this4 = this;
|
|
349
323
|
|
|
350
|
-
var
|
|
351
|
-
slide =
|
|
352
|
-
indicators =
|
|
353
|
-
controls =
|
|
354
|
-
wrap =
|
|
355
|
-
prevIcon =
|
|
356
|
-
prevLabel =
|
|
357
|
-
nextIcon =
|
|
358
|
-
nextLabel =
|
|
359
|
-
className =
|
|
360
|
-
children =
|
|
361
|
-
props =
|
|
362
|
-
|
|
363
|
-
var
|
|
364
|
-
previousActiveIndex =
|
|
365
|
-
direction =
|
|
324
|
+
var _this$props2 = this.props,
|
|
325
|
+
slide = _this$props2.slide,
|
|
326
|
+
indicators = _this$props2.indicators,
|
|
327
|
+
controls = _this$props2.controls,
|
|
328
|
+
wrap = _this$props2.wrap,
|
|
329
|
+
prevIcon = _this$props2.prevIcon,
|
|
330
|
+
prevLabel = _this$props2.prevLabel,
|
|
331
|
+
nextIcon = _this$props2.nextIcon,
|
|
332
|
+
nextLabel = _this$props2.nextLabel,
|
|
333
|
+
className = _this$props2.className,
|
|
334
|
+
children = _this$props2.children,
|
|
335
|
+
props = _objectWithoutPropertiesLoose(_this$props2, ["slide", "indicators", "controls", "wrap", "prevIcon", "prevLabel", "nextIcon", "nextLabel", "className", "children"]);
|
|
336
|
+
|
|
337
|
+
var _this$state = this.state,
|
|
338
|
+
previousActiveIndex = _this$state.previousActiveIndex,
|
|
339
|
+
direction = _this$state.direction;
|
|
366
340
|
|
|
367
341
|
var _splitBsPropsAndOmit = splitBsPropsAndOmit(props, ['interval', 'pauseOnHover', 'onSelect', 'onSlideEnd', 'activeIndex', // Accessed via this.getActiveIndex().
|
|
368
342
|
'defaultActiveIndex', 'direction']),
|
|
@@ -375,42 +349,33 @@ var Carousel = function (_React$Component) {
|
|
|
375
349
|
slide: slide
|
|
376
350
|
});
|
|
377
351
|
|
|
378
|
-
return React.createElement(
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
children: children,
|
|
406
|
-
activeIndex: activeIndex,
|
|
407
|
-
prevIcon: prevIcon,
|
|
408
|
-
prevLabel: prevLabel,
|
|
409
|
-
nextIcon: nextIcon,
|
|
410
|
-
nextLabel: nextLabel,
|
|
411
|
-
bsProps: bsProps
|
|
412
|
-
})
|
|
413
|
-
);
|
|
352
|
+
return React.createElement("div", _extends({}, elementProps, {
|
|
353
|
+
className: classNames(className, classes),
|
|
354
|
+
onMouseOver: this.handleMouseOver,
|
|
355
|
+
onMouseOut: this.handleMouseOut
|
|
356
|
+
}), indicators && this.renderIndicators(children, activeIndex, bsProps), React.createElement("div", {
|
|
357
|
+
className: prefix(bsProps, 'inner')
|
|
358
|
+
}, ValidComponentChildren.map(children, function (child, index) {
|
|
359
|
+
var active = index === activeIndex;
|
|
360
|
+
var previousActive = slide && index === previousActiveIndex;
|
|
361
|
+
return cloneElement(child, {
|
|
362
|
+
active: active,
|
|
363
|
+
index: index,
|
|
364
|
+
animateOut: previousActive,
|
|
365
|
+
animateIn: active && previousActiveIndex != null && slide,
|
|
366
|
+
direction: direction,
|
|
367
|
+
onAnimateOutEnd: previousActive ? _this4.handleItemAnimateOutEnd : null
|
|
368
|
+
});
|
|
369
|
+
})), controls && this.renderControls({
|
|
370
|
+
wrap: wrap,
|
|
371
|
+
children: children,
|
|
372
|
+
activeIndex: activeIndex,
|
|
373
|
+
prevIcon: prevIcon,
|
|
374
|
+
prevLabel: prevLabel,
|
|
375
|
+
nextIcon: nextIcon,
|
|
376
|
+
nextLabel: nextLabel,
|
|
377
|
+
bsProps: bsProps
|
|
378
|
+
}));
|
|
414
379
|
};
|
|
415
380
|
|
|
416
381
|
return Carousel;
|
|
@@ -418,8 +383,6 @@ var Carousel = function (_React$Component) {
|
|
|
418
383
|
|
|
419
384
|
Carousel.propTypes = propTypes;
|
|
420
385
|
Carousel.defaultProps = defaultProps;
|
|
421
|
-
|
|
422
386
|
Carousel.Caption = CarouselCaption;
|
|
423
387
|
Carousel.Item = CarouselItem;
|
|
424
|
-
|
|
425
388
|
export default bsClass('carousel', Carousel);
|
package/es/CarouselCaption.js
CHANGED
|
@@ -1,44 +1,42 @@
|
|
|
1
|
-
import _extends from
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
|
|
5
|
-
import _inherits from 'babel-runtime/helpers/inherits';
|
|
1
|
+
import _extends from "@babel/runtime-corejs2/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime-corejs2/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
import _inheritsLoose from "@babel/runtime-corejs2/helpers/esm/inheritsLoose";
|
|
6
4
|
import classNames from 'classnames';
|
|
7
5
|
import React from 'react';
|
|
8
6
|
import elementType from 'prop-types-extra/lib/elementType';
|
|
9
|
-
|
|
10
7
|
import { bsClass, getClassSet, splitBsProps } from './utils/bootstrapUtils';
|
|
11
|
-
|
|
12
8
|
var propTypes = {
|
|
13
9
|
componentClass: elementType
|
|
14
10
|
};
|
|
15
|
-
|
|
16
11
|
var defaultProps = {
|
|
17
12
|
componentClass: 'div'
|
|
18
13
|
};
|
|
19
14
|
|
|
20
|
-
var CarouselCaption =
|
|
21
|
-
|
|
15
|
+
var CarouselCaption =
|
|
16
|
+
/*#__PURE__*/
|
|
17
|
+
function (_React$Component) {
|
|
18
|
+
_inheritsLoose(CarouselCaption, _React$Component);
|
|
22
19
|
|
|
23
20
|
function CarouselCaption() {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
|
21
|
+
return _React$Component.apply(this, arguments) || this;
|
|
27
22
|
}
|
|
28
23
|
|
|
29
|
-
CarouselCaption.prototype
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
var _proto = CarouselCaption.prototype;
|
|
25
|
+
|
|
26
|
+
_proto.render = function render() {
|
|
27
|
+
var _this$props = this.props,
|
|
28
|
+
Component = _this$props.componentClass,
|
|
29
|
+
className = _this$props.className,
|
|
30
|
+
props = _objectWithoutPropertiesLoose(_this$props, ["componentClass", "className"]);
|
|
34
31
|
|
|
35
32
|
var _splitBsProps = splitBsProps(props),
|
|
36
33
|
bsProps = _splitBsProps[0],
|
|
37
34
|
elementProps = _splitBsProps[1];
|
|
38
35
|
|
|
39
36
|
var classes = getClassSet(bsProps);
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
return React.createElement(Component, _extends({}, elementProps, {
|
|
38
|
+
className: classNames(className, classes)
|
|
39
|
+
}));
|
|
42
40
|
};
|
|
43
41
|
|
|
44
42
|
return CarouselCaption;
|
|
@@ -46,5 +44,4 @@ var CarouselCaption = function (_React$Component) {
|
|
|
46
44
|
|
|
47
45
|
CarouselCaption.propTypes = propTypes;
|
|
48
46
|
CarouselCaption.defaultProps = defaultProps;
|
|
49
|
-
|
|
50
47
|
export default bsClass('carousel-caption', CarouselCaption);
|