@coreui/react-pro 4.2.0-beta.0 → 4.2.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/accordion/index.d.ts +7 -0
- package/dist/components/alert/index.d.ts +4 -0
- package/dist/components/avatar/index.d.ts +2 -0
- package/dist/components/backdrop/index.d.ts +2 -0
- package/dist/components/badge/index.d.ts +2 -0
- package/dist/components/breadcrumb/index.d.ts +3 -0
- package/dist/components/button/index.d.ts +2 -0
- package/dist/components/button-group/index.d.ts +3 -0
- package/dist/components/calendar/CCalendar.d.ts +36 -12
- package/dist/components/callout/index.d.ts +2 -0
- package/dist/components/card/index.d.ts +12 -0
- package/dist/components/carousel/index.d.ts +4 -0
- package/dist/components/close-button/index.d.ts +2 -0
- package/dist/components/collapse/index.d.ts +2 -0
- package/dist/components/date-picker/CDatePicker.d.ts +13 -0
- package/dist/components/date-picker/index.d.ts +2 -0
- package/dist/components/date-range-picker/CDateRangePicker.d.ts +93 -0
- package/dist/components/date-range-picker/index.d.ts +2 -0
- package/dist/components/datepicker/index.d.ts +2 -0
- package/dist/components/daterangepicker/CDateRangePicker.d.ts +26 -11
- package/dist/components/daterangepicker/index.d.ts +2 -0
- package/dist/components/dropdown/index.d.ts +8 -0
- package/dist/components/footer/index.d.ts +2 -0
- package/dist/components/form/CForm.d.ts +2 -2
- package/dist/components/form/CFormCheck.d.ts +2 -1
- package/dist/components/form/CFormControlValidation.d.ts +46 -0
- package/dist/components/form/CFormControlWrapper.d.ts +31 -0
- package/dist/components/form/CFormInput.d.ts +6 -9
- package/dist/components/form/CFormRange.d.ts +7 -1
- package/dist/components/form/CFormSelect.d.ts +3 -10
- package/dist/components/form/CFormTextarea.d.ts +2 -9
- package/dist/components/form/index.d.ts +14 -0
- package/dist/components/grid/index.d.ts +4 -0
- package/dist/components/header/index.d.ts +7 -0
- package/dist/components/image/index.d.ts +2 -0
- package/dist/components/index.d.ts +41 -0
- package/dist/components/link/index.d.ts +2 -0
- package/dist/components/list-group/index.d.ts +3 -0
- package/dist/components/loading-button/index.d.ts +2 -0
- package/dist/components/modal/CModal.d.ts +3 -0
- package/dist/components/modal/index.d.ts +8 -0
- package/dist/components/multi-select/index.d.ts +2 -0
- package/dist/components/nav/index.d.ts +7 -0
- package/dist/components/navbar/index.d.ts +6 -0
- package/dist/components/offcanvas/index.d.ts +5 -0
- package/dist/components/pagination/index.d.ts +4 -0
- package/dist/components/picker/CPicker.d.ts +52 -7
- package/dist/components/placeholder/index.d.ts +2 -0
- package/dist/components/popover/CPopover.d.ts +2 -2
- package/dist/components/popover/index.d.ts +2 -0
- package/dist/components/progress/index.d.ts +3 -0
- package/dist/components/sidebar/index.d.ts +7 -0
- package/dist/components/smart-table/index.d.ts +2 -0
- package/dist/components/spinner/index.d.ts +2 -0
- package/dist/components/table/index.d.ts +9 -0
- package/dist/components/tabs/index.d.ts +3 -0
- package/dist/components/time-picker/CTimePicker.d.ts +45 -0
- package/dist/components/time-picker/CTimePickerRollCol.d.ts +11 -0
- package/dist/components/time-picker/index.d.ts +2 -0
- package/dist/components/timepicker/CTimePicker.d.ts +9 -13
- package/dist/components/timepicker/index.d.ts +2 -0
- package/dist/components/toast/index.d.ts +6 -0
- package/dist/components/tooltip/CTooltip.d.ts +6 -2
- package/dist/components/tooltip/index.d.ts +2 -0
- package/dist/index.d.ts +0 -128
- package/dist/index.es.js +8368 -5764
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +8367 -5764
- package/dist/index.js.map +1 -1
- package/dist/{components/calendar/CCalendar.utils.d.ts → utils/calendar.d.ts} +5 -2
- package/dist/utils/hooks/useStateWithCallback.d.ts +2 -1
- package/dist/utils/time.d.ts +21 -0
- package/package.json +14 -11
- package/src/components/accordion/__tests__/__snapshots__/CAccordionButton.spec.tsx.snap +2 -0
- package/src/components/accordion/__tests__/__snapshots__/CAccordionHeader.spec.tsx.snap +2 -0
- package/src/components/accordion/index.ts +15 -0
- package/src/components/alert/CAlert.tsx +14 -3
- package/src/components/alert/index.ts +5 -0
- package/src/components/avatar/index.ts +3 -0
- package/src/components/backdrop/CBackdrop.tsx +10 -3
- package/src/components/backdrop/index.ts +3 -0
- package/src/components/badge/index.ts +3 -0
- package/src/components/breadcrumb/index.ts +4 -0
- package/src/components/button/index.ts +3 -0
- package/src/components/button-group/index.ts +4 -0
- package/src/components/calendar/CCalendar.tsx +221 -131
- package/src/components/calendar/__tests__/CCalendar.spec.tsx +9 -0
- package/src/components/calendar/__tests__/__snapshots__/CCalendar.spec.tsx.snap +573 -0
- package/src/components/callout/index.ts +3 -0
- package/src/components/card/index.ts +25 -0
- package/src/components/carousel/index.ts +5 -0
- package/src/components/close-button/index.ts +3 -0
- package/src/components/collapse/CCollapse.tsx +1 -0
- package/src/components/collapse/index.ts +3 -0
- package/src/components/{datepicker → date-picker}/CDatePicker.tsx +3 -2
- package/src/components/date-picker/__tests__/CDatePicker.spec.tsx +9 -0
- package/src/components/date-picker/__tests__/__snapshots__/CDatePicker.spec.tsx.snap +617 -0
- package/src/components/date-picker/index.ts +3 -0
- package/src/components/date-range-picker/CDateRangePicker.tsx +495 -0
- package/src/components/date-range-picker/__tests__/CDateRangePicker.spec.tsx +9 -0
- package/src/components/date-range-picker/__tests__/__snapshots__/CDateRangePicker.spec.tsx.snap +1201 -0
- package/src/components/date-range-picker/index.ts +3 -0
- package/src/components/dropdown/CDropdownItem.tsx +1 -1
- package/src/components/dropdown/CDropdownMenu.tsx +14 -14
- package/src/components/dropdown/index.ts +17 -0
- package/src/components/footer/index.ts +3 -0
- package/src/components/form/CForm.tsx +2 -2
- package/src/components/form/CFormCheck.tsx +32 -7
- package/src/components/form/CFormControlValidation.tsx +97 -0
- package/src/components/form/CFormControlWrapper.tsx +85 -0
- package/src/components/form/CFormInput.tsx +75 -19
- package/src/components/form/CFormRange.tsx +18 -4
- package/src/components/form/CFormSelect.tsx +60 -32
- package/src/components/form/CFormTextarea.tsx +45 -17
- package/src/components/form/index.ts +29 -0
- package/src/components/grid/index.ts +5 -0
- package/src/components/header/index.ts +8 -0
- package/src/components/image/index.ts +3 -0
- package/src/components/index.ts +41 -0
- package/src/components/link/index.ts +3 -0
- package/src/components/list-group/index.ts +4 -0
- package/src/components/loading-button/index.ts +3 -0
- package/src/components/modal/CModal.tsx +3 -2
- package/src/components/modal/index.ts +9 -0
- package/src/components/multi-select/CMultiSelect.tsx +46 -38
- package/src/components/multi-select/index.ts +3 -0
- package/src/components/nav/CNavGroup.tsx +1 -0
- package/src/components/nav/index.ts +8 -0
- package/src/components/navbar/index.ts +7 -0
- package/src/components/offcanvas/COffcanvas.tsx +1 -0
- package/src/components/offcanvas/index.ts +6 -0
- package/src/components/pagination/index.ts +5 -0
- package/src/components/picker/CPicker.tsx +104 -32
- package/src/components/picker/__tests__/CPicker.spec.tsx +9 -0
- package/src/components/picker/__tests__/__snapshots__/CPicker.spec.tsx.snap +23 -0
- package/src/components/placeholder/index.ts +3 -0
- package/src/components/popover/CPopover.tsx +59 -57
- package/src/components/popover/index.ts +3 -0
- package/src/components/progress/index.ts +4 -0
- package/src/components/sidebar/index.ts +8 -0
- package/src/components/smart-table/CSmartTable.tsx +2 -2
- package/src/components/smart-table/index.ts +3 -0
- package/src/components/spinner/index.ts +3 -0
- package/src/components/table/index.ts +19 -0
- package/src/components/tabs/CTabPane.tsx +7 -3
- package/src/components/tabs/index.ts +4 -0
- package/src/components/{timepicker → time-picker}/CTimePicker.tsx +71 -98
- package/src/components/{timepicker → time-picker}/CTimePickerRollCol.tsx +7 -1
- package/src/components/time-picker/__tests__/CTimePicker.spec.tsx +9 -0
- package/src/components/time-picker/index.ts +3 -0
- package/src/components/toast/CToast.tsx +6 -1
- package/src/components/toast/index.ts +7 -0
- package/src/components/tooltip/CTooltip.tsx +63 -45
- package/src/components/tooltip/index.ts +3 -0
- package/src/index.ts +0 -258
- package/src/{components/calendar/CCalendar.utils.ts → utils/calendar.ts} +97 -10
- package/src/utils/hooks/useStateWithCallback.ts +6 -3
- package/src/utils/time.ts +84 -0
- package/dist/components/dropdown/CDropdownToggleCustom.d.ts +0 -15
- package/dist/components/timepicker/CTimePicker.utils.d.ts +0 -4
- package/src/components/daterangepicker/CDateRangePicker.tsx +0 -366
- package/src/components/timepicker/CTimePicker.utils.ts +0 -27
|
@@ -3,6 +3,7 @@ export declare const convertToLocalTime: (d: Date, locale: string, options?: {})
|
|
|
3
3
|
export declare const createGroupsInArray: (arr: any[], numberOfGroups: number) => any[][];
|
|
4
4
|
export declare const getCurrentYear: () => number;
|
|
5
5
|
export declare const getCurrentMonth: () => number;
|
|
6
|
+
export declare const getLocalDateFromString: (string: string, locale: string, time?: boolean | undefined) => Date | undefined;
|
|
6
7
|
export declare const getMonthName: (month: number, locale: string) => string;
|
|
7
8
|
export declare const getMonthsNames: (locale: string) => string[];
|
|
8
9
|
export declare const getYears: (year: number) => number[];
|
|
@@ -10,11 +11,13 @@ export declare const getMonthDetails: (year: number, month: number, firstDayOfWe
|
|
|
10
11
|
date: Date;
|
|
11
12
|
month: string;
|
|
12
13
|
}[][];
|
|
13
|
-
export declare const
|
|
14
|
+
export declare const isDisableDateInRange: (startDate?: Date | null | undefined, endDate?: Date | null | undefined, dates?: Date[] | Date[][] | undefined) => boolean;
|
|
15
|
+
export declare const isDateDisabled: (date: Date, min?: Date | null | undefined, max?: Date | null | undefined, dates?: Date[] | Date[][] | undefined) => boolean | undefined;
|
|
14
16
|
export declare const isDateInRange: (date: Date, start: Date | null, end: Date | null) => boolean | null;
|
|
15
17
|
export declare const isDateSelected: (date: Date, start: Date | null, end: Date | null) => boolean | null;
|
|
16
18
|
export declare const isEndDate: (date: Date, start: Date | null, end: Date | null) => boolean | null;
|
|
17
19
|
export declare const isLastDayOfMonth: (date: Date) => boolean;
|
|
18
|
-
export declare const isSameDateAs: (date: Date, date2: Date) => boolean;
|
|
20
|
+
export declare const isSameDateAs: (date: Date | null, date2: Date | null) => boolean;
|
|
19
21
|
export declare const isStartDate: (date: Date, start: Date | null, end: Date | null) => boolean | null;
|
|
20
22
|
export declare const isToday: (date: Date) => boolean;
|
|
23
|
+
export declare const isValidDate: (date: string) => number | false;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
export declare const useStateWithCallback: <S>(initialState: S, handler?: ((prevState: S) => void) | undefined) => [S, Dispatch<SetStateAction<S>>];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const convert12hTo24h: (abbr: 'am' | 'pm', hour: number) => number;
|
|
2
|
+
export declare const convert24hTo12h: (hour: number) => number;
|
|
3
|
+
export declare const convertTimeToDate: (time: Date | string | null | undefined) => Date | null;
|
|
4
|
+
export declare const getAmPm: (date: Date, locale: string) => "am" | "pm";
|
|
5
|
+
export declare const getListOfHours: (locale: string) => {
|
|
6
|
+
value: number;
|
|
7
|
+
label: string;
|
|
8
|
+
}[];
|
|
9
|
+
export declare const getListOfMinutes: (locale: string, valueAsString?: boolean) => {
|
|
10
|
+
value: string | number;
|
|
11
|
+
label: string;
|
|
12
|
+
}[];
|
|
13
|
+
export declare const getListOfSeconds: (locale: string, valueAsString?: boolean) => {
|
|
14
|
+
value: string | number;
|
|
15
|
+
label: string;
|
|
16
|
+
}[];
|
|
17
|
+
export declare const getSelectedHour: (date: Date | null, locale: string) => number | "";
|
|
18
|
+
export declare const getSelectedMinutes: (date: Date | null) => number | "";
|
|
19
|
+
export declare const getSelectedSeconds: (date: Date | null) => number | "";
|
|
20
|
+
export declare const isAmPm: (locale: string) => boolean;
|
|
21
|
+
export declare const isValidTime: (time: string) => number | false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coreui/react-pro",
|
|
3
|
-
"version": "4.2.0
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "UI Components Library for React.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -35,26 +35,29 @@
|
|
|
35
35
|
"build": "rollup -c"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@coreui/icons-pro": "^
|
|
38
|
+
"@coreui/icons-pro": "^3.0.0-0",
|
|
39
39
|
"@coreui/icons-react": "^2.0.0",
|
|
40
|
-
"@popperjs/core": "^2.11.
|
|
41
|
-
"@rollup/plugin-commonjs": "^21.0.
|
|
40
|
+
"@popperjs/core": "^2.11.5",
|
|
41
|
+
"@rollup/plugin-commonjs": "^21.0.3",
|
|
42
42
|
"@rollup/plugin-node-resolve": "^13.1.3",
|
|
43
|
-
"@rollup/plugin-typescript": "^8.3.
|
|
44
|
-
"@testing-library/jest-dom": "^5.16.
|
|
45
|
-
"@testing-library/react": "^12.1.
|
|
46
|
-
"@types/react": "
|
|
47
|
-
"@types/react-dom": "^17.0.
|
|
43
|
+
"@rollup/plugin-typescript": "^8.3.1",
|
|
44
|
+
"@testing-library/jest-dom": "^5.16.4",
|
|
45
|
+
"@testing-library/react": "^12.1.4",
|
|
46
|
+
"@types/react": "17.0.39",
|
|
47
|
+
"@types/react-dom": "^17.0.15",
|
|
48
48
|
"@types/react-transition-group": "^4.4.4",
|
|
49
49
|
"classnames": "^2.3.1",
|
|
50
|
+
"date-fns": "^2.28.0",
|
|
50
51
|
"prop-types": "^15.8.1",
|
|
51
52
|
"react": "^17.0.2",
|
|
53
|
+
"react-device-detect": "^2.1.2",
|
|
52
54
|
"react-dom": "^17.0.2",
|
|
53
55
|
"react-popper": "^2.2.5",
|
|
54
56
|
"react-transition-group": "^4.4.2",
|
|
55
|
-
"rollup": "^2.
|
|
57
|
+
"rollup": "^2.70.1",
|
|
56
58
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
57
|
-
"
|
|
59
|
+
"tslib": "^2.4.0",
|
|
60
|
+
"typescript": "^4.6.3"
|
|
58
61
|
},
|
|
59
62
|
"peerDependencies": {
|
|
60
63
|
"react": "^17",
|
|
@@ -5,6 +5,7 @@ exports[`CAccordionButton customize 1`] = `
|
|
|
5
5
|
<button
|
|
6
6
|
aria-expanded="true"
|
|
7
7
|
class="accordion-button collapsed bazinga"
|
|
8
|
+
type="button"
|
|
8
9
|
>
|
|
9
10
|
Test
|
|
10
11
|
</button>
|
|
@@ -16,6 +17,7 @@ exports[`loads and displays CAccordionButton component 1`] = `
|
|
|
16
17
|
<button
|
|
17
18
|
aria-expanded="true"
|
|
18
19
|
class="accordion-button collapsed"
|
|
20
|
+
type="button"
|
|
19
21
|
>
|
|
20
22
|
Test
|
|
21
23
|
</button>
|
|
@@ -8,6 +8,7 @@ exports[`CAccordionHeader customize 1`] = `
|
|
|
8
8
|
<button
|
|
9
9
|
aria-expanded="true"
|
|
10
10
|
class="accordion-button collapsed"
|
|
11
|
+
type="button"
|
|
11
12
|
>
|
|
12
13
|
Test
|
|
13
14
|
</button>
|
|
@@ -23,6 +24,7 @@ exports[`loads and displays CAccordionHeader component 1`] = `
|
|
|
23
24
|
<button
|
|
24
25
|
aria-expanded="true"
|
|
25
26
|
class="accordion-button collapsed"
|
|
27
|
+
type="button"
|
|
26
28
|
>
|
|
27
29
|
Test
|
|
28
30
|
</button>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CAccordion } from './CAccordion'
|
|
2
|
+
import { CAccordionBody } from './CAccordionBody'
|
|
3
|
+
import { CAccordionButton } from './CAccordionButton'
|
|
4
|
+
import { CAccordionCollapse } from './CAccordionCollapse'
|
|
5
|
+
import { CAccordionHeader } from './CAccordionHeader'
|
|
6
|
+
import { CAccordionItem } from './CAccordionItem'
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
CAccordion,
|
|
10
|
+
CAccordionBody,
|
|
11
|
+
CAccordionButton,
|
|
12
|
+
CAccordionCollapse,
|
|
13
|
+
CAccordionHeader,
|
|
14
|
+
CAccordionItem,
|
|
15
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { forwardRef, HTMLAttributes, useEffect, useState } from 'react'
|
|
1
|
+
import React, { forwardRef, HTMLAttributes, useEffect, useState, useRef } from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
import classNames from 'classnames'
|
|
4
4
|
import { Transition } from 'react-transition-group'
|
|
@@ -6,6 +6,8 @@ import { Transition } from 'react-transition-group'
|
|
|
6
6
|
import { Colors, colorPropType } from '../Types'
|
|
7
7
|
import { CCloseButton } from '../close-button/CCloseButton'
|
|
8
8
|
|
|
9
|
+
import { useForkedRef } from '../../utils/hooks'
|
|
10
|
+
|
|
9
11
|
export interface CAlertProps extends HTMLAttributes<HTMLDivElement> {
|
|
10
12
|
/**
|
|
11
13
|
* A string of all className you want applied to the component.
|
|
@@ -49,6 +51,8 @@ export const CAlert = forwardRef<HTMLDivElement, CAlertProps>(
|
|
|
49
51
|
},
|
|
50
52
|
ref,
|
|
51
53
|
) => {
|
|
54
|
+
const alertRef = useRef<HTMLDivElement>(null)
|
|
55
|
+
const forkedRef = useForkedRef(ref, alertRef)
|
|
52
56
|
const [_visible, setVisible] = useState(visible)
|
|
53
57
|
|
|
54
58
|
useEffect(() => {
|
|
@@ -69,7 +73,14 @@ export const CAlert = forwardRef<HTMLDivElement, CAlertProps>(
|
|
|
69
73
|
}
|
|
70
74
|
|
|
71
75
|
return (
|
|
72
|
-
<Transition
|
|
76
|
+
<Transition
|
|
77
|
+
in={_visible}
|
|
78
|
+
mountOnEnter
|
|
79
|
+
nodeRef={alertRef}
|
|
80
|
+
onExit={onClose}
|
|
81
|
+
timeout={150}
|
|
82
|
+
unmountOnExit
|
|
83
|
+
>
|
|
73
84
|
{(state) => {
|
|
74
85
|
const transitionClass = getTransitionClass(state)
|
|
75
86
|
return (
|
|
@@ -77,7 +88,7 @@ export const CAlert = forwardRef<HTMLDivElement, CAlertProps>(
|
|
|
77
88
|
className={classNames(_className, transitionClass)}
|
|
78
89
|
role="alert"
|
|
79
90
|
{...rest}
|
|
80
|
-
ref={
|
|
91
|
+
ref={forkedRef}
|
|
81
92
|
>
|
|
82
93
|
{children}
|
|
83
94
|
{dismissible && <CCloseButton onClick={() => setVisible(false)} />}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import React, { forwardRef, HTMLAttributes } from 'react'
|
|
1
|
+
import React, { forwardRef, HTMLAttributes, useRef } from 'react'
|
|
2
2
|
import { Transition } from 'react-transition-group'
|
|
3
3
|
import PropTypes from 'prop-types'
|
|
4
4
|
import classNames from 'classnames'
|
|
5
5
|
|
|
6
|
+
import { useForkedRef } from '../../utils/hooks'
|
|
7
|
+
|
|
6
8
|
export interface CBackdropProps extends HTMLAttributes<HTMLDivElement> {
|
|
7
9
|
/**
|
|
8
10
|
* A string of all className you want applied to the base component.
|
|
@@ -16,6 +18,9 @@ export interface CBackdropProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
16
18
|
|
|
17
19
|
export const CBackdrop = forwardRef<HTMLDivElement, CBackdropProps>(
|
|
18
20
|
({ className = 'modal-backdrop', visible, ...rest }, ref) => {
|
|
21
|
+
const backdropRef = useRef<HTMLDivElement>(null)
|
|
22
|
+
const forkedRef = useForkedRef(ref, backdropRef)
|
|
23
|
+
|
|
19
24
|
const _className = classNames(className, 'fade')
|
|
20
25
|
|
|
21
26
|
const getTransitionClass = (state: string) => {
|
|
@@ -23,10 +28,12 @@ export const CBackdrop = forwardRef<HTMLDivElement, CBackdropProps>(
|
|
|
23
28
|
}
|
|
24
29
|
|
|
25
30
|
return (
|
|
26
|
-
<Transition in={visible} mountOnEnter timeout={150} unmountOnExit>
|
|
31
|
+
<Transition in={visible} mountOnEnter nodeRef={backdropRef} timeout={150} unmountOnExit>
|
|
27
32
|
{(state) => {
|
|
28
33
|
const transitionClass = getTransitionClass(state)
|
|
29
|
-
return
|
|
34
|
+
return (
|
|
35
|
+
<div className={classNames(_className, transitionClass)} {...rest} ref={forkedRef} />
|
|
36
|
+
)
|
|
30
37
|
}}
|
|
31
38
|
</Transition>
|
|
32
39
|
)
|