@coreui/react-pro 4.9.0-next.1 → 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/conditional-portal/CConditionalPortal.d.ts +12 -0
- package/dist/components/conditional-portal/index.d.ts +2 -0
- package/dist/components/form/CFormCheck.d.ts +7 -1
- package/dist/components/form/CFormSwitch.d.ts +6 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/table/CTableResponsiveWrapper.d.ts +0 -1
- package/dist/index.es.js +498 -720
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +497 -718
- package/dist/index.js.map +1 -1
- package/package.json +11 -6
- package/src/components/accordion/CAccordion.tsx +7 -3
- package/src/components/accordion/CAccordionBody.tsx +1 -2
- package/src/components/accordion/CAccordionButton.tsx +1 -3
- 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 +19 -27
- 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 +14 -11
- package/src/components/backdrop/CBackdrop.tsx +9 -12
- package/src/components/badge/CBadge.tsx +19 -17
- package/src/components/breadcrumb/CBreadcrumb.tsx +1 -2
- package/src/components/breadcrumb/CBreadcrumbItem.tsx +12 -8
- package/src/components/button/CButton.tsx +7 -9
- 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 -9
- package/src/components/callout/CCallout.tsx +11 -9
- package/src/components/card/CCard.tsx +12 -10
- 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 +9 -11
- package/src/components/date-range-picker/utils.ts +2 -2
- package/src/components/dropdown/CDropdown.tsx +24 -22
- package/src/components/dropdown/CDropdownDivider.tsx +1 -3
- package/src/components/dropdown/CDropdownHeader.tsx +1 -3
- package/src/components/dropdown/CDropdownItem.tsx +6 -3
- package/src/components/dropdown/CDropdownItemPlain.tsx +1 -3
- package/src/components/dropdown/CDropdownMenu.tsx +27 -31
- package/src/components/dropdown/CDropdownToggle.tsx +29 -23
- 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 +87 -63
- package/src/components/form/CFormControlWrapper.tsx +3 -3
- package/src/components/form/CFormFeedback.tsx +11 -8
- package/src/components/form/CFormFloating.tsx +1 -2
- package/src/components/form/CFormInput.tsx +10 -12
- package/src/components/form/CFormLabel.tsx +1 -2
- package/src/components/form/CFormRange.tsx +1 -2
- package/src/components/form/CFormSelect.tsx +15 -10
- package/src/components/form/CFormSwitch.tsx +31 -20
- package/src/components/form/CFormText.tsx +1 -2
- package/src/components/form/CFormTextarea.tsx +13 -9
- 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 +13 -12
- package/src/components/loading-button/CLoadingButton.tsx +1 -3
- package/src/components/modal/CModal.tsx +55 -70
- 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 +1 -2
- 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 +19 -19
- package/src/components/multi-select/utils.ts +3 -3
- 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 +8 -10
- package/src/components/nav/CNavLink.tsx +1 -2
- package/src/components/nav/CNavTitle.tsx +1 -2
- package/src/components/navbar/CNavbar.tsx +21 -22
- 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 +39 -66
- 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 +6 -6
- package/src/components/placeholder/CPlaceholder.tsx +13 -11
- package/src/components/popover/CPopover.tsx +22 -33
- package/src/components/progress/CProgress.tsx +12 -10
- package/src/components/progress/CProgressBar.tsx +9 -11
- package/src/components/sidebar/CSidebar.tsx +20 -18
- 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 +4 -8
- package/src/components/smart-table/utils.ts +3 -4
- package/src/components/spinner/CSpinner.tsx +11 -8
- package/src/components/table/CTable.tsx +20 -18
- package/src/components/table/CTableBody.tsx +12 -8
- package/src/components/table/CTableDataCell.tsx +14 -10
- package/src/components/table/CTableFoot.tsx +12 -8
- package/src/components/table/CTableHead.tsx +12 -8
- package/src/components/table/CTableHeaderCell.tsx +12 -8
- package/src/components/table/CTableResponsiveWrapper.tsx +2 -3
- package/src/components/table/CTableRow.tsx +14 -10
- package/src/components/table/__tests__/__snapshots__/CTable.spec.tsx.snap +1 -5
- package/src/components/table/utils.ts +2 -7
- package/src/components/tabs/CTabContent.tsx +1 -2
- package/src/components/tabs/CTabPane.tsx +17 -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 +12 -14
- package/src/components/toast/CToast.tsx +29 -42
- package/src/components/toast/CToastBody.tsx +1 -2
- package/src/components/toast/CToastClose.tsx +3 -1
- package/src/components/toast/CToastHeader.tsx +1 -2
- package/src/components/toast/CToaster.tsx +26 -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 +21 -32
- package/src/components/virtual-scroller/CVirtualScroller.tsx +4 -6
- package/src/components/widgets/CWidgetStatsA.tsx +8 -6
- package/src/components/widgets/CWidgetStatsD.tsx +9 -10
- package/src/components/widgets/CWidgetStatsE.tsx +1 -3
- package/src/components/widgets/CWidgetStatsF.tsx +1 -4
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>
|
|
@@ -16,11 +16,10 @@ export interface CAccordionBodyProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
16
16
|
export const CAccordionBody = forwardRef<HTMLDivElement, CAccordionBodyProps>(
|
|
17
17
|
({ children, className, ...rest }, ref) => {
|
|
18
18
|
const { visible } = useContext(CAccordionItemContext)
|
|
19
|
-
const _className = classNames('accordion-body', className)
|
|
20
19
|
|
|
21
20
|
return (
|
|
22
21
|
<CCollapse className="accordion-collapse" visible={visible}>
|
|
23
|
-
<div className={
|
|
22
|
+
<div className={classNames('accordion-body', className)} {...rest} ref={ref}>
|
|
24
23
|
{children}
|
|
25
24
|
</div>
|
|
26
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"
|
|
@@ -60,19 +60,6 @@ export const CAlert = forwardRef<HTMLDivElement, CAlertProps>(
|
|
|
60
60
|
setVisible(visible)
|
|
61
61
|
}, [visible])
|
|
62
62
|
|
|
63
|
-
const _className = classNames(
|
|
64
|
-
'alert',
|
|
65
|
-
variant === 'solid' ? `bg-${color} text-white` : `alert-${color}`,
|
|
66
|
-
{
|
|
67
|
-
'alert-dismissible fade': dismissible,
|
|
68
|
-
},
|
|
69
|
-
className,
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
const getTransitionClass = (state: string) => {
|
|
73
|
-
return state === 'entered' && 'show'
|
|
74
|
-
}
|
|
75
|
-
|
|
76
63
|
return (
|
|
77
64
|
<Transition
|
|
78
65
|
in={_visible}
|
|
@@ -82,20 +69,25 @@ export const CAlert = forwardRef<HTMLDivElement, CAlertProps>(
|
|
|
82
69
|
timeout={150}
|
|
83
70
|
unmountOnExit
|
|
84
71
|
>
|
|
85
|
-
{(state) =>
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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
|
+
)}
|
|
99
91
|
</Transition>
|
|
100
92
|
)
|
|
101
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
|
)
|
|
@@ -46,20 +46,23 @@ export interface CAvatarProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
46
46
|
|
|
47
47
|
export const CAvatar = forwardRef<HTMLDivElement, CAvatarProps>(
|
|
48
48
|
({ children, className, color, shape, size, src, status, textColor, ...rest }, ref) => {
|
|
49
|
-
const _className = classNames(
|
|
50
|
-
'avatar',
|
|
51
|
-
{
|
|
52
|
-
[`bg-${color}`]: color,
|
|
53
|
-
[`avatar-${size}`]: size,
|
|
54
|
-
[`text-${textColor}`]: textColor,
|
|
55
|
-
},
|
|
56
|
-
shape,
|
|
57
|
-
className,
|
|
58
|
-
)
|
|
59
49
|
const statusClassName = status && classNames('avatar-status', `bg-${status}`)
|
|
60
50
|
|
|
61
51
|
return (
|
|
62
|
-
<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
|
+
>
|
|
63
66
|
{src ? <img src={src} className="avatar-img" /> : children}
|
|
64
67
|
{status && <span className={statusClassName}></span>}
|
|
65
68
|
</div>
|
|
@@ -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
|
},
|
|
@@ -56,24 +56,26 @@ export const CBadge = forwardRef<HTMLDivElement | HTMLSpanElement, CBadgeProps>(
|
|
|
56
56
|
},
|
|
57
57
|
ref,
|
|
58
58
|
) => {
|
|
59
|
-
const _className = classNames(
|
|
60
|
-
'badge',
|
|
61
|
-
{
|
|
62
|
-
[`bg-${color}`]: color,
|
|
63
|
-
'position-absolute translate-middle': position,
|
|
64
|
-
'top-0': position?.includes('top'),
|
|
65
|
-
'top-100': position?.includes('bottom'),
|
|
66
|
-
'start-100': position?.includes('end'),
|
|
67
|
-
'start-0': position?.includes('start'),
|
|
68
|
-
[`badge-${size}`]: size,
|
|
69
|
-
[`text-${textColor}`]: textColor,
|
|
70
|
-
},
|
|
71
|
-
shape,
|
|
72
|
-
className,
|
|
73
|
-
)
|
|
74
|
-
|
|
75
59
|
return (
|
|
76
|
-
<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
|
+
>
|
|
77
79
|
{children}
|
|
78
80
|
</Component>
|
|
79
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
|
)
|
|
@@ -74,19 +74,17 @@ export const CButton = forwardRef<HTMLButtonElement | HTMLAnchorElement, CButton
|
|
|
74
74
|
},
|
|
75
75
|
ref,
|
|
76
76
|
) => {
|
|
77
|
-
const _className = classNames(
|
|
78
|
-
'btn',
|
|
79
|
-
variant ? `btn-${variant}-${color}` : `btn-${color}`,
|
|
80
|
-
{ [`btn-${size}`]: size },
|
|
81
|
-
shape,
|
|
82
|
-
className,
|
|
83
|
-
)
|
|
84
|
-
|
|
85
77
|
return (
|
|
86
78
|
<CLink
|
|
87
79
|
component={rest.href ? 'a' : component}
|
|
88
80
|
type={type}
|
|
89
|
-
className={
|
|
81
|
+
className={classNames(
|
|
82
|
+
'btn',
|
|
83
|
+
variant ? `btn-${variant}-${color}` : `btn-${color}`,
|
|
84
|
+
{ [`btn-${size}`]: size },
|
|
85
|
+
shape,
|
|
86
|
+
className,
|
|
87
|
+
)}
|
|
90
88
|
{...rest}
|
|
91
89
|
ref={ref}
|
|
92
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
|
}
|
|
@@ -147,18 +147,16 @@ export const isDateDisabled = (
|
|
|
147
147
|
let disabled
|
|
148
148
|
if (dates) {
|
|
149
149
|
dates.forEach((_date: Date | Date[]) => {
|
|
150
|
-
if (Array.isArray(_date)) {
|
|
151
|
-
|
|
152
|
-
disabled = true
|
|
153
|
-
}
|
|
150
|
+
if (Array.isArray(_date) && isDateInRange(date, _date[0], _date[1])) {
|
|
151
|
+
disabled = true
|
|
154
152
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
153
|
+
|
|
154
|
+
if (_date instanceof Date && isSameDateAs(date, _date)) {
|
|
155
|
+
disabled = true
|
|
159
156
|
}
|
|
160
157
|
})
|
|
161
158
|
}
|
|
159
|
+
|
|
162
160
|
if (min && date < min) {
|
|
163
161
|
disabled = true
|
|
164
162
|
}
|
|
@@ -20,16 +20,18 @@ export interface CCalloutProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
20
20
|
|
|
21
21
|
export const CCallout = forwardRef<HTMLDivElement, CCalloutProps>(
|
|
22
22
|
({ children, className, color, ...rest }, ref) => {
|
|
23
|
-
const _className = classNames(
|
|
24
|
-
'callout',
|
|
25
|
-
{
|
|
26
|
-
[`callout-${color}`]: color,
|
|
27
|
-
},
|
|
28
|
-
className,
|
|
29
|
-
)
|
|
30
|
-
|
|
31
23
|
return (
|
|
32
|
-
<div
|
|
24
|
+
<div
|
|
25
|
+
className={classNames(
|
|
26
|
+
'callout',
|
|
27
|
+
{
|
|
28
|
+
[`callout-${color}`]: color,
|
|
29
|
+
},
|
|
30
|
+
className,
|
|
31
|
+
)}
|
|
32
|
+
{...rest}
|
|
33
|
+
ref={ref}
|
|
34
|
+
>
|
|
33
35
|
{children}
|
|
34
36
|
</div>
|
|
35
37
|
)
|
|
@@ -26,17 +26,19 @@ export interface CCardProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
26
26
|
|
|
27
27
|
export const CCard = forwardRef<HTMLDivElement, CCardProps>(
|
|
28
28
|
({ children, className, color, textColor, ...rest }, ref) => {
|
|
29
|
-
const _className = classNames(
|
|
30
|
-
'card',
|
|
31
|
-
{
|
|
32
|
-
[`bg-${color}`]: color,
|
|
33
|
-
[`text-${textColor}`]: textColor,
|
|
34
|
-
},
|
|
35
|
-
className,
|
|
36
|
-
)
|
|
37
|
-
|
|
38
29
|
return (
|
|
39
|
-
<div
|
|
30
|
+
<div
|
|
31
|
+
className={classNames(
|
|
32
|
+
'card',
|
|
33
|
+
{
|
|
34
|
+
[`bg-${color}`]: color,
|
|
35
|
+
[`text-${textColor}`]: textColor,
|
|
36
|
+
},
|
|
37
|
+
className,
|
|
38
|
+
)}
|
|
39
|
+
{...rest}
|
|
40
|
+
ref={ref}
|
|
41
|
+
>
|
|
40
42
|
{children}
|
|
41
43
|
</div>
|
|
42
44
|
)
|
|
@@ -11,10 +11,8 @@ export interface CCardBodyProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
11
11
|
|
|
12
12
|
export const CCardBody = forwardRef<HTMLDivElement, CCardBodyProps>(
|
|
13
13
|
({ children, className, ...rest }, ref) => {
|
|
14
|
-
const _className = classNames('card-body', className)
|
|
15
|
-
|
|
16
14
|
return (
|
|
17
|
-
<div className={
|
|
15
|
+
<div className={classNames('card-body', className)} {...rest} ref={ref}>
|
|
18
16
|
{children}
|
|
19
17
|
</div>
|
|
20
18
|
)
|
|
@@ -11,10 +11,8 @@ export interface CCardFooterProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
11
11
|
|
|
12
12
|
export const CCardFooter = forwardRef<HTMLDivElement, CCardFooterProps>(
|
|
13
13
|
({ children, className, ...rest }, ref) => {
|
|
14
|
-
const _className = classNames('card-footer', className)
|
|
15
|
-
|
|
16
14
|
return (
|
|
17
|
-
<div className={
|
|
15
|
+
<div className={classNames('card-footer', className)} {...rest} ref={ref}>
|
|
18
16
|
{children}
|
|
19
17
|
</div>
|
|
20
18
|
)
|
|
@@ -11,10 +11,8 @@ export interface CCardGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
11
11
|
|
|
12
12
|
export const CCardGroup = forwardRef<HTMLDivElement, CCardGroupProps>(
|
|
13
13
|
({ children, className, ...rest }, ref) => {
|
|
14
|
-
const _className = classNames('card-group', className)
|
|
15
|
-
|
|
16
14
|
return (
|
|
17
|
-
<div className={
|
|
15
|
+
<div className={classNames('card-group', className)} {...rest} ref={ref}>
|
|
18
16
|
{children}
|
|
19
17
|
</div>
|
|
20
18
|
)
|
|
@@ -15,10 +15,8 @@ export interface CCardHeaderProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
15
15
|
|
|
16
16
|
export const CCardHeader = forwardRef<HTMLDivElement, CCardHeaderProps>(
|
|
17
17
|
({ children, component: Component = 'div', className, ...rest }, ref) => {
|
|
18
|
-
const _className = classNames('card-header', className)
|
|
19
|
-
|
|
20
18
|
return (
|
|
21
|
-
<Component className={
|
|
19
|
+
<Component className={classNames('card-header', className)} {...rest} ref={ref}>
|
|
22
20
|
{children}
|
|
23
21
|
</Component>
|
|
24
22
|
)
|
|
@@ -22,10 +22,12 @@ export const CCardImage = forwardRef<
|
|
|
22
22
|
HTMLImageElement | HTMLOrSVGElement | HTMLOrSVGImageElement,
|
|
23
23
|
CCardImageProps
|
|
24
24
|
>(({ children, className, component: Component = 'img', orientation, ...rest }, ref) => {
|
|
25
|
-
const _className = classNames(orientation ? `card-img-${orientation}` : 'card-img', className)
|
|
26
|
-
|
|
27
25
|
return (
|
|
28
|
-
<Component
|
|
26
|
+
<Component
|
|
27
|
+
className={classNames(orientation ? `card-img-${orientation}` : 'card-img', className)}
|
|
28
|
+
{...rest}
|
|
29
|
+
ref={ref}
|
|
30
|
+
>
|
|
29
31
|
{children}
|
|
30
32
|
</Component>
|
|
31
33
|
)
|
|
@@ -11,10 +11,8 @@ export interface CCardImageOverlayProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
11
11
|
|
|
12
12
|
export const CCardImageOverlay = forwardRef<HTMLDivElement, CCardImageOverlayProps>(
|
|
13
13
|
({ children, className, ...rest }, ref) => {
|
|
14
|
-
const _className = classNames('card-img-overlay', className)
|
|
15
|
-
|
|
16
14
|
return (
|
|
17
|
-
<div className={
|
|
15
|
+
<div className={classNames('card-img-overlay', className)} {...rest} ref={ref}>
|
|
18
16
|
{children}
|
|
19
17
|
</div>
|
|
20
18
|
)
|
|
@@ -17,10 +17,8 @@ export interface CCardLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement>
|
|
|
17
17
|
|
|
18
18
|
export const CCardLink = forwardRef<HTMLAnchorElement, CCardLinkProps>(
|
|
19
19
|
({ children, className, ...rest }, ref) => {
|
|
20
|
-
const _className = classNames('card-link', className)
|
|
21
|
-
|
|
22
20
|
return (
|
|
23
|
-
<CLink className={
|
|
21
|
+
<CLink className={classNames('card-link', className)} {...rest} ref={ref}>
|
|
24
22
|
{children}
|
|
25
23
|
</CLink>
|
|
26
24
|
)
|