react-bootstrap 1.0.0-beta.13 → 1.0.0-beta.17

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 (134) hide show
  1. package/AccordionToggle.d.ts +4 -5
  2. package/BootstrapModalManager/package.json +6 -0
  3. package/Container.d.ts +1 -1
  4. package/ElementChildren/package.json +6 -0
  5. package/FormControl.d.ts +7 -2
  6. package/ListGroup.d.ts +1 -0
  7. package/Modal.d.ts +1 -0
  8. package/Overlay.d.ts +1 -1
  9. package/OverlayTrigger.d.ts +1 -0
  10. package/ToggleButton.d.ts +0 -1
  11. package/cjs/AbstractNav.js +1 -1
  12. package/cjs/Alert.js +4 -4
  13. package/cjs/{utils/BootstrapModalManager.js → BootstrapModalManager.js} +9 -5
  14. package/cjs/Card.js +2 -2
  15. package/cjs/CardColumns.js +1 -1
  16. package/cjs/CardDeck.js +1 -1
  17. package/cjs/CardGroup.js +1 -1
  18. package/cjs/Carousel.js +9 -9
  19. package/cjs/CarouselCaption.js +1 -1
  20. package/cjs/CarouselItem.js +1 -1
  21. package/cjs/Collapse.js +7 -7
  22. package/cjs/Container.js +3 -3
  23. package/cjs/Dropdown.js +5 -5
  24. package/cjs/DropdownMenu.js +39 -46
  25. package/cjs/DropdownToggle.js +31 -58
  26. package/cjs/{utils/ElementChildren.js → ElementChildren.js} +0 -0
  27. package/cjs/Fade.js +4 -4
  28. package/cjs/Figure.js +1 -1
  29. package/cjs/FigureCaption.js +1 -1
  30. package/cjs/Form.js +1 -1
  31. package/cjs/FormLabel.js +3 -1
  32. package/cjs/InputGroup.js +1 -1
  33. package/cjs/ListGroup.js +16 -3
  34. package/cjs/Media.js +1 -1
  35. package/cjs/Modal.js +32 -18
  36. package/cjs/ModalBody.js +1 -1
  37. package/cjs/ModalDialog.js +1 -1
  38. package/cjs/ModalFooter.js +1 -1
  39. package/cjs/ModalTitle.js +2 -2
  40. package/cjs/NavDropdown.js +64 -41
  41. package/cjs/Navbar.js +1 -1
  42. package/cjs/OverlayTrigger.js +131 -182
  43. package/cjs/PageItem.js +7 -4
  44. package/cjs/Pagination.js +21 -36
  45. package/cjs/Popover.js +9 -10
  46. package/cjs/ProgressBar.js +1 -1
  47. package/cjs/ResponsiveEmbed.js +19 -35
  48. package/cjs/Row.js +1 -0
  49. package/cjs/SafeAnchor.js +1 -1
  50. package/cjs/SplitButton.js +9 -3
  51. package/cjs/TabContent.js +15 -31
  52. package/cjs/Table.js +31 -47
  53. package/cjs/Tabs.js +1 -1
  54. package/cjs/ToastBody.js +1 -1
  55. package/cjs/ToggleButton.js +45 -78
  56. package/cjs/ToggleButtonGroup.js +44 -65
  57. package/cjs/Tooltip.js +2 -1
  58. package/cjs/{utils/createChainedFunction.js → createChainedFunction.js} +0 -0
  59. package/cjs/{utils/createWithBsPrefix.js → createWithBsPrefix.js} +3 -3
  60. package/cjs/{utils/divWithClassName.js → divWithClassName.js} +0 -0
  61. package/cjs/index.js +4 -0
  62. package/cjs/{utils/triggerBrowserReflow.js → triggerBrowserReflow.js} +0 -0
  63. package/cjs/useWrappedRefWithWarning.js +24 -0
  64. package/createChainedFunction/package.json +6 -0
  65. package/createWithBsPrefix/package.json +6 -0
  66. package/dist/react-bootstrap.js +9477 -11933
  67. package/dist/react-bootstrap.min.js +4 -12
  68. package/divWithClassName/package.json +6 -0
  69. package/esm/AbstractNav.js +1 -1
  70. package/esm/AccordionToggle.d.ts +4 -5
  71. package/esm/Alert.js +4 -4
  72. package/esm/{utils/BootstrapModalManager.js → BootstrapModalManager.js} +9 -5
  73. package/esm/Card.js +2 -2
  74. package/esm/CardColumns.js +1 -1
  75. package/esm/CardDeck.js +1 -1
  76. package/esm/CardGroup.js +1 -1
  77. package/esm/Carousel.js +6 -6
  78. package/esm/CarouselCaption.js +1 -1
  79. package/esm/CarouselItem.js +1 -1
  80. package/esm/Collapse.js +6 -6
  81. package/esm/Container.d.ts +1 -1
  82. package/esm/Container.js +3 -3
  83. package/esm/Dropdown.js +4 -4
  84. package/esm/DropdownMenu.js +34 -43
  85. package/esm/DropdownToggle.js +30 -56
  86. package/esm/{utils/ElementChildren.js → ElementChildren.js} +0 -0
  87. package/esm/Fade.js +3 -3
  88. package/esm/Figure.js +1 -1
  89. package/esm/FigureCaption.js +1 -1
  90. package/esm/Form.js +1 -1
  91. package/esm/FormControl.d.ts +7 -2
  92. package/esm/FormLabel.js +3 -1
  93. package/esm/InputGroup.js +1 -1
  94. package/esm/ListGroup.d.ts +1 -0
  95. package/esm/ListGroup.js +15 -3
  96. package/esm/Media.js +1 -1
  97. package/esm/Modal.d.ts +1 -0
  98. package/esm/Modal.js +28 -15
  99. package/esm/ModalBody.js +1 -1
  100. package/esm/ModalDialog.js +1 -1
  101. package/esm/ModalFooter.js +1 -1
  102. package/esm/ModalTitle.js +2 -2
  103. package/esm/NavDropdown.js +61 -41
  104. package/esm/Navbar.js +1 -1
  105. package/esm/Overlay.d.ts +1 -1
  106. package/esm/OverlayTrigger.d.ts +1 -0
  107. package/esm/OverlayTrigger.js +130 -182
  108. package/esm/PageItem.js +5 -2
  109. package/esm/Pagination.js +22 -37
  110. package/esm/Popover.js +10 -13
  111. package/esm/ProgressBar.js +1 -1
  112. package/esm/ResponsiveEmbed.js +18 -33
  113. package/esm/Row.js +1 -0
  114. package/esm/SafeAnchor.js +1 -1
  115. package/esm/SplitButton.js +9 -3
  116. package/esm/TabContent.js +15 -31
  117. package/esm/Table.js +32 -48
  118. package/esm/Tabs.js +1 -1
  119. package/esm/ToastBody.js +1 -1
  120. package/esm/ToggleButton.d.ts +0 -1
  121. package/esm/ToggleButton.js +44 -79
  122. package/esm/ToggleButtonGroup.js +42 -65
  123. package/esm/Tooltip.js +2 -1
  124. package/esm/{utils/createChainedFunction.js → createChainedFunction.js} +0 -0
  125. package/esm/{utils/createWithBsPrefix.js → createWithBsPrefix.js} +2 -2
  126. package/esm/{utils/divWithClassName.js → divWithClassName.js} +0 -0
  127. package/esm/index.d.ts +1 -0
  128. package/esm/index.js +2 -0
  129. package/esm/{utils/triggerBrowserReflow.js → triggerBrowserReflow.js} +0 -0
  130. package/esm/useWrappedRefWithWarning.js +12 -0
  131. package/index.d.ts +1 -0
  132. package/package.json +12 -16
  133. package/triggerBrowserReflow/package.json +6 -0
  134. package/useWrappedRefWithWarning/package.json +6 -0
