@mtes-mct/monitor-ui 2.3.0 → 2.3.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/config/playwright.config.d.ts +3 -0
- package/e2e/fields.spec.d.ts +1 -0
- package/index.js +28 -37
- package/index.js.map +1 -1
- package/package.json +5 -2
- package/{GlobalStyle.d.ts → src/GlobalStyle.d.ts} +0 -0
- package/{ThemeProvider.d.ts → src/ThemeProvider.d.ts} +0 -0
- package/{components → src/components}/Dropdown/Item.d.ts +0 -0
- package/{components → src/components}/Dropdown/index.d.ts +0 -0
- package/{constants.d.ts → src/constants.d.ts} +0 -0
- package/{elements → src/elements}/Button.d.ts +0 -0
- package/{elements → src/elements}/Field.d.ts +0 -0
- package/{elements → src/elements}/Fieldset.d.ts +0 -0
- package/{elements → src/elements}/IconBox.d.ts +0 -0
- package/{elements → src/elements}/IconButton.d.ts +0 -0
- package/{elements → src/elements}/Label.d.ts +0 -0
- package/{elements → src/elements}/Legend.d.ts +0 -0
- package/{elements → src/elements}/Tag/Disk.d.ts +0 -0
- package/{elements → src/elements}/Tag/constants.d.ts +0 -0
- package/{elements → src/elements}/Tag/index.d.ts +0 -0
- package/{elements → src/elements}/TagGroup.d.ts +0 -0
- package/{fields → src/fields}/AutoComplete.d.ts +0 -0
- package/{fields → src/fields}/Checkbox.d.ts +0 -0
- package/{fields → src/fields}/DatePicker/CalendarPicker.d.ts +2 -0
- package/{fields → src/fields}/DatePicker/index.d.ts +3 -2
- package/{fields → src/fields}/DateRangePicker/DateInput.d.ts +0 -0
- package/{fields → src/fields}/DateRangePicker/NumberInput.d.ts +0 -0
- package/{fields → src/fields}/DateRangePicker/RangeCalendarPicker.d.ts +0 -0
- package/{fields → src/fields}/DateRangePicker/RangedTimePicker.d.ts +0 -0
- package/{fields → src/fields}/DateRangePicker/TimeInput.d.ts +2 -0
- package/{fields → src/fields}/DateRangePicker/constants.d.ts +0 -0
- package/{fields → src/fields}/DateRangePicker/index.d.ts +3 -2
- /package/{fields → src/fields}/DateRangePicker/types.d.ts +0 -0
- /package/{fields → src/fields}/DateRangePicker/utils.d.ts +0 -0
- /package/{fields → src/fields}/MultiCheckbox.d.ts +0 -0
- /package/{fields → src/fields}/MultiRadio.d.ts +0 -0
- /package/{fields → src/fields}/MultiSelect.d.ts +0 -0
- /package/{fields → src/fields}/MultiZoneEditor/index.d.ts +0 -0
- /package/{fields → src/fields}/NumberInput.d.ts +0 -0
- /package/{fields → src/fields}/Select.d.ts +0 -0
- /package/{fields → src/fields}/TextInput.d.ts +0 -0
- /package/{fields → src/fields}/Textarea.d.ts +0 -0
- /package/{formiks → src/formiks}/FormikAutoComplete.d.ts +0 -0
- /package/{formiks → src/formiks}/FormikCheckbox.d.ts +0 -0
- /package/{formiks → src/formiks}/FormikDatePicker.d.ts +0 -0
- /package/{formiks → src/formiks}/FormikDateRangePicker.d.ts +0 -0
- /package/{formiks → src/formiks}/FormikEffect.d.ts +0 -0
- /package/{formiks → src/formiks}/FormikMultiCheckbox.d.ts +0 -0
- /package/{formiks → src/formiks}/FormikMultiRadio.d.ts +0 -0
- /package/{formiks → src/formiks}/FormikMultiSelect.d.ts +0 -0
- /package/{formiks → src/formiks}/FormikNumberInput.d.ts +0 -0
- /package/{formiks → src/formiks}/FormikSelect.d.ts +0 -0
- /package/{formiks → src/formiks}/FormikTextInput.d.ts +0 -0
- /package/{formiks → src/formiks}/FormikTextarea.d.ts +0 -0
- /package/{hooks → src/hooks}/useForceUpdate.d.ts +0 -0
- /package/{icons → src/icons}/ActivityFeed.d.ts +0 -0
- /package/{icons → src/icons}/Alert.d.ts +0 -0
- /package/{icons → src/icons}/Anchor.d.ts +0 -0
- /package/{icons → src/icons}/Archive.d.ts +0 -0
- /package/{icons → src/icons}/Attention.d.ts +0 -0
- /package/{icons → src/icons}/Calendar.d.ts +0 -0
- /package/{icons → src/icons}/Check.d.ts +0 -0
- /package/{icons → src/icons}/Chevron.d.ts +0 -0
- /package/{icons → src/icons}/Clock.d.ts +0 -0
- /package/{icons → src/icons}/Close.d.ts +0 -0
- /package/{icons → src/icons}/Confirm.d.ts +0 -0
- /package/{icons → src/icons}/Control.d.ts +0 -0
- /package/{icons → src/icons}/Delete.d.ts +0 -0
- /package/{icons → src/icons}/Display.d.ts +0 -0
- /package/{icons → src/icons}/DoubleChevron.d.ts +0 -0
- /package/{icons → src/icons}/Download.d.ts +0 -0
- /package/{icons → src/icons}/Drapeau.d.ts +0 -0
- /package/{icons → src/icons}/Duplicate.d.ts +0 -0
- /package/{icons → src/icons}/Edit.d.ts +0 -0
- /package/{icons → src/icons}/EditBis.d.ts +0 -0
- /package/{icons → src/icons}/Favorite.d.ts +0 -0
- /package/{icons → src/icons}/FilledArrow.d.ts +0 -0
- /package/{icons → src/icons}/Filter.d.ts +0 -0
- /package/{icons → src/icons}/FilterBis.d.ts +0 -0
- /package/{icons → src/icons}/Fishery.d.ts +0 -0
- /package/{icons → src/icons}/FishingEngine.d.ts +0 -0
- /package/{icons → src/icons}/FleetSegment.d.ts +0 -0
- /package/{icons → src/icons}/Focus.d.ts +0 -0
- /package/{icons → src/icons}/FocusVessel.d.ts +0 -0
- /package/{icons → src/icons}/FocusZones.d.ts +0 -0
- /package/{icons → src/icons}/Hide.d.ts +0 -0
- /package/{icons → src/icons}/Info.d.ts +0 -0
- /package/{icons → src/icons}/Infringement.d.ts +0 -0
- /package/{icons → src/icons}/Landmark.d.ts +0 -0
- /package/{icons → src/icons}/List.d.ts +0 -0
- /package/{icons → src/icons}/MapLayers.d.ts +0 -0
- /package/{icons → src/icons}/MeasureAngle.d.ts +0 -0
- /package/{icons → src/icons}/MeasureBrokenLine.d.ts +0 -0
- /package/{icons → src/icons}/MeasureCircle.d.ts +0 -0
- /package/{icons → src/icons}/MeasureLine.d.ts +0 -0
- /package/{icons → src/icons}/Minus.d.ts +0 -0
- /package/{icons → src/icons}/More.d.ts +0 -0
- /package/{icons → src/icons}/Note.d.ts +0 -0
- /package/{icons → src/icons}/Observation.d.ts +0 -0
- /package/{icons → src/icons}/Pin.d.ts +0 -0
- /package/{icons → src/icons}/Pinpoint.d.ts +0 -0
- /package/{icons → src/icons}/PinpointHide.d.ts +0 -0
- /package/{icons → src/icons}/Plane.d.ts +0 -0
- /package/{icons → src/icons}/Plus.d.ts +0 -0
- /package/{icons → src/icons}/Reject.d.ts +0 -0
- /package/{icons → src/icons}/Save.d.ts +0 -0
- /package/{icons → src/icons}/Search.d.ts +0 -0
- /package/{icons → src/icons}/SelectCircle.d.ts +0 -0
- /package/{icons → src/icons}/SelectPolygon.d.ts +0 -0
- /package/{icons → src/icons}/SelectRectangle.d.ts +0 -0
- /package/{icons → src/icons}/SelectZone.d.ts +0 -0
- /package/{icons → src/icons}/ShowErsMessages.d.ts +0 -0
- /package/{icons → src/icons}/ShowXml.d.ts +0 -0
- /package/{icons → src/icons}/SortingArrows.d.ts +0 -0
- /package/{icons → src/icons}/Summary.d.ts +0 -0
- /package/{icons → src/icons}/Tag.d.ts +0 -0
- /package/{icons → src/icons}/Unlock.d.ts +0 -0
- /package/{icons → src/icons}/Vessel.d.ts +0 -0
- /package/{icons → src/icons}/ViewOnMap.d.ts +0 -0
- /package/{icons → src/icons}/index.d.ts +0 -0
- /package/{index.d.ts → src/index.d.ts} +0 -0
- /package/{theme.d.ts → src/theme.d.ts} +0 -0
- /package/{types.d.ts → src/types.d.ts} +0 -0
- /package/{utils → src/utils}/capitalizeFirstLetter.d.ts +0 -0
- /package/{utils → src/utils}/cleanInputString.d.ts +0 -0
- /package/{utils → src/utils}/dayjs.d.ts +0 -0
- /package/{utils → src/utils}/getLocalizedDayjs.d.ts +0 -0
- /package/{utils → src/utils}/getUtcDayjs.d.ts +0 -0
- /package/{utils → src/utils}/getUtcizedDayjs.d.ts +0 -0
- /package/{utils → src/utils}/sortDates.d.ts +0 -0
- /package/{utils → src/utils}/stopMouseEventPropagation.d.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [2.3.0](https://github.com/MTES-MCT/monitor-ui/compare/v2.2.1...v2.3.0) (2022-12-16)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **fields:** add NumberInput ([#144](https://github.com/MTES-MCT/monitor-ui/issues/144)) ([649cc6c](https://github.com/MTES-MCT/monitor-ui/commit/649cc6cf0c7c1d416c7b6a774472df30d436bf00))
|
|
7
|
+
|
|
1
8
|
## [2.2.1](https://github.com/MTES-MCT/monitor-ui/compare/v2.2.0...v2.2.1) (2022-12-15)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/index.js
CHANGED
|
@@ -3028,7 +3028,7 @@ function DateInputWithRef({ defaultValue, isEndDate = false, isForcedFocused, is
|
|
|
3028
3028
|
];
|
|
3029
3029
|
onChange(nextDateTuple);
|
|
3030
3030
|
}, [onChange]);
|
|
3031
|
-
return (jsxs(Box$6, { ref: boxSpanRef, "$hasError": hasFormatError || hasValidationError, "$isFocused": isForcedFocused || isFocused, "$isLight": isLight, children: [isStartDate && 'Du ', isEndDate && 'Au ', jsx(NumberInput$1, { ref: dayInputRef, "
|
|
3031
|
+
return (jsxs(Box$6, { ref: boxSpanRef, "$hasError": hasFormatError || hasValidationError, "$isFocused": isForcedFocused || isFocused, "$isLight": isLight, children: [isStartDate && 'Du ', isEndDate && 'Au ', jsx(NumberInput$1, { ref: dayInputRef, "aria-label": `Jour${isStartDate ? ' de début' : ''}${isEndDate ? ' de fin' : ''}`, defaultValue: defaultValue && formatNumberAsDoubleDigit(defaultValue[2]), max: 31, min: 1, onBack: onBack, onBlur: handleBlur, onClick: onClick, onFilled: submit, onFocus: handleFocus, onFormatError: handleFormatError, onNext: () => monthInputRef.current.focus(), onPrevious: onPrevious, size: 2 }), "/", jsx(NumberInput$1, { ref: monthInputRef, "aria-label": `Mois${isStartDate ? ' de début' : ''}${isEndDate ? ' de fin' : ''}`, defaultValue: defaultValue && formatNumberAsDoubleDigit(defaultValue[1]), max: 12, min: 1, onBack: () => dayInputRef.current.focus(), onBlur: handleBlur, onClick: onClick, onFilled: submit, onFocus: handleFocus, onFormatError: handleFormatError, onNext: () => yearInputRef.current.focus(), onPrevious: () => dayInputRef.current.focus(), size: 2 }), "/", jsx(NumberInput$1, { ref: yearInputRef, "aria-label": `Année${isStartDate ? ' de début' : ''}${isEndDate ? ' de fin' : ''}`, defaultValue: defaultValue && defaultValue[0], max: currentUtcYear, min: 2020, onBack: () => monthInputRef.current.focus(), onBlur: handleBlur, onClick: onClick, onFilled: submit, onFocus: handleFocus, onFormatError: handleFormatError, onNext: onNext, onPrevious: () => monthInputRef.current.focus(), size: 4 })] }));
|
|
3032
3032
|
}
|
|
3033
3033
|
const DateInput = forwardRef(DateInputWithRef);
|
|
3034
3034
|
const Box$6 = styled.span `
|
|
@@ -3764,7 +3764,7 @@ const Option = styled.div `
|
|
|
3764
3764
|
}
|
|
3765
3765
|
`;
|
|
3766
3766
|
|
|
3767
|
-
function TimeInputWithRef({ defaultValue, isLight, isStartDate = false, minutesRange = 15, onBack, onChange, onFocus, onNext, onPrevious }, ref) {
|
|
3767
|
+
function TimeInputWithRef({ defaultValue, isEndDate = false, isLight, isStartDate = false, minutesRange = 15, onBack, onChange, onFocus, onNext, onPrevious }, ref) {
|
|
3768
3768
|
const boxSpanRef = useRef();
|
|
3769
3769
|
const hourInputRef = useRef();
|
|
3770
3770
|
const minuteInputRef = useRef();
|
|
@@ -3851,7 +3851,7 @@ function TimeInputWithRef({ defaultValue, isLight, isStartDate = false, minutesR
|
|
|
3851
3851
|
const nextTimeTuple = [hourInputRef.current.value, minuteInputRef.current.value];
|
|
3852
3852
|
onChange(nextTimeTuple);
|
|
3853
3853
|
}, [closeRangedTimePicker, onChange]);
|
|
3854
|
-
return (jsxs(Box$3, { ref: boxSpanRef, "$hasError": hasFormatError || hasValidationError, "$isFocused": isFocused, "$isLight": isLight, children: [jsxs(Fragment, { children: [jsx(NumberInput$1, { ref: hourInputRef, "
|
|
3854
|
+
return (jsxs(Box$3, { ref: boxSpanRef, "$hasError": hasFormatError || hasValidationError, "$isFocused": isFocused, "$isLight": isLight, children: [jsxs(Fragment, { children: [jsx(NumberInput$1, { ref: hourInputRef, "aria-label": `Heure${isStartDate ? ' de début' : ''}${isEndDate ? ' de fin' : ''}`, defaultValue: controlledDefaultValue && controlledDefaultValue[0], max: 23, min: 0, onBack: handleBack, onBlur: handleBlur, onClick: openRangedTimePicker, onFilled: submit, onFocus: handleFocus, onFormatError: handleFormatError, onInput: handleHourInput, onNext: () => minuteInputRef.current.focus(), onPrevious: onPrevious, size: 2 }), ":", jsx(NumberInput$1, { ref: minuteInputRef, "aria-label": `Minute${isStartDate ? ' de début' : ''}${isEndDate ? ' de fin' : ''}`, defaultValue: controlledDefaultValue && controlledDefaultValue[1], max: 59, min: 0, onBack: () => hourInputRef.current.focus(), onBlur: handleBlur, onClick: openRangedTimePicker, onFilled: submit, onFocus: handleFocus, onFormatError: handleFormatError, onNext: onNext, onPrevious: () => hourInputRef.current.focus(), size: 2 })] }), isRangedTimePickerOpenRef.current && (jsx(RangedTimePicker, { filter: rangedTimePickerFilter, minutesRange: minutesRange, onChange: handleRangedTimePickedChange }))] }));
|
|
3855
3855
|
}
|
|
3856
3856
|
const TimeInput = forwardRef(TimeInputWithRef);
|
|
3857
3857
|
const Box$3 = styled.span `
|
|
@@ -3877,7 +3877,7 @@ var DateRangePosition;
|
|
|
3877
3877
|
DateRangePosition["START"] = "START";
|
|
3878
3878
|
})(DateRangePosition || (DateRangePosition = {}));
|
|
3879
3879
|
|
|
3880
|
-
function DateRangePicker({ defaultValue, isHistorical = false, isLabelHidden = false, isLight = false, label, minutesRange = 15, onChange, withTime = false }) {
|
|
3880
|
+
function DateRangePicker({ defaultValue, isHistorical = false, isLabelHidden = false, isLight = false, label, minutesRange = 15, onChange, withTime = false, ...nativeProps }) {
|
|
3881
3881
|
const startDateInputRef = useRef();
|
|
3882
3882
|
const startTimeInputRef = useRef();
|
|
3883
3883
|
const endDateInputRef = useRef();
|
|
@@ -4026,7 +4026,7 @@ function DateRangePicker({ defaultValue, isHistorical = false, isLabelHidden = f
|
|
|
4026
4026
|
window.document.removeEventListener('click', handleClickOutside);
|
|
4027
4027
|
};
|
|
4028
4028
|
}, [handleClickOutside]);
|
|
4029
|
-
return (jsxs(Fieldset, {
|
|
4029
|
+
return (jsxs(Fieldset, { ...nativeProps, children: [jsx(Legend, { isHidden: isLabelHidden, children: label }), jsxs(Box$2, { children: [jsx(Field$1, { children: jsx(DateInput, { ref: startDateInputRef, defaultValue: selectedStartDateTupleRef.current, isForcedFocused: isRangeCalendarPickerOpenRef.current, isLight: isLight, isStartDate: true, onChange: nextDateTuple => handleDateInputFilled(DateRangePosition.START, nextDateTuple), onClick: openRangeCalendarPicker, onNext: handleStartDateInputNext }) }), withTime && (jsx(Field$1, { isTimeField: true, children: jsx(TimeInput, { ref: startTimeInputRef, defaultValue: selectedStartTimeTupleRef.current, 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$1, { isEndDateField: true, children: jsx(DateInput, { ref: endDateInputRef, defaultValue: selectedEndDateTupleRef.current, isEndDate: true, isForcedFocused: isRangeCalendarPickerOpenRef.current, isLight: isLight, onBack: handleEndDateInputPrevious, onChange: nextDateTuple => handleDateInputFilled(DateRangePosition.END, nextDateTuple), onClick: openRangeCalendarPicker, onNext: handleEndDateInputNext, onPrevious: handleEndDateInputPrevious }) }), withTime && (jsx(Field$1, { isTimeField: true, children: jsx(TimeInput, { ref: endTimeInputRef, defaultValue: selectedEndTimeTupleRef.current, isEndDate: true, isLight: isLight, minutesRange: minutesRange, onBack: () => endDateInputRef.current.focus(true), onChange: nextTimeTuple => handleTimeInputFilled(DateRangePosition.END, nextTimeTuple), onFocus: closeRangeCalendarPicker, onPrevious: () => endDateInputRef.current.focus(true) }) }))] }), isRangeCalendarPickerOpenRef.current && (jsx(RangeCalendarPicker, { defaultValue: rangeCalendarPickerDefaultValue, isHistorical: isHistorical, onChange: handleRangeCalendarPickerChange }))] }));
|
|
4030
4030
|
}
|
|
4031
4031
|
const Box$2 = styled.div `
|
|
4032
4032
|
* {
|
|
@@ -4049,44 +4049,18 @@ const Field$1 = styled.span `
|
|
|
4049
4049
|
`;
|
|
4050
4050
|
|
|
4051
4051
|
function CalendarPicker({ defaultValue, isHistorical, onChange }) {
|
|
4052
|
-
const boxRef = useRef();
|
|
4053
|
-
const calendarRef = useRef();
|
|
4054
|
-
const [isFirstLoad, setIsFirstLoad] = useState(true);
|
|
4055
4052
|
const utcTodayAsDayjs = useMemo(() => getUtcDayjs().endOf('day'), []);
|
|
4056
4053
|
const disabledDate = useMemo(() => (date) => date && isHistorical ? getUtcizedDayjs(date).isAfter(utcTodayAsDayjs) : false, [isHistorical, utcTodayAsDayjs]);
|
|
4057
4054
|
const handleSelect = useCallback((nextDate) => {
|
|
4058
4055
|
const nextDateTuple = getDateTupleFromDate(nextDate);
|
|
4059
4056
|
onChange(nextDateTuple);
|
|
4060
4057
|
}, [onChange]);
|
|
4061
|
-
|
|
4062
|
-
// We wait for the <Box /> to render so that `boxRef` is defined
|
|
4063
|
-
// and can be used as a container for <RsuiteDateRangePicker />
|
|
4064
|
-
setIsFirstLoad(false);
|
|
4065
|
-
}, []);
|
|
4066
|
-
return (jsxs(Fragment, { children: [jsx(GlobalStyleToHideBodyDialog, {}), jsx(Box$1, { ref: boxRef, onClick: stopMouseEventPropagation, children: !isFirstLoad && (jsx(DatePicker$1, { ref: calendarRef, container: boxRef.current, disabledDate: disabledDate, format: "yyyy-MM-dd", locale: RSUITE_CALENDAR_LOCALE, oneTap: true, onSelect: handleSelect, open: true, ranges: [],
|
|
4058
|
+
return (jsxs(Fragment, { children: [jsx(RsuiteCalendarPickerModalGlobalStyle, {}), jsx(Box$1, { children: jsx(DatePicker$1, { className: "AAAAAAAAA", classPrefix: "mui-picker-", disabledDate: disabledDate, format: "yyyy-MM-dd", locale: RSUITE_CALENDAR_LOCALE, oneTap: true, onSelect: handleSelect, open: true, ranges: [],
|
|
4067
4059
|
// `defaultValue` seems to be immediatly cancelled so we come down to using a controlled `value`
|
|
4068
|
-
value: defaultValue })
|
|
4060
|
+
value: defaultValue }) })] }));
|
|
4069
4061
|
}
|
|
4070
|
-
const
|
|
4071
|
-
|
|
4072
|
-
display: none;
|
|
4073
|
-
}
|
|
4074
|
-
`;
|
|
4075
|
-
const Box$1 = styled.div `
|
|
4076
|
-
height: 0;
|
|
4077
|
-
position: relative;
|
|
4078
|
-
top: 0;
|
|
4079
|
-
user-select: none;
|
|
4080
|
-
|
|
4081
|
-
.rs-picker-toggle {
|
|
4082
|
-
display: none;
|
|
4083
|
-
}
|
|
4084
|
-
|
|
4085
|
-
.rs-picker-date-panel {
|
|
4086
|
-
height: 290px;
|
|
4087
|
-
}
|
|
4088
|
-
|
|
4089
|
-
.rs-picker-date-menu {
|
|
4062
|
+
const RsuiteCalendarPickerModalGlobalStyle = createGlobalStyle `
|
|
4063
|
+
.rs-mui-picker-date-menu {
|
|
4090
4064
|
border: solid 1px ${p => p.theme.color.lightGray};
|
|
4091
4065
|
border-radius: 0;
|
|
4092
4066
|
margin-top: 4px;
|
|
@@ -4173,8 +4147,22 @@ const Box$1 = styled.div `
|
|
|
4173
4147
|
}
|
|
4174
4148
|
}
|
|
4175
4149
|
`;
|
|
4150
|
+
const Box$1 = styled.div `
|
|
4151
|
+
/* height: 0;
|
|
4152
|
+
position: relative;
|
|
4153
|
+
top: 0; */
|
|
4154
|
+
user-select: none;
|
|
4155
|
+
|
|
4156
|
+
.rs-picker-toggle {
|
|
4157
|
+
display: none;
|
|
4158
|
+
}
|
|
4159
|
+
|
|
4160
|
+
.rs-picker-date-panel {
|
|
4161
|
+
height: 290px;
|
|
4162
|
+
}
|
|
4163
|
+
`;
|
|
4176
4164
|
|
|
4177
|
-
function DatePicker({ defaultValue, isHistorical = false, isLabelHidden = false, isLight = false, label, minutesRange = 15, onChange, withTime = false }) {
|
|
4165
|
+
function DatePicker({ defaultValue, isHistorical = false, isLabelHidden = false, isLight = false, label, minutesRange = 15, onChange, withTime = false, ...nativeProps }) {
|
|
4178
4166
|
const dateInputRef = useRef();
|
|
4179
4167
|
const timeInputRef = useRef();
|
|
4180
4168
|
const isCalendarPickerOpenRef = useRef(false);
|
|
@@ -4241,6 +4229,9 @@ function DatePicker({ defaultValue, isHistorical = false, isLabelHidden = false,
|
|
|
4241
4229
|
closeCalendarPicker();
|
|
4242
4230
|
forceUpdate();
|
|
4243
4231
|
submit();
|
|
4232
|
+
if (withTime && !selectedTimeTupleRef.current) {
|
|
4233
|
+
timeInputRef.current.focus();
|
|
4234
|
+
}
|
|
4244
4235
|
}, [closeCalendarPicker, forceUpdate, submit, withTime]);
|
|
4245
4236
|
const handleTimeInputFilled = useCallback((nextTimeTuple) => {
|
|
4246
4237
|
// If a date has already been selected
|
|
@@ -4263,7 +4254,7 @@ function DatePicker({ defaultValue, isHistorical = false, isLabelHidden = false,
|
|
|
4263
4254
|
window.document.removeEventListener('click', handleClickOutside);
|
|
4264
4255
|
};
|
|
4265
4256
|
}, [handleClickOutside]);
|
|
4266
|
-
return (jsxs(Fieldset, {
|
|
4257
|
+
return (jsxs(Fieldset, { ...nativeProps, children: [jsx(Legend, { isHidden: isLabelHidden, children: label }), jsxs(Box, { children: [jsx(Field, { children: jsx(DateInput, { ref: dateInputRef, defaultValue: selectedDateTupleRef.current, isForcedFocused: isCalendarPickerOpenRef.current, isLight: isLight, onChange: handleDateInputFilled, onClick: openCalendarPicker, onNext: handleDateInputNext }) }), withTime && (jsx(Field, { "$isTimeField": true, children: jsx(TimeInput, { ref: timeInputRef, defaultValue: selectedTimeTupleRef.current, isLight: isLight, minutesRange: minutesRange, onBack: () => dateInputRef.current.focus(true), onChange: handleTimeInputFilled, onFocus: closeCalendarPicker, onPrevious: () => dateInputRef.current.focus(true) }) }))] }), isCalendarPickerOpenRef.current && (jsx(CalendarPicker, { defaultValue: rangeCalendarPickerDefaultValue, isHistorical: isHistorical, onChange: handleCalendarPickerChange }))] }));
|
|
4267
4258
|
}
|
|
4268
4259
|
const Box = styled.div `
|
|
4269
4260
|
* {
|