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.
Files changed (213) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +11 -7
  3. package/dist/react-bootstrap.js +13464 -13723
  4. package/dist/react-bootstrap.min.js +10 -18464
  5. package/es/Accordion.js +13 -16
  6. package/es/Alert.js +26 -31
  7. package/es/Badge.js +21 -31
  8. package/es/Breadcrumb.js +17 -20
  9. package/es/BreadcrumbItem.js +30 -30
  10. package/es/Button.js +23 -27
  11. package/es/ButtonGroup.js +20 -22
  12. package/es/ButtonToolbar.js +16 -18
  13. package/es/Carousel.js +120 -157
  14. package/es/CarouselCaption.js +18 -21
  15. package/es/CarouselItem.js +34 -33
  16. package/es/Checkbox.js +43 -54
  17. package/es/Clearfix.js +24 -24
  18. package/es/CloseButton.js +21 -30
  19. package/es/Col.js +42 -26
  20. package/es/Collapse.js +68 -68
  21. package/es/ControlLabel.js +19 -24
  22. package/es/Dropdown.js +93 -91
  23. package/es/DropdownButton.js +25 -35
  24. package/es/DropdownMenu.js +65 -65
  25. package/es/DropdownToggle.js +28 -40
  26. package/es/Fade.js +26 -29
  27. package/es/Form.js +22 -22
  28. package/es/FormControl.js +32 -33
  29. package/es/FormControlFeedback.js +21 -21
  30. package/es/FormControlStatic.js +18 -21
  31. package/es/FormGroup.js +27 -34
  32. package/es/Glyphicon.js +18 -19
  33. package/es/Grid.js +20 -22
  34. package/es/HelpBlock.js +17 -17
  35. package/es/Image.js +19 -24
  36. package/es/InputGroup.js +17 -18
  37. package/es/InputGroupAddon.js +17 -17
  38. package/es/InputGroupButton.js +17 -17
  39. package/es/Jumbotron.js +18 -21
  40. package/es/Label.js +21 -27
  41. package/es/ListGroup.js +24 -29
  42. package/es/ListGroupItem.js +30 -48
  43. package/es/Media.js +18 -22
  44. package/es/MediaBody.js +19 -22
  45. package/es/MediaHeading.js +18 -21
  46. package/es/MediaLeft.js +18 -19
  47. package/es/MediaList.js +17 -17
  48. package/es/MediaListItem.js +17 -17
  49. package/es/MediaRight.js +18 -19
  50. package/es/MenuItem.js +44 -49
  51. package/es/Modal.js +63 -74
  52. package/es/ModalBody.js +18 -21
  53. package/es/ModalDialog.js +31 -39
  54. package/es/ModalFooter.js +18 -21
  55. package/es/ModalHeader.js +25 -35
  56. package/es/ModalTitle.js +18 -21
  57. package/es/Nav.js +73 -92
  58. package/es/NavDropdown.js +40 -52
  59. package/es/NavItem.js +34 -38
  60. package/es/Navbar.js +62 -73
  61. package/es/NavbarBrand.js +20 -24
  62. package/es/NavbarCollapse.js +21 -28
  63. package/es/NavbarHeader.js +19 -20
  64. package/es/NavbarToggle.js +30 -38
  65. package/es/Overlay.js +21 -25
  66. package/es/OverlayTrigger.js +71 -68
  67. package/es/PageHeader.js +18 -26
  68. package/es/PageItem.js +0 -1
  69. package/es/Pager.js +23 -30
  70. package/es/PagerItem.js +36 -40
  71. package/es/Pagination.js +18 -24
  72. package/es/PaginationItem.js +47 -57
  73. package/es/Panel.js +51 -54
  74. package/es/PanelBody.js +18 -29
  75. package/es/PanelCollapse.js +20 -23
  76. package/es/PanelFooter.js +16 -23
  77. package/es/PanelGroup.js +44 -45
  78. package/es/PanelHeading.js +19 -28
  79. package/es/PanelTitle.js +22 -34
  80. package/es/PanelToggle.js +21 -24
  81. package/es/Popover.js +36 -46
  82. package/es/ProgressBar.js +59 -62
  83. package/es/Radio.js +43 -54
  84. package/es/ResponsiveEmbed.js +27 -32
  85. package/es/Row.js +18 -21
  86. package/es/SafeAnchor.js +32 -32
  87. package/es/SplitButton.js +33 -46
  88. package/es/SplitToggle.js +14 -13
  89. package/es/Tab.js +12 -18
  90. package/es/TabContainer.js +24 -30
  91. package/es/TabContent.js +36 -43
  92. package/es/TabPane.js +58 -68
  93. package/es/Table.js +25 -29
  94. package/es/Tabs.js +56 -71
  95. package/es/Thumbnail.js +34 -34
  96. package/es/ToggleButton.js +32 -37
  97. package/es/ToggleButtonGroup.js +45 -57
  98. package/es/Tooltip.js +33 -40
  99. package/es/Well.js +17 -17
  100. package/es/index.js +2 -0
  101. package/es/utils/PropTypes.js +13 -19
  102. package/es/utils/StyleConfig.js +0 -4
  103. package/es/utils/ValidComponentChildren.js +11 -20
  104. package/es/utils/bootstrapUtils.js +17 -31
  105. package/es/utils/createChainedFunction.js +2 -2
  106. package/es/utils/deprecationWarning.js +28 -30
  107. package/es/utils/splitComponentProps.js +1 -2
  108. package/lib/Accordion.js +23 -36
  109. package/lib/Alert.js +43 -65
  110. package/lib/Badge.js +36 -56
  111. package/lib/Breadcrumb.js +32 -47
  112. package/lib/BreadcrumbItem.js +48 -63
  113. package/lib/Button.js +49 -71
  114. package/lib/ButtonGroup.js +39 -57
  115. package/lib/ButtonToolbar.js +29 -42
  116. package/lib/Carousel.js +161 -214
  117. package/lib/CarouselCaption.js +32 -46
  118. package/lib/CarouselItem.js +54 -73
  119. package/lib/Checkbox.js +64 -87
  120. package/lib/Clearfix.js +45 -58
  121. package/lib/CloseButton.js +33 -50
  122. package/lib/Col.js +78 -73
  123. package/lib/Collapse.js +104 -125
  124. package/lib/ControlLabel.js +38 -59
  125. package/lib/Dropdown.js +153 -192
  126. package/lib/DropdownButton.js +44 -70
  127. package/lib/DropdownMenu.js +96 -120
  128. package/lib/DropdownToggle.js +48 -77
  129. package/lib/Fade.js +49 -68
  130. package/lib/Form.js +39 -52
  131. package/lib/FormControl.js +58 -79
  132. package/lib/FormControlFeedback.js +42 -54
  133. package/lib/FormControlStatic.js +32 -46
  134. package/lib/FormGroup.js +47 -67
  135. package/lib/Glyphicon.js +33 -46
  136. package/lib/Grid.js +36 -51
  137. package/lib/HelpBlock.js +29 -40
  138. package/lib/Image.js +37 -53
  139. package/lib/InputGroup.js +34 -49
  140. package/lib/InputGroupAddon.js +29 -40
  141. package/lib/InputGroupButton.js +29 -40
  142. package/lib/Jumbotron.js +32 -46
  143. package/lib/Label.js +35 -53
  144. package/lib/ListGroup.js +45 -61
  145. package/lib/ListGroupItem.js +55 -85
  146. package/lib/Media.js +43 -70
  147. package/lib/MediaBody.js +37 -55
  148. package/lib/MediaHeading.js +32 -46
  149. package/lib/MediaLeft.js +34 -48
  150. package/lib/MediaList.js +29 -40
  151. package/lib/MediaListItem.js +29 -40
  152. package/lib/MediaRight.js +34 -48
  153. package/lib/MenuItem.js +70 -92
  154. package/lib/Modal.js +130 -186
  155. package/lib/ModalBody.js +32 -46
  156. package/lib/ModalDialog.js +47 -69
  157. package/lib/ModalFooter.js +32 -46
  158. package/lib/ModalHeader.js +43 -70
  159. package/lib/ModalTitle.js +32 -46
  160. package/lib/Nav.js +122 -160
  161. package/lib/NavDropdown.js +63 -97
  162. package/lib/NavItem.js +54 -77
  163. package/lib/Navbar.js +115 -152
  164. package/lib/NavbarBrand.js +37 -55
  165. package/lib/NavbarCollapse.js +36 -57
  166. package/lib/NavbarHeader.js +33 -48
  167. package/lib/NavbarToggle.js +52 -77
  168. package/lib/Overlay.js +50 -75
  169. package/lib/OverlayTrigger.js +114 -129
  170. package/lib/PageHeader.js +30 -49
  171. package/lib/PageItem.js +9 -10
  172. package/lib/Pager.js +41 -63
  173. package/lib/PagerItem.js +55 -78
  174. package/lib/Pagination.js +32 -50
  175. package/lib/PaginationItem.js +67 -91
  176. package/lib/Panel.js +93 -127
  177. package/lib/PanelBody.js +35 -57
  178. package/lib/PanelCollapse.js +44 -56
  179. package/lib/PanelFooter.js +31 -48
  180. package/lib/PanelGroup.js +73 -88
  181. package/lib/PanelHeading.js +37 -59
  182. package/lib/PanelTitle.js +41 -68
  183. package/lib/PanelToggle.js +45 -66
  184. package/lib/Popover.js +59 -84
  185. package/lib/ProgressBar.js +86 -103
  186. package/lib/Radio.js +64 -87
  187. package/lib/ResponsiveEmbed.js +45 -63
  188. package/lib/Row.js +32 -46
  189. package/lib/SafeAnchor.js +53 -69
  190. package/lib/SplitButton.js +57 -90
  191. package/lib/SplitToggle.js +25 -34
  192. package/lib/Tab.js +32 -55
  193. package/lib/TabContainer.js +45 -61
  194. package/lib/TabContent.js +67 -87
  195. package/lib/TabPane.js +103 -131
  196. package/lib/Table.js +44 -59
  197. package/lib/Tabs.js +82 -119
  198. package/lib/Thumbnail.js +55 -67
  199. package/lib/ToggleButton.js +49 -68
  200. package/lib/ToggleButtonGroup.js +67 -104
  201. package/lib/Tooltip.js +55 -77
  202. package/lib/Well.js +30 -41
  203. package/lib/index.js +147 -214
  204. package/lib/utils/PropTypes.js +24 -31
  205. package/lib/utils/StyleConfig.js +13 -11
  206. package/lib/utils/ValidComponentChildren.js +34 -29
  207. package/lib/utils/bootstrapUtils.js +41 -52
  208. package/lib/utils/capitalize.js +2 -0
  209. package/lib/utils/createChainedFunction.js +8 -5
  210. package/lib/utils/deprecationWarning.js +37 -47
  211. package/lib/utils/index.js +11 -15
  212. package/lib/utils/splitComponentProps.js +5 -10
  213. package/package.json +58 -50
