react-bootstrap 0.31.1 → 0.31.5
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 +53 -0
- package/dist/react-bootstrap.js +4811 -4179
- package/dist/react-bootstrap.min.js +9 -9
- package/dist/react-bootstrap.min.js.map +1 -1
- package/es/ButtonToolbar.js +2 -3
- package/es/Carousel.js +85 -77
- package/es/Checkbox.js +2 -0
- package/es/CloseButton.js +1 -1
- package/es/Collapse.js +18 -18
- package/es/Dropdown.js +50 -50
- package/es/DropdownMenu.js +28 -28
- package/es/Fade.js +2 -2
- package/es/FormControl.js +1 -2
- package/es/MediaBody.js +15 -2
- package/es/Modal.js +23 -15
- package/es/Nav.js +44 -44
- package/es/Navbar.js +4 -4
- package/es/OverlayTrigger.js +39 -39
- package/es/Panel.js +44 -44
- package/es/Radio.js +2 -0
- package/es/SafeAnchor.js +15 -2
- package/es/TabContent.js +5 -5
- package/es/TabPane.js +16 -16
- package/es/Tabs.js +2 -2
- package/es/Thumbnail.js +2 -0
- package/es/ToggleButton.js +8 -0
- package/es/ToggleButtonGroup.js +11 -6
- package/es/index.js +4 -0
- package/es/utils/TransitionEvents.js +11 -10
- package/es/utils/ValidComponentChildren.js +1 -1
- package/es/utils/bootstrapUtils.js +2 -1
- package/lib/Accordion.js +9 -9
- package/lib/Alert.js +14 -14
- package/lib/Badge.js +13 -13
- package/lib/Breadcrumb.js +10 -10
- package/lib/BreadcrumbItem.js +14 -14
- package/lib/Button.js +20 -20
- package/lib/ButtonGroup.js +13 -13
- package/lib/ButtonToolbar.js +9 -13
- package/lib/Carousel.js +127 -119
- package/lib/CarouselCaption.js +10 -10
- package/lib/CarouselItem.js +16 -16
- package/lib/Checkbox.js +21 -21
- package/lib/Clearfix.js +15 -15
- package/lib/CloseButton.js +12 -14
- package/lib/Col.js +30 -30
- package/lib/Collapse.js +47 -47
- package/lib/ControlLabel.js +14 -14
- package/lib/Dropdown.js +92 -92
- package/lib/DropdownButton.js +22 -22
- package/lib/DropdownMenu.js +51 -51
- package/lib/DropdownToggle.js +16 -16
- package/lib/Fade.js +20 -20
- package/lib/Form.js +12 -12
- package/lib/FormControl.js +17 -17
- package/lib/FormControlFeedback.js +13 -13
- package/lib/FormControlStatic.js +10 -10
- package/lib/FormGroup.js +15 -15
- package/lib/Glyphicon.js +11 -11
- package/lib/Grid.js +11 -11
- package/lib/HelpBlock.js +9 -9
- package/lib/Image.js +13 -13
- package/lib/InputGroup.js +11 -11
- package/lib/InputGroupAddon.js +9 -9
- package/lib/InputGroupButton.js +9 -9
- package/lib/Jumbotron.js +10 -10
- package/lib/Label.js +12 -12
- package/lib/ListGroup.js +16 -16
- package/lib/ListGroupItem.js +22 -22
- package/lib/Media.js +16 -16
- package/lib/MediaBody.js +29 -10
- package/lib/MediaHeading.js +10 -10
- package/lib/MediaLeft.js +11 -11
- package/lib/MediaList.js +9 -9
- package/lib/MediaListItem.js +9 -9
- package/lib/MediaRight.js +11 -11
- package/lib/MenuItem.js +23 -23
- package/lib/Modal.js +73 -65
- package/lib/ModalBody.js +10 -10
- package/lib/ModalDialog.js +16 -16
- package/lib/ModalFooter.js +10 -10
- package/lib/ModalHeader.js +17 -17
- package/lib/ModalTitle.js +10 -10
- package/lib/Nav.js +81 -81
- package/lib/NavDropdown.js +25 -25
- package/lib/NavItem.js +18 -18
- package/lib/Navbar.js +47 -47
- 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 -25
- package/lib/OverlayTrigger.js +75 -75
- package/lib/PageHeader.js +11 -11
- package/lib/PageItem.js +2 -2
- package/lib/Pager.js +14 -14
- package/lib/PagerItem.js +17 -17
- package/lib/Pagination.js +52 -52
- package/lib/PaginationButton.js +20 -20
- package/lib/Panel.js +76 -76
- package/lib/PanelGroup.js +18 -18
- package/lib/Popover.js +22 -22
- package/lib/ProgressBar.js +29 -29
- package/lib/Radio.js +21 -21
- package/lib/ResponsiveEmbed.js +17 -17
- package/lib/Row.js +10 -10
- package/lib/SafeAnchor.js +31 -16
- package/lib/SplitButton.js +26 -26
- package/lib/SplitToggle.js +8 -8
- package/lib/Tab.js +15 -15
- package/lib/TabContainer.js +17 -17
- package/lib/TabContent.js +29 -29
- package/lib/TabPane.js +57 -57
- package/lib/Table.js +16 -16
- package/lib/Tabs.js +28 -28
- package/lib/Thumbnail.js +19 -19
- package/lib/ToggleButton.js +23 -16
- package/lib/ToggleButtonGroup.js +38 -26
- package/lib/Tooltip.js +20 -20
- package/lib/Well.js +9 -9
- package/lib/index.js +83 -73
- package/lib/utils/PropTypes.js +5 -5
- package/lib/utils/TransitionEvents.js +12 -11
- package/lib/utils/ValidComponentChildren.js +19 -19
- package/lib/utils/bootstrapUtils.js +11 -10
- 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 +20 -18
package/es/Modal.js
CHANGED
|
@@ -34,6 +34,12 @@ var propTypes = _extends({}, BaseModal.propTypes, ModalDialog.propTypes, {
|
|
|
34
34
|
*/
|
|
35
35
|
backdrop: PropTypes.oneOf(['static', true, false]),
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Add an optional extra class name to .modal-backdrop
|
|
39
|
+
* It could end up looking like class="modal-backdrop foo-modal-backdrop in".
|
|
40
|
+
*/
|
|
41
|
+
backdropClassName: PropTypes.string,
|
|
42
|
+
|
|
37
43
|
/**
|
|
38
44
|
* Close the modal when escape key is pressed
|
|
39
45
|
*/
|
|
@@ -142,6 +148,7 @@ var Modal = function (_React$Component) {
|
|
|
142
148
|
_this.handleExited = _this.handleExited.bind(_this);
|
|
143
149
|
_this.handleWindowResize = _this.handleWindowResize.bind(_this);
|
|
144
150
|
_this.handleDialogClick = _this.handleDialogClick.bind(_this);
|
|
151
|
+
_this.setModalRef = _this.setModalRef.bind(_this);
|
|
145
152
|
|
|
146
153
|
_this.state = {
|
|
147
154
|
style: {}
|
|
@@ -162,6 +169,18 @@ var Modal = function (_React$Component) {
|
|
|
162
169
|
this.handleExited();
|
|
163
170
|
};
|
|
164
171
|
|
|
172
|
+
Modal.prototype.setModalRef = function setModalRef(ref) {
|
|
173
|
+
this._modal = ref;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
Modal.prototype.handleDialogClick = function handleDialogClick(e) {
|
|
177
|
+
if (e.target !== e.currentTarget) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
this.props.onHide();
|
|
182
|
+
};
|
|
183
|
+
|
|
165
184
|
Modal.prototype.handleEntering = function handleEntering() {
|
|
166
185
|
// FIXME: This should work even when animation is disabled.
|
|
167
186
|
events.on(window, 'resize', this.handleWindowResize);
|
|
@@ -177,14 +196,6 @@ var Modal = function (_React$Component) {
|
|
|
177
196
|
this.updateStyle();
|
|
178
197
|
};
|
|
179
198
|
|
|
180
|
-
Modal.prototype.handleDialogClick = function handleDialogClick(e) {
|
|
181
|
-
if (e.target !== e.currentTarget) {
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
this.props.onHide();
|
|
186
|
-
};
|
|
187
|
-
|
|
188
199
|
Modal.prototype.updateStyle = function updateStyle() {
|
|
189
200
|
if (!canUseDOM) {
|
|
190
201
|
return;
|
|
@@ -206,10 +217,9 @@ var Modal = function (_React$Component) {
|
|
|
206
217
|
};
|
|
207
218
|
|
|
208
219
|
Modal.prototype.render = function render() {
|
|
209
|
-
var _this2 = this;
|
|
210
|
-
|
|
211
220
|
var _props = this.props,
|
|
212
221
|
backdrop = _props.backdrop,
|
|
222
|
+
backdropClassName = _props.backdropClassName,
|
|
213
223
|
animation = _props.animation,
|
|
214
224
|
show = _props.show,
|
|
215
225
|
Dialog = _props.dialogComponentClass,
|
|
@@ -218,7 +228,7 @@ var Modal = function (_React$Component) {
|
|
|
218
228
|
children = _props.children,
|
|
219
229
|
onEntering = _props.onEntering,
|
|
220
230
|
onExited = _props.onExited,
|
|
221
|
-
props = _objectWithoutProperties(_props, ['backdrop', 'animation', 'show', 'dialogComponentClass', 'className', 'style', 'children', 'onEntering', 'onExited']);
|
|
231
|
+
props = _objectWithoutProperties(_props, ['backdrop', 'backdropClassName', 'animation', 'show', 'dialogComponentClass', 'className', 'style', 'children', 'onEntering', 'onExited']);
|
|
222
232
|
|
|
223
233
|
var _splitComponentProps = splitComponentProps(props, BaseModal),
|
|
224
234
|
baseModalProps = _splitComponentProps[0],
|
|
@@ -229,14 +239,12 @@ var Modal = function (_React$Component) {
|
|
|
229
239
|
return React.createElement(
|
|
230
240
|
BaseModal,
|
|
231
241
|
_extends({}, baseModalProps, {
|
|
232
|
-
ref:
|
|
233
|
-
_this2._modal = c;
|
|
234
|
-
},
|
|
242
|
+
ref: this.setModalRef,
|
|
235
243
|
show: show,
|
|
236
244
|
onEntering: createChainedFunction(onEntering, this.handleEntering),
|
|
237
245
|
onExited: createChainedFunction(onExited, this.handleExited),
|
|
238
246
|
backdrop: backdrop,
|
|
239
|
-
backdropClassName: classNames(prefix(props, 'backdrop'), inClassName),
|
|
247
|
+
backdropClassName: classNames(prefix(props, 'backdrop'), backdropClassName, inClassName),
|
|
240
248
|
containerClassName: prefix(props, 'open'),
|
|
241
249
|
transition: animation ? Fade : undefined,
|
|
242
250
|
dialogTransitionTimeout: Modal.TRANSITION_DURATION,
|
package/es/Nav.js
CHANGED
|
@@ -50,8 +50,8 @@ var propTypes = {
|
|
|
50
50
|
*
|
|
51
51
|
* ```js
|
|
52
52
|
* function (
|
|
53
|
-
*
|
|
54
|
-
*
|
|
53
|
+
* Any eventKey,
|
|
54
|
+
* SyntheticEvent event?
|
|
55
55
|
* )
|
|
56
56
|
* ```
|
|
57
57
|
*/
|
|
@@ -148,30 +148,16 @@ var Nav = function (_React$Component) {
|
|
|
148
148
|
activeNode.firstChild.focus();
|
|
149
149
|
};
|
|
150
150
|
|
|
151
|
-
Nav.prototype.
|
|
152
|
-
var
|
|
153
|
-
|
|
154
|
-
switch (event.keyCode) {
|
|
155
|
-
case keycode.codes.left:
|
|
156
|
-
case keycode.codes.up:
|
|
157
|
-
nextActiveChild = this.getNextActiveChild(-1);
|
|
158
|
-
break;
|
|
159
|
-
case keycode.codes.right:
|
|
160
|
-
case keycode.codes.down:
|
|
161
|
-
nextActiveChild = this.getNextActiveChild(1);
|
|
162
|
-
break;
|
|
163
|
-
default:
|
|
164
|
-
// It was a different key; don't handle this keypress.
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
151
|
+
Nav.prototype.getActiveProps = function getActiveProps() {
|
|
152
|
+
var tabContainer = this.context.$bs_tabContainer;
|
|
167
153
|
|
|
168
|
-
|
|
154
|
+
if (tabContainer) {
|
|
155
|
+
process.env.NODE_ENV !== 'production' ? warning(this.props.activeKey == null && !this.props.activeHref, 'Specifying a `<Nav>` `activeKey` or `activeHref` in the context of ' + 'a `<TabContainer>` is not supported. Instead use `<TabContainer ' + ('activeKey={' + this.props.activeKey + '} />`.')) : void 0;
|
|
169
156
|
|
|
170
|
-
|
|
171
|
-
onSelect(nextActiveChild.props.eventKey);
|
|
157
|
+
return tabContainer;
|
|
172
158
|
}
|
|
173
159
|
|
|
174
|
-
this.
|
|
160
|
+
return this.props;
|
|
175
161
|
};
|
|
176
162
|
|
|
177
163
|
Nav.prototype.getNextActiveChild = function getNextActiveChild(offset) {
|
|
@@ -210,28 +196,6 @@ var Nav = function (_React$Component) {
|
|
|
210
196
|
return validChildren[nextIndex];
|
|
211
197
|
};
|
|
212
198
|
|
|
213
|
-
Nav.prototype.getActiveProps = function getActiveProps() {
|
|
214
|
-
var tabContainer = this.context.$bs_tabContainer;
|
|
215
|
-
|
|
216
|
-
if (tabContainer) {
|
|
217
|
-
process.env.NODE_ENV !== 'production' ? warning(this.props.activeKey == null && !this.props.activeHref, 'Specifying a `<Nav>` `activeKey` or `activeHref` in the context of ' + 'a `<TabContainer>` is not supported. Instead use `<TabContainer ' + ('activeKey={' + this.props.activeKey + '} />`.')) : void 0;
|
|
218
|
-
|
|
219
|
-
return tabContainer;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
return this.props;
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
Nav.prototype.isActive = function isActive(_ref2, activeKey, activeHref) {
|
|
226
|
-
var props = _ref2.props;
|
|
227
|
-
|
|
228
|
-
if (props.active || activeKey != null && props.eventKey === activeKey || activeHref && props.href === activeHref) {
|
|
229
|
-
return true;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
return props.active;
|
|
233
|
-
};
|
|
234
|
-
|
|
235
199
|
Nav.prototype.getTabProps = function getTabProps(child, tabContainer, navRole, active, onSelect) {
|
|
236
200
|
var _this4 = this;
|
|
237
201
|
|
|
@@ -273,6 +237,42 @@ var Nav = function (_React$Component) {
|
|
|
273
237
|
};
|
|
274
238
|
};
|
|
275
239
|
|
|
240
|
+
Nav.prototype.handleTabKeyDown = function handleTabKeyDown(onSelect, event) {
|
|
241
|
+
var nextActiveChild = void 0;
|
|
242
|
+
|
|
243
|
+
switch (event.keyCode) {
|
|
244
|
+
case keycode.codes.left:
|
|
245
|
+
case keycode.codes.up:
|
|
246
|
+
nextActiveChild = this.getNextActiveChild(-1);
|
|
247
|
+
break;
|
|
248
|
+
case keycode.codes.right:
|
|
249
|
+
case keycode.codes.down:
|
|
250
|
+
nextActiveChild = this.getNextActiveChild(1);
|
|
251
|
+
break;
|
|
252
|
+
default:
|
|
253
|
+
// It was a different key; don't handle this keypress.
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
event.preventDefault();
|
|
258
|
+
|
|
259
|
+
if (onSelect && nextActiveChild && nextActiveChild.props.eventKey != null) {
|
|
260
|
+
onSelect(nextActiveChild.props.eventKey);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
this._needsRefocus = true;
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
Nav.prototype.isActive = function isActive(_ref2, activeKey, activeHref) {
|
|
267
|
+
var props = _ref2.props;
|
|
268
|
+
|
|
269
|
+
if (props.active || activeKey != null && props.eventKey === activeKey || activeHref && props.href === activeHref) {
|
|
270
|
+
return true;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
return props.active;
|
|
274
|
+
};
|
|
275
|
+
|
|
276
276
|
Nav.prototype.render = function render() {
|
|
277
277
|
var _extends2,
|
|
278
278
|
_this5 = this;
|
package/es/Navbar.js
CHANGED
|
@@ -52,10 +52,10 @@ var propTypes = {
|
|
|
52
52
|
componentClass: elementType,
|
|
53
53
|
/**
|
|
54
54
|
* A callback fired when the `<Navbar>` body collapses or expands. Fired when
|
|
55
|
-
* a `<Navbar.Toggle>` is clicked and called with the new `
|
|
55
|
+
* a `<Navbar.Toggle>` is clicked and called with the new `expanded`
|
|
56
56
|
* boolean value.
|
|
57
57
|
*
|
|
58
|
-
* @controllable
|
|
58
|
+
* @controllable expanded
|
|
59
59
|
*/
|
|
60
60
|
onToggle: PropTypes.func,
|
|
61
61
|
/**
|
|
@@ -67,8 +67,8 @@ var propTypes = {
|
|
|
67
67
|
*
|
|
68
68
|
* ```js
|
|
69
69
|
* function (
|
|
70
|
-
*
|
|
71
|
-
*
|
|
70
|
+
* Any eventKey,
|
|
71
|
+
* SyntheticEvent event?
|
|
72
72
|
* )
|
|
73
73
|
* ```
|
|
74
74
|
*
|
package/es/OverlayTrigger.js
CHANGED
|
@@ -32,8 +32,8 @@ var triggerType = PropTypes.oneOf(['click', 'hover', 'focus']);
|
|
|
32
32
|
var propTypes = _extends({}, Overlay.propTypes, {
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
* Specify which action or actions trigger Overlay visibility
|
|
36
|
+
*/
|
|
37
37
|
trigger: PropTypes.oneOfType([triggerType, PropTypes.arrayOf(triggerType)]),
|
|
38
38
|
|
|
39
39
|
/**
|
|
@@ -88,8 +88,8 @@ var propTypes = _extends({}, Overlay.propTypes, {
|
|
|
88
88
|
*/
|
|
89
89
|
target: PropTypes.oneOf([null]),
|
|
90
90
|
/**
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
* @private
|
|
92
|
+
*/
|
|
93
93
|
onHide: PropTypes.oneOf([null]),
|
|
94
94
|
/**
|
|
95
95
|
* @private
|
|
@@ -147,66 +147,62 @@ var OverlayTrigger = function (_React$Component) {
|
|
|
147
147
|
clearTimeout(this._hoverHideDelay);
|
|
148
148
|
};
|
|
149
149
|
|
|
150
|
-
OverlayTrigger.prototype.
|
|
151
|
-
if (this.state.show) {
|
|
152
|
-
this.hide();
|
|
153
|
-
} else {
|
|
154
|
-
this.show();
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
OverlayTrigger.prototype.handleDelayedShow = function handleDelayedShow() {
|
|
150
|
+
OverlayTrigger.prototype.handleDelayedHide = function handleDelayedHide() {
|
|
159
151
|
var _this2 = this;
|
|
160
152
|
|
|
161
|
-
if (this.
|
|
162
|
-
clearTimeout(this.
|
|
163
|
-
this.
|
|
153
|
+
if (this._hoverShowDelay != null) {
|
|
154
|
+
clearTimeout(this._hoverShowDelay);
|
|
155
|
+
this._hoverShowDelay = null;
|
|
164
156
|
return;
|
|
165
157
|
}
|
|
166
158
|
|
|
167
|
-
if (this.state.show || this.
|
|
159
|
+
if (!this.state.show || this._hoverHideDelay != null) {
|
|
168
160
|
return;
|
|
169
161
|
}
|
|
170
162
|
|
|
171
|
-
var delay = this.props.
|
|
163
|
+
var delay = this.props.delayHide != null ? this.props.delayHide : this.props.delay;
|
|
172
164
|
|
|
173
165
|
if (!delay) {
|
|
174
|
-
this.
|
|
166
|
+
this.hide();
|
|
175
167
|
return;
|
|
176
168
|
}
|
|
177
169
|
|
|
178
|
-
this.
|
|
179
|
-
_this2.
|
|
180
|
-
_this2.
|
|
170
|
+
this._hoverHideDelay = setTimeout(function () {
|
|
171
|
+
_this2._hoverHideDelay = null;
|
|
172
|
+
_this2.hide();
|
|
181
173
|
}, delay);
|
|
182
174
|
};
|
|
183
175
|
|
|
184
|
-
OverlayTrigger.prototype.
|
|
176
|
+
OverlayTrigger.prototype.handleDelayedShow = function handleDelayedShow() {
|
|
185
177
|
var _this3 = this;
|
|
186
178
|
|
|
187
|
-
if (this.
|
|
188
|
-
clearTimeout(this.
|
|
189
|
-
this.
|
|
179
|
+
if (this._hoverHideDelay != null) {
|
|
180
|
+
clearTimeout(this._hoverHideDelay);
|
|
181
|
+
this._hoverHideDelay = null;
|
|
190
182
|
return;
|
|
191
183
|
}
|
|
192
184
|
|
|
193
|
-
if (
|
|
185
|
+
if (this.state.show || this._hoverShowDelay != null) {
|
|
194
186
|
return;
|
|
195
187
|
}
|
|
196
188
|
|
|
197
|
-
var delay = this.props.
|
|
189
|
+
var delay = this.props.delayShow != null ? this.props.delayShow : this.props.delay;
|
|
198
190
|
|
|
199
191
|
if (!delay) {
|
|
200
|
-
this.
|
|
192
|
+
this.show();
|
|
201
193
|
return;
|
|
202
194
|
}
|
|
203
195
|
|
|
204
|
-
this.
|
|
205
|
-
_this3.
|
|
206
|
-
_this3.
|
|
196
|
+
this._hoverShowDelay = setTimeout(function () {
|
|
197
|
+
_this3._hoverShowDelay = null;
|
|
198
|
+
_this3.show();
|
|
207
199
|
}, delay);
|
|
208
200
|
};
|
|
209
201
|
|
|
202
|
+
OverlayTrigger.prototype.handleHide = function handleHide() {
|
|
203
|
+
this.hide();
|
|
204
|
+
};
|
|
205
|
+
|
|
210
206
|
// Simple implementation of mouseEnter and mouseLeave.
|
|
211
207
|
// React's built version is broken: https://github.com/facebook/react/issues/4251
|
|
212
208
|
// for cases when the trigger is disabled and mouseOut/Over can cause flicker
|
|
@@ -217,17 +213,17 @@ var OverlayTrigger = function (_React$Component) {
|
|
|
217
213
|
var target = e.currentTarget;
|
|
218
214
|
var related = e.relatedTarget || e.nativeEvent.toElement;
|
|
219
215
|
|
|
220
|
-
if (!related || related !== target && !contains(target, related)) {
|
|
216
|
+
if ((!related || related !== target) && !contains(target, related)) {
|
|
221
217
|
handler(e);
|
|
222
218
|
}
|
|
223
219
|
};
|
|
224
220
|
|
|
225
|
-
OverlayTrigger.prototype.
|
|
226
|
-
this.
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
221
|
+
OverlayTrigger.prototype.handleToggle = function handleToggle() {
|
|
222
|
+
if (this.state.show) {
|
|
223
|
+
this.hide();
|
|
224
|
+
} else {
|
|
225
|
+
this.show();
|
|
226
|
+
}
|
|
231
227
|
};
|
|
232
228
|
|
|
233
229
|
OverlayTrigger.prototype.hide = function hide() {
|
|
@@ -246,6 +242,10 @@ var OverlayTrigger = function (_React$Component) {
|
|
|
246
242
|
);
|
|
247
243
|
};
|
|
248
244
|
|
|
245
|
+
OverlayTrigger.prototype.show = function show() {
|
|
246
|
+
this.setState({ show: true });
|
|
247
|
+
};
|
|
248
|
+
|
|
249
249
|
OverlayTrigger.prototype.renderOverlay = function renderOverlay() {
|
|
250
250
|
ReactDOM.unstable_renderSubtreeIntoContainer(this, this._overlay, this._mountNode);
|
|
251
251
|
};
|
package/es/Panel.js
CHANGED
|
@@ -71,33 +71,6 @@ var Panel = function (_React$Component) {
|
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
-
Panel.prototype.renderHeader = function renderHeader(collapsible, header, id, role, expanded, bsProps) {
|
|
75
|
-
var titleClassName = prefix(bsProps, 'title');
|
|
76
|
-
|
|
77
|
-
if (!collapsible) {
|
|
78
|
-
if (!React.isValidElement(header)) {
|
|
79
|
-
return header;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return cloneElement(header, {
|
|
83
|
-
className: classNames(header.props.className, titleClassName)
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (!React.isValidElement(header)) {
|
|
88
|
-
return React.createElement(
|
|
89
|
-
'h4',
|
|
90
|
-
{ role: 'presentation', className: titleClassName },
|
|
91
|
-
this.renderAnchor(header, id, role, expanded)
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return cloneElement(header, {
|
|
96
|
-
className: classNames(header.props.className, titleClassName),
|
|
97
|
-
children: this.renderAnchor(header.props.children, id, role, expanded)
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
|
|
101
74
|
Panel.prototype.renderAnchor = function renderAnchor(header, id, role, expanded) {
|
|
102
75
|
return React.createElement(
|
|
103
76
|
'a',
|
|
@@ -114,23 +87,6 @@ var Panel = function (_React$Component) {
|
|
|
114
87
|
);
|
|
115
88
|
};
|
|
116
89
|
|
|
117
|
-
Panel.prototype.renderCollapsibleBody = function renderCollapsibleBody(id, expanded, role, children, bsProps, animationHooks) {
|
|
118
|
-
return React.createElement(
|
|
119
|
-
Collapse,
|
|
120
|
-
_extends({ 'in': expanded }, animationHooks),
|
|
121
|
-
React.createElement(
|
|
122
|
-
'div',
|
|
123
|
-
{
|
|
124
|
-
id: id,
|
|
125
|
-
role: role,
|
|
126
|
-
className: prefix(bsProps, 'collapse'),
|
|
127
|
-
'aria-hidden': !expanded
|
|
128
|
-
},
|
|
129
|
-
this.renderBody(children, bsProps)
|
|
130
|
-
)
|
|
131
|
-
);
|
|
132
|
-
};
|
|
133
|
-
|
|
134
90
|
Panel.prototype.renderBody = function renderBody(rawChildren, bsProps) {
|
|
135
91
|
var children = [];
|
|
136
92
|
var bodyChildren = [];
|
|
@@ -171,6 +127,50 @@ var Panel = function (_React$Component) {
|
|
|
171
127
|
return children;
|
|
172
128
|
};
|
|
173
129
|
|
|
130
|
+
Panel.prototype.renderCollapsibleBody = function renderCollapsibleBody(id, expanded, role, children, bsProps, animationHooks) {
|
|
131
|
+
return React.createElement(
|
|
132
|
+
Collapse,
|
|
133
|
+
_extends({ 'in': expanded }, animationHooks),
|
|
134
|
+
React.createElement(
|
|
135
|
+
'div',
|
|
136
|
+
{
|
|
137
|
+
id: id,
|
|
138
|
+
role: role,
|
|
139
|
+
className: prefix(bsProps, 'collapse'),
|
|
140
|
+
'aria-hidden': !expanded
|
|
141
|
+
},
|
|
142
|
+
this.renderBody(children, bsProps)
|
|
143
|
+
)
|
|
144
|
+
);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
Panel.prototype.renderHeader = function renderHeader(collapsible, header, id, role, expanded, bsProps) {
|
|
148
|
+
var titleClassName = prefix(bsProps, 'title');
|
|
149
|
+
|
|
150
|
+
if (!collapsible) {
|
|
151
|
+
if (!React.isValidElement(header)) {
|
|
152
|
+
return header;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return cloneElement(header, {
|
|
156
|
+
className: classNames(header.props.className, titleClassName)
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (!React.isValidElement(header)) {
|
|
161
|
+
return React.createElement(
|
|
162
|
+
'h4',
|
|
163
|
+
{ role: 'presentation', className: titleClassName },
|
|
164
|
+
this.renderAnchor(header, id, role, expanded)
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return cloneElement(header, {
|
|
169
|
+
className: classNames(header.props.className, titleClassName),
|
|
170
|
+
children: this.renderAnchor(header.props.children, id, role, expanded)
|
|
171
|
+
});
|
|
172
|
+
};
|
|
173
|
+
|
|
174
174
|
Panel.prototype.render = function render() {
|
|
175
175
|
var _props = this.props,
|
|
176
176
|
collapsible = _props.collapsible,
|
package/es/Radio.js
CHANGED
|
@@ -3,6 +3,8 @@ import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutPropert
|
|
|
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
|
+
/* eslint-disable jsx-a11y/label-has-for */
|
|
7
|
+
|
|
6
8
|
import classNames from 'classnames';
|
|
7
9
|
import React from 'react';
|
|
8
10
|
import PropTypes from 'prop-types';
|
package/es/SafeAnchor.js
CHANGED
|
@@ -7,9 +7,12 @@ import React from 'react';
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import elementType from 'prop-types-extra/lib/elementType';
|
|
9
9
|
|
|
10
|
+
import createChainedFunction from './utils/createChainedFunction';
|
|
11
|
+
|
|
10
12
|
var propTypes = {
|
|
11
13
|
href: PropTypes.string,
|
|
12
14
|
onClick: PropTypes.func,
|
|
15
|
+
onKeyDown: PropTypes.func,
|
|
13
16
|
disabled: PropTypes.bool,
|
|
14
17
|
role: PropTypes.string,
|
|
15
18
|
tabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
@@ -44,6 +47,7 @@ var SafeAnchor = function (_React$Component) {
|
|
|
44
47
|
var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
|
|
45
48
|
|
|
46
49
|
_this.handleClick = _this.handleClick.bind(_this);
|
|
50
|
+
_this.handleKeyDown = _this.handleKeyDown.bind(_this);
|
|
47
51
|
return _this;
|
|
48
52
|
}
|
|
49
53
|
|
|
@@ -68,11 +72,19 @@ var SafeAnchor = function (_React$Component) {
|
|
|
68
72
|
}
|
|
69
73
|
};
|
|
70
74
|
|
|
75
|
+
SafeAnchor.prototype.handleKeyDown = function handleKeyDown(event) {
|
|
76
|
+
if (event.key === ' ') {
|
|
77
|
+
event.preventDefault();
|
|
78
|
+
this.handleClick(event);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
71
82
|
SafeAnchor.prototype.render = function render() {
|
|
72
83
|
var _props2 = this.props,
|
|
73
84
|
Component = _props2.componentClass,
|
|
74
85
|
disabled = _props2.disabled,
|
|
75
|
-
|
|
86
|
+
onKeyDown = _props2.onKeyDown,
|
|
87
|
+
props = _objectWithoutProperties(_props2, ['componentClass', 'disabled', 'onKeyDown']);
|
|
76
88
|
|
|
77
89
|
if (isTrivialHref(props.href)) {
|
|
78
90
|
props.role = props.role || 'button';
|
|
@@ -87,7 +99,8 @@ var SafeAnchor = function (_React$Component) {
|
|
|
87
99
|
}
|
|
88
100
|
|
|
89
101
|
return React.createElement(Component, _extends({}, props, {
|
|
90
|
-
onClick: this.handleClick
|
|
102
|
+
onClick: this.handleClick,
|
|
103
|
+
onKeyDown: createChainedFunction(this.handleKeyDown, onKeyDown)
|
|
91
104
|
}));
|
|
92
105
|
};
|
|
93
106
|
|
package/es/TabContent.js
CHANGED
|
@@ -116,6 +116,11 @@ var TabContent = function (_React$Component) {
|
|
|
116
116
|
this.isUnmounted = true;
|
|
117
117
|
};
|
|
118
118
|
|
|
119
|
+
TabContent.prototype.getContainerActiveKey = function getContainerActiveKey() {
|
|
120
|
+
var tabContainer = this.context.$bs_tabContainer;
|
|
121
|
+
return tabContainer && tabContainer.activeKey;
|
|
122
|
+
};
|
|
123
|
+
|
|
119
124
|
TabContent.prototype.handlePaneEnter = function handlePaneEnter(child, childKey) {
|
|
120
125
|
if (!this.props.animation) {
|
|
121
126
|
return false;
|
|
@@ -154,11 +159,6 @@ var TabContent = function (_React$Component) {
|
|
|
154
159
|
});
|
|
155
160
|
};
|
|
156
161
|
|
|
157
|
-
TabContent.prototype.getContainerActiveKey = function getContainerActiveKey() {
|
|
158
|
-
var tabContainer = this.context.$bs_tabContainer;
|
|
159
|
-
return tabContainer && tabContainer.activeKey;
|
|
160
|
-
};
|
|
161
|
-
|
|
162
162
|
TabContent.prototype.render = function render() {
|
|
163
163
|
var _props2 = this.props,
|
|
164
164
|
Component = _props2.componentClass,
|
package/es/TabPane.js
CHANGED
|
@@ -27,10 +27,10 @@ var propTypes = {
|
|
|
27
27
|
*/
|
|
28
28
|
animation: PropTypes.oneOfType([PropTypes.bool, elementType]),
|
|
29
29
|
|
|
30
|
-
/** @private
|
|
30
|
+
/** @private * */
|
|
31
31
|
id: PropTypes.string,
|
|
32
32
|
|
|
33
|
-
/** @private
|
|
33
|
+
/** @private * */
|
|
34
34
|
'aria-labelledby': PropTypes.string,
|
|
35
35
|
|
|
36
36
|
/**
|
|
@@ -117,7 +117,7 @@ var TabPane = function (_React$Component) {
|
|
|
117
117
|
_this.handleEnter = _this.handleEnter.bind(_this);
|
|
118
118
|
_this.handleExited = _this.handleExited.bind(_this);
|
|
119
119
|
|
|
120
|
-
_this
|
|
120
|
+
_this.in = false;
|
|
121
121
|
return _this;
|
|
122
122
|
}
|
|
123
123
|
|
|
@@ -135,7 +135,7 @@ var TabPane = function (_React$Component) {
|
|
|
135
135
|
};
|
|
136
136
|
|
|
137
137
|
TabPane.prototype.componentDidUpdate = function componentDidUpdate() {
|
|
138
|
-
if (this
|
|
138
|
+
if (this.in) {
|
|
139
139
|
if (!this.shouldBeIn()) {
|
|
140
140
|
// We shouldn't be active any more. Notify the parent.
|
|
141
141
|
this.handleExited();
|
|
@@ -147,19 +147,28 @@ var TabPane = function (_React$Component) {
|
|
|
147
147
|
};
|
|
148
148
|
|
|
149
149
|
TabPane.prototype.componentWillUnmount = function componentWillUnmount() {
|
|
150
|
-
if (this
|
|
150
|
+
if (this.in) {
|
|
151
151
|
// In lieu of the action event firing.
|
|
152
152
|
this.handleExited();
|
|
153
153
|
}
|
|
154
154
|
};
|
|
155
155
|
|
|
156
|
+
TabPane.prototype.getAnimation = function getAnimation() {
|
|
157
|
+
if (this.props.animation != null) {
|
|
158
|
+
return this.props.animation;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
var tabContent = this.context.$bs_tabContent;
|
|
162
|
+
return tabContent && tabContent.animation;
|
|
163
|
+
};
|
|
164
|
+
|
|
156
165
|
TabPane.prototype.handleEnter = function handleEnter() {
|
|
157
166
|
var tabContent = this.context.$bs_tabContent;
|
|
158
167
|
if (!tabContent) {
|
|
159
168
|
return;
|
|
160
169
|
}
|
|
161
170
|
|
|
162
|
-
this
|
|
171
|
+
this.in = tabContent.onPaneEnter(this, this.props.eventKey);
|
|
163
172
|
};
|
|
164
173
|
|
|
165
174
|
TabPane.prototype.handleExited = function handleExited() {
|
|
@@ -169,16 +178,7 @@ var TabPane = function (_React$Component) {
|
|
|
169
178
|
}
|
|
170
179
|
|
|
171
180
|
tabContent.onPaneExited(this);
|
|
172
|
-
this
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
TabPane.prototype.getAnimation = function getAnimation() {
|
|
176
|
-
if (this.props.animation != null) {
|
|
177
|
-
return this.props.animation;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
var tabContent = this.context.$bs_tabContent;
|
|
181
|
-
return tabContent && tabContent.animation;
|
|
181
|
+
this.in = false;
|
|
182
182
|
};
|
|
183
183
|
|
|
184
184
|
TabPane.prototype.isActive = function isActive() {
|
package/es/Tabs.js
CHANGED
package/es/Thumbnail.js
CHANGED
|
@@ -3,6 +3,8 @@ import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutPropert
|
|
|
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
|
+
/* eslint-disable jsx-a11y/alt-text */
|
|
7
|
+
|
|
6
8
|
import classNames from 'classnames';
|
|
7
9
|
import React from 'react';
|
|
8
10
|
import PropTypes from 'prop-types';
|