@mtes-mct/monitor-ui 1.10.1 → 1.10.2
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 +2 -0
- package/index.js +72 -75
- package/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/index.js
CHANGED
|
@@ -3659,37 +3659,34 @@ const StyledInput = styled(Input) `
|
|
|
3659
3659
|
|
|
3660
3660
|
function FormikCheckbox({ name, ...originalProps }) {
|
|
3661
3661
|
const [field, , helpers] = useField(name);
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
// both because it is useless and it will trigger infinite hook calls
|
|
3665
|
-
const setValue = useMemo(() => helpers.setValue, [helpers.setValue]);
|
|
3662
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps, @typescript-eslint/naming-convention
|
|
3663
|
+
const defaultChecked = useMemo(() => Boolean(field.value), []);
|
|
3666
3664
|
const handleChange = useCallback((isChecked) => {
|
|
3667
|
-
setValue(isChecked);
|
|
3668
|
-
|
|
3669
|
-
|
|
3665
|
+
helpers.setValue(isChecked);
|
|
3666
|
+
},
|
|
3667
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3668
|
+
[]);
|
|
3670
3669
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3671
|
-
useEffect(() => () => setValue(undefined), []);
|
|
3672
|
-
return jsx(Checkbox, { defaultChecked:
|
|
3670
|
+
useEffect(() => () => helpers.setValue(undefined), []);
|
|
3671
|
+
return jsx(Checkbox, { defaultChecked: defaultChecked, name: name, onChange: handleChange, ...originalProps });
|
|
3673
3672
|
}
|
|
3674
3673
|
|
|
3675
3674
|
function FormikDatePicker({ name, ...originalProps }) {
|
|
3676
|
-
const [, , helpers] = useField(name);
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
// both because it is useless and it will trigger infinite hook calls
|
|
3675
|
+
const [field, , helpers] = useField(name);
|
|
3676
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3677
|
+
const defaultValue = useMemo(() => field.value, []);
|
|
3680
3678
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3681
|
-
useEffect(() => () => setValue(undefined), []);
|
|
3682
|
-
return jsx(DatePicker, { onChange: setValue, ...originalProps });
|
|
3679
|
+
useEffect(() => () => helpers.setValue(undefined), []);
|
|
3680
|
+
return jsx(DatePicker, { defaultValue: defaultValue, onChange: helpers.setValue, ...originalProps });
|
|
3683
3681
|
}
|
|
3684
3682
|
|
|
3685
3683
|
function FormikDateRangePicker({ name, ...originalProps }) {
|
|
3686
|
-
const [, , helpers] = useField(name);
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
// both because it is useless and it will trigger infinite hook calls
|
|
3684
|
+
const [field, , helpers] = useField(name);
|
|
3685
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3686
|
+
const defaultValue = useMemo(() => field.value, []);
|
|
3690
3687
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3691
|
-
useEffect(() => () => setValue(undefined), []);
|
|
3692
|
-
return jsx(DateRangePicker, { onChange: setValue, ...originalProps });
|
|
3688
|
+
useEffect(() => () => helpers.setValue(undefined), []);
|
|
3689
|
+
return jsx(DateRangePicker, { defaultValue: defaultValue, onChange: helpers.setValue, ...originalProps });
|
|
3693
3690
|
}
|
|
3694
3691
|
|
|
3695
3692
|
function FormikEffect({ onChange }) {
|
|
@@ -3701,87 +3698,87 @@ function FormikEffect({ onChange }) {
|
|
|
3701
3698
|
}
|
|
3702
3699
|
|
|
3703
3700
|
function FormikMultiCheckbox({ name, ...originalProps }) {
|
|
3704
|
-
const [, , helpers] = useField(name);
|
|
3705
|
-
//
|
|
3706
|
-
|
|
3707
|
-
const { setValue } = helpers;
|
|
3701
|
+
const [field, , helpers] = useField(name);
|
|
3702
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3703
|
+
const defaultValue = useMemo(() => field.value, []);
|
|
3708
3704
|
const handleChange = useCallback((nextValue) => {
|
|
3709
|
-
setValue(nextValue);
|
|
3710
|
-
|
|
3711
|
-
|
|
3705
|
+
helpers.setValue(nextValue);
|
|
3706
|
+
},
|
|
3707
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3708
|
+
[]);
|
|
3712
3709
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3713
|
-
useEffect(() => () => setValue(undefined), []);
|
|
3714
|
-
return jsx(MultiCheckbox, { name: name, onChange: handleChange, ...originalProps });
|
|
3710
|
+
useEffect(() => () => helpers.setValue(undefined), []);
|
|
3711
|
+
return jsx(MultiCheckbox, { defaultValue: defaultValue, name: name, onChange: handleChange, ...originalProps });
|
|
3715
3712
|
}
|
|
3716
3713
|
|
|
3717
3714
|
function FormikMultiSelect({ name, ...originalProps }) {
|
|
3718
|
-
const [, , helpers] = useField(name);
|
|
3719
|
-
//
|
|
3720
|
-
|
|
3721
|
-
const { setValue } = helpers;
|
|
3715
|
+
const [field, , helpers] = useField(name);
|
|
3716
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3717
|
+
const defaultValue = useMemo(() => field.value, []);
|
|
3722
3718
|
const handleChange = useCallback((nextValue) => {
|
|
3723
|
-
setValue(nextValue);
|
|
3724
|
-
|
|
3725
|
-
|
|
3719
|
+
helpers.setValue(nextValue);
|
|
3720
|
+
},
|
|
3721
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3722
|
+
[]);
|
|
3726
3723
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3727
|
-
useEffect(() => () => setValue(undefined), []);
|
|
3728
|
-
return jsx(MultiSelect, { name: name, onChange: handleChange, ...originalProps });
|
|
3724
|
+
useEffect(() => () => helpers.setValue(undefined), []);
|
|
3725
|
+
return jsx(MultiSelect, { defaultValue: defaultValue, name: name, onChange: handleChange, ...originalProps });
|
|
3729
3726
|
}
|
|
3730
3727
|
|
|
3731
3728
|
function FormikMultiRadio({ name, ...originalProps }) {
|
|
3732
|
-
const [, , helpers] = useField(name);
|
|
3733
|
-
//
|
|
3734
|
-
|
|
3735
|
-
const { setValue } = helpers;
|
|
3729
|
+
const [field, , helpers] = useField(name);
|
|
3730
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3731
|
+
const defaultValue = useMemo(() => field.value, []);
|
|
3736
3732
|
const handleChange = useCallback((nextValue) => {
|
|
3737
|
-
setValue(nextValue);
|
|
3738
|
-
|
|
3739
|
-
}, []);
|
|
3733
|
+
helpers.setValue(nextValue);
|
|
3734
|
+
},
|
|
3740
3735
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3741
|
-
|
|
3742
|
-
|
|
3736
|
+
[]);
|
|
3737
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3738
|
+
useEffect(() => () => helpers.setValue(undefined), []);
|
|
3739
|
+
return jsx(MultiRadio, { defaultValue: defaultValue, name: name, onChange: handleChange, ...originalProps });
|
|
3743
3740
|
}
|
|
3744
3741
|
|
|
3745
3742
|
function FormikSelect({ name, ...originalProps }) {
|
|
3746
|
-
const [, , helpers] = useField(name);
|
|
3747
|
-
//
|
|
3748
|
-
|
|
3749
|
-
const { setValue } = helpers;
|
|
3743
|
+
const [field, , helpers] = useField(name);
|
|
3744
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3745
|
+
const defaultValue = useMemo(() => field.value, []);
|
|
3750
3746
|
const handleChange = useCallback((nextValue) => {
|
|
3751
|
-
setValue(nextValue);
|
|
3752
|
-
|
|
3753
|
-
}, []);
|
|
3747
|
+
helpers.setValue(nextValue);
|
|
3748
|
+
},
|
|
3754
3749
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3755
|
-
|
|
3756
|
-
|
|
3750
|
+
[]);
|
|
3751
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3752
|
+
useEffect(() => () => helpers.setValue(undefined), []);
|
|
3753
|
+
return jsx(Select, { defaultValue: defaultValue, name: name, onChange: handleChange, ...originalProps });
|
|
3757
3754
|
}
|
|
3758
3755
|
|
|
3759
3756
|
function FormikTextarea({ name, ...originalProps }) {
|
|
3760
|
-
const [, , helpers] = useField(name);
|
|
3761
|
-
//
|
|
3762
|
-
|
|
3763
|
-
const { setValue } = helpers;
|
|
3757
|
+
const [field, , helpers] = useField(name);
|
|
3758
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3759
|
+
const defaultValue = useMemo(() => field.value, []);
|
|
3764
3760
|
const handleChange = useCallback((nextValue) => {
|
|
3765
|
-
setValue(nextValue);
|
|
3766
|
-
|
|
3767
|
-
}, []);
|
|
3761
|
+
helpers.setValue(nextValue);
|
|
3762
|
+
},
|
|
3768
3763
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3769
|
-
|
|
3770
|
-
|
|
3764
|
+
[]);
|
|
3765
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3766
|
+
useEffect(() => () => helpers.setValue(undefined), []);
|
|
3767
|
+
return jsx(Textarea, { defaultValue: defaultValue, name: name, onChange: handleChange, ...originalProps });
|
|
3771
3768
|
}
|
|
3772
3769
|
|
|
3773
3770
|
function FormikTextInput({ name, ...originalProps }) {
|
|
3774
|
-
const [, , helpers] = useField(name);
|
|
3775
|
-
//
|
|
3776
|
-
|
|
3777
|
-
const { setValue } = helpers;
|
|
3771
|
+
const [field, , helpers] = useField(name);
|
|
3772
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3773
|
+
const defaultValue = useMemo(() => field.value, []);
|
|
3778
3774
|
const handleChange = useCallback((nextValue) => {
|
|
3779
|
-
setValue(nextValue);
|
|
3780
|
-
|
|
3781
|
-
|
|
3775
|
+
helpers.setValue(nextValue);
|
|
3776
|
+
},
|
|
3777
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3778
|
+
[]);
|
|
3782
3779
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3783
|
-
useEffect(() => () => setValue(undefined), []);
|
|
3784
|
-
return jsx(TextInput, { name: name, onChange: handleChange, ...originalProps });
|
|
3780
|
+
useEffect(() => () => helpers.setValue(undefined), []);
|
|
3781
|
+
return jsx(TextInput, { defaultValue: defaultValue, name: name, onChange: handleChange, ...originalProps });
|
|
3785
3782
|
}
|
|
3786
3783
|
|
|
3787
3784
|
const IconBox = styled.div `
|