@mtes-mct/monitor-ui 1.10.0 → 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 +10 -0
- package/ThemeProvider.d.ts +1 -1
- package/components/Dropdown/Item.d.ts +1 -1
- package/components/Dropdown/index.d.ts +1 -1
- package/elements/Button.d.ts +1 -1
- package/elements/Field.d.ts +1 -1
- package/elements/Fieldset.d.ts +1 -1
- package/elements/IconBox.d.ts +1 -1
- package/elements/IconButton.d.ts +1 -1
- package/elements/Label.d.ts +1 -1
- package/elements/Legend.d.ts +1 -1
- package/fields/Checkbox.d.ts +1 -1
- package/fields/DatePicker/CalendarPicker.d.ts +1 -1
- package/fields/DatePicker/index.d.ts +1 -1
- package/fields/DateRangePicker/DateInput.d.ts +1 -1
- package/fields/DateRangePicker/NumberInput.d.ts +1 -1
- package/fields/DateRangePicker/RangeCalendarPicker.d.ts +1 -1
- package/fields/DateRangePicker/RangedTimePicker.d.ts +1 -1
- package/fields/DateRangePicker/TimeInput.d.ts +1 -1
- package/fields/DateRangePicker/index.d.ts +1 -1
- package/fields/DateRangePicker/types.d.ts +4 -4
- package/fields/MultiCheckbox.d.ts +1 -1
- package/fields/MultiRadio.d.ts +1 -1
- package/fields/MultiSelect.d.ts +1 -1
- package/fields/Select.d.ts +1 -1
- package/fields/TextInput.d.ts +1 -1
- package/fields/Textarea.d.ts +1 -1
- package/formiks/FormikCheckbox.d.ts +1 -1
- package/formiks/FormikDatePicker.d.ts +1 -1
- package/formiks/FormikDateRangePicker.d.ts +1 -1
- package/formiks/FormikEffect.d.ts +1 -1
- package/formiks/FormikMultiCheckbox.d.ts +1 -1
- package/formiks/FormikMultiRadio.d.ts +1 -1
- package/formiks/FormikMultiSelect.d.ts +1 -1
- package/formiks/FormikSelect.d.ts +1 -1
- package/formiks/FormikTextInput.d.ts +1 -1
- package/formiks/FormikTextarea.d.ts +1 -1
- package/index.js +73 -76
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/theme.d.ts +2 -2
- package/types.d.ts +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## [1.10.1](https://github.com/MTES-MCT/monitor-ui/compare/v1.10.0...v1.10.1) (2022-12-06)
|
|
2
|
+
|
|
3
|
+
# [1.10.0](https://github.com/MTES-MCT/monitor-ui/compare/v1.9.2...v1.10.0) (2022-12-01)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **components:** add Dropdown ([#93](https://github.com/MTES-MCT/monitor-ui/issues/93)) ([1d5ec1b](https://github.com/MTES-MCT/monitor-ui/commit/1d5ec1b06b0f9ed06b44518de60cd69f0286e8fb))
|
|
9
|
+
* **elements:** add IconButton ([#92](https://github.com/MTES-MCT/monitor-ui/issues/92)) ([5ea52c3](https://github.com/MTES-MCT/monitor-ui/commit/5ea52c3bc2c20226641e46b114a6bea617caeb45))
|
|
10
|
+
|
|
1
11
|
## [1.9.2](https://github.com/MTES-MCT/monitor-ui/compare/v1.9.1...v1.9.2) (2022-12-01)
|
|
2
12
|
|
|
3
13
|
|
package/ThemeProvider.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IconProps } from '../../types';
|
|
2
2
|
import type { FunctionComponent } from 'react';
|
|
3
3
|
import type { DropdownMenuItemProps as RsuiteDropdownMenuItemProps } from 'rsuite';
|
|
4
|
-
export
|
|
4
|
+
export type DropdownItemProps = Omit<RsuiteDropdownMenuItemProps, 'as' | 'icon'> & {
|
|
5
5
|
Icon?: FunctionComponent<IconProps>;
|
|
6
6
|
};
|
|
7
7
|
export declare function Item({ Icon, ...originalProps }: DropdownItemProps): JSX.Element;
|
|
@@ -2,7 +2,7 @@ import type { IconProps } from '../../types';
|
|
|
2
2
|
import type { DropdownItemProps } from './Item';
|
|
3
3
|
import type { FunctionComponent } from 'react';
|
|
4
4
|
import type { DropdownProps as RsuiteDropdownProps } from 'rsuite';
|
|
5
|
-
export
|
|
5
|
+
export type DropdownProps = Omit<RsuiteDropdownProps, 'as' | 'icon'> & {
|
|
6
6
|
Icon?: FunctionComponent<IconProps>;
|
|
7
7
|
};
|
|
8
8
|
export declare const Dropdown: FunctionComponent<DropdownProps> & {
|
package/elements/Button.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Accent, Size } from '../contants';
|
|
2
2
|
import type { IconProps } from '../types';
|
|
3
3
|
import type { ButtonHTMLAttributes, FunctionComponent } from 'react';
|
|
4
|
-
export
|
|
4
|
+
export type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
5
5
|
Icon?: FunctionComponent<IconProps>;
|
|
6
6
|
accent?: Accent;
|
|
7
7
|
isFullWidth?: boolean;
|
package/elements/Field.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { HTMLAttributes } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export type FieldProps = HTMLAttributes<HTMLDivElement>;
|
|
3
3
|
export declare const Field: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
package/elements/Fieldset.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { FieldsetHTMLAttributes } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export type FieldsetProps = FieldsetHTMLAttributes<HTMLFieldSetElement>;
|
|
3
3
|
export declare function Fieldset(nativeProps: FieldsetProps): JSX.Element;
|
package/elements/IconBox.d.ts
CHANGED
package/elements/IconButton.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Accent, Size } from '../contants';
|
|
2
2
|
import type { IconProps } from '../types';
|
|
3
3
|
import type { ButtonHTMLAttributes, FunctionComponent } from 'react';
|
|
4
|
-
export
|
|
4
|
+
export type IconButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> & {
|
|
5
5
|
Icon: FunctionComponent<IconProps>;
|
|
6
6
|
accent?: Accent;
|
|
7
7
|
size?: Size;
|
package/elements/Label.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LabelHTMLAttributes } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export type LabelProps = LabelHTMLAttributes<HTMLLabelElement> & {
|
|
3
3
|
isHidden: boolean;
|
|
4
4
|
};
|
|
5
5
|
export declare const Label: import("styled-components").StyledComponent<"label", import("styled-components").DefaultTheme, {
|
package/elements/Legend.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HTMLAttributes } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export type LegendProps = HTMLAttributes<HTMLLegendElement> & {
|
|
3
3
|
isHidden?: boolean;
|
|
4
4
|
};
|
|
5
5
|
export declare function Legend({ isHidden, ...nativeProps }: LegendProps): JSX.Element;
|
package/fields/Checkbox.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CheckboxProps as RsuiteCheckboxProps } from 'rsuite';
|
|
2
2
|
import type { Promisable } from 'type-fest';
|
|
3
|
-
export
|
|
3
|
+
export type CheckboxProps = Omit<RsuiteCheckboxProps, 'as' | 'checked' | 'id' | 'onChange'> & {
|
|
4
4
|
label: string;
|
|
5
5
|
name: string;
|
|
6
6
|
onChange?: (isCheched: boolean) => Promisable<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DateTuple } from '../DateRangePicker/types';
|
|
2
2
|
import type { Promisable } from 'type-fest';
|
|
3
|
-
|
|
3
|
+
type CalendarPickerProps = {
|
|
4
4
|
defaultValue?: Date;
|
|
5
5
|
isHistorical?: boolean;
|
|
6
6
|
onChange: (nextDateTuple: DateTuple) => Promisable<void>;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import type { NumberInputProps } from './NumberInput';
|
|
3
3
|
import type { DateTuple, DateOrTimeInputRef } from './types';
|
|
4
4
|
import type { Promisable } from 'type-fest';
|
|
5
|
-
export
|
|
5
|
+
export type DateInputProps = Pick<NumberInputProps, 'onBack' | 'onPrevious' | 'onNext'> & {
|
|
6
6
|
defaultValue?: DateTuple;
|
|
7
7
|
isEndDate?: boolean;
|
|
8
8
|
isForcedFocused: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { InputHTMLAttributes } from 'react';
|
|
2
2
|
import type { Promisable } from 'type-fest';
|
|
3
|
-
export
|
|
3
|
+
export type NumberInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'maxLength' | 'onInput' | 'pattern' | 'type'> & {
|
|
4
4
|
max: number;
|
|
5
5
|
min: number;
|
|
6
6
|
/** Called when the use press backspace key while the input is empty. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DateRange } from '../../types';
|
|
2
2
|
import type { DateTupleRange } from './types';
|
|
3
3
|
import type { Promisable } from 'type-fest';
|
|
4
|
-
|
|
4
|
+
type RangeCalendarPickerProps = {
|
|
5
5
|
defaultValue?: DateRange;
|
|
6
6
|
isHistorical?: boolean;
|
|
7
7
|
onChange: (nextDateTupleRange: DateTupleRange) => Promisable<void>;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import type { NumberInputProps } from './NumberInput';
|
|
3
3
|
import type { DateOrTimeInputRef, TimeTuple } from './types';
|
|
4
4
|
import type { Promisable } from 'type-fest';
|
|
5
|
-
export
|
|
5
|
+
export type TimeInputProps = Pick<NumberInputProps, 'onBack' | 'onPrevious' | 'onNext'> & {
|
|
6
6
|
defaultValue?: TimeTuple;
|
|
7
7
|
isStartDate?: boolean;
|
|
8
8
|
minutesRange?: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DateRange } from '../../types';
|
|
2
2
|
import type { Promisable } from 'type-fest';
|
|
3
|
-
export
|
|
3
|
+
export type DateRangePickerProps = {
|
|
4
4
|
defaultValue?: DateRange;
|
|
5
5
|
/** Only allow past dates until today. */
|
|
6
6
|
isHistorical?: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type DateOrTimeInputRef = {
|
|
2
2
|
boxSpan: HTMLSpanElement;
|
|
3
3
|
/**
|
|
4
4
|
* Focus the first input in the group.
|
|
@@ -12,7 +12,7 @@ export declare enum DateRangePosition {
|
|
|
12
12
|
START = "START"
|
|
13
13
|
}
|
|
14
14
|
/** In the shape of ["YYYY", "MM", "DD"]. */
|
|
15
|
-
export
|
|
16
|
-
export
|
|
15
|
+
export type DateTuple = [string, string, string];
|
|
16
|
+
export type DateTupleRange = [DateTuple, DateTuple];
|
|
17
17
|
/** In the shape of ["hh", "mm"]. */
|
|
18
|
-
export
|
|
18
|
+
export type TimeTuple = [string, string];
|
package/fields/MultiRadio.d.ts
CHANGED
package/fields/MultiSelect.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Option } from '../types';
|
|
2
2
|
import type { TagPickerProps } from 'rsuite';
|
|
3
3
|
import type { Promisable } from 'type-fest';
|
|
4
|
-
export
|
|
4
|
+
export type MultiSelectProps = Omit<TagPickerProps, 'as' | 'data' | 'defaultValue' | 'id' | 'onChange' | 'value'> & {
|
|
5
5
|
defaultValue?: string[];
|
|
6
6
|
/** Width in REM */
|
|
7
7
|
fixedWidth?: number;
|
package/fields/Select.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Option } from '../types';
|
|
2
2
|
import type { SelectPickerProps } from 'rsuite';
|
|
3
3
|
import type { Promisable } from 'type-fest';
|
|
4
|
-
export
|
|
4
|
+
export type SelectProps = Omit<SelectPickerProps<any>, 'as' | 'data' | 'defaultValue' | 'id' | 'onChange' | 'value'> & {
|
|
5
5
|
defaultValue?: string;
|
|
6
6
|
isLabelHidden?: boolean;
|
|
7
7
|
label: string;
|
package/fields/TextInput.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { InputProps } from 'rsuite';
|
|
2
2
|
import type { Promisable } from 'type-fest';
|
|
3
|
-
export
|
|
3
|
+
export type TextInputProps = Omit<InputProps, 'as' | 'defaultValue' | 'id' | 'onChange' | 'value'> & {
|
|
4
4
|
defaultValue?: string;
|
|
5
5
|
isLabelHidden?: boolean;
|
|
6
6
|
label: string;
|
package/fields/Textarea.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TextareaHTMLAttributes } from 'react';
|
|
2
2
|
import type { Promisable } from 'type-fest';
|
|
3
|
-
export
|
|
3
|
+
export type TextareaProps = Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'defaultValue' | 'id' | 'onChange' | 'value'> & {
|
|
4
4
|
defaultValue?: string;
|
|
5
5
|
isLabelHidden?: boolean;
|
|
6
6
|
label: string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { CheckboxProps } from '../fields/Checkbox';
|
|
2
|
-
export
|
|
2
|
+
export type FormikCheckboxProps = Omit<CheckboxProps, 'checked' | 'defaultChecked' | 'onChange'>;
|
|
3
3
|
export declare function FormikCheckbox({ name, ...originalProps }: FormikCheckboxProps): JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DatePickerProps } from '../fields/DatePicker';
|
|
2
|
-
export
|
|
2
|
+
export type FormikDatePickerProps = Omit<DatePickerProps, 'onChange'> & {
|
|
3
3
|
name: string;
|
|
4
4
|
};
|
|
5
5
|
export declare function FormikDatePicker({ name, ...originalProps }: FormikDatePickerProps): JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DateRangePickerProps } from '../fields/DateRangePicker';
|
|
2
|
-
export
|
|
2
|
+
export type FormikDateRangePickerProps = Omit<DateRangePickerProps, 'onChange'> & {
|
|
3
3
|
name: string;
|
|
4
4
|
};
|
|
5
5
|
export declare function FormikDateRangePicker({ name, ...originalProps }: FormikDateRangePickerProps): JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Promisable } from 'type-fest';
|
|
2
|
-
export
|
|
2
|
+
export type FormikEffectProps = {
|
|
3
3
|
onChange: (nextValues: Record<string, any>) => Promisable<void>;
|
|
4
4
|
};
|
|
5
5
|
export declare function FormikEffect({ onChange }: FormikEffectProps): JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { MultiCheckboxProps } from '../fields/MultiCheckbox';
|
|
2
|
-
export
|
|
2
|
+
export type FormikMultiCheckboxProps = Omit<MultiCheckboxProps, 'defaultValue' | 'onChange'>;
|
|
3
3
|
export declare function FormikMultiCheckbox({ name, ...originalProps }: FormikMultiCheckboxProps): JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { MultiRadioProps } from '../fields/MultiRadio';
|
|
2
|
-
export
|
|
2
|
+
export type FormikMultiRadioProps = Omit<MultiRadioProps, 'defaultValue' | 'onChange'>;
|
|
3
3
|
export declare function FormikMultiRadio({ name, ...originalProps }: FormikMultiRadioProps): JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { MultiSelectProps } from '../fields/MultiSelect';
|
|
2
|
-
export
|
|
2
|
+
export type FormikMultiSelectProps = Omit<MultiSelectProps, 'defaultValue' | 'onChange'>;
|
|
3
3
|
export declare function FormikMultiSelect({ name, ...originalProps }: FormikMultiSelectProps): JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { SelectProps } from '../fields/Select';
|
|
2
|
-
export
|
|
2
|
+
export type FormikSelectProps = Omit<SelectProps, 'defaultValue' | 'onChange'>;
|
|
3
3
|
export declare function FormikSelect({ name, ...originalProps }: FormikSelectProps): JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { TextInputProps } from '../fields/TextInput';
|
|
2
|
-
export
|
|
2
|
+
export type FormikTextInputProps = Omit<TextInputProps, 'defaultValue' | 'onChange'>;
|
|
3
3
|
export declare function FormikTextInput({ name, ...originalProps }: FormikTextInputProps): JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { TextareaProps } from '../fields/Textarea';
|
|
2
|
-
export
|
|
2
|
+
export type FormikTextareaProps = Omit<TextareaProps, 'defaultValue' | 'onChange'>;
|
|
3
3
|
export declare function FormikTextarea({ name, ...originalProps }: FormikTextareaProps): JSX.Element;
|
package/index.js
CHANGED
|
@@ -1372,7 +1372,7 @@ const SecondaryButton = styled.button `
|
|
|
1372
1372
|
const TertiaryButton$1 = styled.button `
|
|
1373
1373
|
background-color: ${p => p.theme.color.white};
|
|
1374
1374
|
border: 1px solid ${p => p.theme.color.white};
|
|
1375
|
-
color: ${p => p.theme.color.
|
|
1375
|
+
color: ${p => p.theme.color.charcoal};
|
|
1376
1376
|
|
|
1377
1377
|
:hover,
|
|
1378
1378
|
&._hover {
|
|
@@ -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
|
+
},
|
|
3735
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3736
|
+
[]);
|
|
3740
3737
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3741
|
-
useEffect(() => () => setValue(undefined), []);
|
|
3742
|
-
return jsx(MultiRadio, { name: name, onChange: handleChange, ...originalProps });
|
|
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
|
+
},
|
|
3749
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3750
|
+
[]);
|
|
3754
3751
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3755
|
-
useEffect(() => () => setValue(undefined), []);
|
|
3756
|
-
return jsx(Select, { name: name, onChange: handleChange, ...originalProps });
|
|
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
|
+
},
|
|
3763
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3764
|
+
[]);
|
|
3768
3765
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3769
|
-
useEffect(() => () => setValue(undefined), []);
|
|
3770
|
-
return jsx(Textarea, { name: name, onChange: handleChange, ...originalProps });
|
|
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 `
|