mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* Update index.d.ts `optionRenderer` can take a number or a function that returns a number, so I've updated the type for that prop * Update index.d.ts Fix issue with callback * Update index.d.ts * Updated react-virtualized-select index.d.ts * Update index.d.ts
37 lines
1.6 KiB
TypeScript
37 lines
1.6 KiB
TypeScript
// Type definitions for react-virtualized-select 3.0
|
|
// Project: https://github.com/bvaughn/react-virtualized-select
|
|
// Definitions by: Sean Kelley <https://github.com/seansfkelley>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
// TypeScript Version: 2.8
|
|
|
|
import * as React from "react";
|
|
import { ReactSelectProps, ReactAsyncSelectProps, ReactCreatableSelectProps, LoadOptionsHandler, OptionValues } from "react-select";
|
|
import { ListProps } from "react-virtualized";
|
|
|
|
export interface VirtualizedOptionRenderOptions<T> {
|
|
focusedOption: T;
|
|
focusedOptionIndex: number;
|
|
focusOption(option: T): void;
|
|
key: string;
|
|
labelKey: keyof T;
|
|
listProps: ListProps;
|
|
option: T;
|
|
options: T[];
|
|
selectValue(option: T): void;
|
|
style: Record<string, string>;
|
|
valueArray: T[];
|
|
}
|
|
|
|
export interface AdditionalVirtualizedSelectProps<TValue> {
|
|
maxHeight?: number;
|
|
optionHeight?: number | ((options: { option: TValue }) => number);
|
|
optionRenderer?(options: VirtualizedOptionRenderOptions<TValue>): JSX.Element;
|
|
selectComponent?: React.ComponentClass<any> | React.StatelessComponent<any>;
|
|
}
|
|
|
|
type VirtualizedSelectProps<TValue = OptionValues> = (ReactCreatableSelectProps<TValue> & ReactAsyncSelectProps<TValue> & AdditionalVirtualizedSelectProps<TValue> & { async: true }) |
|
|
ReactCreatableSelectProps<TValue> & ReactSelectProps<TValue> & AdditionalVirtualizedSelectProps<TValue>;
|
|
|
|
declare class VirtualizedSelect<TValue = OptionValues> extends React.PureComponent<VirtualizedSelectProps<TValue>> {}
|
|
export default VirtualizedSelect;
|