package/es/SafeAnchor.js CHANGED
@@ -1,14 +1,11 @@
1
- import _extends from 'babel-runtime/helpers/extends';
2
- import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
3
- import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
4
- import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
5
- import _inherits from 'babel-runtime/helpers/inherits';
1
+ import _extends from "@babel/runtime-corejs2/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime-corejs2/helpers/esm/objectWithoutPropertiesLoose";
3
+ import _inheritsLoose from "@babel/runtime-corejs2/helpers/esm/inheritsLoose";
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
- function SafeAnchor(props, context) {
45
- _classCallCheck(this, SafeAnchor);
38
+ var SafeAnchor =
39
+ /*#__PURE__*/
40
+ function (_React$Component) {
41
+ _inheritsLoose(SafeAnchor, _React$Component);
46
42
 
47
- var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
43
+ function SafeAnchor(props, context) {
44
+ var _this;
48
45
 
49
- _this.handleClick = _this.handleClick.bind(_this);
50
- _this.handleKeyDown = _this.handleKeyDown.bind(_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.handleClick = function handleClick(event) {
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
- SafeAnchor.prototype.handleKeyDown = function handleKeyDown(event) {
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
- SafeAnchor.prototype.render = function render() {
83
- var _props2 = this.props,
84
- Component = _props2.componentClass,
85
- disabled = _props2.disabled,
86
- onKeyDown = _props2.onKeyDown,
87
- props = _objectWithoutProperties(_props2, ['componentClass', 'disabled', 'onKeyDown']);
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({ pointerEvents: 'none' }, props.style);
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 _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
2
- import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
3
- import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
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 = function (_React$Component) {
38
- _inherits(SplitButton, _React$Component);
35
+ var SplitButton =
36
+ /*#__PURE__*/
37
+ function (_React$Component) {
38
+ _inheritsLoose(SplitButton, _React$Component);
39
39
 
40
40
  function SplitButton() {
41
- _classCallCheck(this, SplitButton);
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.render = function render() {
47
- var _props = this.props,
48
- bsSize = _props.bsSize,
49
- bsStyle = _props.bsStyle,
50
- title = _props.title,
51
- toggleLabel = _props.toggleLabel,
52
- children = _props.children,
53
- props = _objectWithoutProperties(_props, ['bsSize', 'bsStyle', 'title', 'toggleLabel', 'children']);
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
- Dropdown,
61
- _extends({}, dropdownProps, { bsSize: bsSize, bsStyle: bsStyle }),
62
- React.createElement(
63
- Button,
64
- _extends({}, buttonProps, {
65
- disabled: props.disabled,
66
- bsSize: bsSize,
67
- bsStyle: bsStyle
68
- }),
69
- title
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 'babel-runtime/helpers/extends';
2
- import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
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 = function (_React$Component) {
10
- _inherits(SplitToggle, _React$Component);
6
+ var SplitToggle =
7
+ /*#__PURE__*/
8
+ function (_React$Component) {
9
+ _inheritsLoose(SplitToggle, _React$Component);
11
10
 
12
11
  function SplitToggle() {
13
- _classCallCheck(this, SplitToggle);
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.render = function render() {
19
- return React.createElement(DropdownToggle, _extends({}, this.props, { useAnchor: false, noCaret: false }));
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 _classCallCheck from 'babel-runtime/helpers/classCallCheck';
2
- import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
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 = function (_React$Component) {
25
- _inherits(Tab, _React$Component);
19
+ var Tab =
20
+ /*#__PURE__*/
21
+ function (_React$Component) {
22
+ _inheritsLoose(Tab, _React$Component);
26
23
 
27
24
  function Tab() {
28
- _classCallCheck(this, Tab);
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.render = function render() {
34
- var props = _extends({}, this.props);
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;
@@ -1,16 +1,11 @@
1
- import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
2
- import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
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(undefined, [props].concat(args));
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 = function (_React$Component) {
76
- _inherits(TabContainer, _React$Component);
68
+ var TabContainer =
69
+ /*#__PURE__*/
70
+ function (_React$Component) {
71
+ _inheritsLoose(TabContainer, _React$Component);
77
72
 
78
73
  function TabContainer() {
79
- _classCallCheck(this, TabContainer);
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.getChildContext = function getChildContext() {
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 + '-' + type + '-' + key : null;
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
- TabContainer.prototype.render = function render() {
111
- var _props2 = this.props,
112
- children = _props2.children,
113
- props = _objectWithoutProperties(_props2, ['children']);
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
- export default uncontrollable(TabContainer, { activeKey: 'onSelect' });
120
+ export default uncontrollable(TabContainer, {
121
+ activeKey: 'onSelect'
122
+ });
package/es/TabContent.js CHANGED
@@ -1,15 +1,12 @@
1
- import _extends from 'babel-runtime/helpers/extends';
2
- import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
3
- import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
4
- import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
5
- import _inherits from 'babel-runtime/helpers/inherits';
1
+ import _extends from "@babel/runtime-corejs2/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime-corejs2/helpers/esm/objectWithoutPropertiesLoose";
3
+ import _inheritsLoose from "@babel/runtime-corejs2/helpers/esm/inheritsLoose";
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 = function (_React$Component) {
61
- _inherits(TabContent, _React$Component);
54
+ var TabContent =
55
+ /*#__PURE__*/
56
+ function (_React$Component) {
57
+ _inheritsLoose(TabContent, _React$Component);
62
58
 
63
59
  function TabContent(props, context) {
64
- _classCallCheck(this, TabContent);
60
+ var _this;
65
61
 
66
- var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
67
-
68
- _this.handlePaneEnter = _this.handlePaneEnter.bind(_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.getChildContext = function getChildContext() {
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
- TabContent.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
101
+ _proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
110
102
  if (!nextProps.animation && this.state.activeChild) {
111
- this.setState({ activeKey: null, activeChild: null });
103
+ this.setState({
104
+ activeKey: null,
105
+ activeChild: null
106
+ });
112
107
  }
113
108
  };
114
109
 
115
- TabContent.prototype.componentWillUnmount = function componentWillUnmount() {
110
+ _proto.componentWillUnmount = function componentWillUnmount() {
116
111
  this.isUnmounted = true;
117
112
  };
118
113
 
119
- TabContent.prototype.getContainerActiveKey = function getContainerActiveKey() {
114
+ _proto.getContainerActiveKey = function getContainerActiveKey() {
120
115
  var tabContainer = this.context.$bs_tabContainer;
121
116
  return tabContainer && tabContainer.activeKey;
122
117
  };
123
118
 
124
- TabContent.prototype.handlePaneEnter = function handlePaneEnter(child, childKey) {
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
- TabContent.prototype.handlePaneExited = function handlePaneExited(child) {
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
- TabContent.prototype.render = function render() {
163
- var _props2 = this.props,
164
- Component = _props2.componentClass,
165
- className = _props2.className,
166
- props = _objectWithoutProperties(_props2, ['componentClass', 'className']);
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);