import { FC, ReactNode } from "react"; import { Styles } from "react-select"; import { Props as LibraryProps } from "react-select/src/Select"; import { OptionTypeBase } from "react-select/src/types"; /** * List of Props to be removed in a future released. * Used to warn developers about deprecated functionality. */ export declare enum DeprecatedPropNames { defaultText = "defaultText", disabled = "disabled", isNative = "isNative", isRequired = "isRequired", selectedValue = "selectedValue" } /** * The original custom Select returned a string value for the * onChange event callback. react-select returns the full option * for the onChange. When the select is a multi-select the onChange * can return an array of options. Need support for all options. */ declare type onChangeWithLegacySupport = (value: string | { [key: string]: any; } | { [key: string]: any; }[], fullValue: { [key: string]: any; }, action?: { [key: string]: any; }) => void; /** * SelectProps using the react-select LibraryProps with a custom * onChange event. */ export interface SelectProps extends Omit { /** Children that will be nested in the select component */ children?: any; /** If true, component returns a creatable select, see Creatable documentation on react-select */ creatable?: boolean; /** Any extra information you need to pass to a custom component */ componentProps?: { /** React component to render after the prompt/input */ afterInput?: ReactNode; /** React component to render before the prompt/input */ beforeInput?: ReactNode; /** Any data for the custom component */ [key: string]: any; }; /** Deprecated! Allows you to use native styles & functionality */ isNative?: boolean; /** Deprecated! Disables the select component */ disabled?: boolean; /** Adds error styling */ hasError?: boolean; /** Returns the selected value to the component. Also returns full value with the label and the action information. */ onChange?: onChangeWithLegacySupport; /** Form object which comes from Formik */ form?: any; /** ID attribute, requirement for accessibility */ id: string; /** label attribute, requirement for accessibility */ label: string; /** hides the label in the UI */ labelHidden?: boolean; } /** * Styling overrides to match UX spec. * Warning! Never use `!important`, those styles will be ignored. * @param hasError */ export declare const componentStyles: ({ hasError }: Pick) => { clearIndicator: (provided: any, state: any) => any; container: (provided: any, state: any) => any; control: (provided: any, state: any) => any; dropdownIndicator: (provided: any, state: any) => any; group: (provided: any) => any; groupHeading: (provided: any) => any; indicatorsContainer: (provided: any) => any; indicatorSeparator: () => { display: string; }; input: (provided: any, state: any) => any; loadingIndicator: (provided: any) => any; loadingMessage: (provided: any) => any; menu: (provided: any) => any; menuList: (provided: any) => any; menuPortal: (provided: any) => any; multiValue: (provided: any) => any; multiValueLabel: (provided: any) => any; multiValueRemove: (provided: any, state: any) => any; noOptionsMessage: (provided: any) => any; option: (provided: any, state: any) => any; placeholder: (provided: any, state: any) => any; singleValue: (provided: any) => any; valueContainer: (provided: any) => any; }; /** * Need ability to update all the styles to match UX * Also need the ability for a developer to override a single custom style property or callback * Merge both the UX styles with customer styles * * @param customStyles * @param componentStyles */ export declare const mergeStyles: (customStyles: Styles, componentStyles: Styles) => {}; /** * Display warning message in console if deprecated prop is passed to Select * @param propName */ export declare const warnAboutDeprecatedProp: (propName: DeprecatedPropNames) => void; /** * If a deprecated prop is passed to the Select warn the developer and * try to convert the prop to an approved prop if possible. * @param props */ export declare const manageDeprecatedProps: (props: Pick) => Pick; /** * Select component * * @param components * @param creatable * @param form * @param styles * @param onChange * @param ...props * @constructor */ export declare const Select: FC; export {};