@hyphen/hyphen-components 2.15.2 → 2.15.4
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/dist/components/Formik/FormikSelectInput/FormikSelectInput.d.ts +1 -0
- package/dist/css/index.css +1 -1
- package/dist/hyphen-components.cjs.development.js +13 -7
- package/dist/hyphen-components.cjs.development.js.map +1 -1
- package/dist/hyphen-components.cjs.production.min.js +1 -1
- package/dist/hyphen-components.cjs.production.min.js.map +1 -1
- package/dist/hyphen-components.esm.js +13 -7
- package/dist/hyphen-components.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Formik/FormikSelectInput/FormikSelectInput.tsx +12 -4
- package/src/components/SelectInput/SelectInput.module.scss +6 -1
package/package.json
CHANGED
|
@@ -16,6 +16,7 @@ export interface FormikSelectInputProps
|
|
|
16
16
|
errors: FormikErrors<FormikValues>;
|
|
17
17
|
};
|
|
18
18
|
onChange?: SelectInputProps['onChange'];
|
|
19
|
+
error?: any[] | string;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
export const FormikSelectInput: React.FC<FormikSelectInputProps> = ({
|
|
@@ -25,11 +26,18 @@ export const FormikSelectInput: React.FC<FormikSelectInputProps> = ({
|
|
|
25
26
|
id,
|
|
26
27
|
label,
|
|
27
28
|
options,
|
|
29
|
+
error: errorProp,
|
|
28
30
|
...props
|
|
29
31
|
}) => {
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
|
|
32
|
+
let errorMessage;
|
|
33
|
+
const error = errorProp ?? (getIn(touched, name) && getIn(errors, name));
|
|
34
|
+
|
|
35
|
+
if (typeof error === 'string') {
|
|
36
|
+
errorMessage = error;
|
|
37
|
+
} else if (error && typeof error !== 'string') {
|
|
38
|
+
errorMessage = error?.find((err: any) => err?.label)?.label;
|
|
39
|
+
}
|
|
40
|
+
|
|
33
41
|
return (
|
|
34
42
|
<SelectInput
|
|
35
43
|
id={id}
|
|
@@ -39,7 +47,7 @@ export const FormikSelectInput: React.FC<FormikSelectInputProps> = ({
|
|
|
39
47
|
onBlur={onBlur}
|
|
40
48
|
onChange={onChange ?? formikOnChange}
|
|
41
49
|
value={value}
|
|
42
|
-
error={errorMessage
|
|
50
|
+
error={errorMessage}
|
|
43
51
|
{...props}
|
|
44
52
|
/>
|
|
45
53
|
);
|
|
@@ -206,10 +206,15 @@
|
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
:global(.react-select__option),
|
|
209
|
-
:global(.react-select__single-value)
|
|
209
|
+
:global(.react-select__single-value),
|
|
210
|
+
:global(.react-select__input-container) {
|
|
210
211
|
color: var(--color-font-base);
|
|
211
212
|
}
|
|
212
213
|
|
|
214
|
+
:global(.react-select__multi-value__remove) {
|
|
215
|
+
color: var(--color-font-grey);
|
|
216
|
+
}
|
|
217
|
+
|
|
213
218
|
:global(.react-select__control) {
|
|
214
219
|
line-height: var(
|
|
215
220
|
--form-control-line-height,
|