@semcore/date-picker 4.58.0-prerelease.5 → 4.58.0-prerelease.7

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