@mtes-mct/monitor-ui 1.4.0 → 1.5.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 +20 -0
- package/fields/MultiSelect.d.ts +12 -0
- package/fields/Select.d.ts +5 -13
- package/fields/TextInput.d.ts +9 -0
- package/fields/Textarea.d.ts +9 -0
- package/formiks/FormikCheckbox.d.ts +1 -3
- package/formiks/FormikMultiSelect.d.ts +3 -0
- package/formiks/FormikSelect.d.ts +1 -3
- package/formiks/FormikTextInput.d.ts +3 -0
- package/formiks/FormikTextarea.d.ts +3 -0
- package/index.d.ts +12 -0
- package/package.json +1 -1
- package/src/fields/MultiSelect.js +31 -0
- package/src/fields/MultiSelect.js.map +1 -0
- package/src/fields/Select.js +6 -20
- package/src/fields/Select.js.map +1 -1
- package/src/fields/TextInput.js +22 -0
- package/src/fields/TextInput.js.map +1 -0
- package/src/fields/Textarea.js +22 -0
- package/src/fields/Textarea.js.map +1 -0
- package/src/formiks/FormikCheckbox.js +5 -3
- package/src/formiks/FormikCheckbox.js.map +1 -1
- package/src/formiks/FormikDatePicker.js +1 -1
- package/src/formiks/FormikDatePicker.js.map +1 -1
- package/src/formiks/FormikMultiSelect.js +21 -0
- package/src/formiks/FormikMultiSelect.js.map +1 -0
- package/src/formiks/FormikSelect.js +2 -2
- package/src/formiks/FormikSelect.js.map +1 -1
- package/src/formiks/FormikTextInput.js +21 -0
- package/src/formiks/FormikTextInput.js.map +1 -0
- package/src/formiks/FormikTextarea.js +21 -0
- package/src/formiks/FormikTextarea.js.map +1 -0
- package/src/index.js +6 -0
- package/src/index.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
# [1.5.0](https://github.com/MTES-MCT/monitor-ui/compare/v1.4.0...v1.5.0) (2022-11-29)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **fields:** add MultiSelect ([#26](https://github.com/MTES-MCT/monitor-ui/issues/26)) ([e1123b1](https://github.com/MTES-MCT/monitor-ui/commit/e1123b1e09dd55135b6806fdbe7615eab5f65704))
|
|
7
|
+
* **fields:** add Textarea ([#30](https://github.com/MTES-MCT/monitor-ui/issues/30)) ([0cd9b13](https://github.com/MTES-MCT/monitor-ui/commit/0cd9b132b0607b109dbec4ec54e7184e71b8f9d9))
|
|
8
|
+
* **fields:** add TextInput ([#28](https://github.com/MTES-MCT/monitor-ui/issues/28)) ([cdd610f](https://github.com/MTES-MCT/monitor-ui/commit/cdd610f679bfb967f2f6403f9c4c397bfafb0948))
|
|
9
|
+
* **formiks:** add FormikMultiSelect ([#27](https://github.com/MTES-MCT/monitor-ui/issues/27)) ([414c4da](https://github.com/MTES-MCT/monitor-ui/commit/414c4dad1a6a639ae4b1f7cbf61f851d778f08b7))
|
|
10
|
+
* **formiks:** add FormikTextarea ([#31](https://github.com/MTES-MCT/monitor-ui/issues/31)) ([59aa260](https://github.com/MTES-MCT/monitor-ui/commit/59aa260cc8efeec29d795d73261bc77263b67ab4))
|
|
11
|
+
* **formiks:** add FormikTextInput ([#29](https://github.com/MTES-MCT/monitor-ui/issues/29)) ([8feddd3](https://github.com/MTES-MCT/monitor-ui/commit/8feddd39d05484a2c2469e019baacf5b60a10000))
|
|
12
|
+
|
|
13
|
+
# [1.4.0](https://github.com/MTES-MCT/monitor-ui/compare/v1.3.0...v1.4.0) (2022-11-28)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* **fields:** add Checkbox ([#21](https://github.com/MTES-MCT/monitor-ui/issues/21)) ([37a1746](https://github.com/MTES-MCT/monitor-ui/commit/37a1746676da210f437453cfa3812bd537b33661))
|
|
19
|
+
* **formiks:** add FormikCheckbox ([#22](https://github.com/MTES-MCT/monitor-ui/issues/22)) ([f018046](https://github.com/MTES-MCT/monitor-ui/commit/f01804690b045b0d2e7356eb5c6c1cac6c0a5dbe))
|
|
20
|
+
|
|
1
21
|
# [1.3.0](https://github.com/MTES-MCT/monitor-ui/compare/v1.2.0...v1.3.0) (2022-11-24)
|
|
2
22
|
|
|
3
23
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Option } from '../types';
|
|
2
|
+
import type { TagPickerProps } from 'rsuite';
|
|
3
|
+
import type { Promisable } from 'type-fest';
|
|
4
|
+
export declare type MultiSelectProps = Omit<TagPickerProps, 'as' | 'data' | 'defaultValue' | 'onChange' | 'value'> & {
|
|
5
|
+
defaultValue?: string[];
|
|
6
|
+
/** Width in REM */
|
|
7
|
+
fixedWidth?: number;
|
|
8
|
+
name: string;
|
|
9
|
+
onChange?: (nextValue: string[] | undefined) => Promisable<void>;
|
|
10
|
+
options: Option[];
|
|
11
|
+
};
|
|
12
|
+
export declare function MultiSelect({ fixedWidth, onChange, options, searchable, ...originalProps }: MultiSelectProps): JSX.Element;
|
package/fields/Select.d.ts
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import type { Option } from '../types';
|
|
2
|
-
import type { SelectPickerProps
|
|
2
|
+
import type { SelectPickerProps } from 'rsuite';
|
|
3
3
|
import type { Promisable } from 'type-fest';
|
|
4
|
-
declare type
|
|
4
|
+
export declare type SelectProps = Omit<SelectPickerProps<any>, 'as' | 'data' | 'defaultValue' | 'onChange' | 'value'> & {
|
|
5
|
+
defaultValue?: string;
|
|
5
6
|
name: string;
|
|
7
|
+
onChange?: (nextValue: string | undefined) => Promisable<void>;
|
|
6
8
|
options: Option[];
|
|
7
9
|
};
|
|
8
|
-
export declare
|
|
9
|
-
isMulti: true;
|
|
10
|
-
onChange?: (values: string[] | undefined) => Promisable<void>;
|
|
11
|
-
};
|
|
12
|
-
export declare type SingleSelectProps = Omit<RsuiteSelectPickerProps<any>, 'as' | 'data' | 'onChange' | 'value'> & SelectCommonProps & {
|
|
13
|
-
isMulti?: false;
|
|
14
|
-
onChange?: (value: string | undefined) => Promisable<void>;
|
|
15
|
-
};
|
|
16
|
-
export declare type SelectProps = MultiSelectProps | SingleSelectProps;
|
|
17
|
-
export declare function Select({ isMulti, onChange, options, searchable, ...originalProps }: SelectProps): JSX.Element;
|
|
18
|
-
export {};
|
|
10
|
+
export declare function Select({ onChange, options, searchable, ...originalProps }: SelectProps): JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { InputProps } from 'rsuite';
|
|
2
|
+
import type { Promisable } from 'type-fest';
|
|
3
|
+
export declare type TextInputProps = Omit<InputProps, 'as' | 'defaultValue' | 'onChange' | 'value'> & {
|
|
4
|
+
defaultValue?: string;
|
|
5
|
+
name: string;
|
|
6
|
+
onChange?: (nextValue: string | undefined) => Promisable<void>;
|
|
7
|
+
};
|
|
8
|
+
export declare function TextInput({ onChange, ...originalProps }: TextInputProps): JSX.Element;
|
|
9
|
+
export declare const StyledInput: import("styled-components").StyledComponent<import("rsuite/esm/@types/common").RsRefForwardingComponent<"input", InputProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TextareaHTMLAttributes } from 'react';
|
|
2
|
+
import type { Promisable } from 'type-fest';
|
|
3
|
+
export declare type TextareaProps = Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'defaultValue' | 'onChange' | 'value'> & {
|
|
4
|
+
defaultValue?: string;
|
|
5
|
+
name: string;
|
|
6
|
+
onChange?: (nextValue: string | undefined) => Promisable<void>;
|
|
7
|
+
};
|
|
8
|
+
export declare function Textarea({ onChange, rows, ...originalProps }: TextareaProps): JSX.Element;
|
|
9
|
+
export declare const StyledInput: import("styled-components").StyledComponent<import("rsuite/esm/@types/common").RsRefForwardingComponent<"input", import("rsuite").InputProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import type { CheckboxProps } from '../fields/Checkbox';
|
|
2
|
-
export declare type FormikCheckboxProps = Omit<CheckboxProps, 'checked' | 'defaultChecked' | 'onChange'
|
|
3
|
-
name: string;
|
|
4
|
-
};
|
|
2
|
+
export declare type FormikCheckboxProps = Omit<CheckboxProps, 'checked' | 'defaultChecked' | 'onChange'>;
|
|
5
3
|
export declare function FormikCheckbox({ name, ...originalProps }: FormikCheckboxProps): JSX.Element;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import type { SelectProps } from '../fields/Select';
|
|
2
|
-
export declare type FormikSelectProps = Omit<SelectProps, 'defaultValue' | 'onChange'
|
|
3
|
-
name: string;
|
|
4
|
-
};
|
|
2
|
+
export declare type FormikSelectProps = Omit<SelectProps, 'defaultValue' | 'onChange'>;
|
|
5
3
|
export declare function FormikSelect({ name, ...originalProps }: FormikSelectProps): JSX.Element;
|
package/index.d.ts
CHANGED
|
@@ -3,20 +3,32 @@ export { THEME } from './theme';
|
|
|
3
3
|
export { Checkbox } from './fields/Checkbox';
|
|
4
4
|
export { DateRangePicker } from './fields/DateRangePicker';
|
|
5
5
|
export { DatePicker } from './fields/DatePicker';
|
|
6
|
+
export { MultiSelect } from './fields/MultiSelect';
|
|
6
7
|
export { Select } from './fields/Select';
|
|
8
|
+
export { Textarea } from './fields/Textarea';
|
|
9
|
+
export { TextInput } from './fields/TextInput';
|
|
7
10
|
export { FormikCheckbox } from './formiks/FormikCheckbox';
|
|
8
11
|
export { FormikDatePicker } from './formiks/FormikDatePicker';
|
|
9
12
|
export { FormikDateRangePicker } from './formiks/FormikDateRangePicker';
|
|
10
13
|
export { FormikEffect } from './formiks/FormikEffect';
|
|
14
|
+
export { FormikMultiSelect } from './formiks/FormikMultiSelect';
|
|
11
15
|
export { FormikSelect } from './formiks/FormikSelect';
|
|
16
|
+
export { FormikTextarea } from './formiks/FormikTextarea';
|
|
17
|
+
export { FormikTextInput } from './formiks/FormikTextInput';
|
|
12
18
|
export { ThemeProvider } from './ThemeProvider';
|
|
13
19
|
export type { PartialTheme, Theme } from './theme';
|
|
14
20
|
export type { CheckboxProps } from './fields/Checkbox';
|
|
15
21
|
export type { DateRangePickerProps } from './fields/DateRangePicker';
|
|
16
22
|
export type { DatePickerProps } from './fields/DatePicker';
|
|
23
|
+
export type { MultiSelectProps } from './fields/MultiSelect';
|
|
17
24
|
export type { SelectProps } from './fields/Select';
|
|
25
|
+
export type { TextareaProps } from './fields/Textarea';
|
|
26
|
+
export type { TextInputProps } from './fields/TextInput';
|
|
18
27
|
export type { FormikCheckboxProps } from './formiks/FormikCheckbox';
|
|
19
28
|
export type { FormikDatePickerProps } from './formiks/FormikDatePicker';
|
|
20
29
|
export type { FormikDateRangePickerProps } from './formiks/FormikDateRangePicker';
|
|
21
30
|
export type { FormikEffectProps } from './formiks/FormikEffect';
|
|
31
|
+
export type { FormikMultiSelectProps } from './formiks/FormikMultiSelect';
|
|
22
32
|
export type { FormikSelectProps } from './formiks/FormikSelect';
|
|
33
|
+
export type { FormikTextareaProps } from './formiks/FormikTextarea';
|
|
34
|
+
export type { FormikTextInputProps } from './formiks/FormikTextInput';
|
package/package.json
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useMemo, useCallback } from 'react';
|
|
3
|
+
import { TagPicker } from 'rsuite';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
|
|
6
|
+
function MultiSelect({ fixedWidth = 5, onChange, options,
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
8
|
+
searchable = false, ...originalProps }) {
|
|
9
|
+
const key = useMemo(() => `${originalProps.name}-${JSON.stringify(originalProps.defaultValue)}`, [originalProps.defaultValue, originalProps.name]);
|
|
10
|
+
const handleChange = useCallback((nextValue) => {
|
|
11
|
+
if (!onChange) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const normalizedNextValue = !nextValue || !nextValue.length ? undefined : nextValue;
|
|
15
|
+
onChange(normalizedNextValue);
|
|
16
|
+
}, [onChange]);
|
|
17
|
+
return (jsx(StyledTagPicker, { data: options, fixedWidth: fixedWidth, onChange: handleChange, searchable: searchable, ...originalProps }, key));
|
|
18
|
+
}
|
|
19
|
+
// TODO A width seems to be mandatory in rsuite which is a very dirty behavior.
|
|
20
|
+
// We should hack that.
|
|
21
|
+
const StyledTagPicker = styled(TagPicker) `
|
|
22
|
+
cursor: pointer;
|
|
23
|
+
width: ${p => p.fixedWidth}rem;
|
|
24
|
+
|
|
25
|
+
> .rs-picker-toggle {
|
|
26
|
+
cursor: inherit;
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
29
|
+
|
|
30
|
+
export { MultiSelect };
|
|
31
|
+
//# sourceMappingURL=MultiSelect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MultiSelect.js","sources":["../../../src/fields/MultiSelect.tsx"],"sourcesContent":["import { useCallback, useMemo } from 'react'\nimport { TagPicker } from 'rsuite'\nimport styled from 'styled-components'\n\nimport type { Option } from '../types'\nimport type { TagPickerProps } from 'rsuite'\nimport type { Promisable } from 'type-fest'\n\nexport type MultiSelectProps = Omit<TagPickerProps, 'as' | 'data' | 'defaultValue' | 'onChange' | 'value'> & {\n defaultValue?: string[]\n /** Width in REM */\n fixedWidth?: number\n name: string\n onChange?: (nextValue: string[] | undefined) => Promisable<void>\n options: Option[]\n}\nexport function MultiSelect({\n fixedWidth = 5,\n onChange,\n options,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n searchable = false,\n ...originalProps\n}: MultiSelectProps) {\n const key = useMemo(\n () => `${originalProps.name}-${JSON.stringify(originalProps.defaultValue)}`,\n [originalProps.defaultValue, originalProps.name]\n )\n\n const handleChange = useCallback(\n (nextValue: string[] | null) => {\n if (!onChange) {\n return\n }\n\n const normalizedNextValue = !nextValue || !nextValue.length ? undefined : nextValue\n\n onChange(normalizedNextValue)\n },\n [onChange]\n )\n\n return (\n <StyledTagPicker\n key={key}\n data={options}\n fixedWidth={fixedWidth}\n onChange={handleChange}\n searchable={searchable}\n {...originalProps}\n />\n )\n}\n\n// TODO A width seems to be mandatory in rsuite which is a very dirty behavior.\n// We should hack that.\nconst StyledTagPicker = styled(TagPicker)<{\n fixedWidth: number\n}>`\n cursor: pointer;\n width: ${p => p.fixedWidth}rem;\n\n > .rs-picker-toggle {\n cursor: inherit;\n }\n`\n"],"names":["_jsx"],"mappings":";;;;;AAgBM,SAAU,WAAW,CAAC,EAC1B,UAAU,GAAG,CAAC,EACd,QAAQ,EACR,OAAO;AACP;AACA,UAAU,GAAG,KAAK,EAClB,GAAG,aAAa,EACC,EAAA;AACjB,IAAA,MAAM,GAAG,GAAG,OAAO,CACjB,MAAM,CAAG,EAAA,aAAa,CAAC,IAAI,CAAI,CAAA,EAAA,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,YAAY,CAAC,CAAE,CAAA,EAC3E,CAAC,aAAa,CAAC,YAAY,EAAE,aAAa,CAAC,IAAI,CAAC,CACjD,CAAA;AAED,IAAA,MAAM,YAAY,GAAG,WAAW,CAC9B,CAAC,SAA0B,KAAI;QAC7B,IAAI,CAAC,QAAQ,EAAE;YACb,OAAM;AACP,SAAA;AAED,QAAA,MAAM,mBAAmB,GAAG,CAAC,SAAS,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,SAAS,GAAG,SAAS,CAAA;QAEnF,QAAQ,CAAC,mBAAmB,CAAC,CAAA;AAC/B,KAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAA;IAED,QACEA,GAAC,CAAA,eAAe,EAEd,EAAA,IAAI,EAAE,OAAO,EACb,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,YAAY,EACtB,UAAU,EAAE,UAAU,EAClB,GAAA,aAAa,EALZ,EAAA,GAAG,CAMR,EACH;AACH,CAAC;AAED;AACA;AACA,MAAM,eAAe,GAAG,MAAM,CAAC,SAAS,CAAC,CAEvC,CAAA;;AAES,SAAA,EAAA,CAAC,IAAI,CAAC,CAAC,UAAU,CAAA;;;;;CAK3B;;;;"}
|
package/src/fields/Select.js
CHANGED
|
@@ -1,39 +1,25 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { useMemo, useCallback } from 'react';
|
|
3
|
-
import { SelectPicker
|
|
3
|
+
import { SelectPicker } from 'rsuite';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
|
|
6
|
-
function Select({
|
|
6
|
+
function Select({ onChange, options,
|
|
7
7
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
8
8
|
searchable = false, ...originalProps }) {
|
|
9
9
|
const key = useMemo(() => `${originalProps.name}-${JSON.stringify(originalProps.defaultValue)}`, [originalProps.defaultValue, originalProps.name]);
|
|
10
|
-
const handleChange = useCallback((
|
|
10
|
+
const handleChange = useCallback((nextValue) => {
|
|
11
11
|
if (!onChange) {
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
|
-
const
|
|
15
|
-
onChange(
|
|
14
|
+
const normalizedNextValue = nextValue ?? undefined;
|
|
15
|
+
onChange(normalizedNextValue);
|
|
16
16
|
}, [onChange]);
|
|
17
|
-
if (isMulti) {
|
|
18
|
-
return jsx(StyledTagPicker, { data: options, onChange: handleChange, searchable: searchable, ...originalProps });
|
|
19
|
-
}
|
|
20
17
|
return (jsx(StyledSelectPicker, { data: options,
|
|
21
18
|
// The `unknown` type from Rsuite library is wrong. It should be inferred from `data` prop type.
|
|
22
19
|
// `onChange: ((value: unknown, event: React.SyntheticEvent<Element, Event>) => void) | undefined`
|
|
23
20
|
onChange: handleChange, searchable: searchable, ...originalProps }, key));
|
|
24
21
|
}
|
|
25
|
-
const StyledSelectPicker = styled(SelectPicker)
|
|
26
|
-
display: inline-flex;
|
|
27
|
-
width: 9.25rem;
|
|
28
|
-
`;
|
|
29
|
-
const StyledTagPicker = styled(TagPicker) `
|
|
30
|
-
cursor: pointer;
|
|
31
|
-
width: 9.25rem;
|
|
32
|
-
|
|
33
|
-
> .rs-picker-toggle {
|
|
34
|
-
cursor: inherit;
|
|
35
|
-
}
|
|
36
|
-
`;
|
|
22
|
+
const StyledSelectPicker = styled(SelectPicker) ``;
|
|
37
23
|
|
|
38
24
|
export { Select };
|
|
39
25
|
//# sourceMappingURL=Select.js.map
|
package/src/fields/Select.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","sources":["../../../src/fields/Select.tsx"],"sourcesContent":["import { useCallback, useMemo } from 'react'\nimport { SelectPicker
|
|
1
|
+
{"version":3,"file":"Select.js","sources":["../../../src/fields/Select.tsx"],"sourcesContent":["import { useCallback, useMemo } from 'react'\nimport { SelectPicker } from 'rsuite'\nimport styled from 'styled-components'\n\nimport type { Option } from '../types'\nimport type { SelectPickerProps } from 'rsuite'\nimport type { Promisable } from 'type-fest'\n\nexport type SelectProps = Omit<SelectPickerProps<any>, 'as' | 'data' | 'defaultValue' | 'onChange' | 'value'> & {\n defaultValue?: string\n name: string\n onChange?: (nextValue: string | undefined) => Promisable<void>\n options: Option[]\n}\nexport function Select({\n onChange,\n options,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n searchable = false,\n ...originalProps\n}: SelectProps) {\n const key = useMemo(\n () => `${originalProps.name}-${JSON.stringify(originalProps.defaultValue)}`,\n [originalProps.defaultValue, originalProps.name]\n )\n\n const handleChange = useCallback(\n (nextValue: string | null) => {\n if (!onChange) {\n return\n }\n\n const normalizedNextValue = nextValue ?? undefined\n\n onChange(normalizedNextValue)\n },\n [onChange]\n )\n\n return (\n <StyledSelectPicker\n key={key}\n data={options}\n // The `unknown` type from Rsuite library is wrong. It should be inferred from `data` prop type.\n // `onChange: ((value: unknown, event: React.SyntheticEvent<Element, Event>) => void) | undefined`\n onChange={handleChange as any}\n searchable={searchable}\n {...originalProps}\n />\n )\n}\n\nconst StyledSelectPicker = styled(SelectPicker)``\n"],"names":["_jsx"],"mappings":";;;;;SAcgB,MAAM,CAAC,EACrB,QAAQ,EACR,OAAO;AACP;AACA,UAAU,GAAG,KAAK,EAClB,GAAG,aAAa,EACJ,EAAA;AACZ,IAAA,MAAM,GAAG,GAAG,OAAO,CACjB,MAAM,CAAG,EAAA,aAAa,CAAC,IAAI,CAAI,CAAA,EAAA,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,YAAY,CAAC,CAAE,CAAA,EAC3E,CAAC,aAAa,CAAC,YAAY,EAAE,aAAa,CAAC,IAAI,CAAC,CACjD,CAAA;AAED,IAAA,MAAM,YAAY,GAAG,WAAW,CAC9B,CAAC,SAAwB,KAAI;QAC3B,IAAI,CAAC,QAAQ,EAAE;YACb,OAAM;AACP,SAAA;AAED,QAAA,MAAM,mBAAmB,GAAG,SAAS,IAAI,SAAS,CAAA;QAElD,QAAQ,CAAC,mBAAmB,CAAC,CAAA;AAC/B,KAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAA;AAED,IAAA,QACEA,GAAC,CAAA,kBAAkB,EAEjB,EAAA,IAAI,EAAE,OAAO;;;AAGb,QAAA,QAAQ,EAAE,YAAmB,EAC7B,UAAU,EAAE,UAAU,EAClB,GAAA,aAAa,EANZ,EAAA,GAAG,CAOR,EACH;AACH,CAAC;AAED,MAAM,kBAAkB,GAAG,MAAM,CAAC,YAAY,CAAC,CAAA,EAAE;;;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useMemo, useCallback } from 'react';
|
|
3
|
+
import { Input } from 'rsuite';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
|
|
6
|
+
function TextInput({ onChange, ...originalProps }) {
|
|
7
|
+
const key = useMemo(() => `${originalProps.name}-${JSON.stringify(originalProps.defaultValue)}`, [originalProps.defaultValue, originalProps.name]);
|
|
8
|
+
const handleChange = useCallback((nextValue) => {
|
|
9
|
+
if (!onChange) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const normalizedNextValue = nextValue && nextValue.trim().length ? nextValue : undefined;
|
|
13
|
+
onChange(normalizedNextValue);
|
|
14
|
+
}, [onChange]);
|
|
15
|
+
return jsx(StyledInput, { onChange: handleChange, ...originalProps }, key);
|
|
16
|
+
}
|
|
17
|
+
const StyledInput = styled(Input) `
|
|
18
|
+
background-color: ${p => p.theme.color.white};
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
export { StyledInput, TextInput };
|
|
22
|
+
//# sourceMappingURL=TextInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextInput.js","sources":["../../../src/fields/TextInput.tsx"],"sourcesContent":["import { useCallback, useMemo } from 'react'\nimport { Input } from 'rsuite'\nimport styled from 'styled-components'\n\nimport type { InputProps } from 'rsuite'\nimport type { Promisable } from 'type-fest'\n\nexport type TextInputProps = Omit<InputProps, 'as' | 'defaultValue' | 'onChange' | 'value'> & {\n defaultValue?: string\n name: string\n onChange?: (nextValue: string | undefined) => Promisable<void>\n}\nexport function TextInput({ onChange, ...originalProps }: TextInputProps) {\n const key = useMemo(\n () => `${originalProps.name}-${JSON.stringify(originalProps.defaultValue)}`,\n [originalProps.defaultValue, originalProps.name]\n )\n\n const handleChange = useCallback(\n (nextValue: string | null) => {\n if (!onChange) {\n return\n }\n\n const normalizedNextValue = nextValue && nextValue.trim().length ? nextValue : undefined\n\n onChange(normalizedNextValue)\n },\n [onChange]\n )\n\n return <StyledInput key={key} onChange={handleChange} {...originalProps} />\n}\n\nexport const StyledInput = styled(Input)`\n background-color: ${p => p.theme.color.white};\n`\n"],"names":["_jsx"],"mappings":";;;;;AAYM,SAAU,SAAS,CAAC,EAAE,QAAQ,EAAE,GAAG,aAAa,EAAkB,EAAA;AACtE,IAAA,MAAM,GAAG,GAAG,OAAO,CACjB,MAAM,CAAG,EAAA,aAAa,CAAC,IAAI,CAAI,CAAA,EAAA,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,YAAY,CAAC,CAAE,CAAA,EAC3E,CAAC,aAAa,CAAC,YAAY,EAAE,aAAa,CAAC,IAAI,CAAC,CACjD,CAAA;AAED,IAAA,MAAM,YAAY,GAAG,WAAW,CAC9B,CAAC,SAAwB,KAAI;QAC3B,IAAI,CAAC,QAAQ,EAAE;YACb,OAAM;AACP,SAAA;AAED,QAAA,MAAM,mBAAmB,GAAG,SAAS,IAAI,SAAS,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,SAAS,GAAG,SAAS,CAAA;QAExF,QAAQ,CAAC,mBAAmB,CAAC,CAAA;AAC/B,KAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAA;IAED,OAAOA,GAAA,CAAC,WAAW,EAAA,EAAW,QAAQ,EAAE,YAAY,EAAA,GAAM,aAAa,EAAA,EAA9C,GAAG,CAA+C,CAAA;AAC7E,CAAC;MAEY,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA,CAAA;sBAClB,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAA;;;;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useRef, useMemo, useCallback } from 'react';
|
|
3
|
+
import { Input } from 'rsuite';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
|
|
6
|
+
function Textarea({ onChange, rows = 3, ...originalProps }) {
|
|
7
|
+
const inputRef = useRef();
|
|
8
|
+
const key = useMemo(() => `${originalProps.name}-${JSON.stringify(originalProps.defaultValue)}`, [originalProps.defaultValue, originalProps.name]);
|
|
9
|
+
const handleChange = useCallback(() => {
|
|
10
|
+
if (!onChange) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const nextValue = inputRef.current.value.trim();
|
|
14
|
+
const normalizedNextValue = nextValue.length ? nextValue : undefined;
|
|
15
|
+
onChange(normalizedNextValue);
|
|
16
|
+
}, [onChange]);
|
|
17
|
+
return jsx(StyledInput, { ref: inputRef, as: "textarea", onChange: handleChange, rows: rows, ...originalProps }, key);
|
|
18
|
+
}
|
|
19
|
+
const StyledInput = styled(Input) ``;
|
|
20
|
+
|
|
21
|
+
export { StyledInput, Textarea };
|
|
22
|
+
//# sourceMappingURL=Textarea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Textarea.js","sources":["../../../src/fields/Textarea.tsx"],"sourcesContent":["import { useCallback, useMemo, useRef } from 'react'\nimport { Input } from 'rsuite'\nimport styled from 'styled-components'\n\nimport type { MutableRefObject, TextareaHTMLAttributes } from 'react'\nimport type { Promisable } from 'type-fest'\n\nexport type TextareaProps = Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'defaultValue' | 'onChange' | 'value'> & {\n defaultValue?: string\n name: string\n onChange?: (nextValue: string | undefined) => Promisable<void>\n}\nexport function Textarea({ onChange, rows = 3, ...originalProps }: TextareaProps) {\n const inputRef = useRef() as MutableRefObject<HTMLTextAreaElement>\n\n const key = useMemo(\n () => `${originalProps.name}-${JSON.stringify(originalProps.defaultValue)}`,\n [originalProps.defaultValue, originalProps.name]\n )\n\n const handleChange = useCallback(() => {\n if (!onChange) {\n return\n }\n\n const nextValue = inputRef.current.value.trim()\n const normalizedNextValue = nextValue.length ? nextValue : undefined\n\n onChange(normalizedNextValue)\n }, [onChange])\n\n return <StyledInput key={key} ref={inputRef} as=\"textarea\" onChange={handleChange} rows={rows} {...originalProps} />\n}\n\nexport const StyledInput = styled(Input)``\n"],"names":["_jsx"],"mappings":";;;;;AAYgB,SAAA,QAAQ,CAAC,EAAE,QAAQ,EAAE,IAAI,GAAG,CAAC,EAAE,GAAG,aAAa,EAAiB,EAAA;AAC9E,IAAA,MAAM,QAAQ,GAAG,MAAM,EAA2C,CAAA;AAElE,IAAA,MAAM,GAAG,GAAG,OAAO,CACjB,MAAM,CAAG,EAAA,aAAa,CAAC,IAAI,CAAI,CAAA,EAAA,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,YAAY,CAAC,CAAE,CAAA,EAC3E,CAAC,aAAa,CAAC,YAAY,EAAE,aAAa,CAAC,IAAI,CAAC,CACjD,CAAA;AAED,IAAA,MAAM,YAAY,GAAG,WAAW,CAAC,MAAK;QACpC,IAAI,CAAC,QAAQ,EAAE;YACb,OAAM;AACP,SAAA;QAED,MAAM,SAAS,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAA;AAC/C,QAAA,MAAM,mBAAmB,GAAG,SAAS,CAAC,MAAM,GAAG,SAAS,GAAG,SAAS,CAAA;QAEpE,QAAQ,CAAC,mBAAmB,CAAC,CAAA;AAC/B,KAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAA;IAEd,OAAOA,GAAA,CAAC,WAAW,EAAW,EAAA,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAC,UAAU,EAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,KAAM,aAAa,EAAA,EAAvF,GAAG,CAAwF,CAAA;AACtH,CAAC;AAEY,MAAA,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA,CAAA;;;;"}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { useField } from 'formik';
|
|
3
|
-
import { useMemo, useCallback } from 'react';
|
|
3
|
+
import { useMemo, useCallback, useEffect } from 'react';
|
|
4
4
|
import { Checkbox } from '../fields/Checkbox.js';
|
|
5
5
|
|
|
6
6
|
function FormikCheckbox({ name, ...originalProps }) {
|
|
7
7
|
const [field, , helpers] = useField(name);
|
|
8
8
|
const value = useMemo(() => field.value, [field.value]);
|
|
9
|
+
// We don't include `setValues` in `useCallback()` and `useEffect()` dependencies
|
|
10
|
+
// both because it is useless and it will trigger infinite hook calls
|
|
9
11
|
const setValue = useMemo(() => helpers.setValue, [helpers.setValue]);
|
|
10
|
-
// We don't include `setValues` in `useCallback()` dependencok calls
|
|
11
|
-
// both because it is useless and it will trigger infinite ho
|
|
12
12
|
const handleChange = useCallback((isChecked) => {
|
|
13
13
|
setValue(isChecked);
|
|
14
14
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
15
15
|
}, []);
|
|
16
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
17
|
+
useEffect(() => () => setValue(undefined), []);
|
|
16
18
|
return jsx(Checkbox, { defaultChecked: value, name: name, onChange: handleChange, ...originalProps });
|
|
17
19
|
}
|
|
18
20
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormikCheckbox.js","sources":["../../../src/formiks/FormikCheckbox.tsx"],"sourcesContent":["import { useField } from 'formik'\nimport { useCallback, useMemo } from 'react'\n\nimport { Checkbox } from '../fields/Checkbox'\n\nimport type { CheckboxProps } from '../fields/Checkbox'\n\nexport type FormikCheckboxProps = Omit<CheckboxProps, 'checked' | 'defaultChecked' | 'onChange'
|
|
1
|
+
{"version":3,"file":"FormikCheckbox.js","sources":["../../../src/formiks/FormikCheckbox.tsx"],"sourcesContent":["import { useField } from 'formik'\nimport { useCallback, useEffect, useMemo } from 'react'\n\nimport { Checkbox } from '../fields/Checkbox'\n\nimport type { CheckboxProps } from '../fields/Checkbox'\n\nexport type FormikCheckboxProps = Omit<CheckboxProps, 'checked' | 'defaultChecked' | 'onChange'>\nexport function FormikCheckbox({ name, ...originalProps }: FormikCheckboxProps) {\n const [field, , helpers] = useField(name)\n\n const value = useMemo(() => field.value, [field.value])\n // We don't include `setValues` in `useCallback()` and `useEffect()` dependencies\n // both because it is useless and it will trigger infinite hook calls\n const setValue = useMemo(() => helpers.setValue, [helpers.setValue])\n\n const handleChange = useCallback((isChecked: boolean) => {\n setValue(isChecked)\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => () => setValue(undefined), [])\n\n return <Checkbox defaultChecked={value} name={name} onChange={handleChange} {...originalProps} />\n}\n"],"names":["_jsx"],"mappings":";;;;;AAQM,SAAU,cAAc,CAAC,EAAE,IAAI,EAAE,GAAG,aAAa,EAAuB,EAAA;AAC5E,IAAA,MAAM,CAAC,KAAK,IAAI,OAAO,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAA;AAEzC,IAAA,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAA;;;AAGvD,IAAA,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,OAAO,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAA;AAEpE,IAAA,MAAM,YAAY,GAAG,WAAW,CAAC,CAAC,SAAkB,KAAI;QACtD,QAAQ,CAAC,SAAS,CAAC,CAAA;;KAGpB,EAAE,EAAE,CAAC,CAAA;;AAGN,IAAA,SAAS,CAAC,MAAM,MAAM,QAAQ,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC,CAAA;AAE9C,IAAA,OAAOA,IAAC,QAAQ,EAAA,EAAC,cAAc,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAM,GAAA,aAAa,GAAI,CAAA;AACnG;;;;"}
|
|
@@ -6,7 +6,7 @@ import { DatePicker } from '../fields/DatePicker/index.js';
|
|
|
6
6
|
function FormikDatePicker({ name, ...originalProps }) {
|
|
7
7
|
const [, , helpers] = useField(name);
|
|
8
8
|
const { setValue } = helpers;
|
|
9
|
-
// We don't include `setValues` in
|
|
9
|
+
// We don't include `setValues` in `useEffect()` dependencies
|
|
10
10
|
// both because it is useless and it will trigger infinite hook calls
|
|
11
11
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
12
12
|
useEffect(() => () => setValue(undefined), []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormikDatePicker.js","sources":["../../../src/formiks/FormikDatePicker.tsx"],"sourcesContent":["import { useField } from 'formik'\nimport { useEffect } from 'react'\n\nimport { DatePicker } from '../fields/DatePicker'\n\nimport type { DatePickerProps } from '../fields/DatePicker'\n\nexport type FormikDatePickerProps = Omit<DatePickerProps, 'onChange'> & {\n name: string\n}\nexport function FormikDatePicker({ name, ...originalProps }: FormikDatePickerProps) {\n const [, , helpers] = useField(name)\n const { setValue } = helpers\n\n // We don't include `setValues` in
|
|
1
|
+
{"version":3,"file":"FormikDatePicker.js","sources":["../../../src/formiks/FormikDatePicker.tsx"],"sourcesContent":["import { useField } from 'formik'\nimport { useEffect } from 'react'\n\nimport { DatePicker } from '../fields/DatePicker'\n\nimport type { DatePickerProps } from '../fields/DatePicker'\n\nexport type FormikDatePickerProps = Omit<DatePickerProps, 'onChange'> & {\n name: string\n}\nexport function FormikDatePicker({ name, ...originalProps }: FormikDatePickerProps) {\n const [, , helpers] = useField(name)\n const { setValue } = helpers\n\n // We don't include `setValues` in `useEffect()` dependencies\n // both because it is useless and it will trigger infinite hook calls\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => () => setValue(undefined), [])\n\n return <DatePicker onChange={setValue} {...originalProps} />\n}\n"],"names":["_jsx"],"mappings":";;;;;AAUM,SAAU,gBAAgB,CAAC,EAAE,IAAI,EAAE,GAAG,aAAa,EAAyB,EAAA;IAChF,MAAM,KAAK,OAAO,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAA;AACpC,IAAA,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAA;;;;AAK5B,IAAA,SAAS,CAAC,MAAM,MAAM,QAAQ,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC,CAAA;IAE9C,OAAOA,GAAA,CAAC,UAAU,EAAC,EAAA,QAAQ,EAAE,QAAQ,EAAA,GAAM,aAAa,EAAA,CAAI,CAAA;AAC9D;;;;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useField } from 'formik';
|
|
3
|
+
import { useCallback, useEffect } from 'react';
|
|
4
|
+
import { MultiSelect } from '../fields/MultiSelect.js';
|
|
5
|
+
|
|
6
|
+
function FormikMultiSelect({ name, ...originalProps }) {
|
|
7
|
+
const [, , helpers] = useField(name);
|
|
8
|
+
// We don't include `setValues` in `useCallback()` and `useEffect()` dependencies
|
|
9
|
+
// both because it is useless and it will trigger infinite hook calls
|
|
10
|
+
const { setValue } = helpers;
|
|
11
|
+
const handleChange = useCallback((nextValue) => {
|
|
12
|
+
setValue(nextValue);
|
|
13
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
14
|
+
}, []);
|
|
15
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
16
|
+
useEffect(() => () => setValue(undefined), []);
|
|
17
|
+
return jsx(MultiSelect, { name: name, onChange: handleChange, ...originalProps });
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { FormikMultiSelect };
|
|
21
|
+
//# sourceMappingURL=FormikMultiSelect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormikMultiSelect.js","sources":["../../../src/formiks/FormikMultiSelect.tsx"],"sourcesContent":["import { useField } from 'formik'\nimport { useCallback, useEffect } from 'react'\n\nimport { MultiSelect } from '../fields/MultiSelect'\n\nimport type { MultiSelectProps } from '../fields/MultiSelect'\n\nexport type FormikMultiSelectProps = Omit<MultiSelectProps, 'defaultValue' | 'onChange'>\nexport function FormikMultiSelect({ name, ...originalProps }: FormikMultiSelectProps) {\n const [, , helpers] = useField(name)\n // We don't include `setValues` in `useCallback()` and `useEffect()` dependencies\n // both because it is useless and it will trigger infinite hook calls\n const { setValue } = helpers\n\n const handleChange = useCallback((nextValue: string[] | undefined) => {\n setValue(nextValue)\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => () => setValue(undefined), [])\n\n return <MultiSelect name={name} onChange={handleChange} {...originalProps} />\n}\n"],"names":["_jsx"],"mappings":";;;;;AAQM,SAAU,iBAAiB,CAAC,EAAE,IAAI,EAAE,GAAG,aAAa,EAA0B,EAAA;IAClF,MAAM,KAAK,OAAO,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAA;;;AAGpC,IAAA,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAA;AAE5B,IAAA,MAAM,YAAY,GAAG,WAAW,CAAC,CAAC,SAA+B,KAAI;QACnE,QAAQ,CAAC,SAAS,CAAC,CAAA;;KAGpB,EAAE,EAAE,CAAC,CAAA;;AAGN,IAAA,SAAS,CAAC,MAAM,MAAM,QAAQ,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC,CAAA;AAE9C,IAAA,OAAOA,GAAC,CAAA,WAAW,EAAC,EAAA,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAM,GAAA,aAAa,GAAI,CAAA;AAC/E;;;;"}
|
|
@@ -8,8 +8,8 @@ function FormikSelect({ name, ...originalProps }) {
|
|
|
8
8
|
// We don't include `setValues` in `useCallback()` and `useEffect()` dependencies
|
|
9
9
|
// both because it is useless and it will trigger infinite hook calls
|
|
10
10
|
const { setValue } = helpers;
|
|
11
|
-
const handleChange = useCallback((
|
|
12
|
-
setValue(
|
|
11
|
+
const handleChange = useCallback((nextValue) => {
|
|
12
|
+
setValue(nextValue);
|
|
13
13
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
14
14
|
}, []);
|
|
15
15
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormikSelect.js","sources":["../../../src/formiks/FormikSelect.tsx"],"sourcesContent":["import { useField } from 'formik'\nimport { useCallback, useEffect } from 'react'\n\nimport { Select } from '../fields/Select'\n\nimport type { SelectProps } from '../fields/Select'\n\nexport type FormikSelectProps = Omit<SelectProps, 'defaultValue' | 'onChange'
|
|
1
|
+
{"version":3,"file":"FormikSelect.js","sources":["../../../src/formiks/FormikSelect.tsx"],"sourcesContent":["import { useField } from 'formik'\nimport { useCallback, useEffect } from 'react'\n\nimport { Select } from '../fields/Select'\n\nimport type { SelectProps } from '../fields/Select'\n\nexport type FormikSelectProps = Omit<SelectProps, 'defaultValue' | 'onChange'>\nexport function FormikSelect({ name, ...originalProps }: FormikSelectProps) {\n const [, , helpers] = useField(name)\n // We don't include `setValues` in `useCallback()` and `useEffect()` dependencies\n // both because it is useless and it will trigger infinite hook calls\n const { setValue } = helpers\n\n const handleChange = useCallback((nextValue: string | undefined) => {\n setValue(nextValue)\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => () => setValue(undefined), [])\n\n return <Select name={name} onChange={handleChange} {...originalProps} />\n}\n"],"names":["_jsx"],"mappings":";;;;;AAQM,SAAU,YAAY,CAAC,EAAE,IAAI,EAAE,GAAG,aAAa,EAAqB,EAAA;IACxE,MAAM,KAAK,OAAO,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAA;;;AAGpC,IAAA,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAA;AAE5B,IAAA,MAAM,YAAY,GAAG,WAAW,CAAC,CAAC,SAA6B,KAAI;QACjE,QAAQ,CAAC,SAAS,CAAC,CAAA;;KAGpB,EAAE,EAAE,CAAC,CAAA;;AAGN,IAAA,SAAS,CAAC,MAAM,MAAM,QAAQ,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC,CAAA;AAE9C,IAAA,OAAOA,GAAC,CAAA,MAAM,EAAC,EAAA,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAM,GAAA,aAAa,GAAI,CAAA;AAC1E;;;;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useField } from 'formik';
|
|
3
|
+
import { useCallback, useEffect } from 'react';
|
|
4
|
+
import { TextInput } from '../fields/TextInput.js';
|
|
5
|
+
|
|
6
|
+
function FormikTextInput({ name, ...originalProps }) {
|
|
7
|
+
const [, , helpers] = useField(name);
|
|
8
|
+
// We don't include `setValues` in `useCallback()` and `useEffect()` dependencies
|
|
9
|
+
// both because it is useless and it will trigger infinite hook calls
|
|
10
|
+
const { setValue } = helpers;
|
|
11
|
+
const handleChange = useCallback((nextValue) => {
|
|
12
|
+
setValue(nextValue);
|
|
13
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
14
|
+
}, []);
|
|
15
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
16
|
+
useEffect(() => () => setValue(undefined), []);
|
|
17
|
+
return jsx(TextInput, { name: name, onChange: handleChange, ...originalProps });
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { FormikTextInput };
|
|
21
|
+
//# sourceMappingURL=FormikTextInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormikTextInput.js","sources":["../../../src/formiks/FormikTextInput.tsx"],"sourcesContent":["import { useField } from 'formik'\nimport { useCallback, useEffect } from 'react'\n\nimport { TextInput } from '../fields/TextInput'\n\nimport type { TextInputProps } from '../fields/TextInput'\n\nexport type FormikTextInputProps = Omit<TextInputProps, 'defaultValue' | 'onChange'>\nexport function FormikTextInput({ name, ...originalProps }: FormikTextInputProps) {\n const [, , helpers] = useField(name)\n // We don't include `setValues` in `useCallback()` and `useEffect()` dependencies\n // both because it is useless and it will trigger infinite hook calls\n const { setValue } = helpers\n\n const handleChange = useCallback((nextValue: string | undefined) => {\n setValue(nextValue)\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => () => setValue(undefined), [])\n\n return <TextInput name={name} onChange={handleChange} {...originalProps} />\n}\n"],"names":["_jsx"],"mappings":";;;;;AAQM,SAAU,eAAe,CAAC,EAAE,IAAI,EAAE,GAAG,aAAa,EAAwB,EAAA;IAC9E,MAAM,KAAK,OAAO,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAA;;;AAGpC,IAAA,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAA;AAE5B,IAAA,MAAM,YAAY,GAAG,WAAW,CAAC,CAAC,SAA6B,KAAI;QACjE,QAAQ,CAAC,SAAS,CAAC,CAAA;;KAGpB,EAAE,EAAE,CAAC,CAAA;;AAGN,IAAA,SAAS,CAAC,MAAM,MAAM,QAAQ,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC,CAAA;AAE9C,IAAA,OAAOA,GAAC,CAAA,SAAS,EAAC,EAAA,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAM,GAAA,aAAa,GAAI,CAAA;AAC7E;;;;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useField } from 'formik';
|
|
3
|
+
import { useCallback, useEffect } from 'react';
|
|
4
|
+
import { Textarea } from '../fields/Textarea.js';
|
|
5
|
+
|
|
6
|
+
function FormikTextarea({ name, ...originalProps }) {
|
|
7
|
+
const [, , helpers] = useField(name);
|
|
8
|
+
// We don't include `setValues` in `useCallback()` and `useEffect()` dependencies
|
|
9
|
+
// both because it is useless and it will trigger infinite hook calls
|
|
10
|
+
const { setValue } = helpers;
|
|
11
|
+
const handleChange = useCallback((nextValue) => {
|
|
12
|
+
setValue(nextValue);
|
|
13
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
14
|
+
}, []);
|
|
15
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
16
|
+
useEffect(() => () => setValue(undefined), []);
|
|
17
|
+
return jsx(Textarea, { name: name, onChange: handleChange, ...originalProps });
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { FormikTextarea };
|
|
21
|
+
//# sourceMappingURL=FormikTextarea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormikTextarea.js","sources":["../../../src/formiks/FormikTextarea.tsx"],"sourcesContent":["import { useField } from 'formik'\nimport { useCallback, useEffect } from 'react'\n\nimport { Textarea } from '../fields/Textarea'\n\nimport type { TextareaProps } from '../fields/Textarea'\n\nexport type FormikTextareaProps = Omit<TextareaProps, 'defaultValue' | 'onChange'>\nexport function FormikTextarea({ name, ...originalProps }: FormikTextareaProps) {\n const [, , helpers] = useField(name)\n // We don't include `setValues` in `useCallback()` and `useEffect()` dependencies\n // both because it is useless and it will trigger infinite hook calls\n const { setValue } = helpers\n\n const handleChange = useCallback((nextValue: string | undefined) => {\n setValue(nextValue)\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => () => setValue(undefined), [])\n\n return <Textarea name={name} onChange={handleChange} {...originalProps} />\n}\n"],"names":["_jsx"],"mappings":";;;;;AAQM,SAAU,cAAc,CAAC,EAAE,IAAI,EAAE,GAAG,aAAa,EAAuB,EAAA;IAC5E,MAAM,KAAK,OAAO,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAA;;;AAGpC,IAAA,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAA;AAE5B,IAAA,MAAM,YAAY,GAAG,WAAW,CAAC,CAAC,SAA6B,KAAI;QACjE,QAAQ,CAAC,SAAS,CAAC,CAAA;;KAGpB,EAAE,EAAE,CAAC,CAAA;;AAGN,IAAA,SAAS,CAAC,MAAM,MAAM,QAAQ,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC,CAAA;AAE9C,IAAA,OAAOA,GAAC,CAAA,QAAQ,EAAC,EAAA,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAM,GAAA,aAAa,GAAI,CAAA;AAC5E;;;;"}
|
package/src/index.js
CHANGED
|
@@ -4,11 +4,17 @@ export { THEME } from './theme.js';
|
|
|
4
4
|
export { Checkbox } from './fields/Checkbox.js';
|
|
5
5
|
export { DateRangePicker } from './fields/DateRangePicker/index.js';
|
|
6
6
|
export { DatePicker } from './fields/DatePicker/index.js';
|
|
7
|
+
export { MultiSelect } from './fields/MultiSelect.js';
|
|
7
8
|
export { Select } from './fields/Select.js';
|
|
9
|
+
export { Textarea } from './fields/Textarea.js';
|
|
10
|
+
export { TextInput } from './fields/TextInput.js';
|
|
8
11
|
export { FormikCheckbox } from './formiks/FormikCheckbox.js';
|
|
9
12
|
export { FormikDatePicker } from './formiks/FormikDatePicker.js';
|
|
10
13
|
export { FormikDateRangePicker } from './formiks/FormikDateRangePicker.js';
|
|
11
14
|
export { FormikEffect } from './formiks/FormikEffect.js';
|
|
15
|
+
export { FormikMultiSelect } from './formiks/FormikMultiSelect.js';
|
|
12
16
|
export { FormikSelect } from './formiks/FormikSelect.js';
|
|
17
|
+
export { FormikTextarea } from './formiks/FormikTextarea.js';
|
|
18
|
+
export { FormikTextInput } from './formiks/FormikTextInput.js';
|
|
13
19
|
export { ThemeProvider } from './ThemeProvider.js';
|
|
14
20
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
|