@povio/ui 3.2.4-rc.4 → 3.3.0-rc.1
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/buttons/Button/button.cva.d.ts +1 -1
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +0 -1
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +127 -142
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +17 -2
- package/dist/components/inputs/DateTime/shared/DateField.js +87 -92
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +0 -2
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +134 -144
- package/dist/components/inputs/FormField/FormField.js +47 -34
- package/dist/components/inputs/FormField/formField.cva.d.ts +11 -0
- package/dist/components/inputs/FormField/formField.cva.js +16 -0
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +1 -2
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +1 -2
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +2 -54
- package/dist/components/inputs/Selection/Select/QuerySelect.js +46 -99
- package/dist/components/inputs/Selection/shared/querySelect.utils.d.ts +0 -1
- package/dist/components/inputs/Selection/shared/querySelect.utils.js +0 -1
- package/dist/components/inputs/Selection/shared/select.context.js +9 -19
- package/dist/components/inputs/shared/input.cva.js +1 -1
- package/dist/components/shared/pagination/minWidth.cva.d.ts +1 -1
- package/dist/components/table/Table.d.ts +8 -2
- package/dist/components/table/Table.js +55 -33
- package/dist/components/table/TableColumnFilterInput.d.ts +9 -0
- package/dist/components/table/TableColumnFilterInput.js +108 -0
- package/dist/components/table/TableColumnFilterPlaceholder.d.ts +5 -0
- package/dist/components/table/TableColumnFilterPlaceholder.js +41 -0
- package/dist/components/table/TableColumnFilterRow.d.ts +16 -0
- package/dist/components/table/TableColumnFilterRow.js +68 -0
- package/dist/config/uiConfig.context.d.ts +0 -1
- package/dist/config/uiConfig.context.js +1 -2
- package/dist/config/uiOverrides.context.d.ts +1 -0
- package/dist/helpers/dynamicColumns.js +1 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/utils/date-time.utils.d.ts +1 -0
- package/dist/utils/date-time.utils.js +45 -21
- package/package.json +1 -1
- package/dist/components/inputs/DateTime/shared/useFirefoxDateSegmentSelectionGuard.d.ts +0 -2
- package/dist/components/inputs/DateTime/shared/useFirefoxDateSegmentSelectionGuard.js +0 -33
- package/dist/utils/intl.utils.d.ts +0 -7
- package/dist/utils/intl.utils.js +0 -38
- package/dist/utils/intl.utils.spec.d.ts +0 -1
|
@@ -92,7 +92,7 @@ export declare const buttonIconSizeDefinition: {
|
|
|
92
92
|
export type ButtonIconSizeConfig = NonNullable<typeof buttonIconSizeDefinition.config>;
|
|
93
93
|
export declare const buttonTypography: (props: {
|
|
94
94
|
readonly width?: "fill" | "hug" | null | undefined;
|
|
95
|
-
readonly size?: "none" | "
|
|
95
|
+
readonly size?: "none" | "s" | "xs" | "m" | "l" | null | undefined;
|
|
96
96
|
readonly color?: "error" | "primary" | "dual" | "secondary" | "success" | "warning" | null | undefined;
|
|
97
97
|
readonly variant?: "text" | "contained" | "outlined" | "subtle" | "ghost" | null | undefined;
|
|
98
98
|
readonly inverted?: boolean | null | undefined;
|
|
@@ -25,7 +25,6 @@ interface DateRangePickerBaseProps extends FormFieldProps, InputVariantProps, Om
|
|
|
25
25
|
inputClassName?: string;
|
|
26
26
|
onBlur?: (e: FocusEvent<HTMLInputElement>) => void;
|
|
27
27
|
fireBlurOnChange?: boolean;
|
|
28
|
-
allowPartialRange?: boolean;
|
|
29
28
|
}
|
|
30
29
|
export interface DateRangePickerProps extends Omit<DateRangePickerBaseProps, "value" | "onChange" | "minValue" | "maxValue"> {
|
|
31
30
|
value?: {
|
|
@@ -31,7 +31,7 @@ import { useDateRangePickerState, useRangeCalendarState } from "react-stately";
|
|
|
31
31
|
var DateRangePickerBase = (props) => {
|
|
32
32
|
const ui = UIConfig.useConfig();
|
|
33
33
|
const { t } = useTranslation();
|
|
34
|
-
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, className, hideSidebar, placeholder, inputClassName, hideLabel: hideLabelProp, variant: variantProp, as: asProp, size: sizeProp, isClearable: isClearableProp, todayIcon: todayIconProp, todayIconButtonSize: todayIconButtonSizeProp, todayIconButtonComponent: todayIconButtonComponentProp, todayIconPlacement: todayIconPlacementProp, shouldForceLeadingZeros: shouldForceLeadingZerosProp, disableManualEntry: disableManualEntryProp, autoFixYear: autoFixYearProp, fireBlurOnChange: fireBlurOnChangeProp,
|
|
34
|
+
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, className, hideSidebar, placeholder, inputClassName, hideLabel: hideLabelProp, variant: variantProp, as: asProp, size: sizeProp, isClearable: isClearableProp, todayIcon: todayIconProp, todayIconButtonSize: todayIconButtonSizeProp, todayIconButtonComponent: todayIconButtonComponentProp, todayIconPlacement: todayIconPlacementProp, shouldForceLeadingZeros: shouldForceLeadingZerosProp, disableManualEntry: disableManualEntryProp, autoFixYear: autoFixYearProp, fireBlurOnChange: fireBlurOnChangeProp, minValue, maxValue, ...rest } = props;
|
|
35
35
|
const hideLabel = hideLabelProp ?? ui.input.hideLabel;
|
|
36
36
|
const variant = variantProp ?? ui.input.variant;
|
|
37
37
|
const as = asProp ?? ui.input.as;
|
|
@@ -45,7 +45,6 @@ var DateRangePickerBase = (props) => {
|
|
|
45
45
|
const disableManualEntry = disableManualEntryProp ?? ui.dateInput.disableManualEntry;
|
|
46
46
|
const autoFixYear = autoFixYearProp ?? ui.dateInput.autoFixYear;
|
|
47
47
|
const fireBlurOnChange = fireBlurOnChangeProp ?? ui.dateInput.fireBlurOnChange;
|
|
48
|
-
const allowPartialRange = allowPartialRangeProp ?? ui.dateInput.allowPartialRange;
|
|
49
48
|
const timeZone = ui.dateInput.timeZone;
|
|
50
49
|
let effectiveTimeZone = getLocalTimeZone();
|
|
51
50
|
if (timeZone !== "clientLocal") effectiveTimeZone = timeZone;
|
|
@@ -55,8 +54,6 @@ var DateRangePickerBase = (props) => {
|
|
|
55
54
|
return datePickerInputRef.current?.getContainer?.() || null;
|
|
56
55
|
} }), []);
|
|
57
56
|
const normalizedValue = value ?? null;
|
|
58
|
-
const fieldRangeRef = useRef(normalizedValue);
|
|
59
|
-
fieldRangeRef.current = normalizedValue;
|
|
60
57
|
const dialogState = useDateRangePickerState({
|
|
61
58
|
...rest,
|
|
62
59
|
value: normalizedValue,
|
|
@@ -72,8 +69,6 @@ var DateRangePickerBase = (props) => {
|
|
|
72
69
|
minValue,
|
|
73
70
|
maxValue,
|
|
74
71
|
onChange: (newValue) => {
|
|
75
|
-
if (allowPartialRange && newValue === null) return;
|
|
76
|
-
fieldRangeRef.current = newValue;
|
|
77
72
|
const isInvalidRange = isValidRange(newValue);
|
|
78
73
|
onChange?.(newValue);
|
|
79
74
|
if (isInvalidRange) return;
|
|
@@ -96,18 +91,6 @@ var DateRangePickerBase = (props) => {
|
|
|
96
91
|
minValue,
|
|
97
92
|
maxValue
|
|
98
93
|
}, dialogState, dateRangePickerRef);
|
|
99
|
-
const emitPartialRangeChange = (part, date) => {
|
|
100
|
-
if (!allowPartialRange) return;
|
|
101
|
-
const partialRange = {
|
|
102
|
-
start: part === "start" ? date : fieldRangeRef.current?.start ?? null,
|
|
103
|
-
end: part === "end" ? date : fieldRangeRef.current?.end ?? null
|
|
104
|
-
};
|
|
105
|
-
fieldRangeRef.current = partialRange;
|
|
106
|
-
if (partialRange.start && partialRange.end) return;
|
|
107
|
-
const newValue_0 = partialRange.start || partialRange.end ? partialRange : null;
|
|
108
|
-
onChange?.(newValue_0);
|
|
109
|
-
if (fireBlurOnChange) debouncedBlur(newValue_0);
|
|
110
|
-
};
|
|
111
94
|
const { locale } = useLocale$1();
|
|
112
95
|
useImperativeHandle(ref, () => ({
|
|
113
96
|
clear: () => {
|
|
@@ -115,8 +98,8 @@ var DateRangePickerBase = (props) => {
|
|
|
115
98
|
},
|
|
116
99
|
getContainer: () => datePickerInputRef.current?.getContainer?.() ?? null
|
|
117
100
|
}));
|
|
118
|
-
const handleBlur = (
|
|
119
|
-
onBlur?.({ target: { value:
|
|
101
|
+
const handleBlur = (newValue_0) => {
|
|
102
|
+
onBlur?.({ target: { value: newValue_0 } });
|
|
120
103
|
};
|
|
121
104
|
const { callback: debouncedBlur } = useDebounceCallback(handleBlur, { delay: 500 });
|
|
122
105
|
const formFieldProps = {
|
|
@@ -169,9 +152,9 @@ var DateRangePickerBase = (props) => {
|
|
|
169
152
|
className: headerClassName,
|
|
170
153
|
labelProps
|
|
171
154
|
};
|
|
172
|
-
const isDateOutsideBounds = useCallback((
|
|
173
|
-
if (minValue &&
|
|
174
|
-
if (maxValue &&
|
|
155
|
+
const isDateOutsideBounds = useCallback((date) => {
|
|
156
|
+
if (minValue && date.compare(minValue) < 0) return true;
|
|
157
|
+
if (maxValue && date.compare(maxValue) > 0) return true;
|
|
175
158
|
return false;
|
|
176
159
|
}, [minValue, maxValue]);
|
|
177
160
|
const clampRangeToBounds = useCallback((range) => {
|
|
@@ -195,10 +178,10 @@ var DateRangePickerBase = (props) => {
|
|
|
195
178
|
if (maxValue && range_0.end.compare(maxValue) > 0) return false;
|
|
196
179
|
return true;
|
|
197
180
|
}, [minValue, maxValue]);
|
|
198
|
-
const isValidRange = useCallback((
|
|
199
|
-
if (
|
|
200
|
-
const startDate_0 =
|
|
201
|
-
if (
|
|
181
|
+
const isValidRange = useCallback((newValue_1) => {
|
|
182
|
+
if (newValue_1?.start && newValue_1?.end) {
|
|
183
|
+
const startDate_0 = newValue_1.start;
|
|
184
|
+
if (newValue_1.end.compare(startDate_0) < 0) {
|
|
202
185
|
setValidationRangeError(t(($) => $.ui.datePicker.errors.endDateBeforeStart, { ns: "ui" }));
|
|
203
186
|
return true;
|
|
204
187
|
}
|
|
@@ -206,9 +189,9 @@ var DateRangePickerBase = (props) => {
|
|
|
206
189
|
} else setValidationRangeError(void 0);
|
|
207
190
|
return false;
|
|
208
191
|
}, [t]);
|
|
209
|
-
const handleCalendarStatesChange = (
|
|
210
|
-
if (
|
|
211
|
-
const clampedValue = clampRangeToBounds(
|
|
192
|
+
const handleCalendarStatesChange = (newValue_2) => {
|
|
193
|
+
if (newValue_2) {
|
|
194
|
+
const clampedValue = clampRangeToBounds(newValue_2);
|
|
212
195
|
if (!clampedValue) return;
|
|
213
196
|
if (isValidRange(clampedValue)) return;
|
|
214
197
|
dialogState.setValue(clampedValue);
|
|
@@ -240,33 +223,33 @@ var DateRangePickerBase = (props) => {
|
|
|
240
223
|
setActivePreset(null);
|
|
241
224
|
}
|
|
242
225
|
};
|
|
243
|
-
const throttledSetHoverDate = useCallback((
|
|
226
|
+
const throttledSetHoverDate = useCallback((date_0) => {
|
|
244
227
|
requestAnimationFrame(() => {
|
|
245
|
-
setHoverDate(
|
|
228
|
+
setHoverDate(date_0);
|
|
246
229
|
});
|
|
247
230
|
}, []);
|
|
248
|
-
const handleDateHover = useCallback((
|
|
249
|
-
if (rangeSelection.isSelecting && rangeSelection.start) throttledSetHoverDate(
|
|
231
|
+
const handleDateHover = useCallback((date_1) => {
|
|
232
|
+
if (rangeSelection.isSelecting && rangeSelection.start) throttledSetHoverDate(date_1);
|
|
250
233
|
}, [
|
|
251
234
|
rangeSelection.isSelecting,
|
|
252
235
|
rangeSelection.start,
|
|
253
236
|
throttledSetHoverDate
|
|
254
237
|
]);
|
|
255
|
-
const handleDateSelection = useCallback((
|
|
238
|
+
const handleDateSelection = useCallback((date_2, calendarSide) => {
|
|
256
239
|
if (calendarSide) {
|
|
257
240
|
const currentVisibleMonth = (calendarSide === "left" ? leftCalendarState : rightCalendarState).visibleRange.start;
|
|
258
|
-
if (
|
|
259
|
-
leftCalendarState.setFocusedDate(
|
|
260
|
-
rightCalendarState.setFocusedDate(
|
|
241
|
+
if (date_2.month !== currentVisibleMonth.month || date_2.year !== currentVisibleMonth.year) if (calendarSide === "left") {
|
|
242
|
+
leftCalendarState.setFocusedDate(date_2);
|
|
243
|
+
rightCalendarState.setFocusedDate(date_2.add({ months: 1 }));
|
|
261
244
|
} else {
|
|
262
|
-
rightCalendarState.setFocusedDate(
|
|
263
|
-
leftCalendarState.setFocusedDate(
|
|
245
|
+
rightCalendarState.setFocusedDate(date_2);
|
|
246
|
+
leftCalendarState.setFocusedDate(date_2.subtract({ months: 1 }));
|
|
264
247
|
}
|
|
265
248
|
}
|
|
266
|
-
if (isDateOutsideBounds(
|
|
249
|
+
if (isDateOutsideBounds(date_2)) return;
|
|
267
250
|
if (!rangeSelection.isSelecting || !rangeSelection.start) {
|
|
268
251
|
setRangeSelection({
|
|
269
|
-
start:
|
|
252
|
+
start: date_2,
|
|
270
253
|
end: null,
|
|
271
254
|
isSelecting: true
|
|
272
255
|
});
|
|
@@ -275,7 +258,7 @@ var DateRangePickerBase = (props) => {
|
|
|
275
258
|
rightCalendarState.setValue(null);
|
|
276
259
|
} else {
|
|
277
260
|
const { start } = rangeSelection;
|
|
278
|
-
const end =
|
|
261
|
+
const end = date_2;
|
|
279
262
|
const clampedRange = clampRangeToBounds({
|
|
280
263
|
start: start.compare(end) <= 0 ? start : end,
|
|
281
264
|
end: start.compare(end) <= 0 ? end : start
|
|
@@ -300,13 +283,13 @@ var DateRangePickerBase = (props) => {
|
|
|
300
283
|
isDateOutsideBounds,
|
|
301
284
|
clampRangeToBounds
|
|
302
285
|
]);
|
|
303
|
-
const handleKeyboardNavigation = useCallback((event,
|
|
286
|
+
const handleKeyboardNavigation = useCallback((event, date_3, calendarSide_0) => {
|
|
304
287
|
const currentState_0 = calendarSide_0 === "left" ? leftCalendarState : rightCalendarState;
|
|
305
288
|
const otherState = calendarSide_0 === "left" ? rightCalendarState : leftCalendarState;
|
|
306
289
|
let shouldPreventDefault = false;
|
|
307
290
|
switch (event.key) {
|
|
308
291
|
case "ArrowRight": {
|
|
309
|
-
const nextDate =
|
|
292
|
+
const nextDate = date_3.add({ days: 1 });
|
|
310
293
|
const currentMonth_2 = currentState_0.visibleRange.start;
|
|
311
294
|
const otherMonth_2 = otherState.visibleRange.start;
|
|
312
295
|
if (calendarSide_0 === "left" && nextDate.month !== currentMonth_2.month) if (nextDate.year === otherMonth_2.year && nextDate.month === otherMonth_2.month) {
|
|
@@ -319,7 +302,7 @@ var DateRangePickerBase = (props) => {
|
|
|
319
302
|
break;
|
|
320
303
|
}
|
|
321
304
|
case "ArrowLeft": {
|
|
322
|
-
const prevDate =
|
|
305
|
+
const prevDate = date_3.subtract({ days: 1 });
|
|
323
306
|
const currentMonth_1 = currentState_0.visibleRange.start;
|
|
324
307
|
const otherMonth_1 = otherState.visibleRange.start;
|
|
325
308
|
if (calendarSide_0 === "right" && prevDate.month !== currentMonth_1.month) if (prevDate.year === otherMonth_1.year && prevDate.month === otherMonth_1.month) {
|
|
@@ -332,7 +315,7 @@ var DateRangePickerBase = (props) => {
|
|
|
332
315
|
break;
|
|
333
316
|
}
|
|
334
317
|
case "ArrowDown": {
|
|
335
|
-
const nextWeekDate =
|
|
318
|
+
const nextWeekDate = date_3.add({ weeks: 1 });
|
|
336
319
|
const currentMonth_0 = currentState_0.visibleRange.start;
|
|
337
320
|
const otherMonth_0 = otherState.visibleRange.start;
|
|
338
321
|
if (calendarSide_0 === "left" && nextWeekDate.month !== currentMonth_0.month) if (nextWeekDate.year === otherMonth_0.year && nextWeekDate.month === otherMonth_0.month) {
|
|
@@ -345,7 +328,7 @@ var DateRangePickerBase = (props) => {
|
|
|
345
328
|
break;
|
|
346
329
|
}
|
|
347
330
|
case "ArrowUp": {
|
|
348
|
-
const prevWeekDate =
|
|
331
|
+
const prevWeekDate = date_3.subtract({ weeks: 1 });
|
|
349
332
|
const currentMonth = currentState_0.visibleRange.start;
|
|
350
333
|
const otherMonth = otherState.visibleRange.start;
|
|
351
334
|
if (calendarSide_0 === "right" && prevWeekDate.month !== currentMonth.month) if (prevWeekDate.year === otherMonth.year && prevWeekDate.month === otherMonth.month) {
|
|
@@ -359,7 +342,7 @@ var DateRangePickerBase = (props) => {
|
|
|
359
342
|
}
|
|
360
343
|
case "Enter":
|
|
361
344
|
case " ":
|
|
362
|
-
handleDateSelection(
|
|
345
|
+
handleDateSelection(date_3);
|
|
363
346
|
shouldPreventDefault = true;
|
|
364
347
|
break;
|
|
365
348
|
case "Escape":
|
|
@@ -383,8 +366,8 @@ var DateRangePickerBase = (props) => {
|
|
|
383
366
|
rightCalendarState,
|
|
384
367
|
handleDateSelection
|
|
385
368
|
]);
|
|
386
|
-
const syncCalendarStates = useCallback((
|
|
387
|
-
if (
|
|
369
|
+
const syncCalendarStates = useCallback((newValue_3) => {
|
|
370
|
+
if (newValue_3 === null) {
|
|
388
371
|
setValidationRangeError(void 0);
|
|
389
372
|
leftCalendarState.setValue(null);
|
|
390
373
|
rightCalendarState.setValue(null);
|
|
@@ -397,7 +380,7 @@ var DateRangePickerBase = (props) => {
|
|
|
397
380
|
setHoverDate(null);
|
|
398
381
|
return;
|
|
399
382
|
}
|
|
400
|
-
const clampedValue_0 = clampRangeToBounds(
|
|
383
|
+
const clampedValue_0 = clampRangeToBounds(newValue_3);
|
|
401
384
|
if (!clampedValue_0) return;
|
|
402
385
|
if (isValidRange(clampedValue_0)) return;
|
|
403
386
|
leftCalendarState.setValue(clampedValue_0);
|
|
@@ -447,7 +430,6 @@ var DateRangePickerBase = (props) => {
|
|
|
447
430
|
syncCalendarStates(clampedTodayRange);
|
|
448
431
|
};
|
|
449
432
|
const onInputClear = () => {
|
|
450
|
-
fieldRangeRef.current = null;
|
|
451
433
|
onChange?.(null);
|
|
452
434
|
dialogState.setValue(null);
|
|
453
435
|
leftCalendarState.setValue(null);
|
|
@@ -618,10 +600,6 @@ var DateRangePickerBase = (props) => {
|
|
|
618
600
|
groupProps,
|
|
619
601
|
fieldProps: {
|
|
620
602
|
...startFieldProps,
|
|
621
|
-
onChange: (date_5) => {
|
|
622
|
-
startFieldProps.onChange?.(date_5);
|
|
623
|
-
emitPartialRangeChange("start", date_5);
|
|
624
|
-
},
|
|
625
603
|
onBlur: (event_0) => {
|
|
626
604
|
startFieldProps.onBlur?.(event_0);
|
|
627
605
|
handleBlur(state.value);
|
|
@@ -629,10 +607,6 @@ var DateRangePickerBase = (props) => {
|
|
|
629
607
|
},
|
|
630
608
|
endFieldProps: {
|
|
631
609
|
...endFieldProps,
|
|
632
|
-
onChange: (date_6) => {
|
|
633
|
-
endFieldProps.onChange?.(date_6);
|
|
634
|
-
emitPartialRangeChange("end", date_6);
|
|
635
|
-
},
|
|
636
610
|
onBlur: (event_1) => {
|
|
637
611
|
endFieldProps.onBlur?.(event_1);
|
|
638
612
|
handleBlur(state.value);
|
|
@@ -714,14 +688,13 @@ var DateRangePickerBase = (props) => {
|
|
|
714
688
|
});
|
|
715
689
|
};
|
|
716
690
|
var DateRangePickerInner = (t0) => {
|
|
717
|
-
const $ = c(
|
|
691
|
+
const $ = c(25);
|
|
718
692
|
const { fullIso: t1, minValue, maxValue, renderStaticInput, isFormControlDisabled, ...props } = t0;
|
|
719
693
|
const fullIso = t1 === void 0 ? true : t1;
|
|
720
694
|
const ui = UIConfig.useConfig();
|
|
721
695
|
const datePickerInputContentRowCva = UIOverrides.useCva("datePickerInput.contentRowCva", datePickerInputContentRowDefinition);
|
|
722
696
|
const { locale } = useLocale$1();
|
|
723
697
|
const shouldForceLeadingZeros = props.shouldForceLeadingZeros ?? ui.dateInput.shouldForceLeadingZeros;
|
|
724
|
-
const allowPartialRange = props.allowPartialRange ?? ui.dateInput.allowPartialRange;
|
|
725
698
|
const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
|
|
726
699
|
const inputRef = useRef(null);
|
|
727
700
|
const { renderRealInput, replayStaticInputPress } = useStaticInputHandoff({
|
|
@@ -732,71 +705,83 @@ var DateRangePickerInner = (t0) => {
|
|
|
732
705
|
getPressTarget: _temp2
|
|
733
706
|
});
|
|
734
707
|
const normalizedValue = props.value ?? null;
|
|
735
|
-
const formatDateRange = (range) => {
|
|
736
|
-
if (!range || !range.start && !range.end || !allowPartialRange && (!range.start || !range.end)) return null;
|
|
737
|
-
if (fullIso) return {
|
|
738
|
-
start: range.start ? DateTimeUtils.fromCalendarDateToUTCISO(range.start) : null,
|
|
739
|
-
end: range.end ? DateTimeUtils.fromCalendarDateToUTCISO(range.end, { endOfDay: true }) : null
|
|
740
|
-
};
|
|
741
|
-
const startDate = range.start ? DateTimeUtils.fromDateValueToLocal(range.start, "UTC") : null;
|
|
742
|
-
const endDate = range.end ? DateTimeUtils.fromDateValueToLocal(range.end, "UTC") : null;
|
|
743
|
-
return {
|
|
744
|
-
start: startDate ? DateTime.fromJSDate(startDate, { zone: "UTC" }).toISODate() : null,
|
|
745
|
-
end: endDate ? DateTime.fromJSDate(endDate, { zone: "UTC" }).toISODate() : null
|
|
746
|
-
};
|
|
747
|
-
};
|
|
748
|
-
const parseDateRange = (formattedRange) => {
|
|
749
|
-
if (!formattedRange || !formattedRange.start && !formattedRange.end || !allowPartialRange && (!formattedRange.start || !formattedRange.end)) return null;
|
|
750
|
-
if (fullIso) return {
|
|
751
|
-
start: formattedRange.start ? DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.start) : null,
|
|
752
|
-
end: formattedRange.end ? DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.end) : null
|
|
753
|
-
};
|
|
754
|
-
const startDate_0 = formattedRange.start ? DateTime.fromISO(formattedRange.start, { zone: "UTC" }).toJSDate() : null;
|
|
755
|
-
const endDate_0 = formattedRange.end ? DateTime.fromISO(formattedRange.end, { zone: "UTC" }).toJSDate() : null;
|
|
756
|
-
const startZonedDateTime = startDate_0 ? DateTimeUtils.fromLocalToZonedDateTime(startDate_0, "UTC") : null;
|
|
757
|
-
const endZonedDateTime = endDate_0 ? DateTimeUtils.fromLocalToZonedDateTime(endDate_0, "UTC") : null;
|
|
758
|
-
return {
|
|
759
|
-
start: startZonedDateTime ? toCalendarDate(startZonedDateTime) : null,
|
|
760
|
-
end: endZonedDateTime ? toCalendarDate(endZonedDateTime) : null
|
|
761
|
-
};
|
|
762
|
-
};
|
|
763
708
|
let t2;
|
|
764
709
|
if ($[0] !== fullIso) {
|
|
765
|
-
t2 = (
|
|
766
|
-
if (
|
|
767
|
-
if (fullIso) return
|
|
768
|
-
|
|
769
|
-
|
|
710
|
+
t2 = (range) => {
|
|
711
|
+
if (!range?.start || !range?.end) return null;
|
|
712
|
+
if (fullIso) return {
|
|
713
|
+
start: DateTimeUtils.fromCalendarDateToUTCISO(range.start),
|
|
714
|
+
end: DateTimeUtils.fromCalendarDateToUTCISO(range.end, { endOfDay: true })
|
|
715
|
+
};
|
|
716
|
+
const startDate = DateTimeUtils.fromDateValueToLocal(range.start, "UTC");
|
|
717
|
+
const endDate = DateTimeUtils.fromDateValueToLocal(range.end, "UTC");
|
|
718
|
+
return {
|
|
719
|
+
start: DateTime.fromJSDate(startDate, { zone: "UTC" }).toISODate(),
|
|
720
|
+
end: DateTime.fromJSDate(endDate, { zone: "UTC" }).toISODate()
|
|
721
|
+
};
|
|
770
722
|
};
|
|
771
723
|
$[0] = fullIso;
|
|
772
724
|
$[1] = t2;
|
|
773
725
|
} else t2 = $[1];
|
|
774
|
-
const
|
|
726
|
+
const formatDateRange = t2;
|
|
775
727
|
let t3;
|
|
776
|
-
if ($[2] !==
|
|
777
|
-
t3 =
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
728
|
+
if ($[2] !== fullIso) {
|
|
729
|
+
t3 = (formattedRange) => {
|
|
730
|
+
if (!formattedRange?.start || !formattedRange?.end) return null;
|
|
731
|
+
if (fullIso) return {
|
|
732
|
+
start: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.start),
|
|
733
|
+
end: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.end)
|
|
734
|
+
};
|
|
735
|
+
const startDate_0 = DateTime.fromISO(formattedRange.start, { zone: "UTC" }).toJSDate();
|
|
736
|
+
const endDate_0 = DateTime.fromISO(formattedRange.end, { zone: "UTC" }).toJSDate();
|
|
737
|
+
const startZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(startDate_0, "UTC");
|
|
738
|
+
const endZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(endDate_0, "UTC");
|
|
739
|
+
return {
|
|
740
|
+
start: toCalendarDate(startZonedDateTime),
|
|
741
|
+
end: toCalendarDate(endZonedDateTime)
|
|
742
|
+
};
|
|
743
|
+
};
|
|
744
|
+
$[2] = fullIso;
|
|
745
|
+
$[3] = t3;
|
|
746
|
+
} else t3 = $[3];
|
|
747
|
+
const parseDateRange = t3;
|
|
782
748
|
let t4;
|
|
783
|
-
if ($[
|
|
784
|
-
t4 =
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
749
|
+
if ($[4] !== fullIso) {
|
|
750
|
+
t4 = (formattedDate) => {
|
|
751
|
+
if (formattedDate == null) return null;
|
|
752
|
+
if (fullIso) return DateTimeUtils.fromUTCISOToCalendarDate(formattedDate);
|
|
753
|
+
const date = DateTime.fromISO(formattedDate, { zone: "UTC" }).toJSDate();
|
|
754
|
+
return toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date, "UTC"));
|
|
755
|
+
};
|
|
756
|
+
$[4] = fullIso;
|
|
757
|
+
$[5] = t4;
|
|
758
|
+
} else t4 = $[5];
|
|
759
|
+
const parseCalendarDate = t4;
|
|
789
760
|
let t5;
|
|
790
|
-
if ($[
|
|
791
|
-
t5 =
|
|
792
|
-
|
|
793
|
-
|
|
761
|
+
if ($[6] !== minValue || $[7] !== parseCalendarDate) {
|
|
762
|
+
t5 = typeof minValue === "string" ? parseCalendarDate(minValue) : minValue;
|
|
763
|
+
$[6] = minValue;
|
|
764
|
+
$[7] = parseCalendarDate;
|
|
765
|
+
$[8] = t5;
|
|
766
|
+
} else t5 = $[8];
|
|
767
|
+
let t6;
|
|
768
|
+
if ($[9] !== maxValue || $[10] !== parseCalendarDate) {
|
|
769
|
+
t6 = typeof maxValue === "string" ? parseCalendarDate(maxValue) : maxValue;
|
|
770
|
+
$[9] = maxValue;
|
|
771
|
+
$[10] = parseCalendarDate;
|
|
772
|
+
$[11] = t6;
|
|
773
|
+
} else t6 = $[11];
|
|
774
|
+
let t7;
|
|
775
|
+
if ($[12] !== t5 || $[13] !== t6) {
|
|
776
|
+
t7 = {
|
|
777
|
+
minValue: t5,
|
|
778
|
+
maxValue: t6
|
|
794
779
|
};
|
|
795
|
-
$[
|
|
796
|
-
$[
|
|
797
|
-
$[
|
|
798
|
-
} else
|
|
799
|
-
const dateLimits =
|
|
780
|
+
$[12] = t5;
|
|
781
|
+
$[13] = t6;
|
|
782
|
+
$[14] = t7;
|
|
783
|
+
} else t7 = $[14];
|
|
784
|
+
const dateLimits = t7;
|
|
800
785
|
if (!renderInput) {
|
|
801
786
|
const startDateValue = parseCalendarDate(normalizedValue?.start ?? null);
|
|
802
787
|
const endDateValue = parseCalendarDate(normalizedValue?.end ?? null);
|
|
@@ -863,33 +848,33 @@ var DateRangePickerInner = (t0) => {
|
|
|
863
848
|
});
|
|
864
849
|
}
|
|
865
850
|
const T0 = DateRangePickerBase;
|
|
866
|
-
const
|
|
867
|
-
const
|
|
868
|
-
let
|
|
869
|
-
if ($[
|
|
870
|
-
|
|
871
|
-
$[
|
|
872
|
-
$[
|
|
873
|
-
$[
|
|
874
|
-
} else
|
|
875
|
-
let
|
|
876
|
-
if ($[
|
|
877
|
-
|
|
851
|
+
const t8 = mergeRefs(props.ref, inputRef);
|
|
852
|
+
const t9 = parseDateRange(normalizedValue);
|
|
853
|
+
let t10;
|
|
854
|
+
if ($[15] !== formatDateRange || $[16] !== props) {
|
|
855
|
+
t10 = (value) => props.onChange?.(formatDateRange(value));
|
|
856
|
+
$[15] = formatDateRange;
|
|
857
|
+
$[16] = props;
|
|
858
|
+
$[17] = t10;
|
|
859
|
+
} else t10 = $[17];
|
|
860
|
+
let t11;
|
|
861
|
+
if ($[18] !== T0 || $[19] !== dateLimits || $[20] !== props || $[21] !== t10 || $[22] !== t8 || $[23] !== t9) {
|
|
862
|
+
t11 = /* @__PURE__ */ jsx(T0, {
|
|
878
863
|
...props,
|
|
879
864
|
...dateLimits,
|
|
880
|
-
ref:
|
|
881
|
-
value:
|
|
882
|
-
onChange:
|
|
865
|
+
ref: t8,
|
|
866
|
+
value: t9,
|
|
867
|
+
onChange: t10
|
|
883
868
|
});
|
|
884
|
-
$[
|
|
885
|
-
$[
|
|
886
|
-
$[
|
|
887
|
-
$[
|
|
888
|
-
$[
|
|
889
|
-
$[
|
|
890
|
-
$[
|
|
891
|
-
} else
|
|
892
|
-
return
|
|
869
|
+
$[18] = T0;
|
|
870
|
+
$[19] = dateLimits;
|
|
871
|
+
$[20] = props;
|
|
872
|
+
$[21] = t10;
|
|
873
|
+
$[22] = t8;
|
|
874
|
+
$[23] = t9;
|
|
875
|
+
$[24] = t11;
|
|
876
|
+
} else t11 = $[24];
|
|
877
|
+
return t11;
|
|
893
878
|
};
|
|
894
879
|
var DateRangePicker = (t0) => {
|
|
895
880
|
const $ = c(30);
|
|
@@ -162,6 +162,20 @@ var DateTimePickerBase = (props) => {
|
|
|
162
162
|
calendarState.setFocusedDate(state.value || today(effectiveTimeZone));
|
|
163
163
|
if (!isOpen) dialogState.setValue(state.value);
|
|
164
164
|
};
|
|
165
|
+
const onInputBlur = (e) => {
|
|
166
|
+
if (!isTimeOptional) return;
|
|
167
|
+
if (state.value) {
|
|
168
|
+
dialogState.setValue(state.value);
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
const textValue = e?.currentTarget?.textContent ?? null;
|
|
172
|
+
const dateTimeValue = DateTimeUtils.formatTextDateToCalendarDateTime(textValue, effectiveTimeZone, locale);
|
|
173
|
+
if (dateTimeValue) {
|
|
174
|
+
state.setValue(dateTimeValue);
|
|
175
|
+
dialogState.setValue(dateTimeValue);
|
|
176
|
+
dialogState.setTimeValue(new Time(0, 0));
|
|
177
|
+
}
|
|
178
|
+
};
|
|
165
179
|
return /* @__PURE__ */ jsx(TooltipWrapper, {
|
|
166
180
|
as,
|
|
167
181
|
error,
|
|
@@ -178,9 +192,10 @@ var DateTimePickerBase = (props) => {
|
|
|
178
192
|
groupProps,
|
|
179
193
|
fieldProps: {
|
|
180
194
|
...fieldProps,
|
|
181
|
-
onBlur: (
|
|
182
|
-
fieldProps.onBlur?.(
|
|
195
|
+
onBlur: (e_0) => {
|
|
196
|
+
fieldProps.onBlur?.(e_0);
|
|
183
197
|
handleBlur(state.value);
|
|
198
|
+
onInputBlur(e_0);
|
|
184
199
|
}
|
|
185
200
|
},
|
|
186
201
|
fieldValue: normalizedValue,
|