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/lib/Carousel.js
CHANGED
|
@@ -1,78 +1,53 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _extends2 = require('babel-runtime/helpers/extends');
|
|
6
|
-
|
|
7
|
-
var _extends3 = _interopRequireDefault(_extends2);
|
|
8
|
-
|
|
9
|
-
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
|
|
10
|
-
|
|
11
|
-
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
|
|
12
|
-
|
|
13
|
-
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
|
|
14
|
-
|
|
15
|
-
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
|
16
|
-
|
|
17
|
-
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
|
|
18
|
-
|
|
19
|
-
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
|
20
|
-
|
|
21
|
-
var _inherits2 = require('babel-runtime/helpers/inherits');
|
|
22
|
-
|
|
23
|
-
var _inherits3 = _interopRequireDefault(_inherits2);
|
|
24
|
-
|
|
25
|
-
var _classnames = require('classnames');
|
|
26
|
-
|
|
27
|
-
var _classnames2 = _interopRequireDefault(_classnames);
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime-corejs2/helpers/interopRequireWildcard");
|
|
28
4
|
|
|
29
|
-
var
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
30
6
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
var _propTypes = require('prop-types');
|
|
7
|
+
exports.__esModule = true;
|
|
8
|
+
exports.default = void 0;
|
|
34
9
|
|
|
35
|
-
var
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/extends"));
|
|
36
11
|
|
|
37
|
-
var
|
|
12
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/objectWithoutPropertiesLoose"));
|
|
38
13
|
|
|
39
|
-
var
|
|
14
|
+
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inheritsLoose"));
|
|
40
15
|
|
|
41
|
-
var
|
|
16
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/assertThisInitialized"));
|
|
42
17
|
|
|
43
|
-
var
|
|
18
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
44
19
|
|
|
45
|
-
var
|
|
20
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
46
21
|
|
|
47
|
-
var
|
|
22
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
48
23
|
|
|
49
|
-
var
|
|
24
|
+
var _CarouselCaption = _interopRequireDefault(require("./CarouselCaption"));
|
|
50
25
|
|
|
51
|
-
var
|
|
26
|
+
var _CarouselItem = _interopRequireDefault(require("./CarouselItem"));
|
|
52
27
|
|
|
53
|
-
var
|
|
28
|
+
var _Glyphicon = _interopRequireDefault(require("./Glyphicon"));
|
|
54
29
|
|
|
55
|
-
var
|
|
30
|
+
var _SafeAnchor = _interopRequireDefault(require("./SafeAnchor"));
|
|
56
31
|
|
|
57
|
-
var
|
|
32
|
+
var _bootstrapUtils = require("./utils/bootstrapUtils");
|
|
58
33
|
|
|
59
|
-
|
|
34
|
+
var _ValidComponentChildren = _interopRequireDefault(require("./utils/ValidComponentChildren"));
|
|
60
35
|
|
|
61
36
|
// TODO: `slide` should be `animate`.
|
|
62
|
-
|
|
63
37
|
// TODO: Use uncontrollable.
|
|
64
|
-
|
|
65
38
|
var propTypes = {
|
|
66
|
-
slide:
|
|
67
|
-
indicators:
|
|
39
|
+
slide: _propTypes.default.bool,
|
|
40
|
+
indicators: _propTypes.default.bool,
|
|
41
|
+
|
|
68
42
|
/**
|
|
69
43
|
* The amount of time to delay between automatically cycling an item.
|
|
70
44
|
* If `null`, carousel will not automatically cycle.
|
|
71
45
|
*/
|
|
72
|
-
interval:
|
|
73
|
-
controls:
|
|
74
|
-
pauseOnHover:
|
|
75
|
-
wrap:
|
|
46
|
+
interval: _propTypes.default.number,
|
|
47
|
+
controls: _propTypes.default.bool,
|
|
48
|
+
pauseOnHover: _propTypes.default.bool,
|
|
49
|
+
wrap: _propTypes.default.bool,
|
|
50
|
+
|
|
76
51
|
/**
|
|
77
52
|
* Callback fired when the active item changes.
|
|
78
53
|
*
|
|
@@ -84,27 +59,28 @@ var propTypes = {
|
|
|
84
59
|
* be a persisted event object with `direction` set to the direction of the
|
|
85
60
|
* transition.
|
|
86
61
|
*/
|
|
87
|
-
onSelect:
|
|
88
|
-
onSlideEnd:
|
|
89
|
-
activeIndex:
|
|
90
|
-
defaultActiveIndex:
|
|
91
|
-
direction:
|
|
92
|
-
prevIcon:
|
|
62
|
+
onSelect: _propTypes.default.func,
|
|
63
|
+
onSlideEnd: _propTypes.default.func,
|
|
64
|
+
activeIndex: _propTypes.default.number,
|
|
65
|
+
defaultActiveIndex: _propTypes.default.number,
|
|
66
|
+
direction: _propTypes.default.oneOf(['prev', 'next']),
|
|
67
|
+
prevIcon: _propTypes.default.node,
|
|
68
|
+
|
|
93
69
|
/**
|
|
94
70
|
* Label shown to screen readers only, can be used to show the previous element
|
|
95
71
|
* in the carousel.
|
|
96
72
|
* Set to null to deactivate.
|
|
97
73
|
*/
|
|
98
|
-
prevLabel:
|
|
99
|
-
nextIcon:
|
|
74
|
+
prevLabel: _propTypes.default.string,
|
|
75
|
+
nextIcon: _propTypes.default.node,
|
|
76
|
+
|
|
100
77
|
/**
|
|
101
78
|
* Label shown to screen readers only, can be used to show the next element
|
|
102
79
|
* in the carousel.
|
|
103
80
|
* Set to null to deactivate.
|
|
104
81
|
*/
|
|
105
|
-
nextLabel:
|
|
82
|
+
nextLabel: _propTypes.default.string
|
|
106
83
|
};
|
|
107
|
-
|
|
108
84
|
var defaultProps = {
|
|
109
85
|
slide: true,
|
|
110
86
|
interval: 5000,
|
|
@@ -112,49 +88,51 @@ var defaultProps = {
|
|
|
112
88
|
wrap: true,
|
|
113
89
|
indicators: true,
|
|
114
90
|
controls: true,
|
|
115
|
-
prevIcon:
|
|
91
|
+
prevIcon: _react.default.createElement(_Glyphicon.default, {
|
|
92
|
+
glyph: "chevron-left"
|
|
93
|
+
}),
|
|
116
94
|
prevLabel: 'Previous',
|
|
117
|
-
nextIcon:
|
|
95
|
+
nextIcon: _react.default.createElement(_Glyphicon.default, {
|
|
96
|
+
glyph: "chevron-right"
|
|
97
|
+
}),
|
|
118
98
|
nextLabel: 'Next'
|
|
119
99
|
};
|
|
120
100
|
|
|
121
|
-
var Carousel =
|
|
122
|
-
|
|
101
|
+
var Carousel =
|
|
102
|
+
/*#__PURE__*/
|
|
103
|
+
function (_React$Component) {
|
|
104
|
+
(0, _inheritsLoose2.default)(Carousel, _React$Component);
|
|
123
105
|
|
|
124
106
|
function Carousel(props, context) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
_this.
|
|
130
|
-
_this.
|
|
131
|
-
_this.
|
|
132
|
-
_this.
|
|
133
|
-
_this.handleItemAnimateOutEnd = _this.handleItemAnimateOutEnd.bind(_this);
|
|
134
|
-
|
|
107
|
+
var _this;
|
|
108
|
+
|
|
109
|
+
_this = _React$Component.call(this, props, context) || this;
|
|
110
|
+
_this.handleMouseOver = _this.handleMouseOver.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
|
111
|
+
_this.handleMouseOut = _this.handleMouseOut.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
|
112
|
+
_this.handlePrev = _this.handlePrev.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
|
113
|
+
_this.handleNext = _this.handleNext.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
|
114
|
+
_this.handleItemAnimateOutEnd = _this.handleItemAnimateOutEnd.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
|
135
115
|
var defaultActiveIndex = props.defaultActiveIndex;
|
|
136
|
-
|
|
137
|
-
|
|
138
116
|
_this.state = {
|
|
139
117
|
activeIndex: defaultActiveIndex != null ? defaultActiveIndex : 0,
|
|
140
118
|
previousActiveIndex: null,
|
|
141
119
|
direction: null
|
|
142
120
|
};
|
|
143
|
-
|
|
144
121
|
_this.isUnmounted = false;
|
|
145
122
|
return _this;
|
|
146
123
|
}
|
|
147
124
|
|
|
148
|
-
Carousel.prototype
|
|
125
|
+
var _proto = Carousel.prototype;
|
|
126
|
+
|
|
127
|
+
_proto.componentDidMount = function componentDidMount() {
|
|
149
128
|
this.waitForNext();
|
|
150
129
|
};
|
|
151
130
|
|
|
152
|
-
|
|
131
|
+
_proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
|
153
132
|
var activeIndex = this.getActiveIndex();
|
|
154
133
|
|
|
155
134
|
if (nextProps.activeIndex != null && nextProps.activeIndex !== activeIndex) {
|
|
156
135
|
clearTimeout(this.timeout);
|
|
157
|
-
|
|
158
136
|
this.setState({
|
|
159
137
|
previousActiveIndex: activeIndex,
|
|
160
138
|
direction: nextProps.direction != null ? nextProps.direction : this.getDirection(activeIndex, nextProps.activeIndex)
|
|
@@ -170,17 +148,17 @@ var Carousel = function (_React$Component) {
|
|
|
170
148
|
}
|
|
171
149
|
};
|
|
172
150
|
|
|
173
|
-
|
|
151
|
+
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
174
152
|
clearTimeout(this.timeout);
|
|
175
153
|
this.isUnmounted = true;
|
|
176
154
|
};
|
|
177
155
|
|
|
178
|
-
|
|
156
|
+
_proto.getActiveIndex = function getActiveIndex() {
|
|
179
157
|
var activeIndexProp = this.props.activeIndex;
|
|
180
158
|
return activeIndexProp != null ? activeIndexProp : this.state.activeIndex;
|
|
181
159
|
};
|
|
182
160
|
|
|
183
|
-
|
|
161
|
+
_proto.getDirection = function getDirection(prevIndex, index) {
|
|
184
162
|
if (prevIndex === index) {
|
|
185
163
|
return null;
|
|
186
164
|
}
|
|
@@ -188,7 +166,7 @@ var Carousel = function (_React$Component) {
|
|
|
188
166
|
return prevIndex > index ? 'prev' : 'next';
|
|
189
167
|
};
|
|
190
168
|
|
|
191
|
-
|
|
169
|
+
_proto.handleItemAnimateOutEnd = function handleItemAnimateOutEnd() {
|
|
192
170
|
var _this2 = this;
|
|
193
171
|
|
|
194
172
|
this.setState({
|
|
@@ -203,76 +181,72 @@ var Carousel = function (_React$Component) {
|
|
|
203
181
|
});
|
|
204
182
|
};
|
|
205
183
|
|
|
206
|
-
|
|
184
|
+
_proto.handleMouseOut = function handleMouseOut() {
|
|
207
185
|
if (this.isPaused) {
|
|
208
186
|
this.play();
|
|
209
187
|
}
|
|
210
188
|
};
|
|
211
189
|
|
|
212
|
-
|
|
190
|
+
_proto.handleMouseOver = function handleMouseOver() {
|
|
213
191
|
if (this.props.pauseOnHover) {
|
|
214
192
|
this.pause();
|
|
215
193
|
}
|
|
216
194
|
};
|
|
217
195
|
|
|
218
|
-
|
|
196
|
+
_proto.handleNext = function handleNext(e) {
|
|
219
197
|
var index = this.getActiveIndex() + 1;
|
|
220
|
-
|
|
198
|
+
|
|
199
|
+
var count = _ValidComponentChildren.default.count(this.props.children);
|
|
221
200
|
|
|
222
201
|
if (index > count - 1) {
|
|
223
202
|
if (!this.props.wrap) {
|
|
224
203
|
return;
|
|
225
204
|
}
|
|
205
|
+
|
|
226
206
|
index = 0;
|
|
227
207
|
}
|
|
228
208
|
|
|
229
209
|
this.select(index, e, 'next');
|
|
230
210
|
};
|
|
231
211
|
|
|
232
|
-
|
|
212
|
+
_proto.handlePrev = function handlePrev(e) {
|
|
233
213
|
var index = this.getActiveIndex() - 1;
|
|
234
214
|
|
|
235
215
|
if (index < 0) {
|
|
236
216
|
if (!this.props.wrap) {
|
|
237
217
|
return;
|
|
238
218
|
}
|
|
239
|
-
|
|
219
|
+
|
|
220
|
+
index = _ValidComponentChildren.default.count(this.props.children) - 1;
|
|
240
221
|
}
|
|
241
222
|
|
|
242
223
|
this.select(index, e, 'prev');
|
|
243
|
-
};
|
|
224
|
+
}; // This might be a public API.
|
|
244
225
|
|
|
245
|
-
// This might be a public API.
|
|
246
226
|
|
|
247
|
-
|
|
248
|
-
Carousel.prototype.pause = function pause() {
|
|
227
|
+
_proto.pause = function pause() {
|
|
249
228
|
this.isPaused = true;
|
|
250
229
|
clearTimeout(this.timeout);
|
|
251
|
-
};
|
|
252
|
-
|
|
253
|
-
// This might be a public API.
|
|
230
|
+
}; // This might be a public API.
|
|
254
231
|
|
|
255
232
|
|
|
256
|
-
|
|
233
|
+
_proto.play = function play() {
|
|
257
234
|
this.isPaused = false;
|
|
258
235
|
this.waitForNext();
|
|
259
236
|
};
|
|
260
237
|
|
|
261
|
-
|
|
262
|
-
clearTimeout(this.timeout);
|
|
263
|
-
|
|
264
|
-
// TODO: Is this necessary? Seems like the only risk is if the component
|
|
238
|
+
_proto.select = function select(index, e, direction) {
|
|
239
|
+
clearTimeout(this.timeout); // TODO: Is this necessary? Seems like the only risk is if the component
|
|
265
240
|
// unmounts while handleItemAnimateOutEnd fires.
|
|
241
|
+
|
|
266
242
|
if (this.isUnmounted) {
|
|
267
243
|
return;
|
|
268
244
|
}
|
|
269
245
|
|
|
270
246
|
var previousActiveIndex = this.props.slide ? this.getActiveIndex() : null;
|
|
271
247
|
direction = direction || this.getDirection(previousActiveIndex, index);
|
|
272
|
-
|
|
273
248
|
var onSelect = this.props.onSelect;
|
|
274
249
|
|
|
275
|
-
|
|
276
250
|
if (onSelect) {
|
|
277
251
|
if (onSelect.length > 1) {
|
|
278
252
|
// React SyntheticEvents are pooled, so we need to remove this event
|
|
@@ -283,7 +257,9 @@ var Carousel = function (_React$Component) {
|
|
|
283
257
|
e.persist();
|
|
284
258
|
e.direction = direction;
|
|
285
259
|
} else {
|
|
286
|
-
e = {
|
|
260
|
+
e = {
|
|
261
|
+
direction: direction
|
|
262
|
+
};
|
|
287
263
|
}
|
|
288
264
|
|
|
289
265
|
onSelect(index, e);
|
|
@@ -308,19 +284,18 @@ var Carousel = function (_React$Component) {
|
|
|
308
284
|
}
|
|
309
285
|
};
|
|
310
286
|
|
|
311
|
-
|
|
312
|
-
var
|
|
313
|
-
slide =
|
|
314
|
-
interval =
|
|
315
|
-
activeIndexProp =
|
|
316
|
-
|
|
287
|
+
_proto.waitForNext = function waitForNext() {
|
|
288
|
+
var _this$props = this.props,
|
|
289
|
+
slide = _this$props.slide,
|
|
290
|
+
interval = _this$props.interval,
|
|
291
|
+
activeIndexProp = _this$props.activeIndex;
|
|
317
292
|
|
|
318
293
|
if (!this.isPaused && slide && interval && activeIndexProp == null) {
|
|
319
294
|
this.timeout = setTimeout(this.handleNext, interval);
|
|
320
295
|
}
|
|
321
296
|
};
|
|
322
297
|
|
|
323
|
-
|
|
298
|
+
_proto.renderControls = function renderControls(properties) {
|
|
324
299
|
var wrap = properties.wrap,
|
|
325
300
|
children = properties.children,
|
|
326
301
|
activeIndex = properties.activeIndex,
|
|
@@ -329,83 +304,65 @@ var Carousel = function (_React$Component) {
|
|
|
329
304
|
bsProps = properties.bsProps,
|
|
330
305
|
prevLabel = properties.prevLabel,
|
|
331
306
|
nextLabel = properties.nextLabel;
|
|
332
|
-
|
|
333
307
|
var controlClassName = (0, _bootstrapUtils.prefix)(bsProps, 'control');
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
_SafeAnchor2.default,
|
|
351
|
-
{
|
|
352
|
-
key: 'next',
|
|
353
|
-
className: (0, _classnames2.default)(controlClassName, 'right'),
|
|
354
|
-
onClick: this.handleNext
|
|
355
|
-
},
|
|
356
|
-
nextIcon,
|
|
357
|
-
nextLabel && _react2.default.createElement(
|
|
358
|
-
'span',
|
|
359
|
-
{ className: 'sr-only' },
|
|
360
|
-
nextLabel
|
|
361
|
-
)
|
|
362
|
-
)];
|
|
308
|
+
|
|
309
|
+
var count = _ValidComponentChildren.default.count(children);
|
|
310
|
+
|
|
311
|
+
return [(wrap || activeIndex !== 0) && _react.default.createElement(_SafeAnchor.default, {
|
|
312
|
+
key: "prev",
|
|
313
|
+
className: (0, _classnames.default)(controlClassName, 'left'),
|
|
314
|
+
onClick: this.handlePrev
|
|
315
|
+
}, prevIcon, prevLabel && _react.default.createElement("span", {
|
|
316
|
+
className: "sr-only"
|
|
317
|
+
}, prevLabel)), (wrap || activeIndex !== count - 1) && _react.default.createElement(_SafeAnchor.default, {
|
|
318
|
+
key: "next",
|
|
319
|
+
className: (0, _classnames.default)(controlClassName, 'right'),
|
|
320
|
+
onClick: this.handleNext
|
|
321
|
+
}, nextIcon, nextLabel && _react.default.createElement("span", {
|
|
322
|
+
className: "sr-only"
|
|
323
|
+
}, nextLabel))];
|
|
363
324
|
};
|
|
364
325
|
|
|
365
|
-
|
|
326
|
+
_proto.renderIndicators = function renderIndicators(children, activeIndex, bsProps) {
|
|
366
327
|
var _this3 = this;
|
|
367
328
|
|
|
368
329
|
var indicators = [];
|
|
369
330
|
|
|
370
|
-
|
|
371
|
-
indicators.push(
|
|
331
|
+
_ValidComponentChildren.default.forEach(children, function (child, index) {
|
|
332
|
+
indicators.push(_react.default.createElement("li", {
|
|
372
333
|
key: index,
|
|
373
334
|
className: index === activeIndex ? 'active' : null,
|
|
374
335
|
onClick: function onClick(e) {
|
|
375
336
|
return _this3.select(index, e);
|
|
376
337
|
}
|
|
377
|
-
}),
|
|
378
|
-
|
|
379
|
-
// Force whitespace between indicator elements. Bootstrap requires
|
|
338
|
+
}), // Force whitespace between indicator elements. Bootstrap requires
|
|
380
339
|
// this for correct spacing of elements.
|
|
381
340
|
' ');
|
|
382
341
|
});
|
|
383
342
|
|
|
384
|
-
return
|
|
385
|
-
'
|
|
386
|
-
|
|
387
|
-
indicators
|
|
388
|
-
);
|
|
343
|
+
return _react.default.createElement("ol", {
|
|
344
|
+
className: (0, _bootstrapUtils.prefix)(bsProps, 'indicators')
|
|
345
|
+
}, indicators);
|
|
389
346
|
};
|
|
390
347
|
|
|
391
|
-
|
|
348
|
+
_proto.render = function render() {
|
|
392
349
|
var _this4 = this;
|
|
393
350
|
|
|
394
|
-
var
|
|
395
|
-
slide =
|
|
396
|
-
indicators =
|
|
397
|
-
controls =
|
|
398
|
-
wrap =
|
|
399
|
-
prevIcon =
|
|
400
|
-
prevLabel =
|
|
401
|
-
nextIcon =
|
|
402
|
-
nextLabel =
|
|
403
|
-
className =
|
|
404
|
-
children =
|
|
405
|
-
props = (0,
|
|
406
|
-
var
|
|
407
|
-
previousActiveIndex =
|
|
408
|
-
direction =
|
|
351
|
+
var _this$props2 = this.props,
|
|
352
|
+
slide = _this$props2.slide,
|
|
353
|
+
indicators = _this$props2.indicators,
|
|
354
|
+
controls = _this$props2.controls,
|
|
355
|
+
wrap = _this$props2.wrap,
|
|
356
|
+
prevIcon = _this$props2.prevIcon,
|
|
357
|
+
prevLabel = _this$props2.prevLabel,
|
|
358
|
+
nextIcon = _this$props2.nextIcon,
|
|
359
|
+
nextLabel = _this$props2.nextLabel,
|
|
360
|
+
className = _this$props2.className,
|
|
361
|
+
children = _this$props2.children,
|
|
362
|
+
props = (0, _objectWithoutPropertiesLoose2.default)(_this$props2, ["slide", "indicators", "controls", "wrap", "prevIcon", "prevLabel", "nextIcon", "nextLabel", "className", "children"]);
|
|
363
|
+
var _this$state = this.state,
|
|
364
|
+
previousActiveIndex = _this$state.previousActiveIndex,
|
|
365
|
+
direction = _this$state.direction;
|
|
409
366
|
|
|
410
367
|
var _splitBsPropsAndOmit = (0, _bootstrapUtils.splitBsPropsAndOmit)(props, ['interval', 'pauseOnHover', 'onSelect', 'onSlideEnd', 'activeIndex', // Accessed via this.getActiveIndex().
|
|
411
368
|
'defaultActiveIndex', 'direction']),
|
|
@@ -413,57 +370,47 @@ var Carousel = function (_React$Component) {
|
|
|
413
370
|
elementProps = _splitBsPropsAndOmit[1];
|
|
414
371
|
|
|
415
372
|
var activeIndex = this.getActiveIndex();
|
|
416
|
-
|
|
417
|
-
var classes = (0, _extends3.default)({}, (0, _bootstrapUtils.getClassSet)(bsProps), {
|
|
373
|
+
var classes = (0, _extends2.default)({}, (0, _bootstrapUtils.getClassSet)(bsProps), {
|
|
418
374
|
slide: slide
|
|
419
375
|
});
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
wrap: wrap,
|
|
448
|
-
children: children,
|
|
449
|
-
activeIndex: activeIndex,
|
|
450
|
-
prevIcon: prevIcon,
|
|
451
|
-
prevLabel: prevLabel,
|
|
452
|
-
nextIcon: nextIcon,
|
|
453
|
-
nextLabel: nextLabel,
|
|
454
|
-
bsProps: bsProps
|
|
455
|
-
})
|
|
456
|
-
);
|
|
376
|
+
return _react.default.createElement("div", (0, _extends2.default)({}, elementProps, {
|
|
377
|
+
className: (0, _classnames.default)(className, classes),
|
|
378
|
+
onMouseOver: this.handleMouseOver,
|
|
379
|
+
onMouseOut: this.handleMouseOut
|
|
380
|
+
}), indicators && this.renderIndicators(children, activeIndex, bsProps), _react.default.createElement("div", {
|
|
381
|
+
className: (0, _bootstrapUtils.prefix)(bsProps, 'inner')
|
|
382
|
+
}, _ValidComponentChildren.default.map(children, function (child, index) {
|
|
383
|
+
var active = index === activeIndex;
|
|
384
|
+
var previousActive = slide && index === previousActiveIndex;
|
|
385
|
+
return (0, _react.cloneElement)(child, {
|
|
386
|
+
active: active,
|
|
387
|
+
index: index,
|
|
388
|
+
animateOut: previousActive,
|
|
389
|
+
animateIn: active && previousActiveIndex != null && slide,
|
|
390
|
+
direction: direction,
|
|
391
|
+
onAnimateOutEnd: previousActive ? _this4.handleItemAnimateOutEnd : null
|
|
392
|
+
});
|
|
393
|
+
})), controls && this.renderControls({
|
|
394
|
+
wrap: wrap,
|
|
395
|
+
children: children,
|
|
396
|
+
activeIndex: activeIndex,
|
|
397
|
+
prevIcon: prevIcon,
|
|
398
|
+
prevLabel: prevLabel,
|
|
399
|
+
nextIcon: nextIcon,
|
|
400
|
+
nextLabel: nextLabel,
|
|
401
|
+
bsProps: bsProps
|
|
402
|
+
}));
|
|
457
403
|
};
|
|
458
404
|
|
|
459
405
|
return Carousel;
|
|
460
|
-
}(
|
|
406
|
+
}(_react.default.Component);
|
|
461
407
|
|
|
462
408
|
Carousel.propTypes = propTypes;
|
|
463
409
|
Carousel.defaultProps = defaultProps;
|
|
410
|
+
Carousel.Caption = _CarouselCaption.default;
|
|
411
|
+
Carousel.Item = _CarouselItem.default;
|
|
464
412
|
|
|
465
|
-
|
|
466
|
-
Carousel.Item = _CarouselItem2.default;
|
|
413
|
+
var _default = (0, _bootstrapUtils.bsClass)('carousel', Carousel);
|
|
467
414
|
|
|
468
|
-
exports.default =
|
|
469
|
-
module.exports = exports[
|
|
415
|
+
exports.default = _default;
|
|
416
|
+
module.exports = exports["default"];
|