package/esm/Pagination.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
4
3
  import classNames from 'classnames';
5
4
  import React from 'react';
6
- import { createBootstrapComponent } from './ThemeProvider';
5
+ import { useBootstrapPrefix } from './ThemeProvider';
7
6
  import PageItem, { First, Prev, Ellipsis, Next, Last } from './PageItem';
7
+
8
8
  /**
9
9
  * @property {PageItem} Item
10
10
  * @property {PageItem} First
@@ -13,39 +13,24 @@ import PageItem, { First, Prev, Ellipsis, Next, Last } from './PageItem';
13
13
  * @property {PageItem} Next
14
14
  * @property {PageItem} Last
15
15
  */
16
+ var Pagination = React.forwardRef(function (_ref, ref) {
17
+ var bsPrefix = _ref.bsPrefix,
18
+ className = _ref.className,
19
+ children = _ref.children,
20
+ size = _ref.size,
21
+ props = _objectWithoutPropertiesLoose(_ref, ["bsPrefix", "className", "children", "size"]);
16
22
 
17
- var Pagination =
18
- /*#__PURE__*/
19
- function (_React$Component) {
20
- _inheritsLoose(Pagination, _React$Component);
21
-
22
- function Pagination() {
23
- return _React$Component.apply(this, arguments) || this;
24
- }
25
-
26
- var _proto = Pagination.prototype;
27
-
28
- _proto.render = function render() {
29
- var _this$props = this.props,
30
- bsPrefix = _this$props.bsPrefix,
31
- className = _this$props.className,
32
- children = _this$props.children,
33
- size = _this$props.size,
34
- props = _objectWithoutPropertiesLoose(_this$props, ["bsPrefix", "className", "children", "size"]);
35
-
36
- return React.createElement("ul", _extends({}, props, {
37
- className: classNames(className, bsPrefix, size && bsPrefix + "-" + size)
38
- }), children);
39
- };
40
-
41
- return Pagination;
42
- }(React.Component);
43
-
44
- var DecoratedPagination = createBootstrapComponent(Pagination, 'pagination');
45
- DecoratedPagination.First = First;
46
- DecoratedPagination.Prev = Prev;
47
- DecoratedPagination.Ellipsis = Ellipsis;
48
- DecoratedPagination.Item = PageItem;
49
- DecoratedPagination.Next = Next;
50
- DecoratedPagination.Last = Last;
51
- export default DecoratedPagination;
23
+ var decoratedBsPrefix = useBootstrapPrefix(bsPrefix, 'pagination');
24
+ return React.createElement("ul", _extends({
25
+ ref: ref
26
+ }, props, {
27
+ className: classNames(className, decoratedBsPrefix, size && decoratedBsPrefix + "-" + size)
28
+ }), children);
29
+ });
30
+ Pagination.First = First;
31
+ Pagination.Prev = Prev;
32
+ Pagination.Ellipsis = Ellipsis;
33
+ Pagination.Item = PageItem;
34
+ Pagination.Next = Next;
35
+ Pagination.Last = Last;
36
+ export default Pagination;
package/esm/Popover.js CHANGED
@@ -3,16 +3,14 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
3
3
  import classNames from 'classnames';
