@coreui/react-pro 4.9.0-next.0 → 4.9.0
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/README.md +1 -1
- package/dist/components/alert/CAlert.d.ts +1 -1
- package/dist/components/avatar/CAvatar.d.ts +1 -1
- package/dist/components/badge/CBadge.d.ts +1 -1
- package/dist/components/button/CButton.d.ts +1 -1
- package/dist/components/calendar/utils.d.ts +0 -1
- package/dist/components/callout/CCallout.d.ts +1 -1
- package/dist/components/card/CCard.d.ts +1 -1
- package/dist/components/conditional-portal/CConditionalPortal.d.ts +12 -0
- package/dist/components/conditional-portal/index.d.ts +2 -0
- package/dist/components/date-range-picker/CDateRangePicker.d.ts +1 -1
- package/dist/components/date-range-picker/utils.d.ts +1 -0
- package/dist/components/dropdown/CDropdown.d.ts +1 -1
- package/dist/components/dropdown/CDropdownToggle.d.ts +1 -1
- package/dist/components/form/CFormCheck.d.ts +8 -2
- package/dist/components/form/CFormSwitch.d.ts +6 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/list-group/CListGroupItem.d.ts +4 -5
- package/dist/components/multi-select/CMultiSelect.d.ts +1 -13
- package/dist/components/multi-select/CMultiSelectNativeSelect.d.ts +1 -1
- package/dist/components/multi-select/CMultiSelectOptions.d.ts +1 -1
- package/dist/components/multi-select/CMultiSelectSelection.d.ts +1 -1
- package/dist/components/multi-select/types.d.ts +14 -0
- package/dist/components/multi-select/utils.d.ts +6 -0
- package/dist/components/navbar/CNavbar.d.ts +1 -1
- package/dist/components/picker/CPicker.d.ts +1 -1
- package/dist/components/placeholder/CPlaceholder.d.ts +1 -1
- package/dist/components/popover/CPopover.d.ts +1 -1
- package/dist/components/progress/CProgressBar.d.ts +1 -1
- package/dist/components/smart-table/CSmartTableHead.d.ts +1 -1
- package/dist/components/smart-table/CSmartTableInterface.d.ts +8 -0
- package/dist/components/smart-table/types.d.ts +1 -1
- package/dist/components/spinner/CSpinner.d.ts +1 -1
- package/dist/components/table/CTable.d.ts +2 -18
- package/dist/components/table/CTableBody.d.ts +1 -1
- package/dist/components/table/CTableDataCell.d.ts +1 -1
- package/dist/components/table/CTableFoot.d.ts +1 -1
- package/dist/components/table/CTableHead.d.ts +1 -1
- package/dist/components/table/CTableHeaderCell.d.ts +1 -1
- package/dist/components/table/CTableResponsiveWrapper.d.ts +0 -1
- package/dist/components/table/CTableRow.d.ts +1 -1
- package/dist/components/table/types.d.ts +17 -0
- package/dist/components/table/utils.d.ts +5 -0
- package/dist/components/toast/CToast.d.ts +1 -1
- package/dist/components/toast/CToastClose.d.ts +1 -1
- package/dist/components/tooltip/CTooltip.d.ts +1 -1
- package/dist/components/virtual-scroller/CVirtualScroller.d.ts +0 -8
- package/dist/components/widgets/CWidgetStatsA.d.ts +1 -1
- package/dist/components/widgets/CWidgetStatsB.d.ts +1 -1
- package/dist/components/widgets/CWidgetStatsC.d.ts +1 -1
- package/dist/components/widgets/CWidgetStatsD.d.ts +1 -1
- package/dist/components/widgets/CWidgetStatsF.d.ts +1 -1
- package/dist/index.es.js +696 -927
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +695 -925
- package/dist/index.js.map +1 -1
- package/dist/props.d.ts +8 -0
- package/dist/types.d.ts +7 -0
- package/dist/utils/index.d.ts +1 -3
- package/package.json +11 -6
- package/src/components/accordion/CAccordion.tsx +7 -3
- package/src/components/accordion/CAccordionBody.tsx +2 -2
- package/src/components/accordion/CAccordionButton.tsx +1 -3
- package/src/components/accordion/CAccordionCollapse.tsx +1 -0
- package/src/components/accordion/CAccordionHeader.tsx +1 -3
- package/src/components/accordion/CAccordionItem.tsx +2 -4
- package/src/components/accordion/__tests__/__snapshots__/CAccordionBody.spec.tsx.snap +2 -2
- package/src/components/alert/CAlert.tsx +21 -28
- package/src/components/alert/CAlertHeading.tsx +1 -3
- package/src/components/alert/CAlertLink.tsx +1 -3
- package/src/components/alert/__tests__/__snapshots__/CAlert.spec.tsx.snap +1 -1
- package/src/components/avatar/CAvatar.tsx +16 -19
- package/src/components/backdrop/CBackdrop.tsx +10 -13
- package/src/components/badge/CBadge.tsx +21 -27
- package/src/components/breadcrumb/CBreadcrumb.tsx +1 -2
- package/src/components/breadcrumb/CBreadcrumbItem.tsx +12 -8
- package/src/components/button/CButton.tsx +10 -10
- package/src/components/button-group/CButtonGroup.tsx +9 -7
- package/src/components/button-group/CButtonToolbar.tsx +1 -3
- package/src/components/calendar/utils.ts +7 -55
- package/src/components/callout/CCallout.tsx +13 -10
- package/src/components/card/CCard.tsx +14 -11
- package/src/components/card/CCardBody.tsx +1 -3
- package/src/components/card/CCardFooter.tsx +1 -3
- package/src/components/card/CCardGroup.tsx +1 -3
- package/src/components/card/CCardHeader.tsx +1 -3
- package/src/components/card/CCardImage.tsx +5 -3
- package/src/components/card/CCardImageOverlay.tsx +1 -3
- package/src/components/card/CCardLink.tsx +1 -3
- package/src/components/card/CCardSubtitle.tsx +1 -3
- package/src/components/card/CCardText.tsx +1 -3
- package/src/components/card/CCardTitle.tsx +1 -3
- package/src/components/carousel/CCarousel.tsx +8 -8
- package/src/components/carousel/CCarouselCaption.tsx +1 -3
- package/src/components/carousel/CCarouselItem.tsx +11 -9
- package/src/components/close-button/CCloseButton.tsx +9 -10
- package/src/components/collapse/CCollapse.tsx +8 -20
- package/src/components/collapse/__tests__/CCollapse.spec.tsx +2 -3
- package/src/components/conditional-portal/CConditionalPortal.tsx +29 -0
- package/src/components/conditional-portal/index.ts +3 -0
- package/src/components/date-range-picker/CDateRangePicker.tsx +11 -13
- package/src/components/date-range-picker/utils.ts +49 -0
- package/src/components/dropdown/CDropdown.tsx +26 -23
- package/src/components/dropdown/CDropdownDivider.tsx +1 -3
- package/src/components/dropdown/CDropdownHeader.tsx +1 -3
- package/src/components/dropdown/CDropdownItem.tsx +7 -5
- package/src/components/dropdown/CDropdownItemPlain.tsx +1 -3
- package/src/components/dropdown/CDropdownMenu.tsx +29 -32
- package/src/components/dropdown/CDropdownToggle.tsx +34 -27
- package/src/components/dropdown/__tests__/CDropdown.spec.tsx +2 -4
- package/src/components/dropdown/__tests__/__snapshots__/CDropdown.spec.tsx.snap +1 -1
- package/src/components/footer/CFooter.tsx +5 -3
- package/src/components/form/CForm.tsx +5 -2
- package/src/components/form/CFormCheck.tsx +90 -66
- package/src/components/form/CFormControlValidation.tsx +0 -1
- package/src/components/form/CFormControlWrapper.tsx +3 -4
- package/src/components/form/CFormFeedback.tsx +11 -8
- package/src/components/form/CFormFloating.tsx +1 -2
- package/src/components/form/CFormInput.tsx +18 -16
- package/src/components/form/CFormLabel.tsx +1 -2
- package/src/components/form/CFormRange.tsx +2 -4
- package/src/components/form/CFormSelect.tsx +16 -12
- package/src/components/form/CFormSwitch.tsx +31 -20
- package/src/components/form/CFormText.tsx +1 -2
- package/src/components/form/CFormTextarea.tsx +14 -11
- package/src/components/form/CInputGroup.tsx +11 -8
- package/src/components/form/CInputGroupText.tsx +1 -2
- package/src/components/form/__tests__/CFormRange.spec.tsx +1 -1
- package/src/components/form/__tests__/__snapshots__/CForm.spec.tsx.snap +2 -6
- package/src/components/form/__tests__/__snapshots__/CFormRange.spec.tsx.snap +2 -2
- package/src/components/grid/CCol.tsx +8 -6
- package/src/components/grid/CContainer.tsx +8 -6
- package/src/components/grid/CRow.tsx +4 -3
- package/src/components/header/CHeader.tsx +12 -13
- package/src/components/header/CHeaderBrand.tsx +1 -3
- package/src/components/header/CHeaderBrand.tsx~HEAD +1 -3
- package/src/components/header/CHeaderDivider.tsx +1 -3
- package/src/components/header/CHeaderNav.tsx +6 -3
- package/src/components/header/CHeaderText.tsx +1 -3
- package/src/components/header/CHeaderToggler.tsx +2 -4
- package/src/components/image/CImage.tsx +17 -10
- package/src/components/image/__tests__/__snapshots__/CImage.spec.tsx.snap +1 -3
- package/src/components/index.ts +1 -0
- package/src/components/link/CLink.tsx +2 -4
- package/src/components/list-group/CListGroup.tsx +11 -10
- package/src/components/list-group/CListGroupItem.tsx +21 -20
- package/src/components/list-group/CListGroupItem.tsx~HEAD +3 -1
- package/src/components/loading-button/CLoadingButton.tsx +1 -3
- package/src/components/modal/CModal.tsx +57 -72
- package/src/components/modal/CModalBody.tsx +1 -3
- package/src/components/modal/CModalContent.tsx +1 -3
- package/src/components/modal/CModalDialog.tsx +16 -14
- package/src/components/modal/CModalFooter.tsx +1 -3
- package/src/components/modal/CModalHeader.tsx +4 -4
- package/src/components/modal/CModalTitle.tsx +1 -3
- package/src/components/modal/__tests__/CModal.spec.tsx +19 -20
- package/src/components/multi-select/CMultiSelect.tsx +34 -93
- package/src/components/multi-select/CMultiSelectNativeSelect.tsx +1 -1
- package/src/components/multi-select/CMultiSelectOptions.tsx +2 -2
- package/src/components/multi-select/CMultiSelectSelection.tsx +1 -1
- package/src/components/multi-select/types.ts +15 -0
- package/src/components/multi-select/utils.ts +92 -0
- package/src/components/nav/CNav.tsx +13 -10
- package/src/components/nav/CNavGroup.tsx +1 -3
- package/src/components/nav/CNavGroupItems.tsx +1 -2
- package/src/components/nav/CNavItem.tsx +9 -10
- package/src/components/nav/CNavLink.tsx +4 -5
- package/src/components/nav/CNavTitle.tsx +1 -2
- package/src/components/navbar/CNavbar.tsx +23 -23
- package/src/components/navbar/CNavbarBrand.tsx +2 -3
- package/src/components/navbar/CNavbarNav.tsx +6 -3
- package/src/components/navbar/CNavbarText.tsx +1 -3
- package/src/components/navbar/CNavbarToggler.tsx +2 -4
- package/src/components/offcanvas/COffcanvas.tsx +42 -68
- package/src/components/offcanvas/COffcanvasBody.tsx +1 -3
- package/src/components/offcanvas/COffcanvasHeader.tsx +1 -3
- package/src/components/offcanvas/COffcanvasTitle.tsx +1 -3
- package/src/components/offcanvas/__tests__/COffcanvas.spec.tsx +7 -2
- package/src/components/offcanvas/__tests__/__snapshots__/COffcanvas.spec.tsx.snap +9 -4
- package/src/components/pagination/CPagination.tsx +12 -9
- package/src/components/pagination/CPaginationItem.tsx +12 -11
- package/src/components/pagination/__tests__/CPagination.spec.tsx +3 -3
- package/src/components/pagination/__tests__/CPaginationItem.spec.tsx +3 -3
- package/src/components/picker/CPicker.tsx +7 -7
- package/src/components/placeholder/CPlaceholder.tsx +15 -12
- package/src/components/popover/CPopover.tsx +24 -34
- package/src/components/progress/CProgress.tsx +13 -10
- package/src/components/progress/CProgressBar.tsx +11 -12
- package/src/components/sidebar/CSidebar.tsx +22 -19
- package/src/components/sidebar/CSidebarBrand.tsx +1 -2
- package/src/components/sidebar/CSidebarFooter.tsx +1 -2
- package/src/components/sidebar/CSidebarHeader.tsx +1 -2
- package/src/components/sidebar/CSidebarNav.tsx +2 -2
- package/src/components/sidebar/CSidebarToggler.tsx +1 -2
- package/src/components/smart-pagination/CSmartPagination.tsx +22 -20
- package/src/components/smart-table/CSmartTable.tsx +5 -9
- package/src/components/smart-table/CSmartTableBody.tsx +82 -81
- package/src/components/smart-table/CSmartTableHead.tsx +5 -2
- package/src/components/smart-table/CSmartTableInterface.tsx +8 -0
- package/src/components/smart-table/{utils.tsx → utils.ts} +4 -5
- package/src/components/spinner/CSpinner.tsx +13 -9
- package/src/components/table/CTable.tsx +45 -77
- package/src/components/table/CTableBody.tsx +14 -9
- package/src/components/table/CTableDataCell.tsx +16 -11
- package/src/components/table/CTableFoot.tsx +14 -9
- package/src/components/table/CTableHead.tsx +14 -9
- package/src/components/table/CTableHeaderCell.tsx +14 -9
- package/src/components/table/CTableResponsiveWrapper.tsx +2 -3
- package/src/components/table/CTableRow.tsx +16 -11
- package/src/components/table/__tests__/__snapshots__/CTable.spec.tsx.snap +1 -5
- package/src/components/table/types.ts +20 -0
- package/src/components/table/utils.ts +24 -0
- package/src/components/tabs/CTabContent.tsx +1 -2
- package/src/components/tabs/CTabPane.tsx +18 -20
- package/src/components/tabs/__tests__/CTabPane.spec.tsx +2 -5
- package/src/components/tabs/__tests__/__snapshots__/CTabPane.spec.tsx.snap +1 -1
- package/src/components/time-picker/CTimePicker.tsx +14 -18
- package/src/components/toast/CToast.tsx +32 -45
- package/src/components/toast/CToastBody.tsx +1 -2
- package/src/components/toast/CToastClose.tsx +4 -2
- package/src/components/toast/CToastHeader.tsx +1 -2
- package/src/components/toast/CToaster.tsx +27 -26
- package/src/components/toast/__tests__/CToast.spec.tsx +2 -1
- package/src/components/toast/__tests__/__snapshots__/CToast.spec.tsx.snap +1 -66
- package/src/components/tooltip/CTooltip.tsx +24 -34
- package/src/components/virtual-scroller/CVirtualScroller.tsx +35 -60
- package/src/components/widgets/CWidgetStatsA.tsx +11 -9
- package/src/components/widgets/CWidgetStatsB.tsx +4 -4
- package/src/components/widgets/CWidgetStatsC.tsx +4 -4
- package/src/components/widgets/CWidgetStatsD.tsx +13 -15
- package/src/components/widgets/CWidgetStatsE.tsx +2 -5
- package/src/components/widgets/CWidgetStatsF.tsx +4 -8
- package/src/{components/Types.tsx → props.ts} +1 -68
- package/src/types.ts +68 -0
- package/src/utils/index.ts +1 -3
- package/src/components/multi-select/CMultiSelectCleaner.tsx +0 -18
- package/src/utils/getNextSibling.ts +0 -18
- package/src/utils/getPreviousSibling.ts +0 -18
- package/src/components/smart-table/{types.tsx → types.ts} +1 -1
package/dist/props.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import type { Placements, Triggers } from './types';
|
|
3
|
+
export declare const colorPropType: PropTypes.Requireable<string>;
|
|
4
|
+
export declare const gradientsPropType: PropTypes.Requireable<string>;
|
|
5
|
+
export declare const placementPropType: PropTypes.Requireable<Placements>;
|
|
6
|
+
export declare const shapePropType: PropTypes.Requireable<string>;
|
|
7
|
+
export declare const textColorsPropType: PropTypes.Requireable<string>;
|
|
8
|
+
export declare const triggerPropType: PropTypes.Requireable<Triggers>;
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type Breakpoints = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
|
2
|
+
export type Colors = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light' | string;
|
|
3
|
+
export type Gradients = 'primary-gradient' | 'secondary-gradient' | 'success-gradient' | 'danger-gradient' | 'warning-gradient' | 'info-gradient' | 'dark-gradient' | 'light-gradient';
|
|
4
|
+
export type Placements = 'auto' | 'auto-start' | 'auto-end' | 'top-end' | 'top' | 'top-start' | 'bottom-end' | 'bottom' | 'bottom-start' | 'right-start' | 'right' | 'right-end' | 'left-start' | 'left' | 'left-end' | undefined;
|
|
5
|
+
export type Shapes = 'rounded' | 'rounded-top' | 'rounded-end' | 'rounded-bottom' | 'rounded-start' | 'rounded-circle' | 'rounded-pill' | 'rounded-0' | 'rounded-1' | 'rounded-2' | 'rounded-3' | string;
|
|
6
|
+
export type TextColors = Colors | 'white' | 'muted' | 'high-emphasis' | 'medium-emphasis' | 'disabled' | 'high-emphasis-inverse' | 'medium-emphasis-inverse' | 'disabled-inverse' | string;
|
|
7
|
+
export type Triggers = 'hover' | 'focus' | 'click';
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import getNextSibling from './getNextSibling';
|
|
2
|
-
import getPreviousSibling from './getPreviousSibling';
|
|
3
1
|
import isInViewport from './isInViewport';
|
|
4
2
|
import isObjectInArray from './isObjectInArray';
|
|
5
|
-
export {
|
|
3
|
+
export { isInViewport, isObjectInArray };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coreui/react-pro",
|
|
3
|
-
"version": "4.9.0
|
|
3
|
+
"version": "4.9.0",
|
|
4
4
|
"description": "UI Components Library for React.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -32,7 +32,9 @@
|
|
|
32
32
|
"src/"
|
|
33
33
|
],
|
|
34
34
|
"scripts": {
|
|
35
|
-
"build": "rollup -c --bundleConfigAsCjs"
|
|
35
|
+
"build": "rollup -c --bundleConfigAsCjs",
|
|
36
|
+
"test": "jest --coverage",
|
|
37
|
+
"test:update": "jest --coverage --updateSnapshot"
|
|
36
38
|
},
|
|
37
39
|
"devDependencies": {
|
|
38
40
|
"@coreui/icons": "^3.0.0",
|
|
@@ -42,20 +44,23 @@
|
|
|
42
44
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
43
45
|
"@rollup/plugin-typescript": "^11.0.0",
|
|
44
46
|
"@testing-library/jest-dom": "^5.16.5",
|
|
45
|
-
"@testing-library/react": "^
|
|
46
|
-
"@types/react": "18.0.
|
|
47
|
-
"@types/react-dom": "^18.0.
|
|
47
|
+
"@testing-library/react": "^14.0.0",
|
|
48
|
+
"@types/react": "18.0.28",
|
|
49
|
+
"@types/react-dom": "^18.0.11",
|
|
48
50
|
"@types/react-transition-group": "^4.4.5",
|
|
49
51
|
"classnames": "^2.3.2",
|
|
50
52
|
"date-fns": "^2.29.3",
|
|
53
|
+
"jest": "^29.5.0",
|
|
54
|
+
"jest-environment-jsdom": "^29.5.0",
|
|
51
55
|
"prop-types": "^15.8.1",
|
|
52
56
|
"react": "^18.2.0",
|
|
53
57
|
"react-device-detect": "^2.2.2",
|
|
54
58
|
"react-dom": "^18.2.0",
|
|
55
59
|
"react-popper": "^2.3.0",
|
|
56
60
|
"react-transition-group": "^4.4.5",
|
|
57
|
-
"rollup": "^3.
|
|
61
|
+
"rollup": "^3.19.1",
|
|
58
62
|
"tslib": "^2.5.0",
|
|
63
|
+
"ts-jest": "^29.0.5",
|
|
59
64
|
"typescript": "^4.9.5"
|
|
60
65
|
},
|
|
61
66
|
"peerDependencies": {
|
|
@@ -30,11 +30,15 @@ export interface CAccordionContextProps {
|
|
|
30
30
|
export const CAccordionContext = createContext({} as CAccordionContextProps)
|
|
31
31
|
|
|
32
32
|
export const CAccordion = forwardRef<HTMLDivElement, CAccordionProps>(
|
|
33
|
-
({ children, activeItemKey
|
|
33
|
+
({ children, activeItemKey, alwaysOpen = false, className, flush, ...rest }, ref) => {
|
|
34
34
|
const [_activeItemKey, setActiveKey] = useState(activeItemKey)
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
return (
|
|
37
|
-
<div
|
|
37
|
+
<div
|
|
38
|
+
className={classNames('accordion', { 'accordion-flush': flush }, className)}
|
|
39
|
+
{...rest}
|
|
40
|
+
ref={ref}
|
|
41
|
+
>
|
|
38
42
|
<CAccordionContext.Provider value={{ _activeItemKey, alwaysOpen, setActiveKey }}>
|
|
39
43
|
{children}
|
|
40
44
|
</CAccordionContext.Provider>
|
|
@@ -5,6 +5,7 @@ import classNames from 'classnames'
|
|
|
5
5
|
import { CAccordionItemContext } from './CAccordionItem'
|
|
6
6
|
|
|
7
7
|
import { CCollapse } from './../collapse/CCollapse'
|
|
8
|
+
|
|
8
9
|
export interface CAccordionBodyProps extends HTMLAttributes<HTMLDivElement> {
|
|
9
10
|
/**
|
|
10
11
|
* A string of all className you want applied to the base component.
|
|
@@ -15,11 +16,10 @@ export interface CAccordionBodyProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
15
16
|
export const CAccordionBody = forwardRef<HTMLDivElement, CAccordionBodyProps>(
|
|
16
17
|
({ children, className, ...rest }, ref) => {
|
|
17
18
|
const { visible } = useContext(CAccordionItemContext)
|
|
18
|
-
const _className = classNames('accordion-body', className)
|
|
19
19
|
|
|
20
20
|
return (
|
|
21
21
|
<CCollapse className="accordion-collapse" visible={visible}>
|
|
22
|
-
<div className={
|
|
22
|
+
<div className={classNames('accordion-body', className)} {...rest} ref={ref}>
|
|
23
23
|
{children}
|
|
24
24
|
</div>
|
|
25
25
|
</CCollapse>
|
|
@@ -15,12 +15,10 @@ export const CAccordionButton = forwardRef<HTMLButtonElement, CAccordionButtonPr
|
|
|
15
15
|
({ children, className, ...rest }, ref) => {
|
|
16
16
|
const { visible, setVisible } = useContext(CAccordionItemContext)
|
|
17
17
|
|
|
18
|
-
const _className = classNames('accordion-button', { collapsed: !visible }, className)
|
|
19
|
-
|
|
20
18
|
return (
|
|
21
19
|
<button
|
|
22
20
|
type="button"
|
|
23
|
-
className={
|
|
21
|
+
className={classNames('accordion-button', { collapsed: !visible }, className)}
|
|
24
22
|
aria-expanded={!visible}
|
|
25
23
|
onClick={() => setVisible(!visible)}
|
|
26
24
|
{...rest}
|
|
@@ -13,10 +13,8 @@ export interface CAccordionHeaderProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
13
13
|
|
|
14
14
|
export const CAccordionHeader = forwardRef<HTMLDivElement, CAccordionHeaderProps>(
|
|
15
15
|
({ children, className, ...rest }, ref) => {
|
|
16
|
-
const _className = classNames('accordion-header', className)
|
|
17
|
-
|
|
18
16
|
return (
|
|
19
|
-
<div className={
|
|
17
|
+
<div className={classNames('accordion-header', className)} {...rest} ref={ref}>
|
|
20
18
|
<CAccordionButton>{children}</CAccordionButton>
|
|
21
19
|
</div>
|
|
22
20
|
)
|
|
@@ -32,7 +32,7 @@ export interface CAccordionItemProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
32
32
|
|
|
33
33
|
export const CAccordionItem = forwardRef<HTMLDivElement, CAccordionItemProps>(
|
|
34
34
|
({ children, className, itemKey, ...rest }, ref) => {
|
|
35
|
-
const _itemKey = useRef(itemKey
|
|
35
|
+
const _itemKey = useRef(itemKey ?? Math.random().toString(36).slice(2, 11))
|
|
36
36
|
|
|
37
37
|
const { _activeItemKey, alwaysOpen, setActiveKey } = useContext(CAccordionContext)
|
|
38
38
|
const [visible, setVisible] = useState(Boolean(_activeItemKey === _itemKey.current))
|
|
@@ -45,10 +45,8 @@ export const CAccordionItem = forwardRef<HTMLDivElement, CAccordionItemProps>(
|
|
|
45
45
|
setVisible(Boolean(_activeItemKey === _itemKey.current))
|
|
46
46
|
}, [_activeItemKey])
|
|
47
47
|
|
|
48
|
-
const _className = classNames('accordion-item', className)
|
|
49
|
-
|
|
50
48
|
return (
|
|
51
|
-
<div className={
|
|
49
|
+
<div className={classNames('accordion-item', className)} {...rest} ref={ref}>
|
|
52
50
|
<CAccordionItemContext.Provider value={{ setVisible, visible }}>
|
|
53
51
|
{children}
|
|
54
52
|
</CAccordionItemContext.Provider>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
exports[`CAccordionBody customize 1`] = `
|
|
4
4
|
<div>
|
|
5
5
|
<div
|
|
6
|
-
class="accordion-
|
|
6
|
+
class="accordion-collapse collapse"
|
|
7
7
|
>
|
|
8
8
|
<div
|
|
9
9
|
class="accordion-body"
|
|
@@ -17,7 +17,7 @@ exports[`CAccordionBody customize 1`] = `
|
|
|
17
17
|
exports[`loads and displays CAccordionBody component 1`] = `
|
|
18
18
|
<div>
|
|
19
19
|
<div
|
|
20
|
-
class="accordion-
|
|
20
|
+
class="accordion-collapse collapse"
|
|
21
21
|
>
|
|
22
22
|
<div
|
|
23
23
|
class="accordion-body"
|
|
@@ -3,10 +3,11 @@ import PropTypes from 'prop-types'
|
|
|
3
3
|
import classNames from 'classnames'
|
|
4
4
|
import { Transition } from 'react-transition-group'
|
|
5
5
|
|
|
6
|
-
import { Colors, colorPropType } from '../Types'
|
|
7
6
|
import { CCloseButton } from '../close-button/CCloseButton'
|
|
8
7
|
|
|
9
8
|
import { useForkedRef } from '../../hooks'
|
|
9
|
+
import { colorPropType } from '../../props'
|
|
10
|
+
import type { Colors } from '../../types'
|
|
10
11
|
|
|
11
12
|
export interface CAlertProps extends HTMLAttributes<HTMLDivElement> {
|
|
12
13
|
/**
|
|
@@ -59,19 +60,6 @@ export const CAlert = forwardRef<HTMLDivElement, CAlertProps>(
|
|
|
59
60
|
setVisible(visible)
|
|
60
61
|
}, [visible])
|
|
61
62
|
|
|
62
|
-
const _className = classNames(
|
|
63
|
-
'alert',
|
|
64
|
-
variant === 'solid' ? `bg-${color} text-white` : `alert-${color}`,
|
|
65
|
-
{
|
|
66
|
-
'alert-dismissible fade': dismissible,
|
|
67
|
-
},
|
|
68
|
-
className,
|
|
69
|
-
)
|
|
70
|
-
|
|
71
|
-
const getTransitionClass = (state: string) => {
|
|
72
|
-
return state === 'entered' && 'show'
|
|
73
|
-
}
|
|
74
|
-
|
|
75
63
|
return (
|
|
76
64
|
<Transition
|
|
77
65
|
in={_visible}
|
|
@@ -81,20 +69,25 @@ export const CAlert = forwardRef<HTMLDivElement, CAlertProps>(
|
|
|
81
69
|
timeout={150}
|
|
82
70
|
unmountOnExit
|
|
83
71
|
>
|
|
84
|
-
{(state) =>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
72
|
+
{(state) => (
|
|
73
|
+
<div
|
|
74
|
+
className={classNames(
|
|
75
|
+
'alert',
|
|
76
|
+
variant === 'solid' ? `bg-${color} text-white` : `alert-${color}`,
|
|
77
|
+
{
|
|
78
|
+
'alert-dismissible fade': dismissible,
|
|
79
|
+
show: state === 'entered',
|
|
80
|
+
},
|
|
81
|
+
className,
|
|
82
|
+
)}
|
|
83
|
+
role="alert"
|
|
84
|
+
{...rest}
|
|
85
|
+
ref={forkedRef}
|
|
86
|
+
>
|
|
87
|
+
{children}
|
|
88
|
+
{dismissible && <CCloseButton onClick={() => setVisible(false)} />}
|
|
89
|
+
</div>
|
|
90
|
+
)}
|
|
98
91
|
</Transition>
|
|
99
92
|
)
|
|
100
93
|
},
|
|
@@ -15,10 +15,8 @@ export interface CAlertHeadingProps extends HTMLAttributes<HTMLHeadingElement> {
|
|
|
15
15
|
|
|
16
16
|
export const CAlertHeading = forwardRef<HTMLHeadingElement, CAlertHeadingProps>(
|
|
17
17
|
({ children, className, component: Component = 'h4', ...rest }, ref) => {
|
|
18
|
-
const _className = classNames('alert-heading', className)
|
|
19
|
-
|
|
20
18
|
return (
|
|
21
|
-
<Component className={
|
|
19
|
+
<Component className={classNames('alert-heading', className)} {...rest} ref={ref}>
|
|
22
20
|
{children}
|
|
23
21
|
</Component>
|
|
24
22
|
)
|
|
@@ -13,10 +13,8 @@ export interface CAlertLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement>
|
|
|
13
13
|
|
|
14
14
|
export const CAlertLink = forwardRef<HTMLAnchorElement, CAlertLinkProps>(
|
|
15
15
|
({ children, className, ...rest }, ref) => {
|
|
16
|
-
const _className = classNames('alert-link', className)
|
|
17
|
-
|
|
18
16
|
return (
|
|
19
|
-
<CLink className={
|
|
17
|
+
<CLink className={classNames('alert-link', className)} {...rest} ref={ref}>
|
|
20
18
|
{children}
|
|
21
19
|
</CLink>
|
|
22
20
|
)
|
|
@@ -2,14 +2,8 @@ import React, { forwardRef, HTMLAttributes } from 'react'
|
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
import classNames from 'classnames'
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
Shapes,
|
|
8
|
-
TextColors,
|
|
9
|
-
colorPropType,
|
|
10
|
-
shapePropType,
|
|
11
|
-
textColorsPropType,
|
|
12
|
-
} from '../Types'
|
|
5
|
+
import { colorPropType, shapePropType, textColorsPropType } from '../../props'
|
|
6
|
+
import type { Colors, Shapes, TextColors } from '../../types'
|
|
13
7
|
|
|
14
8
|
export interface CAvatarProps extends HTMLAttributes<HTMLDivElement> {
|
|
15
9
|
/**
|
|
@@ -52,20 +46,23 @@ export interface CAvatarProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
52
46
|
|
|
53
47
|
export const CAvatar = forwardRef<HTMLDivElement, CAvatarProps>(
|
|
54
48
|
({ children, className, color, shape, size, src, status, textColor, ...rest }, ref) => {
|
|
55
|
-
const _className = classNames(
|
|
56
|
-
'avatar',
|
|
57
|
-
{
|
|
58
|
-
[`bg-${color}`]: color,
|
|
59
|
-
[`avatar-${size}`]: size,
|
|
60
|
-
[`text-${textColor}`]: textColor,
|
|
61
|
-
},
|
|
62
|
-
shape,
|
|
63
|
-
className,
|
|
64
|
-
)
|
|
65
49
|
const statusClassName = status && classNames('avatar-status', `bg-${status}`)
|
|
66
50
|
|
|
67
51
|
return (
|
|
68
|
-
<div
|
|
52
|
+
<div
|
|
53
|
+
className={classNames(
|
|
54
|
+
'avatar',
|
|
55
|
+
{
|
|
56
|
+
[`bg-${color}`]: color,
|
|
57
|
+
[`avatar-${size}`]: size,
|
|
58
|
+
[`text-${textColor}`]: textColor,
|
|
59
|
+
},
|
|
60
|
+
shape,
|
|
61
|
+
className,
|
|
62
|
+
)}
|
|
63
|
+
{...rest}
|
|
64
|
+
ref={ref}
|
|
65
|
+
>
|
|
69
66
|
{src ? <img src={src} className="avatar-img" /> : children}
|
|
70
67
|
{status && <span className={statusClassName}></span>}
|
|
71
68
|
</div>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { forwardRef, HTMLAttributes, useRef } from 'react'
|
|
2
|
-
import { Transition } from 'react-transition-group'
|
|
3
2
|
import PropTypes from 'prop-types'
|
|
4
3
|
import classNames from 'classnames'
|
|
4
|
+
import { Transition } from 'react-transition-group'
|
|
5
5
|
|
|
6
6
|
import { useForkedRef } from '../../hooks'
|
|
7
7
|
|
|
@@ -21,20 +21,17 @@ export const CBackdrop = forwardRef<HTMLDivElement, CBackdropProps>(
|
|
|
21
21
|
const backdropRef = useRef<HTMLDivElement>(null)
|
|
22
22
|
const forkedRef = useForkedRef(ref, backdropRef)
|
|
23
23
|
|
|
24
|
-
const _className = classNames(className, 'fade')
|
|
25
|
-
|
|
26
|
-
const getTransitionClass = (state: string) => {
|
|
27
|
-
return state === 'entered' && 'show'
|
|
28
|
-
}
|
|
29
|
-
|
|
30
24
|
return (
|
|
31
25
|
<Transition in={visible} mountOnEnter nodeRef={backdropRef} timeout={150} unmountOnExit>
|
|
32
|
-
{(state) =>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
26
|
+
{(state) => (
|
|
27
|
+
<div
|
|
28
|
+
className={classNames(className, 'fade', {
|
|
29
|
+
show: state === 'entered',
|
|
30
|
+
})}
|
|
31
|
+
{...rest}
|
|
32
|
+
ref={forkedRef}
|
|
33
|
+
/>
|
|
34
|
+
)}
|
|
38
35
|
</Transition>
|
|
39
36
|
)
|
|
40
37
|
},
|
|
@@ -2,16 +2,8 @@ import React, { ElementType, forwardRef, HTMLAttributes } from 'react'
|
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
import classNames from 'classnames'
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
Gradients,
|
|
8
|
-
Shapes,
|
|
9
|
-
TextColors,
|
|
10
|
-
colorPropType,
|
|
11
|
-
gradientsPropType,
|
|
12
|
-
shapePropType,
|
|
13
|
-
textColorsPropType,
|
|
14
|
-
} from '../Types'
|
|
5
|
+
import { colorPropType, gradientsPropType, shapePropType, textColorsPropType } from '../../props'
|
|
6
|
+
import type { Colors, Gradients, Shapes, TextColors } from '../../types'
|
|
15
7
|
|
|
16
8
|
export interface CBadgeProps extends HTMLAttributes<HTMLDivElement | HTMLSpanElement> {
|
|
17
9
|
/**
|
|
@@ -64,24 +56,26 @@ export const CBadge = forwardRef<HTMLDivElement | HTMLSpanElement, CBadgeProps>(
|
|
|
64
56
|
},
|
|
65
57
|
ref,
|
|
66
58
|
) => {
|
|
67
|
-
const _className = classNames(
|
|
68
|
-
'badge',
|
|
69
|
-
{
|
|
70
|
-
[`bg-${color}`]: color,
|
|
71
|
-
'position-absolute translate-middle': position,
|
|
72
|
-
'top-0': position?.includes('top'),
|
|
73
|
-
'top-100': position?.includes('bottom'),
|
|
74
|
-
'start-100': position?.includes('end'),
|
|
75
|
-
'start-0': position?.includes('start'),
|
|
76
|
-
[`badge-${size}`]: size,
|
|
77
|
-
[`text-${textColor}`]: textColor,
|
|
78
|
-
},
|
|
79
|
-
shape,
|
|
80
|
-
className,
|
|
81
|
-
)
|
|
82
|
-
|
|
83
59
|
return (
|
|
84
|
-
<Component
|
|
60
|
+
<Component
|
|
61
|
+
className={classNames(
|
|
62
|
+
'badge',
|
|
63
|
+
{
|
|
64
|
+
[`bg-${color}`]: color,
|
|
65
|
+
'position-absolute translate-middle': position,
|
|
66
|
+
'top-0': position?.includes('top'),
|
|
67
|
+
'top-100': position?.includes('bottom'),
|
|
68
|
+
'start-100': position?.includes('end'),
|
|
69
|
+
'start-0': position?.includes('start'),
|
|
70
|
+
[`badge-${size}`]: size,
|
|
71
|
+
[`text-${textColor}`]: textColor,
|
|
72
|
+
},
|
|
73
|
+
shape,
|
|
74
|
+
className,
|
|
75
|
+
)}
|
|
76
|
+
{...rest}
|
|
77
|
+
ref={ref}
|
|
78
|
+
>
|
|
85
79
|
{children}
|
|
86
80
|
</Component>
|
|
87
81
|
)
|
|
@@ -11,10 +11,9 @@ export interface CBreadcrumbProps extends HTMLAttributes<HTMLOListElement> {
|
|
|
11
11
|
|
|
12
12
|
export const CBreadcrumb = forwardRef<HTMLOListElement, CBreadcrumbProps>(
|
|
13
13
|
({ children, className, ...rest }, ref) => {
|
|
14
|
-
const _className = classNames('breadcrumb', className)
|
|
15
14
|
return (
|
|
16
15
|
<nav aria-label="breadcrumb">
|
|
17
|
-
<ol className={
|
|
16
|
+
<ol className={classNames('breadcrumb', className)} {...rest} ref={ref}>
|
|
18
17
|
{children}
|
|
19
18
|
</ol>
|
|
20
19
|
</nav>
|
|
@@ -21,15 +21,19 @@ export interface CBreadcrumbItemProps extends HTMLAttributes<HTMLLIElement> {
|
|
|
21
21
|
|
|
22
22
|
export const CBreadcrumbItem = forwardRef<HTMLLIElement, CBreadcrumbItemProps>(
|
|
23
23
|
({ children, active, className, href, ...rest }, ref) => {
|
|
24
|
-
const _className = classNames(
|
|
25
|
-
'breadcrumb-item',
|
|
26
|
-
{
|
|
27
|
-
active: active,
|
|
28
|
-
},
|
|
29
|
-
className,
|
|
30
|
-
)
|
|
31
24
|
return (
|
|
32
|
-
<li
|
|
25
|
+
<li
|
|
26
|
+
className={classNames(
|
|
27
|
+
'breadcrumb-item',
|
|
28
|
+
{
|
|
29
|
+
active: active,
|
|
30
|
+
},
|
|
31
|
+
className,
|
|
32
|
+
)}
|
|
33
|
+
{...(active && { 'aria-current': 'page' })}
|
|
34
|
+
{...rest}
|
|
35
|
+
ref={ref}
|
|
36
|
+
>
|
|
33
37
|
{href ? <CLink href={href}>{children}</CLink> : children}
|
|
34
38
|
</li>
|
|
35
39
|
)
|
|
@@ -2,9 +2,11 @@ import React, { ElementType, forwardRef } from 'react'
|
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
import classNames from 'classnames'
|
|
4
4
|
|
|
5
|
-
import { Colors, Shapes, colorPropType } from '../Types'
|
|
6
5
|
import { CLink, CLinkProps } from '../link/CLink'
|
|
7
6
|
|
|
7
|
+
import { colorPropType } from '../../props'
|
|
8
|
+
import type { Colors, Shapes } from '../../types'
|
|
9
|
+
|
|
8
10
|
export interface CButtonProps extends Omit<CLinkProps, 'size'> {
|
|
9
11
|
/**
|
|
10
12
|
* Toggle the active state for the component.
|
|
@@ -72,19 +74,17 @@ export const CButton = forwardRef<HTMLButtonElement | HTMLAnchorElement, CButton
|
|
|
72
74
|
},
|
|
73
75
|
ref,
|
|
74
76
|
) => {
|
|
75
|
-
const _className = classNames(
|
|
76
|
-
'btn',
|
|
77
|
-
variant ? `btn-${variant}-${color}` : `btn-${color}`,
|
|
78
|
-
{ [`btn-${size}`]: size },
|
|
79
|
-
shape,
|
|
80
|
-
className,
|
|
81
|
-
)
|
|
82
|
-
|
|
83
77
|
return (
|
|
84
78
|
<CLink
|
|
85
79
|
component={rest.href ? 'a' : component}
|
|
86
80
|
type={type}
|
|
87
|
-
className={
|
|
81
|
+
className={classNames(
|
|
82
|
+
'btn',
|
|
83
|
+
variant ? `btn-${variant}-${color}` : `btn-${color}`,
|
|
84
|
+
{ [`btn-${size}`]: size },
|
|
85
|
+
shape,
|
|
86
|
+
className,
|
|
87
|
+
)}
|
|
88
88
|
{...rest}
|
|
89
89
|
ref={ref}
|
|
90
90
|
>
|
|
@@ -19,14 +19,16 @@ export interface CButtonGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
19
19
|
|
|
20
20
|
export const CButtonGroup = forwardRef<HTMLDivElement, CButtonGroupProps>(
|
|
21
21
|
({ children, className, size, vertical, ...rest }, ref) => {
|
|
22
|
-
const _className = classNames(
|
|
23
|
-
vertical ? 'btn-group-vertical' : 'btn-group',
|
|
24
|
-
{ [`btn-group-${size}`]: size },
|
|
25
|
-
className,
|
|
26
|
-
)
|
|
27
|
-
|
|
28
22
|
return (
|
|
29
|
-
<div
|
|
23
|
+
<div
|
|
24
|
+
className={classNames(
|
|
25
|
+
vertical ? 'btn-group-vertical' : 'btn-group',
|
|
26
|
+
{ [`btn-group-${size}`]: size },
|
|
27
|
+
className,
|
|
28
|
+
)}
|
|
29
|
+
{...rest}
|
|
30
|
+
ref={ref}
|
|
31
|
+
>
|
|
30
32
|
{children}
|
|
31
33
|
</div>
|
|
32
34
|
)
|
|
@@ -11,10 +11,8 @@ export interface CButtonToolbarProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
11
11
|
|
|
12
12
|
export const CButtonToolbar = forwardRef<HTMLDivElement, CButtonToolbarProps>(
|
|
13
13
|
({ children, className, ...rest }, ref) => {
|
|
14
|
-
const _className = classNames('btn-toolbar', className)
|
|
15
|
-
|
|
16
14
|
return (
|
|
17
|
-
<div className={
|
|
15
|
+
<div className={classNames('btn-toolbar', className)} {...rest} ref={ref}>
|
|
18
16
|
{children}
|
|
19
17
|
</div>
|
|
20
18
|
)
|
|
@@ -6,7 +6,7 @@ export const convertToLocalTime = (d: Date, locale: string, options = {}) =>
|
|
|
6
6
|
|
|
7
7
|
export const createGroupsInArray = <T>(arr: T[], numberOfGroups: number): T[][] => {
|
|
8
8
|
const perGroup = Math.ceil(arr.length / numberOfGroups)
|
|
9
|
-
return
|
|
9
|
+
return Array.from({ length: numberOfGroups })
|
|
10
10
|
.fill('')
|
|
11
11
|
.map((_, i) => arr.slice(i * perGroup, (i + 1) * perGroup))
|
|
12
12
|
}
|
|
@@ -15,52 +15,6 @@ export const getCurrentYear = () => new Date().getFullYear()
|
|
|
15
15
|
|
|
16
16
|
export const getCurrentMonth = () => new Date().getMonth()
|
|
17
17
|
|
|
18
|
-
export const getLocalDateFromString = (string: string, locale: string, time?: boolean) => {
|
|
19
|
-
const date = new Date(2013, 11, 31, 17, 19, 22)
|
|
20
|
-
let regex = time ? date.toLocaleString(locale) : date.toLocaleDateString(locale)
|
|
21
|
-
regex = regex
|
|
22
|
-
.replace('2013', '(?<year>[0-9]{2,4})')
|
|
23
|
-
.replace('12', '(?<month>[0-9]{1,2})')
|
|
24
|
-
.replace('31', '(?<day>[0-9]{1,2})')
|
|
25
|
-
|
|
26
|
-
if (time) {
|
|
27
|
-
regex = regex
|
|
28
|
-
.replace('5', '(?<hour>[0-9]{1,2})')
|
|
29
|
-
.replace('17', '(?<hour>[0-9]{1,2})')
|
|
30
|
-
.replace('19', '(?<minute>[0-9]{1,2})')
|
|
31
|
-
.replace('22', '(?<second>[0-9]{1,2})')
|
|
32
|
-
.replace('PM', '(?<ampm>[A-Z]{2})')
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const rgx = RegExp(`${regex}`)
|
|
36
|
-
const partials = string.match(rgx)
|
|
37
|
-
|
|
38
|
-
if (partials === null) return
|
|
39
|
-
|
|
40
|
-
const newDate =
|
|
41
|
-
partials.groups &&
|
|
42
|
-
(time
|
|
43
|
-
? new Date(
|
|
44
|
-
Number(partials.groups['year']),
|
|
45
|
-
Number(partials.groups['month']) - 1,
|
|
46
|
-
Number(partials.groups['day']),
|
|
47
|
-
partials.groups['ampm']
|
|
48
|
-
? partials.groups['ampm'] === 'PM'
|
|
49
|
-
? Number(partials.groups['hour']) + 12
|
|
50
|
-
: Number(partials.groups['hour'])
|
|
51
|
-
: Number(partials.groups['hour']),
|
|
52
|
-
Number(partials.groups['minute']),
|
|
53
|
-
Number(partials.groups['second']),
|
|
54
|
-
)
|
|
55
|
-
: new Date(
|
|
56
|
-
Number(partials.groups['year']),
|
|
57
|
-
Number(partials.groups['month']) - 1,
|
|
58
|
-
Number(partials.groups['day']),
|
|
59
|
-
))
|
|
60
|
-
|
|
61
|
-
return newDate
|
|
62
|
-
}
|
|
63
|
-
|
|
64
18
|
export const getMonthName = (month: number, locale: string) => {
|
|
65
19
|
const d = new Date()
|
|
66
20
|
d.setDate(1)
|
|
@@ -193,18 +147,16 @@ export const isDateDisabled = (
|
|
|
193
147
|
let disabled
|
|
194
148
|
if (dates) {
|
|
195
149
|
dates.forEach((_date: Date | Date[]) => {
|
|
196
|
-
if (Array.isArray(_date)) {
|
|
197
|
-
|
|
198
|
-
disabled = true
|
|
199
|
-
}
|
|
150
|
+
if (Array.isArray(_date) && isDateInRange(date, _date[0], _date[1])) {
|
|
151
|
+
disabled = true
|
|
200
152
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}
|
|
153
|
+
|
|
154
|
+
if (_date instanceof Date && isSameDateAs(date, _date)) {
|
|
155
|
+
disabled = true
|
|
205
156
|
}
|
|
206
157
|
})
|
|
207
158
|
}
|
|
159
|
+
|
|
208
160
|
if (min && date < min) {
|
|
209
161
|
disabled = true
|
|
210
162
|
}
|