@mtes-mct/monitor-ui 2.2.1 → 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 +14 -0
- package/config/playwright.config.d.ts +3 -0
- package/e2e/fields.spec.d.ts +1 -0
- package/index.js +59 -41
- 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/src/fields/NumberInput.d.ts +11 -0
- package/{fields → src/fields}/Select.d.ts +0 -0
- package/{fields → src/fields}/TextInput.d.ts +1 -1
- 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/src/formiks/FormikNumberInput.d.ts +3 -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} +4 -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,17 @@
|
|
|
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
|
+
|
|
8
|
+
## [2.2.1](https://github.com/MTES-MCT/monitor-ui/compare/v2.2.0...v2.2.1) (2022-12-15)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **elements:** use gap instead of margin in TagGroup ([#142](https://github.com/MTES-MCT/monitor-ui/issues/142)) ([b6d73ea](https://github.com/MTES-MCT/monitor-ui/commit/b6d73eaa1daaf4f7c112dd9e5b6542265a2fbb1c))
|
|
14
|
+
|
|
1
15
|
# [2.2.0](https://github.com/MTES-MCT/monitor-ui/compare/v2.1.1...v2.2.0) (2022-12-15)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styled, { createGlobalStyle, ThemeProvider as ThemeProvider$1, css } from 'styled-components';
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import { useMemo, useRef, useState, useCallback, useEffect, useReducer, forwardRef, useImperativeHandle } from 'react';
|
|
4
|
-
import { Dropdown as Dropdown$1, AutoComplete as AutoComplete$1, Checkbox as Checkbox$1, DateRangePicker as DateRangePicker$1, DatePicker as DatePicker$1, TagPicker, Radio,
|
|
4
|
+
import { Dropdown as Dropdown$1, AutoComplete as AutoComplete$1, Checkbox as Checkbox$1, DateRangePicker as DateRangePicker$1, DatePicker as DatePicker$1, TagPicker, Radio, Input, SelectPicker } from 'rsuite';
|
|
5
5
|
import { useField, useFormikContext } from 'formik';
|
|
6
6
|
|
|
7
7
|
var Accent;
|
|
@@ -2888,7 +2888,7 @@ function NumberInputWithRef({ defaultValue, max, min, onBack, onClick, onFilled,
|
|
|
2888
2888
|
}, [onBack, onNext, onPrevious]);
|
|
2889
2889
|
return (jsx(StyledNumberInput, { ref: inputRef, "$size": size, defaultValue: defaultValue, maxLength: size, onClick: handleClick, onFocus: handleFocus, onInput: handleInput, onKeyDown: handleKeyDown, pattern: "\\d*", placeholder: placeholder, type: "text", ...nativeProps }, String(defaultValue)));
|
|
2890
2890
|
}
|
|
2891
|
-
const NumberInput = forwardRef(NumberInputWithRef);
|
|
2891
|
+
const NumberInput$1 = forwardRef(NumberInputWithRef);
|
|
2892
2892
|
const StyledNumberInput = styled.input `
|
|
2893
2893
|
background-color: transparent;
|
|
2894
2894
|
border: 0;
|
|
@@ -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, { 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, { 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
|
* {
|
|
@@ -4793,6 +4784,26 @@ const ZoneWrapper = styled.div `
|
|
|
4793
4784
|
padding: 6px 12px 6px;
|
|
4794
4785
|
`;
|
|
4795
4786
|
|
|
4787
|
+
function NumberInput({ isLabelHidden = false, isLight = false, label, onChange, ...originalProps }) {
|
|
4788
|
+
const key = useMemo(() => `${originalProps.name}-${JSON.stringify(originalProps.defaultValue)}`, [originalProps.defaultValue, originalProps.name]);
|
|
4789
|
+
const handleChange = useCallback((nextValue) => {
|
|
4790
|
+
if (!onChange) {
|
|
4791
|
+
return;
|
|
4792
|
+
}
|
|
4793
|
+
const normalizedNextValueAsString = nextValue && nextValue.length ? nextValue : undefined;
|
|
4794
|
+
const nextValueAsNumber = Number(normalizedNextValueAsString);
|
|
4795
|
+
const normalizedNextValue = !Number.isNaN(nextValueAsNumber) ? nextValueAsNumber : undefined;
|
|
4796
|
+
onChange(normalizedNextValue);
|
|
4797
|
+
}, [onChange]);
|
|
4798
|
+
return (jsxs(Field$2, { children: [jsx(Label, { htmlFor: originalProps.name, isHidden: isLabelHidden, children: label }), jsx(StyledInput$2, { "$isLight": isLight, id: originalProps.name, onChange: handleChange, type: "number", ...originalProps }, key)] }));
|
|
4799
|
+
}
|
|
4800
|
+
const StyledInput$2 = styled(Input) `
|
|
4801
|
+
background-color: ${p => (p.$isLight ? p.theme.color.white : p.theme.color.gainsboro)};
|
|
4802
|
+
border: 0;
|
|
4803
|
+
font-size: 13px;
|
|
4804
|
+
width: 100%;
|
|
4805
|
+
`;
|
|
4806
|
+
|
|
4796
4807
|
function Select({ isLabelHidden = false, isLight = false, label, onChange, options,
|
|
4797
4808
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
4798
4809
|
searchable = false, ...originalProps }) {
|
|
@@ -4846,7 +4857,7 @@ function TextInput({ isLabelHidden = false, isLight = false, label, onChange, ..
|
|
|
4846
4857
|
const normalizedNextValue = nextValue && nextValue.trim().length ? nextValue : undefined;
|
|
4847
4858
|
onChange(normalizedNextValue);
|
|
4848
4859
|
}, [onChange]);
|
|
4849
|
-
return (jsxs(Field$2, { children: [jsx(Label, { htmlFor: originalProps.name, isHidden: isLabelHidden, children: label }), jsx(StyledInput, { "$isLight": isLight, id: originalProps.name, onChange: handleChange, ...originalProps }, key)] }));
|
|
4860
|
+
return (jsxs(Field$2, { children: [jsx(Label, { htmlFor: originalProps.name, isHidden: isLabelHidden, children: label }), jsx(StyledInput, { "$isLight": isLight, id: originalProps.name, onChange: handleChange, type: "text", ...originalProps }, key)] }));
|
|
4850
4861
|
}
|
|
4851
4862
|
const StyledInput = styled(Input) `
|
|
4852
4863
|
background-color: ${p => (p.$isLight ? p.theme.color.white : p.theme.color.gainsboro)};
|
|
@@ -4912,6 +4923,13 @@ function FormikMultiRadio({ name, ...originalProps }) {
|
|
|
4912
4923
|
return jsx(MultiRadio, { defaultValue: defaultValue, name: name, onChange: helpers.setValue, ...originalProps });
|
|
4913
4924
|
}
|
|
4914
4925
|
|
|
4926
|
+
function FormikNumberInput({ name, ...originalProps }) {
|
|
4927
|
+
const [field, , helpers] = useField(name);
|
|
4928
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4929
|
+
const defaultValue = useMemo(() => field.value, []);
|
|
4930
|
+
return jsx(NumberInput, { defaultValue: defaultValue, name: name, onChange: helpers.setValue, ...originalProps });
|
|
4931
|
+
}
|
|
4932
|
+
|
|
4915
4933
|
function FormikSelect({ name, ...originalProps }) {
|
|
4916
4934
|
const [field, , helpers] = useField(name);
|
|
4917
4935
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -4933,5 +4951,5 @@ function FormikTextInput({ name, ...originalProps }) {
|
|
|
4933
4951
|
return jsx(TextInput, { defaultValue: defaultValue, name: name, onChange: helpers.setValue, ...originalProps });
|
|
4934
4952
|
}
|
|
4935
4953
|
|
|
4936
|
-
export { Accent, AutoComplete, Button, Checkbox, DatePicker, DateRangePicker, Dropdown, Field$2 as Field, Fieldset, FormikAutoComplete, FormikCheckbox, FormikDatePicker, FormikDateRangePicker, FormikEffect, FormikMultiCheckbox, FormikMultiRadio, FormikMultiSelect, FormikSelect, FormikTextInput, FormikTextarea, GlobalStyle, index as Icon, IconButton, Label, Legend, MultiCheckbox, MultiRadio, MultiSelect, MultiZoneEditor, Select, Size, THEME, Tag$1 as Tag, TagGroup, TextInput, Textarea, ThemeProvider };
|
|
4954
|
+
export { Accent, AutoComplete, Button, Checkbox, DatePicker, DateRangePicker, Dropdown, Field$2 as Field, Fieldset, FormikAutoComplete, FormikCheckbox, FormikDatePicker, FormikDateRangePicker, FormikEffect, FormikMultiCheckbox, FormikMultiRadio, FormikMultiSelect, FormikNumberInput, FormikSelect, FormikTextInput, FormikTextarea, GlobalStyle, index as Icon, IconButton, Label, Legend, MultiCheckbox, MultiRadio, MultiSelect, MultiZoneEditor, NumberInput, Select, Size, THEME, Tag$1 as Tag, TagGroup, TextInput, Textarea, ThemeProvider };
|
|
4937
4955
|
//# sourceMappingURL=index.js.map
|