4
4
  import React from 'react';
5
5
  import isRequiredForA11y from 'prop-types-extra/lib/isRequiredForA11y';
6
- import { createBootstrapComponent } from './ThemeProvider';
6
+ import { useBootstrapPrefix } from './ThemeProvider';
7
7
  import PopoverTitle from './PopoverTitle';
8
8
  import PopoverContent from './PopoverContent';
9
9
  var defaultProps = {
10
10
  placement: 'right'
11
11
  };
12
-
13
- function Popover(_ref) {
12
+ var Popover = React.forwardRef(function (_ref, ref) {
14
13
  var bsPrefix = _ref.bsPrefix,
15
- innerRef = _ref.innerRef,
16
14
  placement = _ref.placement,
17
15
  className = _ref.className,
18
16
  style = _ref.style,
@@ -21,21 +19,20 @@ function Popover(_ref) {
21
19
  arrowProps = _ref.arrowProps,
22
20
  _ = _ref.scheduleUpdate,
23
21
  _1 = _ref.outOfBoundaries,
24
- props = _objectWithoutPropertiesLoose(_ref, ["bsPrefix", "innerRef", "placement", "className", "style", "children", "content", "arrowProps", "scheduleUpdate", "outOfBoundaries"]);
22
+ props = _objectWithoutPropertiesLoose(_ref, ["bsPrefix", "placement", "className", "style", "children", "content", "arrowProps", "scheduleUpdate", "outOfBoundaries"]);
25
23
 
24
+ var decoratedBsPrefix = useBootstrapPrefix(bsPrefix, 'popover');
26
25
  return React.createElement("div", _extends({
26
+ ref: ref,
27
27
  role: "tooltip",
28
- ref: innerRef,
29
28
  style: style,
30
29
  "x-placement": placement,
31
- className: classNames(className, bsPrefix, "bs-popover-" + placement)
30
+ className: classNames(className, decoratedBsPrefix, "bs-popover-" + placement)
32
31
  }, props), React.createElement("div", _extends({
33
32
  className: "arrow"
34
33
  }, arrowProps)), content ? React.createElement(PopoverContent, null, children) : children);
35
- }
36
-
34
+ });
37
35
  Popover.defaultProps = defaultProps;
38
- var DecoratedPopover = createBootstrapComponent(Popover, 'popover');
39
- DecoratedPopover.Title = PopoverTitle;
40
- DecoratedPopover.Content = PopoverContent;
41
- export default DecoratedPopover;
36
+ Popover.Title = PopoverTitle;
37
+ Popover.Content = PopoverContent;
38
+ export default Popover;
@@ -3,7 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
3
3
  import classNames from 'classnames';
4
4
  import React, { cloneElement } from 'react';
5
5
  import { useBootstrapPrefix } from './ThemeProvider';
6
- import { map } from './utils/ElementChildren';
6
+ import { map } from './ElementChildren';
7
7
  var ROUND_PRECISION = 1000;
8
8
  /**
9
9
  * Validate that children, if any, are instances of `<ProgressBar>`.
@@ -1,42 +1,27 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
4
3
  import classNames from 'classnames';
5
4
  import React from 'react';
6
- import { createBootstrapComponent } from './ThemeProvider';
5
+ import { useBootstrapPrefix } from './ThemeProvider';
7
6
  var defaultProps = {
8
7
  aspectRatio: '1by1'
9
8
  };
9
+ var ResponsiveEmbed = React.forwardRef(function (_ref, ref) {
10
+ var bsPrefix = _ref.bsPrefix,
11
+ className = _ref.className,
12
+ children = _ref.children,
13
+ aspectRatio = _ref.aspectRatio,
14
+ props = _objectWithoutPropertiesLoose(_ref, ["bsPrefix", "className", "children", "aspectRatio"]);
10
15
 
11
- var ResponsiveEmbed =
12
- /*#__PURE__*/
13
- function (_React$Component) {
14
- _inheritsLoose(ResponsiveEmbed, _React$Component);
15
-
16
- function ResponsiveEmbed() {
17
- return _React$Component.apply(this, arguments) || this;
18
- }
19
-
20
- var _proto = ResponsiveEmbed.prototype;
21
-
22
- _proto.render = function render() {
23
- var _this$props = this.props,
24
- bsPrefix = _this$props.bsPrefix,
25
- className = _this$props.className,
26
- children = _this$props.children,
27
- aspectRatio = _this$props.aspectRatio,
28
- props = _objectWithoutPropertiesLoose(_this$props, ["bsPrefix", "className", "children", "aspectRatio"]);
29
-
30
- var child = React.Children.only(children);
31
- return React.createElement("div", _extends({}, props, {
32
- className: classNames(bsPrefix, className, aspectRatio && bsPrefix + "-" + aspectRatio)
33
- }), React.cloneElement(child, {
34
- className: classNames(child.props.className, bsPrefix + "-item")
35
- }));
36
- };
37
-
38
- return ResponsiveEmbed;
39
- }(React.Component);
40
-
16
+ var decoratedBsPrefix = useBootstrapPrefix(bsPrefix, 'embed-responsive');
17
+ var child = React.Children.only(children);
18
+ return React.createElement("div", _extends({
19
+ ref: ref
20
+ }, props, {
21
+ className: classNames(decoratedBsPrefix, className, aspectRatio && decoratedBsPrefix + "-" + aspectRatio)
22
+ }), React.cloneElement(child, {
23
+ className: classNames(child.props.className, decoratedBsPrefix + "-item")
24
+ }));
25
+ });
41
26
  ResponsiveEmbed.defaultProps = defaultProps;
