@mtes-mct/monitor-ui 2.14.1 → 2.14.3
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 +16 -0
- package/index.js +18 -29
- package/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## [2.14.2](https://github.com/MTES-MCT/monitor-ui/compare/v2.14.1...v2.14.2) (2023-02-08)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **elements:** make secondary Button background transparent ([7f1e490](https://github.com/MTES-MCT/monitor-ui/commit/7f1e4909d1a075a90de683c603dfc1b7dd586010))
|
|
7
|
+
* **fields:** make MultiZoneEditor row background white when isLight ([96f7a00](https://github.com/MTES-MCT/monitor-ui/commit/96f7a00bd7eab7755de13e8202aa64367e8d7b18))
|
|
8
|
+
* **formiks:** remove touched condition for errors ([91ac524](https://github.com/MTES-MCT/monitor-ui/commit/91ac524d0916390bc5308083390264d018dad980))
|
|
9
|
+
|
|
10
|
+
## [2.14.1](https://github.com/MTES-MCT/monitor-ui/compare/v2.14.0...v2.14.1) (2023-02-08)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **fields:** remove value setting to undefined on destroy ([71f409b](https://github.com/MTES-MCT/monitor-ui/commit/71f409b699df131a70454204b87b0e563798cac9))
|
|
16
|
+
|
|
1
17
|
# [2.14.0](https://github.com/MTES-MCT/monitor-ui/compare/v2.13.2...v2.14.0) (2023-02-07)
|
|
2
18
|
|
|
3
19
|
|
package/index.js
CHANGED
|
@@ -2132,7 +2132,7 @@ const PrimaryButton = styled.button `
|
|
|
2132
2132
|
}
|
|
2133
2133
|
`;
|
|
2134
2134
|
const SecondaryButton = styled.button `
|
|
2135
|
-
background-color:
|
|
2135
|
+
background-color: transparent;
|
|
2136
2136
|
border: 1px solid ${p => p.theme.color.charcoal};
|
|
2137
2137
|
color: ${p => p.theme.color.charcoal};
|
|
2138
2138
|
|
|
@@ -2152,7 +2152,7 @@ const SecondaryButton = styled.button `
|
|
|
2152
2152
|
|
|
2153
2153
|
:disabled,
|
|
2154
2154
|
&._disabled {
|
|
2155
|
-
background-color:
|
|
2155
|
+
background-color: transparent;
|
|
2156
2156
|
border: 1px solid ${p => p.theme.color.lightGray};
|
|
2157
2157
|
color: ${p => p.theme.color.lightGray};
|
|
2158
2158
|
}
|
|
@@ -3278,7 +3278,7 @@ const FieldError = styled.p `
|
|
|
3278
3278
|
font-size: 13px;
|
|
3279
3279
|
font-weight: 700;
|
|
3280
3280
|
line-height: 1.3846;
|
|
3281
|
-
margin
|
|
3281
|
+
margin: 4px 0 0 0;
|
|
3282
3282
|
`;
|
|
3283
3283
|
|
|
3284
3284
|
const useClickOutsideEffect = (zoneRefOrzoneRefs, action, baseContainer) => {
|
|
@@ -5465,9 +5465,9 @@ disabled = false, error, initialZone, isLabelHidden = false, isLight = false, la
|
|
|
5465
5465
|
setZones(defaultValue);
|
|
5466
5466
|
}, [defaultValue]);
|
|
5467
5467
|
useFieldUndefineEffect(disabled, onChange, handleDisable);
|
|
5468
|
-
return (jsxs(Fieldset, { disabled: disabled, isLegendHidden: isLabelHidden,
|
|
5468
|
+
return (jsxs(Fieldset, { disabled: disabled, isLegendHidden: isLabelHidden, legend: label, children: [jsx(Button, { accent: Accent.SECONDARY, disabled: disabled, Icon: Plus, isFullWidth: true, onClick: addZone, children: addButtonLabel }), jsx(Fragment, { children: zones.map((zone, index) => (
|
|
5469
5469
|
// eslint-disable-next-line react/no-array-index-key
|
|
5470
|
-
jsxs(Row, { children: [jsxs(
|
|
5470
|
+
jsxs(Row, { children: [jsxs(ZoneBox, { "$isLight": isLight, children: [zone[labelPropName], jsxs(Link, { onClick: () => centerZone(zone), children: [jsx(SelectRectangle, {}), jsx("span", { children: "Centrer sur la carte" })] })] }), jsx(IconButton, { accent: Accent.SECONDARY, Icon: Edit, onClick: () => editZone(index, zone) }), jsx(IconButton, { accent: Accent.SECONDARY, "aria-label": "Supprimer cette zone", Icon: Delete, onClick: () => deleteZone(index) })] }, `zone-${index}`))) }), hasError && jsx(FieldError, { children: controlledError })] }));
|
|
5471
5471
|
}
|
|
5472
5472
|
const Row = styled.div `
|
|
5473
5473
|
align-items: center;
|
|
@@ -5478,8 +5478,8 @@ const Row = styled.div `
|
|
|
5478
5478
|
margin: 0 0 0 8px;
|
|
5479
5479
|
}
|
|
5480
5480
|
`;
|
|
5481
|
-
const
|
|
5482
|
-
background-color: ${p => p.theme.color.gainsboro};
|
|
5481
|
+
const ZoneBox = styled.div `
|
|
5482
|
+
background-color: ${p => (p.$isLight ? p.theme.color.white : p.theme.color.gainsboro)};
|
|
5483
5483
|
display: flex;
|
|
5484
5484
|
flex-grow: 1;
|
|
5485
5485
|
font-size: 13px;
|
|
@@ -5671,23 +5671,21 @@ function FormikAutoComplete({ name, ...originalProps }) {
|
|
|
5671
5671
|
const [field, meta, helpers] = useField(name);
|
|
5672
5672
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5673
5673
|
const defaultValue = useMemo(() => field.value, []);
|
|
5674
|
-
const error = useMemo(() => (meta.initialTouched ? meta.error : undefined), [meta.error, meta.initialTouched]);
|
|
5675
5674
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5676
5675
|
const handleChange = useMemo(() => helpers.setValue, []);
|
|
5677
5676
|
if (!defaultValue) {
|
|
5678
5677
|
return jsx(AutoComplete, { name: name, onChange: helpers.setValue, ...originalProps });
|
|
5679
5678
|
}
|
|
5680
|
-
return (jsx(AutoComplete, { defaultValue: defaultValue, error: error, name: name, onChange: handleChange, ...originalProps }));
|
|
5679
|
+
return (jsx(AutoComplete, { defaultValue: defaultValue, error: meta.error, name: name, onChange: handleChange, ...originalProps }));
|
|
5681
5680
|
}
|
|
5682
5681
|
|
|
5683
5682
|
function FormikCheckbox({ name, ...originalProps }) {
|
|
5684
5683
|
const [field, meta, helpers] = useField(name);
|
|
5685
|
-
const error = useMemo(() => (meta.initialTouched ? meta.error : undefined), [meta.error, meta.initialTouched]);
|
|
5686
5684
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5687
5685
|
const handleChange = useMemo(() => helpers.setValue, []);
|
|
5688
5686
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5689
5687
|
const isDefaultChecked = useMemo(() => Boolean(field.value), []);
|
|
5690
|
-
return (jsx(Checkbox, { defaultChecked: isDefaultChecked, error: error, name: name, onChange: handleChange, ...originalProps }));
|
|
5688
|
+
return (jsx(Checkbox, { defaultChecked: isDefaultChecked, error: meta.error, name: name, onChange: handleChange, ...originalProps }));
|
|
5691
5689
|
}
|
|
5692
5690
|
|
|
5693
5691
|
const UntypedDatePicker = DatePicker;
|
|
@@ -5695,10 +5693,9 @@ function FormikDatePicker({ name, ...originalProps }) {
|
|
|
5695
5693
|
const [field, meta, helpers] = useField(name);
|
|
5696
5694
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5697
5695
|
const defaultValue = useMemo(() => field.value, []);
|
|
5698
|
-
const error = useMemo(() => (meta.initialTouched ? meta.error : undefined), [meta.error, meta.initialTouched]);
|
|
5699
5696
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5700
5697
|
const handleChange = useMemo(() => helpers.setValue, []);
|
|
5701
|
-
return jsx(UntypedDatePicker, { defaultValue: defaultValue, error: error, onChange: handleChange, ...originalProps });
|
|
5698
|
+
return jsx(UntypedDatePicker, { defaultValue: defaultValue, error: meta.error, onChange: handleChange, ...originalProps });
|
|
5702
5699
|
}
|
|
5703
5700
|
|
|
5704
5701
|
const UntypedDateRangePicker = DateRangePicker;
|
|
@@ -5706,10 +5703,9 @@ function FormikDateRangePicker({ name, ...originalProps }) {
|
|
|
5706
5703
|
const [field, meta, helpers] = useField(name);
|
|
5707
5704
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5708
5705
|
const defaultValue = useMemo(() => field.value, []);
|
|
5709
|
-
const error = useMemo(() => (meta.initialTouched ? meta.error : undefined), [meta.error, meta.initialTouched]);
|
|
5710
5706
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5711
5707
|
const handleChange = useMemo(() => helpers.setValue, []);
|
|
5712
|
-
return jsx(UntypedDateRangePicker, { defaultValue: defaultValue, error: error, onChange: handleChange, ...originalProps });
|
|
5708
|
+
return (jsx(UntypedDateRangePicker, { defaultValue: defaultValue, error: meta.error, onChange: handleChange, ...originalProps }));
|
|
5713
5709
|
}
|
|
5714
5710
|
|
|
5715
5711
|
function FormikEffect({ onChange }) {
|
|
@@ -5724,70 +5720,63 @@ function FormikMultiCheckbox({ name, ...originalProps }) {
|
|
|
5724
5720
|
const [field, meta, helpers] = useField(name);
|
|
5725
5721
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5726
5722
|
const defaultValue = useMemo(() => field.value, []);
|
|
5727
|
-
const error = useMemo(() => (meta.initialTouched ? meta.error : undefined), [meta.error, meta.initialTouched]);
|
|
5728
5723
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5729
5724
|
const handleChange = useMemo(() => helpers.setValue, []);
|
|
5730
|
-
return (jsx(MultiCheckbox, { defaultValue: defaultValue, error: error, name: name, onChange: handleChange, ...originalProps }));
|
|
5725
|
+
return (jsx(MultiCheckbox, { defaultValue: defaultValue, error: meta.error, name: name, onChange: handleChange, ...originalProps }));
|
|
5731
5726
|
}
|
|
5732
5727
|
|
|
5733
5728
|
function FormikMultiSelect({ name, ...originalProps }) {
|
|
5734
5729
|
const [field, meta, helpers] = useField(name);
|
|
5735
5730
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5736
5731
|
const defaultValue = useMemo(() => field.value, []);
|
|
5737
|
-
const error = useMemo(() => (meta.initialTouched ? meta.error : undefined), [meta.error, meta.initialTouched]);
|
|
5738
5732
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5739
5733
|
const handleChange = useMemo(() => helpers.setValue, []);
|
|
5740
|
-
return (jsx(MultiSelect, { defaultValue: defaultValue, error: error, name: name, onChange: handleChange, ...originalProps }));
|
|
5734
|
+
return (jsx(MultiSelect, { defaultValue: defaultValue, error: meta.error, name: name, onChange: handleChange, ...originalProps }));
|
|
5741
5735
|
}
|
|
5742
5736
|
|
|
5743
5737
|
function FormikMultiRadio({ name, ...originalProps }) {
|
|
5744
5738
|
const [field, meta, helpers] = useField(name);
|
|
5745
5739
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5746
5740
|
const defaultValue = useMemo(() => field.value, []);
|
|
5747
|
-
const error = useMemo(() => (meta.initialTouched ? meta.error : undefined), [meta.error, meta.initialTouched]);
|
|
5748
5741
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5749
5742
|
const handleChange = useMemo(() => helpers.setValue, []);
|
|
5750
|
-
return jsx(MultiRadio, { defaultValue: defaultValue, error: error, name: name, onChange: handleChange, ...originalProps });
|
|
5743
|
+
return (jsx(MultiRadio, { defaultValue: defaultValue, error: meta.error, name: name, onChange: handleChange, ...originalProps }));
|
|
5751
5744
|
}
|
|
5752
5745
|
|
|
5753
5746
|
function FormikNumberInput({ name, ...originalProps }) {
|
|
5754
5747
|
const [field, meta, helpers] = useField(name);
|
|
5755
5748
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5756
5749
|
const defaultValue = useMemo(() => field.value, []);
|
|
5757
|
-
const error = useMemo(() => (meta.initialTouched ? meta.error : undefined), [meta.error, meta.initialTouched]);
|
|
5758
5750
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5759
5751
|
const handleChange = useMemo(() => helpers.setValue, []);
|
|
5760
|
-
return (jsx(NumberInput, { defaultValue: defaultValue, error: error, name: name, onChange: handleChange, ...originalProps }));
|
|
5752
|
+
return (jsx(NumberInput, { defaultValue: defaultValue, error: meta.error, name: name, onChange: handleChange, ...originalProps }));
|
|
5761
5753
|
}
|
|
5762
5754
|
|
|
5763
5755
|
function FormikSelect({ name, ...originalProps }) {
|
|
5764
5756
|
const [field, meta, helpers] = useField(name);
|
|
5765
5757
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5766
5758
|
const defaultValue = useMemo(() => field.value, []);
|
|
5767
|
-
const error = useMemo(() => (meta.initialTouched ? meta.error : undefined), [meta.error, meta.initialTouched]);
|
|
5768
5759
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5769
5760
|
const handleChange = useMemo(() => helpers.setValue, []);
|
|
5770
|
-
return jsx(Select, { defaultValue: defaultValue, error: error, name: name, onChange: handleChange, ...originalProps });
|
|
5761
|
+
return (jsx(Select, { defaultValue: defaultValue, error: meta.error, name: name, onChange: handleChange, ...originalProps }));
|
|
5771
5762
|
}
|
|
5772
5763
|
|
|
5773
5764
|
function FormikTextarea({ name, ...originalProps }) {
|
|
5774
5765
|
const [field, meta, helpers] = useField(name);
|
|
5775
5766
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5776
5767
|
const defaultValue = useMemo(() => field.value, []);
|
|
5777
|
-
const error = useMemo(() => (meta.initialTouched ? meta.error : undefined), [meta.error, meta.initialTouched]);
|
|
5778
5768
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5779
5769
|
const handleChange = useMemo(() => helpers.setValue, []);
|
|
5780
|
-
return jsx(Textarea, { defaultValue: defaultValue, error: error, name: name, onChange: handleChange, ...originalProps });
|
|
5770
|
+
return (jsx(Textarea, { defaultValue: defaultValue, error: meta.error, name: name, onChange: handleChange, ...originalProps }));
|
|
5781
5771
|
}
|
|
5782
5772
|
|
|
5783
5773
|
function FormikTextInput({ name, ...originalProps }) {
|
|
5784
5774
|
const [field, meta, helpers] = useField(name);
|
|
5785
5775
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5786
5776
|
const defaultValue = useMemo(() => field.value, []);
|
|
5787
|
-
const error = useMemo(() => (meta.initialTouched ? meta.error : undefined), [meta.error, meta.initialTouched]);
|
|
5788
5777
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5789
5778
|
const handleChange = useMemo(() => helpers.setValue, []);
|
|
5790
|
-
return jsx(TextInput, { defaultValue: defaultValue, error: error, name: name, onChange: handleChange, ...originalProps });
|
|
5779
|
+
return (jsx(TextInput, { defaultValue: defaultValue, error: meta.error, name: name, onChange: handleChange, ...originalProps }));
|
|
5791
5780
|
}
|
|
5792
5781
|
|
|
5793
5782
|
const noop = () => { };
|