@coreui/react-pro 4.9.0 → 4.10.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/date-range-picker/CDateRangePicker.d.ts +6 -0
- package/dist/components/time-picker/CTimePicker.d.ts +6 -0
- package/dist/index.es.js +14 -13
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +14 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/date-range-picker/CDateRangePicker.tsx +10 -0
- package/src/components/dropdown/CDropdown.tsx +33 -30
- package/src/components/time-picker/CTimePicker.tsx +9 -0
- package/dist/components/Types.d.ts +0 -14
- package/dist/components/multi-select/CMultiSelectCleaner.d.ts +0 -2
- package/dist/components/multi-select/CMultiSelectSearchInput.d.ts +0 -5
- package/dist/components/pagination/CSmartPagination.d.ts +0 -80
- package/dist/components/time-picker/CTimePicker copy.d.ts +0 -46
- package/dist/utils/calendar.d.ts +0 -23
- package/dist/utils/getNextSibling.d.ts +0 -2
- package/dist/utils/getPreviousSibling.d.ts +0 -2
- package/dist/utils/hooks/index.d.ts +0 -3
- package/dist/utils/hooks/useForkedRef.d.ts +0 -7
- package/dist/utils/hooks/useStateWithCallback.d.ts +0 -2
- package/dist/utils/isVisible.d.ts +0 -2
- package/dist/utils/time.d.ts +0 -21
package/package.json
CHANGED
|
@@ -84,6 +84,12 @@ export interface CDateRangePickerProps
|
|
|
84
84
|
* Set the ranges button variant to an outlined button or a ghost button.
|
|
85
85
|
*/
|
|
86
86
|
rangesButtonsVariant?: 'outline' | 'ghost'
|
|
87
|
+
/**
|
|
88
|
+
* When present, it specifies that date must be filled out before submitting the form.
|
|
89
|
+
*
|
|
90
|
+
* @since 4.10.0
|
|
91
|
+
*/
|
|
92
|
+
required?: boolean
|
|
87
93
|
/**
|
|
88
94
|
* Default icon or character character that separates two dates.
|
|
89
95
|
*/
|
|
@@ -159,6 +165,7 @@ export const CDateRangePicker = forwardRef<HTMLDivElement | HTMLLIElement, CDate
|
|
|
159
165
|
rangesButtonsColor = 'secondary',
|
|
160
166
|
rangesButtonsSize,
|
|
161
167
|
rangesButtonsVariant = 'ghost',
|
|
168
|
+
required,
|
|
162
169
|
separator = true,
|
|
163
170
|
size,
|
|
164
171
|
startDate,
|
|
@@ -316,6 +323,7 @@ export const CDateRangePicker = forwardRef<HTMLDivElement | HTMLLIElement, CDate
|
|
|
316
323
|
{...(id && { name: range ? `${id}-start-date` : `${id}-date` })}
|
|
317
324
|
placeholder={Array.isArray(placeholder) ? placeholder[0] : placeholder}
|
|
318
325
|
readOnly={inputReadOnly || typeof format === 'string'}
|
|
326
|
+
required={required}
|
|
319
327
|
onChange={(event) => {
|
|
320
328
|
const date = getLocalDateFromString(event.target.value, locale, timepicker)
|
|
321
329
|
if (date instanceof Date && date.getTime()) {
|
|
@@ -346,6 +354,7 @@ export const CDateRangePicker = forwardRef<HTMLDivElement | HTMLLIElement, CDate
|
|
|
346
354
|
{...(id && { name: `${id}-end-date` })}
|
|
347
355
|
placeholder={placeholder[1]}
|
|
348
356
|
readOnly={inputReadOnly || typeof format === 'string'}
|
|
357
|
+
required={required}
|
|
349
358
|
onChange={(event) => {
|
|
350
359
|
const date = getLocalDateFromString(event.target.value, locale, timepicker)
|
|
351
360
|
if (date instanceof Date && date.getTime()) {
|
|
@@ -565,6 +574,7 @@ CDateRangePicker.propTypes = {
|
|
|
565
574
|
rangesButtonsColor: CButton.propTypes?.color,
|
|
566
575
|
rangesButtonsSize: CButton.propTypes?.size,
|
|
567
576
|
rangesButtonsVariant: CButton.propTypes?.variant,
|
|
577
|
+
required: PropTypes.bool,
|
|
568
578
|
separator: PropTypes.oneOfType([PropTypes.bool, PropTypes.node]),
|
|
569
579
|
size: PropTypes.oneOf(['sm', 'lg']),
|
|
570
580
|
timepicker: PropTypes.bool,
|
|
@@ -3,6 +3,7 @@ import React, {
|
|
|
3
3
|
ElementType,
|
|
4
4
|
forwardRef,
|
|
5
5
|
HTMLAttributes,
|
|
6
|
+
ReactNode,
|
|
6
7
|
RefObject,
|
|
7
8
|
useEffect,
|
|
8
9
|
useRef,
|
|
@@ -87,6 +88,16 @@ export interface CDropdownProps extends HTMLAttributes<HTMLDivElement | HTMLLIEl
|
|
|
87
88
|
visible?: boolean
|
|
88
89
|
}
|
|
89
90
|
|
|
91
|
+
const PopperManagerWrapper = ({
|
|
92
|
+
children,
|
|
93
|
+
popper,
|
|
94
|
+
}: {
|
|
95
|
+
children: ReactNode
|
|
96
|
+
popper: boolean
|
|
97
|
+
}) => {
|
|
98
|
+
return popper ? <Manager>{children}</Manager> : <>{children}</>
|
|
99
|
+
}
|
|
100
|
+
|
|
90
101
|
interface ContextProps extends CDropdownProps {
|
|
91
102
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
92
103
|
dropdownToggleRef: RefObject<any> | undefined
|
|
@@ -149,38 +160,30 @@ export const CDropdown = forwardRef<HTMLDivElement | HTMLLIElement, CDropdownPro
|
|
|
149
160
|
!_visible && onHide && onHide()
|
|
150
161
|
}, [_visible])
|
|
151
162
|
|
|
152
|
-
const DropdownContent = () => {
|
|
153
|
-
return variant === 'input-group' ? (
|
|
154
|
-
<>{children}</>
|
|
155
|
-
) : (
|
|
156
|
-
<Component
|
|
157
|
-
className={classNames(
|
|
158
|
-
variant === 'nav-item' ? 'nav-item dropdown' : variant,
|
|
159
|
-
{
|
|
160
|
-
'dropdown-center': direction === 'center',
|
|
161
|
-
'dropup dropup-center': direction === 'dropup-center',
|
|
162
|
-
direction: direction && direction !== 'center' && direction !== 'dropup-center',
|
|
163
|
-
show: _visible,
|
|
164
|
-
},
|
|
165
|
-
className,
|
|
166
|
-
)}
|
|
167
|
-
{...rest}
|
|
168
|
-
ref={forkedRef}
|
|
169
|
-
>
|
|
170
|
-
{children}
|
|
171
|
-
</Component>
|
|
172
|
-
)
|
|
173
|
-
}
|
|
174
|
-
|
|
175
163
|
return (
|
|
176
164
|
<CDropdownContext.Provider value={contextValues}>
|
|
177
|
-
{popper
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
165
|
+
<PopperManagerWrapper popper={popper}>
|
|
166
|
+
{variant === 'input-group' ? (
|
|
167
|
+
<>{children}</>
|
|
168
|
+
) : (
|
|
169
|
+
<Component
|
|
170
|
+
className={classNames(
|
|
171
|
+
variant === 'nav-item' ? 'nav-item dropdown' : variant,
|
|
172
|
+
{
|
|
173
|
+
'dropdown-center': direction === 'center',
|
|
174
|
+
'dropup dropup-center': direction === 'dropup-center',
|
|
175
|
+
direction: direction && direction !== 'center' && direction !== 'dropup-center',
|
|
176
|
+
show: _visible,
|
|
177
|
+
},
|
|
178
|
+
className,
|
|
179
|
+
)}
|
|
180
|
+
{...rest}
|
|
181
|
+
ref={forkedRef}
|
|
182
|
+
>
|
|
183
|
+
{children}
|
|
184
|
+
</Component>
|
|
185
|
+
)}
|
|
186
|
+
</PopperManagerWrapper>
|
|
184
187
|
</CDropdownContext.Provider>
|
|
185
188
|
)
|
|
186
189
|
},
|
|
@@ -60,6 +60,12 @@ export interface CTimePickerProps
|
|
|
60
60
|
* Specifies a short hint that is visible in the input.
|
|
61
61
|
*/
|
|
62
62
|
placeholder?: string
|
|
63
|
+
/**
|
|
64
|
+
* When present, it specifies that time must be filled out before submitting the form.
|
|
65
|
+
*
|
|
66
|
+
* @since 4.10.0
|
|
67
|
+
*/
|
|
68
|
+
required?: boolean
|
|
63
69
|
/**
|
|
64
70
|
* Show seconds.
|
|
65
71
|
*
|
|
@@ -102,6 +108,7 @@ export const CTimePicker = forwardRef<HTMLDivElement | HTMLLIElement, CTimePicke
|
|
|
102
108
|
onHide,
|
|
103
109
|
onShow,
|
|
104
110
|
placeholder = 'Select time',
|
|
111
|
+
required,
|
|
105
112
|
seconds = true,
|
|
106
113
|
size,
|
|
107
114
|
text,
|
|
@@ -195,6 +202,7 @@ export const CTimePicker = forwardRef<HTMLDivElement | HTMLLIElement, CTimePicke
|
|
|
195
202
|
}
|
|
196
203
|
placeholder={placeholder}
|
|
197
204
|
readOnly={inputReadOnly}
|
|
205
|
+
required={required}
|
|
198
206
|
ref={inputRef}
|
|
199
207
|
/>
|
|
200
208
|
{(indicator || cleaner) && (
|
|
@@ -397,6 +405,7 @@ CTimePicker.propTypes = {
|
|
|
397
405
|
className: PropTypes.string,
|
|
398
406
|
locale: PropTypes.string,
|
|
399
407
|
onTimeChange: PropTypes.func,
|
|
408
|
+
required: PropTypes.bool,
|
|
400
409
|
seconds: PropTypes.bool,
|
|
401
410
|
time: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string]),
|
|
402
411
|
variant: PropTypes.oneOf(['roll', 'select']),
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
export type Breakpoints = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
|
3
|
-
export type Colors = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light' | string;
|
|
4
|
-
export declare const colorPropType: PropTypes.Requireable<string>;
|
|
5
|
-
export type Gradients = 'primary-gradient' | 'secondary-gradient' | 'success-gradient' | 'danger-gradient' | 'warning-gradient' | 'info-gradient' | 'dark-gradient' | 'light-gradient';
|
|
6
|
-
export declare const gradientsPropType: PropTypes.Requireable<string>;
|
|
7
|
-
export type Placements = 'auto' | 'auto-start' | 'auto-end' | 'top-end' | 'top' | 'top-start' | 'bottom-end' | 'bottom' | 'bottom-start' | 'right-start' | 'right' | 'right-end' | 'left-start' | 'left' | 'left-end' | undefined;
|
|
8
|
-
export declare const placementPropType: PropTypes.Requireable<Placements>;
|
|
9
|
-
export type Shapes = 'rounded' | 'rounded-top' | 'rounded-end' | 'rounded-bottom' | 'rounded-start' | 'rounded-circle' | 'rounded-pill' | 'rounded-0' | 'rounded-1' | 'rounded-2' | 'rounded-3' | string;
|
|
10
|
-
export declare const shapePropType: PropTypes.Requireable<string>;
|
|
11
|
-
export type TextColors = Colors | 'white' | 'muted' | 'high-emphasis' | 'medium-emphasis' | 'disabled' | 'high-emphasis-inverse' | 'medium-emphasis-inverse' | 'disabled-inverse' | string;
|
|
12
|
-
export declare const textColorsPropType: PropTypes.Requireable<string>;
|
|
13
|
-
export type Triggers = 'hover' | 'focus' | 'click';
|
|
14
|
-
export declare const triggerPropType: PropTypes.Requireable<Triggers>;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import React, { InputHTMLAttributes } from 'react';
|
|
2
|
-
export interface CMultiSelectSearchInputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
3
|
-
placeholder?: string;
|
|
4
|
-
}
|
|
5
|
-
export declare const CMultiSelectSearchInput: React.ForwardRefExoticComponent<CMultiSelectSearchInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode, HTMLAttributes } from 'react';
|
|
2
|
-
export interface CSmartPaginationProps extends HTMLAttributes<HTMLUListElement> {
|
|
3
|
-
/**
|
|
4
|
-
* A string of all className you want applied to the base component. [docs]
|
|
5
|
-
*/
|
|
6
|
-
className?: string;
|
|
7
|
-
/**
|
|
8
|
-
* Current page number. [docs]
|
|
9
|
-
*
|
|
10
|
-
* @default 1
|
|
11
|
-
*/
|
|
12
|
-
activePage?: number;
|
|
13
|
-
/**
|
|
14
|
-
* Show/hide dots. [docs]
|
|
15
|
-
*
|
|
16
|
-
* @default true
|
|
17
|
-
*/
|
|
18
|
-
dots?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Show/hide arrows. [docs]
|
|
21
|
-
*
|
|
22
|
-
* @default true
|
|
23
|
-
*/
|
|
24
|
-
arrows?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Show double arrows buttons. [docs]
|
|
27
|
-
*
|
|
28
|
-
* @default doubleArrows
|
|
29
|
-
*/
|
|
30
|
-
doubleArrows?: boolean;
|
|
31
|
-
/**
|
|
32
|
-
* The content of 'firstButton' button. [docs]
|
|
33
|
-
*
|
|
34
|
-
* @default '<React.Fragment>«</React.Fragment>''
|
|
35
|
-
*/
|
|
36
|
-
firstButton?: ReactNode | string;
|
|
37
|
-
/**
|
|
38
|
-
* The content of 'previousButton' button. [docs]
|
|
39
|
-
*
|
|
40
|
-
* @default '<React.Fragment>‹</React.Fragment>'
|
|
41
|
-
*/
|
|
42
|
-
previousButton?: ReactNode | string;
|
|
43
|
-
/**
|
|
44
|
-
* The content of 'nextButton' button. [docs]
|
|
45
|
-
*
|
|
46
|
-
* @default '<React.Fragment>›</React.Fragment>''
|
|
47
|
-
*/
|
|
48
|
-
nextButton?: ReactNode | string;
|
|
49
|
-
/**
|
|
50
|
-
* The content of 'lastButton' button. [docs]
|
|
51
|
-
*
|
|
52
|
-
* @default '<React.Fragment>»</React.Fragment>'
|
|
53
|
-
*/
|
|
54
|
-
lastButton?: ReactNode | string;
|
|
55
|
-
/**
|
|
56
|
-
* Size of pagination, valid values: 'sm', 'lg'. [docs]
|
|
57
|
-
*/
|
|
58
|
-
size?: 'sm' | 'lg';
|
|
59
|
-
/**
|
|
60
|
-
* Horizontall align. [docs]
|
|
61
|
-
*
|
|
62
|
-
* @default 'start'
|
|
63
|
-
*/
|
|
64
|
-
align?: 'start' | 'center' | 'end';
|
|
65
|
-
/**
|
|
66
|
-
* Maximum items number. [docs]
|
|
67
|
-
*
|
|
68
|
-
* @default 5
|
|
69
|
-
*/
|
|
70
|
-
limit?: number;
|
|
71
|
-
/**
|
|
72
|
-
* Number of pages. [docs]
|
|
73
|
-
*/
|
|
74
|
-
pages: number;
|
|
75
|
-
/**
|
|
76
|
-
* On active page change callback. [docs]
|
|
77
|
-
*/
|
|
78
|
-
onActivePageChange: (a: number, b?: boolean) => void;
|
|
79
|
-
}
|
|
80
|
-
export declare const CSmartPagination: React.ForwardRefExoticComponent<CSmartPaginationProps & React.RefAttributes<HTMLUListElement>>;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
import { CFormControlWrapperProps } from '../form/CFormControlWrapper';
|
|
3
|
-
import { CPickerProps } from './../picker/CPicker';
|
|
4
|
-
export interface CTimePickerProps extends Omit<CFormControlWrapperProps, 'floatingLabel'>, Omit<CPickerProps, 'autoClose' | 'component' | 'dark' | 'placeholder' | 'variant' | 'onChange'> {
|
|
5
|
-
/**
|
|
6
|
-
* A string of all className you want applied to the component.
|
|
7
|
-
*/
|
|
8
|
-
className?: string;
|
|
9
|
-
/**
|
|
10
|
-
* Toggle visibility or set the content of the cleaner button.
|
|
11
|
-
*/
|
|
12
|
-
cleaner?: ReactNode | boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Toggle visibility or set the content of the input indicator.
|
|
15
|
-
*/
|
|
16
|
-
indicator?: ReactNode | boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Toggle the readonly state for the component.
|
|
19
|
-
*/
|
|
20
|
-
inputReadOnly?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Sets the default locale for components. If not set, it is inherited from the browser.
|
|
23
|
-
*/
|
|
24
|
-
locale?: string;
|
|
25
|
-
/**
|
|
26
|
-
* Callback fired when the time changed.
|
|
27
|
-
*/
|
|
28
|
-
onTimeChange?: (timeString: string | null, localeTimeString?: string, date?: Date) => void;
|
|
29
|
-
/**
|
|
30
|
-
* Specifies a short hint that is visible in the input.
|
|
31
|
-
*/
|
|
32
|
-
placeholder?: string;
|
|
33
|
-
/**
|
|
34
|
-
* Size the component small or large.
|
|
35
|
-
*/
|
|
36
|
-
size?: 'sm' | 'lg';
|
|
37
|
-
/**
|
|
38
|
-
* Initial selected time.
|
|
39
|
-
*/
|
|
40
|
-
time?: Date | string | null;
|
|
41
|
-
/**
|
|
42
|
-
* Set the time picker variant to a roll or select.
|
|
43
|
-
*/
|
|
44
|
-
variant?: 'roll' | 'select';
|
|
45
|
-
}
|
|
46
|
-
export declare const CTimePicker: React.ForwardRefExoticComponent<CTimePickerProps & React.RefAttributes<HTMLDivElement | HTMLLIElement>>;
|
package/dist/utils/calendar.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export declare const convertToLocalDate: (d: Date, locale: string, options?: {}) => string;
|
|
2
|
-
export declare const convertToLocalTime: (d: Date, locale: string, options?: {}) => string;
|
|
3
|
-
export declare const createGroupsInArray: (arr: any[], numberOfGroups: number) => any[][];
|
|
4
|
-
export declare const getCurrentYear: () => number;
|
|
5
|
-
export declare const getCurrentMonth: () => number;
|
|
6
|
-
export declare const getLocalDateFromString: (string: string, locale: string, time?: boolean) => Date | undefined;
|
|
7
|
-
export declare const getMonthName: (month: number, locale: string) => string;
|
|
8
|
-
export declare const getMonthsNames: (locale: string) => string[];
|
|
9
|
-
export declare const getYears: (year: number) => number[];
|
|
10
|
-
export declare const getMonthDetails: (year: number, month: number, firstDayOfWeek: number) => {
|
|
11
|
-
date: Date;
|
|
12
|
-
month: string;
|
|
13
|
-
}[][];
|
|
14
|
-
export declare const isDisableDateInRange: (startDate?: Date | null, endDate?: Date | null, dates?: Date[] | Date[][] | (Date | Date[])[]) => boolean;
|
|
15
|
-
export declare const isDateDisabled: (date: Date, min?: Date | null, max?: Date | null, dates?: Date[] | Date[][] | (Date | Date[])[]) => boolean | undefined;
|
|
16
|
-
export declare const isDateInRange: (date: Date, start: Date | null, end: Date | null) => boolean | null;
|
|
17
|
-
export declare const isDateSelected: (date: Date, start: Date | null, end: Date | null) => boolean | null;
|
|
18
|
-
export declare const isEndDate: (date: Date, start: Date | null, end: Date | null) => boolean | null;
|
|
19
|
-
export declare const isLastDayOfMonth: (date: Date) => boolean;
|
|
20
|
-
export declare const isSameDateAs: (date: Date | null, date2: Date | null) => boolean;
|
|
21
|
-
export declare const isStartDate: (date: Date, start: Date | null, end: Date | null) => boolean | null;
|
|
22
|
-
export declare const isToday: (date: Date) => boolean;
|
|
23
|
-
export declare const isValidDate: (date: string) => number | false;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export type AssignableRef<ValueType> = {
|
|
3
|
-
bivarianceHack(instance: ValueType | null): void;
|
|
4
|
-
}['bivarianceHack'] | React.MutableRefObject<ValueType | null>;
|
|
5
|
-
export declare function useForkedRef<RefValueType = any>(...refs: (AssignableRef<RefValueType> | null | undefined)[]): ((node: any) => void) | null;
|
|
6
|
-
export declare function assignRef<RefValueType = any>(ref: AssignableRef<RefValueType> | null | undefined, value: any): void;
|
|
7
|
-
export declare function isFunction(value: any): value is Function;
|
package/dist/utils/time.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
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, ampm?: 'auto' | boolean) => {
|
|
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, ampm?: 'auto' | boolean) => 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;
|