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