@mtes-mct/monitor-ui 6.5.2 → 6.6.0
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/formiks/FormikEffect.d.ts +2 -1
- package/index.d.ts +0 -1
- package/index.js +16 -7
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/utils/noop.d.ts +0 -1
- package/utils/toggleInCollection.d.ts +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [6.5.2](https://github.com/MTES-MCT/monitor-ui/compare/v6.5.1...v6.5.2) (2023-05-27)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **fields:** add missing and normalize error styles ([8104328](https://github.com/MTES-MCT/monitor-ui/commit/810432817e7ea1dfa77427a1ea4fac83cdd41713))
|
|
7
|
+
|
|
1
8
|
## [6.5.1](https://github.com/MTES-MCT/monitor-ui/compare/v6.5.0...v6.5.1) (2023-05-26)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Promisable } from 'type-fest';
|
|
2
2
|
export type FormikEffectProps = {
|
|
3
3
|
onChange: (nextValues: Record<string, any>) => Promisable<void>;
|
|
4
|
+
onError?: ((nextValues: Record<string, any>) => Promisable<void>) | undefined;
|
|
4
5
|
};
|
|
5
|
-
export declare function FormikEffect({ onChange }: FormikEffectProps): JSX.Element;
|
|
6
|
+
export declare function FormikEffect({ onChange, onError }: FormikEffectProps): JSX.Element;
|
package/index.d.ts
CHANGED
|
@@ -62,7 +62,6 @@ export { getCoordinates, coordinatesAreDistinct } from './utils/coordinates';
|
|
|
62
62
|
export { getLocalizedDayjs } from './utils/getLocalizedDayjs';
|
|
63
63
|
export { getPseudoRandomString } from './utils/getPseudoRandomString';
|
|
64
64
|
export { getUtcizedDayjs } from './utils/getUtcizedDayjs';
|
|
65
|
-
export { noop } from './utils/noop';
|
|
66
65
|
export { isNumeric } from './utils/isNumeric';
|
|
67
66
|
export { stopMouseEventPropagation } from './utils/stopMouseEventPropagation';
|
|
68
67
|
export type { PartialTheme, Theme } from './theme';
|
package/index.js
CHANGED
|
@@ -34984,9 +34984,7 @@ const Box$1 = styled.div `
|
|
|
34984
34984
|
text-align: left;
|
|
34985
34985
|
`;
|
|
34986
34986
|
|
|
34987
|
-
|
|
34988
|
-
|
|
34989
|
-
function CoordinatesInput({ className, coordinatesFormat, defaultValue, error, isLabelHidden = false, isLight = false, label, onChange = noop, ...nativeProps }) {
|
|
34987
|
+
function CoordinatesInput({ className, coordinatesFormat, defaultValue, error, isLabelHidden = false, isLight = false, label, onChange = fp.noop, ...nativeProps }) {
|
|
34990
34988
|
const controlledClassName = classnames('Field-CoordinatesInput', className);
|
|
34991
34989
|
const controlledError = useMemo(() => normalizeString(error), [error]);
|
|
34992
34990
|
const hasError = useMemo(() => Boolean(controlledError), [controlledError]);
|
|
@@ -35332,11 +35330,22 @@ function FormikDateRangePicker({ name, ...originalProps }) {
|
|
|
35332
35330
|
return (jsx(UntypedDateRangePicker, { defaultValue: field.value, error: meta.error, onChange: handleChange, ...originalProps }));
|
|
35333
35331
|
}
|
|
35334
35332
|
|
|
35335
|
-
function FormikEffect({ onChange }) {
|
|
35336
|
-
const { values } = useFormikContext();
|
|
35333
|
+
function FormikEffect({ onChange, onError }) {
|
|
35334
|
+
const { errors, values } = useFormikContext();
|
|
35335
|
+
const previousErrors = usePrevious(errors);
|
|
35336
|
+
const previousValues = usePrevious(values);
|
|
35337
35337
|
useEffect(() => {
|
|
35338
|
+
if (fp.isEqual(previousValues, values)) {
|
|
35339
|
+
return;
|
|
35340
|
+
}
|
|
35338
35341
|
onChange(values);
|
|
35339
|
-
}, [onChange, values]);
|
|
35342
|
+
}, [onChange, previousValues, values]);
|
|
35343
|
+
useEffect(() => {
|
|
35344
|
+
if (!onError || fp.isEqual(previousErrors, errors)) {
|
|
35345
|
+
return;
|
|
35346
|
+
}
|
|
35347
|
+
onError(errors);
|
|
35348
|
+
}, [errors, onError, previousErrors]);
|
|
35340
35349
|
return jsx(Fragment, {});
|
|
35341
35350
|
}
|
|
35342
35351
|
|
|
@@ -35449,5 +35458,5 @@ function useNewWindow() {
|
|
|
35449
35458
|
return contextValue;
|
|
35450
35459
|
}
|
|
35451
35460
|
|
|
35452
|
-
export { Accent, Button, Checkbox, CoordinatesFormat, CoordinatesInput, CustomSearch, DatePicker, DateRangePicker, Dialog, Dropdown, Field$2 as Field, Fieldset, FormikCheckbox, FormikCoordinatesInput, FormikDatePicker, FormikDateRangePicker, FormikEffect, FormikMultiCheckbox, FormikMultiRadio, FormikMultiSelect, FormikNumberInput, FormikSearch, FormikSelect, FormikTextInput, FormikTextarea, GlobalStyle, index as Icon, IconButton, Label, Legend, MultiCheckbox, MultiRadio, MultiSelect, MultiZoneEditor, NewWindow, NewWindowContext, NumberInput, OPENLAYERS_PROJECTION, OnlyFontGlobalStyle, Search, Select, SimpleTable, SingleTag, Size, THEME, Tag, TagBullet, TagGroup, TextInput, Textarea, ThemeProvider, WSG84_PROJECTION, coordinatesAreDistinct, customDayjs, getCoordinates, getLocalizedDayjs, getPseudoRandomString, getUtcizedDayjs, isNumeric,
|
|
35461
|
+
export { Accent, Button, Checkbox, CoordinatesFormat, CoordinatesInput, CustomSearch, DatePicker, DateRangePicker, Dialog, Dropdown, Field$2 as Field, Fieldset, FormikCheckbox, FormikCoordinatesInput, FormikDatePicker, FormikDateRangePicker, FormikEffect, FormikMultiCheckbox, FormikMultiRadio, FormikMultiSelect, FormikNumberInput, FormikSearch, FormikSelect, FormikTextInput, FormikTextarea, GlobalStyle, index as Icon, IconButton, Label, Legend, MultiCheckbox, MultiRadio, MultiSelect, MultiZoneEditor, NewWindow, NewWindowContext, NumberInput, OPENLAYERS_PROJECTION, OnlyFontGlobalStyle, Search, Select, SimpleTable, SingleTag, Size, THEME, Tag, TagBullet, TagGroup, TextInput, Textarea, ThemeProvider, WSG84_PROJECTION, coordinatesAreDistinct, customDayjs, getCoordinates, getLocalizedDayjs, getPseudoRandomString, getUtcizedDayjs, isNumeric, stopMouseEventPropagation, useClickOutsideEffect, useFieldControl, useForceUpdate, useKey, useNewWindow, usePrevious };
|
|
35453
35462
|
//# sourceMappingURL=index.js.map
|