@coreui/react-pro 4.0.0-rc.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/LICENSE +21 -0
- package/README.md +144 -0
- package/dist/components/Types.d.ts +14 -0
- package/dist/components/accordion/CAccordion.d.ts +26 -0
- package/dist/components/accordion/CAccordionBody.d.ts +8 -0
- package/dist/components/accordion/CAccordionButton.d.ts +8 -0
- package/dist/components/accordion/CAccordionCollapse.d.ts +3 -0
- package/dist/components/accordion/CAccordionHeader.d.ts +8 -0
- package/dist/components/accordion/CAccordionItem.d.ts +17 -0
- package/dist/components/alert/CAlert.d.ts +38 -0
- package/dist/components/alert/CAlertHeading.d.ts +14 -0
- package/dist/components/alert/CAlertLink.d.ts +8 -0
- package/dist/components/avatar/CAvatar.d.ts +41 -0
- package/dist/components/backdrop/CBackdrop.d.ts +12 -0
- package/dist/components/badge/CBadge.d.ts +39 -0
- package/dist/components/breadcrumb/CBreadcrumb.d.ts +8 -0
- package/dist/components/breadcrumb/CBreadcrumbItem.d.ts +16 -0
- package/dist/components/button/CButton.d.ts +58 -0
- package/dist/components/button-group/CButtonGroup.d.ts +18 -0
- package/dist/components/button-group/CButtonToolbar.d.ts +8 -0
- package/dist/components/callout/CCallout.d.ts +15 -0
- package/dist/components/card/CCard.d.ts +21 -0
- package/dist/components/card/CCardBody.d.ts +8 -0
- package/dist/components/card/CCardFooter.d.ts +8 -0
- package/dist/components/card/CCardGroup.d.ts +8 -0
- package/dist/components/card/CCardHeader.d.ts +14 -0
- package/dist/components/card/CCardImage.d.ts +18 -0
- package/dist/components/card/CCardImageOverlay.d.ts +8 -0
- package/dist/components/card/CCardLink.d.ts +12 -0
- package/dist/components/card/CCardSubtitle.d.ts +14 -0
- package/dist/components/card/CCardText.d.ts +14 -0
- package/dist/components/card/CCardTitle.d.ts +14 -0
- package/dist/components/carousel/CCarousel.d.ts +53 -0
- package/dist/components/carousel/CCarouselCaption.d.ts +8 -0
- package/dist/components/carousel/CCarouselControl.d.ts +16 -0
- package/dist/components/carousel/CCarouselIndicators.d.ts +12 -0
- package/dist/components/carousel/CCarouselInner.d.ts +8 -0
- package/dist/components/carousel/CCarouselItem.d.ts +12 -0
- package/dist/components/close-button/CCloseButton.d.ts +16 -0
- package/dist/components/collapse/CCollapse.d.ts +12 -0
- package/dist/components/dropdown/CDropdown.d.ts +72 -0
- package/dist/components/dropdown/CDropdownDivider.d.ts +8 -0
- package/dist/components/dropdown/CDropdownHeader.d.ts +14 -0
- package/dist/components/dropdown/CDropdownItem.d.ts +15 -0
- package/dist/components/dropdown/CDropdownItemPlain.d.ts +14 -0
- package/dist/components/dropdown/CDropdownMenu.d.ts +15 -0
- package/dist/components/dropdown/CDropdownToggle.d.ts +20 -0
- package/dist/components/element-cover/CElementCover.d.ts +26 -0
- package/dist/components/footer/CFooter.d.ts +12 -0
- package/dist/components/form/CForm.d.ts +12 -0
- package/dist/components/form/CFormCheck.d.ts +68 -0
- package/dist/components/form/CFormFeedback.d.ts +26 -0
- package/dist/components/form/CFormFloating.d.ts +8 -0
- package/dist/components/form/CFormInput.d.ts +51 -0
- package/dist/components/form/CFormLabel.d.ts +12 -0
- package/dist/components/form/CFormRange.d.ts +38 -0
- package/dist/components/form/CFormSelect.d.ts +26 -0
- package/dist/components/form/CFormSwitch.d.ts +37 -0
- package/dist/components/form/CFormText.d.ts +14 -0
- package/dist/components/form/CFormTextarea.d.ts +38 -0
- package/dist/components/form/CInputGroup.d.ts +14 -0
- package/dist/components/form/CInputGroupText.d.ts +14 -0
- package/dist/components/grid/CCol.d.ts +52 -0
- package/dist/components/grid/CContainer.d.ts +32 -0
- package/dist/components/grid/CRow.d.ts +50 -0
- package/dist/components/header/CHeader.d.ts +18 -0
- package/dist/components/header/CHeaderBrand.d.ts +14 -0
- package/dist/components/header/CHeaderDivider.d.ts +8 -0
- package/dist/components/header/CHeaderNav.d.ts +14 -0
- package/dist/components/header/CHeaderText.d.ts +8 -0
- package/dist/components/header/CHeaderToggler.d.ts +8 -0
- package/dist/components/image/CImage.d.ts +24 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/link/CLink.d.ts +26 -0
- package/dist/components/list-group/CListGroup.d.ts +22 -0
- package/dist/components/list-group/CListGroupItem.d.ts +29 -0
- package/dist/components/loading-button/CLoadingButton.d.ts +31 -0
- package/dist/components/modal/CModal.d.ts +62 -0
- package/dist/components/modal/CModalBody.d.ts +8 -0
- package/dist/components/modal/CModalContent.d.ts +8 -0
- package/dist/components/modal/CModalDialog.d.ts +26 -0
- package/dist/components/modal/CModalFooter.d.ts +8 -0
- package/dist/components/modal/CModalHeader.d.ts +14 -0
- package/dist/components/modal/CModalTitle.d.ts +14 -0
- package/dist/components/multi-select/CMultiSelect.d.ts +93 -0
- package/dist/components/multi-select/CMultiSelectCleaner.d.ts +2 -0
- package/dist/components/multi-select/CMultiSelectNativeSelect.d.ts +8 -0
- package/dist/components/multi-select/CMultiSelectOptions.d.ts +10 -0
- package/dist/components/multi-select/CMultiSelectSearchInput.d.ts +5 -0
- package/dist/components/multi-select/CMultiSelectSelectAllButton.d.ts +2 -0
- package/dist/components/multi-select/CMultiSelectSelection.d.ts +11 -0
- package/dist/components/nav/CNav.d.ts +22 -0
- package/dist/components/nav/CNavGroup.d.ts +25 -0
- package/dist/components/nav/CNavGroupItems.d.ts +8 -0
- package/dist/components/nav/CNavItem.d.ts +3 -0
- package/dist/components/nav/CNavLink.d.ts +31 -0
- package/dist/components/nav/CNavTitle.d.ts +8 -0
- package/dist/components/navbar/CNavbar.d.ts +43 -0
- package/dist/components/navbar/CNavbarBrand.d.ts +17 -0
- package/dist/components/navbar/CNavbarNav.d.ts +14 -0
- package/dist/components/navbar/CNavbarText.d.ts +8 -0
- package/dist/components/navbar/CNavbarToggler.d.ts +8 -0
- package/dist/components/offcanvas/COffcanvas.d.ts +37 -0
- package/dist/components/offcanvas/COffcanvasBody.d.ts +8 -0
- package/dist/components/offcanvas/COffcanvasHeader.d.ts +8 -0
- package/dist/components/offcanvas/COffcanvasTitle.d.ts +14 -0
- package/dist/components/pagination/CPagination.d.ts +16 -0
- package/dist/components/pagination/CPaginationItem.d.ts +16 -0
- package/dist/components/pagination/CSmartPagination.d.ts +80 -0
- package/dist/components/popover/CPopover.d.ts +36 -0
- package/dist/components/popover/CPopoverContent.d.ts +10 -0
- package/dist/components/progress/CProgress.d.ts +26 -0
- package/dist/components/progress/CProgressBar.d.ts +29 -0
- package/dist/components/sidebar/CSidebar.d.ts +49 -0
- package/dist/components/sidebar/CSidebarBrand.d.ts +8 -0
- package/dist/components/sidebar/CSidebarFooter.d.ts +8 -0
- package/dist/components/sidebar/CSidebarHeader.d.ts +8 -0
- package/dist/components/sidebar/CSidebarNav.d.ts +14 -0
- package/dist/components/sidebar/CSidebarToggler.d.ts +8 -0
- package/dist/components/smart-table/CSmartTable.d.ts +3 -0
- package/dist/components/smart-table/CSmartTableBody.d.ts +13 -0
- package/dist/components/smart-table/CSmartTableCleaner.d.ts +7 -0
- package/dist/components/smart-table/CSmartTableFilter.d.ts +8 -0
- package/dist/components/smart-table/CSmartTableHead.d.ts +17 -0
- package/dist/components/smart-table/CSmartTableInterface.d.ts +289 -0
- package/dist/components/smart-table/CSmartTableItemsPerPageSelector.d.ts +8 -0
- package/dist/components/spinner/CSpinner.d.ts +37 -0
- package/dist/components/table/CTable.d.ts +53 -0
- package/dist/components/table/CTableBody.d.ts +15 -0
- package/dist/components/table/CTableCaption.d.ts +2 -0
- package/dist/components/table/CTableDataCell.d.ts +27 -0
- package/dist/components/table/CTableFoot.d.ts +15 -0
- package/dist/components/table/CTableHead.d.ts +15 -0
- package/dist/components/table/CTableHeaderCell.d.ts +15 -0
- package/dist/components/table/CTableRow.d.ts +23 -0
- package/dist/components/tabs/CTabContent.d.ts +8 -0
- package/dist/components/tabs/CTabPane.d.ts +12 -0
- package/dist/components/toast/CToast.d.ts +53 -0
- package/dist/components/toast/CToastBody.d.ts +8 -0
- package/dist/components/toast/CToastClose.d.ts +9 -0
- package/dist/components/toast/CToastHeader.d.ts +12 -0
- package/dist/components/toast/CToaster.d.ts +18 -0
- package/dist/components/tooltip/CTooltip.d.ts +27 -0
- package/dist/components/tooltip/CTooltipContent.d.ts +10 -0
- package/dist/components/widgets/CWidgetBrand.d.ts +19 -0
- package/dist/components/widgets/CWidgetDropdown.d.ts +20 -0
- package/dist/components/widgets/CWidgetIcon.d.ts +21 -0
- package/dist/components/widgets/CWidgetProgress.d.ts +32 -0
- package/dist/components/widgets/CWidgetProgressIcon.d.ts +32 -0
- package/dist/components/widgets/CWidgetSimple.d.ts +15 -0
- package/dist/components/widgets/CWidgetStatsA.d.ts +31 -0
- package/dist/components/widgets/CWidgetStatsB.d.ts +38 -0
- package/dist/components/widgets/CWidgetStatsC.d.ts +38 -0
- package/dist/components/widgets/CWidgetStatsD.d.ts +32 -0
- package/dist/components/widgets/CWidgetStatsE.d.ts +20 -0
- package/dist/components/widgets/CWidgetStatsF.d.ts +35 -0
- package/dist/components/widgets/index.d.ts +7 -0
- package/dist/index.d.ts +129 -0
- package/dist/index.es.js +9765 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.js +9926 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/hooks/index.d.ts +3 -0
- package/dist/utils/hooks/useForkedRef.d.ts +7 -0
- package/dist/utils/hooks/useStateWithCallback.d.ts +1 -0
- package/package.json +99 -0
- package/src/components/Types.tsx +128 -0
- package/src/components/accordion/CAccordion.tsx +54 -0
- package/src/components/accordion/CAccordionBody.tsx +35 -0
- package/src/components/accordion/CAccordionButton.tsx +39 -0
- package/src/components/accordion/CAccordionCollapse.tsx +19 -0
- package/src/components/accordion/CAccordionHeader.tsx +31 -0
- package/src/components/accordion/CAccordionItem.tsx +66 -0
- package/src/components/accordion/__tests__/CAccordion.spec.tsx +36 -0
- package/src/components/accordion/__tests__/CAccordionBody.spec.tsx +15 -0
- package/src/components/accordion/__tests__/CAccordionButton.spec.tsx +16 -0
- package/src/components/accordion/__tests__/CAccordionCollapse.spec.tsx +10 -0
- package/src/components/accordion/__tests__/CAccordionHeader.spec.tsx +16 -0
- package/src/components/accordion/__tests__/CAccordionItem.spec.tsx +16 -0
- package/src/components/accordion/__tests__/__snapshots__/CAccordion.spec.tsx.snap +21 -0
- package/src/components/accordion/__tests__/__snapshots__/CAccordionBody.spec.tsx.snap +29 -0
- package/src/components/accordion/__tests__/__snapshots__/CAccordionButton.spec.tsx.snap +23 -0
- package/src/components/accordion/__tests__/__snapshots__/CAccordionCollapse.spec.tsx.snap +11 -0
- package/src/components/accordion/__tests__/__snapshots__/CAccordionHeader.spec.tsx.snap +31 -0
- package/src/components/accordion/__tests__/__snapshots__/CAccordionItem.spec.tsx.snap +21 -0
- package/src/components/alert/CAlert.tsx +100 -0
- package/src/components/alert/CAlertHeading.tsx +36 -0
- package/src/components/alert/CAlertLink.tsx +31 -0
- package/src/components/alert/__tests__/CAlert.spec.tsx +45 -0
- package/src/components/alert/__tests__/CAlertHeading.spec.tsx +20 -0
- package/src/components/alert/__tests__/CAlertLink.spec.tsx +20 -0
- package/src/components/alert/__tests__/__snapshots__/CAlert.spec.tsx.snap +27 -0
- package/src/components/alert/__tests__/__snapshots__/CAlertHeading.spec.tsx.snap +21 -0
- package/src/components/alert/__tests__/__snapshots__/CAlertLink.spec.tsx.snap +22 -0
- package/src/components/avatar/CAvatar.tsx +87 -0
- package/src/components/avatar/__tests__/CAvatar.spec.tsx +54 -0
- package/src/components/avatar/__tests__/__snapshots__/CAvatar.spec.tsx.snap +40 -0
- package/src/components/backdrop/CBackdrop.tsx +41 -0
- package/src/components/backdrop/__tests__/CBackdrop.spec.tsx +31 -0
- package/src/components/backdrop/__tests__/__snapshots__/CBackdrop.spec.tsx.snap +23 -0
- package/src/components/badge/CBadge.tsx +86 -0
- package/src/components/badge/__tests__/CBadge.spec.tsx +22 -0
- package/src/components/badge/__tests__/__snapshots__/CBadge.spec.tsx.snap +21 -0
- package/src/components/breadcrumb/CBreadcrumb.tsx +30 -0
- package/src/components/breadcrumb/CBreadcrumbItem.tsx +46 -0
- package/src/components/breadcrumb/__tests__/CBreadcrumb.spec.tsx +22 -0
- package/src/components/breadcrumb/__tests__/CBreadcrumbItem.spec.tsx +21 -0
- package/src/components/breadcrumb/__tests__/__snapshots__/CBreadcrumb.spec.tsx.snap +42 -0
- package/src/components/breadcrumb/__tests__/__snapshots__/CBreadcrumbItem.spec.tsx.snap +22 -0
- package/src/components/button/CButton.tsx +112 -0
- package/src/components/button/__tests__/CButton.spec.tsx +44 -0
- package/src/components/button/__tests__/CButtonClose.spec.tsx +23 -0
- package/src/components/button/__tests__/__snapshots__/CButton.spec.tsx.snap +38 -0
- package/src/components/button/__tests__/__snapshots__/CButtonClose.spec.tsx.snap +24 -0
- package/src/components/button-group/CButtonGroup.tsx +45 -0
- package/src/components/button-group/CButtonToolbar.tsx +29 -0
- package/src/components/button-group/__tests__/CButtonGroup.spec.tsx +37 -0
- package/src/components/button-group/__tests__/CButtonToolbar.spec.tsx +29 -0
- package/src/components/button-group/__tests__/__snapshots__/CButtonGroup.spec.tsx.snap +63 -0
- package/src/components/button-group/__tests__/__snapshots__/CButtonToolbar.spec.tsx.snap +66 -0
- package/src/components/callout/CCallout.tsx +44 -0
- package/src/components/callout/__tests__/CCallout.spec.tsx +21 -0
- package/src/components/callout/__tests__/__snapshots__/CCallout.spec.tsx.snap +21 -0
- package/src/components/card/CCard.tsx +52 -0
- package/src/components/card/CCardBody.tsx +29 -0
- package/src/components/card/CCardFooter.tsx +29 -0
- package/src/components/card/CCardGroup.tsx +29 -0
- package/src/components/card/CCardHeader.tsx +36 -0
- package/src/components/card/CCardImage.tsx +43 -0
- package/src/components/card/CCardImageOverlay.tsx +29 -0
- package/src/components/card/CCardLink.tsx +35 -0
- package/src/components/card/CCardSubtitle.tsx +35 -0
- package/src/components/card/CCardText.tsx +36 -0
- package/src/components/card/CCardTitle.tsx +36 -0
- package/src/components/card/__tests__/CCard.spec.tsx +22 -0
- package/src/components/card/__tests__/CCardBody.spec.tsx +16 -0
- package/src/components/card/__tests__/CCardFooter.spec.tsx +16 -0
- package/src/components/card/__tests__/CCardGroup.spec.tsx +51 -0
- package/src/components/card/__tests__/CCardHeader.spec.tsx +20 -0
- package/src/components/card/__tests__/CCardImage.spec.tsx +18 -0
- package/src/components/card/__tests__/CCardImageOverlay.spec.tsx +17 -0
- package/src/components/card/__tests__/CCardLink.spec.tsx +20 -0
- package/src/components/card/__tests__/CCardSubtitle.spec.tsx +20 -0
- package/src/components/card/__tests__/CCardText.spec.tsx +20 -0
- package/src/components/card/__tests__/CCardTitle.spec.tsx +20 -0
- package/src/components/card/__tests__/__snapshots__/CCard.spec.tsx.snap +21 -0
- package/src/components/card/__tests__/__snapshots__/CCardBody.spec.tsx.snap +21 -0
- package/src/components/card/__tests__/__snapshots__/CCardFooter.spec.tsx.snap +21 -0
- package/src/components/card/__tests__/__snapshots__/CCardGroup.spec.tsx.snap +86 -0
- package/src/components/card/__tests__/__snapshots__/CCardHeader.spec.tsx.snap +21 -0
- package/src/components/card/__tests__/__snapshots__/CCardImage.spec.tsx.snap +17 -0
- package/src/components/card/__tests__/__snapshots__/CCardImageOverlay.spec.tsx.snap +19 -0
- package/src/components/card/__tests__/__snapshots__/CCardLink.spec.tsx.snap +22 -0
- package/src/components/card/__tests__/__snapshots__/CCardSubtitle.spec.tsx.snap +21 -0
- package/src/components/card/__tests__/__snapshots__/CCardText.spec.tsx.snap +21 -0
- package/src/components/card/__tests__/__snapshots__/CCardTitle.spec.tsx.snap +21 -0
- package/src/components/carousel/CCarousel.tsx +168 -0
- package/src/components/carousel/CCarouselCaption.tsx +24 -0
- package/src/components/carousel/CCarouselControl.tsx +56 -0
- package/src/components/carousel/CCarouselIndicators.tsx +49 -0
- package/src/components/carousel/CCarouselInner.tsx +41 -0
- package/src/components/carousel/CCarouselItem.tsx +110 -0
- package/src/components/carousel/__tests__/CCarousel.spec.tsx +275 -0
- package/src/components/carousel/__tests__/__snapshots__/CCarousel.spec.tsx.snap +376 -0
- package/src/components/close-button/CCloseButton.tsx +43 -0
- package/src/components/close-button/__tests__/CCloseButton.spec.tsx +24 -0
- package/src/components/close-button/__tests__/__snapshots__/CCloseButton.spec.tsx.snap +20 -0
- package/src/components/collapse/CCollapse.tsx +92 -0
- package/src/components/collapse/__tests__/CCollapse.spec.tsx +41 -0
- package/src/components/collapse/__tests__/__snapshots__/CCollapse.spec.tsx.snap +21 -0
- package/src/components/dropdown/CDropdown.tsx +205 -0
- package/src/components/dropdown/CDropdownDivider.tsx +24 -0
- package/src/components/dropdown/CDropdownHeader.tsx +36 -0
- package/src/components/dropdown/CDropdownItem.tsx +39 -0
- package/src/components/dropdown/CDropdownItemPlain.tsx +36 -0
- package/src/components/dropdown/CDropdownMenu.tsx +111 -0
- package/src/components/dropdown/CDropdownToggle.tsx +91 -0
- package/src/components/dropdown/__tests__/CDropdown.spec.tsx +95 -0
- package/src/components/dropdown/__tests__/CDropdownDivider.spec.tsx +16 -0
- package/src/components/dropdown/__tests__/CDropdownHeader.spec.tsx +20 -0
- package/src/components/dropdown/__tests__/CDropdownItem.spec.tsx +20 -0
- package/src/components/dropdown/__tests__/CDropdownItemPlain.spec.tsx +20 -0
- package/src/components/dropdown/__tests__/CDropdownMenu.spec.tsx +23 -0
- package/src/components/dropdown/__tests__/CDropdownToggle.spec.tsx +20 -0
- package/src/components/dropdown/__tests__/__snapshots__/CDropdown.spec.tsx.snap +77 -0
- package/src/components/dropdown/__tests__/__snapshots__/CDropdownDivider.spec.tsx.snap +17 -0
- package/src/components/dropdown/__tests__/__snapshots__/CDropdownHeader.spec.tsx.snap +21 -0
- package/src/components/dropdown/__tests__/__snapshots__/CDropdownItem.spec.tsx.snap +21 -0
- package/src/components/dropdown/__tests__/__snapshots__/CDropdownItemPlain.spec.tsx.snap +21 -0
- package/src/components/dropdown/__tests__/__snapshots__/CDropdownMenu.spec.tsx.snap +29 -0
- package/src/components/dropdown/__tests__/__snapshots__/CDropdownToggle.spec.tsx.snap +30 -0
- package/src/components/element-cover/CElementCover.tsx +114 -0
- package/src/components/footer/CFooter.tsx +34 -0
- package/src/components/footer/__tests__/CFooter.spec.tsx +21 -0
- package/src/components/footer/__tests__/__snapshots__/CFooter.spec.tsx.snap +21 -0
- package/src/components/form/CForm.tsx +33 -0
- package/src/components/form/CFormCheck.tsx +156 -0
- package/src/components/form/CFormFeedback.tsx +59 -0
- package/src/components/form/CFormFloating.tsx +28 -0
- package/src/components/form/CFormInput.tsx +87 -0
- package/src/components/form/CFormLabel.tsx +33 -0
- package/src/components/form/CFormRange.tsx +53 -0
- package/src/components/form/CFormSelect.tsx +58 -0
- package/src/components/form/CFormSwitch.tsx +84 -0
- package/src/components/form/CFormText.tsx +35 -0
- package/src/components/form/CFormTextarea.tsx +68 -0
- package/src/components/form/CInputGroup.tsx +41 -0
- package/src/components/form/CInputGroupText.tsx +35 -0
- package/src/components/form/__tests__/CForm.spec.tsx +35 -0
- package/src/components/form/__tests__/CFormCheck.spec.tsx +33 -0
- package/src/components/form/__tests__/CFormFeedback.spec.tsx +29 -0
- package/src/components/form/__tests__/CFormFloating.spec.tsx +17 -0
- package/src/components/form/__tests__/CFormInput.spec.tsx +44 -0
- package/src/components/form/__tests__/CFormLabel.spec.tsx +17 -0
- package/src/components/form/__tests__/CFormRange.spec.tsx +33 -0
- package/src/components/form/__tests__/CFormSelect.spec.tsx +22 -0
- package/src/components/form/__tests__/CFormSwitch.spec.tsx +42 -0
- package/src/components/form/__tests__/CFormText.spec.tsx +20 -0
- package/src/components/form/__tests__/CFormTextarea.spec.tsx +32 -0
- package/src/components/form/__tests__/CInputGroup.spec.tsx +21 -0
- package/src/components/form/__tests__/CInputGroupText.spec.tsx +16 -0
- package/src/components/form/__tests__/__snapshots__/CForm.spec.tsx.snap +64 -0
- package/src/components/form/__tests__/__snapshots__/CFormCheck.spec.tsx.snap +46 -0
- package/src/components/form/__tests__/__snapshots__/CFormFeedback.spec.tsx.snap +25 -0
- package/src/components/form/__tests__/__snapshots__/CFormFloating.spec.tsx.snap +19 -0
- package/src/components/form/__tests__/__snapshots__/CFormInput.spec.tsx.snap +22 -0
- package/src/components/form/__tests__/__snapshots__/CFormLabel.spec.tsx.snap +21 -0
- package/src/components/form/__tests__/__snapshots__/CFormRange.spec.tsx.snap +26 -0
- package/src/components/form/__tests__/__snapshots__/CFormSelect.spec.tsx.snap +26 -0
- package/src/components/form/__tests__/__snapshots__/CFormSwitch.spec.tsx.snap +34 -0
- package/src/components/form/__tests__/__snapshots__/CFormText.spec.tsx.snap +21 -0
- package/src/components/form/__tests__/__snapshots__/CFormTextarea.spec.tsx.snap +23 -0
- package/src/components/form/__tests__/__snapshots__/CInputGroup.spec.tsx.snap +21 -0
- package/src/components/form/__tests__/__snapshots__/CInputGroupText.spec.tsx.snap +21 -0
- package/src/components/grid/CCol.tsx +144 -0
- package/src/components/grid/CContainer.tsx +80 -0
- package/src/components/grid/CRow.tsx +118 -0
- package/src/components/grid/__tests__/CCol.spec.tsx +42 -0
- package/src/components/grid/__tests__/CContainer.spec.tsx +31 -0
- package/src/components/grid/__tests__/CRow.spec.tsx +116 -0
- package/src/components/grid/__tests__/__snapshots__/CCol.spec.tsx.snap +31 -0
- package/src/components/grid/__tests__/__snapshots__/CContainer.spec.tsx.snap +31 -0
- package/src/components/grid/__tests__/__snapshots__/CRow.spec.tsx.snap +61 -0
- package/src/components/header/CHeader.tsx +60 -0
- package/src/components/header/CHeaderBrand.tsx +36 -0
- package/src/components/header/CHeaderDivider.tsx +24 -0
- package/src/components/header/CHeaderNav.tsx +36 -0
- package/src/components/header/CHeaderText.tsx +29 -0
- package/src/components/header/CHeaderToggler.tsx +29 -0
- package/src/components/header/__tests__/CHeader.spec.tsx +21 -0
- package/src/components/header/__tests__/CHeaderBrand.spec.tsx +20 -0
- package/src/components/header/__tests__/CHeaderDivider.spec.tsx +16 -0
- package/src/components/header/__tests__/CHeaderNav.spec.tsx +20 -0
- package/src/components/header/__tests__/CHeaderText.spec.tsx +16 -0
- package/src/components/header/__tests__/CHeaderToggler.spec.tsx +16 -0
- package/src/components/header/__tests__/__snapshots__/CHeader.spec.tsx.snap +25 -0
- package/src/components/header/__tests__/__snapshots__/CHeaderBrand.spec.tsx.snap +21 -0
- package/src/components/header/__tests__/__snapshots__/CHeaderDivider.spec.tsx.snap +21 -0
- package/src/components/header/__tests__/__snapshots__/CHeaderNav.spec.tsx.snap +23 -0
- package/src/components/header/__tests__/__snapshots__/CHeaderText.spec.tsx.snap +21 -0
- package/src/components/header/__tests__/__snapshots__/CHeaderToggler.spec.tsx.snap +23 -0
- package/src/components/image/CImage.tsx +52 -0
- package/src/components/image/__tests__/CImage.spec.tsx +28 -0
- package/src/components/image/__tests__/__snapshots__/CImage.spec.tsx.snap +25 -0
- package/src/components/index.ts +1 -0
- package/src/components/link/CLink.tsx +64 -0
- package/src/components/link/__tests__/CLink.spec.tsx +51 -0
- package/src/components/link/__tests__/__snapshots__/CLink.spec.tsx.snap +24 -0
- package/src/components/list-group/CListGroup.tsx +66 -0
- package/src/components/list-group/CListGroupItem.tsx +81 -0
- package/src/components/list-group/__tests__/CListGroup.spec.tsx +33 -0
- package/src/components/list-group/__tests__/CListGroupItem.spec.tsx +29 -0
- package/src/components/list-group/__tests__/__snapshots__/CListGroup.spec.tsx.snap +45 -0
- package/src/components/list-group/__tests__/__snapshots__/CListGroupItem.spec.tsx.snap +24 -0
- package/src/components/loading-button/CLoadingButton.tsx +93 -0
- package/src/components/loading-button/__tests__/CLoadingButton.spec.tsx +47 -0
- package/src/components/loading-button/__tests__/__snapshots__/CLoadingButton.spec.tsx.snap +43 -0
- package/src/components/modal/CModal.tsx +240 -0
- package/src/components/modal/CModalBody.tsx +29 -0
- package/src/components/modal/CModalContent.tsx +29 -0
- package/src/components/modal/CModalDialog.tsx +65 -0
- package/src/components/modal/CModalFooter.tsx +29 -0
- package/src/components/modal/CModalHeader.tsx +40 -0
- package/src/components/modal/CModalTitle.tsx +36 -0
- package/src/components/modal/__tests__/CModal.spec.tsx +67 -0
- package/src/components/modal/__tests__/CModalBody.spec.tsx +16 -0
- package/src/components/modal/__tests__/CModalContent.spec.tsx +16 -0
- package/src/components/modal/__tests__/CModalDialog.spec.tsx +30 -0
- package/src/components/modal/__tests__/CModalFooter.spec.tsx +16 -0
- package/src/components/modal/__tests__/CModalHeader.spec.tsx +24 -0
- package/src/components/modal/__tests__/CModalTitle.spec.tsx +20 -0
- package/src/components/modal/__tests__/__snapshots__/CModal.spec.tsx.snap +13 -0
- package/src/components/modal/__tests__/__snapshots__/CModalBody.spec.tsx.snap +21 -0
- package/src/components/modal/__tests__/__snapshots__/CModalContent.spec.tsx.snap +21 -0
- package/src/components/modal/__tests__/__snapshots__/CModalDialog.spec.tsx.snap +21 -0
- package/src/components/modal/__tests__/__snapshots__/CModalFooter.spec.tsx.snap +21 -0
- package/src/components/modal/__tests__/__snapshots__/CModalHeader.spec.tsx.snap +29 -0
- package/src/components/modal/__tests__/__snapshots__/CModalTitle.spec.tsx.snap +21 -0
- package/src/components/multi-select/CMultiSelect.tsx +399 -0
- package/src/components/multi-select/CMultiSelectCleaner.tsx +18 -0
- package/src/components/multi-select/CMultiSelectNativeSelect.tsx +44 -0
- package/src/components/multi-select/CMultiSelectOptions.tsx +65 -0
- package/src/components/multi-select/CMultiSelectSearchInput.tsx +28 -0
- package/src/components/multi-select/CMultiSelectSelectAllButton.tsx +21 -0
- package/src/components/multi-select/CMultiSelectSelection.tsx +60 -0
- package/src/components/multi-select/__tests__/CMultiSelect.spec.tsx +139 -0
- package/src/components/multi-select/__tests__/CMultiSelectCleaner.spec.tsx +15 -0
- package/src/components/multi-select/__tests__/CMultiSelectNativeSelect.spec.tsx +36 -0
- package/src/components/multi-select/__tests__/CMultiSelectOptions.spec.tsx +69 -0
- package/src/components/multi-select/__tests__/CMultiSelectSearchInput.spec.tsx +17 -0
- package/src/components/multi-select/__tests__/CMultiSelectSelectAllButton.spec.tsx +21 -0
- package/src/components/multi-select/__tests__/CMultiSelectSelection.spec.tsx +105 -0
- package/src/components/multi-select/__tests__/__snapshots__/CMultiSelect.spec.tsx.snap +111 -0
- package/src/components/multi-select/__tests__/__snapshots__/CMultiSelectCleaner.spec.tsx.snap +19 -0
- package/src/components/multi-select/__tests__/__snapshots__/CMultiSelectNativeSelect.spec.tsx.snap +37 -0
- package/src/components/multi-select/__tests__/__snapshots__/CMultiSelectOptions.spec.tsx.snap +36 -0
- package/src/components/multi-select/__tests__/__snapshots__/CMultiSelectSearchInput.spec.tsx.snap +20 -0
- package/src/components/multi-select/__tests__/__snapshots__/CMultiSelectSelectAllButton.spec.tsx.snap +24 -0
- package/src/components/multi-select/__tests__/__snapshots__/CMultiSelectSelection.spec.tsx.snap +58 -0
- package/src/components/nav/CNav.tsx +54 -0
- package/src/components/nav/CNavGroup.tsx +147 -0
- package/src/components/nav/CNavGroupItems.tsx +28 -0
- package/src/components/nav/CNavItem.tsx +29 -0
- package/src/components/nav/CNavLink.tsx +66 -0
- package/src/components/nav/CNavTitle.tsx +28 -0
- package/src/components/nav/__tests__/CNav.spec.tsx +62 -0
- package/src/components/nav/__tests__/CNavGroup.spec.tsx +25 -0
- package/src/components/nav/__tests__/CNavGroupItems.spec.tsx +16 -0
- package/src/components/nav/__tests__/CNavItem.spec.tsx +22 -0
- package/src/components/nav/__tests__/CNavLink.spec.tsx +25 -0
- package/src/components/nav/__tests__/CNavTitle.spec.tsx +16 -0
- package/src/components/nav/__tests__/__snapshots__/CNav.spec.tsx.snap +118 -0
- package/src/components/nav/__tests__/__snapshots__/CNavGroup.spec.tsx.snap +36 -0
- package/src/components/nav/__tests__/__snapshots__/CNavGroupItems.spec.tsx.snap +21 -0
- package/src/components/nav/__tests__/__snapshots__/CNavItem.spec.tsx.snap +45 -0
- package/src/components/nav/__tests__/__snapshots__/CNavLink.spec.tsx.snap +35 -0
- package/src/components/nav/__tests__/__snapshots__/CNavTitle.spec.tsx.snap +21 -0
- package/src/components/navbar/CNavbar.tsx +115 -0
- package/src/components/navbar/CNavbarBrand.tsx +40 -0
- package/src/components/navbar/CNavbarNav.tsx +36 -0
- package/src/components/navbar/CNavbarText.tsx +29 -0
- package/src/components/navbar/CNavbarToggler.tsx +29 -0
- package/src/components/navbar/__tests__/CNavbar.spec.tsx +46 -0
- package/src/components/navbar/__tests__/CNavbarBrand.spec.tsx +25 -0
- package/src/components/navbar/__tests__/CNavbarNav.spec.tsx +21 -0
- package/src/components/navbar/__tests__/CNavbarText.spec.tsx +16 -0
- package/src/components/navbar/__tests__/CNavbarToggler.spec.tsx +23 -0
- package/src/components/navbar/__tests__/__snapshots__/CNavbar.spec.tsx.snap +39 -0
- package/src/components/navbar/__tests__/__snapshots__/CNavbarBrand.spec.tsx.snap +33 -0
- package/src/components/navbar/__tests__/__snapshots__/CNavbarNav.spec.tsx.snap +23 -0
- package/src/components/navbar/__tests__/__snapshots__/CNavbarText.spec.tsx.snap +21 -0
- package/src/components/navbar/__tests__/__snapshots__/CNavbarToggler.spec.tsx.snap +38 -0
- package/src/components/offcanvas/COffcanvas.tsx +146 -0
- package/src/components/offcanvas/COffcanvasBody.tsx +29 -0
- package/src/components/offcanvas/COffcanvasHeader.tsx +29 -0
- package/src/components/offcanvas/COffcanvasTitle.tsx +36 -0
- package/src/components/offcanvas/__tests__/COffcanvas.spec.tsx +97 -0
- package/src/components/offcanvas/__tests__/COffcanvasBody.spec.tsx +17 -0
- package/src/components/offcanvas/__tests__/COffcanvasHeader.spec.tsx +17 -0
- package/src/components/offcanvas/__tests__/COffcanvasTitle.spec.tsx +21 -0
- package/src/components/offcanvas/__tests__/__snapshots__/COffcanvas.spec.tsx.snap +45 -0
- package/src/components/offcanvas/__tests__/__snapshots__/COffcanvasBody.spec.tsx.snap +19 -0
- package/src/components/offcanvas/__tests__/__snapshots__/COffcanvasHeader.spec.tsx.snap +19 -0
- package/src/components/offcanvas/__tests__/__snapshots__/COffcanvasTitle.spec.tsx.snap +19 -0
- package/src/components/pagination/CPagination.tsx +45 -0
- package/src/components/pagination/CPaginationItem.tsx +57 -0
- package/src/components/pagination/CSmartPagination.tsx +262 -0
- package/src/components/pagination/__tests__/CPagination.spec.tsx +38 -0
- package/src/components/pagination/__tests__/CPaginationItem.spec.tsx +29 -0
- package/src/components/pagination/__tests__/__snapshots__/CPagination.spec.tsx.snap +65 -0
- package/src/components/pagination/__tests__/__snapshots__/CPaginationItem.spec.tsx.snap +30 -0
- package/src/components/popover/CPopover.tsx +137 -0
- package/src/components/popover/CPopoverContent.tsx +41 -0
- package/src/components/popover/__tests__/CPopover.spec.tsx +84 -0
- package/src/components/popover/__tests__/__snapshots__/CPopover.spec.tsx.snap +43 -0
- package/src/components/progress/CProgress.tsx +66 -0
- package/src/components/progress/CProgressBar.tsx +71 -0
- package/src/components/progress/__tests__/CProgress.spec.tsx +21 -0
- package/src/components/progress/__tests__/CProgressBar.spec.tsx +25 -0
- package/src/components/progress/__tests__/__snapshots__/CProgress.spec.tsx.snap +31 -0
- package/src/components/progress/__tests__/__snapshots__/CProgressBar.spec.tsx.snap +31 -0
- package/src/components/sidebar/CSidebar.tsx +216 -0
- package/src/components/sidebar/CSidebarBrand.tsx +28 -0
- package/src/components/sidebar/CSidebarFooter.tsx +28 -0
- package/src/components/sidebar/CSidebarHeader.tsx +28 -0
- package/src/components/sidebar/CSidebarNav.tsx +47 -0
- package/src/components/sidebar/CSidebarToggler.tsx +28 -0
- package/src/components/sidebar/__tests__/CSidebar.spec.tsx +46 -0
- package/src/components/sidebar/__tests__/CSidebarBrand.spec.tsx +16 -0
- package/src/components/sidebar/__tests__/CSidebarFooter.spec.tsx +16 -0
- package/src/components/sidebar/__tests__/CSidebarHeader.spec.tsx +16 -0
- package/src/components/sidebar/__tests__/CSidebarNav.spec.tsx +16 -0
- package/src/components/sidebar/__tests__/CSidebarToggler.spec.tsx +17 -0
- package/src/components/sidebar/__tests__/__snapshots__/CSidebar.spec.tsx.snap +31 -0
- package/src/components/sidebar/__tests__/__snapshots__/CSidebarBrand.spec.tsx.snap +22 -0
- package/src/components/sidebar/__tests__/__snapshots__/CSidebarFooter.spec.tsx.snap +21 -0
- package/src/components/sidebar/__tests__/__snapshots__/CSidebarHeader.spec.tsx.snap +21 -0
- package/src/components/sidebar/__tests__/__snapshots__/CSidebarNav.spec.tsx.snap +17 -0
- package/src/components/sidebar/__tests__/__snapshots__/CSidebarToggler.spec.tsx.snap +19 -0
- package/src/components/smart-table/CSmartTable.tsx +471 -0
- package/src/components/smart-table/CSmartTableBody.tsx +146 -0
- package/src/components/smart-table/CSmartTableCleaner.tsx +50 -0
- package/src/components/smart-table/CSmartTableFilter.tsx +33 -0
- package/src/components/smart-table/CSmartTableHead.tsx +181 -0
- package/src/components/smart-table/CSmartTableInterface.tsx +300 -0
- package/src/components/smart-table/CSmartTableItemsPerPageSelector.tsx +42 -0
- package/src/components/spinner/CSpinner.tsx +79 -0
- package/src/components/spinner/__tests__/CSpinner.spec.tsx +22 -0
- package/src/components/spinner/__tests__/__snapshots__/CSpinner.spec.tsx.snap +31 -0
- package/src/components/table/CTable.tsx +129 -0
- package/src/components/table/CTableBody.tsx +43 -0
- package/src/components/table/CTableCaption.tsx +19 -0
- package/src/components/table/CTableDataCell.tsx +60 -0
- package/src/components/table/CTableFoot.tsx +43 -0
- package/src/components/table/CTableHead.tsx +43 -0
- package/src/components/table/CTableHeaderCell.tsx +43 -0
- package/src/components/table/CTableRow.tsx +55 -0
- package/src/components/table/__tests__/CTable.spec.tsx +105 -0
- package/src/components/table/__tests__/CTableBody.spec.tsx +30 -0
- package/src/components/table/__tests__/CTableCaption.spec.tsx +21 -0
- package/src/components/table/__tests__/CTableDataCell.spec.tsx +43 -0
- package/src/components/table/__tests__/CTableFoot.spec.tsx +30 -0
- package/src/components/table/__tests__/CTableHead.spec.tsx +30 -0
- package/src/components/table/__tests__/CTableHeaderCell.spec.tsx +39 -0
- package/src/components/table/__tests__/CTableRow.spec.tsx +37 -0
- package/src/components/table/__tests__/__snapshots__/CTable.spec.tsx.snap +117 -0
- package/src/components/table/__tests__/__snapshots__/CTableBody.spec.tsx.snap +21 -0
- package/src/components/table/__tests__/__snapshots__/CTableCaption.spec.tsx.snap +15 -0
- package/src/components/table/__tests__/__snapshots__/CTableDataCell.spec.tsx.snap +25 -0
- package/src/components/table/__tests__/__snapshots__/CTableFoot.spec.tsx.snap +21 -0
- package/src/components/table/__tests__/__snapshots__/CTableHead.spec.tsx.snap +21 -0
- package/src/components/table/__tests__/__snapshots__/CTableHeaderCell.spec.tsx.snap +25 -0
- package/src/components/table/__tests__/__snapshots__/CTableRow.spec.tsx.snap +23 -0
- package/src/components/tabs/CTabContent.tsx +28 -0
- package/src/components/tabs/CTabPane.tsx +60 -0
- package/src/components/tabs/__tests__/CTabContent.spec.tsx +16 -0
- package/src/components/tabs/__tests__/CTabPane.spec.tsx +51 -0
- package/src/components/tabs/__tests__/__snapshots__/CTabContent.spec.tsx.snap +21 -0
- package/src/components/tabs/__tests__/__snapshots__/CTabPane.spec.tsx.snap +23 -0
- package/src/components/toast/CToast.tsx +177 -0
- package/src/components/toast/CToastBody.tsx +28 -0
- package/src/components/toast/CToastClose.tsx +31 -0
- package/src/components/toast/CToastHeader.tsx +36 -0
- package/src/components/toast/CToaster.tsx +103 -0
- package/src/components/toast/__tests__/CToast.spec.tsx +98 -0
- package/src/components/toast/__tests__/CToastBody.spec.tsx +16 -0
- package/src/components/toast/__tests__/CToastHeader.spec.tsx +16 -0
- package/src/components/toast/__tests__/CToaster.spec.tsx +47 -0
- package/src/components/toast/__tests__/__snapshots__/CToast.spec.tsx.snap +81 -0
- package/src/components/toast/__tests__/__snapshots__/CToastBody.spec.tsx.snap +21 -0
- package/src/components/toast/__tests__/__snapshots__/CToastHeader.spec.tsx.snap +21 -0
- package/src/components/toast/__tests__/__snapshots__/CToaster.spec.tsx.snap +25 -0
- package/src/components/tooltip/CTooltip.tsx +116 -0
- package/src/components/tooltip/CTooltipContent.tsx +37 -0
- package/src/components/tooltip/__tests__/CTooltip.spec.tsx +68 -0
- package/src/components/tooltip/__tests__/__snapshots__/CTooltip.spec.tsx.snap +21 -0
- package/src/components/widgets/CWidgetStatsA.tsx +70 -0
- package/src/components/widgets/CWidgetStatsB.tsx +80 -0
- package/src/components/widgets/CWidgetStatsC.tsx +93 -0
- package/src/components/widgets/CWidgetStatsD.tsx +85 -0
- package/src/components/widgets/CWidgetStatsE.tsx +53 -0
- package/src/components/widgets/CWidgetStatsF.tsx +73 -0
- package/src/components/widgets/__tests__/CWidgetStatsA.spec.tsx +47 -0
- package/src/components/widgets/__tests__/CWidgetStatsB.spec.tsx +38 -0
- package/src/components/widgets/__tests__/CWidgetStatsC.spec.tsx +39 -0
- package/src/components/widgets/__tests__/CWidgetStatsD.spec.tsx +51 -0
- package/src/components/widgets/__tests__/CWidgetStatsE.spec.tsx +30 -0
- package/src/components/widgets/__tests__/CWidgetStatsF.spec.tsx +59 -0
- package/src/components/widgets/__tests__/__snapshots__/CWidgetStatsA.spec.tsx.snap +40 -0
- package/src/components/widgets/__tests__/__snapshots__/CWidgetStatsB.spec.tsx.snap +57 -0
- package/src/components/widgets/__tests__/__snapshots__/CWidgetStatsC.spec.tsx.snap +59 -0
- package/src/components/widgets/__tests__/__snapshots__/CWidgetStatsD.spec.tsx.snap +63 -0
- package/src/components/widgets/__tests__/__snapshots__/CWidgetStatsE.spec.tsx.snap +36 -0
- package/src/components/widgets/__tests__/__snapshots__/CWidgetStatsF.spec.tsx.snap +60 -0
- package/src/components/widgets/index.ts +8 -0
- package/src/index.ts +259 -0
- package/src/utils/hooks/index.ts +4 -0
- package/src/utils/hooks/useForkedRef.ts +45 -0
- package/src/utils/hooks/useStateWithCallback.ts +7 -0
- package/tsconfig.json +25 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { render, fireEvent } from '@testing-library/react'
|
|
3
|
+
import '@testing-library/jest-dom/extend-expect'
|
|
4
|
+
import { CLoadingButton } from '../../../index'
|
|
5
|
+
|
|
6
|
+
test('loads and displays CLoadingButton component', async () => {
|
|
7
|
+
const { container } = render(<CLoadingButton />)
|
|
8
|
+
expect(container).toMatchSnapshot()
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
test('CLoadingButton customize', async () => {
|
|
12
|
+
const { container } = render(
|
|
13
|
+
<CLoadingButton
|
|
14
|
+
className="bazinga"
|
|
15
|
+
disabledOnLoading={true}
|
|
16
|
+
loading={true}
|
|
17
|
+
spinnerType="grow"
|
|
18
|
+
timeout={1000}
|
|
19
|
+
>
|
|
20
|
+
Text
|
|
21
|
+
</CLoadingButton>,
|
|
22
|
+
)
|
|
23
|
+
expect(container).toMatchSnapshot()
|
|
24
|
+
expect(container.firstChild).toHaveClass('btn-loading')
|
|
25
|
+
expect(container.firstChild).toHaveClass('is-loading')
|
|
26
|
+
expect(container.firstChild).toHaveClass('bazinga')
|
|
27
|
+
expect(container.firstChild).toHaveAttribute('disabled', '')
|
|
28
|
+
expect(container.firstChild).toHaveTextContent('Text')
|
|
29
|
+
if (container.firstChild === null) {
|
|
30
|
+
expect(true).toBe(false)
|
|
31
|
+
} else {
|
|
32
|
+
expect(container.firstChild.firstChild).toHaveClass('btn-loading-spinner')
|
|
33
|
+
expect(container.firstChild.firstChild).toHaveClass('spinner-grow')
|
|
34
|
+
expect(container.firstChild.firstChild).toHaveClass('spinner-grow-sm')
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
test('CLoadingButton test event on click', async () => {
|
|
39
|
+
const onClick = jest.fn()
|
|
40
|
+
render(<CLoadingButton onClick={onClick}>Text</CLoadingButton>)
|
|
41
|
+
expect(onClick).toHaveBeenCalledTimes(0)
|
|
42
|
+
const button = document.querySelector('.btn-loading')
|
|
43
|
+
if (button !== null) {
|
|
44
|
+
fireEvent.click(button)
|
|
45
|
+
}
|
|
46
|
+
expect(onClick).toHaveBeenCalledTimes(1)
|
|
47
|
+
})
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`CLoadingButton customize 1`] = `
|
|
4
|
+
<div>
|
|
5
|
+
<button
|
|
6
|
+
class="btn btn-primary btn-loading is-loading bazinga disabled"
|
|
7
|
+
disabled=""
|
|
8
|
+
type="button"
|
|
9
|
+
>
|
|
10
|
+
<div
|
|
11
|
+
class="spinner-grow text-undefined spinner-grow-sm btn-loading-spinner"
|
|
12
|
+
role="status"
|
|
13
|
+
>
|
|
14
|
+
<span
|
|
15
|
+
class="visually-hidden"
|
|
16
|
+
>
|
|
17
|
+
Loading...
|
|
18
|
+
</span>
|
|
19
|
+
</div>
|
|
20
|
+
Text
|
|
21
|
+
</button>
|
|
22
|
+
</div>
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
exports[`loads and displays CLoadingButton component 1`] = `
|
|
26
|
+
<div>
|
|
27
|
+
<button
|
|
28
|
+
class="btn btn-primary btn-loading"
|
|
29
|
+
type="button"
|
|
30
|
+
>
|
|
31
|
+
<div
|
|
32
|
+
class="spinner-border text-undefined spinner-border-sm btn-loading-spinner"
|
|
33
|
+
role="status"
|
|
34
|
+
>
|
|
35
|
+
<span
|
|
36
|
+
class="visually-hidden"
|
|
37
|
+
>
|
|
38
|
+
Loading...
|
|
39
|
+
</span>
|
|
40
|
+
</div>
|
|
41
|
+
</button>
|
|
42
|
+
</div>
|
|
43
|
+
`;
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
createContext,
|
|
3
|
+
forwardRef,
|
|
4
|
+
HTMLAttributes,
|
|
5
|
+
useCallback,
|
|
6
|
+
useEffect,
|
|
7
|
+
useLayoutEffect,
|
|
8
|
+
useRef,
|
|
9
|
+
useState,
|
|
10
|
+
} from 'react'
|
|
11
|
+
import { createPortal } from 'react-dom'
|
|
12
|
+
import PropTypes from 'prop-types'
|
|
13
|
+
import classNames from 'classnames'
|
|
14
|
+
import { CSSTransition } from 'react-transition-group'
|
|
15
|
+
|
|
16
|
+
import { useForkedRef } from '../../utils/hooks'
|
|
17
|
+
|
|
18
|
+
import { CBackdrop } from '../backdrop/CBackdrop'
|
|
19
|
+
import { CModalContent } from './CModalContent'
|
|
20
|
+
import { CModalDialog } from './CModalDialog'
|
|
21
|
+
|
|
22
|
+
export interface CModalProps extends HTMLAttributes<HTMLDivElement> {
|
|
23
|
+
/**
|
|
24
|
+
* Align the modal in the center or top of the screen. [docs]
|
|
25
|
+
*
|
|
26
|
+
* @default 'top'
|
|
27
|
+
*/
|
|
28
|
+
alignment?: 'top' | 'center'
|
|
29
|
+
/**
|
|
30
|
+
* Apply a backdrop on body while modal is open. [docs]
|
|
31
|
+
* @default true
|
|
32
|
+
*/
|
|
33
|
+
backdrop?: boolean | 'static'
|
|
34
|
+
/**
|
|
35
|
+
* A string of all className you want applied to the base component. [docs]
|
|
36
|
+
*/
|
|
37
|
+
className?: string
|
|
38
|
+
/**
|
|
39
|
+
* @ignore
|
|
40
|
+
*/
|
|
41
|
+
duration?: number
|
|
42
|
+
/**
|
|
43
|
+
* Set modal to covers the entire user viewport. [docs]
|
|
44
|
+
*/
|
|
45
|
+
fullscreen?: boolean | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'
|
|
46
|
+
/**
|
|
47
|
+
* Closes the modal when escape key is pressed. [docs]
|
|
48
|
+
* @default true
|
|
49
|
+
*/
|
|
50
|
+
keyboard?: boolean
|
|
51
|
+
/**
|
|
52
|
+
* Method called before the dissmiss animation has started. [docs]
|
|
53
|
+
*/
|
|
54
|
+
onDismiss?: () => void
|
|
55
|
+
/**
|
|
56
|
+
* Generates modal using createPortal. [docs]
|
|
57
|
+
*/
|
|
58
|
+
portal?: boolean
|
|
59
|
+
/**
|
|
60
|
+
* Create a scrollable modal that allows scrolling the modal body. [docs]
|
|
61
|
+
*/
|
|
62
|
+
scrollable?: boolean
|
|
63
|
+
/**
|
|
64
|
+
* Size the component small, large, or extra large. [docs]
|
|
65
|
+
*/
|
|
66
|
+
size?: 'sm' | 'lg' | 'xl'
|
|
67
|
+
/**
|
|
68
|
+
* Remove animation to create modal that simply appear rather than fade in to view. [docs]
|
|
69
|
+
*/
|
|
70
|
+
transition?: boolean
|
|
71
|
+
/**
|
|
72
|
+
* Toggle the visibility of modal component. [docs]
|
|
73
|
+
*/
|
|
74
|
+
visible?: boolean
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
interface ModalContextProps {
|
|
78
|
+
visible?: boolean
|
|
79
|
+
setVisible: React.Dispatch<React.SetStateAction<boolean | undefined>>
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export const CModalContext = createContext({} as ModalContextProps)
|
|
83
|
+
|
|
84
|
+
export const CModal = forwardRef<HTMLDivElement, CModalProps>(
|
|
85
|
+
(
|
|
86
|
+
{
|
|
87
|
+
children,
|
|
88
|
+
alignment,
|
|
89
|
+
backdrop = true,
|
|
90
|
+
className,
|
|
91
|
+
duration = 150,
|
|
92
|
+
fullscreen,
|
|
93
|
+
keyboard = true,
|
|
94
|
+
onDismiss,
|
|
95
|
+
portal = true,
|
|
96
|
+
scrollable,
|
|
97
|
+
size,
|
|
98
|
+
transition = true,
|
|
99
|
+
visible,
|
|
100
|
+
},
|
|
101
|
+
ref,
|
|
102
|
+
) => {
|
|
103
|
+
const modalRef = useRef<HTMLDivElement>(null)
|
|
104
|
+
const forkedRef = useForkedRef(ref, modalRef)
|
|
105
|
+
|
|
106
|
+
const [_visible, setVisible] = useState(visible)
|
|
107
|
+
const [staticBackdrop, setStaticBackdrop] = useState(false)
|
|
108
|
+
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
setVisible(visible)
|
|
111
|
+
}, [visible])
|
|
112
|
+
|
|
113
|
+
const contextValues = {
|
|
114
|
+
visible: _visible,
|
|
115
|
+
setVisible,
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const handleDismiss = () => {
|
|
119
|
+
if (backdrop === 'static') {
|
|
120
|
+
return setStaticBackdrop(true)
|
|
121
|
+
}
|
|
122
|
+
return onDismiss && onDismiss()
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
useLayoutEffect(() => {
|
|
126
|
+
setTimeout(() => setStaticBackdrop(false), duration)
|
|
127
|
+
}, [staticBackdrop])
|
|
128
|
+
|
|
129
|
+
const getTransitionClass = (state: string) => {
|
|
130
|
+
return state === 'entering'
|
|
131
|
+
? 'd-block'
|
|
132
|
+
: state === 'entered'
|
|
133
|
+
? 'show d-block'
|
|
134
|
+
: state === 'exiting'
|
|
135
|
+
? 'd-block'
|
|
136
|
+
: ''
|
|
137
|
+
}
|
|
138
|
+
const _className = classNames(
|
|
139
|
+
'modal',
|
|
140
|
+
{
|
|
141
|
+
'modal-static': staticBackdrop,
|
|
142
|
+
fade: transition,
|
|
143
|
+
},
|
|
144
|
+
className,
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
// Set focus to modal after open
|
|
148
|
+
useLayoutEffect(() => {
|
|
149
|
+
if (_visible) {
|
|
150
|
+
document.body.classList.add('modal-open')
|
|
151
|
+
setTimeout(
|
|
152
|
+
() => {
|
|
153
|
+
modalRef.current?.focus()
|
|
154
|
+
},
|
|
155
|
+
!transition ? 0 : duration,
|
|
156
|
+
)
|
|
157
|
+
} else {
|
|
158
|
+
document.body.classList.remove('modal-open')
|
|
159
|
+
}
|
|
160
|
+
return () => document.body.classList.remove('modal-open')
|
|
161
|
+
}, [_visible])
|
|
162
|
+
|
|
163
|
+
const handleKeyDown = useCallback(
|
|
164
|
+
(event) => {
|
|
165
|
+
if (event.key === 'Escape' && keyboard) {
|
|
166
|
+
return handleDismiss()
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
[modalRef, handleDismiss],
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
const modal = (ref?: React.Ref<HTMLDivElement>, transitionClass?: string) => {
|
|
173
|
+
return (
|
|
174
|
+
<CModalContext.Provider value={contextValues}>
|
|
175
|
+
<div
|
|
176
|
+
className={classNames(_className, transitionClass)}
|
|
177
|
+
tabIndex={-1}
|
|
178
|
+
role="dialog"
|
|
179
|
+
ref={ref}
|
|
180
|
+
>
|
|
181
|
+
<CModalDialog
|
|
182
|
+
alignment={alignment}
|
|
183
|
+
fullscreen={fullscreen}
|
|
184
|
+
scrollable={scrollable}
|
|
185
|
+
size={size}
|
|
186
|
+
onClick={(event) => event.stopPropagation()}
|
|
187
|
+
>
|
|
188
|
+
<CModalContent>{children}</CModalContent>
|
|
189
|
+
</CModalDialog>
|
|
190
|
+
</div>
|
|
191
|
+
</CModalContext.Provider>
|
|
192
|
+
)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return (
|
|
196
|
+
<>
|
|
197
|
+
<div onClick={handleDismiss} onKeyDown={handleKeyDown}>
|
|
198
|
+
<CSSTransition
|
|
199
|
+
in={_visible}
|
|
200
|
+
timeout={!transition ? 0 : duration}
|
|
201
|
+
onExit={onDismiss}
|
|
202
|
+
mountOnEnter
|
|
203
|
+
unmountOnExit
|
|
204
|
+
>
|
|
205
|
+
{(state) => {
|
|
206
|
+
const transitionClass = getTransitionClass(state)
|
|
207
|
+
return typeof window !== 'undefined' && portal
|
|
208
|
+
? createPortal(modal(forkedRef, transitionClass), document.body)
|
|
209
|
+
: modal(forkedRef, transitionClass)
|
|
210
|
+
}}
|
|
211
|
+
</CSSTransition>
|
|
212
|
+
</div>
|
|
213
|
+
{typeof window !== 'undefined' && portal
|
|
214
|
+
? backdrop && createPortal(<CBackdrop visible={_visible} />, document.body)
|
|
215
|
+
: backdrop && <CBackdrop visible={_visible} />}
|
|
216
|
+
</>
|
|
217
|
+
)
|
|
218
|
+
},
|
|
219
|
+
)
|
|
220
|
+
|
|
221
|
+
CModal.propTypes = {
|
|
222
|
+
alignment: PropTypes.oneOf(['top', 'center']),
|
|
223
|
+
backdrop: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf<'static'>(['static'])]),
|
|
224
|
+
children: PropTypes.node,
|
|
225
|
+
className: PropTypes.string,
|
|
226
|
+
duration: PropTypes.number,
|
|
227
|
+
fullscreen: PropTypes.oneOfType([
|
|
228
|
+
PropTypes.bool,
|
|
229
|
+
PropTypes.oneOf<'sm' | 'md' | 'lg' | 'xl' | 'xxl'>(['sm', 'md', 'lg', 'xl', 'xxl']),
|
|
230
|
+
]),
|
|
231
|
+
keyboard: PropTypes.bool,
|
|
232
|
+
onDismiss: PropTypes.func,
|
|
233
|
+
portal: PropTypes.bool,
|
|
234
|
+
scrollable: PropTypes.bool,
|
|
235
|
+
size: PropTypes.oneOf(['sm', 'lg', 'xl']),
|
|
236
|
+
transition: PropTypes.bool,
|
|
237
|
+
visible: PropTypes.bool,
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
CModal.displayName = 'CModal'
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React, { forwardRef, HTMLAttributes } from 'react'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
3
|
+
import classNames from 'classnames'
|
|
4
|
+
|
|
5
|
+
export interface CModalBodyProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
/**
|
|
7
|
+
* A string of all className you want applied to the base component. [docs]
|
|
8
|
+
*/
|
|
9
|
+
className?: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const CModalBody = forwardRef<HTMLDivElement, CModalBodyProps>(
|
|
13
|
+
({ children, className, ...rest }, ref) => {
|
|
14
|
+
const _className = classNames('modal-body', className)
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<div className={_className} {...rest} ref={ref}>
|
|
18
|
+
{children}
|
|
19
|
+
</div>
|
|
20
|
+
)
|
|
21
|
+
},
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
CModalBody.propTypes = {
|
|
25
|
+
children: PropTypes.node,
|
|
26
|
+
className: PropTypes.string,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
CModalBody.displayName = 'CModalBody'
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React, { forwardRef, HTMLAttributes } from 'react'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
3
|
+
import classNames from 'classnames'
|
|
4
|
+
|
|
5
|
+
export interface CModalContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
/**
|
|
7
|
+
* A string of all className you want applied to the base component. [docs]
|
|
8
|
+
*/
|
|
9
|
+
className?: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const CModalContent = forwardRef<HTMLDivElement, CModalContentProps>(
|
|
13
|
+
({ children, className, ...rest }, ref) => {
|
|
14
|
+
const _className = classNames('modal-content', className)
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<div className={_className} {...rest} ref={ref}>
|
|
18
|
+
{children}
|
|
19
|
+
</div>
|
|
20
|
+
)
|
|
21
|
+
},
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
CModalContent.propTypes = {
|
|
25
|
+
children: PropTypes.node,
|
|
26
|
+
className: PropTypes.string,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
CModalContent.displayName = 'CModalContent'
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React, { forwardRef, HTMLAttributes } from 'react'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
3
|
+
import classNames from 'classnames'
|
|
4
|
+
|
|
5
|
+
export interface CModalDialogProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
/**
|
|
7
|
+
* Align the modal in the center or top of the screen. [docs]
|
|
8
|
+
*
|
|
9
|
+
* @default 'top'
|
|
10
|
+
*/
|
|
11
|
+
alignment?: 'top' | 'center'
|
|
12
|
+
/**
|
|
13
|
+
* A string of all className you want applied to the base component. [docs]
|
|
14
|
+
*/
|
|
15
|
+
className?: string
|
|
16
|
+
/**
|
|
17
|
+
* Set modal to covers the entire user viewport. [docs]
|
|
18
|
+
*/
|
|
19
|
+
fullscreen?: boolean | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'
|
|
20
|
+
/**
|
|
21
|
+
* Does the modal dialog itself scroll, or does the whole dialog scroll within the window. [docs]
|
|
22
|
+
*/
|
|
23
|
+
scrollable?: boolean
|
|
24
|
+
/**
|
|
25
|
+
* Size the component small, large, or extra large. [docs]
|
|
26
|
+
*/
|
|
27
|
+
size?: 'sm' | 'lg' | 'xl'
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const CModalDialog = forwardRef<HTMLDivElement, CModalDialogProps>(
|
|
31
|
+
({ children, alignment, className, fullscreen, scrollable, size, ...rest }, ref) => {
|
|
32
|
+
const _className = classNames(
|
|
33
|
+
'modal-dialog',
|
|
34
|
+
{
|
|
35
|
+
'modal-dialog-centered': alignment === 'center',
|
|
36
|
+
[typeof fullscreen === 'boolean'
|
|
37
|
+
? 'modal-fullscreen'
|
|
38
|
+
: `modal-fullscreen-${fullscreen}-down`]: fullscreen,
|
|
39
|
+
'modal-dialog-scrollable': scrollable,
|
|
40
|
+
[`modal-${size}`]: size,
|
|
41
|
+
},
|
|
42
|
+
className,
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<div className={_className} {...rest} ref={ref}>
|
|
47
|
+
{children}
|
|
48
|
+
</div>
|
|
49
|
+
)
|
|
50
|
+
},
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
CModalDialog.propTypes = {
|
|
54
|
+
alignment: PropTypes.oneOf(['top', 'center']),
|
|
55
|
+
children: PropTypes.node,
|
|
56
|
+
className: PropTypes.string,
|
|
57
|
+
fullscreen: PropTypes.oneOfType([
|
|
58
|
+
PropTypes.bool,
|
|
59
|
+
PropTypes.oneOf<'sm' | 'md' | 'lg' | 'xl' | 'xxl'>(['sm', 'md', 'lg', 'xl', 'xxl']),
|
|
60
|
+
]),
|
|
61
|
+
scrollable: PropTypes.bool,
|
|
62
|
+
size: PropTypes.oneOf(['sm', 'lg', 'xl']),
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
CModalDialog.displayName = 'CModalDialog'
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React, { forwardRef, HTMLAttributes } from 'react'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
3
|
+
import classNames from 'classnames'
|
|
4
|
+
|
|
5
|
+
export interface CModalFooterProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
/**
|
|
7
|
+
* A string of all className you want applied to the base component. [docs]
|
|
8
|
+
*/
|
|
9
|
+
className?: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const CModalFooter = forwardRef<HTMLDivElement, CModalFooterProps>(
|
|
13
|
+
({ children, className, ...rest }, ref) => {
|
|
14
|
+
const _className = classNames('modal-footer', className)
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<div className={_className} {...rest} ref={ref}>
|
|
18
|
+
{children}
|
|
19
|
+
</div>
|
|
20
|
+
)
|
|
21
|
+
},
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
CModalFooter.propTypes = {
|
|
25
|
+
children: PropTypes.node,
|
|
26
|
+
className: PropTypes.string,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
CModalFooter.displayName = 'CModalFooter'
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React, { forwardRef, HTMLAttributes, useContext } from 'react'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
3
|
+
import { CModalContext } from './CModal'
|
|
4
|
+
import { CCloseButton } from '../close-button/CCloseButton'
|
|
5
|
+
import classNames from 'classnames'
|
|
6
|
+
|
|
7
|
+
export interface CModalHeaderProps extends HTMLAttributes<HTMLDivElement> {
|
|
8
|
+
/**
|
|
9
|
+
* A string of all className you want applied to the base component. [docs]
|
|
10
|
+
*/
|
|
11
|
+
className?: string
|
|
12
|
+
/**
|
|
13
|
+
* Add a close button component to the header. [docs]
|
|
14
|
+
*
|
|
15
|
+
* @default true
|
|
16
|
+
*/
|
|
17
|
+
closeButton?: boolean
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const CModalHeader = forwardRef<HTMLDivElement, CModalHeaderProps>(
|
|
21
|
+
({ children, className, closeButton = true, ...rest }, ref) => {
|
|
22
|
+
const { setVisible } = useContext(CModalContext)
|
|
23
|
+
const _className = classNames('modal-header', className)
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div className={_className} {...rest} ref={ref}>
|
|
27
|
+
{children}
|
|
28
|
+
{closeButton && <CCloseButton onClick={() => setVisible(false)} />}
|
|
29
|
+
</div>
|
|
30
|
+
)
|
|
31
|
+
},
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
CModalHeader.propTypes = {
|
|
35
|
+
children: PropTypes.node,
|
|
36
|
+
className: PropTypes.string,
|
|
37
|
+
closeButton: PropTypes.bool,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
CModalHeader.displayName = 'CModalHeader'
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React, { ElementType, forwardRef, HTMLAttributes } from 'react'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
3
|
+
import classNames from 'classnames'
|
|
4
|
+
|
|
5
|
+
export interface CModalTitleProps extends HTMLAttributes<HTMLHeadingElement> {
|
|
6
|
+
/**
|
|
7
|
+
* A string of all className you want applied to the base component. [docs]
|
|
8
|
+
*/
|
|
9
|
+
className?: string
|
|
10
|
+
/**
|
|
11
|
+
* Component used for the root node. Either a string to use a HTML element or a component. [docs]
|
|
12
|
+
*
|
|
13
|
+
* @default 'h5'
|
|
14
|
+
*/
|
|
15
|
+
component?: string | ElementType
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const CModalTitle = forwardRef<HTMLHeadElement, CModalTitleProps>(
|
|
19
|
+
({ children, component: Component = 'h5', className, ...rest }, ref) => {
|
|
20
|
+
const _className = classNames('modal-title', className)
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Component className={_className} {...rest} ref={ref}>
|
|
24
|
+
{children}
|
|
25
|
+
</Component>
|
|
26
|
+
)
|
|
27
|
+
},
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
CModalTitle.propTypes = {
|
|
31
|
+
children: PropTypes.node,
|
|
32
|
+
className: PropTypes.string,
|
|
33
|
+
component: PropTypes.elementType,
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
CModalTitle.displayName = 'CModalTitle'
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { render, fireEvent } from '@testing-library/react'
|
|
3
|
+
import '@testing-library/jest-dom/extend-expect'
|
|
4
|
+
import { CModal } from '../../../index'
|
|
5
|
+
|
|
6
|
+
test('loads and displays CModal component', async () => {
|
|
7
|
+
const { container } = render(<CModal portal={false}>Test</CModal>)
|
|
8
|
+
expect(container).toMatchSnapshot()
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
test('CModal customize', async () => {
|
|
12
|
+
const { container } = render(
|
|
13
|
+
<CModal
|
|
14
|
+
alignment="center"
|
|
15
|
+
className="bazinga"
|
|
16
|
+
duration={100}
|
|
17
|
+
fullscreen="xl"
|
|
18
|
+
scrollable={true}
|
|
19
|
+
size="xl"
|
|
20
|
+
visible={true}
|
|
21
|
+
>
|
|
22
|
+
Test
|
|
23
|
+
</CModal>,
|
|
24
|
+
)
|
|
25
|
+
expect(container).toMatchSnapshot()
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
test('CModal dialog close on press ESC', async () => {
|
|
29
|
+
jest.useFakeTimers()
|
|
30
|
+
const onDismiss = jest.fn()
|
|
31
|
+
render(
|
|
32
|
+
<CModal onDismiss={onDismiss} portal={false} visible>
|
|
33
|
+
Test
|
|
34
|
+
</CModal>,
|
|
35
|
+
)
|
|
36
|
+
expect(onDismiss).toHaveBeenCalledTimes(0)
|
|
37
|
+
const modal = document.querySelector('.modal')
|
|
38
|
+
if (modal !== null) {
|
|
39
|
+
fireEvent.keyDown(modal, {
|
|
40
|
+
key: 'Escape',
|
|
41
|
+
code: 'Escape',
|
|
42
|
+
keyCode: 27,
|
|
43
|
+
charCode: 27,
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
jest.runAllTimers()
|
|
47
|
+
expect(onDismiss).toHaveBeenCalledTimes(1)
|
|
48
|
+
jest.useRealTimers()
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
// test('CModal dialog close on backdrop', async () => {
|
|
52
|
+
// jest.useFakeTimers()
|
|
53
|
+
// const onDismiss = jest.fn()
|
|
54
|
+
// render(
|
|
55
|
+
// <CModal onDismiss={onDismiss} portal={false} visible={true}>
|
|
56
|
+
// Test
|
|
57
|
+
// </CModal>,
|
|
58
|
+
// )
|
|
59
|
+
// expect(onDismiss).toHaveBeenCalledTimes(0)
|
|
60
|
+
// const backdrop = document.querySelector('.modal-backdrop')
|
|
61
|
+
// if (backdrop !== null) {
|
|
62
|
+
// fireEvent.click(backdrop)
|
|
63
|
+
// }
|
|
64
|
+
// jest.runAllTimers()
|
|
65
|
+
// expect(onDismiss).toHaveBeenCalledTimes(1)
|
|
66
|
+
// jest.useRealTimers()
|
|
67
|
+
// })
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { render } from '@testing-library/react'
|
|
3
|
+
import '@testing-library/jest-dom/extend-expect'
|
|
4
|
+
import { CModalBody } from '../../../index'
|
|
5
|
+
|
|
6
|
+
test('loads and displays CModalBody component', async () => {
|
|
7
|
+
const { container } = render(<CModalBody>Test</CModalBody>)
|
|
8
|
+
expect(container).toMatchSnapshot()
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
test('CModalBody customize', async () => {
|
|
12
|
+
const { container } = render(<CModalBody className="bazinga">Test</CModalBody>)
|
|
13
|
+
expect(container).toMatchSnapshot()
|
|
14
|
+
expect(container.firstChild).toHaveClass('bazinga')
|
|
15
|
+
expect(container.firstChild).toHaveClass('modal-body')
|
|
16
|
+
})
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { render } from '@testing-library/react'
|
|
3
|
+
import '@testing-library/jest-dom/extend-expect'
|
|
4
|
+
import { CModalContent } from '../../../index'
|
|
5
|
+
|
|
6
|
+
test('loads and displays CModalContent component', async () => {
|
|
7
|
+
const { container } = render(<CModalContent>Test</CModalContent>)
|
|
8
|
+
expect(container).toMatchSnapshot()
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
test('CModalContent customize', async () => {
|
|
12
|
+
const { container } = render(<CModalContent className="bazinga">Test</CModalContent>)
|
|
13
|
+
expect(container).toMatchSnapshot()
|
|
14
|
+
expect(container.firstChild).toHaveClass('bazinga')
|
|
15
|
+
expect(container.firstChild).toHaveClass('modal-content')
|
|
16
|
+
})
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { render } from '@testing-library/react'
|
|
3
|
+
import '@testing-library/jest-dom/extend-expect'
|
|
4
|
+
import { CModalDialog } from '../../../index'
|
|
5
|
+
|
|
6
|
+
test('loads and displays CModalDialog component', async () => {
|
|
7
|
+
const { container } = render(<CModalDialog>Test</CModalDialog>)
|
|
8
|
+
expect(container).toMatchSnapshot()
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
test('CModalDialog customize', async () => {
|
|
12
|
+
const { container } = render(
|
|
13
|
+
<CModalDialog
|
|
14
|
+
className="bazinga"
|
|
15
|
+
alignment="center"
|
|
16
|
+
fullscreen="lg"
|
|
17
|
+
scrollable={true}
|
|
18
|
+
size="xl"
|
|
19
|
+
>
|
|
20
|
+
Test
|
|
21
|
+
</CModalDialog>,
|
|
22
|
+
)
|
|
23
|
+
expect(container).toMatchSnapshot()
|
|
24
|
+
expect(container.firstChild).toHaveClass('bazinga')
|
|
25
|
+
expect(container.firstChild).toHaveClass('modal-dialog')
|
|
26
|
+
expect(container.firstChild).toHaveClass('modal-dialog-centered')
|
|
27
|
+
expect(container.firstChild).toHaveClass('modal-fullscreen-lg-down')
|
|
28
|
+
expect(container.firstChild).toHaveClass('modal-dialog-scrollable')
|
|
29
|
+
expect(container.firstChild).toHaveClass('modal-xl')
|
|
30
|
+
})
|