@arteneo/forge
Version:
35 lines (34 loc) • 2.34 kB
TypeScript
import React from "react";
import { FormControlProps, AutocompleteChangeReason, AutocompleteChangeDetails, AutocompleteProps, AutocompleteRenderInputParams } from "@mui/material";
import { FormikValues } from "formik";
import OptionsType from "../../../components/Form/definitions/OptionsType";
import OptionInterface from "../../../components/Form/definitions/OptionInterface";
import FieldPlaceholderInterface from "../../../components/Form/definitions/FieldPlaceholderInterface";
import { SelectValueType, Multiple, DisableClearable, FreeSolo } from "../../../components/Form/definitions/AutocompleteTypes";
type SelectAutocompleteProps = AutocompleteProps<OptionInterface, Multiple, DisableClearable, FreeSolo>;
type SelectAutocompletePartialProps<T> = {
[P in keyof T]?: T[P];
};
type SelectAutocompleteOptionalProps = SelectAutocompletePartialProps<SelectAutocompleteProps>;
interface SelectSpecificProps {
options: OptionsType;
disableTranslateOption?: boolean;
onChange?: (path: string, setFieldValue: (field: string, value: any, shouldValidate?: boolean) => void, value: SelectValueType, onChange: () => void, values: FormikValues, event: React.SyntheticEvent, reason: AutocompleteChangeReason, name: string, details?: AutocompleteChangeDetails<OptionInterface>) => void;
groupBy?: (option: OptionInterface) => string;
disableTranslateGroupBy?: boolean;
renderInput?: (params: SelectRenderInputProps, option?: OptionInterface) => React.ReactNode;
autocompleteProps?: SelectAutocompleteOptionalProps;
formControlProps?: FormControlProps;
}
type SelectProps = SelectSpecificProps & FieldPlaceholderInterface;
interface SelectRenderInputProps extends AutocompleteRenderInputParams {
label?: React.ReactNode;
required: boolean;
placeholder?: string;
onBlur: () => void;
error: boolean;
}
declare const SelectRenderInput: (params: SelectRenderInputProps) => React.JSX.Element;
declare const Select: ({ options, disableTranslateOption, onChange, groupBy, disableTranslateGroupBy, renderInput, autocompleteProps, formControlProps, validate: fieldValidate, ...field }: SelectProps) => React.JSX.Element | null;
export default Select;
export { SelectProps, SelectSpecificProps, SelectRenderInput, SelectRenderInputProps, SelectAutocompleteProps, SelectAutocompleteOptionalProps, };