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/Tab.js
CHANGED
|
@@ -1,84 +1,61 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
|
|
6
|
-
|
|
7
|
-
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
|
8
|
-
|
|
9
|
-
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
|
|
10
|
-
|
|
11
|
-
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
|
12
|
-
|
|
13
|
-
var _inherits2 = require('babel-runtime/helpers/inherits');
|
|
14
|
-
|
|
15
|
-
var _inherits3 = _interopRequireDefault(_inherits2);
|
|
16
|
-
|
|
17
|
-
var _extends2 = require('babel-runtime/helpers/extends');
|
|
18
|
-
|
|
19
|
-
var _extends3 = _interopRequireDefault(_extends2);
|
|
20
|
-
|
|
21
|
-
var _react = require('react');
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
22
4
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
var _propTypes = require('prop-types');
|
|
26
|
-
|
|
27
|
-
var _propTypes2 = _interopRequireDefault(_propTypes);
|
|
28
|
-
|
|
29
|
-
var _TabContainer = require('./TabContainer');
|
|
30
|
-
|
|
31
|
-
var _TabContainer2 = _interopRequireDefault(_TabContainer);
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
32
7
|
|
|
33
|
-
var
|
|
8
|
+
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inheritsLoose"));
|
|
34
9
|
|
|
35
|
-
var
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/extends"));
|
|
36
11
|
|
|
37
|
-
var
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
38
13
|
|
|
39
|
-
var
|
|
14
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
40
15
|
|
|
41
|
-
|
|
16
|
+
var _TabContainer = _interopRequireDefault(require("./TabContainer"));
|
|
42
17
|
|
|
43
|
-
var
|
|
18
|
+
var _TabContent = _interopRequireDefault(require("./TabContent"));
|
|
44
19
|
|
|
45
|
-
|
|
20
|
+
var _TabPane = _interopRequireDefault(require("./TabPane"));
|
|
46
21
|
|
|
47
|
-
|
|
22
|
+
var propTypes = (0, _extends2.default)({}, _TabPane.default.propTypes, {
|
|
23
|
+
disabled: _propTypes.default.bool,
|
|
24
|
+
title: _propTypes.default.node,
|
|
48
25
|
|
|
49
26
|
/**
|
|
50
27
|
* tabClassName is used as className for the associated NavItem
|
|
51
28
|
*/
|
|
52
|
-
tabClassName:
|
|
29
|
+
tabClassName: _propTypes.default.string
|
|
53
30
|
});
|
|
54
31
|
|
|
55
|
-
var Tab =
|
|
56
|
-
|
|
32
|
+
var Tab =
|
|
33
|
+
/*#__PURE__*/
|
|
34
|
+
function (_React$Component) {
|
|
35
|
+
(0, _inheritsLoose2.default)(Tab, _React$Component);
|
|
57
36
|
|
|
58
37
|
function Tab() {
|
|
59
|
-
|
|
60
|
-
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
|
|
38
|
+
return _React$Component.apply(this, arguments) || this;
|
|
61
39
|
}
|
|
62
40
|
|
|
63
|
-
Tab.prototype
|
|
64
|
-
|
|
41
|
+
var _proto = Tab.prototype;
|
|
42
|
+
|
|
43
|
+
_proto.render = function render() {
|
|
44
|
+
var props = (0, _extends2.default)({}, this.props); // These props are for the parent `<Tabs>` rather than the `<TabPane>`.
|
|
65
45
|
|
|
66
|
-
// These props are for the parent `<Tabs>` rather than the `<TabPane>`.
|
|
67
46
|
delete props.title;
|
|
68
47
|
delete props.disabled;
|
|
69
48
|
delete props.tabClassName;
|
|
70
|
-
|
|
71
|
-
return _react2.default.createElement(_TabPane2.default, props);
|
|
49
|
+
return _react.default.createElement(_TabPane.default, props);
|
|
72
50
|
};
|
|
73
51
|
|
|
74
52
|
return Tab;
|
|
75
|
-
}(
|
|
53
|
+
}(_react.default.Component);
|
|
76
54
|
|
|
77
55
|
Tab.propTypes = propTypes;
|
|
78
|
-
|
|
79
|
-
Tab.
|
|
80
|
-
Tab.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
exports
|
|
84
|
-
module.exports = exports['default'];
|
|
56
|
+
Tab.Container = _TabContainer.default;
|
|
57
|
+
Tab.Content = _TabContent.default;
|
|
58
|
+
Tab.Pane = _TabPane.default;
|
|
59
|
+
var _default = Tab;
|
|
60
|
+
exports.default = _default;
|
|
61
|
+
module.exports = exports["default"];
|
package/lib/TabContainer.js
CHANGED
|
@@ -1,41 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
|
|
6
|
-
|
|
7
|
-
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
|
|
8
|
-
|
|
9
|
-
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
|
|
10
|
-
|
|
11
|
-
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
|
12
|
-
|
|
13
|
-
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
|
|
14
|
-
|
|
15
|
-
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
|
16
|
-
|
|
17
|
-
var _inherits2 = require('babel-runtime/helpers/inherits');
|
|
18
|
-
|
|
19
|
-
var _inherits3 = _interopRequireDefault(_inherits2);
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
20
4
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var _react2 = _interopRequireDefault(_react);
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
24
7
|
|
|
25
|
-
var
|
|
8
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/objectWithoutPropertiesLoose"));
|
|
26
9
|
|
|
27
|
-
var
|
|
10
|
+
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inheritsLoose"));
|
|
28
11
|
|
|
29
|
-
var
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
30
13
|
|
|
31
|
-
var
|
|
14
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
32
15
|
|
|
33
|
-
|
|
16
|
+
var _uncontrollable = _interopRequireDefault(require("uncontrollable"));
|
|
34
17
|
|
|
35
18
|
var TAB = 'tab';
|
|
36
19
|
var PANE = 'pane';
|
|
37
20
|
|
|
38
|
-
var idPropType =
|
|
21
|
+
var idPropType = _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]);
|
|
39
22
|
|
|
40
23
|
var propTypes = {
|
|
41
24
|
/**
|
|
@@ -46,11 +29,11 @@ var propTypes = {
|
|
|
46
29
|
var error = null;
|
|
47
30
|
|
|
48
31
|
if (!props.generateChildId) {
|
|
49
|
-
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
32
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
50
33
|
args[_key - 1] = arguments[_key];
|
|
51
34
|
}
|
|
52
35
|
|
|
53
|
-
error = idPropType.apply(
|
|
36
|
+
error = idPropType.apply(void 0, [props].concat(args));
|
|
54
37
|
|
|
55
38
|
if (!error && !props.id) {
|
|
56
39
|
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');
|
|
@@ -60,7 +43,6 @@ var propTypes = {
|
|
|
60
43
|
return error;
|
|
61
44
|
},
|
|
62
45
|
|
|
63
|
-
|
|
64
46
|
/**
|
|
65
47
|
* A function that takes an `eventKey` and `type` and returns a unique id for
|
|
66
48
|
* child tab `<NavItem>`s and `<TabPane>`s. The function _must_ be a pure
|
|
@@ -72,50 +54,51 @@ var propTypes = {
|
|
|
72
54
|
*
|
|
73
55
|
* @defaultValue (eventKey, type) => `${this.props.id}-${type}-${key}`
|
|
74
56
|
*/
|
|
75
|
-
generateChildId:
|
|
57
|
+
generateChildId: _propTypes.default.func,
|
|
76
58
|
|
|
77
59
|
/**
|
|
78
60
|
* A callback fired when a tab is selected.
|
|
79
61
|
*
|
|
80
62
|
* @controllable activeKey
|
|
81
63
|
*/
|
|
82
|
-
onSelect:
|
|
64
|
+
onSelect: _propTypes.default.func,
|
|
83
65
|
|
|
84
66
|
/**
|
|
85
67
|
* The `eventKey` of the currently active tab.
|
|
86
68
|
*
|
|
87
69
|
* @controllable onSelect
|
|
88
70
|
*/
|
|
89
|
-
activeKey:
|
|
71
|
+
activeKey: _propTypes.default.any
|
|
90
72
|
};
|
|
91
|
-
|
|
92
73
|
var childContextTypes = {
|
|
93
|
-
$bs_tabContainer:
|
|
94
|
-
activeKey:
|
|
95
|
-
onSelect:
|
|
96
|
-
getTabId:
|
|
97
|
-
getPaneId:
|
|
74
|
+
$bs_tabContainer: _propTypes.default.shape({
|
|
75
|
+
activeKey: _propTypes.default.any,
|
|
76
|
+
onSelect: _propTypes.default.func.isRequired,
|
|
77
|
+
getTabId: _propTypes.default.func.isRequired,
|
|
78
|
+
getPaneId: _propTypes.default.func.isRequired
|
|
98
79
|
})
|
|
99
80
|
};
|
|
100
81
|
|
|
101
|
-
var TabContainer =
|
|
102
|
-
|
|
82
|
+
var TabContainer =
|
|
83
|
+
/*#__PURE__*/
|
|
84
|
+
function (_React$Component) {
|
|
85
|
+
(0, _inheritsLoose2.default)(TabContainer, _React$Component);
|
|
103
86
|
|
|
104
87
|
function TabContainer() {
|
|
105
|
-
|
|
106
|
-
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
|
|
88
|
+
return _React$Component.apply(this, arguments) || this;
|
|
107
89
|
}
|
|
108
90
|
|
|
109
|
-
TabContainer.prototype
|
|
110
|
-
var _props = this.props,
|
|
111
|
-
activeKey = _props.activeKey,
|
|
112
|
-
onSelect = _props.onSelect,
|
|
113
|
-
generateChildId = _props.generateChildId,
|
|
114
|
-
id = _props.id;
|
|
91
|
+
var _proto = TabContainer.prototype;
|
|
115
92
|
|
|
93
|
+
_proto.getChildContext = function getChildContext() {
|
|
94
|
+
var _this$props = this.props,
|
|
95
|
+
activeKey = _this$props.activeKey,
|
|
96
|
+
onSelect = _this$props.onSelect,
|
|
97
|
+
generateChildId = _this$props.generateChildId,
|
|
98
|
+
id = _this$props.id;
|
|
116
99
|
|
|
117
100
|
var getId = generateChildId || function (key, type) {
|
|
118
|
-
return id ? id +
|
|
101
|
+
return id ? id + "-" + type + "-" + key : null;
|
|
119
102
|
};
|
|
120
103
|
|
|
121
104
|
return {
|
|
@@ -132,24 +115,25 @@ var TabContainer = function (_React$Component) {
|
|
|
132
115
|
};
|
|
133
116
|
};
|
|
134
117
|
|
|
135
|
-
|
|
136
|
-
var
|
|
137
|
-
children =
|
|
138
|
-
props = (0,
|
|
139
|
-
|
|
140
|
-
|
|
118
|
+
_proto.render = function render() {
|
|
119
|
+
var _this$props2 = this.props,
|
|
120
|
+
children = _this$props2.children,
|
|
121
|
+
props = (0, _objectWithoutPropertiesLoose2.default)(_this$props2, ["children"]);
|
|
141
122
|
delete props.generateChildId;
|
|
142
123
|
delete props.onSelect;
|
|
143
124
|
delete props.activeKey;
|
|
144
|
-
|
|
145
|
-
return _react2.default.cloneElement(_react2.default.Children.only(children), props);
|
|
125
|
+
return _react.default.cloneElement(_react.default.Children.only(children), props);
|
|
146
126
|
};
|
|
147
127
|
|
|
148
128
|
return TabContainer;
|
|
149
|
-
}(
|
|
129
|
+
}(_react.default.Component);
|
|
150
130
|
|
|
151
131
|
TabContainer.propTypes = propTypes;
|
|
152
132
|
TabContainer.childContextTypes = childContextTypes;
|
|
153
133
|
|
|
154
|
-
|
|
155
|
-
|
|
134
|
+
var _default = (0, _uncontrollable.default)(TabContainer, {
|
|
135
|
+
activeKey: 'onSelect'
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
exports.default = _default;
|
|
139
|
+
module.exports = exports["default"];
|
package/lib/TabContent.js
CHANGED
|
@@ -1,108 +1,86 @@
|
|
|
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);
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
16
4
|
|
|
17
|
-
|
|
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');
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
26
7
|
|
|
27
|
-
var
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/extends"));
|
|
28
9
|
|
|
29
|
-
var
|
|
10
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/objectWithoutPropertiesLoose"));
|
|
30
11
|
|
|
31
|
-
var
|
|
12
|
+
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inheritsLoose"));
|
|
32
13
|
|
|
33
|
-
var
|
|
14
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/assertThisInitialized"));
|
|
34
15
|
|
|
35
|
-
var
|
|
16
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
36
17
|
|
|
37
|
-
var
|
|
18
|
+
var _react = _interopRequireDefault(require("react"));
|
|
38
19
|
|
|
39
|
-
var
|
|
20
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
40
21
|
|
|
41
|
-
var
|
|
22
|
+
var _elementType = _interopRequireDefault(require("prop-types-extra/lib/elementType"));
|
|
42
23
|
|
|
43
|
-
|
|
24
|
+
var _bootstrapUtils = require("./utils/bootstrapUtils");
|
|
44
25
|
|
|
45
26
|
var propTypes = {
|
|
46
|
-
componentClass:
|
|
27
|
+
componentClass: _elementType.default,
|
|
47
28
|
|
|
48
29
|
/**
|
|
49
30
|
* Sets a default animation strategy for all children `<TabPane>`s. Use
|
|
50
31
|
* `false` to disable, `true` to enable the default `<Fade>` animation or
|
|
51
32
|
* a react-transition-group v2 `<Transition/>` component.
|
|
52
33
|
*/
|
|
53
|
-
animation:
|
|
34
|
+
animation: _propTypes.default.oneOfType([_propTypes.default.bool, _elementType.default]),
|
|
54
35
|
|
|
55
36
|
/**
|
|
56
37
|
* Wait until the first "enter" transition to mount tabs (add them to the DOM)
|
|
57
38
|
*/
|
|
58
|
-
mountOnEnter:
|
|
39
|
+
mountOnEnter: _propTypes.default.bool,
|
|
59
40
|
|
|
60
41
|
/**
|
|
61
42
|
* Unmount tabs (remove it from the DOM) when they are no longer visible
|
|
62
43
|
*/
|
|
63
|
-
unmountOnExit:
|
|
44
|
+
unmountOnExit: _propTypes.default.bool
|
|
64
45
|
};
|
|
65
|
-
|
|
66
46
|
var defaultProps = {
|
|
67
47
|
componentClass: 'div',
|
|
68
48
|
animation: true,
|
|
69
49
|
mountOnEnter: false,
|
|
70
50
|
unmountOnExit: false
|
|
71
51
|
};
|
|
72
|
-
|
|
73
52
|
var contextTypes = {
|
|
74
|
-
$bs_tabContainer:
|
|
75
|
-
activeKey:
|
|
53
|
+
$bs_tabContainer: _propTypes.default.shape({
|
|
54
|
+
activeKey: _propTypes.default.any
|
|
76
55
|
})
|
|
77
56
|
};
|
|
78
|
-
|
|
79
57
|
var childContextTypes = {
|
|
80
|
-
$bs_tabContent:
|
|
81
|
-
bsClass:
|
|
82
|
-
animation:
|
|
83
|
-
activeKey:
|
|
84
|
-
mountOnEnter:
|
|
85
|
-
unmountOnExit:
|
|
86
|
-
onPaneEnter:
|
|
87
|
-
onPaneExited:
|
|
88
|
-
exiting:
|
|
58
|
+
$bs_tabContent: _propTypes.default.shape({
|
|
59
|
+
bsClass: _propTypes.default.string,
|
|
60
|
+
animation: _propTypes.default.oneOfType([_propTypes.default.bool, _elementType.default]),
|
|
61
|
+
activeKey: _propTypes.default.any,
|
|
62
|
+
mountOnEnter: _propTypes.default.bool,
|
|
63
|
+
unmountOnExit: _propTypes.default.bool,
|
|
64
|
+
onPaneEnter: _propTypes.default.func.isRequired,
|
|
65
|
+
onPaneExited: _propTypes.default.func.isRequired,
|
|
66
|
+
exiting: _propTypes.default.bool.isRequired
|
|
89
67
|
})
|
|
90
68
|
};
|
|
91
69
|
|
|
92
|
-
var TabContent =
|
|
93
|
-
|
|
70
|
+
var TabContent =
|
|
71
|
+
/*#__PURE__*/
|
|
72
|
+
function (_React$Component) {
|
|
73
|
+
(0, _inheritsLoose2.default)(TabContent, _React$Component);
|
|
94
74
|
|
|
95
75
|
function TabContent(props, context) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
var _this = (0, _possibleConstructorReturn3.default)(this, _React$Component.call(this, props, context));
|
|
76
|
+
var _this;
|
|
99
77
|
|
|
100
|
-
_this
|
|
101
|
-
_this.
|
|
102
|
-
|
|
103
|
-
// Active entries in state will be `null` unless `animation` is set. Need
|
|
78
|
+
_this = _React$Component.call(this, props, context) || this;
|
|
79
|
+
_this.handlePaneEnter = _this.handlePaneEnter.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
|
80
|
+
_this.handlePaneExited = _this.handlePaneExited.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this))); // Active entries in state will be `null` unless `animation` is set. Need
|
|
104
81
|
// to track active child in case keys swap and the active child changes
|
|
105
82
|
// but the active key does not.
|
|
83
|
+
|
|
106
84
|
_this.state = {
|
|
107
85
|
activeKey: null,
|
|
108
86
|
activeChild: null
|
|
@@ -110,20 +88,18 @@ var TabContent = function (_React$Component) {
|
|
|
110
88
|
return _this;
|
|
111
89
|
}
|
|
112
90
|
|
|
113
|
-
TabContent.prototype
|
|
114
|
-
var _props = this.props,
|
|
115
|
-
bsClass = _props.bsClass,
|
|
116
|
-
animation = _props.animation,
|
|
117
|
-
mountOnEnter = _props.mountOnEnter,
|
|
118
|
-
unmountOnExit = _props.unmountOnExit;
|
|
119
|
-
|
|
91
|
+
var _proto = TabContent.prototype;
|
|
120
92
|
|
|
93
|
+
_proto.getChildContext = function getChildContext() {
|
|
94
|
+
var _this$props = this.props,
|
|
95
|
+
bsClass = _this$props.bsClass,
|
|
96
|
+
animation = _this$props.animation,
|
|
97
|
+
mountOnEnter = _this$props.mountOnEnter,
|
|
98
|
+
unmountOnExit = _this$props.unmountOnExit;
|
|
121
99
|
var stateActiveKey = this.state.activeKey;
|
|
122
100
|
var containerActiveKey = this.getContainerActiveKey();
|
|
123
|
-
|
|
124
101
|
var activeKey = stateActiveKey != null ? stateActiveKey : containerActiveKey;
|
|
125
102
|
var exiting = stateActiveKey != null && stateActiveKey !== containerActiveKey;
|
|
126
|
-
|
|
127
103
|
return {
|
|
128
104
|
$bs_tabContent: {
|
|
129
105
|
bsClass: bsClass,
|
|
@@ -138,27 +114,30 @@ var TabContent = function (_React$Component) {
|
|
|
138
114
|
};
|
|
139
115
|
};
|
|
140
116
|
|
|
141
|
-
|
|
117
|
+
_proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
|
142
118
|
if (!nextProps.animation && this.state.activeChild) {
|
|
143
|
-
this.setState({
|
|
119
|
+
this.setState({
|
|
120
|
+
activeKey: null,
|
|
121
|
+
activeChild: null
|
|
122
|
+
});
|
|
144
123
|
}
|
|
145
124
|
};
|
|
146
125
|
|
|
147
|
-
|
|
126
|
+
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
148
127
|
this.isUnmounted = true;
|
|
149
128
|
};
|
|
150
129
|
|
|
151
|
-
|
|
130
|
+
_proto.getContainerActiveKey = function getContainerActiveKey() {
|
|
152
131
|
var tabContainer = this.context.$bs_tabContainer;
|
|
153
132
|
return tabContainer && tabContainer.activeKey;
|
|
154
133
|
};
|
|
155
134
|
|
|
156
|
-
|
|
135
|
+
_proto.handlePaneEnter = function handlePaneEnter(child, childKey) {
|
|
157
136
|
if (!this.props.animation) {
|
|
158
137
|
return false;
|
|
159
|
-
}
|
|
138
|
+
} // It's possible that this child should be transitioning out.
|
|
139
|
+
|
|
160
140
|
|
|
161
|
-
// It's possible that this child should be transitioning out.
|
|
162
141
|
if (childKey !== this.getContainerActiveKey()) {
|
|
163
142
|
return false;
|
|
164
143
|
}
|
|
@@ -167,11 +146,10 @@ var TabContent = function (_React$Component) {
|
|
|
167
146
|
activeKey: childKey,
|
|
168
147
|
activeChild: child
|
|
169
148
|
});
|
|
170
|
-
|
|
171
149
|
return true;
|
|
172
150
|
};
|
|
173
151
|
|
|
174
|
-
|
|
152
|
+
_proto.handlePaneExited = function handlePaneExited(child) {
|
|
175
153
|
// This might happen as everything is unmounting.
|
|
176
154
|
if (this.isUnmounted) {
|
|
177
155
|
return;
|
|
@@ -191,28 +169,30 @@ var TabContent = function (_React$Component) {
|
|
|
191
169
|
});
|
|
192
170
|
};
|
|
193
171
|
|
|
194
|
-
|
|
195
|
-
var
|
|
196
|
-
Component =
|
|
197
|
-
className =
|
|
198
|
-
props = (0,
|
|
172
|
+
_proto.render = function render() {
|
|
173
|
+
var _this$props2 = this.props,
|
|
174
|
+
Component = _this$props2.componentClass,
|
|
175
|
+
className = _this$props2.className,
|
|
176
|
+
props = (0, _objectWithoutPropertiesLoose2.default)(_this$props2, ["componentClass", "className"]);
|
|
199
177
|
|
|
200
178
|
var _splitBsPropsAndOmit = (0, _bootstrapUtils.splitBsPropsAndOmit)(props, ['animation', 'mountOnEnter', 'unmountOnExit']),
|
|
201
179
|
bsProps = _splitBsPropsAndOmit[0],
|
|
202
180
|
elementProps = _splitBsPropsAndOmit[1];
|
|
203
181
|
|
|
204
|
-
return
|
|
205
|
-
className: (0,
|
|
182
|
+
return _react.default.createElement(Component, (0, _extends2.default)({}, elementProps, {
|
|
183
|
+
className: (0, _classnames.default)(className, (0, _bootstrapUtils.prefix)(bsProps, 'content'))
|
|
206
184
|
}));
|
|
207
185
|
};
|
|
208
186
|
|
|
209
187
|
return TabContent;
|
|
210
|
-
}(
|
|
188
|
+
}(_react.default.Component);
|
|
211
189
|
|
|
212
190
|
TabContent.propTypes = propTypes;
|
|
213
191
|
TabContent.defaultProps = defaultProps;
|
|
214
192
|
TabContent.contextTypes = contextTypes;
|
|
215
193
|
TabContent.childContextTypes = childContextTypes;
|
|
216
194
|
|
|
217
|
-
|
|
218
|
-
|
|
195
|
+
var _default = (0, _bootstrapUtils.bsClass)('tab', TabContent);
|
|
196
|
+
|
|
197
|
+
exports.default = _default;
|
|
198
|
+
module.exports = exports["default"];
|