@xsolla/xui-date-picker 0.64.0-pr56.1768440195

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.
@@ -0,0 +1,99 @@
1
+ import React, { ReactNode } from 'react';
2
+ import * as locales from 'date-fns/locale';
3
+
4
+ type CalendarLocaleType = keyof typeof locales;
5
+ interface CalendarProps {
6
+ locale?: CalendarLocaleType;
7
+ /**
8
+ * The day to use as first day of the week, starting from 0 (Sunday) to 6 (Saturday).
9
+ */
10
+ firstDayOfWeek?: number;
11
+ /**
12
+ * The month to display in the calendar at first render.
13
+ */
14
+ initialMonth?: Date;
15
+ /**
16
+ * The month to display in the calendar.
17
+ */
18
+ month?: Date;
19
+ /**
20
+ * Select in range mode for calendar
21
+ */
22
+ selectsRange?: boolean;
23
+ /**
24
+ * The minimum selectable date
25
+ */
26
+ minDate?: Date | null;
27
+ /**
28
+ * The maximum selectable date
29
+ */
30
+ maxDate?: Date | null;
31
+ /**
32
+ * For range mode. Start date in selected period
33
+ */
34
+ startDate?: Date | null;
35
+ /**
36
+ * For range mode. End date in selected period
37
+ */
38
+ endDate?: Date | null;
39
+ /**
40
+ * The selected date
41
+ */
42
+ selectedDate?: Date | null;
43
+ /**
44
+ * Property sets the maximum height of a context menus for selecting month and year.
45
+ */
46
+ contextMenuMaxHeight?: number;
47
+ /**
48
+ * Returns custom content to display above the calendar's date picker.
49
+ */
50
+ topContent?: (datePicker: {
51
+ close: () => void;
52
+ }) => ReactNode;
53
+ /**
54
+ * Returns custom content to display beneath the calendar's date picker.
55
+ */
56
+ bottomContent?: (datePicker: {
57
+ close: () => void;
58
+ }) => ReactNode;
59
+ /**
60
+ * Test ID for testing frameworks
61
+ */
62
+ testID?: string;
63
+ /**
64
+ * Callback fired when the date changes
65
+ */
66
+ onChange?: (date: Date | [Date | null, Date | null]) => void;
67
+ }
68
+ type DateRangeType = [Date | null, Date | null];
69
+ interface DatePickerProps extends Omit<CalendarProps, "onChange"> {
70
+ /**
71
+ * Event handler when the value of a Datepicker changes.
72
+ */
73
+ onChange?: (date: Date | DateRangeType) => void;
74
+ /**
75
+ * Placeholder text for the input
76
+ */
77
+ placeholder?: string;
78
+ /**
79
+ * Size of the input
80
+ */
81
+ size?: "xl" | "l" | "m" | "s" | "xs";
82
+ /**
83
+ * Whether the input is disabled
84
+ */
85
+ disabled?: boolean;
86
+ /**
87
+ * Custom background color for the input
88
+ */
89
+ backgroundColor?: string;
90
+ }
91
+
92
+ declare const DatePicker: React.ForwardRefExoticComponent<DatePickerProps & React.RefAttributes<any>>;
93
+
94
+ declare const Calendar: React.ForwardRefExoticComponent<CalendarProps & React.RefAttributes<any>>;
95
+
96
+ declare function formatDate(date: Date, formatStr: string, locale?: CalendarLocaleType): string;
97
+ declare function getMonthInLocale(month: number, locale?: CalendarLocaleType): string;
98
+
99
+ export { Calendar, type CalendarLocaleType, type CalendarProps, DatePicker, type DatePickerProps, type DateRangeType, formatDate, getMonthInLocale };
@@ -0,0 +1,99 @@
1
+ import React, { ReactNode } from 'react';
2
+ import * as locales from 'date-fns/locale';
3
+
4
+ type CalendarLocaleType = keyof typeof locales;
5
+ interface CalendarProps {
6
+ locale?: CalendarLocaleType;
7
+ /**
8
+ * The day to use as first day of the week, starting from 0 (Sunday) to 6 (Saturday).
9
+ */
10
+ firstDayOfWeek?: number;
11
+ /**
12
+ * The month to display in the calendar at first render.
13
+ */
14
+ initialMonth?: Date;
15
+ /**
16
+ * The month to display in the calendar.
17
+ */
18
+ month?: Date;
19
+ /**
20
+ * Select in range mode for calendar
21
+ */
22
+ selectsRange?: boolean;
23
+ /**
24
+ * The minimum selectable date
25
+ */
26
+ minDate?: Date | null;
27
+ /**
28
+ * The maximum selectable date
29
+ */
30
+ maxDate?: Date | null;
31
+ /**
32
+ * For range mode. Start date in selected period
33
+ */
34
+ startDate?: Date | null;
35
+ /**
36
+ * For range mode. End date in selected period
37
+ */
38
+ endDate?: Date | null;
39
+ /**
40
+ * The selected date
41
+ */
42
+ selectedDate?: Date | null;
43
+ /**
44
+ * Property sets the maximum height of a context menus for selecting month and year.
45
+ */
46
+ contextMenuMaxHeight?: number;
47
+ /**
48
+ * Returns custom content to display above the calendar's date picker.
49
+ */
50
+ topContent?: (datePicker: {
51
+ close: () => void;
52
+ }) => ReactNode;
53
+ /**
54
+ * Returns custom content to display beneath the calendar's date picker.
55
+ */
56
+ bottomContent?: (datePicker: {
57
+ close: () => void;
58
+ }) => ReactNode;
59
+ /**
60
+ * Test ID for testing frameworks
61
+ */
62
+ testID?: string;
63
+ /**
64
+ * Callback fired when the date changes
65
+ */
66
+ onChange?: (date: Date | [Date | null, Date | null]) => void;
67
+ }
68
+ type DateRangeType = [Date | null, Date | null];
69
+ interface DatePickerProps extends Omit<CalendarProps, "onChange"> {
70
+ /**
71
+ * Event handler when the value of a Datepicker changes.
72
+ */
73
+ onChange?: (date: Date | DateRangeType) => void;
74
+ /**
75
+ * Placeholder text for the input
76
+ */
77
+ placeholder?: string;
78
+ /**
79
+ * Size of the input
80
+ */
81
+ size?: "xl" | "l" | "m" | "s" | "xs";
82
+ /**
83
+ * Whether the input is disabled
84
+ */
85
+ disabled?: boolean;
86
+ /**
87
+ * Custom background color for the input
88
+ */
89
+ backgroundColor?: string;
90
+ }
91
+
92
+ declare const DatePicker: React.ForwardRefExoticComponent<DatePickerProps & React.RefAttributes<any>>;
93
+
94
+ declare const Calendar: React.ForwardRefExoticComponent<CalendarProps & React.RefAttributes<any>>;
95
+
96
+ declare function formatDate(date: Date, formatStr: string, locale?: CalendarLocaleType): string;
97
+ declare function getMonthInLocale(month: number, locale?: CalendarLocaleType): string;
98
+
99
+ export { Calendar, type CalendarLocaleType, type CalendarProps, DatePicker, type DatePickerProps, type DateRangeType, formatDate, getMonthInLocale };