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/SafeAnchor.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
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 React from 'react';
|
|
7
6
|
import PropTypes from 'prop-types';
|
|
8
7
|
import elementType from 'prop-types-extra/lib/elementType';
|
|
9
|
-
|
|
10
8
|
import createChainedFunction from './utils/createChainedFunction';
|
|
11
|
-
|
|
12
9
|
var propTypes = {
|
|
13
10
|
href: PropTypes.string,
|
|
14
11
|
onClick: PropTypes.func,
|
|
@@ -16,12 +13,12 @@ var propTypes = {
|
|
|
16
13
|
disabled: PropTypes.bool,
|
|
17
14
|
role: PropTypes.string,
|
|
18
15
|
tabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
16
|
+
|
|
19
17
|
/**
|
|
20
18
|
* this is sort of silly but needed for Button
|
|
21
19
|
*/
|
|
22
20
|
componentClass: elementType
|
|
23
21
|
};
|
|
24
|
-
|
|
25
22
|
var defaultProps = {
|
|
26
23
|
componentClass: 'a'
|
|
27
24
|
};
|
|
@@ -29,7 +26,6 @@ var defaultProps = {
|
|
|
29
26
|
function isTrivialHref(href) {
|
|
30
27
|
return !href || href.trim() === '#';
|
|
31
28
|
}
|
|
32
|
-
|
|
33
29
|
/**
|
|
34
30
|
* There are situations due to browser quirks or Bootstrap CSS where
|
|
35
31
|
* an anchor tag is needed, when semantically a button tag is the
|
|
@@ -38,25 +34,28 @@ function isTrivialHref(href) {
|
|
|
38
34
|
* links, which is usually desirable for Buttons, NavItems, MenuItems, etc.
|
|
39
35
|
*/
|
|
40
36
|
|
|
41
|
-
var SafeAnchor = function (_React$Component) {
|
|
42
|
-
_inherits(SafeAnchor, _React$Component);
|
|
43
37
|
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
var SafeAnchor =
|
|
39
|
+
/*#__PURE__*/
|
|
40
|
+
function (_React$Component) {
|
|
41
|
+
_inheritsLoose(SafeAnchor, _React$Component);
|
|
46
42
|
|
|
47
|
-
|
|
43
|
+
function SafeAnchor(props, context) {
|
|
44
|
+
var _this;
|
|
48
45
|
|
|
49
|
-
_this
|
|
50
|
-
_this.
|
|
46
|
+
_this = _React$Component.call(this, props, context) || this;
|
|
47
|
+
_this.handleClick = _this.handleClick.bind(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
48
|
+
_this.handleKeyDown = _this.handleKeyDown.bind(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
51
49
|
return _this;
|
|
52
50
|
}
|
|
53
51
|
|
|
54
|
-
SafeAnchor.prototype
|
|
55
|
-
var _props = this.props,
|
|
56
|
-
disabled = _props.disabled,
|
|
57
|
-
href = _props.href,
|
|
58
|
-
onClick = _props.onClick;
|
|
52
|
+
var _proto = SafeAnchor.prototype;
|
|
59
53
|
|
|
54
|
+
_proto.handleClick = function handleClick(event) {
|
|
55
|
+
var _this$props = this.props,
|
|
56
|
+
disabled = _this$props.disabled,
|
|
57
|
+
href = _this$props.href,
|
|
58
|
+
onClick = _this$props.onClick;
|
|
60
59
|
|
|
61
60
|
if (disabled || isTrivialHref(href)) {
|
|
62
61
|
event.preventDefault();
|
|
@@ -72,30 +71,32 @@ var SafeAnchor = function (_React$Component) {
|
|
|
72
71
|
}
|
|
73
72
|
};
|
|
74
73
|
|
|
75
|
-
|
|
74
|
+
_proto.handleKeyDown = function handleKeyDown(event) {
|
|
76
75
|
if (event.key === ' ') {
|
|
77
76
|
event.preventDefault();
|
|
78
77
|
this.handleClick(event);
|
|
79
78
|
}
|
|
80
79
|
};
|
|
81
80
|
|
|
82
|
-
|
|
83
|
-
var
|
|
84
|
-
Component =
|
|
85
|
-
disabled =
|
|
86
|
-
onKeyDown =
|
|
87
|
-
props =
|
|
81
|
+
_proto.render = function render() {
|
|
82
|
+
var _this$props2 = this.props,
|
|
83
|
+
Component = _this$props2.componentClass,
|
|
84
|
+
disabled = _this$props2.disabled,
|
|
85
|
+
onKeyDown = _this$props2.onKeyDown,
|
|
86
|
+
props = _objectWithoutPropertiesLoose(_this$props2, ["componentClass", "disabled", "onKeyDown"]);
|
|
88
87
|
|
|
89
88
|
if (isTrivialHref(props.href)) {
|
|
90
|
-
props.role = props.role || 'button';
|
|
91
|
-
// we want to make sure there is a href attribute on the node
|
|
89
|
+
props.role = props.role || 'button'; // we want to make sure there is a href attribute on the node
|
|
92
90
|
// otherwise, the cursor incorrectly styled (except with role='button')
|
|
91
|
+
|
|
93
92
|
props.href = props.href || '#';
|
|
94
93
|
}
|
|
95
94
|
|
|
96
95
|
if (disabled) {
|
|
97
96
|
props.tabIndex = -1;
|
|
98
|
-
props.style = _extends({
|
|
97
|
+
props.style = _extends({
|
|
98
|
+
pointerEvents: 'none'
|
|
99
|
+
}, props.style);
|
|
99
100
|
}
|
|
100
101
|
|
|
101
102
|
return React.createElement(Component, _extends({}, props, {
|
|
@@ -109,5 +110,4 @@ var SafeAnchor = function (_React$Component) {
|
|
|
109
110
|
|
|
110
111
|
SafeAnchor.propTypes = propTypes;
|
|
111
112
|
SafeAnchor.defaultProps = defaultProps;
|
|
112
|
-
|
|
113
113
|
export default SafeAnchor;
|
package/es/SplitButton.js
CHANGED
|
@@ -1,91 +1,78 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import _inherits from 'babel-runtime/helpers/inherits';
|
|
5
|
-
import _extends from 'babel-runtime/helpers/extends';
|
|
1
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime-corejs2/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
|
+
import _inheritsLoose from "@babel/runtime-corejs2/helpers/esm/inheritsLoose";
|
|
3
|
+
import _extends from "@babel/runtime-corejs2/helpers/esm/extends";
|
|
6
4
|
import React from 'react';
|
|
7
5
|
import PropTypes from 'prop-types';
|
|
8
|
-
|
|
9
6
|
import Button from './Button';
|
|
10
7
|
import Dropdown from './Dropdown';
|
|
11
8
|
import SplitToggle from './SplitToggle';
|
|
12
9
|
import splitComponentProps from './utils/splitComponentProps';
|
|
13
10
|
|
|
14
11
|
var propTypes = _extends({}, Dropdown.propTypes, {
|
|
15
|
-
|
|
16
12
|
// Toggle props.
|
|
17
13
|
bsStyle: PropTypes.string,
|
|
18
14
|
bsSize: PropTypes.string,
|
|
19
15
|
href: PropTypes.string,
|
|
20
16
|
onClick: PropTypes.func,
|
|
17
|
+
|
|
21
18
|
/**
|
|
22
19
|
* The content of the split button.
|
|
23
20
|
*/
|
|
24
21
|
title: PropTypes.node.isRequired,
|
|
22
|
+
|
|
25
23
|
/**
|
|
26
24
|
* Accessible label for the toggle; the value of `title` if not specified.
|
|
27
25
|
*/
|
|
28
26
|
toggleLabel: PropTypes.string,
|
|
29
|
-
|
|
30
27
|
// Override generated docs from <Dropdown>.
|
|
28
|
+
|
|
31
29
|
/**
|
|
32
30
|
* @private
|
|
33
31
|
*/
|
|
34
32
|
children: PropTypes.node
|
|
35
33
|
});
|
|
36
34
|
|
|
37
|
-
var SplitButton =
|
|
38
|
-
|
|
35
|
+
var SplitButton =
|
|
36
|
+
/*#__PURE__*/
|
|
37
|
+
function (_React$Component) {
|
|
38
|
+
_inheritsLoose(SplitButton, _React$Component);
|
|
39
39
|
|
|
40
40
|
function SplitButton() {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
|
41
|
+
return _React$Component.apply(this, arguments) || this;
|
|
44
42
|
}
|
|
45
43
|
|
|
46
|
-
SplitButton.prototype
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
44
|
+
var _proto = SplitButton.prototype;
|
|
45
|
+
|
|
46
|
+
_proto.render = function render() {
|
|
47
|
+
var _this$props = this.props,
|
|
48
|
+
bsSize = _this$props.bsSize,
|
|
49
|
+
bsStyle = _this$props.bsStyle,
|
|
50
|
+
title = _this$props.title,
|
|
51
|
+
toggleLabel = _this$props.toggleLabel,
|
|
52
|
+
children = _this$props.children,
|
|
53
|
+
props = _objectWithoutPropertiesLoose(_this$props, ["bsSize", "bsStyle", "title", "toggleLabel", "children"]);
|
|
54
54
|
|
|
55
55
|
var _splitComponentProps = splitComponentProps(props, Dropdown.ControlledComponent),
|
|
56
56
|
dropdownProps = _splitComponentProps[0],
|
|
57
57
|
buttonProps = _splitComponentProps[1];
|
|
58
58
|
|
|
59
|
-
return React.createElement(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
React.createElement(SplitToggle, {
|
|
72
|
-
'aria-label': toggleLabel || title,
|
|
73
|
-
bsSize: bsSize,
|
|
74
|
-
bsStyle: bsStyle
|
|
75
|
-
}),
|
|
76
|
-
React.createElement(
|
|
77
|
-
Dropdown.Menu,
|
|
78
|
-
null,
|
|
79
|
-
children
|
|
80
|
-
)
|
|
81
|
-
);
|
|
59
|
+
return React.createElement(Dropdown, _extends({}, dropdownProps, {
|
|
60
|
+
bsSize: bsSize,
|
|
61
|
+
bsStyle: bsStyle
|
|
62
|
+
}), React.createElement(Button, _extends({}, buttonProps, {
|
|
63
|
+
disabled: props.disabled,
|
|
64
|
+
bsSize: bsSize,
|
|
65
|
+
bsStyle: bsStyle
|
|
66
|
+
}), title), React.createElement(SplitToggle, {
|
|
67
|
+
"aria-label": toggleLabel || title,
|
|
68
|
+
bsSize: bsSize,
|
|
69
|
+
bsStyle: bsStyle
|
|
70
|
+
}), React.createElement(Dropdown.Menu, null, children));
|
|
82
71
|
};
|
|
83
72
|
|
|
84
73
|
return SplitButton;
|
|
85
74
|
}(React.Component);
|
|
86
75
|
|
|
87
76
|
SplitButton.propTypes = propTypes;
|
|
88
|
-
|
|
89
77
|
SplitButton.Toggle = SplitToggle;
|
|
90
|
-
|
|
91
78
|
export default SplitButton;
|
package/es/SplitToggle.js
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
import _extends from
|
|
2
|
-
import
|
|
3
|
-
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
|
|
4
|
-
import _inherits from 'babel-runtime/helpers/inherits';
|
|
1
|
+
import _extends from "@babel/runtime-corejs2/helpers/esm/extends";
|
|
2
|
+
import _inheritsLoose from "@babel/runtime-corejs2/helpers/esm/inheritsLoose";
|
|
5
3
|
import React from 'react';
|
|
6
|
-
|
|
7
4
|
import DropdownToggle from './DropdownToggle';
|
|
8
5
|
|
|
9
|
-
var SplitToggle =
|
|
10
|
-
|
|
6
|
+
var SplitToggle =
|
|
7
|
+
/*#__PURE__*/
|
|
8
|
+
function (_React$Component) {
|
|
9
|
+
_inheritsLoose(SplitToggle, _React$Component);
|
|
11
10
|
|
|
12
11
|
function SplitToggle() {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
|
12
|
+
return _React$Component.apply(this, arguments) || this;
|
|
16
13
|
}
|
|
17
14
|
|
|
18
|
-
SplitToggle.prototype
|
|
19
|
-
|
|
15
|
+
var _proto = SplitToggle.prototype;
|
|
16
|
+
|
|
17
|
+
_proto.render = function render() {
|
|
18
|
+
return React.createElement(DropdownToggle, _extends({}, this.props, {
|
|
19
|
+
useAnchor: false,
|
|
20
|
+
noCaret: false
|
|
21
|
+
}));
|
|
20
22
|
};
|
|
21
23
|
|
|
22
24
|
return SplitToggle;
|
|
23
25
|
}(React.Component);
|
|
24
26
|
|
|
25
27
|
SplitToggle.defaultProps = DropdownToggle.defaultProps;
|
|
26
|
-
|
|
27
28
|
export default SplitToggle;
|
package/es/Tab.js
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import _inherits from 'babel-runtime/helpers/inherits';
|
|
4
|
-
import _extends from 'babel-runtime/helpers/extends';
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs2/helpers/esm/inheritsLoose";
|
|
2
|
+
import _extends from "@babel/runtime-corejs2/helpers/esm/extends";
|
|
5
3
|
import React from 'react';
|
|
6
4
|
import PropTypes from 'prop-types';
|
|
7
|
-
|
|
8
5
|
import TabContainer from './TabContainer';
|
|
9
6
|
import TabContent from './TabContent';
|
|
10
7
|
import TabPane from './TabPane';
|
|
11
8
|
|
|
12
9
|
var propTypes = _extends({}, TabPane.propTypes, {
|
|
13
|
-
|
|
14
10
|
disabled: PropTypes.bool,
|
|
15
|
-
|
|
16
11
|
title: PropTypes.node,
|
|
17
12
|
|
|
18
13
|
/**
|
|
@@ -21,23 +16,24 @@ var propTypes = _extends({}, TabPane.propTypes, {
|
|
|
21
16
|
tabClassName: PropTypes.string
|
|
22
17
|
});
|
|
23
18
|
|
|
24
|
-
var Tab =
|
|
25
|
-
|
|
19
|
+
var Tab =
|
|
20
|
+
/*#__PURE__*/
|
|
21
|
+
function (_React$Component) {
|
|
22
|
+
_inheritsLoose(Tab, _React$Component);
|
|
26
23
|
|
|
27
24
|
function Tab() {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
|
25
|
+
return _React$Component.apply(this, arguments) || this;
|
|
31
26
|
}
|
|
32
27
|
|
|
33
|
-
Tab.prototype
|
|
34
|
-
|
|
28
|
+
var _proto = Tab.prototype;
|
|
29
|
+
|
|
30
|
+
_proto.render = function render() {
|
|
31
|
+
var props = _extends({}, this.props); // These props are for the parent `<Tabs>` rather than the `<TabPane>`.
|
|
32
|
+
|
|
35
33
|
|
|
36
|
-
// These props are for the parent `<Tabs>` rather than the `<TabPane>`.
|
|
37
34
|
delete props.title;
|
|
38
35
|
delete props.disabled;
|
|
39
36
|
delete props.tabClassName;
|
|
40
|
-
|
|
41
37
|
return React.createElement(TabPane, props);
|
|
42
38
|
};
|
|
43
39
|
|
|
@@ -45,9 +41,7 @@ var Tab = function (_React$Component) {
|
|
|
45
41
|
}(React.Component);
|
|
46
42
|
|
|
47
43
|
Tab.propTypes = propTypes;
|
|
48
|
-
|
|
49
44
|
Tab.Container = TabContainer;
|
|
50
45
|
Tab.Content = TabContent;
|
|
51
46
|
Tab.Pane = TabPane;
|
|
52
|
-
|
|
53
47
|
export default Tab;
|
package/es/TabContainer.js
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
|
|
4
|
-
import _inherits from 'babel-runtime/helpers/inherits';
|
|
1
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime-corejs2/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
|
+
import _inheritsLoose from "@babel/runtime-corejs2/helpers/esm/inheritsLoose";
|
|
5
3
|
import React from 'react';
|
|
6
4
|
import PropTypes from 'prop-types';
|
|
7
5
|
import uncontrollable from 'uncontrollable';
|
|
8
|
-
|
|
9
6
|
var TAB = 'tab';
|
|
10
7
|
var PANE = 'pane';
|
|
11
|
-
|
|
12
8
|
var idPropType = PropTypes.oneOfType([PropTypes.string, PropTypes.number]);
|
|
13
|
-
|
|
14
9
|
var propTypes = {
|
|
15
10
|
/**
|
|
16
11
|
* HTML id attribute, required if no `generateChildId` prop
|
|
@@ -20,11 +15,11 @@ var propTypes = {
|
|
|
20
15
|
var error = null;
|
|
21
16
|
|
|
22
17
|
if (!props.generateChildId) {
|
|
23
|
-
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
18
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
24
19
|
args[_key - 1] = arguments[_key];
|
|
25
20
|
}
|
|
26
21
|
|
|
27
|
-
error = idPropType.apply(
|
|
22
|
+
error = idPropType.apply(void 0, [props].concat(args));
|
|
28
23
|
|
|
29
24
|
if (!error && !props.id) {
|
|
30
25
|
error = new Error('In order to properly initialize Tabs in a way that is accessible ' + 'to assistive technologies (such as screen readers) an `id` or a ' + '`generateChildId` prop to TabContainer is required');
|
|
@@ -34,7 +29,6 @@ var propTypes = {
|
|
|
34
29
|
return error;
|
|
35
30
|
},
|
|
36
31
|
|
|
37
|
-
|
|
38
32
|
/**
|
|
39
33
|
* A function that takes an `eventKey` and `type` and returns a unique id for
|
|
40
34
|
* child tab `<NavItem>`s and `<TabPane>`s. The function _must_ be a pure
|
|
@@ -62,7 +56,6 @@ var propTypes = {
|
|
|
62
56
|
*/
|
|
63
57
|
activeKey: PropTypes.any
|
|
64
58
|
};
|
|
65
|
-
|
|
66
59
|
var childContextTypes = {
|
|
67
60
|
$bs_tabContainer: PropTypes.shape({
|
|
68
61
|
activeKey: PropTypes.any,
|
|
@@ -72,25 +65,26 @@ var childContextTypes = {
|
|
|
72
65
|
})
|
|
73
66
|
};
|
|
74
67
|
|
|
75
|
-
var TabContainer =
|
|
76
|
-
|
|
68
|
+
var TabContainer =
|
|
69
|
+
/*#__PURE__*/
|
|
70
|
+
function (_React$Component) {
|
|
71
|
+
_inheritsLoose(TabContainer, _React$Component);
|
|
77
72
|
|
|
78
73
|
function TabContainer() {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
|
74
|
+
return _React$Component.apply(this, arguments) || this;
|
|
82
75
|
}
|
|
83
76
|
|
|
84
|
-
TabContainer.prototype
|
|
85
|
-
var _props = this.props,
|
|
86
|
-
activeKey = _props.activeKey,
|
|
87
|
-
onSelect = _props.onSelect,
|
|
88
|
-
generateChildId = _props.generateChildId,
|
|
89
|
-
id = _props.id;
|
|
77
|
+
var _proto = TabContainer.prototype;
|
|
90
78
|
|
|
79
|
+
_proto.getChildContext = function getChildContext() {
|
|
80
|
+
var _this$props = this.props,
|
|
81
|
+
activeKey = _this$props.activeKey,
|
|
82
|
+
onSelect = _this$props.onSelect,
|
|
83
|
+
generateChildId = _this$props.generateChildId,
|
|
84
|
+
id = _this$props.id;
|
|
91
85
|
|
|
92
86
|
var getId = generateChildId || function (key, type) {
|
|
93
|
-
return id ? id +
|
|
87
|
+
return id ? id + "-" + type + "-" + key : null;
|
|
94
88
|
};
|
|
95
89
|
|
|
96
90
|
return {
|
|
@@ -107,15 +101,14 @@ var TabContainer = function (_React$Component) {
|
|
|
107
101
|
};
|
|
108
102
|
};
|
|
109
103
|
|
|
110
|
-
|
|
111
|
-
var
|
|
112
|
-
children =
|
|
113
|
-
props =
|
|
104
|
+
_proto.render = function render() {
|
|
105
|
+
var _this$props2 = this.props,
|
|
106
|
+
children = _this$props2.children,
|
|
107
|
+
props = _objectWithoutPropertiesLoose(_this$props2, ["children"]);
|
|
114
108
|
|
|
115
109
|
delete props.generateChildId;
|
|
116
110
|
delete props.onSelect;
|
|
117
111
|
delete props.activeKey;
|
|
118
|
-
|
|
119
112
|
return React.cloneElement(React.Children.only(children), props);
|
|
120
113
|
};
|
|
121
114
|
|
|
@@ -124,5 +117,6 @@ var TabContainer = function (_React$Component) {
|
|
|
124
117
|
|
|
125
118
|
TabContainer.propTypes = propTypes;
|
|
126
119
|
TabContainer.childContextTypes = childContextTypes;
|
|
127
|
-
|
|
128
|
-
|
|
120
|
+
export default uncontrollable(TabContainer, {
|
|
121
|
+
activeKey: 'onSelect'
|
|
122
|
+
});
|
package/es/TabContent.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
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 from 'react';
|
|
8
7
|
import PropTypes from 'prop-types';
|
|
9
8
|
import elementType from 'prop-types-extra/lib/elementType';
|
|
10
|
-
|
|
11
9
|
import { bsClass as setBsClass, prefix, splitBsPropsAndOmit } from './utils/bootstrapUtils';
|
|
12
|
-
|
|
13
10
|
var propTypes = {
|
|
14
11
|
componentClass: elementType,
|
|
15
12
|
|
|
@@ -30,20 +27,17 @@ var propTypes = {
|
|
|
30
27
|
*/
|
|
31
28
|
unmountOnExit: PropTypes.bool
|
|
32
29
|
};
|
|
33
|
-
|
|
34
30
|
var defaultProps = {
|
|
35
31
|
componentClass: 'div',
|
|
36
32
|
animation: true,
|
|
37
33
|
mountOnEnter: false,
|
|
38
34
|
unmountOnExit: false
|
|
39
35
|
};
|
|
40
|
-
|
|
41
36
|
var contextTypes = {
|
|
42
37
|
$bs_tabContainer: PropTypes.shape({
|
|
43
38
|
activeKey: PropTypes.any
|
|
44
39
|
})
|
|
45
40
|
};
|
|
46
|
-
|
|
47
41
|
var childContextTypes = {
|
|
48
42
|
$bs_tabContent: PropTypes.shape({
|
|
49
43
|
bsClass: PropTypes.string,
|
|
@@ -57,20 +51,20 @@ var childContextTypes = {
|
|
|
57
51
|
})
|
|
58
52
|
};
|
|
59
53
|
|
|
60
|
-
var TabContent =
|
|
61
|
-
|
|
54
|
+
var TabContent =
|
|
55
|
+
/*#__PURE__*/
|
|
56
|
+
function (_React$Component) {
|
|
57
|
+
_inheritsLoose(TabContent, _React$Component);
|
|
62
58
|
|
|
63
59
|
function TabContent(props, context) {
|
|
64
|
-
|
|
60
|
+
var _this;
|
|
65
61
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
_this.
|
|
69
|
-
_this.handlePaneExited = _this.handlePaneExited.bind(_this);
|
|
70
|
-
|
|
71
|
-
// Active entries in state will be `null` unless `animation` is set. Need
|
|
62
|
+
_this = _React$Component.call(this, props, context) || this;
|
|
63
|
+
_this.handlePaneEnter = _this.handlePaneEnter.bind(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
64
|
+
_this.handlePaneExited = _this.handlePaneExited.bind(_assertThisInitialized(_assertThisInitialized(_this))); // Active entries in state will be `null` unless `animation` is set. Need
|
|
72
65
|
// to track active child in case keys swap and the active child changes
|
|
73
66
|
// but the active key does not.
|
|
67
|
+
|
|
74
68
|
_this.state = {
|
|
75
69
|
activeKey: null,
|
|
76
70
|
activeChild: null
|
|
@@ -78,20 +72,18 @@ var TabContent = function (_React$Component) {
|
|
|
78
72
|
return _this;
|
|
79
73
|
}
|
|
80
74
|
|
|
81
|
-
TabContent.prototype
|
|
82
|
-
var _props = this.props,
|
|
83
|
-
bsClass = _props.bsClass,
|
|
84
|
-
animation = _props.animation,
|
|
85
|
-
mountOnEnter = _props.mountOnEnter,
|
|
86
|
-
unmountOnExit = _props.unmountOnExit;
|
|
87
|
-
|
|
75
|
+
var _proto = TabContent.prototype;
|
|
88
76
|
|
|
77
|
+
_proto.getChildContext = function getChildContext() {
|
|
78
|
+
var _this$props = this.props,
|
|
79
|
+
bsClass = _this$props.bsClass,
|
|
80
|
+
animation = _this$props.animation,
|
|
81
|
+
mountOnEnter = _this$props.mountOnEnter,
|
|
82
|
+
unmountOnExit = _this$props.unmountOnExit;
|
|
89
83
|
var stateActiveKey = this.state.activeKey;
|
|
90
84
|
var containerActiveKey = this.getContainerActiveKey();
|
|
91
|
-
|
|
92
85
|
var activeKey = stateActiveKey != null ? stateActiveKey : containerActiveKey;
|
|
93
86
|
var exiting = stateActiveKey != null && stateActiveKey !== containerActiveKey;
|
|
94
|
-
|
|
95
87
|
return {
|
|
96
88
|
$bs_tabContent: {
|
|
97
89
|
bsClass: bsClass,
|
|
@@ -106,27 +98,30 @@ var TabContent = function (_React$Component) {
|
|
|
106
98
|
};
|
|
107
99
|
};
|
|
108
100
|
|
|
109
|
-
|
|
101
|
+
_proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
|
110
102
|
if (!nextProps.animation && this.state.activeChild) {
|
|
111
|
-
this.setState({
|
|
103
|
+
this.setState({
|
|
104
|
+
activeKey: null,
|
|
105
|
+
activeChild: null
|
|
106
|
+
});
|
|
112
107
|
}
|
|
113
108
|
};
|
|
114
109
|
|
|
115
|
-
|
|
110
|
+
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
116
111
|
this.isUnmounted = true;
|
|
117
112
|
};
|
|
118
113
|
|
|
119
|
-
|
|
114
|
+
_proto.getContainerActiveKey = function getContainerActiveKey() {
|
|
120
115
|
var tabContainer = this.context.$bs_tabContainer;
|
|
121
116
|
return tabContainer && tabContainer.activeKey;
|
|
122
117
|
};
|
|
123
118
|
|
|
124
|
-
|
|
119
|
+
_proto.handlePaneEnter = function handlePaneEnter(child, childKey) {
|
|
125
120
|
if (!this.props.animation) {
|
|
126
121
|
return false;
|
|
127
|
-
}
|
|
122
|
+
} // It's possible that this child should be transitioning out.
|
|
123
|
+
|
|
128
124
|
|
|
129
|
-
// It's possible that this child should be transitioning out.
|
|
130
125
|
if (childKey !== this.getContainerActiveKey()) {
|
|
131
126
|
return false;
|
|
132
127
|
}
|
|
@@ -135,11 +130,10 @@ var TabContent = function (_React$Component) {
|
|
|
135
130
|
activeKey: childKey,
|
|
136
131
|
activeChild: child
|
|
137
132
|
});
|
|
138
|
-
|
|
139
133
|
return true;
|
|
140
134
|
};
|
|
141
135
|
|
|
142
|
-
|
|
136
|
+
_proto.handlePaneExited = function handlePaneExited(child) {
|
|
143
137
|
// This might happen as everything is unmounting.
|
|
144
138
|
if (this.isUnmounted) {
|
|
145
139
|
return;
|
|
@@ -159,11 +153,11 @@ var TabContent = function (_React$Component) {
|
|
|
159
153
|
});
|
|
160
154
|
};
|
|
161
155
|
|
|
162
|
-
|
|
163
|
-
var
|
|
164
|
-
Component =
|
|
165
|
-
className =
|
|
166
|
-
props =
|
|
156
|
+
_proto.render = function render() {
|
|
157
|
+
var _this$props2 = this.props,
|
|
158
|
+
Component = _this$props2.componentClass,
|
|
159
|
+
className = _this$props2.className,
|
|
160
|
+
props = _objectWithoutPropertiesLoose(_this$props2, ["componentClass", "className"]);
|
|
167
161
|
|
|
168
162
|
var _splitBsPropsAndOmit = splitBsPropsAndOmit(props, ['animation', 'mountOnEnter', 'unmountOnExit']),
|
|
169
163
|
bsProps = _splitBsPropsAndOmit[0],
|
|
@@ -181,5 +175,4 @@ TabContent.propTypes = propTypes;
|
|
|
181
175
|
TabContent.defaultProps = defaultProps;
|
|
182
176
|
TabContent.contextTypes = contextTypes;
|
|
183
177
|
TabContent.childContextTypes = childContextTypes;
|
|
184
|
-
|
|
185
178
|
export default setBsClass('tab', TabContent);
|