@coreui/react-pro 4.8.0 → 4.9.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/index.d.ts +2 -0
- package/dist/components/calendar/utils.d.ts +22 -0
- package/dist/components/callout/CCallout.d.ts +1 -1
- package/dist/components/card/CCard.d.ts +1 -1
- package/dist/components/date-picker/CDatePicker.d.ts +1 -1
- package/dist/components/date-range-picker/CDateRangePicker.d.ts +3 -3
- 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/element-cover/CElementCover.d.ts +0 -4
- package/dist/components/element-cover/index.d.ts +2 -0
- package/dist/components/form/CFormCheck.d.ts +1 -1
- 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/offcanvas/COffcanvas.d.ts +7 -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/CSmartTableBody.d.ts +6 -5
- package/dist/components/smart-table/CSmartTableHead.d.ts +6 -3
- package/dist/components/smart-table/CSmartTableInterface.d.ts +38 -59
- package/dist/components/smart-table/types.d.ts +53 -0
- package/dist/components/smart-table/utils.d.ts +16 -0
- 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/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/time-picker/types.d.ts +15 -0
- package/dist/components/time-picker/utils.d.ts +23 -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/hooks/index.d.ts +3 -0
- package/dist/hooks/useForkedRef.d.ts +7 -0
- package/dist/hooks/useStateWithCallback.d.ts +2 -0
- package/dist/index.es.js +1171 -1109
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1171 -1108
- 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 +2 -3
- package/dist/utils/isObjectInArray.d.ts +2 -0
- package/package.json +11 -11
- package/src/components/accordion/CAccordionBody.tsx +1 -0
- package/src/components/accordion/CAccordionCollapse.tsx +1 -0
- package/src/components/alert/CAlert.tsx +3 -2
- package/src/components/avatar/CAvatar.tsx +2 -8
- package/src/components/backdrop/CBackdrop.tsx +2 -2
- package/src/components/badge/CBadge.tsx +2 -10
- package/src/components/button/CButton.tsx +3 -1
- package/src/components/calendar/CCalendar.tsx +351 -240
- package/src/components/calendar/index.ts +3 -0
- package/src/{utils/calendar.ts → components/calendar/utils.ts} +1 -47
- package/src/components/callout/CCallout.tsx +2 -1
- package/src/components/card/CCard.tsx +2 -1
- package/src/components/carousel/CCarousel.tsx +1 -1
- package/src/components/carousel/CCarouselItem.tsx +1 -1
- package/src/components/collapse/CCollapse.tsx +1 -1
- package/src/components/date-picker/CDatePicker.tsx +1 -1
- package/src/components/date-range-picker/CDateRangePicker.tsx +4 -4
- package/src/components/date-range-picker/utils.ts +49 -0
- package/src/components/dropdown/CDropdown.tsx +3 -2
- package/src/components/dropdown/CDropdownItem.tsx +1 -2
- package/src/components/dropdown/CDropdownMenu.tsx +2 -1
- package/src/components/dropdown/CDropdownToggle.tsx +5 -4
- package/src/components/element-cover/CElementCover.tsx +16 -22
- package/src/components/element-cover/index.ts +3 -0
- package/src/components/form/CFormCheck.tsx +3 -3
- package/src/components/form/CFormControlValidation.tsx +0 -1
- package/src/components/form/CFormControlWrapper.tsx +0 -1
- package/src/components/form/CFormInput.tsx +8 -4
- package/src/components/form/CFormRange.tsx +1 -2
- package/src/components/form/CFormSelect.tsx +1 -2
- package/src/components/form/CFormTextarea.tsx +1 -2
- package/src/components/index.ts +1 -0
- package/src/components/list-group/CListGroupItem.tsx +8 -8
- package/src/components/list-group/CListGroupItem.tsx~HEAD +3 -1
- package/src/components/modal/CModal.tsx +2 -2
- package/src/components/modal/CModalHeader.tsx +3 -2
- package/src/components/multi-select/CMultiSelect.tsx +15 -74
- 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/CNavItem.tsx +1 -0
- package/src/components/nav/CNavLink.tsx +4 -3
- package/src/components/navbar/CNavbar.tsx +2 -1
- package/src/components/offcanvas/COffcanvas.tsx +38 -19
- package/src/components/picker/CPicker.tsx +1 -1
- package/src/components/placeholder/CPlaceholder.tsx +2 -1
- package/src/components/popover/CPopover.tsx +2 -1
- package/src/components/progress/CProgress.tsx +1 -0
- package/src/components/progress/CProgressBar.tsx +2 -1
- package/src/components/sidebar/CSidebar.tsx +3 -2
- package/src/components/smart-table/CSmartTable.tsx +263 -257
- package/src/components/smart-table/CSmartTableBody.tsx +98 -107
- package/src/components/smart-table/CSmartTableCleaner.tsx +1 -1
- package/src/components/smart-table/CSmartTableFilter.tsx +1 -3
- package/src/components/smart-table/CSmartTableHead.tsx +56 -103
- package/src/components/smart-table/CSmartTableInterface.tsx +49 -71
- package/src/components/smart-table/CSmartTableItemsPerPageSelector.tsx +1 -2
- package/src/components/smart-table/types.ts +65 -0
- package/src/components/smart-table/utils.ts +199 -0
- package/src/components/spinner/CSpinner.tsx +2 -1
- package/src/components/table/CTable.tsx +25 -59
- package/src/components/table/CTableBody.tsx +2 -1
- package/src/components/table/CTableDataCell.tsx +2 -1
- package/src/components/table/CTableFoot.tsx +2 -1
- package/src/components/table/CTableHead.tsx +2 -1
- package/src/components/table/CTableHeaderCell.tsx +2 -1
- package/src/components/table/CTableRow.tsx +2 -1
- package/src/components/table/types.ts +20 -0
- package/src/components/table/utils.ts +29 -0
- package/src/components/tabs/CTabPane.tsx +2 -1
- package/src/components/time-picker/CTimePicker.tsx +48 -23
- package/src/components/time-picker/CTimePickerRollCol.tsx +1 -1
- package/src/components/time-picker/types.ts +15 -0
- package/src/{utils/time.ts → components/time-picker/utils.ts} +43 -2
- package/src/components/toast/CToast.tsx +4 -4
- package/src/components/toast/CToastClose.tsx +2 -2
- package/src/components/toast/CToaster.tsx +2 -1
- package/src/components/tooltip/CTooltip.tsx +3 -2
- package/src/components/virtual-scroller/CVirtualScroller.tsx +32 -55
- package/src/components/widgets/CWidgetStatsA.tsx +3 -3
- package/src/components/widgets/CWidgetStatsB.tsx +4 -4
- package/src/components/widgets/CWidgetStatsC.tsx +4 -4
- package/src/components/widgets/CWidgetStatsD.tsx +4 -5
- package/src/components/widgets/CWidgetStatsE.tsx +1 -2
- package/src/components/widgets/CWidgetStatsF.tsx +3 -4
- package/src/{components/Types.tsx → props.ts} +1 -68
- package/src/types.ts +68 -0
- package/src/utils/index.ts +2 -3
- package/src/utils/isObjectInArray.ts +14 -0
- 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/{utils/hooks → hooks}/index.ts +0 -0
- /package/src/{utils/hooks → hooks}/useForkedRef.ts +0 -0
- /package/src/{utils/hooks → hooks}/useStateWithCallback.ts +0 -0
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
import PropTypes from 'prop-types'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export type Colors =
|
|
6
|
-
| 'primary'
|
|
7
|
-
| 'secondary'
|
|
8
|
-
| 'success'
|
|
9
|
-
| 'danger'
|
|
10
|
-
| 'warning'
|
|
11
|
-
| 'info'
|
|
12
|
-
| 'dark'
|
|
13
|
-
| 'light'
|
|
14
|
-
| string
|
|
3
|
+
import type { Placements, Triggers } from './types'
|
|
15
4
|
|
|
16
5
|
export const colorPropType = PropTypes.oneOfType([
|
|
17
6
|
PropTypes.oneOf([
|
|
@@ -27,16 +16,6 @@ export const colorPropType = PropTypes.oneOfType([
|
|
|
27
16
|
PropTypes.string,
|
|
28
17
|
])
|
|
29
18
|
|
|
30
|
-
export type Gradients =
|
|
31
|
-
| 'primary-gradient'
|
|
32
|
-
| 'secondary-gradient'
|
|
33
|
-
| 'success-gradient'
|
|
34
|
-
| 'danger-gradient'
|
|
35
|
-
| 'warning-gradient'
|
|
36
|
-
| 'info-gradient'
|
|
37
|
-
| 'dark-gradient'
|
|
38
|
-
| 'light-gradient'
|
|
39
|
-
|
|
40
19
|
export const gradientsPropType = PropTypes.oneOf([
|
|
41
20
|
'primary-gradient',
|
|
42
21
|
'secondary-gradient',
|
|
@@ -48,24 +27,6 @@ export const gradientsPropType = PropTypes.oneOf([
|
|
|
48
27
|
'light-gradient',
|
|
49
28
|
])
|
|
50
29
|
|
|
51
|
-
export type Placements =
|
|
52
|
-
| 'auto'
|
|
53
|
-
| 'auto-start'
|
|
54
|
-
| 'auto-end'
|
|
55
|
-
| 'top-end'
|
|
56
|
-
| 'top'
|
|
57
|
-
| 'top-start'
|
|
58
|
-
| 'bottom-end'
|
|
59
|
-
| 'bottom'
|
|
60
|
-
| 'bottom-start'
|
|
61
|
-
| 'right-start'
|
|
62
|
-
| 'right'
|
|
63
|
-
| 'right-end'
|
|
64
|
-
| 'left-start'
|
|
65
|
-
| 'left'
|
|
66
|
-
| 'left-end'
|
|
67
|
-
| undefined
|
|
68
|
-
|
|
69
30
|
export const placementPropType = PropTypes.oneOf<Placements>([
|
|
70
31
|
'auto',
|
|
71
32
|
'auto-start',
|
|
@@ -84,20 +45,6 @@ export const placementPropType = PropTypes.oneOf<Placements>([
|
|
|
84
45
|
'left-end',
|
|
85
46
|
])
|
|
86
47
|
|
|
87
|
-
export type Shapes =
|
|
88
|
-
| 'rounded'
|
|
89
|
-
| 'rounded-top'
|
|
90
|
-
| 'rounded-end'
|
|
91
|
-
| 'rounded-bottom'
|
|
92
|
-
| 'rounded-start'
|
|
93
|
-
| 'rounded-circle'
|
|
94
|
-
| 'rounded-pill'
|
|
95
|
-
| 'rounded-0'
|
|
96
|
-
| 'rounded-1'
|
|
97
|
-
| 'rounded-2'
|
|
98
|
-
| 'rounded-3'
|
|
99
|
-
| string
|
|
100
|
-
|
|
101
48
|
export const shapePropType = PropTypes.oneOfType([
|
|
102
49
|
PropTypes.oneOf([
|
|
103
50
|
'rounded',
|
|
@@ -115,24 +62,10 @@ export const shapePropType = PropTypes.oneOfType([
|
|
|
115
62
|
PropTypes.string,
|
|
116
63
|
])
|
|
117
64
|
|
|
118
|
-
export type TextColors =
|
|
119
|
-
| Colors
|
|
120
|
-
| 'white'
|
|
121
|
-
| 'muted'
|
|
122
|
-
| 'high-emphasis'
|
|
123
|
-
| 'medium-emphasis'
|
|
124
|
-
| 'disabled'
|
|
125
|
-
| 'high-emphasis-inverse'
|
|
126
|
-
| 'medium-emphasis-inverse'
|
|
127
|
-
| 'disabled-inverse'
|
|
128
|
-
| string
|
|
129
|
-
|
|
130
65
|
export const textColorsPropType = PropTypes.oneOfType([
|
|
131
66
|
colorPropType,
|
|
132
67
|
PropTypes.oneOf(['white', 'muted']),
|
|
133
68
|
PropTypes.string,
|
|
134
69
|
])
|
|
135
70
|
|
|
136
|
-
export type Triggers = 'hover' | 'focus' | 'click'
|
|
137
|
-
|
|
138
71
|
export const triggerPropType = PropTypes.oneOf<Triggers>(['hover', 'focus', 'click'])
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export type Breakpoints = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'
|
|
2
|
+
|
|
3
|
+
export type Colors =
|
|
4
|
+
| 'primary'
|
|
5
|
+
| 'secondary'
|
|
6
|
+
| 'success'
|
|
7
|
+
| 'danger'
|
|
8
|
+
| 'warning'
|
|
9
|
+
| 'info'
|
|
10
|
+
| 'dark'
|
|
11
|
+
| 'light'
|
|
12
|
+
| string
|
|
13
|
+
|
|
14
|
+
export type Gradients =
|
|
15
|
+
| 'primary-gradient'
|
|
16
|
+
| 'secondary-gradient'
|
|
17
|
+
| 'success-gradient'
|
|
18
|
+
| 'danger-gradient'
|
|
19
|
+
| 'warning-gradient'
|
|
20
|
+
| 'info-gradient'
|
|
21
|
+
| 'dark-gradient'
|
|
22
|
+
| 'light-gradient'
|
|
23
|
+
|
|
24
|
+
export type Placements =
|
|
25
|
+
| 'auto'
|
|
26
|
+
| 'auto-start'
|
|
27
|
+
| 'auto-end'
|
|
28
|
+
| 'top-end'
|
|
29
|
+
| 'top'
|
|
30
|
+
| 'top-start'
|
|
31
|
+
| 'bottom-end'
|
|
32
|
+
| 'bottom'
|
|
33
|
+
| 'bottom-start'
|
|
34
|
+
| 'right-start'
|
|
35
|
+
| 'right'
|
|
36
|
+
| 'right-end'
|
|
37
|
+
| 'left-start'
|
|
38
|
+
| 'left'
|
|
39
|
+
| 'left-end'
|
|
40
|
+
| undefined
|
|
41
|
+
|
|
42
|
+
export type Shapes =
|
|
43
|
+
| 'rounded'
|
|
44
|
+
| 'rounded-top'
|
|
45
|
+
| 'rounded-end'
|
|
46
|
+
| 'rounded-bottom'
|
|
47
|
+
| 'rounded-start'
|
|
48
|
+
| 'rounded-circle'
|
|
49
|
+
| 'rounded-pill'
|
|
50
|
+
| 'rounded-0'
|
|
51
|
+
| 'rounded-1'
|
|
52
|
+
| 'rounded-2'
|
|
53
|
+
| 'rounded-3'
|
|
54
|
+
| string
|
|
55
|
+
|
|
56
|
+
export type TextColors =
|
|
57
|
+
| Colors
|
|
58
|
+
| 'white'
|
|
59
|
+
| 'muted'
|
|
60
|
+
| 'high-emphasis'
|
|
61
|
+
| 'medium-emphasis'
|
|
62
|
+
| 'disabled'
|
|
63
|
+
| 'high-emphasis-inverse'
|
|
64
|
+
| 'medium-emphasis-inverse'
|
|
65
|
+
| 'disabled-inverse'
|
|
66
|
+
| string
|
|
67
|
+
|
|
68
|
+
export type Triggers = 'hover' | 'focus' | 'click'
|
package/src/utils/index.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import getNextSibling from './getNextSibling'
|
|
2
|
-
import getPreviousSibling from './getPreviousSibling'
|
|
3
1
|
import isInViewport from './isInViewport'
|
|
2
|
+
import isObjectInArray from './isObjectInArray'
|
|
4
3
|
|
|
5
|
-
export {
|
|
4
|
+
export { isInViewport, isObjectInArray }
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const isObjectInArray = <T>(array: T[], item: T, ignore: string[] = []) =>
|
|
2
|
+
array.some((_item: T) => {
|
|
3
|
+
let result = true
|
|
4
|
+
for (const key in item) {
|
|
5
|
+
if (!ignore.includes(key) && item[key] !== _item[key]) {
|
|
6
|
+
result = false
|
|
7
|
+
break
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return result
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export default isObjectInArray
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// TODO: check if component property is necessary.
|
|
2
|
-
|
|
3
|
-
import React, { forwardRef, HTMLAttributes } from 'react'
|
|
4
|
-
|
|
5
|
-
export const CMultiSelectCleaner = forwardRef<HTMLButtonElement, HTMLAttributes<HTMLButtonElement>>(
|
|
6
|
-
(props, ref) => {
|
|
7
|
-
return (
|
|
8
|
-
<button
|
|
9
|
-
type="button"
|
|
10
|
-
className="form-multi-select-selection-cleaner"
|
|
11
|
-
{...props}
|
|
12
|
-
ref={ref}
|
|
13
|
-
></button>
|
|
14
|
-
)
|
|
15
|
-
},
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
CMultiSelectCleaner.displayName = 'CMultiSelectCleaner'
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
const getNextSibling = (elem: HTMLElement, selector?: string) => {
|
|
2
|
-
// Get the next sibling element
|
|
3
|
-
let sibling = elem.nextElementSibling
|
|
4
|
-
|
|
5
|
-
// If there's no selector, return the first sibling
|
|
6
|
-
if (!selector) return sibling
|
|
7
|
-
|
|
8
|
-
// If the sibling matches our selector, use it
|
|
9
|
-
// If not, jump to the next sibling and continue the loop
|
|
10
|
-
while (sibling) {
|
|
11
|
-
if (sibling.matches(selector)) return sibling
|
|
12
|
-
sibling = sibling.nextElementSibling
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
return
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default getNextSibling
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
const getPreviousSibling = (elem: HTMLElement, selector?: string) => {
|
|
2
|
-
// Get the next sibling element
|
|
3
|
-
let sibling = elem.previousElementSibling
|
|
4
|
-
|
|
5
|
-
// If there's no selector, return the first sibling
|
|
6
|
-
if (!selector) return sibling
|
|
7
|
-
|
|
8
|
-
// If the sibling matches our selector, use it
|
|
9
|
-
// If not, jump to the next sibling and continue the loop
|
|
10
|
-
while (sibling) {
|
|
11
|
-
if (sibling.matches(selector)) return sibling
|
|
12
|
-
sibling = sibling.previousElementSibling
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
return
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default getPreviousSibling
|
|
File without changes
|
|
File without changes
|
|
File without changes
|