react-bootstrap 1.0.0-beta.1 → 1.0.0-beta.10
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/{lib/AbstractNav.js → AbstractNav.js} +6 -20
- package/AbstractNavItem.js +71 -0
- package/Accordion.d.ts +19 -0
- package/Accordion.js +57 -0
- package/AccordionCollapse.d.ts +18 -0
- package/AccordionCollapse.js +33 -0
- package/{lib/CardContext.js → AccordionContext.js} +0 -0
- package/AccordionToggle.d.ts +14 -0
- package/AccordionToggle.js +32 -0
- package/Alert.d.ts +38 -0
- package/Alert.js +89 -0
- package/Badge.d.ts +19 -0
- package/Badge.js +40 -0
- package/Breadcrumb.d.ts +18 -0
- package/Breadcrumb.js +49 -0
- package/BreadcrumbItem.d.ts +16 -0
- package/BreadcrumbItem.js +59 -0
- package/Button.d.ts +36 -0
- package/Button.js +60 -0
- package/ButtonGroup.d.ts +16 -0
- package/ButtonGroup.js +46 -0
- package/ButtonToolbar.d.ts +14 -0
- package/ButtonToolbar.js +37 -0
- package/Card.d.ts +86 -0
- package/Card.js +82 -0
- package/CardColumns.d.ts +9 -0
- package/{lib/CardColumns.js → CardColumns.js} +0 -0
- package/{lib/NavbarContext.js → CardContext.js} +0 -0
- package/CardDeck.d.ts +9 -0
- package/{lib/CardDeck.js → CardDeck.js} +0 -0
- package/CardGroup.d.ts +9 -0
- package/{lib/CardGroup.js → CardGroup.js} +0 -0
- package/CardImg.d.ts +13 -0
- package/CardImg.js +41 -0
- package/Carousel.d.ts +34 -0
- package/{lib/Carousel.js → Carousel.js} +61 -110
- package/CarouselCaption.d.ts +9 -0
- package/CarouselCaption.js +15 -0
- package/CarouselItem.d.ts +7 -0
- package/CarouselItem.js +13 -0
- package/CloseButton.d.ts +12 -0
- package/CloseButton.js +48 -0
- package/Col.d.ts +37 -0
- package/Col.js +63 -0
- package/Collapse.d.ts +21 -0
- package/{lib/Collapse.js → Collapse.js} +3 -90
- package/Container.d.ts +13 -0
- package/Container.js +42 -0
- package/Dropdown.d.ts +39 -0
- package/Dropdown.js +109 -0
- package/DropdownButton.d.ts +27 -0
- package/{lib/DropdownButton.js → DropdownButton.js} +30 -42
- package/DropdownItem.d.ts +20 -0
- package/DropdownItem.js +75 -0
- package/DropdownMenu.d.ts +18 -0
- package/DropdownMenu.js +97 -0
- package/DropdownToggle.d.ts +18 -0
- package/{lib/DropdownToggle.js → DropdownToggle.js} +10 -31
- package/Fade.d.ts +15 -0
- package/{lib/Fade.js → Fade.js} +0 -62
- package/Feedback.d.ts +14 -0
- package/Feedback.js +49 -0
- package/Figure.d.ts +15 -0
- package/Figure.js +21 -0
- package/FigureCaption.d.ts +9 -0
- package/FigureCaption.js +15 -0
- package/FigureImage.d.ts +9 -0
- package/FigureImage.js +65 -0
- package/Form.d.ts +32 -0
- package/Form.js +59 -0
- package/FormCheck.d.ts +29 -0
- package/FormCheck.js +93 -0
- package/FormCheckInput.d.ts +19 -0
- package/FormCheckInput.js +51 -0
- package/FormCheckLabel.d.ts +15 -0
- package/FormCheckLabel.js +48 -0
- package/FormContext.js +16 -0
- package/FormControl.d.ts +27 -0
- package/FormControl.js +74 -0
- package/FormGroup.d.ts +14 -0
- package/FormGroup.js +47 -0
- package/FormLabel.d.ts +24 -0
- package/FormLabel.js +64 -0
- package/FormText.d.ts +14 -0
- package/FormText.js +36 -0
- package/Image.d.ts +14 -0
- package/{lib/Image.js → Image.js} +0 -28
- package/InputGroup.d.ts +34 -0
- package/{lib/InputGroup.js → InputGroup.js} +2 -20
- package/Jumbotron.d.ts +13 -0
- package/{lib/Jumbotron.js → Jumbotron.js} +2 -16
- package/ListGroup.d.ts +20 -0
- package/{lib/ListGroup.js → ListGroup.js} +6 -26
- package/ListGroupItem.d.ts +24 -0
- package/{lib/ListGroupItem.js → ListGroupItem.js} +0 -40
- package/Media.d.ts +15 -0
- package/Media.js +38 -0
- package/Modal.d.ts +44 -0
- package/{lib/Modal.js → Modal.js} +72 -152
- package/ModalBody.d.ts +9 -0
- package/ModalBody.js +13 -0
- package/{lib/ModalContext.js → ModalContext.js} +0 -0
- package/ModalDialog.d.ts +13 -0
- package/ModalDialog.js +39 -0
- package/ModalFooter.d.ts +9 -0
- package/ModalFooter.js +13 -0
- package/ModalHeader.d.ts +15 -0
- package/ModalHeader.js +59 -0
- package/ModalTitle.d.ts +9 -0
- package/ModalTitle.js +19 -0
- package/Nav.d.ts +30 -0
- package/Nav.js +83 -0
- package/{lib/NavContext.js → NavContext.js} +0 -0
- package/NavDropdown.d.ts +25 -0
- package/{lib/NavDropdown.js → NavDropdown.js} +0 -37
- package/NavItem.d.ts +13 -0
- package/NavItem.js +36 -0
- package/NavLink.d.ts +20 -0
- package/{lib/NavLink.js → NavLink.js} +7 -58
- package/Navbar.d.ts +35 -0
- package/{lib/Navbar.js → Navbar.js} +11 -120
- package/NavbarBrand.d.ts +13 -0
- package/NavbarBrand.js +34 -0
- package/NavbarCollapse.d.ts +16 -0
- package/NavbarCollapse.js +38 -0
- package/NavbarContext.js +13 -0
- package/NavbarToggle.d.ts +13 -0
- package/NavbarToggle.js +66 -0
- package/Overlay.d.ts +37 -0
- package/{lib/Overlay.js → Overlay.js} +2 -64
- package/OverlayTrigger.d.ts +21 -0
- package/{lib/OverlayTrigger.js → OverlayTrigger.js} +0 -50
- package/PageItem.d.ts +24 -0
- package/{lib/PageItem.js → PageItem.js} +0 -13
- package/Pagination.d.ts +20 -0
- package/{lib/Pagination.js → Pagination.js} +0 -13
- package/Popover.d.ts +16 -0
- package/Popover.js +57 -0
- package/PopoverContent.js +35 -0
- package/PopoverTitle.js +35 -0
- package/ProgressBar.d.ts +18 -0
- package/{lib/ProgressBar.js → ProgressBar.js} +2 -65
- package/README.md +22 -11
- package/ResponsiveEmbed.d.ts +15 -0
- package/{lib/CarouselItem.js → ResponsiveEmbed.js} +19 -18
- package/Row.d.ts +14 -0
- package/Row.js +40 -0
- package/SafeAnchor.d.ts +18 -0
- package/{lib/SafeAnchor.js → SafeAnchor.js} +6 -28
- package/{lib/SelectableContext.js → SelectableContext.js} +0 -0
- package/Spinner.d.ts +25 -0
- package/{lib/NavItem.js → Spinner.js} +15 -28
- package/SplitButton.d.ts +31 -0
- package/{lib/SplitButton.js → SplitButton.js} +0 -49
- package/Tab.d.ts +25 -0
- package/{lib/Tab.js → Tab.js} +0 -5
- package/TabContainer.d.ts +18 -0
- package/TabContainer.js +96 -0
- package/TabContent.d.ts +9 -0
- package/{lib/TabContent.js → TabContent.js} +3 -16
- package/{lib/TabContext.js → TabContext.js} +0 -0
- package/TabPane.d.ts +18 -0
- package/TabPane.js +99 -0
- package/Table.d.ts +17 -0
- package/{lib/Table.js → Table.js} +3 -49
- package/Tabs.d.ts +22 -0
- package/{lib/Tabs.js → Tabs.js} +5 -69
- package/ThemeProvider.d.ts +9 -0
- package/ThemeProvider.js +82 -0
- package/Toast.d.ts +25 -0
- package/Toast.js +92 -0
- package/ToastBody.d.ts +9 -0
- package/ToastBody.js +13 -0
- package/ToastContext.js +16 -0
- package/ToastHeader.d.ts +14 -0
- package/ToastHeader.js +59 -0
- package/ToggleButton.d.ts +22 -0
- package/{lib/ToggleButton.js → ToggleButton.js} +0 -48
- package/ToggleButtonGroup.d.ts +31 -0
- package/{lib/ToggleButtonGroup.js → ToggleButtonGroup.js} +5 -38
- package/Tooltip.d.ts +15 -0
- package/{lib/Tooltip.js → Tooltip.js} +0 -41
- package/dist/react-bootstrap.js +10177 -12975
- package/dist/react-bootstrap.min.js +7 -7
- package/es/AbstractNav.js +6 -17
- package/es/AbstractNavItem.js +39 -68
- package/es/Accordion.d.ts +19 -0
- package/es/Accordion.js +37 -0
- package/es/AccordionCollapse.d.ts +18 -0
- package/es/AccordionCollapse.js +17 -0
- package/es/AccordionContext.js +2 -0
- package/es/AccordionToggle.d.ts +14 -0
- package/es/AccordionToggle.js +19 -0
- package/es/Alert.d.ts +38 -0
- package/es/Alert.js +45 -112
- package/es/Badge.d.ts +19 -0
- package/es/Badge.js +19 -50
- package/es/Breadcrumb.d.ts +18 -0
- package/es/Breadcrumb.js +26 -63
- package/es/BreadcrumbItem.d.ts +16 -0
- package/es/BreadcrumbItem.js +39 -81
- package/es/Button.d.ts +36 -0
- package/es/Button.js +34 -104
- package/es/ButtonGroup.d.ts +16 -0
- package/es/ButtonGroup.js +24 -71
- package/es/ButtonToolbar.d.ts +14 -0
- package/es/ButtonToolbar.js +16 -44
- package/es/Card.d.ts +86 -0
- package/es/Card.js +43 -106
- package/es/CardColumns.d.ts +9 -0
- package/es/CardDeck.d.ts +9 -0
- package/es/CardGroup.d.ts +9 -0
- package/es/CardImg.d.ts +13 -0
- package/es/CardImg.js +20 -51
- package/es/Carousel.d.ts +34 -0
- package/es/Carousel.js +62 -109
- package/es/CarouselCaption.d.ts +9 -0
- package/es/CarouselCaption.js +4 -48
- package/es/CarouselItem.d.ts +7 -0
- package/es/CarouselItem.js +2 -42
- package/es/CloseButton.d.ts +12 -0
- package/es/CloseButton.js +20 -30
- package/es/Col.d.ts +37 -0
- package/es/Col.js +39 -106
- package/es/Collapse.d.ts +21 -0
- package/es/Collapse.js +3 -89
- package/es/Container.d.ts +13 -0
- package/es/Container.js +21 -51
- package/es/Dropdown.d.ts +39 -0
- package/es/Dropdown.js +59 -148
- package/es/DropdownButton.d.ts +27 -0
- package/es/DropdownButton.js +29 -42
- package/es/DropdownItem.d.ts +20 -0
- package/es/DropdownItem.js +45 -113
- package/es/DropdownMenu.d.ts +18 -0
- package/es/DropdownMenu.js +59 -100
- package/es/DropdownToggle.d.ts +18 -0
- package/es/DropdownToggle.js +7 -27
- package/es/Fade.d.ts +15 -0
- package/es/Fade.js +0 -61
- package/es/Feedback.d.ts +14 -0
- package/es/Feedback.js +20 -34
- package/es/Figure.d.ts +15 -0
- package/es/Figure.js +7 -49
- package/es/FigureCaption.d.ts +9 -0
- package/es/FigureCaption.js +5 -46
- package/es/FigureImage.d.ts +9 -0
- package/es/FigureImage.js +37 -24
- package/es/Form.d.ts +32 -0
- package/es/Form.js +17 -51
- package/es/FormCheck.d.ts +29 -0
- package/es/FormCheck.js +55 -117
- package/es/FormCheckInput.d.ts +19 -0
- package/es/FormCheckInput.js +17 -47
- package/es/FormCheckLabel.d.ts +15 -0
- package/es/FormCheckLabel.js +17 -32
- package/es/FormContext.js +0 -2
- package/es/FormControl.d.ts +27 -0
- package/es/FormControl.js +45 -146
- package/es/FormGroup.d.ts +14 -0
- package/es/FormGroup.js +17 -43
- package/es/FormLabel.d.ts +24 -0
- package/es/FormLabel.js +25 -63
- package/es/FormText.d.ts +14 -0
- package/es/FormText.js +13 -39
- package/es/Image.d.ts +14 -0
- package/es/Image.js +0 -27
- package/es/InputGroup.d.ts +34 -0
- package/es/InputGroup.js +2 -18
- package/es/Jumbotron.d.ts +13 -0
- package/es/Jumbotron.js +2 -14
- package/es/ListGroup.d.ts +20 -0
- package/es/ListGroup.js +5 -23
- package/es/ListGroupItem.d.ts +24 -0
- package/es/ListGroupItem.js +0 -38
- package/es/Media.d.ts +15 -0
- package/es/Media.js +17 -45
- package/es/Modal.d.ts +44 -0
- package/es/Modal.js +73 -150
- package/es/ModalBody.d.ts +9 -0
- package/es/ModalBody.js +2 -43
- package/es/ModalDialog.d.ts +13 -0
- package/es/ModalDialog.js +21 -51
- package/es/ModalFooter.d.ts +9 -0
- package/es/ModalFooter.js +2 -43
- package/es/ModalHeader.d.ts +15 -0
- package/es/ModalHeader.js +30 -66
- package/es/ModalTitle.d.ts +9 -0
- package/es/ModalTitle.js +4 -43
- package/es/Nav.d.ts +30 -0
- package/es/Nav.js +45 -140
- package/es/NavDropdown.d.ts +25 -0
- package/es/NavDropdown.js +0 -35
- package/es/NavItem.d.ts +13 -0
- package/es/NavItem.js +18 -46
- package/es/NavLink.d.ts +20 -0
- package/es/NavLink.js +8 -57
- package/es/Navbar.d.ts +35 -0
- package/es/Navbar.js +10 -117
- package/es/NavbarBrand.d.ts +13 -0
- package/es/NavbarBrand.js +16 -47
- package/es/NavbarCollapse.d.ts +16 -0
- package/es/NavbarCollapse.js +17 -37
- package/es/NavbarToggle.d.ts +13 -0
- package/es/NavbarToggle.js +41 -81
- package/es/Overlay.d.ts +37 -0
- package/es/Overlay.js +1 -63
- package/es/OverlayTrigger.d.ts +21 -0
- package/es/OverlayTrigger.js +0 -48
- package/es/PageItem.d.ts +24 -0
- package/es/PageItem.js +0 -12
- package/es/Pagination.d.ts +20 -0
- package/es/Pagination.js +0 -12
- package/es/Popover.d.ts +16 -0
- package/es/Popover.js +9 -54
- package/es/PopoverContent.js +21 -0
- package/es/PopoverTitle.js +21 -0
- package/es/ProgressBar.d.ts +18 -0
- package/es/ProgressBar.js +2 -64
- package/es/ResponsiveEmbed.d.ts +15 -0
- package/es/ResponsiveEmbed.js +14 -45
- package/es/Row.d.ts +14 -0
- package/es/Row.js +19 -45
- package/es/SafeAnchor.d.ts +18 -0
- package/es/SafeAnchor.js +5 -24
- package/es/Spinner.d.ts +25 -0
- package/es/Spinner.js +40 -0
- package/es/SplitButton.d.ts +31 -0
- package/es/SplitButton.js +0 -48
- package/es/Tab.d.ts +25 -0
- package/es/Tab.js +0 -4
- package/es/TabContainer.d.ts +18 -0
- package/es/TabContainer.js +3 -81
- package/es/TabContent.d.ts +9 -0
- package/es/TabContent.js +3 -13
- package/es/TabPane.d.ts +18 -0
- package/es/TabPane.js +59 -146
- package/es/Table.d.ts +17 -0
- package/es/Table.js +3 -47
- package/es/Tabs.d.ts +22 -0
- package/es/Tabs.js +4 -64
- package/es/ThemeProvider.d.ts +9 -0
- package/es/ThemeProvider.js +23 -37
- package/es/Toast.d.ts +25 -0
- package/es/Toast.js +71 -0
- package/es/ToastBody.d.ts +9 -0
- package/es/ToastBody.js +2 -0
- package/es/ToastContext.js +5 -0
- package/es/ToastHeader.d.ts +14 -0
- package/es/ToastHeader.js +41 -0
- package/es/ToggleButton.d.ts +22 -0
- package/es/ToggleButton.js +0 -46
- package/es/ToggleButtonGroup.d.ts +31 -0
- package/es/ToggleButtonGroup.js +4 -36
- package/es/Tooltip.d.ts +15 -0
- package/es/Tooltip.js +0 -40
- package/es/helpers.d.ts +33 -0
- package/es/index.d.ts +93 -0
- package/es/index.js +18 -4
- package/es/useAccordionToggle.js +16 -0
- package/es/utils/ElementChildren.js +32 -0
- package/es/utils/createChainedFunction.js +1 -4
- package/es/utils/createWithBsPrefix.js +18 -33
- package/helpers.d.ts +33 -0
- package/index.d.ts +93 -0
- package/{lib/index.js → index.js} +34 -9
- package/package.json +24 -107
- package/useAccordionToggle.js +29 -0
- package/{lib/utils → utils}/BootstrapModalManager.js +0 -0
- package/utils/ElementChildren.js +39 -0
- package/{lib/utils → utils}/createChainedFunction.js +1 -4
- package/utils/createWithBsPrefix.js +51 -0
- package/{lib/utils → utils}/divWithClassName.js +0 -0
- package/{lib/utils → utils}/triggerBrowserReflow.js +0 -0
- package/CHANGELOG.md +0 -1053
- package/es/Clearfix.js +0 -95
- package/es/InvalidFeedback.js +0 -46
- package/es/utils/PropTypes.js +0 -75
- package/es/utils/StyleConfig.js +0 -38
- package/es/utils/ValidComponentChildren.js +0 -176
- package/es/utils/bootstrapUtils.js +0 -176
- package/es/utils/deprecationWarning.js +0 -64
- package/es/utils/index.js +0 -6
- package/es/utils/splitComponentProps.js +0 -16
- package/lib/AbstractNavItem.js +0 -99
- package/lib/Alert.js +0 -154
- package/lib/Badge.js +0 -72
- package/lib/Breadcrumb.js +0 -86
- package/lib/BreadcrumbItem.js +0 -104
- package/lib/Button.js +0 -132
- package/lib/ButtonGroup.js +0 -95
- package/lib/ButtonToolbar.js +0 -66
- package/lib/Card.js +0 -144
- package/lib/CardImg.js +0 -74
- package/lib/CarouselCaption.js +0 -66
- package/lib/Clearfix.js +0 -118
- package/lib/CloseButton.js +0 -55
- package/lib/Col.js +0 -136
- package/lib/Container.js +0 -74
- package/lib/Dropdown.js +0 -196
- package/lib/DropdownItem.js +0 -146
- package/lib/DropdownMenu.js +0 -139
- package/lib/Feedback.js +0 -62
- package/lib/Figure.js +0 -68
- package/lib/FigureCaption.js +0 -63
- package/lib/FigureImage.js +0 -49
- package/lib/Form.js +0 -93
- package/lib/FormCheck.js +0 -152
- package/lib/FormCheckInput.js +0 -80
- package/lib/FormCheckLabel.js +0 -62
- package/lib/FormContext.js +0 -19
- package/lib/FormControl.js +0 -175
- package/lib/FormGroup.js +0 -74
- package/lib/FormLabel.js +0 -100
- package/lib/FormText.js +0 -65
- package/lib/InvalidFeedback.js +0 -64
- package/lib/Media.js +0 -68
- package/lib/ModalBody.js +0 -60
- package/lib/ModalDialog.js +0 -71
- package/lib/ModalFooter.js +0 -60
- package/lib/ModalHeader.js +0 -95
- package/lib/ModalTitle.js +0 -64
- package/lib/Nav.js +0 -176
- package/lib/NavbarBrand.js +0 -68
- package/lib/NavbarCollapse.js +0 -60
- package/lib/NavbarToggle.js +0 -106
- package/lib/Popover.js +0 -103
- package/lib/ResponsiveEmbed.js +0 -92
- package/lib/Row.js +0 -68
- package/lib/TabContainer.js +0 -177
- package/lib/TabPane.js +0 -190
- package/lib/ThemeProvider.js +0 -93
- package/lib/utils/PropTypes.js +0 -90
- package/lib/utils/StyleConfig.js +0 -47
- package/lib/utils/ValidComponentChildren.js +0 -205
- package/lib/utils/bootstrapUtils.js +0 -204
- package/lib/utils/createWithBsPrefix.js +0 -66
- package/lib/utils/deprecationWarning.js +0 -76
- package/lib/utils/index.js +0 -20
- package/lib/utils/splitComponentProps.js +0 -23
|
@@ -13,12 +13,8 @@ var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inh
|
|
|
13
13
|
|
|
14
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
15
|
|
|
16
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
|
-
|
|
18
16
|
var _react = _interopRequireDefault(require("react"));
|
|
19
17
|
|
|
20
|
-
var _elementType = _interopRequireDefault(require("prop-types-extra/lib/elementType"));
|
|
21
|
-
|
|
22
18
|
var _ThemeProvider = require("./ThemeProvider");
|
|
23
19
|
|
|
24
20
|
var TabContent =
|
|
@@ -33,9 +29,11 @@ function (_React$Component) {
|
|
|
33
29
|
var _proto = TabContent.prototype;
|
|
34
30
|
|
|
35
31
|
_proto.render = function render() {
|
|
32
|
+
// Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
|
|
36
33
|
var _this$props = this.props,
|
|
37
34
|
bsPrefix = _this$props.bsPrefix,
|
|
38
|
-
|
|
35
|
+
_this$props$as = _this$props.as,
|
|
36
|
+
Component = _this$props$as === void 0 ? 'div' : _this$props$as,
|
|
39
37
|
className = _this$props.className,
|
|
40
38
|
props = (0, _objectWithoutPropertiesLoose2.default)(_this$props, ["bsPrefix", "as", "className"]);
|
|
41
39
|
return _react.default.createElement(Component, (0, _extends2.default)({}, props, {
|
|
@@ -46,17 +44,6 @@ function (_React$Component) {
|
|
|
46
44
|
return TabContent;
|
|
47
45
|
}(_react.default.Component);
|
|
48
46
|
|
|
49
|
-
TabContent.propTypes = {
|
|
50
|
-
/**
|
|
51
|
-
* @default 'tab-content'
|
|
52
|
-
*/
|
|
53
|
-
bsPrefix: _propTypes.default.string,
|
|
54
|
-
as: _elementType.default
|
|
55
|
-
};
|
|
56
|
-
TabContent.defaultProps = {
|
|
57
|
-
as: 'div'
|
|
58
|
-
};
|
|
59
|
-
|
|
60
47
|
var _default = (0, _ThemeProvider.createBootstrapComponent)(TabContent, 'tab-content');
|
|
61
48
|
|
|
62
49
|
exports.default = _default;
|
|
File without changes
|
package/TabPane.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { BsPrefixComponent, TransitionCallbacks } from './helpers';
|
|
4
|
+
|
|
5
|
+
export interface TabPaneProps extends TransitionCallbacks {
|
|
6
|
+
eventKey?: unknown;
|
|
7
|
+
active?: boolean;
|
|
8
|
+
transition?: false | React.ReactType;
|
|
9
|
+
bsClass?: string;
|
|
10
|
+
mountOnEnter?: boolean;
|
|
11
|
+
unmountOnExit?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare class TabPane<
|
|
15
|
+
As extends React.ReactType = 'div'
|
|
16
|
+
> extends BsPrefixComponent<As, TabPaneProps> {}
|
|
17
|
+
|
|
18
|
+
export default TabPane;
|
package/TabPane.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
+
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
+
|
|
7
|
+
exports.__esModule = true;
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
|
|
12
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
13
|
+
|
|
14
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
+
|
|
16
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
+
|
|
18
|
+
var _ThemeProvider = require("./ThemeProvider");
|
|
19
|
+
|
|
20
|
+
var _TabContext = _interopRequireDefault(require("./TabContext"));
|
|
21
|
+
|
|
22
|
+
var _SelectableContext = _interopRequireWildcard(require("./SelectableContext"));
|
|
23
|
+
|
|
24
|
+
var _Fade = _interopRequireDefault(require("./Fade"));
|
|
25
|
+
|
|
26
|
+
function useTabContext(props) {
|
|
27
|
+
var context = (0, _react.useContext)(_TabContext.default);
|
|
28
|
+
if (!context) return props;
|
|
29
|
+
var activeKey = context.activeKey,
|
|
30
|
+
getControlledId = context.getControlledId,
|
|
31
|
+
getControllerId = context.getControllerId,
|
|
32
|
+
rest = (0, _objectWithoutPropertiesLoose2.default)(context, ["activeKey", "getControlledId", "getControllerId"]);
|
|
33
|
+
var shouldTransition = props.transition !== false && rest.transition !== false;
|
|
34
|
+
var key = (0, _SelectableContext.makeEventKey)(props.eventKey);
|
|
35
|
+
return (0, _extends2.default)({}, props, {
|
|
36
|
+
active: props.active == null && key != null ? (0, _SelectableContext.makeEventKey)(activeKey) === key : props.active,
|
|
37
|
+
id: getControlledId(props.eventKey),
|
|
38
|
+
'aria-labelledby': getControllerId(props.eventKey),
|
|
39
|
+
transition: shouldTransition && (props.transition || rest.transition || _Fade.default),
|
|
40
|
+
mountOnEnter: props.mountOnEnter != null ? props.mountOnEnter : rest.mountOnEnter,
|
|
41
|
+
unmountOnExit: props.unmountOnExit != null ? props.unmountOnExit : rest.unmountOnExit
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
var TabPane = _react.default.forwardRef(function (props, ref) {
|
|
46
|
+
var _useTabContext = useTabContext(props),
|
|
47
|
+
bsPrefix = _useTabContext.bsPrefix,
|
|
48
|
+
className = _useTabContext.className,
|
|
49
|
+
active = _useTabContext.active,
|
|
50
|
+
onEnter = _useTabContext.onEnter,
|
|
51
|
+
onEntering = _useTabContext.onEntering,
|
|
52
|
+
onEntered = _useTabContext.onEntered,
|
|
53
|
+
onExit = _useTabContext.onExit,
|
|
54
|
+
onExiting = _useTabContext.onExiting,
|
|
55
|
+
onExited = _useTabContext.onExited,
|
|
56
|
+
mountOnEnter = _useTabContext.mountOnEnter,
|
|
57
|
+
unmountOnExit = _useTabContext.unmountOnExit,
|
|
58
|
+
Transition = _useTabContext.transition,
|
|
59
|
+
_useTabContext$as = _useTabContext.as,
|
|
60
|
+
Component = _useTabContext$as === void 0 ? 'div' : _useTabContext$as,
|
|
61
|
+
_ = _useTabContext.eventKey,
|
|
62
|
+
rest = (0, _objectWithoutPropertiesLoose2.default)(_useTabContext, ["bsPrefix", "className", "active", "onEnter", "onEntering", "onEntered", "onExit", "onExiting", "onExited", "mountOnEnter", "unmountOnExit", "transition", "as", "eventKey"]);
|
|
63
|
+
|
|
64
|
+
var prefix = (0, _ThemeProvider.useBootstrapPrefix)(bsPrefix, 'tab-pane');
|
|
65
|
+
if (!active && unmountOnExit) return null;
|
|
66
|
+
|
|
67
|
+
var pane = _react.default.createElement(Component, (0, _extends2.default)({}, rest, {
|
|
68
|
+
ref: ref,
|
|
69
|
+
role: "tabpanel",
|
|
70
|
+
"aria-hidden": !active,
|
|
71
|
+
className: (0, _classnames.default)(className, prefix, {
|
|
72
|
+
active: active
|
|
73
|
+
})
|
|
74
|
+
}));
|
|
75
|
+
|
|
76
|
+
if (Transition) pane = _react.default.createElement(Transition, {
|
|
77
|
+
in: active,
|
|
78
|
+
onEnter: onEnter,
|
|
79
|
+
onEntering: onEntering,
|
|
80
|
+
onEntered: onEntered,
|
|
81
|
+
onExit: onExit,
|
|
82
|
+
onExiting: onExiting,
|
|
83
|
+
onExited: onExited,
|
|
84
|
+
mountOnEnter: mountOnEnter,
|
|
85
|
+
unmountOnExit: unmountOnExit
|
|
86
|
+
}, pane); // We provide an empty the TabContext so `<Nav>`s in `<TabPane>`s don't
|
|
87
|
+
// conflict with the top level one.
|
|
88
|
+
|
|
89
|
+
return _react.default.createElement(_TabContext.default.Provider, {
|
|
90
|
+
value: null
|
|
91
|
+
}, _react.default.createElement(_SelectableContext.default.Provider, {
|
|
92
|
+
value: null
|
|
93
|
+
}, pane));
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
TabPane.displayName = 'TabPane';
|
|
97
|
+
var _default = TabPane;
|
|
98
|
+
exports.default = _default;
|
|
99
|
+
module.exports = exports["default"];
|
package/Table.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { BsPrefixComponent } from './helpers';
|
|
4
|
+
|
|
5
|
+
export interface TableProps {
|
|
6
|
+
striped?: boolean;
|
|
7
|
+
bordered?: boolean;
|
|
8
|
+
borderless?: boolean;
|
|
9
|
+
hover?: boolean;
|
|
10
|
+
size?: string;
|
|
11
|
+
variant?: string;
|
|
12
|
+
responsive?: boolean | string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
declare class Table extends BsPrefixComponent<'table', TableProps> {}
|
|
16
|
+
|
|
17
|
+
export default Table;
|
|
@@ -15,8 +15,6 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
15
15
|
|
|
16
16
|
var _react = _interopRequireDefault(require("react"));
|
|
17
17
|
|
|
18
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
19
|
-
|
|
20
18
|
var _ThemeProvider = require("./ThemeProvider");
|
|
21
19
|
|
|
22
20
|
var Table =
|
|
@@ -36,12 +34,13 @@ function (_React$Component) {
|
|
|
36
34
|
className = _this$props.className,
|
|
37
35
|
striped = _this$props.striped,
|
|
38
36
|
bordered = _this$props.bordered,
|
|
37
|
+
borderless = _this$props.borderless,
|
|
39
38
|
hover = _this$props.hover,
|
|
40
39
|
size = _this$props.size,
|
|
41
40
|
variant = _this$props.variant,
|
|
42
41
|
responsive = _this$props.responsive,
|
|
43
|
-
props = (0, _objectWithoutPropertiesLoose2.default)(_this$props, ["bsPrefix", "className", "striped", "bordered", "hover", "size", "variant", "responsive"]);
|
|
44
|
-
var classes = (0, _classnames.default)(bsPrefix, className, variant && bsPrefix + "-" + variant, size && bsPrefix + "-" + size, striped && bsPrefix + "-striped", bordered && bsPrefix + "-bordered", hover && bsPrefix + "-hover");
|
|
42
|
+
props = (0, _objectWithoutPropertiesLoose2.default)(_this$props, ["bsPrefix", "className", "striped", "bordered", "borderless", "hover", "size", "variant", "responsive"]);
|
|
43
|
+
var classes = (0, _classnames.default)(bsPrefix, className, variant && bsPrefix + "-" + variant, size && bsPrefix + "-" + size, striped && bsPrefix + "-striped", bordered && bsPrefix + "-bordered", borderless && bsPrefix + "-borderless", hover && bsPrefix + "-hover");
|
|
45
44
|
|
|
46
45
|
var table = _react.default.createElement("table", (0, _extends2.default)({}, props, {
|
|
47
46
|
className: classes
|
|
@@ -65,51 +64,6 @@ function (_React$Component) {
|
|
|
65
64
|
return Table;
|
|
66
65
|
}(_react.default.Component);
|
|
67
66
|
|
|
68
|
-
Table.propTypes = {
|
|
69
|
-
/**
|
|
70
|
-
* @default 'table'
|
|
71
|
-
*/
|
|
72
|
-
bsPrefix: _propTypes.default.string,
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Adds zebra-striping to any table row within the `<tbody>`.
|
|
76
|
-
*/
|
|
77
|
-
striped: _propTypes.default.bool,
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Adds borders on all sides of the table and cells.
|
|
81
|
-
*/
|
|
82
|
-
bordered: _propTypes.default.bool,
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Enable a hover state on table rows within a `<tbody>`.
|
|
86
|
-
*/
|
|
87
|
-
hover: _propTypes.default.bool,
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Make tables more compact by cutting cell padding in half by setting
|
|
91
|
-
* size as `sm`.
|
|
92
|
-
*/
|
|
93
|
-
size: _propTypes.default.string,
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Invert the colors of the table — with light text on dark backgrounds
|
|
97
|
-
* by setting variant as `dark`.
|
|
98
|
-
*/
|
|
99
|
-
variant: _propTypes.default.string,
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Responsive tables allow tables to be scrolled horizontally with ease.
|
|
103
|
-
* Across every breakpoint, use `responsive` for horizontally
|
|
104
|
-
* scrolling tables. Responsive tables are wrapped automatically in a `div`.
|
|
105
|
-
* Use `responsive="sm"`, `responsive="md"`, `responsive="lg"`, or
|
|
106
|
-
* `responsive="xl"` as needed to create responsive tables up to
|
|
107
|
-
* a particular breakpoint. From that breakpoint and up, the table will
|
|
108
|
-
* behave normally and not scroll horizontally.
|
|
109
|
-
*/
|
|
110
|
-
responsive: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.string])
|
|
111
|
-
};
|
|
112
|
-
|
|
113
67
|
var _default = (0, _ThemeProvider.createBootstrapComponent)(Table, 'table');
|
|
114
68
|
|
|
115
69
|
exports.default = _default;
|
package/Tabs.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import Nav from './Nav';
|
|
4
|
+
|
|
5
|
+
import { BsPrefixComponent, SelectCallback } from './helpers';
|
|
6
|
+
|
|
7
|
+
export interface TabsProps {
|
|
8
|
+
activeKey?: unknown;
|
|
9
|
+
defaultActiveKey?: unknown;
|
|
10
|
+
onSelect?: SelectCallback;
|
|
11
|
+
variant?: 'tabs' | 'pills';
|
|
12
|
+
transition?: false | React.ReactType;
|
|
13
|
+
id: string;
|
|
14
|
+
mountOnEnter?: boolean;
|
|
15
|
+
unmountOnExit?: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare class Tabs<
|
|
19
|
+
As extends React.ReactType = typeof Nav
|
|
20
|
+
> extends BsPrefixComponent<As, TabsProps> {}
|
|
21
|
+
|
|
22
|
+
export default Tabs;
|
package/{lib/Tabs.js → Tabs.js}
RENAMED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
-
|
|
5
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
4
|
|
|
7
5
|
exports.__esModule = true;
|
|
@@ -15,13 +13,9 @@ var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inh
|
|
|
15
13
|
|
|
16
14
|
var _react = _interopRequireDefault(require("react"));
|
|
17
15
|
|
|
18
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
19
|
-
|
|
20
|
-
var _elementType = _interopRequireDefault(require("prop-types-extra/lib/elementType"));
|
|
21
|
-
|
|
22
16
|
var _isRequiredForA11y = _interopRequireDefault(require("prop-types-extra/lib/isRequiredForA11y"));
|
|
23
17
|
|
|
24
|
-
var _uncontrollable =
|
|
18
|
+
var _uncontrollable = require("uncontrollable");
|
|
25
19
|
|
|
26
20
|
var _Nav = _interopRequireDefault(require("./Nav"));
|
|
27
21
|
|
|
@@ -35,66 +29,9 @@ var _TabContent = _interopRequireDefault(require("./TabContent"));
|
|
|
35
29
|
|
|
36
30
|
var _TabPane = _interopRequireDefault(require("./TabPane"));
|
|
37
31
|
|
|
38
|
-
var
|
|
32
|
+
var _ElementChildren = require("./utils/ElementChildren");
|
|
39
33
|
|
|
40
34
|
var TabContainer = _TabContainer.default.ControlledComponent;
|
|
41
|
-
var propTypes = {
|
|
42
|
-
/**
|
|
43
|
-
* Mark the Tab with a matching `eventKey` as active.
|
|
44
|
-
*
|
|
45
|
-
* @controllable onSelect
|
|
46
|
-
*/
|
|
47
|
-
activeKey: _propTypes.default.any,
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Navigation style
|
|
51
|
-
*
|
|
52
|
-
* @type {('tabs'| 'pills')}
|
|
53
|
-
*/
|
|
54
|
-
variant: _propTypes.default.string,
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Sets a default animation strategy for all children `<TabPane>`s. Use
|
|
58
|
-
* `false` to disable, `true` to enable the default `<Fade>` animation or
|
|
59
|
-
* a react-transition-group v2 `<Transition/>` component.
|
|
60
|
-
*
|
|
61
|
-
* @type {Transition | false}
|
|
62
|
-
* @default {Fade}
|
|
63
|
-
*/
|
|
64
|
-
transition: _propTypes.default.oneOfType([_propTypes.default.oneOf([false]), _elementType.default]),
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* HTML id attribute, required if no `generateChildId` prop
|
|
68
|
-
* is specified.
|
|
69
|
-
*
|
|
70
|
-
* @type {string}
|
|
71
|
-
*/
|
|
72
|
-
id: (0, _isRequiredForA11y.default)(_propTypes.default.string),
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Callback fired when a Tab is selected.
|
|
76
|
-
*
|
|
77
|
-
* ```js
|
|
78
|
-
* function (
|
|
79
|
-
* Any eventKey,
|
|
80
|
-
* SyntheticEvent event?
|
|
81
|
-
* )
|
|
82
|
-
* ```
|
|
83
|
-
*
|
|
84
|
-
* @controllable activeKey
|
|
85
|
-
*/
|
|
86
|
-
onSelect: _propTypes.default.func,
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Wait until the first "enter" transition to mount tabs (add them to the DOM)
|
|
90
|
-
*/
|
|
91
|
-
mountOnEnter: _propTypes.default.bool,
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Unmount tabs (remove it from the DOM) when it is no longer visible
|
|
95
|
-
*/
|
|
96
|
-
unmountOnExit: _propTypes.default.bool
|
|
97
|
-
};
|
|
98
35
|
var defaultProps = {
|
|
99
36
|
variant: 'tabs',
|
|
100
37
|
mountOnEnter: false,
|
|
@@ -103,7 +40,7 @@ var defaultProps = {
|
|
|
103
40
|
|
|
104
41
|
function getDefaultActiveKey(children) {
|
|
105
42
|
var defaultActiveKey;
|
|
106
|
-
|
|
43
|
+
(0, _ElementChildren.forEach)(children, function (child) {
|
|
107
44
|
if (defaultActiveKey == null) {
|
|
108
45
|
defaultActiveKey = child.props.eventKey;
|
|
109
46
|
}
|
|
@@ -162,7 +99,7 @@ function (_React$Component) {
|
|
|
162
99
|
}, _react.default.createElement(_Nav.default, (0, _extends2.default)({}, props, {
|
|
163
100
|
role: "tablist",
|
|
164
101
|
as: "nav"
|
|
165
|
-
}),
|
|
102
|
+
}), (0, _ElementChildren.map)(children, this.renderTab)), _react.default.createElement(_TabContent.default, null, (0, _ElementChildren.map)(children, function (child) {
|
|
166
103
|
var childProps = (0, _extends2.default)({}, child.props);
|
|
167
104
|
delete childProps.title;
|
|
168
105
|
delete childProps.disabled;
|
|
@@ -174,10 +111,9 @@ function (_React$Component) {
|
|
|
174
111
|
return Tabs;
|
|
175
112
|
}(_react.default.Component);
|
|
176
113
|
|
|
177
|
-
Tabs.propTypes = propTypes;
|
|
178
114
|
Tabs.defaultProps = defaultProps;
|
|
179
115
|
|
|
180
|
-
var _default = (0, _uncontrollable.
|
|
116
|
+
var _default = (0, _uncontrollable.uncontrollable)(Tabs, {
|
|
181
117
|
activeKey: 'onSelect'
|
|
182
118
|
});
|
|
183
119
|
|
package/ThemeProvider.js
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
+
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
+
|
|
7
|
+
exports.__esModule = true;
|
|
8
|
+
exports.useBootstrapPrefix = useBootstrapPrefix;
|
|
9
|
+
exports.createBootstrapComponent = createBootstrapComponent;
|
|
10
|
+
exports.default = exports.ThemeConsumer = void 0;
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
|
15
|
+
|
|
16
|
+
var _forwardRef = _interopRequireDefault(require("@restart/context/forwardRef"));
|
|
17
|
+
|
|
18
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
+
|
|
20
|
+
var ThemeContext = _react.default.createContext(new Map());
|
|
21
|
+
|
|
22
|
+
var Consumer = ThemeContext.Consumer,
|
|
23
|
+
Provider = ThemeContext.Provider;
|
|
24
|
+
exports.ThemeConsumer = Consumer;
|
|
25
|
+
|
|
26
|
+
var ThemeProvider =
|
|
27
|
+
/*#__PURE__*/
|
|
28
|
+
function (_React$Component) {
|
|
29
|
+
(0, _inheritsLoose2.default)(ThemeProvider, _React$Component);
|
|
30
|
+
|
|
31
|
+
function ThemeProvider(props) {
|
|
32
|
+
var _this;
|
|
33
|
+
|
|
34
|
+
_this = _React$Component.call(this, props) || this;
|
|
35
|
+
_this.prefixes = new Map();
|
|
36
|
+
Object.keys(_this.props.prefixes).forEach(function (key) {
|
|
37
|
+
_this.prefixes.set(key, _this.props.prefixes[key]);
|
|
38
|
+
});
|
|
39
|
+
return _this;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
var _proto = ThemeProvider.prototype;
|
|
43
|
+
|
|
44
|
+
_proto.render = function render() {
|
|
45
|
+
return _react.default.createElement(Provider, {
|
|
46
|
+
value: this.prefixes
|
|
47
|
+
}, this.props.children);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
return ThemeProvider;
|
|
51
|
+
}(_react.default.Component);
|
|
52
|
+
|
|
53
|
+
function useBootstrapPrefix(prefix, defaultPrefix) {
|
|
54
|
+
var prefixes = (0, _react.useContext)(ThemeContext);
|
|
55
|
+
return prefix || prefixes.get(defaultPrefix) || defaultPrefix;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function createBootstrapComponent(Component, opts) {
|
|
59
|
+
if (typeof opts === 'string') opts = {
|
|
60
|
+
prefix: opts
|
|
61
|
+
};
|
|
62
|
+
var isClassy = Component.prototype && Component.prototype.isReactComponent; // If it's a functional component make sure we don't break it with a ref
|
|
63
|
+
|
|
64
|
+
var _opts = opts,
|
|
65
|
+
prefix = _opts.prefix,
|
|
66
|
+
_opts$forwardRefAs = _opts.forwardRefAs,
|
|
67
|
+
forwardRefAs = _opts$forwardRefAs === void 0 ? isClassy ? 'ref' : 'innerRef' : _opts$forwardRefAs;
|
|
68
|
+
return (0, _forwardRef.default)(function (_ref, ref) {
|
|
69
|
+
var props = (0, _extends2.default)({}, _ref);
|
|
70
|
+
props[forwardRefAs] = ref;
|
|
71
|
+
var prefixes = (0, _react.useContext)(ThemeContext);
|
|
72
|
+
return _react.default.createElement(Component, (0, _extends2.default)({}, props, {
|
|
73
|
+
// eslint-disable-next-line react/prop-types
|
|
74
|
+
bsPrefix: props.bsPrefix || prefixes.get(prefix) || prefix
|
|
75
|
+
}));
|
|
76
|
+
}, {
|
|
77
|
+
displayName: "Bootstrap(" + (Component.displayName || Component.name) + ")"
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
var _default = ThemeProvider;
|
|
82
|
+
exports.default = _default;
|
package/Toast.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import ToastBody from './ToastBody';
|
|
4
|
+
import ToastHeader from './ToastHeader';
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
BsPrefixComponent,
|
|
8
|
+
TransitionCallbacks,
|
|
9
|
+
} from './helpers';
|
|
10
|
+
|
|
11
|
+
export interface ToastProps extends TransitionCallbacks {
|
|
12
|
+
animation?: boolean;
|
|
13
|
+
autohide?: boolean;
|
|
14
|
+
delay?: number;
|
|
15
|
+
onClose?: () => void;
|
|
16
|
+
show: boolean;
|
|
17
|
+
transition: boolean | React.ElementType,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
declare class Toast extends BsPrefixComponent<'div', ToastProps> {
|
|
21
|
+
static Body: typeof ToastBody;
|
|
22
|
+
static Header: typeof ToastHeader;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default Toast;
|
package/Toast.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
+
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
+
|
|
7
|
+
exports.__esModule = true;
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
|
|
12
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
+
|
|
16
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
|
+
|
|
18
|
+
var _Fade = _interopRequireDefault(require("./Fade"));
|
|
19
|
+
|
|
20
|
+
var _ToastHeader = _interopRequireDefault(require("./ToastHeader"));
|
|
21
|
+
|
|
22
|
+
var _ToastBody = _interopRequireDefault(require("./ToastBody"));
|
|
23
|
+
|
|
24
|
+
var _ThemeProvider = require("./ThemeProvider");
|
|
25
|
+
|
|
26
|
+
var _ToastContext = _interopRequireDefault(require("./ToastContext"));
|
|
27
|
+
|
|
28
|
+
var defaultProps = {
|
|
29
|
+
animation: true,
|
|
30
|
+
autohide: false,
|
|
31
|
+
delay: 3000,
|
|
32
|
+
show: true,
|
|
33
|
+
transition: _Fade.default
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
var Toast = function Toast(_ref) {
|
|
37
|
+
var bsPrefix = _ref.bsPrefix,
|
|
38
|
+
className = _ref.className,
|
|
39
|
+
children = _ref.children,
|
|
40
|
+
Transition = _ref.transition,
|
|
41
|
+
show = _ref.show,
|
|
42
|
+
animation = _ref.animation,
|
|
43
|
+
delay = _ref.delay,
|
|
44
|
+
autohide = _ref.autohide,
|
|
45
|
+
onClose = _ref.onClose,
|
|
46
|
+
innerRef = _ref.innerRef,
|
|
47
|
+
props = (0, _objectWithoutPropertiesLoose2.default)(_ref, ["bsPrefix", "className", "children", "transition", "show", "animation", "delay", "autohide", "onClose", "innerRef"]);
|
|
48
|
+
var delayRef = (0, _react.useRef)(delay);
|
|
49
|
+
var onCloseRef = (0, _react.useRef)(onClose); // We use refs for these, because we don't want to restart the autohide
|
|
50
|
+
// timer in case these values change.
|
|
51
|
+
|
|
52
|
+
delayRef.current = delay;
|
|
53
|
+
onCloseRef.current = onClose;
|
|
54
|
+
(0, _react.useEffect)(function () {
|
|
55
|
+
if (!(autohide && show)) {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
var autohideHandle = setTimeout(function () {
|
|
60
|
+
onCloseRef.current();
|
|
61
|
+
}, delayRef.current);
|
|
62
|
+
return function () {
|
|
63
|
+
clearTimeout(autohideHandle);
|
|
64
|
+
};
|
|
65
|
+
}, [autohide, show]);
|
|
66
|
+
var useAnimation = Transition && animation;
|
|
67
|
+
|
|
68
|
+
var toast = _react.default.createElement("div", (0, _extends2.default)({}, props, {
|
|
69
|
+
ref: innerRef,
|
|
70
|
+
className: (0, _classnames.default)(bsPrefix, className, !useAnimation && show && 'show'),
|
|
71
|
+
role: "alert",
|
|
72
|
+
"aria-live": "assertive",
|
|
73
|
+
"aria-atomic": "true"
|
|
74
|
+
}), children);
|
|
75
|
+
|
|
76
|
+
var toastContext = {
|
|
77
|
+
onClose: onClose
|
|
78
|
+
};
|
|
79
|
+
return _react.default.createElement(_ToastContext.default.Provider, {
|
|
80
|
+
value: toastContext
|
|
81
|
+
}, useAnimation ? _react.default.createElement(Transition, {
|
|
82
|
+
in: show
|
|
83
|
+
}, toast) : toast);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
Toast.defaultProps = defaultProps;
|
|
87
|
+
var DecoratedToast = (0, _ThemeProvider.createBootstrapComponent)(Toast, 'toast');
|
|
88
|
+
DecoratedToast.Body = _ToastBody.default;
|
|
89
|
+
DecoratedToast.Header = _ToastHeader.default;
|
|
90
|
+
var _default = DecoratedToast;
|
|
91
|
+
exports.default = _default;
|
|
92
|
+
module.exports = exports["default"];
|
package/ToastBody.d.ts
ADDED
package/ToastBody.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _createWithBsPrefix = _interopRequireDefault(require("./utils/createWithBsPrefix"));
|
|
9
|
+
|
|
10
|
+
var _default = (0, _createWithBsPrefix.default)('toast-body');
|
|
11
|
+
|
|
12
|
+
exports.default = _default;
|
|
13
|
+
module.exports = exports["default"];
|
package/ToastContext.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var ToastContext = _react.default.createContext({
|
|
11
|
+
onClose: function onClose() {}
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
var _default = ToastContext;
|
|
15
|
+
exports.default = _default;
|
|
16
|
+
module.exports = exports["default"];
|
package/ToastHeader.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { BsPrefixComponent } from './helpers';
|
|
4
|
+
|
|
5
|
+
export interface ToastHeaderProps {
|
|
6
|
+
closeLabel?: string;
|
|
7
|
+
closeButton?: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
declare class ToastHeader<
|
|
11
|
+
As extends React.ReactType = 'div'
|
|
12
|
+
> extends BsPrefixComponent<As, ToastHeaderProps> { }
|
|
13
|
+
|
|
14
|
+
export default ToastHeader;
|