@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
|
@@ -20,10 +20,10 @@ test('CPaginationItem customize', async () => {
|
|
|
20
20
|
expect(container.firstChild).toHaveClass('active')
|
|
21
21
|
expect(container.firstChild).toHaveClass('disabled')
|
|
22
22
|
let element = container.firstChild
|
|
23
|
-
if (element
|
|
23
|
+
if (element === null) {
|
|
24
|
+
expect(true).toBe(false)
|
|
25
|
+
} else {
|
|
24
26
|
element = element.firstChild
|
|
25
27
|
expect(element).toHaveClass('page-link')
|
|
26
|
-
} else {
|
|
27
|
-
expect(true).toBe(false)
|
|
28
28
|
}
|
|
29
29
|
})
|
|
@@ -7,7 +7,7 @@ import { CDropdown, CDropdownProps } from '../dropdown/CDropdown'
|
|
|
7
7
|
import { CDropdownMenu } from '../dropdown/CDropdownMenu'
|
|
8
8
|
import { CDropdownToggle } from '../dropdown/CDropdownToggle'
|
|
9
9
|
|
|
10
|
-
import { Colors } from '
|
|
10
|
+
import { Colors } from '../../types'
|
|
11
11
|
|
|
12
12
|
export interface CPickerProps extends Omit<CDropdownProps, 'variant'> {
|
|
13
13
|
/**
|
|
@@ -150,16 +150,15 @@ export const CPicker = forwardRef<HTMLDivElement | HTMLLIElement, CPickerProps>(
|
|
|
150
150
|
</>
|
|
151
151
|
)
|
|
152
152
|
|
|
153
|
-
const _className = classNames('picker', className)
|
|
154
|
-
|
|
155
153
|
switch (container) {
|
|
156
|
-
case 'inline':
|
|
157
|
-
return <div className={
|
|
158
|
-
|
|
154
|
+
case 'inline': {
|
|
155
|
+
return <div className={classNames('picker', className)}>{children}</div>
|
|
156
|
+
}
|
|
157
|
+
default: {
|
|
159
158
|
return (
|
|
160
159
|
<CDropdown
|
|
161
160
|
autoClose="outside"
|
|
162
|
-
className={
|
|
161
|
+
className={classNames('picker', className)}
|
|
163
162
|
onHide={() => {
|
|
164
163
|
setVisible(false)
|
|
165
164
|
onHide && onHide()
|
|
@@ -186,6 +185,7 @@ export const CPicker = forwardRef<HTMLDivElement | HTMLLIElement, CPickerProps>(
|
|
|
186
185
|
</CDropdownMenu>
|
|
187
186
|
</CDropdown>
|
|
188
187
|
)
|
|
188
|
+
}
|
|
189
189
|
}
|
|
190
190
|
},
|
|
191
191
|
)
|
|
@@ -2,7 +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 {
|
|
5
|
+
import { colorPropType } from '../../props'
|
|
6
|
+
import type { Colors } from '../../types'
|
|
6
7
|
|
|
7
8
|
export interface CPlaceholderProps extends HTMLAttributes<HTMLSpanElement> {
|
|
8
9
|
/**
|
|
@@ -84,18 +85,20 @@ export const CPlaceholder = forwardRef<HTMLSpanElement, CPlaceholderProps>(
|
|
|
84
85
|
}
|
|
85
86
|
})
|
|
86
87
|
|
|
87
|
-
const _className = classNames(
|
|
88
|
-
animation ? `placeholder-${animation}` : 'placeholder',
|
|
89
|
-
{
|
|
90
|
-
[`bg-${color}`]: color,
|
|
91
|
-
[`placeholder-${size}`]: size,
|
|
92
|
-
},
|
|
93
|
-
repsonsiveClassNames,
|
|
94
|
-
className,
|
|
95
|
-
)
|
|
96
|
-
|
|
97
88
|
return (
|
|
98
|
-
<Component
|
|
89
|
+
<Component
|
|
90
|
+
className={classNames(
|
|
91
|
+
animation ? `placeholder-${animation}` : 'placeholder',
|
|
92
|
+
{
|
|
93
|
+
[`bg-${color}`]: color,
|
|
94
|
+
[`placeholder-${size}`]: size,
|
|
95
|
+
},
|
|
96
|
+
repsonsiveClassNames,
|
|
97
|
+
className,
|
|
98
|
+
)}
|
|
99
|
+
{...rest}
|
|
100
|
+
ref={ref}
|
|
101
|
+
>
|
|
99
102
|
{children}
|
|
100
103
|
</Component>
|
|
101
104
|
)
|
|
@@ -5,7 +5,8 @@ import classNames from 'classnames'
|
|
|
5
5
|
import { usePopper } from 'react-popper'
|
|
6
6
|
import { Transition } from 'react-transition-group'
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { triggerPropType } from '../../props'
|
|
9
|
+
import type { Triggers } from '../../types'
|
|
9
10
|
|
|
10
11
|
export interface CPopoverProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
11
12
|
/**
|
|
@@ -84,16 +85,6 @@ export const CPopover: FC<CPopoverProps> = ({
|
|
|
84
85
|
setVisible(visible)
|
|
85
86
|
}, [visible])
|
|
86
87
|
|
|
87
|
-
const getTransitionClass = (state: string) => {
|
|
88
|
-
return state === 'entering'
|
|
89
|
-
? 'fade'
|
|
90
|
-
: state === 'entered'
|
|
91
|
-
? 'fade show'
|
|
92
|
-
: state === 'exiting'
|
|
93
|
-
? 'fade'
|
|
94
|
-
: 'fade'
|
|
95
|
-
}
|
|
96
|
-
|
|
97
88
|
return (
|
|
98
89
|
<>
|
|
99
90
|
{React.cloneElement(children as React.ReactElement<any>, {
|
|
@@ -124,29 +115,28 @@ export const CPopover: FC<CPopoverProps> = ({
|
|
|
124
115
|
}}
|
|
125
116
|
unmountOnExit
|
|
126
117
|
>
|
|
127
|
-
{(state) =>
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}}
|
|
118
|
+
{(state) => (
|
|
119
|
+
<div
|
|
120
|
+
className={classNames(
|
|
121
|
+
'popover',
|
|
122
|
+
`bs-popover-${placement.replace('left', 'start').replace('right', 'end')}`,
|
|
123
|
+
'fade',
|
|
124
|
+
{
|
|
125
|
+
show: state === 'entered',
|
|
126
|
+
},
|
|
127
|
+
className,
|
|
128
|
+
)}
|
|
129
|
+
ref={setPopperElement}
|
|
130
|
+
role="tooltip"
|
|
131
|
+
style={styles.popper}
|
|
132
|
+
{...attributes.popper}
|
|
133
|
+
{...rest}
|
|
134
|
+
>
|
|
135
|
+
<div className="popover-arrow" style={styles.arrow} ref={setArrowElement}></div>
|
|
136
|
+
<div className="popover-header">{title}</div>
|
|
137
|
+
<div className="popover-body">{content}</div>
|
|
138
|
+
</div>
|
|
139
|
+
)}
|
|
150
140
|
</Transition>,
|
|
151
141
|
document.body,
|
|
152
142
|
)}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { forwardRef, HTMLAttributes } from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
import classNames from 'classnames'
|
|
4
|
+
|
|
4
5
|
import { CProgressBar, CProgressBarProps } from './CProgressBar'
|
|
5
6
|
|
|
6
7
|
export interface CProgressProps
|
|
@@ -30,17 +31,19 @@ export interface CProgressProps
|
|
|
30
31
|
|
|
31
32
|
export const CProgress = forwardRef<HTMLDivElement, CProgressProps>(
|
|
32
33
|
({ children, className, height, thin, value = 0, white, ...rest }, ref) => {
|
|
33
|
-
const _className = classNames(
|
|
34
|
-
'progress',
|
|
35
|
-
{
|
|
36
|
-
'progress-thin': thin,
|
|
37
|
-
'progress-white': white,
|
|
38
|
-
},
|
|
39
|
-
className,
|
|
40
|
-
)
|
|
41
|
-
|
|
42
34
|
return (
|
|
43
|
-
<div
|
|
35
|
+
<div
|
|
36
|
+
className={classNames(
|
|
37
|
+
'progress',
|
|
38
|
+
{
|
|
39
|
+
'progress-thin': thin,
|
|
40
|
+
'progress-white': white,
|
|
41
|
+
},
|
|
42
|
+
className,
|
|
43
|
+
)}
|
|
44
|
+
style={height ? { height: `${height}px` } : {}}
|
|
45
|
+
ref={ref}
|
|
46
|
+
>
|
|
44
47
|
{value ? (
|
|
45
48
|
<CProgressBar value={value} {...rest}>
|
|
46
49
|
{children}
|
|
@@ -2,7 +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 {
|
|
5
|
+
import { colorPropType, gradientsPropType } from '../../props'
|
|
6
|
+
import type { Colors, Gradients } from '../../types'
|
|
6
7
|
|
|
7
8
|
export interface CProgressBarProps extends HTMLAttributes<HTMLDivElement> {
|
|
8
9
|
/**
|
|
@@ -31,19 +32,17 @@ export interface CProgressBarProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
31
32
|
|
|
32
33
|
export const CProgressBar = forwardRef<HTMLDivElement, CProgressBarProps>(
|
|
33
34
|
({ children, animated, className, color, value = 0, variant, ...rest }, ref) => {
|
|
34
|
-
const _className = classNames(
|
|
35
|
-
'progress-bar',
|
|
36
|
-
{
|
|
37
|
-
[`bg-${color}`]: color,
|
|
38
|
-
[`progress-bar-${variant}`]: variant,
|
|
39
|
-
'progress-bar-animated': animated,
|
|
40
|
-
},
|
|
41
|
-
className,
|
|
42
|
-
)
|
|
43
|
-
|
|
44
35
|
return (
|
|
45
36
|
<div
|
|
46
|
-
className={
|
|
37
|
+
className={classNames(
|
|
38
|
+
'progress-bar',
|
|
39
|
+
{
|
|
40
|
+
[`bg-${color}`]: color,
|
|
41
|
+
[`progress-bar-${variant}`]: variant,
|
|
42
|
+
'progress-bar-animated': animated,
|
|
43
|
+
},
|
|
44
|
+
className,
|
|
45
|
+
)}
|
|
47
46
|
role="progressbar"
|
|
48
47
|
style={{ width: `${value}%` }}
|
|
49
48
|
aria-valuenow={value}
|
|
@@ -3,9 +3,10 @@ import { createPortal } from 'react-dom'
|
|
|
3
3
|
import PropTypes from 'prop-types'
|
|
4
4
|
import classNames from 'classnames'
|
|
5
5
|
|
|
6
|
+
import { CBackdrop } from '../backdrop/CBackdrop'
|
|
7
|
+
|
|
6
8
|
import { isInViewport } from '../../utils'
|
|
7
9
|
import { useForkedRef } from '../../hooks'
|
|
8
|
-
import { CBackdrop } from '../backdrop/CBackdrop'
|
|
9
10
|
|
|
10
11
|
export interface CSidebarProps extends HTMLAttributes<HTMLDivElement> {
|
|
11
12
|
/**
|
|
@@ -97,7 +98,7 @@ export const CSidebar = forwardRef<HTMLDivElement, CSidebarProps>(
|
|
|
97
98
|
}, [visible])
|
|
98
99
|
|
|
99
100
|
useEffect(() => {
|
|
100
|
-
|
|
101
|
+
inViewport !== undefined && onVisibleChange && onVisibleChange(inViewport)
|
|
101
102
|
!inViewport && onHide && onHide()
|
|
102
103
|
inViewport && onShow && onShow()
|
|
103
104
|
}, [inViewport])
|
|
@@ -168,25 +169,27 @@ export const CSidebar = forwardRef<HTMLDivElement, CSidebarProps>(
|
|
|
168
169
|
handleHide()
|
|
169
170
|
}
|
|
170
171
|
|
|
171
|
-
const _className = classNames(
|
|
172
|
-
'sidebar',
|
|
173
|
-
{
|
|
174
|
-
[`sidebar-${colorScheme}`]: colorScheme,
|
|
175
|
-
'sidebar-narrow': narrow,
|
|
176
|
-
'sidebar-overlaid': overlaid,
|
|
177
|
-
[`sidebar-${placement}`]: placement,
|
|
178
|
-
[`sidebar-${position}`]: position,
|
|
179
|
-
[`sidebar-${size}`]: size,
|
|
180
|
-
'sidebar-narrow-unfoldable': unfoldable,
|
|
181
|
-
show: _visible === true && mobile,
|
|
182
|
-
hide: _visible === false && !mobile,
|
|
183
|
-
},
|
|
184
|
-
className,
|
|
185
|
-
)
|
|
186
|
-
|
|
187
172
|
return (
|
|
188
173
|
<>
|
|
189
|
-
<div
|
|
174
|
+
<div
|
|
175
|
+
className={classNames(
|
|
176
|
+
'sidebar',
|
|
177
|
+
{
|
|
178
|
+
[`sidebar-${colorScheme}`]: colorScheme,
|
|
179
|
+
'sidebar-narrow': narrow,
|
|
180
|
+
'sidebar-overlaid': overlaid,
|
|
181
|
+
[`sidebar-${placement}`]: placement,
|
|
182
|
+
[`sidebar-${position}`]: position,
|
|
183
|
+
[`sidebar-${size}`]: size,
|
|
184
|
+
'sidebar-narrow-unfoldable': unfoldable,
|
|
185
|
+
show: _visible === true && mobile,
|
|
186
|
+
hide: _visible === false && !mobile,
|
|
187
|
+
},
|
|
188
|
+
className,
|
|
189
|
+
)}
|
|
190
|
+
{...rest}
|
|
191
|
+
ref={forkedRef}
|
|
192
|
+
>
|
|
190
193
|
{children}
|
|
191
194
|
</div>
|
|
192
195
|
{typeof window !== 'undefined' &&
|
|
@@ -11,9 +11,8 @@ export interface CSidebarBrandProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
11
11
|
|
|
12
12
|
export const CSidebarBrand = forwardRef<HTMLDivElement, CSidebarBrandProps>(
|
|
13
13
|
({ children, className, ...rest }, ref) => {
|
|
14
|
-
const _className = classNames('sidebar-brand', className)
|
|
15
14
|
return (
|
|
16
|
-
<div className={
|
|
15
|
+
<div className={classNames('sidebar-brand', className)} ref={ref} {...rest}>
|
|
17
16
|
{children}
|
|
18
17
|
</div>
|
|
19
18
|
)
|
|
@@ -11,9 +11,8 @@ export interface CSidebarFooterProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
11
11
|
|
|
12
12
|
export const CSidebarFooter = forwardRef<HTMLDivElement, CSidebarFooterProps>(
|
|
13
13
|
({ children, className, ...rest }, ref) => {
|
|
14
|
-
const _className = classNames('sidebar-footer', className)
|
|
15
14
|
return (
|
|
16
|
-
<div className={
|
|
15
|
+
<div className={classNames('sidebar-footer', className)} ref={ref} {...rest}>
|
|
17
16
|
{children}
|
|
18
17
|
</div>
|
|
19
18
|
)
|
|
@@ -11,9 +11,8 @@ export interface CSidebarHeaderProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
11
11
|
|
|
12
12
|
export const CSidebarHeader = forwardRef<HTMLDivElement, CSidebarHeaderProps>(
|
|
13
13
|
({ children, className, ...rest }, ref) => {
|
|
14
|
-
const _className = classNames('sidebar-header', className)
|
|
15
14
|
return (
|
|
16
|
-
<div className={
|
|
15
|
+
<div className={classNames('sidebar-header', className)} ref={ref} {...rest}>
|
|
17
16
|
{children}
|
|
18
17
|
</div>
|
|
19
18
|
)
|
|
@@ -23,9 +23,9 @@ export const CSidebarNav = forwardRef<HTMLUListElement, CSidebarNavProps>(
|
|
|
23
23
|
visibleGroup,
|
|
24
24
|
setVisibleGroup,
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
return (
|
|
28
|
-
<ul className={
|
|
28
|
+
<ul className={classNames('sidebar-nav', className)} ref={ref} {...rest}>
|
|
29
29
|
<CNavContext.Provider value={CNavContextValues}>
|
|
30
30
|
{React.Children.map(children, (child, index) => {
|
|
31
31
|
if (React.isValidElement(child)) {
|
|
@@ -11,9 +11,8 @@ export interface CSidebarTogglerProps extends HTMLAttributes<HTMLButtonElement>
|
|
|
11
11
|
|
|
12
12
|
export const CSidebarToggler = forwardRef<HTMLButtonElement, CSidebarTogglerProps>(
|
|
13
13
|
({ children, className, ...rest }, ref) => {
|
|
14
|
-
const _className = classNames('sidebar-toggler', className)
|
|
15
14
|
return (
|
|
16
|
-
<button className={
|
|
15
|
+
<button className={classNames('sidebar-toggler', className)} ref={ref} {...rest}>
|
|
17
16
|
{children}
|
|
18
17
|
</button>
|
|
19
18
|
)
|
|
@@ -92,8 +92,6 @@ export const CSmartPagination = forwardRef<HTMLUListElement, CSmartPaginationPro
|
|
|
92
92
|
},
|
|
93
93
|
ref,
|
|
94
94
|
) => {
|
|
95
|
-
const _classNames = classNames(`justify-content-${align}`, className)
|
|
96
|
-
|
|
97
95
|
const showDots: boolean = (() => {
|
|
98
96
|
return dots && limit > 4 && limit < pages
|
|
99
97
|
})()
|
|
@@ -131,23 +129,21 @@ export const CSmartPagination = forwardRef<HTMLUListElement, CSmartPaginationPro
|
|
|
131
129
|
})()
|
|
132
130
|
|
|
133
131
|
const items: number[] = (() => {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
).reverse()
|
|
150
|
-
}
|
|
132
|
+
return activePage - maxPrevItems <= 1
|
|
133
|
+
? Array.from(
|
|
134
|
+
{
|
|
135
|
+
length: itemsAmount,
|
|
136
|
+
},
|
|
137
|
+
(_v, i) => i + 1,
|
|
138
|
+
)
|
|
139
|
+
: Array.from(
|
|
140
|
+
{
|
|
141
|
+
length: itemsAmount,
|
|
142
|
+
},
|
|
143
|
+
(_v, i) => {
|
|
144
|
+
return lastItem - i
|
|
145
|
+
},
|
|
146
|
+
).reverse()
|
|
151
147
|
})()
|
|
152
148
|
|
|
153
149
|
const setPage = (number: number): void => {
|
|
@@ -157,7 +153,13 @@ export const CSmartPagination = forwardRef<HTMLUListElement, CSmartPaginationPro
|
|
|
157
153
|
}
|
|
158
154
|
|
|
159
155
|
return (
|
|
160
|
-
<CPagination
|
|
156
|
+
<CPagination
|
|
157
|
+
className={classNames(`justify-content-${align}`, className)}
|
|
158
|
+
aria-label="pagination"
|
|
159
|
+
size={size}
|
|
160
|
+
{...rest}
|
|
161
|
+
ref={ref}
|
|
162
|
+
>
|
|
161
163
|
{doubleArrows && (
|
|
162
164
|
<CPaginationItem
|
|
163
165
|
onClick={() => setPage(1)}
|
|
@@ -284,7 +284,7 @@ export const CSmartTable = forwardRef<HTMLDivElement, CSmartTableProps>(
|
|
|
284
284
|
}
|
|
285
285
|
|
|
286
286
|
//if column changed or sort was descending change asc to true
|
|
287
|
-
const state = sorterState
|
|
287
|
+
const state = sorterState ?? { column: '', state: '' }
|
|
288
288
|
|
|
289
289
|
if (state.column === column) {
|
|
290
290
|
if (state.state === 0) {
|
|
@@ -292,11 +292,7 @@ export const CSmartTable = forwardRef<HTMLDivElement, CSmartTableProps>(
|
|
|
292
292
|
} else if (state.state === 'asc') {
|
|
293
293
|
state.state = 'desc'
|
|
294
294
|
} else {
|
|
295
|
-
|
|
296
|
-
state.state = 'asc'
|
|
297
|
-
} else {
|
|
298
|
-
state.state = 0
|
|
299
|
-
}
|
|
295
|
+
state.state = typeof columnSorter === 'object' && !columnSorter.resetable ? 'asc' : 0
|
|
300
296
|
}
|
|
301
297
|
} else {
|
|
302
298
|
state.column = column
|
|
@@ -360,7 +356,7 @@ export const CSmartTable = forwardRef<HTMLDivElement, CSmartTableProps>(
|
|
|
360
356
|
Object.values(columnFilterState).join('')
|
|
361
357
|
}
|
|
362
358
|
onClick={() => handleClean()}
|
|
363
|
-
|
|
359
|
+
onKeyDown={(event) => {
|
|
364
360
|
if (event.key === 'Enter') handleClean()
|
|
365
361
|
}}
|
|
366
362
|
/>
|
|
@@ -378,7 +374,7 @@ export const CSmartTable = forwardRef<HTMLDivElement, CSmartTableProps>(
|
|
|
378
374
|
{...tableHeadProps}
|
|
379
375
|
columnFilter={columnFilter}
|
|
380
376
|
columnFilterState={columnFilterState}
|
|
381
|
-
columns={columns
|
|
377
|
+
columns={columns ?? columnNames}
|
|
382
378
|
columnSorter={columnSorter}
|
|
383
379
|
items={_items}
|
|
384
380
|
selectable={selectable}
|
|
@@ -418,7 +414,7 @@ export const CSmartTable = forwardRef<HTMLDivElement, CSmartTableProps>(
|
|
|
418
414
|
{...tableFootProps}
|
|
419
415
|
columnFilter={false}
|
|
420
416
|
columnSorter={false}
|
|
421
|
-
columns={columns
|
|
417
|
+
columns={columns ?? columnNames}
|
|
422
418
|
items={_items}
|
|
423
419
|
handleSelectAllChecked={() => handleSelectAllChecked()}
|
|
424
420
|
selectable={selectable}
|
|
@@ -51,89 +51,90 @@ export const CSmartTableBody = forwardRef<HTMLTableSectionElement, CSmartTableBo
|
|
|
51
51
|
{...rest}
|
|
52
52
|
ref={ref}
|
|
53
53
|
>
|
|
54
|
-
{currentItems.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
>
|
|
70
|
-
{selectable && (
|
|
71
|
-
<CTableDataCell>
|
|
72
|
-
<CFormCheck
|
|
73
|
-
checked={
|
|
74
|
-
selected &&
|
|
75
|
-
isObjectInArray(selected, item, ['_cellProps', '_props', '_selected'])
|
|
76
|
-
}
|
|
77
|
-
onChange={(event) => {
|
|
78
|
-
const _item = { ...item }
|
|
79
|
-
delete _item['_cellProps']
|
|
80
|
-
delete _item['_props']
|
|
81
|
-
delete _item['_selected']
|
|
82
|
-
onRowChecked && onRowChecked(_item, event.target.checked)
|
|
83
|
-
}}
|
|
84
|
-
/>
|
|
85
|
-
</CTableDataCell>
|
|
86
|
-
)}
|
|
87
|
-
{columnNames.map((colName, index) => {
|
|
88
|
-
return (
|
|
89
|
-
(scopedColumns &&
|
|
90
|
-
scopedColumns[colName] &&
|
|
91
|
-
React.cloneElement(
|
|
92
|
-
scopedColumns[colName](item, trIndex + firstItemOnActivePageIndex),
|
|
93
|
-
{
|
|
94
|
-
key: index,
|
|
95
|
-
},
|
|
96
|
-
)) || (
|
|
97
|
-
<CTableDataCell {...getTableDataCellProps(item, colName)} key={index}>
|
|
98
|
-
{String(item[colName])}
|
|
99
|
-
</CTableDataCell>
|
|
54
|
+
{currentItems.length ? (
|
|
55
|
+
currentItems.map((item: Item, trIndex) => {
|
|
56
|
+
return (
|
|
57
|
+
<React.Fragment key={trIndex}>
|
|
58
|
+
<CTableRow
|
|
59
|
+
{...(item._props && { ...item._props })}
|
|
60
|
+
{...(clickableRows && { tabIndex: 0 })}
|
|
61
|
+
onClick={(event) =>
|
|
62
|
+
onRowClick &&
|
|
63
|
+
onRowClick(
|
|
64
|
+
item,
|
|
65
|
+
trIndex + firstItemOnActivePageIndex,
|
|
66
|
+
getClickedColumnName(event.target as HTMLTextAreaElement, columnNames),
|
|
67
|
+
event,
|
|
100
68
|
)
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
item,
|
|
119
|
-
trIndex + firstItemOnActivePageIndex,
|
|
120
|
-
getClickedColumnName(event.target as HTMLTextAreaElement, columnNames),
|
|
121
|
-
true,
|
|
122
|
-
)
|
|
123
|
-
}
|
|
124
|
-
className="p-0"
|
|
125
|
-
key={`details${trIndex}`}
|
|
126
|
-
>
|
|
127
|
-
<CTableDataCell colSpan={colspan} className="p-0" style={{ border: 0 }}>
|
|
128
|
-
{scopedColumns.details(item, trIndex + firstItemOnActivePageIndex)}
|
|
69
|
+
}
|
|
70
|
+
>
|
|
71
|
+
{selectable && (
|
|
72
|
+
<CTableDataCell>
|
|
73
|
+
<CFormCheck
|
|
74
|
+
checked={
|
|
75
|
+
selected &&
|
|
76
|
+
isObjectInArray(selected, item, ['_cellProps', '_props', '_selected'])
|
|
77
|
+
}
|
|
78
|
+
onChange={(event) => {
|
|
79
|
+
const _item = { ...item }
|
|
80
|
+
delete _item['_cellProps']
|
|
81
|
+
delete _item['_props']
|
|
82
|
+
delete _item['_selected']
|
|
83
|
+
onRowChecked && onRowChecked(_item, event.target.checked)
|
|
84
|
+
}}
|
|
85
|
+
/>
|
|
129
86
|
</CTableDataCell>
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
87
|
+
)}
|
|
88
|
+
{columnNames.map((colName, index) => {
|
|
89
|
+
return (
|
|
90
|
+
(scopedColumns &&
|
|
91
|
+
scopedColumns[colName] &&
|
|
92
|
+
React.cloneElement(
|
|
93
|
+
scopedColumns[colName](item, trIndex + firstItemOnActivePageIndex),
|
|
94
|
+
{
|
|
95
|
+
key: index,
|
|
96
|
+
},
|
|
97
|
+
)) || (
|
|
98
|
+
<CTableDataCell {...getTableDataCellProps(item, colName)} key={index}>
|
|
99
|
+
{String(item[colName])}
|
|
100
|
+
</CTableDataCell>
|
|
101
|
+
)
|
|
102
|
+
)
|
|
103
|
+
})}
|
|
104
|
+
</CTableRow>
|
|
105
|
+
{scopedColumns && scopedColumns.details && (
|
|
106
|
+
<>
|
|
107
|
+
<CTableRow>
|
|
108
|
+
<CTableDataCell
|
|
109
|
+
colSpan={colspan}
|
|
110
|
+
className="p-0"
|
|
111
|
+
style={{ borderBottomWidth: 0 }}
|
|
112
|
+
tabIndex={-1}
|
|
113
|
+
></CTableDataCell>
|
|
114
|
+
</CTableRow>
|
|
115
|
+
<CTableRow
|
|
116
|
+
onClick={(event) =>
|
|
117
|
+
onRowClick &&
|
|
118
|
+
onRowClick(
|
|
119
|
+
item,
|
|
120
|
+
trIndex + firstItemOnActivePageIndex,
|
|
121
|
+
getClickedColumnName(event.target as HTMLTextAreaElement, columnNames),
|
|
122
|
+
true,
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
className="p-0"
|
|
126
|
+
key={`details${trIndex}`}
|
|
127
|
+
>
|
|
128
|
+
<CTableDataCell colSpan={colspan} className="p-0" style={{ border: 0 }}>
|
|
129
|
+
{scopedColumns.details(item, trIndex + firstItemOnActivePageIndex)}
|
|
130
|
+
</CTableDataCell>
|
|
131
|
+
</CTableRow>
|
|
132
|
+
</>
|
|
133
|
+
)}
|
|
134
|
+
</React.Fragment>
|
|
135
|
+
)
|
|
136
|
+
})
|
|
137
|
+
) : (
|
|
137
138
|
<CTableRow>
|
|
138
139
|
<CTableDataCell colSpan={colspan}>{noItemsLabel}</CTableDataCell>
|
|
139
140
|
</CTableRow>
|