@mtes-mct/monitor-ui 2.8.0 → 2.8.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/CHANGELOG.md +7 -0
- package/README.md +2 -1
- package/index.js +66 -70
- package/index.js.map +1 -1
- package/package.json +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [2.8.0](https://github.com/MTES-MCT/monitor-ui/compare/v2.7.2...v2.8.0) (2023-01-17)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **fields:** handle both Date & string dates in DatePicker & DateRangePicker ([6aacf70](https://github.com/MTES-MCT/monitor-ui/commit/6aacf7007bcbc789b9de643be2d192a1808b0afc))
|
|
7
|
+
|
|
1
8
|
## [2.7.2](https://github.com/MTES-MCT/monitor-ui/compare/v2.7.1...v2.7.2) (2023-01-13)
|
|
2
9
|
|
|
3
10
|
|
package/README.md
CHANGED
|
@@ -55,7 +55,8 @@ Please read the [contributing document](CONTRIBUTING.md) for setup and contribut
|
|
|
55
55
|
|
|
56
56
|
---
|
|
57
57
|
|
|
58
|
-
[img-github]:
|
|
58
|
+
[img-github]:
|
|
59
|
+
https://img.shields.io/github/actions/workflow/status/MTES-MCT/monitor-ui/check.yml?branch=main&style=flat-square
|
|
59
60
|
[img-license]: https://img.shields.io/github/license/MTES-MCT/monitor-ui?style=flat-square
|
|
60
61
|
[img-npm]: https://img.shields.io/npm/v/@mtes-mct/monitor-ui?style=flat-square
|
|
61
62
|
[lnk-github]: https://github.com/MTES-MCT/monitor-ui/actions?query=branch%3Amain++
|
package/index.js
CHANGED
|
@@ -3440,13 +3440,9 @@ dayjs_minExports.tz.setDefault('UTC');
|
|
|
3440
3440
|
* `2022-01-02T03:04:05.006Z` => `2022-01-02T03:04:05.006+01:00` (or `+02:00` during DST) in Europe/Paris timezone.
|
|
3441
3441
|
*/
|
|
3442
3442
|
function getLocalizedDayjs(utcDate) {
|
|
3443
|
-
if (typeof utcDate === 'string') {
|
|
3444
|
-
return dayjs_minExports(utcDate);
|
|
3445
|
-
}
|
|
3446
|
-
const utcDateAsDate = dayjs_minExports(utcDate).toDate();
|
|
3447
3443
|
// The number of minutes returned by getTimezoneOffset() is positive if the local time zone is behind UTC,
|
|
3448
3444
|
// and negative if the local time zone is ahead of UTC. For example, for UTC+10, -600 will be returned.
|
|
3449
|
-
const timezoneOffsetInMinutes =
|
|
3445
|
+
const timezoneOffsetInMinutes = new Date().getTimezoneOffset();
|
|
3450
3446
|
return dayjs_minExports(utcDate).add(timezoneOffsetInMinutes, 'minutes');
|
|
3451
3447
|
}
|
|
3452
3448
|
|
|
@@ -4472,20 +4468,20 @@ disabled = false, isCompact = false, isHistorical = false, isLabelHidden = false
|
|
|
4472
4468
|
const dateInputRef = useRef();
|
|
4473
4469
|
const timeInputRef = useRef();
|
|
4474
4470
|
const isCalendarPickerOpenRef = useRef(false);
|
|
4475
|
-
const
|
|
4476
|
-
const
|
|
4477
|
-
const
|
|
4471
|
+
const selectedLocalizedDateRef = useRef(defaultValue ? getLocalizedDayjs(defaultValue).toDate() : undefined);
|
|
4472
|
+
const selectedLocalizedDateTupleRef = useRef(getDateTupleFromDate(selectedLocalizedDateRef.current));
|
|
4473
|
+
const selectedLocalizedTimeTupleRef = useRef(getTimeTupleFromDate(selectedLocalizedDateRef.current));
|
|
4478
4474
|
const { forceUpdate } = useForceUpdate();
|
|
4479
|
-
const rangeCalendarPickerDefaultValue = useMemo(() =>
|
|
4480
|
-
? getDateFromDateAndTimeTuple(
|
|
4475
|
+
const rangeCalendarPickerDefaultValue = useMemo(() => selectedLocalizedDateTupleRef.current
|
|
4476
|
+
? getDateFromDateAndTimeTuple(selectedLocalizedDateTupleRef.current, ['00', '00'])
|
|
4481
4477
|
: undefined,
|
|
4482
4478
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4483
|
-
[
|
|
4479
|
+
[selectedLocalizedDateTupleRef.current]);
|
|
4484
4480
|
const submit = useCallback(() => {
|
|
4485
|
-
if (!onChange || !
|
|
4481
|
+
if (!onChange || !selectedLocalizedDateRef.current) {
|
|
4486
4482
|
return;
|
|
4487
4483
|
}
|
|
4488
|
-
const nextDateAsDayjs = getUtcizedDayjs(
|
|
4484
|
+
const nextDateAsDayjs = getUtcizedDayjs(selectedLocalizedDateRef.current);
|
|
4489
4485
|
if (isStringDate) {
|
|
4490
4486
|
onChange(nextDateAsDayjs.toISOString());
|
|
4491
4487
|
}
|
|
@@ -4504,13 +4500,13 @@ disabled = false, isCompact = false, isHistorical = false, isLabelHidden = false
|
|
|
4504
4500
|
timeInputRef.current.focus();
|
|
4505
4501
|
}, [withTime]);
|
|
4506
4502
|
const handleDateInputChange = useCallback((nextDateTuple, isFilled) => {
|
|
4507
|
-
|
|
4503
|
+
selectedLocalizedDateTupleRef.current = nextDateTuple;
|
|
4508
4504
|
// If there is no time input or a time has already been selected,
|
|
4509
|
-
if (!withTime ||
|
|
4505
|
+
if (!withTime || selectedLocalizedTimeTupleRef.current) {
|
|
4510
4506
|
// we must update the selected date and call onChange()
|
|
4511
|
-
const timeTuple = (withTime ?
|
|
4507
|
+
const timeTuple = (withTime ? selectedLocalizedTimeTupleRef.current : ['00', '00']);
|
|
4512
4508
|
const nextDate = getDateFromDateAndTimeTuple(nextDateTuple, timeTuple);
|
|
4513
|
-
|
|
4509
|
+
selectedLocalizedDateRef.current = getLocalizedDayjs(nextDate).toDate();
|
|
4514
4510
|
submit();
|
|
4515
4511
|
}
|
|
4516
4512
|
if (isFilled) {
|
|
@@ -4522,32 +4518,32 @@ disabled = false, isCompact = false, isHistorical = false, isLabelHidden = false
|
|
|
4522
4518
|
if (!withTime) {
|
|
4523
4519
|
// we have to fix the date at the beginning of the day
|
|
4524
4520
|
const nextDate = getDateFromDateAndTimeTuple(nextDateTuple, ['00', '00']);
|
|
4525
|
-
|
|
4521
|
+
selectedLocalizedDateRef.current = nextDate;
|
|
4526
4522
|
}
|
|
4527
4523
|
// If this is a date picker with a time input,
|
|
4528
4524
|
else {
|
|
4529
4525
|
// we include the selected time if it exists, set it at the beginning of the day if not
|
|
4530
|
-
const nextDate = getDateFromDateAndTimeTuple(nextDateTuple,
|
|
4531
|
-
|
|
4526
|
+
const nextDate = getDateFromDateAndTimeTuple(nextDateTuple, selectedLocalizedTimeTupleRef.current || ['00', '00']);
|
|
4527
|
+
selectedLocalizedDateRef.current = nextDate;
|
|
4532
4528
|
}
|
|
4533
|
-
|
|
4534
|
-
|
|
4529
|
+
selectedLocalizedDateTupleRef.current = nextDateTuple;
|
|
4530
|
+
selectedLocalizedTimeTupleRef.current = getTimeTupleFromDate(selectedLocalizedDateRef.current);
|
|
4535
4531
|
closeCalendarPicker();
|
|
4536
4532
|
forceUpdate();
|
|
4537
4533
|
submit();
|
|
4538
|
-
if (withTime && !
|
|
4534
|
+
if (withTime && !selectedLocalizedTimeTupleRef.current) {
|
|
4539
4535
|
timeInputRef.current.focus();
|
|
4540
4536
|
}
|
|
4541
4537
|
}, [closeCalendarPicker, forceUpdate, submit, withTime]);
|
|
4542
4538
|
const handleTimeInputFilled = useCallback((nextTimeTuple) => {
|
|
4543
4539
|
// If a date has already been selected
|
|
4544
|
-
if (
|
|
4540
|
+
if (selectedLocalizedDateTupleRef.current) {
|
|
4545
4541
|
// we must update the selected date accordingly and submit it
|
|
4546
|
-
const nextDate = getDateFromDateAndTimeTuple(
|
|
4547
|
-
|
|
4542
|
+
const nextDate = getDateFromDateAndTimeTuple(selectedLocalizedDateTupleRef.current, nextTimeTuple);
|
|
4543
|
+
selectedLocalizedDateRef.current = nextDate;
|
|
4548
4544
|
submit();
|
|
4549
4545
|
}
|
|
4550
|
-
|
|
4546
|
+
selectedLocalizedTimeTupleRef.current = nextTimeTuple;
|
|
4551
4547
|
submit();
|
|
4552
4548
|
}, [submit]);
|
|
4553
4549
|
const openCalendarPicker = useCallback(() => {
|
|
@@ -4555,7 +4551,7 @@ disabled = false, isCompact = false, isHistorical = false, isLabelHidden = false
|
|
|
4555
4551
|
forceUpdate();
|
|
4556
4552
|
}, [forceUpdate]);
|
|
4557
4553
|
useClickOutside(boxRef, closeCalendarPicker, baseContainer);
|
|
4558
|
-
return (jsxs(Fieldset, { disabled: disabled, ...nativeProps, children: [jsx(Legend, { isDisabled: disabled, isHidden: isLabelHidden, children: label }), jsxs(Box$4, { ref: boxRef, children: [jsx(Field$1, { children: jsx(DateInput, { ref: dateInputRef, defaultValue:
|
|
4554
|
+
return (jsxs(Fieldset, { disabled: disabled, ...nativeProps, children: [jsx(Legend, { isDisabled: disabled, isHidden: isLabelHidden, children: label }), jsxs(Box$4, { ref: boxRef, children: [jsx(Field$1, { children: jsx(DateInput, { ref: dateInputRef, defaultValue: selectedLocalizedDateTupleRef.current, disabled: disabled, isCompact: isCompact, isForcedFocused: isCalendarPickerOpenRef.current, isLight: isLight, onChange: handleDateInputChange, onClick: openCalendarPicker, onNext: handleDateInputNext }) }), withTime && (jsx(Field$1, { "$isTimeField": true, children: jsx(TimeInput, { ref: timeInputRef, baseContainer: baseContainer, defaultValue: selectedLocalizedTimeTupleRef.current, disabled: disabled, isCompact: isCompact, isLight: isLight, minutesRange: minutesRange, onBack: () => dateInputRef.current.focus(true), onChange: handleTimeInputFilled, onFocus: closeCalendarPicker, onPrevious: () => dateInputRef.current.focus(true) }) }))] }), jsx(CalendarPicker, { defaultValue: rangeCalendarPickerDefaultValue, isHistorical: isHistorical, isOpen: isCalendarPickerOpenRef.current, onChange: handleCalendarPickerChange })] }));
|
|
4559
4555
|
}
|
|
4560
4556
|
const Box$4 = styled.div `
|
|
4561
4557
|
* {
|
|
@@ -4784,34 +4780,34 @@ disabled = false, isCompact = false, isHistorical = false, isLabelHidden = false
|
|
|
4784
4780
|
const endDateInputRef = useRef();
|
|
4785
4781
|
const endTimeInputRef = useRef();
|
|
4786
4782
|
const isRangeCalendarPickerOpenRef = useRef(false);
|
|
4787
|
-
const
|
|
4788
|
-
const
|
|
4789
|
-
const
|
|
4790
|
-
const
|
|
4791
|
-
const
|
|
4792
|
-
const
|
|
4783
|
+
const selectedLocalizedStartDateRef = useRef(defaultValue ? getLocalizedDayjs(defaultValue[0]).toDate() : undefined);
|
|
4784
|
+
const selectedLocalizedEndDateRef = useRef(defaultValue ? getLocalizedDayjs(defaultValue[1]).toDate() : undefined);
|
|
4785
|
+
const selectedLocalizedStartDateTupleRef = useRef(getDateTupleFromDate(selectedLocalizedStartDateRef.current));
|
|
4786
|
+
const selectedLocalizedEndDateTupleRef = useRef(getDateTupleFromDate(selectedLocalizedEndDateRef.current));
|
|
4787
|
+
const selectedLocalizedStartTimeTupleRef = useRef(getTimeTupleFromDate(selectedLocalizedStartDateRef.current));
|
|
4788
|
+
const selectedLocalizedEndTimeTupleRef = useRef(getTimeTupleFromDate(selectedLocalizedEndDateRef.current));
|
|
4793
4789
|
const { forceUpdate } = useForceUpdate();
|
|
4794
|
-
const rangeCalendarPickerDefaultValue = useMemo(() =>
|
|
4790
|
+
const rangeCalendarPickerDefaultValue = useMemo(() => selectedLocalizedStartDateTupleRef.current && selectedLocalizedEndDateTupleRef.current
|
|
4795
4791
|
? [
|
|
4796
|
-
getDateFromDateAndTimeTuple(
|
|
4797
|
-
getDateFromDateAndTimeTuple(
|
|
4792
|
+
getDateFromDateAndTimeTuple(selectedLocalizedStartDateTupleRef.current, ['00', '00']),
|
|
4793
|
+
getDateFromDateAndTimeTuple(selectedLocalizedEndDateTupleRef.current, ['00', '00'], true)
|
|
4798
4794
|
]
|
|
4799
4795
|
: undefined,
|
|
4800
4796
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4801
|
-
[
|
|
4797
|
+
[selectedLocalizedEndDateTupleRef.current, selectedLocalizedStartDateTupleRef.current]);
|
|
4802
4798
|
const submit = useCallback(() => {
|
|
4803
|
-
if (!onChange || !
|
|
4799
|
+
if (!onChange || !selectedLocalizedStartDateRef.current || !selectedLocalizedEndDateRef.current) {
|
|
4804
4800
|
return;
|
|
4805
4801
|
}
|
|
4806
4802
|
if (isStringDate) {
|
|
4807
|
-
const utcizedStartDateAsString = getUtcizedDayjs(
|
|
4808
|
-
const utcizedEndDateAsString = getUtcizedDayjs(
|
|
4803
|
+
const utcizedStartDateAsString = getUtcizedDayjs(selectedLocalizedStartDateRef.current).toISOString();
|
|
4804
|
+
const utcizedEndDateAsString = getUtcizedDayjs(selectedLocalizedEndDateRef.current).toISOString();
|
|
4809
4805
|
const nextDateAsStringRange = [utcizedStartDateAsString, utcizedEndDateAsString];
|
|
4810
4806
|
onChange(nextDateAsStringRange);
|
|
4811
4807
|
}
|
|
4812
4808
|
else {
|
|
4813
|
-
const utcizedStartDate = getUtcizedDayjs(
|
|
4814
|
-
const utcizedEndDate = getUtcizedDayjs(
|
|
4809
|
+
const utcizedStartDate = getUtcizedDayjs(selectedLocalizedStartDateRef.current).toDate();
|
|
4810
|
+
const utcizedEndDate = getUtcizedDayjs(selectedLocalizedEndDateRef.current).toDate();
|
|
4815
4811
|
const nextDateRange = [utcizedStartDate, utcizedEndDate];
|
|
4816
4812
|
onChange(nextDateRange);
|
|
4817
4813
|
}
|
|
@@ -4842,13 +4838,13 @@ disabled = false, isCompact = false, isHistorical = false, isLabelHidden = false
|
|
|
4842
4838
|
}, [withTime]);
|
|
4843
4839
|
const handleDateInputChange = useCallback((position, nextDateTuple, isFilled) => {
|
|
4844
4840
|
if (position === DateRangePosition.START) {
|
|
4845
|
-
|
|
4841
|
+
selectedLocalizedStartDateTupleRef.current = nextDateTuple;
|
|
4846
4842
|
// If there is no time input or a start time has already been selected,
|
|
4847
|
-
if (!withTime ||
|
|
4843
|
+
if (!withTime || selectedLocalizedStartTimeTupleRef.current) {
|
|
4848
4844
|
// we must update the selected start date and call onChange()
|
|
4849
|
-
const startTimeTuple = (withTime ?
|
|
4845
|
+
const startTimeTuple = (withTime ? selectedLocalizedStartTimeTupleRef.current : ['00', '00']);
|
|
4850
4846
|
const nextStartDate = getDateFromDateAndTimeTuple(nextDateTuple, startTimeTuple);
|
|
4851
|
-
|
|
4847
|
+
selectedLocalizedStartDateRef.current = nextStartDate;
|
|
4852
4848
|
submit();
|
|
4853
4849
|
}
|
|
4854
4850
|
if (isFilled) {
|
|
@@ -4856,13 +4852,13 @@ disabled = false, isCompact = false, isHistorical = false, isLabelHidden = false
|
|
|
4856
4852
|
}
|
|
4857
4853
|
}
|
|
4858
4854
|
else {
|
|
4859
|
-
|
|
4855
|
+
selectedLocalizedEndDateTupleRef.current = nextDateTuple;
|
|
4860
4856
|
// If there is no time input or an end time has already been selected,
|
|
4861
|
-
if (!withTime ||
|
|
4857
|
+
if (!withTime || selectedLocalizedEndTimeTupleRef.current) {
|
|
4862
4858
|
// we must update the selected end date and call onChange()
|
|
4863
|
-
const endTimeTuple = (withTime ?
|
|
4859
|
+
const endTimeTuple = (withTime ? selectedLocalizedEndTimeTupleRef.current : ['23', '59']);
|
|
4864
4860
|
const nextEndDate = getDateFromDateAndTimeTuple(nextDateTuple, endTimeTuple, true);
|
|
4865
|
-
|
|
4861
|
+
selectedLocalizedEndDateRef.current = nextEndDate;
|
|
4866
4862
|
submit();
|
|
4867
4863
|
}
|
|
4868
4864
|
if (isFilled) {
|
|
@@ -4878,22 +4874,22 @@ disabled = false, isCompact = false, isHistorical = false, isLabelHidden = false
|
|
|
4878
4874
|
const nextStartDate = getDateFromDateAndTimeTuple(nextStartDateTuple, ['00', '00']);
|
|
4879
4875
|
// and the end date at the end of the day
|
|
4880
4876
|
const nextEndDate = getDateFromDateAndTimeTuple(nextEndDateTuple, ['23', '59'], true);
|
|
4881
|
-
|
|
4882
|
-
|
|
4877
|
+
selectedLocalizedStartDateRef.current = nextStartDate;
|
|
4878
|
+
selectedLocalizedEndDateRef.current = nextEndDate;
|
|
4883
4879
|
}
|
|
4884
4880
|
// If this is a date picker with a time input,
|
|
4885
4881
|
else {
|
|
4886
4882
|
// we include the selected start time if it exists, set it at the beginning of the day if not
|
|
4887
|
-
const nextStartDate = getDateFromDateAndTimeTuple(nextStartDateTuple,
|
|
4888
|
-
|
|
4883
|
+
const nextStartDate = getDateFromDateAndTimeTuple(nextStartDateTuple, selectedLocalizedStartTimeTupleRef.current || ['00', '00']);
|
|
4884
|
+
selectedLocalizedStartDateRef.current = nextStartDate;
|
|
4889
4885
|
// we include the selected end time if it exists, set it at the end of the day if not
|
|
4890
|
-
const nextEndDate = getDateFromDateAndTimeTuple(nextEndDateTuple,
|
|
4891
|
-
|
|
4886
|
+
const nextEndDate = getDateFromDateAndTimeTuple(nextEndDateTuple, selectedLocalizedEndTimeTupleRef.current || ['23', '59'], true);
|
|
4887
|
+
selectedLocalizedEndDateRef.current = nextEndDate;
|
|
4892
4888
|
}
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4889
|
+
selectedLocalizedStartDateTupleRef.current = nextStartDateTuple;
|
|
4890
|
+
selectedLocalizedStartTimeTupleRef.current = getTimeTupleFromDate(selectedLocalizedStartDateRef.current);
|
|
4891
|
+
selectedLocalizedEndDateTupleRef.current = nextEndDateTuple;
|
|
4892
|
+
selectedLocalizedEndTimeTupleRef.current = getTimeTupleFromDate(selectedLocalizedEndDateRef.current);
|
|
4897
4893
|
closeRangeCalendarPicker();
|
|
4898
4894
|
forceUpdate();
|
|
4899
4895
|
submit();
|
|
@@ -4901,24 +4897,24 @@ disabled = false, isCompact = false, isHistorical = false, isLabelHidden = false
|
|
|
4901
4897
|
const handleTimeInputFilled = useCallback((position, nextTimeTuple) => {
|
|
4902
4898
|
if (position === DateRangePosition.START) {
|
|
4903
4899
|
// If a start date has already been selected
|
|
4904
|
-
if (
|
|
4900
|
+
if (selectedLocalizedStartDateTupleRef.current) {
|
|
4905
4901
|
// we must update the selected start date accordingly and submit it
|
|
4906
|
-
const nextStartDate = getDateFromDateAndTimeTuple(
|
|
4907
|
-
|
|
4902
|
+
const nextStartDate = getDateFromDateAndTimeTuple(selectedLocalizedStartDateTupleRef.current, nextTimeTuple);
|
|
4903
|
+
selectedLocalizedStartDateRef.current = nextStartDate;
|
|
4908
4904
|
submit();
|
|
4909
4905
|
}
|
|
4910
|
-
|
|
4906
|
+
selectedLocalizedStartTimeTupleRef.current = nextTimeTuple;
|
|
4911
4907
|
endDateInputRef.current.focus();
|
|
4912
4908
|
}
|
|
4913
4909
|
else {
|
|
4914
4910
|
// If an end date has already been selected
|
|
4915
|
-
if (
|
|
4911
|
+
if (selectedLocalizedEndDateTupleRef.current) {
|
|
4916
4912
|
// we must update the selected end date accordingly and submit it
|
|
4917
|
-
const nextEndDate = getDateFromDateAndTimeTuple(
|
|
4918
|
-
|
|
4913
|
+
const nextEndDate = getDateFromDateAndTimeTuple(selectedLocalizedEndDateTupleRef.current, nextTimeTuple, true);
|
|
4914
|
+
selectedLocalizedEndDateRef.current = nextEndDate;
|
|
4919
4915
|
submit();
|
|
4920
4916
|
}
|
|
4921
|
-
|
|
4917
|
+
selectedLocalizedEndTimeTupleRef.current = nextTimeTuple;
|
|
4922
4918
|
}
|
|
4923
4919
|
submit();
|
|
4924
4920
|
}, [submit]);
|
|
@@ -4927,7 +4923,7 @@ disabled = false, isCompact = false, isHistorical = false, isLabelHidden = false
|
|
|
4927
4923
|
forceUpdate();
|
|
4928
4924
|
}, [forceUpdate]);
|
|
4929
4925
|
useClickOutside([endDateInputRef, startDateInputRef], closeRangeCalendarPicker, baseContainer);
|
|
4930
|
-
return (jsxs(Fieldset, { ...nativeProps, children: [jsx(Legend, { isDisabled: disabled, isHidden: isLabelHidden, children: label }), jsxs(Box$2, { isDisabled: disabled, children: [jsx(Field, { children: jsx(DateInput, { ref: startDateInputRef, defaultValue:
|
|
4926
|
+
return (jsxs(Fieldset, { ...nativeProps, children: [jsx(Legend, { isDisabled: disabled, isHidden: isLabelHidden, children: label }), jsxs(Box$2, { isDisabled: disabled, children: [jsx(Field, { children: jsx(DateInput, { ref: startDateInputRef, defaultValue: selectedLocalizedStartDateTupleRef.current, disabled: disabled, isCompact: isCompact, isForcedFocused: isRangeCalendarPickerOpenRef.current, isLight: isLight, isStartDate: true, onChange: (nextDateTuple, isFilled) => handleDateInputChange(DateRangePosition.START, nextDateTuple, isFilled), onClick: openRangeCalendarPicker, onNext: handleStartDateInputNext }) }), withTime && (jsx(Field, { isTimeField: true, children: jsx(TimeInput, { ref: startTimeInputRef, baseContainer: baseContainer, defaultValue: selectedLocalizedStartTimeTupleRef.current, disabled: disabled, isCompact: isCompact, isLight: isLight, isStartDate: true, minutesRange: minutesRange, onBack: () => startDateInputRef.current.focus(true), onChange: nextTimeTuple => handleTimeInputFilled(DateRangePosition.START, nextTimeTuple), onFocus: closeRangeCalendarPicker, onNext: () => endDateInputRef.current.focus(), onPrevious: () => startDateInputRef.current.focus(true) }) })), jsx(Field, { isEndDateField: true, children: jsx(DateInput, { ref: endDateInputRef, defaultValue: selectedLocalizedEndDateTupleRef.current, disabled: disabled, isCompact: isCompact, isEndDate: true, isForcedFocused: isRangeCalendarPickerOpenRef.current, isLight: isLight, onBack: handleEndDateInputPrevious, onChange: (nextDateTuple, isFilled) => handleDateInputChange(DateRangePosition.END, nextDateTuple, isFilled), onClick: openRangeCalendarPicker, onNext: handleEndDateInputNext, onPrevious: handleEndDateInputPrevious }) }), withTime && (jsx(Field, { isTimeField: true, children: jsx(TimeInput, { ref: endTimeInputRef, baseContainer: baseContainer, defaultValue: selectedLocalizedEndTimeTupleRef.current, disabled: disabled, isCompact: isCompact, isEndDate: true, isLight: isLight, minutesRange: minutesRange, onBack: () => endDateInputRef.current.focus(true), onChange: nextTimeTuple => handleTimeInputFilled(DateRangePosition.END, nextTimeTuple), onFocus: closeRangeCalendarPicker, onPrevious: () => endDateInputRef.current.focus(true) }) }))] }), jsx(RangeCalendarPicker, { defaultValue: rangeCalendarPickerDefaultValue, isHistorical: isHistorical, isOpen: isRangeCalendarPickerOpenRef.current, onChange: handleRangeCalendarPickerChange })] }));
|
|
4931
4927
|
}
|
|
4932
4928
|
const Box$2 = styled.div `
|
|
4933
4929
|
* {
|