@collana-solutions/reactstrap 0.0.0-stage → 10.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/LICENSE +21 -0
- package/README.md +177 -2
- package/esm/Accordion.js +53 -0
- package/esm/AccordionBody.js +45 -0
- package/esm/AccordionContext.js +10 -0
- package/esm/AccordionHeader.js +50 -0
- package/esm/AccordionItem.js +33 -0
- package/esm/Alert.js +85 -0
- package/esm/Badge.js +45 -0
- package/esm/Breadcrumb.js +47 -0
- package/esm/BreadcrumbItem.js +33 -0
- package/esm/Button.js +83 -0
- package/esm/ButtonDropdown.js +14 -0
- package/esm/ButtonGroup.js +47 -0
- package/esm/ButtonToggle.js +66 -0
- package/esm/ButtonToolbar.js +41 -0
- package/esm/Card.js +44 -0
- package/esm/CardBody.js +32 -0
- package/esm/CardColumns.js +26 -0
- package/esm/CardDeck.js +26 -0
- package/esm/CardFooter.js +29 -0
- package/esm/CardGroup.js +26 -0
- package/esm/CardHeader.js +29 -0
- package/esm/CardImg.js +42 -0
- package/esm/CardImgOverlay.js +26 -0
- package/esm/CardLink.js +29 -0
- package/esm/CardSubtitle.js +29 -0
- package/esm/CardText.js +29 -0
- package/esm/CardTitle.js +29 -0
- package/esm/Carousel.js +336 -0
- package/esm/CarouselCaption.js +25 -0
- package/esm/CarouselContext.js +9 -0
- package/esm/CarouselControl.js +56 -0
- package/esm/CarouselIndicators.js +49 -0
- package/esm/CarouselItem.js +147 -0
- package/esm/CloseButton.js +44 -0
- package/esm/Col.js +87 -0
- package/esm/Collapse.js +171 -0
- package/esm/Container.js +34 -0
- package/esm/Dropdown.js +364 -0
- package/esm/DropdownContext.js +13 -0
- package/esm/DropdownItem.js +136 -0
- package/esm/DropdownMenu.js +169 -0
- package/esm/DropdownToggle.js +144 -0
- package/esm/Fade.js +64 -0
- package/esm/Form.js +74 -0
- package/esm/FormFeedback.js +33 -0
- package/esm/FormGroup.js +45 -0
- package/esm/FormText.js +32 -0
- package/esm/Input.js +124 -0
- package/esm/InputGroup.js +45 -0
- package/esm/InputGroupContext.js +2 -0
- package/esm/InputGroupText.js +29 -0
- package/esm/Label.js +87 -0
- package/esm/List.js +34 -0
- package/esm/ListGroup.js +54 -0
- package/esm/ListGroupItem.js +49 -0
- package/esm/ListGroupItemHeading.js +29 -0
- package/esm/ListGroupItemText.js +29 -0
- package/esm/ListInlineItem.js +31 -0
- package/esm/Media.js +68 -0
- package/esm/Modal.js +499 -0
- package/esm/ModalBody.js +29 -0
- package/esm/ModalFooter.js +29 -0
- package/esm/ModalHeader.js +54 -0
- package/esm/Nav.js +70 -0
- package/esm/NavItem.js +32 -0
- package/esm/NavLink.js +87 -0
- package/esm/Navbar.js +75 -0
- package/esm/NavbarBrand.js +29 -0
- package/esm/NavbarText.js +31 -0
- package/esm/NavbarToggler.js +45 -0
- package/esm/Offcanvas.js +425 -0
- package/esm/OffcanvasBody.js +26 -0
- package/esm/OffcanvasHeader.js +49 -0
- package/esm/Pagination.js +51 -0
- package/esm/PaginationItem.js +39 -0
- package/esm/PaginationLink.js +81 -0
- package/esm/Placeholder.js +48 -0
- package/esm/PlaceholderButton.js +43 -0
- package/esm/Popover.js +23 -0
- package/esm/PopoverBody.js +26 -0
- package/esm/PopoverHeader.js +26 -0
- package/esm/PopperContent.js +232 -0
- package/esm/PopperTargetHelper.js +13 -0
- package/esm/Portal.js +53 -0
- package/esm/Progress.js +93 -0
- package/esm/Row.js +49 -0
- package/esm/Spinner.js +47 -0
- package/esm/TabContent.js +70 -0
- package/esm/TabContext.js +9 -0
- package/esm/TabPane.js +35 -0
- package/esm/Table.js +63 -0
- package/esm/Toast.js +56 -0
- package/esm/ToastBody.js +29 -0
- package/esm/ToastHeader.js +75 -0
- package/esm/Tooltip.js +24 -0
- package/esm/TooltipPopoverWrapper.js +392 -0
- package/esm/UncontrolledAccordion.js +65 -0
- package/esm/UncontrolledAlert.js +50 -0
- package/esm/UncontrolledButtonDropdown.js +59 -0
- package/esm/UncontrolledCarousel.js +150 -0
- package/esm/UncontrolledCollapse.js +84 -0
- package/esm/UncontrolledDropdown.js +65 -0
- package/esm/UncontrolledPopover.js +59 -0
- package/esm/UncontrolledTooltip.js +59 -0
- package/esm/__tests__/Accordion.spec.js +160 -0
- package/esm/__tests__/AccordionBody.spec.js +42 -0
- package/esm/__tests__/AccordionHeader.spec.js +77 -0
- package/esm/__tests__/AccordionItem.spec.js +19 -0
- package/esm/__tests__/Alert.spec.js +139 -0
- package/esm/__tests__/Badge.spec.js +39 -0
- package/esm/__tests__/Breadcrumb.spec.js +25 -0
- package/esm/__tests__/BreadcrumbList.spec.js +29 -0
- package/esm/__tests__/Button.spec.js +161 -0
- package/esm/__tests__/ButtonDropdown.spec.js +27 -0
- package/esm/__tests__/ButtonGroup.spec.js +27 -0
- package/esm/__tests__/ButtonToggle.spec.js +94 -0
- package/esm/__tests__/ButtonToolbar.spec.js +13 -0
- package/esm/__tests__/Card.spec.js +38 -0
- package/esm/__tests__/CardBody.spec.js +13 -0
- package/esm/__tests__/CardColumns.spec.js +13 -0
- package/esm/__tests__/CardDeck.spec.js +13 -0
- package/esm/__tests__/CardFooter.spec.js +13 -0
- package/esm/__tests__/CardGroup.spec.js +13 -0
- package/esm/__tests__/CardHeader.spec.js +13 -0
- package/esm/__tests__/CardImg.spec.js +31 -0
- package/esm/__tests__/CardImgOverlay.spec.js +13 -0
- package/esm/__tests__/CardLink.spec.js +13 -0
- package/esm/__tests__/CardSubtitle.spec.js +16 -0
- package/esm/__tests__/CardText.spec.js +13 -0
- package/esm/__tests__/CardTitle.spec.js +16 -0
- package/esm/__tests__/Carousel.spec.js +639 -0
- package/esm/__tests__/CloseButton.spec.js +103 -0
- package/esm/__tests__/Col.spec.js +122 -0
- package/esm/__tests__/Collapse.spec.js +149 -0
- package/esm/__tests__/Container.spec.js +37 -0
- package/esm/__tests__/Dropdown.spec.js +1659 -0
- package/esm/__tests__/DropdownItem.spec.js +213 -0
- package/esm/__tests__/DropdownMenu.spec.js +147 -0
- package/esm/__tests__/DropdownToggle.spec.js +177 -0
- package/esm/__tests__/Fade.spec.js +174 -0
- package/esm/__tests__/Form.spec.js +16 -0
- package/esm/__tests__/FormFeedback.spec.js +34 -0
- package/esm/__tests__/FormGroup.spec.js +135 -0
- package/esm/__tests__/FormText.spec.js +44 -0
- package/esm/__tests__/Input.spec.js +318 -0
- package/esm/__tests__/InputGroup.spec.js +80 -0
- package/esm/__tests__/InputGroupText.spec.js +16 -0
- package/esm/__tests__/Label.spec.js +173 -0
- package/esm/__tests__/List.spec.js +27 -0
- package/esm/__tests__/ListGroup.spec.js +50 -0
- package/esm/__tests__/ListGroupItem.spec.js +46 -0
- package/esm/__tests__/ListGroupItemHeading.spec.js +10 -0
- package/esm/__tests__/ListGroupItemText.spec.js +10 -0
- package/esm/__tests__/ListInlineItem.spec.js +16 -0
- package/esm/__tests__/Media.spec.js +129 -0
- package/esm/__tests__/Modal.spec.js +1051 -0
- package/esm/__tests__/ModalBody.spec.js +13 -0
- package/esm/__tests__/ModalFooter.spec.js +13 -0
- package/esm/__tests__/ModalHeader.spec.js +36 -0
- package/esm/__tests__/Nav.spec.js +91 -0
- package/esm/__tests__/NavBrand.spec.js +18 -0
- package/esm/__tests__/NavItem.spec.js +25 -0
- package/esm/__tests__/NavLink.spec.js +102 -0
- package/esm/__tests__/Navbar.spec.js +101 -0
- package/esm/__tests__/NavbarText.spec.js +16 -0
- package/esm/__tests__/NavbarToggler.spec.js +16 -0
- package/esm/__tests__/Offcanvas.spec.js +781 -0
- package/esm/__tests__/OffcanvasBody.spec.js +13 -0
- package/esm/__tests__/OffcanvasHeader.spec.js +34 -0
- package/esm/__tests__/Pagination.spec.js +48 -0
- package/esm/__tests__/PaginationItem.spec.js +27 -0
- package/esm/__tests__/PaginationLink.spec.js +111 -0
- package/esm/__tests__/Placeholder.spec.js +79 -0
- package/esm/__tests__/PlaceholderButton.spec.js +19 -0
- package/esm/__tests__/Popover.spec.js +32 -0
- package/esm/__tests__/PopoverBody.spec.js +8 -0
- package/esm/__tests__/PopoverHeader.spec.js +8 -0
- package/esm/__tests__/PopperContent.spec.js +172 -0
- package/esm/__tests__/Progress.spec.js +220 -0
- package/esm/__tests__/Row.spec.js +37 -0
- package/esm/__tests__/Spinner.spec.js +48 -0
- package/esm/__tests__/Table.spec.js +70 -0
- package/esm/__tests__/Tabs.spec.js +75 -0
- package/esm/__tests__/Toast.spec.js +43 -0
- package/esm/__tests__/ToastBody.spec.js +13 -0
- package/esm/__tests__/ToastHeader.spec.js +30 -0
- package/esm/__tests__/Tooltip.spec.js +32 -0
- package/esm/__tests__/TooltipPopoverWrapper.spec.js +623 -0
- package/esm/__tests__/Uncontrolled.spec.js +418 -0
- package/esm/__tests__/UncontrolledAccordion.spec.js +116 -0
- package/esm/__tests__/UncontrolledCarousel.spec.js +235 -0
- package/esm/__tests__/UncontrolledCollapse.spec.js +98 -0
- package/esm/__tests__/utils.spec.js +389 -0
- package/esm/index.js +200 -0
- package/esm/polyfill.js +24 -0
- package/esm/testUtils.js +58 -0
- package/esm/utils.js +284 -0
- package/lib/Accordion.js +60 -0
- package/lib/AccordionBody.js +55 -0
- package/lib/AccordionContext.js +16 -0
- package/lib/AccordionHeader.js +58 -0
- package/lib/AccordionItem.js +41 -0
- package/lib/Alert.js +87 -0
- package/lib/Badge.js +51 -0
- package/lib/Breadcrumb.js +53 -0
- package/lib/BreadcrumbItem.js +41 -0
- package/lib/Button.js +91 -0
- package/lib/ButtonDropdown.js +21 -0
- package/lib/ButtonGroup.js +54 -0
- package/lib/ButtonToggle.js +63 -0
- package/lib/ButtonToolbar.js +48 -0
- package/lib/Card.js +52 -0
- package/lib/CardBody.js +40 -0
- package/lib/CardColumns.js +34 -0
- package/lib/CardDeck.js +34 -0
- package/lib/CardFooter.js +37 -0
- package/lib/CardGroup.js +34 -0
- package/lib/CardHeader.js +37 -0
- package/lib/CardImg.js +50 -0
- package/lib/CardImgOverlay.js +34 -0
- package/lib/CardLink.js +37 -0
- package/lib/CardSubtitle.js +37 -0
- package/lib/CardText.js +37 -0
- package/lib/CardTitle.js +37 -0
- package/lib/Carousel.js +273 -0
- package/lib/CarouselCaption.js +34 -0
- package/lib/CarouselContext.js +15 -0
- package/lib/CarouselControl.js +65 -0
- package/lib/CarouselIndicators.js +58 -0
- package/lib/CarouselItem.js +127 -0
- package/lib/CloseButton.js +52 -0
- package/lib/Col.js +94 -0
- package/lib/Collapse.js +154 -0
- package/lib/Container.js +42 -0
- package/lib/Dropdown.js +308 -0
- package/lib/DropdownContext.js +19 -0
- package/lib/DropdownItem.js +117 -0
- package/lib/DropdownMenu.js +148 -0
- package/lib/DropdownToggle.js +129 -0
- package/lib/Fade.js +69 -0
- package/lib/Form.js +57 -0
- package/lib/FormFeedback.js +40 -0
- package/lib/FormGroup.js +53 -0
- package/lib/FormText.js +39 -0
- package/lib/Input.js +105 -0
- package/lib/InputGroup.js +53 -0
- package/lib/InputGroupContext.js +9 -0
- package/lib/InputGroupText.js +37 -0
- package/lib/Label.js +93 -0
- package/lib/List.js +43 -0
- package/lib/ListGroup.js +60 -0
- package/lib/ListGroupItem.js +57 -0
- package/lib/ListGroupItemHeading.js +37 -0
- package/lib/ListGroupItemText.js +37 -0
- package/lib/ListInlineItem.js +40 -0
- package/lib/Media.js +77 -0
- package/lib/Modal.js +457 -0
- package/lib/ModalBody.js +37 -0
- package/lib/ModalFooter.js +37 -0
- package/lib/ModalHeader.js +60 -0
- package/lib/Nav.js +77 -0
- package/lib/NavItem.js +40 -0
- package/lib/NavLink.js +71 -0
- package/lib/Navbar.js +79 -0
- package/lib/NavbarBrand.js +37 -0
- package/lib/NavbarText.js +39 -0
- package/lib/NavbarToggler.js +52 -0
- package/lib/Offcanvas.js +383 -0
- package/lib/OffcanvasBody.js +34 -0
- package/lib/OffcanvasHeader.js +55 -0
- package/lib/Pagination.js +55 -0
- package/lib/PaginationItem.js +47 -0
- package/lib/PaginationLink.js +91 -0
- package/lib/Placeholder.js +57 -0
- package/lib/PlaceholderButton.js +51 -0
- package/lib/Popover.js +31 -0
- package/lib/PopoverBody.js +34 -0
- package/lib/PopoverHeader.js +34 -0
- package/lib/PopperContent.js +194 -0
- package/lib/PopperTargetHelper.js +20 -0
- package/lib/Portal.js +35 -0
- package/lib/Progress.js +95 -0
- package/lib/Row.js +56 -0
- package/lib/Spinner.js +53 -0
- package/lib/TabContent.js +54 -0
- package/lib/TabContext.js +15 -0
- package/lib/TabPane.js +40 -0
- package/lib/Table.js +70 -0
- package/lib/Toast.js +60 -0
- package/lib/ToastBody.js +37 -0
- package/lib/ToastHeader.js +80 -0
- package/lib/Tooltip.js +32 -0
- package/lib/TooltipPopoverWrapper.js +333 -0
- package/lib/UncontrolledAccordion.js +59 -0
- package/lib/UncontrolledAlert.js +32 -0
- package/lib/UncontrolledButtonDropdown.js +43 -0
- package/lib/UncontrolledCarousel.js +124 -0
- package/lib/UncontrolledCollapse.js +63 -0
- package/lib/UncontrolledDropdown.js +48 -0
- package/lib/UncontrolledPopover.js +43 -0
- package/lib/UncontrolledTooltip.js +43 -0
- package/lib/index.js +706 -0
- package/lib/polyfill.js +21 -0
- package/lib/testUtils.js +68 -0
- package/lib/utils.js +314 -0
- package/package.json +328 -3
- package/src/Accordion.js +60 -0
- package/src/AccordionBody.js +60 -0
- package/src/AccordionContext.js +10 -0
- package/src/AccordionHeader.js +65 -0
- package/src/AccordionItem.js +39 -0
- package/src/Alert.js +101 -0
- package/src/Badge.js +56 -0
- package/src/Breadcrumb.js +51 -0
- package/src/BreadcrumbItem.js +41 -0
- package/src/Button.js +106 -0
- package/src/ButtonDropdown.js +15 -0
- package/src/ButtonGroup.js +47 -0
- package/src/ButtonToggle.js +73 -0
- package/src/ButtonToolbar.js +32 -0
- package/src/Card.js +56 -0
- package/src/CardBody.js +38 -0
- package/src/CardColumns.js +24 -0
- package/src/CardDeck.js +24 -0
- package/src/CardFooter.js +27 -0
- package/src/CardGroup.js +24 -0
- package/src/CardHeader.js +27 -0
- package/src/CardImg.js +47 -0
- package/src/CardImgOverlay.js +24 -0
- package/src/CardLink.js +35 -0
- package/src/CardSubtitle.js +27 -0
- package/src/CardText.js +27 -0
- package/src/CardTitle.js +27 -0
- package/src/Carousel.js +323 -0
- package/src/CarouselCaption.js +32 -0
- package/src/CarouselContext.js +9 -0
- package/src/CarouselControl.js +66 -0
- package/src/CarouselIndicators.js +60 -0
- package/src/CarouselItem.js +139 -0
- package/src/CloseButton.js +43 -0
- package/src/Col.js +120 -0
- package/src/Collapse.js +175 -0
- package/src/Container.js +39 -0
- package/src/Dropdown.js +408 -0
- package/src/DropdownContext.js +13 -0
- package/src/DropdownItem.js +119 -0
- package/src/DropdownMenu.js +162 -0
- package/src/DropdownToggle.js +137 -0
- package/src/Fade.js +83 -0
- package/src/Form.js +53 -0
- package/src/FormFeedback.js +40 -0
- package/src/FormGroup.js +60 -0
- package/src/FormText.js +39 -0
- package/src/Input.js +142 -0
- package/src/InputGroup.js +47 -0
- package/src/InputGroupContext.js +3 -0
- package/src/InputGroupText.js +28 -0
- package/src/Label.js +123 -0
- package/src/List.js +30 -0
- package/src/ListGroup.js +60 -0
- package/src/ListGroupItem.js +59 -0
- package/src/ListGroupItemHeading.js +27 -0
- package/src/ListGroupItemText.js +27 -0
- package/src/ListInlineItem.js +28 -0
- package/src/Media.js +83 -0
- package/src/Modal.js +578 -0
- package/src/ModalBody.js +27 -0
- package/src/ModalFooter.js +27 -0
- package/src/ModalHeader.js +64 -0
- package/src/Nav.js +81 -0
- package/src/NavItem.js +36 -0
- package/src/NavLink.js +80 -0
- package/src/Navbar.js +81 -0
- package/src/NavbarBrand.js +28 -0
- package/src/NavbarText.js +35 -0
- package/src/NavbarToggler.js +47 -0
- package/src/Offcanvas.js +473 -0
- package/src/OffcanvasBody.js +24 -0
- package/src/OffcanvasHeader.js +59 -0
- package/src/Pagination.js +53 -0
- package/src/PaginationItem.js +43 -0
- package/src/PaginationLink.js +95 -0
- package/src/Placeholder.js +59 -0
- package/src/PlaceholderButton.js +35 -0
- package/src/Popover.js +30 -0
- package/src/PopoverBody.js +25 -0
- package/src/PopoverHeader.js +25 -0
- package/src/PopperContent.js +238 -0
- package/src/PopperTargetHelper.js +17 -0
- package/src/Portal.js +38 -0
- package/src/Progress.js +104 -0
- package/src/Row.js +66 -0
- package/src/Spinner.js +67 -0
- package/src/TabContent.js +51 -0
- package/src/TabContext.js +9 -0
- package/src/TabPane.js +35 -0
- package/src/Table.js +86 -0
- package/src/Toast.js +64 -0
- package/src/ToastBody.js +35 -0
- package/src/ToastHeader.js +89 -0
- package/src/Tooltip.js +32 -0
- package/src/TooltipPopoverWrapper.js +403 -0
- package/src/UncontrolledAccordion.js +43 -0
- package/src/UncontrolledAlert.js +23 -0
- package/src/UncontrolledButtonDropdown.js +34 -0
- package/src/UncontrolledCarousel.js +134 -0
- package/src/UncontrolledCollapse.js +69 -0
- package/src/UncontrolledDropdown.js +42 -0
- package/src/UncontrolledPopover.js +34 -0
- package/src/UncontrolledTooltip.js +34 -0
- package/src/__tests__/.eslintrc +26 -0
- package/src/__tests__/Accordion.spec.js +148 -0
- package/src/__tests__/AccordionBody.spec.js +52 -0
- package/src/__tests__/AccordionHeader.spec.js +60 -0
- package/src/__tests__/AccordionItem.spec.js +21 -0
- package/src/__tests__/Alert.spec.js +145 -0
- package/src/__tests__/Badge.spec.js +54 -0
- package/src/__tests__/Breadcrumb.spec.js +32 -0
- package/src/__tests__/BreadcrumbList.spec.js +38 -0
- package/src/__tests__/Button.spec.js +129 -0
- package/src/__tests__/ButtonDropdown.spec.js +38 -0
- package/src/__tests__/ButtonGroup.spec.js +32 -0
- package/src/__tests__/ButtonToggle.spec.js +59 -0
- package/src/__tests__/ButtonToolbar.spec.js +20 -0
- package/src/__tests__/Card.spec.js +56 -0
- package/src/__tests__/CardBody.spec.js +20 -0
- package/src/__tests__/CardColumns.spec.js +20 -0
- package/src/__tests__/CardDeck.spec.js +20 -0
- package/src/__tests__/CardFooter.spec.js +20 -0
- package/src/__tests__/CardGroup.spec.js +20 -0
- package/src/__tests__/CardHeader.spec.js +20 -0
- package/src/__tests__/CardImg.spec.js +36 -0
- package/src/__tests__/CardImgOverlay.spec.js +20 -0
- package/src/__tests__/CardLink.spec.js +20 -0
- package/src/__tests__/CardSubtitle.spec.js +25 -0
- package/src/__tests__/CardText.spec.js +20 -0
- package/src/__tests__/CardTitle.spec.js +25 -0
- package/src/__tests__/Carousel.spec.js +769 -0
- package/src/__tests__/CloseButton.spec.js +46 -0
- package/src/__tests__/Col.spec.js +102 -0
- package/src/__tests__/Collapse.spec.js +124 -0
- package/src/__tests__/Container.spec.js +39 -0
- package/src/__tests__/Dropdown.spec.js +1185 -0
- package/src/__tests__/DropdownItem.spec.js +142 -0
- package/src/__tests__/DropdownMenu.spec.js +215 -0
- package/src/__tests__/DropdownToggle.spec.js +177 -0
- package/src/__tests__/Fade.spec.js +130 -0
- package/src/__tests__/Form.spec.js +25 -0
- package/src/__tests__/FormFeedback.spec.js +48 -0
- package/src/__tests__/FormGroup.spec.js +158 -0
- package/src/__tests__/FormText.spec.js +57 -0
- package/src/__tests__/Input.spec.js +250 -0
- package/src/__tests__/InputGroup.spec.js +73 -0
- package/src/__tests__/InputGroupText.spec.js +25 -0
- package/src/__tests__/Label.spec.js +148 -0
- package/src/__tests__/List.spec.js +34 -0
- package/src/__tests__/ListGroup.spec.js +60 -0
- package/src/__tests__/ListGroupItem.spec.js +47 -0
- package/src/__tests__/ListGroupItemHeading.spec.js +12 -0
- package/src/__tests__/ListGroupItemText.spec.js +16 -0
- package/src/__tests__/ListInlineItem.spec.js +25 -0
- package/src/__tests__/Media.spec.js +121 -0
- package/src/__tests__/Modal.spec.js +1137 -0
- package/src/__tests__/ModalBody.spec.js +20 -0
- package/src/__tests__/ModalFooter.spec.js +20 -0
- package/src/__tests__/ModalHeader.spec.js +36 -0
- package/src/__tests__/Nav.spec.js +84 -0
- package/src/__tests__/NavBrand.spec.js +27 -0
- package/src/__tests__/NavItem.spec.js +32 -0
- package/src/__tests__/NavLink.spec.js +76 -0
- package/src/__tests__/Navbar.spec.js +109 -0
- package/src/__tests__/NavbarText.spec.js +25 -0
- package/src/__tests__/NavbarToggler.spec.js +25 -0
- package/src/__tests__/Offcanvas.spec.js +840 -0
- package/src/__tests__/OffcanvasBody.spec.js +20 -0
- package/src/__tests__/OffcanvasHeader.spec.js +35 -0
- package/src/__tests__/Pagination.spec.js +47 -0
- package/src/__tests__/PaginationItem.spec.js +32 -0
- package/src/__tests__/PaginationLink.spec.js +114 -0
- package/src/__tests__/Placeholder.spec.js +67 -0
- package/src/__tests__/PlaceholderButton.spec.js +16 -0
- package/src/__tests__/Popover.spec.js +39 -0
- package/src/__tests__/PopoverBody.spec.js +9 -0
- package/src/__tests__/PopoverHeader.spec.js +9 -0
- package/src/__tests__/PopperContent.spec.js +246 -0
- package/src/__tests__/Progress.spec.js +233 -0
- package/src/__tests__/Row.spec.js +38 -0
- package/src/__tests__/Spinner.spec.js +53 -0
- package/src/__tests__/Table.spec.js +68 -0
- package/src/__tests__/Tabs.spec.js +77 -0
- package/src/__tests__/Toast.spec.js +58 -0
- package/src/__tests__/ToastBody.spec.js +20 -0
- package/src/__tests__/ToastHeader.spec.js +30 -0
- package/src/__tests__/Tooltip.spec.js +38 -0
- package/src/__tests__/TooltipPopoverWrapper.spec.js +777 -0
- package/src/__tests__/Uncontrolled.spec.js +298 -0
- package/src/__tests__/UncontrolledAccordion.spec.js +120 -0
- package/src/__tests__/UncontrolledCarousel.spec.js +136 -0
- package/src/__tests__/UncontrolledCollapse.spec.js +74 -0
- package/src/__tests__/utils.spec.js +399 -0
- package/src/index.js +101 -0
- package/src/polyfill.js +26 -0
- package/src/testUtils.js +50 -0
- package/src/utils.js +403 -0
- package/types/index.d.ts +195 -0
- package/types/lib/Accordion.d.ts +19 -0
- package/types/lib/AccordionBody.d.ts +12 -0
- package/types/lib/AccordionHeader.d.ts +12 -0
- package/types/lib/AccordionItem.d.ts +11 -0
- package/types/lib/Alert.d.ts +23 -0
- package/types/lib/Badge.d.ts +14 -0
- package/types/lib/Breadcrumb.d.ts +13 -0
- package/types/lib/BreadcrumbItem.d.ts +12 -0
- package/types/lib/Button.d.ts +19 -0
- package/types/lib/ButtonDropdown.d.ts +9 -0
- package/types/lib/ButtonGroup.d.ts +13 -0
- package/types/lib/ButtonToggle.d.ts +12 -0
- package/types/lib/ButtonToolbar.d.ts +11 -0
- package/types/lib/Card.d.ts +16 -0
- package/types/lib/CardBody.d.ts +12 -0
- package/types/lib/CardColumns.d.ts +11 -0
- package/types/lib/CardDeck.d.ts +11 -0
- package/types/lib/CardFooter.d.ts +11 -0
- package/types/lib/CardGroup.d.ts +11 -0
- package/types/lib/CardHeader.d.ts +11 -0
- package/types/lib/CardImg.d.ts +14 -0
- package/types/lib/CardImgOverlay.d.ts +11 -0
- package/types/lib/CardLink.d.ts +13 -0
- package/types/lib/CardSubtitle.d.ts +11 -0
- package/types/lib/CardText.d.ts +11 -0
- package/types/lib/CardTitle.d.ts +11 -0
- package/types/lib/Carousel.d.ts +35 -0
- package/types/lib/CarouselCaption.d.ts +13 -0
- package/types/lib/CarouselControl.d.ts +15 -0
- package/types/lib/CarouselIndicators.d.ts +16 -0
- package/types/lib/CarouselItem.d.ts +19 -0
- package/types/lib/CloseButton.d.ts +12 -0
- package/types/lib/Col.d.ts +30 -0
- package/types/lib/Collapse.d.ts +32 -0
- package/types/lib/Container.d.ts +12 -0
- package/types/lib/Dropdown.d.ts +35 -0
- package/types/lib/DropdownItem.d.ts +18 -0
- package/types/lib/DropdownMenu.d.ts +20 -0
- package/types/lib/DropdownToggle.d.ts +20 -0
- package/types/lib/Fade.d.ts +23 -0
- package/types/lib/Form.d.ts +12 -0
- package/types/lib/FormFeedback.d.ts +13 -0
- package/types/lib/FormGroup.d.ts +19 -0
- package/types/lib/FormText.d.ts +13 -0
- package/types/lib/Input.d.ts +47 -0
- package/types/lib/InputGroup.d.ts +12 -0
- package/types/lib/InputGroupText.d.ts +11 -0
- package/types/lib/Label.d.ts +27 -0
- package/types/lib/List.d.ts +12 -0
- package/types/lib/ListGroup.d.ts +14 -0
- package/types/lib/ListGroupItem.d.ts +16 -0
- package/types/lib/ListGroupItemHeading.d.ts +14 -0
- package/types/lib/ListGroupItemText.d.ts +14 -0
- package/types/lib/ListInlineItem.d.ts +11 -0
- package/types/lib/Media.d.ts +23 -0
- package/types/lib/Modal.d.ts +39 -0
- package/types/lib/ModalBody.d.ts +11 -0
- package/types/lib/ModalFooter.d.ts +11 -0
- package/types/lib/ModalHeader.d.ts +13 -0
- package/types/lib/Nav.d.ts +19 -0
- package/types/lib/NavItem.d.ts +12 -0
- package/types/lib/NavLink.d.ts +15 -0
- package/types/lib/Navbar.d.ts +19 -0
- package/types/lib/NavbarBrand.d.ts +12 -0
- package/types/lib/NavbarText.d.ts +11 -0
- package/types/lib/NavbarToggler.d.ts +12 -0
- package/types/lib/Offcanvas.d.ts +38 -0
- package/types/lib/OffcanvasBody.d.ts +11 -0
- package/types/lib/OffcanvasHeader.d.ts +13 -0
- package/types/lib/Pagination.d.ts +15 -0
- package/types/lib/PaginationItem.d.ts +13 -0
- package/types/lib/PaginationLink.d.ts +17 -0
- package/types/lib/Placeholder.d.ts +17 -0
- package/types/lib/PlaceholderButton.d.ts +14 -0
- package/types/lib/Popover.d.ts +34 -0
- package/types/lib/PopoverBody.d.ts +11 -0
- package/types/lib/PopoverHeader.d.ts +11 -0
- package/types/lib/Progress.d.ts +23 -0
- package/types/lib/Row.d.ts +21 -0
- package/types/lib/Spinner.d.ts +14 -0
- package/types/lib/TabContent.d.ts +12 -0
- package/types/lib/TabPane.d.ts +12 -0
- package/types/lib/Table.d.ts +22 -0
- package/types/lib/Tag.d.ts +13 -0
- package/types/lib/Toast.d.ts +16 -0
- package/types/lib/ToastBody.d.ts +12 -0
- package/types/lib/ToastHeader.d.ts +16 -0
- package/types/lib/Tooltip.d.ts +31 -0
- package/types/lib/Uncontrolled.d.ts +41 -0
- package/types/lib/utils.d.ts +5 -0
- package/types/reactstrap-tests.tsx +5465 -0
- package/types/tsconfig.json +20 -0
- package/types/tslint.json +1 -0
package/lib/Modal.js
ADDED
|
@@ -0,0 +1,457 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
var _Portal = _interopRequireDefault(require("./Portal"));
|
|
11
|
+
var _Fade = _interopRequireDefault(require("./Fade"));
|
|
12
|
+
var _utils = require("./utils");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
17
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
18
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
19
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
20
|
+
function noop() {}
|
|
21
|
+
const FadePropTypes = _propTypes.default.shape(_Fade.default.propTypes);
|
|
22
|
+
const propTypes = {
|
|
23
|
+
/** */
|
|
24
|
+
autoFocus: _propTypes.default.bool,
|
|
25
|
+
/** Add backdrop to modal */
|
|
26
|
+
backdrop: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.oneOf(['static'])]),
|
|
27
|
+
/** add custom classname to backdrop */
|
|
28
|
+
backdropClassName: _propTypes.default.string,
|
|
29
|
+
backdropTransition: FadePropTypes,
|
|
30
|
+
/** Vertically center the modal */
|
|
31
|
+
centered: _propTypes.default.bool,
|
|
32
|
+
/** Add children for the modal to wrap */
|
|
33
|
+
children: _propTypes.default.node,
|
|
34
|
+
/** Add custom className for modal content */
|
|
35
|
+
contentClassName: _propTypes.default.string,
|
|
36
|
+
className: _propTypes.default.string,
|
|
37
|
+
container: _utils.targetPropType,
|
|
38
|
+
cssModule: _propTypes.default.object,
|
|
39
|
+
external: _propTypes.default.node,
|
|
40
|
+
/** Enable/Disable animation */
|
|
41
|
+
fade: _propTypes.default.bool,
|
|
42
|
+
/** Make the modal fullscreen */
|
|
43
|
+
fullscreen: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.oneOf(['sm', 'md', 'lg', 'xl'])]),
|
|
44
|
+
innerRef: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string, _propTypes.default.func]),
|
|
45
|
+
/** The status of the modal, either open or close */
|
|
46
|
+
isOpen: _propTypes.default.bool,
|
|
47
|
+
/** Allow modal to be closed with escape key. */
|
|
48
|
+
keyboard: _propTypes.default.bool,
|
|
49
|
+
/** Identifies the element (or elements) that labels the current element. */
|
|
50
|
+
labelledBy: _propTypes.default.string,
|
|
51
|
+
modalClassName: _propTypes.default.string,
|
|
52
|
+
modalTransition: FadePropTypes,
|
|
53
|
+
/** Function to be triggered on close */
|
|
54
|
+
onClosed: _propTypes.default.func,
|
|
55
|
+
/** Function to be triggered on enter */
|
|
56
|
+
onEnter: _propTypes.default.func,
|
|
57
|
+
/** Function to be triggered on exit */
|
|
58
|
+
onExit: _propTypes.default.func,
|
|
59
|
+
/** Function to be triggered on open */
|
|
60
|
+
onOpened: _propTypes.default.func,
|
|
61
|
+
/** Returns focus to the element that triggered opening of the modal */
|
|
62
|
+
returnFocusAfterClose: _propTypes.default.bool,
|
|
63
|
+
/** Accessibility role */
|
|
64
|
+
role: _propTypes.default.string,
|
|
65
|
+
/** Make the modal scrollable */
|
|
66
|
+
scrollable: _propTypes.default.bool,
|
|
67
|
+
/** Two optional sizes `lg` and `sm` */
|
|
68
|
+
size: _propTypes.default.string,
|
|
69
|
+
/** Function to toggle modal visibility */
|
|
70
|
+
toggle: _propTypes.default.func,
|
|
71
|
+
trapFocus: _propTypes.default.bool,
|
|
72
|
+
/** Unmounts the modal when modal is closed */
|
|
73
|
+
unmountOnClose: _propTypes.default.bool,
|
|
74
|
+
wrapClassName: _propTypes.default.string,
|
|
75
|
+
zIndex: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])
|
|
76
|
+
};
|
|
77
|
+
const propsToOmit = Object.keys(propTypes);
|
|
78
|
+
const defaultProps = {
|
|
79
|
+
isOpen: false,
|
|
80
|
+
autoFocus: true,
|
|
81
|
+
centered: false,
|
|
82
|
+
scrollable: false,
|
|
83
|
+
role: 'dialog',
|
|
84
|
+
backdrop: true,
|
|
85
|
+
keyboard: true,
|
|
86
|
+
zIndex: 1050,
|
|
87
|
+
fade: true,
|
|
88
|
+
onOpened: noop,
|
|
89
|
+
onClosed: noop,
|
|
90
|
+
modalTransition: {
|
|
91
|
+
timeout: _utils.TransitionTimeouts.Modal
|
|
92
|
+
},
|
|
93
|
+
backdropTransition: {
|
|
94
|
+
mountOnEnter: true,
|
|
95
|
+
timeout: _utils.TransitionTimeouts.Fade // uses standard fade transition
|
|
96
|
+
},
|
|
97
|
+
unmountOnClose: true,
|
|
98
|
+
returnFocusAfterClose: true,
|
|
99
|
+
container: 'body',
|
|
100
|
+
trapFocus: false
|
|
101
|
+
};
|
|
102
|
+
class Modal extends _react.default.Component {
|
|
103
|
+
constructor(props) {
|
|
104
|
+
super(props);
|
|
105
|
+
this._element = null;
|
|
106
|
+
this._originalBodyPadding = null;
|
|
107
|
+
this.getFocusableChildren = this.getFocusableChildren.bind(this);
|
|
108
|
+
this.handleBackdropClick = this.handleBackdropClick.bind(this);
|
|
109
|
+
this.handleBackdropMouseDown = this.handleBackdropMouseDown.bind(this);
|
|
110
|
+
this.handleEscape = this.handleEscape.bind(this);
|
|
111
|
+
this.handleStaticBackdropAnimation = this.handleStaticBackdropAnimation.bind(this);
|
|
112
|
+
this.handleTab = this.handleTab.bind(this);
|
|
113
|
+
this.onOpened = this.onOpened.bind(this);
|
|
114
|
+
this.onClosed = this.onClosed.bind(this);
|
|
115
|
+
this.manageFocusAfterClose = this.manageFocusAfterClose.bind(this);
|
|
116
|
+
this.clearBackdropAnimationTimeout = this.clearBackdropAnimationTimeout.bind(this);
|
|
117
|
+
this.trapFocus = this.trapFocus.bind(this);
|
|
118
|
+
this.state = {
|
|
119
|
+
isOpen: false,
|
|
120
|
+
showStaticBackdropAnimation: false
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
componentDidMount() {
|
|
124
|
+
const {
|
|
125
|
+
isOpen,
|
|
126
|
+
autoFocus,
|
|
127
|
+
onEnter
|
|
128
|
+
} = this.props;
|
|
129
|
+
if (isOpen) {
|
|
130
|
+
this.init();
|
|
131
|
+
this.setState({
|
|
132
|
+
isOpen: true
|
|
133
|
+
});
|
|
134
|
+
if (autoFocus) {
|
|
135
|
+
this.setFocus();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if (onEnter) {
|
|
139
|
+
onEnter();
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// traps focus inside the Modal, even if the browser address bar is focused
|
|
143
|
+
document.addEventListener('focus', this.trapFocus, true);
|
|
144
|
+
this._isMounted = true;
|
|
145
|
+
}
|
|
146
|
+
componentDidUpdate(prevProps, prevState) {
|
|
147
|
+
if (this.props.isOpen && !prevProps.isOpen) {
|
|
148
|
+
this.init();
|
|
149
|
+
this.setState({
|
|
150
|
+
isOpen: true
|
|
151
|
+
});
|
|
152
|
+
// let render() renders Modal Dialog first
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// now Modal Dialog is rendered and we can refer this._element and this._dialog
|
|
157
|
+
if (this.props.autoFocus && this.state.isOpen && !prevState.isOpen) {
|
|
158
|
+
this.setFocus();
|
|
159
|
+
}
|
|
160
|
+
if (this._element && prevProps.zIndex !== this.props.zIndex) {
|
|
161
|
+
this._element.style.zIndex = this.props.zIndex;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
componentWillUnmount() {
|
|
165
|
+
this.clearBackdropAnimationTimeout();
|
|
166
|
+
if (this.props.onExit) {
|
|
167
|
+
this.props.onExit();
|
|
168
|
+
}
|
|
169
|
+
if (this._element) {
|
|
170
|
+
this.destroy();
|
|
171
|
+
if (this.props.isOpen || this.state.isOpen) {
|
|
172
|
+
this.close();
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
document.removeEventListener('focus', this.trapFocus, true);
|
|
176
|
+
this._isMounted = false;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// not mouseUp because scrollbar fires it, shouldn't close when user scrolls
|
|
180
|
+
handleBackdropClick(e) {
|
|
181
|
+
if (e.target === this._mouseDownElement) {
|
|
182
|
+
e.stopPropagation();
|
|
183
|
+
const backdrop = this._dialog ? this._dialog.parentNode : null;
|
|
184
|
+
if (backdrop && e.target === backdrop && this.props.backdrop === 'static') {
|
|
185
|
+
this.handleStaticBackdropAnimation();
|
|
186
|
+
}
|
|
187
|
+
if (!this.props.isOpen || this.props.backdrop !== true) return;
|
|
188
|
+
if (backdrop && e.target === backdrop && this.props.toggle) {
|
|
189
|
+
this.props.toggle(e);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
handleTab(e) {
|
|
194
|
+
if (e.which !== 9 && e.key !== 'Tab') return;
|
|
195
|
+
if (this.modalIndex < Modal.openCount - 1) return; // last opened modal
|
|
196
|
+
|
|
197
|
+
const focusableChildren = this.getFocusableChildren();
|
|
198
|
+
const totalFocusable = focusableChildren.length;
|
|
199
|
+
if (totalFocusable === 0) return;
|
|
200
|
+
const currentFocus = this.getFocusedChild();
|
|
201
|
+
let focusedIndex = 0;
|
|
202
|
+
for (let i = 0; i < totalFocusable; i += 1) {
|
|
203
|
+
if (focusableChildren[i] === currentFocus) {
|
|
204
|
+
focusedIndex = i;
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
if (e.shiftKey && focusedIndex === 0) {
|
|
209
|
+
e.preventDefault();
|
|
210
|
+
focusableChildren[totalFocusable - 1].focus();
|
|
211
|
+
} else if (!e.shiftKey && focusedIndex === totalFocusable - 1) {
|
|
212
|
+
e.preventDefault();
|
|
213
|
+
focusableChildren[0].focus();
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
handleBackdropMouseDown(e) {
|
|
217
|
+
this._mouseDownElement = e.target;
|
|
218
|
+
}
|
|
219
|
+
handleEscape(e) {
|
|
220
|
+
if (this.props.isOpen && (e.keyCode === _utils.keyCodes.esc || e.key === 'Escape') && this.props.toggle) {
|
|
221
|
+
if (this.props.keyboard) {
|
|
222
|
+
e.preventDefault();
|
|
223
|
+
e.stopPropagation();
|
|
224
|
+
this.props.toggle(e);
|
|
225
|
+
} else if (this.props.backdrop === 'static') {
|
|
226
|
+
e.preventDefault();
|
|
227
|
+
e.stopPropagation();
|
|
228
|
+
this.handleStaticBackdropAnimation();
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
handleStaticBackdropAnimation() {
|
|
233
|
+
this.clearBackdropAnimationTimeout();
|
|
234
|
+
this.setState({
|
|
235
|
+
showStaticBackdropAnimation: true
|
|
236
|
+
});
|
|
237
|
+
this._backdropAnimationTimeout = setTimeout(() => {
|
|
238
|
+
this.setState({
|
|
239
|
+
showStaticBackdropAnimation: false
|
|
240
|
+
});
|
|
241
|
+
}, 100);
|
|
242
|
+
}
|
|
243
|
+
onOpened(node, isAppearing) {
|
|
244
|
+
this.props.onOpened();
|
|
245
|
+
(this.props.modalTransition.onEntered || noop)(node, isAppearing);
|
|
246
|
+
}
|
|
247
|
+
onClosed(node) {
|
|
248
|
+
const {
|
|
249
|
+
unmountOnClose
|
|
250
|
+
} = this.props;
|
|
251
|
+
// so all methods get called before it is unmounted
|
|
252
|
+
this.props.onClosed();
|
|
253
|
+
(this.props.modalTransition.onExited || noop)(node);
|
|
254
|
+
if (unmountOnClose) {
|
|
255
|
+
this.destroy();
|
|
256
|
+
}
|
|
257
|
+
this.close();
|
|
258
|
+
if (this._isMounted) {
|
|
259
|
+
this.setState({
|
|
260
|
+
isOpen: false
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
setFocus() {
|
|
265
|
+
if (this._dialog && this._dialog.parentNode && typeof this._dialog.parentNode.focus === 'function') {
|
|
266
|
+
this._dialog.parentNode.focus();
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
getFocusableChildren() {
|
|
270
|
+
return this._element.querySelectorAll(_utils.focusableElements.join(', '));
|
|
271
|
+
}
|
|
272
|
+
getFocusedChild() {
|
|
273
|
+
let currentFocus;
|
|
274
|
+
const focusableChildren = this.getFocusableChildren();
|
|
275
|
+
try {
|
|
276
|
+
currentFocus = document.activeElement;
|
|
277
|
+
} catch (err) {
|
|
278
|
+
currentFocus = focusableChildren[0];
|
|
279
|
+
}
|
|
280
|
+
return currentFocus;
|
|
281
|
+
}
|
|
282
|
+
trapFocus(ev) {
|
|
283
|
+
if (!this.props.trapFocus) {
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
if (!this._element) {
|
|
287
|
+
// element is not attached
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
if (this._dialog && this._dialog.parentNode === ev.target) {
|
|
291
|
+
// initial focus when the Modal is opened
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
if (this.modalIndex < Modal.openCount - 1) {
|
|
295
|
+
// last opened modal
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
const children = this.getFocusableChildren();
|
|
299
|
+
for (let i = 0; i < children.length; i += 1) {
|
|
300
|
+
// focus is already inside the Modal
|
|
301
|
+
if (children[i] === ev.target) return;
|
|
302
|
+
}
|
|
303
|
+
if (children.length > 0) {
|
|
304
|
+
// otherwise focus the first focusable element in the Modal
|
|
305
|
+
ev.preventDefault();
|
|
306
|
+
ev.stopPropagation();
|
|
307
|
+
children[0].focus();
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
init() {
|
|
311
|
+
try {
|
|
312
|
+
this._triggeringElement = document.activeElement;
|
|
313
|
+
} catch (err) {
|
|
314
|
+
this._triggeringElement = null;
|
|
315
|
+
}
|
|
316
|
+
if (!this._element) {
|
|
317
|
+
this._element = document.createElement('div');
|
|
318
|
+
this._element.setAttribute('tabindex', '-1');
|
|
319
|
+
this._element.style.position = 'relative';
|
|
320
|
+
this._element.style.zIndex = this.props.zIndex;
|
|
321
|
+
this._mountContainer = (0, _utils.getTarget)(this.props.container);
|
|
322
|
+
this._mountContainer.appendChild(this._element);
|
|
323
|
+
}
|
|
324
|
+
this._originalBodyPadding = (0, _utils.getOriginalBodyPadding)();
|
|
325
|
+
if (Modal.openCount < 1) {
|
|
326
|
+
Modal.originalBodyOverflow = window.getComputedStyle(document.body).overflow;
|
|
327
|
+
}
|
|
328
|
+
(0, _utils.conditionallyUpdateScrollbar)();
|
|
329
|
+
if (Modal.openCount === 0) {
|
|
330
|
+
document.body.className = (0, _classnames.default)(document.body.className, (0, _utils.mapToCssModules)('modal-open', this.props.cssModule));
|
|
331
|
+
document.body.style.overflow = 'hidden';
|
|
332
|
+
}
|
|
333
|
+
this.modalIndex = Modal.openCount;
|
|
334
|
+
Modal.openCount += 1;
|
|
335
|
+
}
|
|
336
|
+
destroy() {
|
|
337
|
+
if (this._element) {
|
|
338
|
+
this._mountContainer.removeChild(this._element);
|
|
339
|
+
this._element = null;
|
|
340
|
+
}
|
|
341
|
+
this.manageFocusAfterClose();
|
|
342
|
+
}
|
|
343
|
+
manageFocusAfterClose() {
|
|
344
|
+
if (this._triggeringElement) {
|
|
345
|
+
const {
|
|
346
|
+
returnFocusAfterClose
|
|
347
|
+
} = this.props;
|
|
348
|
+
if (this._triggeringElement.focus && returnFocusAfterClose) this._triggeringElement.focus();
|
|
349
|
+
this._triggeringElement = null;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
close() {
|
|
353
|
+
if (Modal.openCount <= 1) {
|
|
354
|
+
const modalOpenClassName = (0, _utils.mapToCssModules)('modal-open', this.props.cssModule);
|
|
355
|
+
// Use regex to prevent matching `modal-open` as part of a different class, e.g. `my-modal-opened`
|
|
356
|
+
const modalOpenClassNameRegex = new RegExp(`(^| )${modalOpenClassName}( |$)`);
|
|
357
|
+
document.body.className = document.body.className.replace(modalOpenClassNameRegex, ' ').trim();
|
|
358
|
+
document.body.style.overflow = Modal.originalBodyOverflow;
|
|
359
|
+
}
|
|
360
|
+
this.manageFocusAfterClose();
|
|
361
|
+
Modal.openCount = Math.max(0, Modal.openCount - 1);
|
|
362
|
+
(0, _utils.setScrollbarWidth)(this._originalBodyPadding);
|
|
363
|
+
}
|
|
364
|
+
clearBackdropAnimationTimeout() {
|
|
365
|
+
if (this._backdropAnimationTimeout) {
|
|
366
|
+
clearTimeout(this._backdropAnimationTimeout);
|
|
367
|
+
this._backdropAnimationTimeout = undefined;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
renderModalDialog() {
|
|
371
|
+
const attributes = (0, _utils.omit)(this.props, propsToOmit);
|
|
372
|
+
const dialogBaseClass = 'modal-dialog';
|
|
373
|
+
return /*#__PURE__*/_react.default.createElement("div", _extends({}, attributes, {
|
|
374
|
+
className: (0, _utils.mapToCssModules)((0, _classnames.default)(dialogBaseClass, this.props.className, {
|
|
375
|
+
[`modal-${this.props.size}`]: this.props.size,
|
|
376
|
+
[`${dialogBaseClass}-centered`]: this.props.centered,
|
|
377
|
+
[`${dialogBaseClass}-scrollable`]: this.props.scrollable,
|
|
378
|
+
'modal-fullscreen': this.props.fullscreen === true,
|
|
379
|
+
[`modal-fullscreen-${this.props.fullscreen}-down`]: typeof this.props.fullscreen === 'string'
|
|
380
|
+
}), this.props.cssModule),
|
|
381
|
+
role: "document",
|
|
382
|
+
ref: c => {
|
|
383
|
+
this._dialog = c;
|
|
384
|
+
}
|
|
385
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
386
|
+
className: (0, _utils.mapToCssModules)((0, _classnames.default)('modal-content', this.props.contentClassName), this.props.cssModule)
|
|
387
|
+
}, this.props.children));
|
|
388
|
+
}
|
|
389
|
+
render() {
|
|
390
|
+
const {
|
|
391
|
+
unmountOnClose
|
|
392
|
+
} = this.props;
|
|
393
|
+
if (!!this._element && (this.state.isOpen || !unmountOnClose)) {
|
|
394
|
+
const isModalHidden = !!this._element && !this.state.isOpen && !unmountOnClose;
|
|
395
|
+
this._element.style.display = isModalHidden ? 'none' : 'block';
|
|
396
|
+
const {
|
|
397
|
+
wrapClassName,
|
|
398
|
+
modalClassName,
|
|
399
|
+
backdropClassName,
|
|
400
|
+
cssModule,
|
|
401
|
+
isOpen,
|
|
402
|
+
backdrop,
|
|
403
|
+
role,
|
|
404
|
+
labelledBy,
|
|
405
|
+
external,
|
|
406
|
+
innerRef
|
|
407
|
+
} = this.props;
|
|
408
|
+
const modalAttributes = {
|
|
409
|
+
onClick: this.handleBackdropClick,
|
|
410
|
+
onMouseDown: this.handleBackdropMouseDown,
|
|
411
|
+
onKeyUp: this.handleEscape,
|
|
412
|
+
onKeyDown: this.handleTab,
|
|
413
|
+
style: {
|
|
414
|
+
display: 'block'
|
|
415
|
+
},
|
|
416
|
+
'aria-labelledby': labelledBy,
|
|
417
|
+
'aria-modal': true,
|
|
418
|
+
role,
|
|
419
|
+
tabIndex: '-1'
|
|
420
|
+
};
|
|
421
|
+
const hasTransition = this.props.fade;
|
|
422
|
+
const modalTransition = _objectSpread(_objectSpread(_objectSpread({}, _Fade.default.defaultProps), this.props.modalTransition), {}, {
|
|
423
|
+
baseClass: hasTransition ? this.props.modalTransition.baseClass : '',
|
|
424
|
+
timeout: hasTransition ? this.props.modalTransition.timeout : 0
|
|
425
|
+
});
|
|
426
|
+
const backdropTransition = _objectSpread(_objectSpread(_objectSpread({}, _Fade.default.defaultProps), this.props.backdropTransition), {}, {
|
|
427
|
+
baseClass: hasTransition ? this.props.backdropTransition.baseClass : '',
|
|
428
|
+
timeout: hasTransition ? this.props.backdropTransition.timeout : 0
|
|
429
|
+
});
|
|
430
|
+
const Backdrop = backdrop && (hasTransition ? /*#__PURE__*/_react.default.createElement(_Fade.default, _extends({}, backdropTransition, {
|
|
431
|
+
in: isOpen && !!backdrop,
|
|
432
|
+
cssModule: cssModule,
|
|
433
|
+
className: (0, _utils.mapToCssModules)((0, _classnames.default)('modal-backdrop', backdropClassName), cssModule)
|
|
434
|
+
})) : /*#__PURE__*/_react.default.createElement("div", {
|
|
435
|
+
className: (0, _utils.mapToCssModules)((0, _classnames.default)('modal-backdrop', 'show', backdropClassName), cssModule)
|
|
436
|
+
}));
|
|
437
|
+
return /*#__PURE__*/_react.default.createElement(_Portal.default, {
|
|
438
|
+
node: this._element
|
|
439
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
440
|
+
className: (0, _utils.mapToCssModules)(wrapClassName)
|
|
441
|
+
}, /*#__PURE__*/_react.default.createElement(_Fade.default, _extends({}, modalAttributes, modalTransition, {
|
|
442
|
+
in: isOpen,
|
|
443
|
+
onEntered: this.onOpened,
|
|
444
|
+
onExited: this.onClosed,
|
|
445
|
+
cssModule: cssModule,
|
|
446
|
+
className: (0, _utils.mapToCssModules)((0, _classnames.default)('modal', modalClassName, this.state.showStaticBackdropAnimation && 'modal-static'), cssModule),
|
|
447
|
+
innerRef: innerRef
|
|
448
|
+
}), external, this.renderModalDialog()), Backdrop));
|
|
449
|
+
}
|
|
450
|
+
return null;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
Modal.propTypes = propTypes;
|
|
454
|
+
Modal.defaultProps = defaultProps;
|
|
455
|
+
Modal.openCount = 0;
|
|
456
|
+
Modal.originalBodyOverflow = null;
|
|
457
|
+
var _default = exports.default = Modal;
|
package/lib/ModalBody.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
var _utils = require("./utils");
|
|
11
|
+
const _excluded = ["className", "cssModule", "tag"];
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
14
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
15
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
16
|
+
const propTypes = {
|
|
17
|
+
/** Add custom class */
|
|
18
|
+
className: _propTypes.default.string,
|
|
19
|
+
/** Change underlying component's CSS base class name */
|
|
20
|
+
cssModule: _propTypes.default.object,
|
|
21
|
+
/** Set a custom element for this component */
|
|
22
|
+
tag: _utils.tagPropType
|
|
23
|
+
};
|
|
24
|
+
function ModalBody(props) {
|
|
25
|
+
const {
|
|
26
|
+
className,
|
|
27
|
+
cssModule,
|
|
28
|
+
tag: Tag = 'div'
|
|
29
|
+
} = props,
|
|
30
|
+
attributes = _objectWithoutProperties(props, _excluded);
|
|
31
|
+
const classes = (0, _utils.mapToCssModules)((0, _classnames.default)(className, 'modal-body'), cssModule);
|
|
32
|
+
return /*#__PURE__*/_react.default.createElement(Tag, _extends({}, attributes, {
|
|
33
|
+
className: classes
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
ModalBody.propTypes = propTypes;
|
|
37
|
+
var _default = exports.default = ModalBody;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
var _utils = require("./utils");
|
|
11
|
+
const _excluded = ["className", "cssModule", "tag"];
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
14
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
15
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
16
|
+
const propTypes = {
|
|
17
|
+
/** Add custom class */
|
|
18
|
+
className: _propTypes.default.string,
|
|
19
|
+
/** Change underlying component's CSS base class name */
|
|
20
|
+
cssModule: _propTypes.default.object,
|
|
21
|
+
/** Set a custom element for this component */
|
|
22
|
+
tag: _utils.tagPropType
|
|
23
|
+
};
|
|
24
|
+
function ModalFooter(props) {
|
|
25
|
+
const {
|
|
26
|
+
className,
|
|
27
|
+
cssModule,
|
|
28
|
+
tag: Tag = 'div'
|
|
29
|
+
} = props,
|
|
30
|
+
attributes = _objectWithoutProperties(props, _excluded);
|
|
31
|
+
const classes = (0, _utils.mapToCssModules)((0, _classnames.default)(className, 'modal-footer'), cssModule);
|
|
32
|
+
return /*#__PURE__*/_react.default.createElement(Tag, _extends({}, attributes, {
|
|
33
|
+
className: classes
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
ModalFooter.propTypes = propTypes;
|
|
37
|
+
var _default = exports.default = ModalFooter;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
var _utils = require("./utils");
|
|
11
|
+
const _excluded = ["className", "cssModule", "children", "toggle", "tag", "wrapTag", "closeAriaLabel", "close"];
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
14
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
15
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
16
|
+
const propTypes = {
|
|
17
|
+
children: _propTypes.default.node,
|
|
18
|
+
/** Add custom class */
|
|
19
|
+
className: _propTypes.default.string,
|
|
20
|
+
/** Custom close button */
|
|
21
|
+
close: _propTypes.default.object,
|
|
22
|
+
closeAriaLabel: _propTypes.default.string,
|
|
23
|
+
/** Change underlying component's CSS base class name */
|
|
24
|
+
cssModule: _propTypes.default.object,
|
|
25
|
+
/** Set a custom element for this component */
|
|
26
|
+
tag: _utils.tagPropType,
|
|
27
|
+
/** Function to be triggered when close button is clicked */
|
|
28
|
+
toggle: _propTypes.default.func,
|
|
29
|
+
wrapTag: _utils.tagPropType
|
|
30
|
+
};
|
|
31
|
+
function ModalHeader(props) {
|
|
32
|
+
let closeButton;
|
|
33
|
+
const {
|
|
34
|
+
className,
|
|
35
|
+
cssModule,
|
|
36
|
+
children,
|
|
37
|
+
toggle,
|
|
38
|
+
tag: Tag = 'h5',
|
|
39
|
+
wrapTag: WrapTag = 'div',
|
|
40
|
+
closeAriaLabel = 'Close',
|
|
41
|
+
close
|
|
42
|
+
} = props,
|
|
43
|
+
attributes = _objectWithoutProperties(props, _excluded);
|
|
44
|
+
const classes = (0, _utils.mapToCssModules)((0, _classnames.default)(className, 'modal-header'), cssModule);
|
|
45
|
+
if (!close && toggle) {
|
|
46
|
+
closeButton = /*#__PURE__*/_react.default.createElement("button", {
|
|
47
|
+
type: "button",
|
|
48
|
+
onClick: toggle,
|
|
49
|
+
className: (0, _utils.mapToCssModules)('btn-close', cssModule),
|
|
50
|
+
"aria-label": closeAriaLabel
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return /*#__PURE__*/_react.default.createElement(WrapTag, _extends({}, attributes, {
|
|
54
|
+
className: classes
|
|
55
|
+
}), /*#__PURE__*/_react.default.createElement(Tag, {
|
|
56
|
+
className: (0, _utils.mapToCssModules)('modal-title', cssModule)
|
|
57
|
+
}, children), close || closeButton);
|
|
58
|
+
}
|
|
59
|
+
ModalHeader.propTypes = propTypes;
|
|
60
|
+
var _default = exports.default = ModalHeader;
|
package/lib/Nav.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
var _utils = require("./utils");
|
|
11
|
+
const _excluded = ["className", "cssModule", "tabs", "pills", "vertical", "horizontal", "justified", "fill", "navbar", "card", "tag"];
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
14
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
15
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
16
|
+
const propTypes = {
|
|
17
|
+
/** Adding card prop adds `.card-header-tabs` or `.card-header-pills` class */
|
|
18
|
+
card: _propTypes.default.bool,
|
|
19
|
+
/** Add custom class */
|
|
20
|
+
className: _propTypes.default.string,
|
|
21
|
+
/** Change underlying component's CSS base class name */
|
|
22
|
+
cssModule: _propTypes.default.object,
|
|
23
|
+
/** fills the nav to extend to full available width */
|
|
24
|
+
fill: _propTypes.default.bool,
|
|
25
|
+
/** Change the horizontal alignment of your nav */
|
|
26
|
+
horizontal: _propTypes.default.oneOf(['center', 'end']),
|
|
27
|
+
/** All horizontal space will be occupied by nav links, but unlike the `fill` above, every nav item will be the same width. */
|
|
28
|
+
justified: _propTypes.default.bool,
|
|
29
|
+
/** Add navbar for a full-height and lightweight navigation */
|
|
30
|
+
navbar: _propTypes.default.bool,
|
|
31
|
+
/** Make NavItems look like pills */
|
|
32
|
+
pills: _propTypes.default.bool,
|
|
33
|
+
/** Make NavItems look like tabs */
|
|
34
|
+
tabs: _propTypes.default.bool,
|
|
35
|
+
/** Set a custom element for this component */
|
|
36
|
+
tag: _utils.tagPropType,
|
|
37
|
+
/** Stack your navigation by changing the flex item direction */
|
|
38
|
+
vertical: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.string])
|
|
39
|
+
};
|
|
40
|
+
const getVerticalClass = vertical => {
|
|
41
|
+
if (vertical === false) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
if (vertical === true || vertical === 'xs') {
|
|
45
|
+
return 'flex-column';
|
|
46
|
+
}
|
|
47
|
+
return `flex-${vertical}-column`;
|
|
48
|
+
};
|
|
49
|
+
function Nav(props) {
|
|
50
|
+
const {
|
|
51
|
+
className,
|
|
52
|
+
cssModule,
|
|
53
|
+
tabs,
|
|
54
|
+
pills,
|
|
55
|
+
vertical = false,
|
|
56
|
+
horizontal,
|
|
57
|
+
justified,
|
|
58
|
+
fill,
|
|
59
|
+
navbar,
|
|
60
|
+
card,
|
|
61
|
+
tag: Tag = 'ul'
|
|
62
|
+
} = props,
|
|
63
|
+
attributes = _objectWithoutProperties(props, _excluded);
|
|
64
|
+
const classes = (0, _utils.mapToCssModules)((0, _classnames.default)(className, navbar ? 'navbar-nav' : 'nav', horizontal ? `justify-content-${horizontal}` : false, getVerticalClass(vertical), {
|
|
65
|
+
'nav-tabs': tabs,
|
|
66
|
+
'card-header-tabs': card && tabs,
|
|
67
|
+
'nav-pills': pills,
|
|
68
|
+
'card-header-pills': card && pills,
|
|
69
|
+
'nav-justified': justified,
|
|
70
|
+
'nav-fill': fill
|
|
71
|
+
}), cssModule);
|
|
72
|
+
return /*#__PURE__*/_react.default.createElement(Tag, _extends({}, attributes, {
|
|
73
|
+
className: classes
|
|
74
|
+
}));
|
|
75
|
+
}
|
|
76
|
+
Nav.propTypes = propTypes;
|
|
77
|
+
var _default = exports.default = Nav;
|