@ssa-ui-kit/core 2.3.0 → 2.4.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/dist/components/DatePicker/types.d.ts +1 -2
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +1 -1
- package/dist/components/DateRangePicker/DateRangePickerContext.d.ts +2 -0
- package/dist/components/DateRangePicker/DateRangePickerProvider.d.ts +2 -0
- package/dist/components/DateRangePicker/components/Calendar.d.ts +1 -0
- package/dist/components/DateRangePicker/components/Content.d.ts +1 -0
- package/dist/components/DateRangePicker/components/DatesListWrapper.d.ts +10 -0
- package/dist/components/DateRangePicker/components/DaysView.d.ts +1 -0
- package/dist/components/DateRangePicker/components/Header.d.ts +1 -0
- package/dist/components/DateRangePicker/components/MonthsSwitch.d.ts +1 -0
- package/dist/components/DateRangePicker/components/MonthsView.d.ts +1 -0
- package/dist/components/DateRangePicker/components/Trigger.d.ts +1 -0
- package/dist/components/DateRangePicker/components/TriggerInput.d.ts +6 -0
- package/dist/components/DateRangePicker/components/YearsView.d.ts +1 -0
- package/dist/components/DateRangePicker/components/index.d.ts +9 -0
- package/dist/components/DateRangePicker/constants.d.ts +1 -0
- package/dist/components/DateRangePicker/helpers/ClassnameArray.d.ts +3 -0
- package/dist/components/DateRangePicker/helpers/index.d.ts +1 -0
- package/dist/components/DateRangePicker/hooks/index.d.ts +3 -0
- package/dist/components/DateRangePicker/hooks/useDatePickerMask.d.ts +10 -0
- package/dist/components/DateRangePicker/hooks/useDateRangePicker.d.ts +40 -0
- package/dist/components/DateRangePicker/hooks/useRangeHighlighting.d.ts +10 -0
- package/dist/components/DateRangePicker/styles.d.ts +34 -0
- package/dist/components/DateRangePicker/types.d.ts +35 -9
- package/dist/components/DateRangePicker/useDateRangePickerContext.d.ts +1 -0
- package/dist/components/DateRangePicker/utils/dates.d.ts +11 -0
- package/dist/components/DateRangePicker/utils/index.d.ts +1 -0
- package/dist/components/FormHelperText/types.d.ts +1 -0
- package/dist/index.js +1630 -385
- package/dist/index.js.map +1 -1
- package/dist/types/emotion.d.ts +1 -0
- package/package.json +3 -3
|
@@ -6,7 +6,6 @@ export type DatePickerProps = {
|
|
|
6
6
|
name: string;
|
|
7
7
|
label?: string;
|
|
8
8
|
format?: 'mm/dd/yyyy' | 'dd/mm/yyyy';
|
|
9
|
-
isOpenToggle?: boolean;
|
|
10
9
|
maskOptions?: Parameters<typeof useMask>[0];
|
|
11
10
|
openCalendarMode?: 'icon' | 'input' | 'both';
|
|
12
11
|
inputProps?: Partial<InputProps>;
|
|
@@ -23,7 +22,6 @@ export type DatePickerProps = {
|
|
|
23
22
|
mode: 'dateFrom' | 'dateTo';
|
|
24
23
|
otherDate: Date | null;
|
|
25
24
|
};
|
|
26
|
-
safeOnChange?: (date?: DateTime) => void;
|
|
27
25
|
onChange?: (date?: Date) => void;
|
|
28
26
|
onOpen?: () => void;
|
|
29
27
|
onClose?: () => void;
|
|
@@ -48,6 +46,7 @@ export type DatePickerContextProps = Omit<DatePickerProps, 'dateMin' | 'dateMax'
|
|
|
48
46
|
month: number;
|
|
49
47
|
year: number;
|
|
50
48
|
};
|
|
49
|
+
safeOnChange?: (date?: DateTime) => void;
|
|
51
50
|
setCalendarViewDateTime: Dispatch<SetStateAction<DateTime | undefined>>;
|
|
52
51
|
setDateTime: Dispatch<SetStateAction<DateTime<boolean> | undefined>>;
|
|
53
52
|
setIsOpen: Dispatch<SetStateAction<boolean>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { DateRangePickerProps } from './types';
|
|
2
|
-
export declare const DateRangePicker: ({ format, openCalendarMode,
|
|
2
|
+
export declare const DateRangePicker: ({ format, openCalendarMode, showCalendarIcon, ...rest }: DateRangePickerProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DatePickerCalendar: () => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DatePickerContent: () => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const DatesListWrapper: import("@emotion/styled").StyledComponent<{
|
|
2
|
+
theme?: import("@emotion/react").Theme;
|
|
3
|
+
as?: React.ElementType;
|
|
4
|
+
} & {
|
|
5
|
+
avatarSize?: number;
|
|
6
|
+
direction?: string;
|
|
7
|
+
alignItems?: string;
|
|
8
|
+
} & import("../../..").CommonProps & import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
9
|
+
theme?: import("@emotion/react").Theme;
|
|
10
|
+
}, {}, {}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DaysView: () => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Header: () => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MonthsSwitch: () => import("@emotion/react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MonthsView: () => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Trigger: () => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MouseEventHandler } from 'react';
|
|
2
|
+
export declare const TriggerInput: ({ datepickerType, withPopover, onClick, }: {
|
|
3
|
+
datepickerType: "from" | "to";
|
|
4
|
+
withPopover?: boolean;
|
|
5
|
+
onClick: MouseEventHandler<HTMLInputElement>;
|
|
6
|
+
}) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const YearsView: () => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './Trigger';
|
|
2
|
+
export * from './Calendar';
|
|
3
|
+
export * from './Content';
|
|
4
|
+
export * from './MonthsSwitch';
|
|
5
|
+
export * from './Header';
|
|
6
|
+
export * from './DaysView';
|
|
7
|
+
export * from './MonthsView';
|
|
8
|
+
export * from './YearsView';
|
|
9
|
+
export * from './DatesListWrapper';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ClassnameArray';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DateRangePickerProps } from '../types';
|
|
2
|
+
export declare const useDatePickerMask: ({ maskOptions, formatIndexes, dateMinParts, dateMaxParts, }: Pick<DateRangePickerProps, "maskOptions"> & {
|
|
3
|
+
formatIndexes: {
|
|
4
|
+
day: number;
|
|
5
|
+
month: number;
|
|
6
|
+
year: number;
|
|
7
|
+
};
|
|
8
|
+
dateMinParts: number[];
|
|
9
|
+
dateMaxParts: number[];
|
|
10
|
+
}) => import("react").MutableRefObject<HTMLInputElement>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { DateTime } from 'luxon';
|
|
2
|
+
import { CalendarType, DateRangePickerProps, DateTimeTuple } from '../types';
|
|
3
|
+
export declare const useDateRangePicker: ({ dateMin, dateMax, name: _name, format, maskOptions, isOpenState, defaultValue, onOpen, onClose, onError, onChange, ...rest }: DateRangePickerProps & {
|
|
4
|
+
isOpenState?: boolean;
|
|
5
|
+
}) => {
|
|
6
|
+
formatIndexes: {
|
|
7
|
+
day: number;
|
|
8
|
+
month: number;
|
|
9
|
+
year: number;
|
|
10
|
+
};
|
|
11
|
+
dateMinParts: number[];
|
|
12
|
+
dateMaxParts: number[];
|
|
13
|
+
dateMinDT: DateTime<true> | DateTime<false>;
|
|
14
|
+
dateMaxDT: DateTime<true> | DateTime<false>;
|
|
15
|
+
dateTime: DateTimeTuple;
|
|
16
|
+
inputValueFrom: any;
|
|
17
|
+
inputValueTo: any;
|
|
18
|
+
calendarViewDateTime: [DateTime<boolean> | undefined, DateTime<boolean> | undefined];
|
|
19
|
+
maskInputRef: import("react").MutableRefObject<HTMLInputElement>;
|
|
20
|
+
calendarType: CalendarType;
|
|
21
|
+
lastChangedDate: [Date | undefined, Date | undefined];
|
|
22
|
+
luxonFormat: string;
|
|
23
|
+
lastFocusedElement: "from" | "to";
|
|
24
|
+
nameFrom: string;
|
|
25
|
+
nameTo: string;
|
|
26
|
+
currentIndex: number;
|
|
27
|
+
currentCalendarViewDT: DateTime<boolean>;
|
|
28
|
+
isOpen: boolean;
|
|
29
|
+
status: "error" | "success" | "basic" | undefined;
|
|
30
|
+
inputFromRef: ((instance: HTMLInputElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | null;
|
|
31
|
+
inputToRef: ((instance: HTMLInputElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | null;
|
|
32
|
+
setIsOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
33
|
+
handleSetIsOpen: (open: boolean) => void;
|
|
34
|
+
setLastFocusedElement: import("react").Dispatch<import("react").SetStateAction<"from" | "to">>;
|
|
35
|
+
safeOnChange: (newDateTime?: DateTime) => void;
|
|
36
|
+
setCalendarType: import("react").Dispatch<import("react").SetStateAction<CalendarType>>;
|
|
37
|
+
setCalendarViewDateTime: import("react").Dispatch<import("react").SetStateAction<[DateTime<boolean> | undefined, DateTime<boolean> | undefined]>>;
|
|
38
|
+
setDateTime: import("react").Dispatch<import("react").SetStateAction<DateTimeTuple>>;
|
|
39
|
+
handleBlur: import("react").FocusEventHandler<HTMLInputElement>;
|
|
40
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DateTime } from 'luxon';
|
|
2
|
+
export declare const useRangeHighlighting: () => {
|
|
3
|
+
handleDateHover: (currentDT: DateTime | null) => void;
|
|
4
|
+
getClassNames: (currentDT: DateTime, { isCalendarFirstDateSelected, isCalendarSecondDateSelected, }: {
|
|
5
|
+
isCalendarFirstDateSelected: boolean;
|
|
6
|
+
isCalendarSecondDateSelected: boolean;
|
|
7
|
+
}) => string[];
|
|
8
|
+
isHighlightDate: (currentDT: DateTime) => boolean;
|
|
9
|
+
hoveredDate: DateTime<boolean> | null;
|
|
10
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const DaysViewCell: import("@emotion/styled").StyledComponent<{
|
|
2
|
+
theme?: import("@emotion/react").Theme;
|
|
3
|
+
as?: React.ElementType;
|
|
4
|
+
} & {
|
|
5
|
+
avatarSize?: number;
|
|
6
|
+
direction?: string;
|
|
7
|
+
alignItems?: string;
|
|
8
|
+
} & import("../..").CommonProps & import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
9
|
+
theme?: import("@emotion/react").Theme;
|
|
10
|
+
} & {
|
|
11
|
+
isCalendarDateNow: boolean;
|
|
12
|
+
isCalendarDateSelected: boolean;
|
|
13
|
+
isCalendarFirstDateSelected?: boolean;
|
|
14
|
+
isCalendarSecondDateSelected?: boolean;
|
|
15
|
+
isHighlighted: boolean;
|
|
16
|
+
}, {}, {}>;
|
|
17
|
+
export declare const YearsViewCell: import("@emotion/styled").StyledComponent<{
|
|
18
|
+
theme?: import("@emotion/react").Theme;
|
|
19
|
+
as?: React.ElementType;
|
|
20
|
+
} & {
|
|
21
|
+
isCalendarYear: boolean;
|
|
22
|
+
isCalendarFirstDateSelected?: boolean;
|
|
23
|
+
isCalendarSecondDateSelected?: boolean;
|
|
24
|
+
isHighlighted: boolean;
|
|
25
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
26
|
+
export declare const MonthsViewCell: import("@emotion/styled").StyledComponent<{
|
|
27
|
+
theme?: import("@emotion/react").Theme;
|
|
28
|
+
as?: React.ElementType;
|
|
29
|
+
} & {
|
|
30
|
+
isCalendarMonth: boolean;
|
|
31
|
+
isCalendarFirstDateSelected?: boolean;
|
|
32
|
+
isCalendarSecondDateSelected?: boolean;
|
|
33
|
+
isHighlighted: boolean;
|
|
34
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -1,12 +1,27 @@
|
|
|
1
|
-
import { Dispatch, SetStateAction } from 'react';
|
|
1
|
+
import { Dispatch, MouseEventHandler, SetStateAction } from 'react';
|
|
2
2
|
import { DateTime } from 'luxon';
|
|
3
|
-
import {
|
|
3
|
+
import { useMask } from '@react-input/mask';
|
|
4
4
|
import { FieldContextValue } from '../Field/FieldProvider';
|
|
5
|
+
import { InputProps } from '../Input/types';
|
|
5
6
|
export type LastFocusedElement = 'from' | 'to';
|
|
6
|
-
export type DateRangePickerProps =
|
|
7
|
+
export type DateRangePickerProps = {
|
|
8
|
+
name: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
format?: 'mm/dd/yyyy' | 'dd/mm/yyyy';
|
|
11
|
+
isOpenState?: boolean;
|
|
7
12
|
value?: [string | undefined, string | undefined];
|
|
8
13
|
defaultValue?: [string, string];
|
|
14
|
+
maskOptions?: Parameters<typeof useMask>[0];
|
|
15
|
+
openCalendarMode?: 'icon' | 'input' | 'both';
|
|
16
|
+
inputProps?: Partial<InputProps>;
|
|
9
17
|
status?: FieldContextValue['status'];
|
|
18
|
+
dateMin?: string;
|
|
19
|
+
dateMax?: string;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
helperText?: string;
|
|
22
|
+
showCalendarIcon?: boolean;
|
|
23
|
+
triggerClassname?: string;
|
|
24
|
+
calendarClassname?: string;
|
|
10
25
|
onChange?: (dates?: [Date | null, Date | null]) => void;
|
|
11
26
|
onOpen?: () => void;
|
|
12
27
|
onClose?: () => void;
|
|
@@ -15,13 +30,20 @@ export type DateRangePickerProps = Omit<DatePickerProps, 'isOpenToggle' | 'value
|
|
|
15
30
|
onYearChange?: (date: Date) => void;
|
|
16
31
|
onBlur?: React.FocusEventHandler<HTMLInputElement>;
|
|
17
32
|
};
|
|
33
|
+
export type DateTimeTuple = [DateTime | undefined, DateTime | undefined];
|
|
18
34
|
export type DateRangePickerContextProps = Omit<DateRangePickerProps, 'dateMin' | 'dateMax'> & {
|
|
19
|
-
|
|
35
|
+
nameFrom: string;
|
|
36
|
+
nameTo: string;
|
|
20
37
|
isOpen: boolean;
|
|
38
|
+
currentCalendarViewDT: DateTime;
|
|
39
|
+
currentIndex: number;
|
|
40
|
+
calendarViewDateTime: DateTimeTuple;
|
|
21
41
|
calendarType: CalendarType;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
42
|
+
inputValueFrom?: string;
|
|
43
|
+
inputValueTo?: string;
|
|
44
|
+
inputFromRef: React.ForwardedRef<HTMLInputElement | null>;
|
|
45
|
+
inputToRef: React.ForwardedRef<HTMLInputElement | null>;
|
|
46
|
+
dateTime: DateTimeTuple;
|
|
25
47
|
dateMinParts: number[];
|
|
26
48
|
dateMaxParts: number[];
|
|
27
49
|
dateMinDT: DateTime;
|
|
@@ -32,9 +54,13 @@ export type DateRangePickerContextProps = Omit<DateRangePickerProps, 'dateMin' |
|
|
|
32
54
|
year: number;
|
|
33
55
|
};
|
|
34
56
|
lastFocusedElement: LastFocusedElement;
|
|
57
|
+
lastChangedDate?: [Date | undefined, Date | undefined];
|
|
58
|
+
safeOnChange?: (date?: DateTime) => void;
|
|
35
59
|
setLastFocusedElement: Dispatch<SetStateAction<LastFocusedElement>>;
|
|
36
|
-
|
|
37
|
-
|
|
60
|
+
handleToggleOpen: MouseEventHandler<HTMLButtonElement | HTMLInputElement>;
|
|
61
|
+
handleSetIsOpen: (open: boolean) => void;
|
|
62
|
+
setCalendarViewDateTime: Dispatch<SetStateAction<DateTimeTuple>>;
|
|
63
|
+
setDateTime: Dispatch<SetStateAction<DateTimeTuple>>;
|
|
38
64
|
setIsOpen: Dispatch<SetStateAction<boolean>>;
|
|
39
65
|
setCalendarType: Dispatch<SetStateAction<CalendarType>>;
|
|
40
66
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useDateRangePickerContext: () => import("./types").DateRangePickerContextProps;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const getDaysForCalendarMonth: (date?: Date) => Date[];
|
|
2
|
+
export declare const getWeekDays: () => string[];
|
|
3
|
+
export declare const getYearsList: (props?: {
|
|
4
|
+
yearsFrom?: number;
|
|
5
|
+
yearsCount?: number;
|
|
6
|
+
}) => number[];
|
|
7
|
+
export declare const processDate: (dateParts: {
|
|
8
|
+
month: string;
|
|
9
|
+
day: string;
|
|
10
|
+
year: string;
|
|
11
|
+
}, yearMin: number, yearMax: number) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dates';
|