@coreui/react-pro 4.2.0-beta.0 → 4.2.0-beta.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/calendar/CCalendar.d.ts +27 -10
- package/dist/components/calendar/CCalendar.utils.d.ts +2 -1
- package/dist/components/daterangepicker/CDateRangePicker.d.ts +26 -11
- package/dist/components/picker/CPicker.d.ts +50 -9
- package/dist/components/timepicker/CTimePicker.d.ts +9 -13
- package/dist/components/timepicker/CTimePicker.utils.d.ts +13 -0
- package/dist/index.es.js +243 -206
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +243 -206
- package/dist/index.js.map +1 -1
- package/dist/utils/calendar.d.ts +21 -0
- package/dist/utils/time.d.ts +17 -0
- package/package.json +3 -2
- 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/calendar/CCalendar.tsx +104 -58
- 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/datepicker/CDatePicker.tsx +1 -0
- package/src/components/datepicker/__tests__/CDatePicker.spec.tsx +9 -0
- package/src/components/datepicker/__tests__/__snapshots__/CDatePicker.spec.tsx.snap +617 -0
- package/src/components/daterangepicker/CDateRangePicker.tsx +152 -91
- package/src/components/daterangepicker/__tests__/CDateRangePicker.spec.tsx +9 -0
- package/src/components/daterangepicker/__tests__/__snapshots__/CDateRangePicker.spec.tsx.snap +1201 -0
- package/src/components/dropdown/CDropdownMenu.tsx +5 -3
- package/src/components/picker/CPicker.tsx +99 -34
- 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/timepicker/CTimePicker.tsx +66 -87
- package/src/components/timepicker/CTimePickerRollCol.tsx +7 -1
- package/src/components/timepicker/__tests__/CTimePicker.spec.tsx +9 -0
- package/src/{components/calendar/CCalendar.utils.ts → utils/calendar.ts} +11 -1
- package/src/utils/time.ts +58 -0
- package/src/components/timepicker/CTimePicker.utils.ts +0 -27
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
|
|
44
44
|
Several quick start options are available:
|
|
45
45
|
|
|
46
|
-
- [Download the latest release](https://github.com/coreui/coreui-react/archive/v4.2.0-beta.
|
|
46
|
+
- [Download the latest release](https://github.com/coreui/coreui-react/archive/v4.2.0-beta.1.zip)
|
|
47
47
|
- Clone the repo: `git clone https://github.com/coreui/coreui-react.git`
|
|
48
48
|
- Install with [npm](https://www.npmjs.com/): `npm install @coreui/react`
|
|
49
49
|
- Install with [yarn](https://yarnpkg.com/): `yarn add @coreui/react`
|
|
@@ -18,21 +18,32 @@ export interface CCalendarProps {
|
|
|
18
18
|
endDate?: Date | string | null;
|
|
19
19
|
/**
|
|
20
20
|
* Sets the day of start week.
|
|
21
|
-
* 0 - Sunday,
|
|
21
|
+
* - 0 - Sunday,
|
|
22
|
+
* - 1 - Monday,
|
|
23
|
+
* - 2 - Tuesday,
|
|
24
|
+
* - 3 - Wednesday,
|
|
25
|
+
* - 4 - Thursday,
|
|
26
|
+
* - 5 - Friday,
|
|
27
|
+
* - 6 - Saturday,
|
|
28
|
+
* - 7 - Sunday
|
|
29
|
+
*
|
|
30
|
+
* @default 1
|
|
22
31
|
*/
|
|
23
32
|
firstDayOfWeek?: number;
|
|
24
33
|
/**
|
|
25
|
-
* Sets the default locale for components. If not set, it is inherited from the
|
|
34
|
+
* Sets the default locale for components. If not set, it is inherited from the browser.
|
|
35
|
+
*
|
|
36
|
+
* @default 'default'
|
|
26
37
|
*/
|
|
27
38
|
locale?: string;
|
|
28
39
|
/**
|
|
29
40
|
* Max selectable date.
|
|
30
41
|
*/
|
|
31
|
-
maxDate?: Date;
|
|
42
|
+
maxDate?: Date | string;
|
|
32
43
|
/**
|
|
33
44
|
* Min selectable date.
|
|
34
45
|
*/
|
|
35
|
-
minDate?: Date;
|
|
46
|
+
minDate?: Date | string;
|
|
36
47
|
/**
|
|
37
48
|
* Show arrows navigation.
|
|
38
49
|
*/
|
|
@@ -40,19 +51,19 @@ export interface CCalendarProps {
|
|
|
40
51
|
/**
|
|
41
52
|
* The custom next icon.
|
|
42
53
|
*/
|
|
43
|
-
|
|
54
|
+
navNextIcon?: ReactNode;
|
|
44
55
|
/**
|
|
45
56
|
* The custom next double icon.
|
|
46
57
|
*/
|
|
47
|
-
|
|
58
|
+
navNextDoubleIcon?: ReactNode;
|
|
48
59
|
/**
|
|
49
60
|
* The custom prev icon.
|
|
50
61
|
*/
|
|
51
|
-
|
|
62
|
+
navPrevIcon?: ReactNode;
|
|
52
63
|
/**
|
|
53
64
|
* The custom prev double icon.
|
|
54
65
|
*/
|
|
55
|
-
|
|
66
|
+
navPrevDoubleIcon?: ReactNode;
|
|
56
67
|
/**
|
|
57
68
|
* Allow range selection.
|
|
58
69
|
*/
|
|
@@ -66,9 +77,11 @@ export interface CCalendarProps {
|
|
|
66
77
|
*/
|
|
67
78
|
startDate?: Date | string | null;
|
|
68
79
|
/**
|
|
69
|
-
* Set length of day name.
|
|
80
|
+
* Set length or format of day name.
|
|
81
|
+
*
|
|
82
|
+
* @default 2
|
|
70
83
|
*/
|
|
71
|
-
|
|
84
|
+
weekdayFormat?: number | 'long' | 'narrow' | 'short';
|
|
72
85
|
/**
|
|
73
86
|
* Callback fired when the user hovers over the calendar cell.
|
|
74
87
|
*/
|
|
@@ -85,5 +98,9 @@ export interface CCalendarProps {
|
|
|
85
98
|
* Callback fired when the end date changed.
|
|
86
99
|
*/
|
|
87
100
|
onEndDateChange?: (date: Date | null) => void;
|
|
101
|
+
/**
|
|
102
|
+
* Callback fired when the view type of calendar changed.
|
|
103
|
+
*/
|
|
104
|
+
onViewChanged?: (view: string) => void;
|
|
88
105
|
}
|
|
89
106
|
export declare const CCalendar: React.ForwardRefExoticComponent<CCalendarProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -10,7 +10,7 @@ export declare const getMonthDetails: (year: number, month: number, firstDayOfWe
|
|
|
10
10
|
date: Date;
|
|
11
11
|
month: string;
|
|
12
12
|
}[][];
|
|
13
|
-
export declare const isDisabled: (date: Date, min?: Date | undefined, max?: Date | undefined, dates?: Date[] | Date[][] | undefined) => boolean | undefined;
|
|
13
|
+
export declare const isDisabled: (date: Date, min?: Date | null | undefined, max?: Date | null | undefined, dates?: Date[] | Date[][] | undefined) => boolean | undefined;
|
|
14
14
|
export declare const isDateInRange: (date: Date, start: Date | null, end: Date | null) => boolean | null;
|
|
15
15
|
export declare const isDateSelected: (date: Date, start: Date | null, end: Date | null) => boolean | null;
|
|
16
16
|
export declare const isEndDate: (date: Date, start: Date | null, end: Date | null) => boolean | null;
|
|
@@ -18,3 +18,4 @@ export declare const isLastDayOfMonth: (date: Date) => boolean;
|
|
|
18
18
|
export declare const isSameDateAs: (date: Date, date2: Date) => boolean;
|
|
19
19
|
export declare const isStartDate: (date: Date, start: Date | null, end: Date | null) => boolean | null;
|
|
20
20
|
export declare const isToday: (date: Date) => boolean;
|
|
21
|
+
export declare const isValidDate: (date: string) => number | false;
|
|
@@ -1,27 +1,24 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import { CCalendarProps } from '../calendar/CCalendar';
|
|
3
|
-
import { CPickerProps } from '
|
|
3
|
+
import { CPickerProps } from '../picker/CPicker';
|
|
4
|
+
import { Colors } from '../Types';
|
|
4
5
|
export interface CDateRangePickerProps extends Omit<CPickerProps, 'autoClose' | 'component' | 'dark' | 'placeholder' | 'variant'>, Omit<CCalendarProps, 'onCalendarCellHover' | 'onCalendarDateChange'> {
|
|
5
6
|
/**
|
|
6
7
|
* The number of calendars that render on desktop devices.
|
|
7
8
|
*/
|
|
8
9
|
calendars?: number;
|
|
9
10
|
/**
|
|
10
|
-
*
|
|
11
|
+
* A string of all className you want applied to the component.
|
|
11
12
|
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Cleaner icon.
|
|
15
|
-
*/
|
|
16
|
-
cleanerIcon?: ReactNode | boolean;
|
|
13
|
+
className?: string;
|
|
17
14
|
/**
|
|
18
|
-
*
|
|
15
|
+
* Toggle visibility or set the content of the cleaner button.
|
|
19
16
|
*/
|
|
20
|
-
|
|
17
|
+
cleaner?: boolean;
|
|
21
18
|
/**
|
|
22
|
-
*
|
|
19
|
+
* Toggle visibility or set the content of the input indicator.
|
|
23
20
|
*/
|
|
24
|
-
|
|
21
|
+
indicator?: ReactNode | boolean;
|
|
25
22
|
/**
|
|
26
23
|
* Toggle the readonly state for the component.
|
|
27
24
|
*/
|
|
@@ -38,6 +35,24 @@ export interface CDateRangePickerProps extends Omit<CPickerProps, 'autoClose' |
|
|
|
38
35
|
* Predefined date ranges the user can select from.
|
|
39
36
|
*/
|
|
40
37
|
ranges?: object;
|
|
38
|
+
/**
|
|
39
|
+
* Sets the color context of the cancel button to one of CoreUI’s themed colors.
|
|
40
|
+
*
|
|
41
|
+
* @type 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light' | string
|
|
42
|
+
*/
|
|
43
|
+
rangesButtonsColor?: Colors;
|
|
44
|
+
/**
|
|
45
|
+
* Size the ranges button small or large.
|
|
46
|
+
*/
|
|
47
|
+
rangesButtonsSize?: 'sm' | 'lg';
|
|
48
|
+
/**
|
|
49
|
+
* Set the ranges button variant to an outlined button or a ghost button.
|
|
50
|
+
*/
|
|
51
|
+
rangesButtonsVariant?: 'outline' | 'ghost';
|
|
52
|
+
/**
|
|
53
|
+
* Default icon or character character that separates two dates.
|
|
54
|
+
*/
|
|
55
|
+
separator?: ReactNode | boolean;
|
|
41
56
|
/**
|
|
42
57
|
* Size the component small or large.
|
|
43
58
|
*/
|
|
@@ -1,10 +1,55 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import { CDropdownProps } from '../dropdown/CDropdown';
|
|
3
|
+
import { Colors } from '../Types';
|
|
3
4
|
export interface CPickerProps extends Omit<CDropdownProps, 'variant'> {
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
+
* Toggle visibility or set the content of cancel button.
|
|
7
|
+
*
|
|
8
|
+
* @default 'Cancel'
|
|
6
9
|
*/
|
|
7
|
-
|
|
10
|
+
cancelButton?: boolean | ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Sets the color context of the cancel button to one of CoreUI’s themed colors.
|
|
13
|
+
*
|
|
14
|
+
* @type 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light' | string
|
|
15
|
+
* @default 'primary'
|
|
16
|
+
*/
|
|
17
|
+
cancelButtonColor?: Colors;
|
|
18
|
+
/**
|
|
19
|
+
* Size the cancel button small or large.
|
|
20
|
+
*
|
|
21
|
+
* @default 'sm'
|
|
22
|
+
*/
|
|
23
|
+
cancelButtonSize?: 'sm' | 'lg';
|
|
24
|
+
/**
|
|
25
|
+
* Set the cancel button variant to an outlined button or a ghost button.
|
|
26
|
+
*
|
|
27
|
+
* @default 'ghost'
|
|
28
|
+
*/
|
|
29
|
+
cancelButtonVariant?: 'outline' | 'ghost';
|
|
30
|
+
/**
|
|
31
|
+
* Toggle visibility or set the content of confirm button.
|
|
32
|
+
*
|
|
33
|
+
* @default 'OK'
|
|
34
|
+
*/
|
|
35
|
+
confirmButton?: boolean | ReactNode;
|
|
36
|
+
/**
|
|
37
|
+
* Sets the color context of the confirm button to one of CoreUI’s themed colors.
|
|
38
|
+
*
|
|
39
|
+
* @type 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light' | string
|
|
40
|
+
* @default 'primary'
|
|
41
|
+
*/
|
|
42
|
+
confirmButtonColor?: Colors;
|
|
43
|
+
/**
|
|
44
|
+
* Size the confirm button small or large.
|
|
45
|
+
*
|
|
46
|
+
* @default 'sm'
|
|
47
|
+
*/
|
|
48
|
+
confirmButtonSize?: 'sm' | 'lg';
|
|
49
|
+
/**
|
|
50
|
+
* Set the confirm button variant to an outlined button or a ghost button.
|
|
51
|
+
*/
|
|
52
|
+
confirmButtonVariant?: 'outline' | 'ghost';
|
|
8
53
|
/**
|
|
9
54
|
* Set container type for the component.
|
|
10
55
|
*/
|
|
@@ -17,18 +62,14 @@ export interface CPickerProps extends Omit<CDropdownProps, 'variant'> {
|
|
|
17
62
|
* Toggle visibility of footer element or set the content of footer.
|
|
18
63
|
*/
|
|
19
64
|
footer?: boolean | ReactNode;
|
|
20
|
-
/**
|
|
21
|
-
* Ok button text
|
|
22
|
-
*/
|
|
23
|
-
okButtonText?: ReactNode;
|
|
24
65
|
/**
|
|
25
66
|
* Callback fired when the cancel button has been clicked.
|
|
26
67
|
*/
|
|
27
|
-
|
|
68
|
+
onCancel?: () => void;
|
|
28
69
|
/**
|
|
29
|
-
* Callback fired when the
|
|
70
|
+
* Callback fired when the confirm button has been clicked.
|
|
30
71
|
*/
|
|
31
|
-
|
|
72
|
+
onConfirm?: () => void;
|
|
32
73
|
/**
|
|
33
74
|
* The content of toggler.
|
|
34
75
|
*/
|
|
@@ -6,29 +6,25 @@ export interface CTimePickerProps extends Omit<CPickerProps, 'autoClose' | 'comp
|
|
|
6
6
|
*/
|
|
7
7
|
className?: string;
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Toggle visibility or set the content of the cleaner button.
|
|
10
10
|
*/
|
|
11
|
-
cleaner?: boolean;
|
|
11
|
+
cleaner?: ReactNode | boolean;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Toggle visibility or set the content of the input indicator.
|
|
14
14
|
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Default input icon.
|
|
18
|
-
*/
|
|
19
|
-
defaultIcon?: ReactNode | boolean;
|
|
15
|
+
indicator?: ReactNode | boolean;
|
|
20
16
|
/**
|
|
21
17
|
* Toggle the readonly state for the component.
|
|
22
18
|
*/
|
|
23
19
|
inputReadOnly?: boolean;
|
|
24
20
|
/**
|
|
25
|
-
* Sets the default locale for components. If not set, it is inherited from the
|
|
21
|
+
* Sets the default locale for components. If not set, it is inherited from the browser.
|
|
26
22
|
*/
|
|
27
23
|
locale?: string;
|
|
28
24
|
/**
|
|
29
|
-
* Callback fired when the
|
|
25
|
+
* Callback fired when the time changed.
|
|
30
26
|
*/
|
|
31
|
-
|
|
27
|
+
onTimeChange?: (timeString: string, localeTimeString: string, date: Date) => void;
|
|
32
28
|
/**
|
|
33
29
|
* Specifies a short hint that is visible in the input.
|
|
34
30
|
*/
|
|
@@ -38,9 +34,9 @@ export interface CTimePickerProps extends Omit<CPickerProps, 'autoClose' | 'comp
|
|
|
38
34
|
*/
|
|
39
35
|
size?: 'sm' | 'lg';
|
|
40
36
|
/**
|
|
41
|
-
*
|
|
37
|
+
* Initial selected time.
|
|
42
38
|
*/
|
|
43
|
-
|
|
39
|
+
time?: Date | string | null;
|
|
44
40
|
/**
|
|
45
41
|
* Set the time picker variant to a roll or select.
|
|
46
42
|
*/
|
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
export declare const convert12hTo24h: (abbr: 'am' | 'pm', hour: number) => number;
|
|
2
2
|
export declare const convert24hTo12h: (hour: number) => number;
|
|
3
|
+
export declare const convertTimeToDate: (time: Date | string | null | undefined) => Date | null;
|
|
3
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 getMinutesOrSeconds: (locale: string) => {
|
|
10
|
+
value: number;
|
|
11
|
+
label: string;
|
|
12
|
+
}[];
|
|
13
|
+
export declare const getSelectedHour: (date: Date | null, locale: string) => number;
|
|
14
|
+
export declare const getSelectedMinutes: (date: Date | null) => number;
|
|
15
|
+
export declare const getSelectedSeconds: (date: Date | null) => number;
|
|
4
16
|
export declare const isAmPm: (locale: string) => boolean;
|
|
17
|
+
export declare const isValidTime: (time: string) => number | false;
|