/*
* Copyright (c) 2021 - 2024, Ludvig Lundgren and the autobrr contributors.
* SPDX-License-Identifier: GPL-2.0-or-later
*/
import { Field, FieldProps } from "formik";
import { components } from "react-select";
import type {
InputProps,
ControlProps,
MenuProps,
OptionProps,
IndicatorSeparatorProps,
DropdownIndicatorProps
} from "react-select";
import { classNames } from "@utils";
interface ErrorFieldProps {
name: string;
classNames?: string;
}
export const ErrorField = ({ name, classNames }: ErrorFieldProps) => (
{({ meta: { touched, error } }: FieldProps) =>
touched && error ? {error} : null
}
);
interface RequiredFieldProps {
required?: boolean
}
export const RequiredField = ({ required }: RequiredFieldProps) => (
<>
{required && *}
>
);
export const SelectInput = (props: InputProps) => (
);
export const SelectControl = (props: ControlProps) => (
);
export const SelectMenu = (props: MenuProps) => (
);
export const SelectOption = (props: OptionProps) => (
);
export const IndicatorSeparator = (props: IndicatorSeparatorProps) => (
);
export const DropdownIndicator = (props: DropdownIndicatorProps) => (
);