42
- export default createBootstrapComponent(ResponsiveEmbed, 'embed-responsive');
27
+ export default ResponsiveEmbed;
package/esm/Row.js CHANGED
@@ -21,5 +21,6 @@ var Row = React.forwardRef(function (props, ref) {
21
21
  className: classNames(className, decoratedBsPrefix, noGutters && 'no-gutters')
22
22
  }));
23
23
  });
24
+ Row.displayName = 'Row';
24
25
  Row.defaultProps = defaultProps;
25
26
  export default Row;
package/esm/SafeAnchor.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  import React from 'react';
4
- import createChainedFunction from './utils/createChainedFunction';
4
+ import createChainedFunction from './createChainedFunction';
5
5
 
6
6
  function isTrivialHref(href) {
7
7
  return !href || href.trim() === '#';
@@ -30,6 +30,9 @@ var propTypes = {
30
30
  /** The content of the non-toggle Button. */
31
31
  title: PropTypes.node.isRequired,
32
32
 
33
+ /** A `type` passed to the non-toggle Button */
34
+ type: PropTypes.string,
35
+
33
36
  /** Disables both Buttons */
34
37
  disabled: PropTypes.bool,
35
38
 
@@ -53,7 +56,8 @@ var propTypes = {
53
56
  size: PropTypes.string
54
57
  };
55
58
  var defaultProps = {
56
- toggleLabel: 'Toggle dropdown'
59
+ toggleLabel: 'Toggle dropdown',
60
+ type: 'button'
57
61
  };
58
62
  var SplitButton = React.forwardRef(function (_ref, ref) {
59
63
  var id = _ref.id,
@@ -61,6 +65,7 @@ var SplitButton = React.forwardRef(function (_ref, ref) {
61
65
  size = _ref.size,
62
66
  variant = _ref.variant,
63
67
  title = _ref.title,
68
+ type = _ref.type,
64
69
  toggleLabel = _ref.toggleLabel,
65
70
  children = _ref.children,
66
71
  onClick = _ref.onClick,
@@ -68,7 +73,7 @@ var SplitButton = React.forwardRef(function (_ref, ref) {
68
73
  target = _ref.target,
69
74
  menuRole = _ref.menuRole,
70
75
  rootCloseEvent = _ref.rootCloseEvent,
71
- props = _objectWithoutPropertiesLoose(_ref, ["id", "bsPrefix", "size", "variant", "title", "toggleLabel", "children", "onClick", "href", "target", "menuRole", "rootCloseEvent"]);
76
+ props = _objectWithoutPropertiesLoose(_ref, ["id", "bsPrefix", "size", "variant", "title", "type", "toggleLabel", "children", "onClick", "href", "target", "menuRole", "rootCloseEvent"]);
72
77
 
73
78
  return React.createElement(Dropdown, _extends({
74
79
  ref: ref
@@ -81,7 +86,8 @@ var SplitButton = React.forwardRef(function (_ref, ref) {
81
86
  bsPrefix: bsPrefix,
82
87
  href: href,
83
88
  target: target,
84
- onClick: onClick
89
+ onClick: onClick,
90
+ type: type
85
91
  }, title), React.createElement(Dropdown.Toggle, {
86
92
  split: true,
87
93
  id: id,
package/esm/TabContent.js CHANGED
@@ -1,36 +1,20 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
4
3
  import classNames from 'classnames';
5
4
  import React from 'react';
6
- import { createBootstrapComponent } from './ThemeProvider';
5
+ import { useBootstrapPrefix } from './ThemeProvider';
6
+ var TabContent = React.forwardRef(function (_ref, ref) {
7
+ var bsPrefix = _ref.bsPrefix,
8
+ _ref$as = _ref.as,
9
+ Component = _ref$as === void 0 ? 'div' : _ref$as,
10
+ className = _ref.className,
11
+ props = _objectWithoutPropertiesLoose(_ref, ["bsPrefix", "as", "className"]);
7
12
 
8
- var TabContent =
9
- /*#__PURE__*/
10
- function (_React$Component) {
11
- _inheritsLoose(TabContent, _React$Component);
12
-
13
- function TabContent() {
14
- return _React$Component.apply(this, arguments) || this;
15
- }
16
-
17
- var _proto = TabContent.prototype;
18
-
19
- _proto.render = function render() {
20
- // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
21
- var _this$props = this.props,
22
- bsPrefix = _this$props.bsPrefix,
23
- _this$props$as = _this$props.as,
24
- Component = _this$props$as === void 0 ? 'div' : _this$props$as,
25
- className = _this$props.className,
26
- props = _objectWithoutPropertiesLoose(_this$props, ["bsPrefix", "as", "className"]);
27
-
28
- return React.createElement(Component, _extends({}, props, {
29
- className: classNames(className, bsPrefix)
30
- }));
31
- };
32
-
33
- return TabContent;
34
- }(React.Component);
35
-
36
- export default createBootstrapComponent(TabContent, 'tab-content');
13
+ var decoratedBsPrefix = useBootstrapPrefix(bsPrefix, 'tab-content');
14
+ return React.createElement(Component, _extends({
15
+ ref: ref
16
+ }, props, {
17
+ className: classNames(className, decoratedBsPrefix)
18
+ }));
19
+ });
20
+ export default TabContent;
package/esm/Table.js CHANGED
@@ -1,55 +1,39 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
4
3
  import classNames from 'classnames';
5
4
  import React from 'react';
6
- import { createBootstrapComponent } from './ThemeProvider';
7
-
8
- var Table =
9
- /*#__PURE__*/
10
- function (_React$Component) {
11
- _inheritsLoose(Table, _React$Component);
12
-
13
- function Table() {
14
- return _React$Component.apply(this, arguments) || this;
15
- }
16
-
17
- var _proto = Table.prototype;
18
-
19
- _proto.render = function render() {
20
- var _this$props = this.props,
21
- bsPrefix = _this$props.bsPrefix,
22
- className = _this$props.className,
23
- striped = _this$props.striped,
24
- bordered = _this$props.bordered,
25
- borderless = _this$props.borderless,
26
- hover = _this$props.hover,
27
- size = _this$props.size,
28
- variant = _this$props.variant,
29
- responsive = _this$props.responsive,
30
- props = _objectWithoutPropertiesLoose(_this$props, ["bsPrefix", "className", "striped", "bordered", "borderless", "hover", "size", "variant", "responsive"]);
31
-
32
- var classes = classNames(bsPrefix, className, variant && bsPrefix + "-" + variant, size && bsPrefix + "-" + size, striped && bsPrefix + "-striped", bordered && bsPrefix + "-bordered", borderless && bsPrefix + "-borderless", hover && bsPrefix + "-hover");
33
- var table = React.createElement("table", _extends({}, props, {
34
- className: classes
35
- }));
36
-
37
- if (responsive) {
38
- var responsiveClass = bsPrefix + "-responsive";
39
-
40
- if (typeof responsive === 'string') {
41
- responsiveClass = responsiveClass + "-" + responsive;
42
- }
43
-
44
- return React.createElement("div", {
45
- className: responsiveClass
46
- }, table);
5
+ import { useBootstrapPrefix } from './ThemeProvider';
6
+ var Table = React.forwardRef(function (_ref, ref) {
7
+ var bsPrefix = _ref.bsPrefix,
8
+ className = _ref.className,
9
+ striped = _ref.striped,
10
+ bordered = _ref.bordered,
11
+ borderless = _ref.borderless,
12
+ hover = _ref.hover,
13
+ size = _ref.size,
14
+ variant = _ref.variant,
15
+ responsive = _ref.responsive,
16
+ props = _objectWithoutPropertiesLoose(_ref, ["bsPrefix", "className", "striped", "bordered", "borderless", "hover", "size", "variant", "responsive"]);
17
+
18
+ var decoratedBsPrefix = useBootstrapPrefix(bsPrefix, 'table');
19
+ var classes = classNames(className, decoratedBsPrefix, variant && decoratedBsPrefix + "-" + variant, size && decoratedBsPrefix + "-" + size, striped && decoratedBsPrefix + "-striped", bordered && decoratedBsPrefix + "-bordered", borderless && decoratedBsPrefix + "-borderless", hover && decoratedBsPrefix + "-hover");
20
+ var table = React.createElement("table", _extends({}, props, {
21
+ className: classes,
22
+ ref: ref
23
+ }));
24
+
25
+ if (responsive) {
26
+ var responsiveClass = decoratedBsPrefix + "-responsive";
27
+
28
+ if (typeof responsive === 'string') {
29
+ responsiveClass = responsiveClass + "-" + responsive;
47
30
  }
48
31
 
49
- return table;
50
- };
51
-
52
- return Table;
53
- }(React.Component);
32
+ return React.createElement("div", {
33
+ className: responsiveClass
34
+ }, table);
35
+ }
54
36
 
55
- export default createBootstrapComponent(Table, 'table');
37
+ return table;
38
+ });
39
+ export default Table;
package/esm/Tabs.js CHANGED
@@ -9,7 +9,7 @@ import NavItem from './NavItem';
9
9
  import TabContainer from './TabContainer';
10
10
  import TabContent from './TabContent';
11
11
  import TabPane from './TabPane';
12
- import { forEach, map } from './utils/ElementChildren';
12
+ import { forEach, map } from './ElementChildren';
13
13
  var defaultProps = {
14
14
  variant: 'tabs',
15
15
  mountOnEnter: false,
package/esm/ToastBody.js CHANGED
@@ -1,2 +1,2 @@
1
- import createWithBsPrefix from './utils/createWithBsPrefix';
1
+ import createWithBsPrefix from './createWithBsPrefix';
2
2
  export default createWithBsPrefix('toast-body');
@@ -12,7 +12,6 @@ export interface ToggleButtonProps {
12
12
  onChange?: React.ChangeEventHandler<this>;
13
13
  value: unknown;
14
14
  inputRef?: React.LegacyRef<this>;
15
- innerRef?: React.LegacyRef<this>;
16
15
  }
17
16
 
18
17
  declare class ToggleButton<
@@ -1,86 +1,51 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
4
3
  import classNames from 'classnames';
5
- import React from 'react';
4
+ import React, { useState, useCallback } from 'react';
6
5
  import Button from './Button';
7
6
 
8
7
  var noop = function noop() {};
9
8
 
10
- var ToggleButton =
11
- /*#__PURE__*/
12
- function (_React$Component) {
13
- _inheritsLoose(ToggleButton, _React$Component);
14
-
15
- function ToggleButton() {
16
- var _this;
17
-
18
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
19
- args[_key] = arguments[_key];
20
- }
21
-
22
- _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
23
- _this.state = {
24
- focused: false
25
- };
26
-
27
- _this.handleFocus = function (e) {
28
- if (e.target.tagName === 'INPUT') _this.setState({
29
- focused: true
30
- });
31
- };
32
-
33
- _this.handleBlur = function (e) {
34
- if (e.target.tagName === 'INPUT') _this.setState({
35
- focused: false
36
- });
37
- };
38
-
39
- return _this;
40
- }
41
-
42
- var _proto = ToggleButton.prototype;
43
-
44
- _proto.render = function render() {
45
- var _this$props = this.props,
46
- children = _this$props.children,
47
- name = _this$props.name,
48
- className = _this$props.className,
49
- checked = _this$props.checked,
50
- type = _this$props.type,
51
- onChange = _this$props.onChange,
52
- value = _this$props.value,
53
- disabled = _this$props.disabled,
54
- inputRef = _this$props.inputRef,
55
- innerRef = _this$props.innerRef,
56
- props = _objectWithoutPropertiesLoose(_this$props, ["children", "name", "className", "checked", "type", "onChange", "value", "disabled", "inputRef", "innerRef"]);
57
-
58
- var focused = this.state.focused;
59
- return React.createElement(Button, _extends({}, props, {
60
- ref: innerRef,
61
- className: classNames(className, focused && 'focus', disabled && 'disabled'),
62
- type: null,
63
- active: !!checked,
64
- as: "label"
65
- }), React.createElement("input", {
66
- name: name,
67
- type: type,
68
- value: value,
69
- ref: inputRef,
70
- autoComplete: "off",
71
- checked: !!checked,
72
- disabled: !!disabled,
73
- onFocus: this.handleFocus,
74
- onBlur: this.handleBlur,
75
- onChange: onChange || noop
76
- }), children);
77
- };
78
-
79
- return ToggleButton;
80
- }(React.Component);
81
-
82
- export default React.forwardRef(function (props, ref) {
83
- return React.createElement(ToggleButton, _extends({
84
- innerRef: ref
85
- }, props));
86
- });
9
+ var ToggleButton = React.forwardRef(function (_ref, ref) {
10
+ var children = _ref.children,
11
+ name = _ref.name,
12
+ className = _ref.className,
13
+ checked = _ref.checked,
14
+ type = _ref.type,
15
+ onChange = _ref.onChange,
16
+ value = _ref.value,
17
+ disabled = _ref.disabled,
18
+ inputRef = _ref.inputRef,
19
+ props = _objectWithoutPropertiesLoose(_ref, ["children", "name", "className", "checked", "type", "onChange", "value", "disabled", "inputRef"]);
20
+
21
+ var _useState = useState(false),
22
+ focused = _useState[0],
23
+ setFocused = _useState[1];
24
+
25
+ var handleFocus = useCallback(function (e) {
26
+ if (e.target.tagName === 'INPUT') setFocused(true);
27
+ }, []);
28
+ var handleBlur = useCallback(function (e) {
29
+ if (e.target.tagName === 'INPUT') setFocused(false);
30
+ }, []);
31
+ return React.createElement(Button, _extends({}, props, {
32
+ ref: ref,
33
+ className: classNames(className, focused && 'focus', disabled && 'disabled'),
34
+ type: null,
35
+ active: !!checked,
36
+ as: "label"
37
+ }), React.createElement("input", {
38
+ name: name,
39
+ type: type,
40
+ value: value,
41
+ ref: inputRef,
42
+ autoComplete: "off",
43
+ checked: !!checked,
44
+ disabled: !!disabled,
45
+ onFocus: handleFocus,
46
+ onBlur: handleBlur,
47
+ onChange: onChange || noop
48
+ }), children);
49
+ });
50
+ ToggleButton.displayName = 'ToggleButton';
51
+ export default ToggleButton;