@semcore/date-picker 4.57.2-prerelease.0 → 4.58.0-prerelease.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/CHANGELOG.md +6 -0
- package/lib/cjs/DatePicker.js +27 -36
- package/lib/cjs/DatePicker.js.map +1 -1
- package/lib/cjs/DateRangeComparator.js +38 -43
- package/lib/cjs/DateRangeComparator.js.map +1 -1
- package/lib/cjs/DateRangePicker.js +17 -22
- package/lib/cjs/DateRangePicker.js.map +1 -1
- package/lib/cjs/MonthDateRangeComparator.js +42 -47
- package/lib/cjs/MonthDateRangeComparator.js.map +1 -1
- package/lib/cjs/MonthPicker.js +16 -21
- package/lib/cjs/MonthPicker.js.map +1 -1
- package/lib/cjs/MonthRangePicker.js +18 -23
- package/lib/cjs/MonthRangePicker.js.map +1 -1
- package/lib/cjs/components/ButtonTrigger.js +8 -10
- package/lib/cjs/components/ButtonTrigger.js.map +1 -1
- package/lib/cjs/components/Calendar.js +109 -125
- package/lib/cjs/components/Calendar.js.map +1 -1
- package/lib/cjs/components/DateRangeComparatorAbstract.js +121 -104
- package/lib/cjs/components/DateRangeComparatorAbstract.js.map +1 -1
- package/lib/cjs/components/InputTrigger.js +179 -189
- package/lib/cjs/components/InputTrigger.js.map +1 -1
- package/lib/cjs/components/PickerAbstract.js +58 -57
- package/lib/cjs/components/PickerAbstract.js.map +1 -1
- package/lib/cjs/components/RangePickerAbstract.js +97 -76
- package/lib/cjs/components/RangePickerAbstract.js.map +1 -1
- package/lib/cjs/components/index.js +41 -46
- package/lib/cjs/components/index.js.map +1 -1
- package/lib/cjs/index.d.js.map +1 -1
- package/lib/cjs/index.js +2 -2
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/style/calendar.shadow.css +40 -42
- package/lib/cjs/style/date-picker.shadow.css +15 -16
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js +4 -5
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/cjs/translations/de.json +6 -2
- package/lib/cjs/translations/es.json +6 -2
- package/lib/cjs/translations/fr.json +6 -2
- package/lib/cjs/translations/it.json +6 -2
- package/lib/cjs/translations/ja.json +6 -2
- package/lib/cjs/translations/ko.json +6 -2
- package/lib/cjs/translations/nl.json +6 -2
- package/lib/cjs/translations/pl.json +6 -2
- package/lib/cjs/translations/pt.json +6 -2
- package/lib/cjs/translations/sv.json +6 -2
- package/lib/cjs/translations/tr.json +6 -2
- package/lib/cjs/translations/vi.json +6 -2
- package/lib/cjs/translations/zh.json +6 -2
- package/lib/cjs/utils/cronTabScheduler.js +8 -5
- package/lib/cjs/utils/cronTabScheduler.js.map +1 -1
- package/lib/cjs/utils/datesIntersects.js +3 -4
- package/lib/cjs/utils/datesIntersects.js.map +1 -1
- package/lib/cjs/utils/formatDate.js +3 -5
- package/lib/cjs/utils/formatDate.js.map +1 -1
- package/lib/cjs/utils/includesDate.js +2 -3
- package/lib/cjs/utils/includesDate.js.map +1 -1
- package/lib/cjs/utils/isBetweenPlugin.js +21 -0
- package/lib/cjs/utils/isBetweenPlugin.js.map +1 -0
- package/lib/cjs/utils/shortDateRangeFormat.js +2 -2
- package/lib/cjs/utils/shortDateRangeFormat.js.map +1 -1
- package/lib/es6/DatePicker.js +22 -28
- package/lib/es6/DatePicker.js.map +1 -1
- package/lib/es6/DateRangeComparator.js +23 -27
- package/lib/es6/DateRangeComparator.js.map +1 -1
- package/lib/es6/DateRangePicker.js +13 -17
- package/lib/es6/DateRangePicker.js.map +1 -1
- package/lib/es6/MonthDateRangeComparator.js +28 -32
- package/lib/es6/MonthDateRangeComparator.js.map +1 -1
- package/lib/es6/MonthPicker.js +13 -17
- package/lib/es6/MonthPicker.js.map +1 -1
- package/lib/es6/MonthRangePicker.js +14 -18
- package/lib/es6/MonthRangePicker.js.map +1 -1
- package/lib/es6/components/ButtonTrigger.js +5 -5
- package/lib/es6/components/ButtonTrigger.js.map +1 -1
- package/lib/es6/components/Calendar.js +100 -112
- package/lib/es6/components/Calendar.js.map +1 -1
- package/lib/es6/components/DateRangeComparatorAbstract.js +120 -101
- package/lib/es6/components/DateRangeComparatorAbstract.js.map +1 -1
- package/lib/es6/components/InputTrigger.js +173 -180
- package/lib/es6/components/InputTrigger.js.map +1 -1
- package/lib/es6/components/PickerAbstract.js +58 -55
- package/lib/es6/components/PickerAbstract.js.map +1 -1
- package/lib/es6/components/RangePickerAbstract.js +94 -71
- package/lib/es6/components/RangePickerAbstract.js.map +1 -1
- package/lib/es6/components/index.js +35 -38
- package/lib/es6/components/index.js.map +1 -1
- package/lib/es6/index.d.js.map +1 -1
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/style/calendar.shadow.css +40 -42
- package/lib/es6/style/date-picker.shadow.css +15 -16
- package/lib/es6/translations/__intergalactic-dynamic-locales.js +2 -2
- package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/es6/translations/de.json +6 -2
- package/lib/es6/translations/es.json +6 -2
- package/lib/es6/translations/fr.json +6 -2
- package/lib/es6/translations/it.json +6 -2
- package/lib/es6/translations/ja.json +6 -2
- package/lib/es6/translations/ko.json +6 -2
- package/lib/es6/translations/nl.json +6 -2
- package/lib/es6/translations/pl.json +6 -2
- package/lib/es6/translations/pt.json +6 -2
- package/lib/es6/translations/sv.json +6 -2
- package/lib/es6/translations/tr.json +6 -2
- package/lib/es6/translations/vi.json +6 -2
- package/lib/es6/translations/zh.json +6 -2
- package/lib/es6/utils/cronTabScheduler.js +7 -4
- package/lib/es6/utils/cronTabScheduler.js.map +1 -1
- package/lib/es6/utils/datesIntersects.js +1 -1
- package/lib/es6/utils/datesIntersects.js.map +1 -1
- package/lib/es6/utils/formatDate.js.map +1 -1
- package/lib/es6/utils/includesDate.js.map +1 -1
- package/lib/es6/utils/isBetweenPlugin.js +16 -0
- package/lib/es6/utils/isBetweenPlugin.js.map +1 -0
- package/lib/es6/utils/shortDateRangeFormat.js +1 -1
- package/lib/es6/utils/shortDateRangeFormat.js.map +1 -1
- package/lib/esm/DatePicker.mjs +27 -33
- package/lib/esm/DateRangeComparator.mjs +26 -30
- package/lib/esm/DateRangePicker.mjs +17 -21
- package/lib/esm/MonthDateRangeComparator.mjs +31 -35
- package/lib/esm/MonthPicker.mjs +16 -20
- package/lib/esm/MonthRangePicker.mjs +18 -22
- package/lib/esm/components/ButtonTrigger.mjs +5 -5
- package/lib/esm/components/Calendar.mjs +103 -115
- package/lib/esm/components/DateRangeComparatorAbstract.mjs +105 -89
- package/lib/esm/components/InputTrigger.mjs +143 -181
- package/lib/esm/components/PickerAbstract.mjs +61 -62
- package/lib/esm/components/RangePickerAbstract.mjs +94 -73
- package/lib/esm/components/index.mjs +29 -33
- package/lib/esm/style/calendar.shadow.css +40 -42
- package/lib/esm/style/date-picker.shadow.css +15 -16
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +2 -2
- package/lib/esm/translations/de.json.mjs +18 -6
- package/lib/esm/translations/es.json.mjs +18 -6
- package/lib/esm/translations/fr.json.mjs +18 -6
- package/lib/esm/translations/it.json.mjs +18 -6
- package/lib/esm/translations/ja.json.mjs +18 -6
- package/lib/esm/translations/ko.json.mjs +18 -6
- package/lib/esm/translations/nl.json.mjs +18 -6
- package/lib/esm/translations/pl.json.mjs +18 -6
- package/lib/esm/translations/pt.json.mjs +18 -6
- package/lib/esm/translations/sv.json.mjs +18 -6
- package/lib/esm/translations/tr.json.mjs +18 -6
- package/lib/esm/translations/vi.json.mjs +18 -6
- package/lib/esm/translations/zh.json.mjs +18 -6
- package/lib/esm/utils/cronTabScheduler.mjs +4 -4
- package/lib/esm/utils/datesIntersects.mjs +1 -1
- package/lib/esm/utils/isBetweenPlugin.mjs +13 -0
- package/lib/esm/utils/shortDateRangeFormat.mjs +1 -2
- package/lib/types/index.d.ts +140 -171
- package/package.json +16 -16
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const isBetween = (function(_o, c, d) {
|
|
2
|
+
c.prototype.isBetween = function(a, b, u, i) {
|
|
3
|
+
var dA = d(a);
|
|
4
|
+
var dB = d(b);
|
|
5
|
+
i = i || "()";
|
|
6
|
+
var dAi = i[0] === "(";
|
|
7
|
+
var dBi = i[1] === ")";
|
|
8
|
+
return (dAi ? this.isAfter(dA, u) : !this.isBefore(dA, u)) && (dBi ? this.isBefore(dB, u) : !this.isAfter(dB, u)) || (dAi ? this.isBefore(dA, u) : !this.isAfter(dA, u)) && (dBi ? this.isAfter(dB, u) : !this.isBefore(dB, u));
|
|
9
|
+
};
|
|
10
|
+
});
|
|
11
|
+
export {
|
|
12
|
+
isBetween as default
|
|
13
|
+
};
|
|
@@ -44,8 +44,7 @@ function shortDateRangeFormat(dates, _ref) {
|
|
|
44
44
|
}).format(normalizeDates[0]), " ").concat(normalizeDates[0].getFullYear());
|
|
45
45
|
}
|
|
46
46
|
if (isSimilarYear) {
|
|
47
|
-
options.year;
|
|
48
|
-
var newOptions = _objectWithoutProperties(options, _excluded2);
|
|
47
|
+
var _year = options.year, newOptions = _objectWithoutProperties(options, _excluded2);
|
|
49
48
|
if (getDayJSLocale(locale) === "en") {
|
|
50
49
|
return "".concat(new Intl.DateTimeFormat(locale, newOptions).format(normalizeDates[0]), "-").concat(new Intl.DateTimeFormat(locale, newOptions).format(normalizeDates[1]), ", ").concat(normalizeDates[0].getFullYear());
|
|
51
50
|
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
1
|
+
import type { Flex, Box, BoxProps } from '@semcore/base-components';
|
|
2
|
+
import type Popper from '@semcore/base-components';
|
|
3
|
+
import type { BaseTriggerProps } from '@semcore/base-trigger';
|
|
4
|
+
import type BaseTrigger from '@semcore/base-trigger';
|
|
5
|
+
import type { ButtonProps } from '@semcore/button';
|
|
6
|
+
import type Button from '@semcore/button';
|
|
7
|
+
import type Checkbox from '@semcore/checkbox';
|
|
8
|
+
import type { UnknownProperties, Intergalactic, PropGetterFn } from '@semcore/core';
|
|
9
|
+
import type { WithI18nEnhanceProps } from '@semcore/core/lib/utils/enhances/i18nEnhance';
|
|
10
|
+
import type Divider from '@semcore/divider';
|
|
11
|
+
import type { DropdownProps, DropdownTriggerProps } from '@semcore/dropdown';
|
|
12
|
+
import type { InputProps, InputValueProps } from '@semcore/input';
|
|
13
|
+
import type Input from '@semcore/input';
|
|
14
|
+
import type { InputMaskValueProps } from '@semcore/input-mask';
|
|
15
|
+
import type { TooltipProps } from '@semcore/tooltip';
|
|
16
|
+
import type dayjs from 'dayjs';
|
|
17
|
+
import type { ChangeEvent } from 'react';
|
|
18
|
+
import type React from 'react';
|
|
15
19
|
|
|
16
20
|
export type DateConstructorParams = string | number | Date;
|
|
17
21
|
|
|
@@ -21,8 +25,6 @@ export type DateConstructorParams = string | number | Date;
|
|
|
21
25
|
* */
|
|
22
26
|
export type DisabledDates = (DateConstructorParams | (DateConstructorParams | false)[] | string)[];
|
|
23
27
|
|
|
24
|
-
/** @deprecated */
|
|
25
|
-
export interface ICalendarProps extends CalendarProps, UnknownProperties {}
|
|
26
28
|
export type CalendarProps = BoxProps & {
|
|
27
29
|
/**
|
|
28
30
|
* Locale for displaying the days of a week and months, to be transferred to `Intl`
|
|
@@ -33,13 +35,9 @@ export type CalendarProps = BoxProps & {
|
|
|
33
35
|
* Array of dates blocked for selection
|
|
34
36
|
*/
|
|
35
37
|
disabled?: DisabledDates;
|
|
36
|
-
/**
|
|
37
|
-
* @ignore
|
|
38
|
-
* */
|
|
38
|
+
/** Internal */
|
|
39
39
|
highlighted?: DateConstructorParams[];
|
|
40
|
-
/**
|
|
41
|
-
* @ignore
|
|
42
|
-
* */
|
|
40
|
+
/** Internal */
|
|
43
41
|
onHighlightedChange?: (date: Date[]) => void;
|
|
44
42
|
/**
|
|
45
43
|
* The selected date, accepts everything which is accepted by `new Date()`
|
|
@@ -54,40 +52,43 @@ export type CalendarProps = BoxProps & {
|
|
|
54
52
|
* @default new Date()
|
|
55
53
|
* */
|
|
56
54
|
displayedPeriod?: Date;
|
|
57
|
-
|
|
55
|
+
/** Controls whether to render dates from previous/next months */
|
|
58
56
|
renderOutdated?: boolean;
|
|
59
57
|
};
|
|
60
58
|
|
|
61
|
-
/** @deprecated */
|
|
62
|
-
export interface ICalendarDaysContext extends CalendarDaysContext, UnknownProperties {}
|
|
63
59
|
export type CalendarDaysContext = {
|
|
64
60
|
days: CalendarUnitProps[];
|
|
65
61
|
};
|
|
66
62
|
|
|
67
|
-
/** @deprecated */
|
|
68
|
-
export interface ICalendarMonthsContext extends CalendarMonthsContext, UnknownProperties {}
|
|
69
63
|
export type CalendarMonthsContext = {
|
|
70
64
|
months: CalendarUnitProps[];
|
|
71
65
|
};
|
|
72
66
|
|
|
73
|
-
/** @deprecated */
|
|
74
|
-
export interface ICalendarUnitProps extends CalendarUnitProps, UnknownProperties {}
|
|
75
67
|
export type CalendarUnitProps = BoxProps & {
|
|
68
|
+
/** Indicates if the calendar unit is part of a selected date range */
|
|
76
69
|
selected?: boolean;
|
|
70
|
+
/** Marks units from previous/next months that appear in the current month view */
|
|
77
71
|
outdated?: boolean;
|
|
72
|
+
/** Prevents interaction with the unit */
|
|
78
73
|
disabled?: boolean;
|
|
74
|
+
/** Highlights the current date */
|
|
79
75
|
today?: boolean;
|
|
76
|
+
/** Marks the beginning of a selected date range */
|
|
80
77
|
startSelected?: boolean;
|
|
78
|
+
/** Marks the end of a selected date range */
|
|
81
79
|
endSelected?: boolean;
|
|
80
|
+
/** Shows preview highlighting during range selection */
|
|
82
81
|
highlighted?: boolean;
|
|
82
|
+
/** Marks the start of a highlighted range */
|
|
83
83
|
startHighlighted?: boolean;
|
|
84
|
+
/** Marks the end of a highlighted range */
|
|
84
85
|
endHighlighted?: boolean;
|
|
86
|
+
/** The actual Date object this unit represents */
|
|
85
87
|
date?: Date;
|
|
88
|
+
/** Content to display within the unit (typically the day number) */
|
|
86
89
|
children?: React.ReactNode;
|
|
87
90
|
};
|
|
88
91
|
|
|
89
|
-
/** @deprecated */
|
|
90
|
-
export interface ICalendarContext extends CalendarContext, UnknownProperties {}
|
|
91
92
|
export type CalendarContext = {
|
|
92
93
|
getUnitProps: PropGetterFn;
|
|
93
94
|
};
|
|
@@ -101,137 +102,129 @@ declare const Calendar: Intergalactic.Component<
|
|
|
101
102
|
Unit: Intergalactic.Component<'div', CalendarUnitProps>;
|
|
102
103
|
};
|
|
103
104
|
|
|
104
|
-
/** @deprecated */
|
|
105
|
-
export interface IDatePickerProps extends DatePickerProps, UnknownProperties {}
|
|
106
105
|
export type DatePickerProps = Intergalactic.InternalTypings.EfficientOmit<
|
|
107
106
|
DropdownProps,
|
|
108
107
|
'disabled'
|
|
109
108
|
> &
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
WithI18nEnhanceProps & {
|
|
110
|
+
/**
|
|
112
111
|
* The selected date, accepts everything which is accepted by `new Date()`
|
|
113
112
|
* */
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
value?: DateConstructorParams;
|
|
114
|
+
/**
|
|
116
115
|
* To be activated upon selecting the date
|
|
117
116
|
* */
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
onChange?: (date: Date) => void;
|
|
118
|
+
/**
|
|
120
119
|
* Array of dates blocked for selection
|
|
121
120
|
* */
|
|
122
|
-
|
|
123
|
-
|
|
121
|
+
disabled?: (DateConstructorParams | (DateConstructorParams | false)[] | string)[];
|
|
122
|
+
/**
|
|
124
123
|
* Error message when user attempts to input a disabled date
|
|
125
124
|
* */
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
disabledErrorText?: ((attemptedDate: Date) => string) | string | null;
|
|
126
|
+
/**
|
|
128
127
|
* Date for showing the necessary month
|
|
129
128
|
* @default new Date()
|
|
130
129
|
* */
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
displayedPeriod?: DateConstructorParams;
|
|
131
|
+
/**
|
|
133
132
|
* To be activated upon changing the current shown month
|
|
134
133
|
* */
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
onDisplayedPeriodChange?: (date: Date) => void;
|
|
135
|
+
/**
|
|
137
136
|
* Component size
|
|
138
137
|
* @default m
|
|
139
138
|
*/
|
|
140
|
-
|
|
141
|
-
|
|
139
|
+
size?: 'm' | 'l';
|
|
140
|
+
/**
|
|
142
141
|
* The selected date, accepts everything which is accepted by `new Date()`
|
|
143
142
|
* */
|
|
144
|
-
|
|
145
|
-
|
|
143
|
+
highlighted?: DateConstructorParams[];
|
|
144
|
+
/**
|
|
146
145
|
* Default value selected date, accepts everything which is accepted by `new Date()`
|
|
147
146
|
* */
|
|
148
|
-
|
|
149
|
-
|
|
147
|
+
defaultValue?: DateConstructorParams;
|
|
148
|
+
/**
|
|
150
149
|
* Default value date for showing the necessary month
|
|
151
150
|
* */
|
|
152
|
-
|
|
153
|
-
|
|
151
|
+
defaultDisplayedPeriod?: DateConstructorParams;
|
|
152
|
+
/**
|
|
154
153
|
* Default value selected date, accepts everything which is accepted by `new Date()`
|
|
155
154
|
* */
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
defaultHighlighted?: DateConstructorParams[];
|
|
156
|
+
};
|
|
158
157
|
|
|
159
|
-
/** @deprecated */
|
|
160
|
-
export interface IDateRangePickerProps extends DateRangePickerProps, UnknownProperties {}
|
|
161
158
|
export type DateRangePickerProps = Intergalactic.InternalTypings.EfficientOmit<
|
|
162
159
|
DropdownProps,
|
|
163
160
|
'disabled'
|
|
164
161
|
> &
|
|
165
|
-
|
|
166
|
-
|
|
162
|
+
WithI18nEnhanceProps & {
|
|
163
|
+
/**
|
|
167
164
|
* The selected date, accepts everything which is accepted by `new Date()`
|
|
168
165
|
* */
|
|
169
|
-
|
|
170
|
-
|
|
166
|
+
value?: DateConstructorParams[];
|
|
167
|
+
/**
|
|
171
168
|
* Default value selected date, accepts everything which is accepted by `new Date()`
|
|
172
169
|
* */
|
|
173
|
-
|
|
174
|
-
|
|
170
|
+
defaultValue?: DateConstructorParams[];
|
|
171
|
+
/**
|
|
175
172
|
* Default value date for showing the necessary month
|
|
176
173
|
* */
|
|
177
|
-
|
|
178
|
-
|
|
174
|
+
defaultDisplayedPeriod?: DateConstructorParams;
|
|
175
|
+
/**
|
|
179
176
|
* Default value selected date, accepts everything which is accepted by `new Date()`
|
|
180
177
|
* */
|
|
181
|
-
|
|
182
|
-
|
|
178
|
+
defaultHighlighted?: DateConstructorParams[];
|
|
179
|
+
/**
|
|
183
180
|
* To be activated upon selecting the date
|
|
184
181
|
* */
|
|
185
|
-
|
|
186
|
-
|
|
182
|
+
onChange?: (date: Date[]) => void;
|
|
183
|
+
/**
|
|
187
184
|
* Array of dates blocked for selection
|
|
188
185
|
* */
|
|
189
|
-
|
|
190
|
-
|
|
186
|
+
disabled?: (DateConstructorParams | (DateConstructorParams | false)[] | string)[];
|
|
187
|
+
/**
|
|
191
188
|
* Error message when user attempts to input a disabled date
|
|
192
189
|
* */
|
|
193
|
-
|
|
194
|
-
|
|
190
|
+
disabledErrorText?: ((attemptedDate: Date) => string) | string | null;
|
|
191
|
+
/**
|
|
195
192
|
* Date for showing the necessary month
|
|
196
193
|
* @default new Date()
|
|
197
194
|
* */
|
|
198
|
-
|
|
199
|
-
|
|
195
|
+
displayedPeriod?: DateConstructorParams;
|
|
196
|
+
/**
|
|
200
197
|
* To be activated upon changing the current shown month
|
|
201
198
|
* */
|
|
202
|
-
|
|
203
|
-
|
|
199
|
+
onDisplayedPeriodChange?: (date: Date) => void;
|
|
200
|
+
/**
|
|
204
201
|
* The selected date, accepts everything which is accepted by `new Date()`
|
|
205
202
|
* */
|
|
206
|
-
|
|
207
|
-
|
|
203
|
+
highlighted?: DateConstructorParams[];
|
|
204
|
+
/**
|
|
208
205
|
* Remove the 'Reset' button
|
|
209
206
|
* */
|
|
210
|
-
|
|
211
|
-
|
|
207
|
+
unclearable?: boolean;
|
|
208
|
+
/**
|
|
212
209
|
* To be activated upon selecting the date
|
|
213
210
|
* */
|
|
214
|
-
|
|
215
|
-
|
|
211
|
+
onHighlightedChange?: (date: Date[]) => void;
|
|
212
|
+
/**
|
|
216
213
|
* Intermediate value between `highlighted` and `value` that user see before explicitly applying it.
|
|
217
214
|
*/
|
|
218
|
-
|
|
219
|
-
|
|
215
|
+
preselectedValue?: DateConstructorParams[];
|
|
216
|
+
/**
|
|
220
217
|
* Normally called when user preselects a date range and when user applies this range.
|
|
221
218
|
*/
|
|
222
|
-
|
|
223
|
-
|
|
219
|
+
onPreselectedValueChange?: (date: Date[]) => void;
|
|
220
|
+
/**
|
|
224
221
|
* Array of periods
|
|
225
222
|
* [{value: [new Date(), new Date()], children: "Today"}]
|
|
226
223
|
* @default Past 2 days / Past week / Past 2 week / Past month / Past 2 month
|
|
227
224
|
* */
|
|
228
|
-
|
|
229
|
-
|
|
225
|
+
periods?: (ButtonProps & { value: Date[] })[];
|
|
226
|
+
};
|
|
230
227
|
|
|
231
|
-
/** @deprecated */
|
|
232
|
-
export interface IDateRangePickerPeriodProps
|
|
233
|
-
extends DateRangePickerPeriodProps,
|
|
234
|
-
UnknownProperties {}
|
|
235
228
|
export type DateRangePickerPeriodProps = BoxProps & {
|
|
236
229
|
/**
|
|
237
230
|
* Current selected period
|
|
@@ -257,8 +250,6 @@ export type DateRangePickerPeriodProps = BoxProps & {
|
|
|
257
250
|
periods?: (ButtonProps & { value: Date[] })[];
|
|
258
251
|
};
|
|
259
252
|
|
|
260
|
-
/** @deprecated */
|
|
261
|
-
export interface IDatePickerContext extends DatePickerContext, UnknownProperties {}
|
|
262
253
|
export type DatePickerContext = {
|
|
263
254
|
getTriggerProps: PropGetterFn;
|
|
264
255
|
getPopperProps: PropGetterFn;
|
|
@@ -270,10 +261,6 @@ export type DatePickerContext = {
|
|
|
270
261
|
getTodayProps: PropGetterFn;
|
|
271
262
|
};
|
|
272
263
|
|
|
273
|
-
/** @deprecated */
|
|
274
|
-
export interface IAbstractDatePickerHandlers
|
|
275
|
-
extends AbstractDatePickerHandlers,
|
|
276
|
-
UnknownProperties {}
|
|
277
264
|
export type AbstractDatePickerHandlers = {
|
|
278
265
|
displayedPeriod: (value: DateConstructorParams) => void;
|
|
279
266
|
visible: (index: boolean) => void;
|
|
@@ -281,14 +268,10 @@ export type AbstractDatePickerHandlers = {
|
|
|
281
268
|
value: (index: DateConstructorParams) => void;
|
|
282
269
|
};
|
|
283
270
|
|
|
284
|
-
/** @deprecated */
|
|
285
|
-
export interface IDatePickerHandlers extends DatePickerHandlers, UnknownProperties {}
|
|
286
271
|
export type DatePickerHandlers = {
|
|
287
272
|
visible: (index: boolean) => void;
|
|
288
273
|
};
|
|
289
274
|
|
|
290
|
-
/** @deprecated */
|
|
291
|
-
export interface IInputTriggerProps extends InputTriggerProps, UnknownProperties {}
|
|
292
275
|
export type BaseInputTriggerProps = InputProps &
|
|
293
276
|
TooltipProps & {
|
|
294
277
|
/**
|
|
@@ -311,24 +294,16 @@ export type RangeInputTriggerProps = BaseInputTriggerProps & {
|
|
|
311
294
|
onChange?: (date: Date[], event: ChangeEvent) => void;
|
|
312
295
|
};
|
|
313
296
|
|
|
314
|
-
/** @deprecated */
|
|
315
|
-
export interface ISingleDateInputProps extends SingleDateInputProps, UnknownProperties {}
|
|
316
297
|
export type SingleDateInputProps = InputTriggerProps & {};
|
|
317
298
|
|
|
318
|
-
/** @deprecated */
|
|
319
|
-
export interface IDateRangeProps extends DateRangeProps, UnknownProperties {}
|
|
320
299
|
export type DateRangeProps = RangeInputTriggerProps & {};
|
|
321
300
|
|
|
322
|
-
/** @deprecated */
|
|
323
|
-
export interface IDatePickerMaskedInputProps
|
|
324
|
-
extends DatePickerMaskedInputProps,
|
|
325
|
-
UnknownProperties {}
|
|
326
301
|
export type DatePickerMaskedInputProps = {
|
|
327
302
|
date?: Date;
|
|
328
303
|
onDateChange?: (date: Date, event: ChangeEvent) => void;
|
|
329
304
|
onDisplayedPeriodChange?: (date: Date) => void;
|
|
330
305
|
locale?: string;
|
|
331
|
-
parts?: { year:
|
|
306
|
+
parts?: { year: boolean; month: boolean; day: boolean };
|
|
332
307
|
disabledDates?: (Date | (Date | false)[] | string)[];
|
|
333
308
|
};
|
|
334
309
|
|
|
@@ -386,8 +361,6 @@ declare const DatePicker: Intergalactic.Component<
|
|
|
386
361
|
subtract: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;
|
|
387
362
|
};
|
|
388
363
|
|
|
389
|
-
/** @deprecated */
|
|
390
|
-
export interface IDateRangePickerContext extends DateRangePickerContext, UnknownProperties {}
|
|
391
364
|
export type DateRangePickerContext = {
|
|
392
365
|
getTriggerProps: PropGetterFn;
|
|
393
366
|
getPopperProps: PropGetterFn;
|
|
@@ -424,8 +397,6 @@ declare const DateRangePicker: Intergalactic.Component<
|
|
|
424
397
|
subtract: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;
|
|
425
398
|
};
|
|
426
399
|
|
|
427
|
-
/** @deprecated */
|
|
428
|
-
export interface IMonthPickerContext extends MonthPickerContext, UnknownProperties {}
|
|
429
400
|
export type MonthPickerContext = {
|
|
430
401
|
getTriggerProps: PropGetterFn;
|
|
431
402
|
getPopperProps: PropGetterFn;
|
|
@@ -458,8 +429,6 @@ declare const MonthPicker: Intergalactic.Component<
|
|
|
458
429
|
subtract: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;
|
|
459
430
|
};
|
|
460
431
|
|
|
461
|
-
/** @deprecated */
|
|
462
|
-
export interface IMonthRangePickerContext extends MonthRangePickerContext, UnknownProperties {}
|
|
463
432
|
export type MonthRangePickerContext = {
|
|
464
433
|
getTriggerProps: PropGetterFn;
|
|
465
434
|
getPopperProps: PropGetterFn;
|
|
@@ -506,106 +475,106 @@ export type DateRangeComparatorProps = Intergalactic.InternalTypings.EfficientOm
|
|
|
506
475
|
DropdownProps,
|
|
507
476
|
'disabled'
|
|
508
477
|
> &
|
|
509
|
-
|
|
510
|
-
|
|
478
|
+
WithI18nEnhanceProps & {
|
|
479
|
+
/**
|
|
511
480
|
* Selected date ranges
|
|
512
481
|
* */
|
|
513
|
-
|
|
514
|
-
|
|
482
|
+
value?: DateRangeComparatorValue;
|
|
483
|
+
/**
|
|
515
484
|
* Default value for selected date ranges
|
|
516
485
|
* */
|
|
517
|
-
|
|
518
|
-
|
|
486
|
+
defaultValue?: DateRangeComparatorValue;
|
|
487
|
+
/**
|
|
519
488
|
* Default value date for showing the necessary month
|
|
520
489
|
* */
|
|
521
|
-
|
|
522
|
-
|
|
490
|
+
defaultDisplayedPeriod?: DateConstructorParams;
|
|
491
|
+
/**
|
|
523
492
|
* Default value selected date, accepts everything which is accepted by `new Date()`
|
|
524
493
|
* */
|
|
525
|
-
|
|
526
|
-
|
|
494
|
+
defaultHighlighted?: DateConstructorParams[];
|
|
495
|
+
/**
|
|
527
496
|
* Called with selected date when user clicks `Apply` button.
|
|
528
497
|
* */
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
498
|
+
onChange?: (ranges: {
|
|
499
|
+
value?: DateConstructorParams[];
|
|
500
|
+
compare?: DateConstructorParams[];
|
|
501
|
+
}) => void;
|
|
502
|
+
/**
|
|
534
503
|
* Array of dates blocked for selection
|
|
535
504
|
* */
|
|
536
|
-
|
|
537
|
-
|
|
505
|
+
disabled?: (DateConstructorParams | (DateConstructorParams | false)[] | string)[];
|
|
506
|
+
/**
|
|
538
507
|
* Error message when user attempts to input a disabled date
|
|
539
508
|
* */
|
|
540
|
-
|
|
541
|
-
|
|
509
|
+
disabledErrorText?: ((attemptedDate: Date) => string) | string | null;
|
|
510
|
+
/**
|
|
542
511
|
* Date for showing the necessary month
|
|
543
512
|
* @default new Date()
|
|
544
513
|
* */
|
|
545
|
-
|
|
546
|
-
|
|
514
|
+
displayedPeriod?: DateConstructorParams;
|
|
515
|
+
/**
|
|
547
516
|
* To be activated upon changing the current shown month
|
|
548
517
|
* */
|
|
549
|
-
|
|
550
|
-
|
|
518
|
+
onDisplayedPeriodChange?: (date: Date) => void;
|
|
519
|
+
/**
|
|
551
520
|
* The selected date, accepts everything which is accepted by `new Date()`
|
|
552
521
|
* */
|
|
553
|
-
|
|
554
|
-
|
|
522
|
+
highlighted?: DateConstructorParams[];
|
|
523
|
+
/**
|
|
555
524
|
* To be activated upon selecting the date
|
|
556
525
|
* */
|
|
557
|
-
|
|
558
|
-
|
|
526
|
+
onHighlightedChange?: (date: Date[]) => void;
|
|
527
|
+
/**
|
|
559
528
|
* The selected date, accepts everything which is accepted by `new Date()`
|
|
560
529
|
* */
|
|
561
|
-
|
|
562
|
-
|
|
530
|
+
compareHighlighted?: DateConstructorParams[];
|
|
531
|
+
/**
|
|
563
532
|
* To be activated upon selecting the date
|
|
564
533
|
* */
|
|
565
|
-
|
|
566
|
-
|
|
534
|
+
onCompareHighlightedChange?: (date: Date[]) => void;
|
|
535
|
+
/**
|
|
567
536
|
* Intermediate value between `highlighted` and `value` that user see before explicitly applying it.
|
|
568
537
|
*/
|
|
569
|
-
|
|
570
|
-
|
|
538
|
+
preselectedValue?: DateConstructorParams[];
|
|
539
|
+
/**
|
|
571
540
|
* Normally called when user preselects a date range and when user applies this range.
|
|
572
541
|
*/
|
|
573
|
-
|
|
574
|
-
|
|
542
|
+
onPreselectedValueChange?: (date: Date[]) => void;
|
|
543
|
+
/**
|
|
575
544
|
* Intermediate value between `compareHighlighted` and `compare` that user see before explicitly applying it.
|
|
576
545
|
*/
|
|
577
|
-
|
|
578
|
-
|
|
546
|
+
preselectedCompare?: DateConstructorParams[];
|
|
547
|
+
/**
|
|
579
548
|
* Normally called when user preselects a compare range and when user applies ranges.
|
|
580
549
|
*/
|
|
581
|
-
|
|
582
|
-
|
|
550
|
+
onPreselectedCompareChange?: (date: Date[]) => void;
|
|
551
|
+
/**
|
|
583
552
|
* Controls that compare range input is enabled.
|
|
584
553
|
*/
|
|
585
|
-
|
|
586
|
-
|
|
554
|
+
compareToggle?: boolean;
|
|
555
|
+
/**
|
|
587
556
|
* Toggles when compare range input enables or disables.
|
|
588
557
|
*/
|
|
589
|
-
|
|
590
|
-
|
|
558
|
+
onCompareToggleChange?: (compareToggle: boolean) => void;
|
|
559
|
+
/**
|
|
591
560
|
* Controls which date range is focused.
|
|
592
561
|
*/
|
|
593
|
-
|
|
594
|
-
|
|
562
|
+
focusedRange?: DateRangeComparatorFocusRange;
|
|
563
|
+
/**
|
|
595
564
|
* Called when user focuses or is focused on some of the date ranges.
|
|
596
565
|
*/
|
|
597
|
-
|
|
598
|
-
|
|
566
|
+
onFocusedRangeChange?: (focusedRange: DateRangeComparatorFocusRange) => void;
|
|
567
|
+
/**
|
|
599
568
|
* Remove the 'Reset' button
|
|
600
569
|
* */
|
|
601
|
-
|
|
602
|
-
|
|
570
|
+
unclearable?: boolean;
|
|
571
|
+
/**
|
|
603
572
|
* Array of periods
|
|
604
573
|
* [{value: [new Date(), new Date()], children: "Today"}]
|
|
605
574
|
* @default Past 2 days / Past week / Past 2 week / Past month / Past 2 month
|
|
606
575
|
* */
|
|
607
|
-
|
|
608
|
-
|
|
576
|
+
periods?: (ButtonProps & { value: Date[] })[];
|
|
577
|
+
};
|
|
609
578
|
|
|
610
579
|
export type DateRangeComparatorContext = {
|
|
611
580
|
getTriggerProps: PropGetterFn;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/date-picker",
|
|
3
3
|
"description": "Semrush DatePicker Component",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.58.0-prerelease.0",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -14,24 +14,24 @@
|
|
|
14
14
|
"types": "./lib/types/index.d.ts"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@semcore/utils": "4.
|
|
18
|
-
"@semcore/base-trigger": "4.
|
|
19
|
-
"@semcore/button": "5.
|
|
20
|
-
"@semcore/divider": "4.
|
|
21
|
-
"@semcore/dropdown": "4.
|
|
22
|
-
"@semcore/flex-box": "5.
|
|
23
|
-
"@semcore/icon": "4.
|
|
24
|
-
"@semcore/input": "4.
|
|
25
|
-
"@semcore/input-mask": "5.
|
|
26
|
-
"@semcore/neighbor-location": "4.
|
|
27
|
-
"@semcore/typography": "5.
|
|
28
|
-
"@semcore/checkbox": "7.
|
|
29
|
-
"@semcore/popper": "5.
|
|
30
|
-
"@semcore/tooltip": "6.
|
|
17
|
+
"@semcore/utils": "4.49.0-prerelease.0",
|
|
18
|
+
"@semcore/base-trigger": "4.54.0-prerelease.0",
|
|
19
|
+
"@semcore/button": "5.44.0-prerelease.0",
|
|
20
|
+
"@semcore/divider": "4.41.0-prerelease.0",
|
|
21
|
+
"@semcore/dropdown": "4.44.0-prerelease.0",
|
|
22
|
+
"@semcore/flex-box": "5.42.0-prerelease.0",
|
|
23
|
+
"@semcore/icon": "4.63.0-prerelease.0",
|
|
24
|
+
"@semcore/input": "4.43.0-prerelease.0",
|
|
25
|
+
"@semcore/input-mask": "5.44.0-prerelease.0",
|
|
26
|
+
"@semcore/neighbor-location": "4.41.0-prerelease.0",
|
|
27
|
+
"@semcore/typography": "5.54.0-prerelease.0",
|
|
28
|
+
"@semcore/checkbox": "7.45.0-prerelease.0",
|
|
29
|
+
"@semcore/popper": "5.47.0-prerelease.0",
|
|
30
|
+
"@semcore/tooltip": "6.50.0-prerelease.0",
|
|
31
31
|
"dayjs": "1.8.36"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@semcore/core": "^2.
|
|
34
|
+
"@semcore/core": "^2.40.0-prerelease.0",
|
|
35
35
|
"react": "16.8 - 18",
|
|
36
36
|
"react-dom": "16.8 - 18"
|
|
37
37
|
},
|