From 5c106a96397d1607537100acc124edef67fd54a1 Mon Sep 17 00:00:00 2001 From: wassname Date: Fri, 8 Apr 2016 14:41:10 +0800 Subject: [PATCH] Extended defined props --- react-select/react-select-tests.tsx | 5 -- react-select/react-select.d.ts | 82 ++++++++++++++++++++++++++++- 2 files changed, 80 insertions(+), 7 deletions(-) diff --git a/react-select/react-select-tests.tsx b/react-select/react-select-tests.tsx index cc2cc7376..d8287b00a 100644 --- a/react-select/react-select-tests.tsx +++ b/react-select/react-select-tests.tsx @@ -7,11 +7,6 @@ import * as ReactDOM from "react-dom"; import * as Select from "react-select"; -import * as React from "react"; -import * as ReactDOM from "react-dom"; - -import * as Select from "react-select"; - class SelectTest extends React.Component, {}> { render() { diff --git a/react-select/react-select.d.ts b/react-select/react-select.d.ts index 3414b4472..35ef505b5 100644 --- a/react-select/react-select.d.ts +++ b/react-select/react-select.d.ts @@ -6,6 +6,7 @@ /// declare namespace ReactSelect { + interface Option { /** Text for rendering */ label: string; @@ -199,14 +200,91 @@ declare namespace ReactSelect { * @default false */ valueRenderer?: () => void; + /** + * optional style to apply to the control + */ + style?: any; + + /** + * optional tab index of the control + */ + tabIndex?: string; + + /** + * value component to render + */ + valueComponent?: Function; + + /** + * optional style to apply to the component wrapper + */ + wrapperStyle?: any; + + /** + * onClick handler for value labels: function (value, event) {} + */ + onValueClick?: Function; + + /** + * pass the value to onChange as a simple value (legacy pre 1.0 mode), defaults to false + */ + simpleValue?: boolean; } - interface ReactAsyncSelectProps extends __React.Props { + interface ReactAsyncSelectProps extends ReactSelectProps { + /** + * object to use to cache results; can be null to disable cache + */ cache?: any; - loadOptions?: () => void; + + /** + * whether to strip diacritics when filtering (shared with Select) + */ ignoreAccents?: boolean; + + /** + * whether to perform case-insensitive filtering (shared with Select) + */ + ignoreCase?: boolean; + + /** + * overrides the isLoading state when set to true + */ isLoading?: boolean; + + /** + * function to call to load options asynchronously + */ + loadOptions: (input: string, callback: (options: Option[]) => any) => any; + + /** + * replaces the placeholder while options are loading + */ loadingPlaceholder?: string; + + /** + * the minimum number of characters that trigger loadOptions + */ + minimumInput?: number; + + /** + * placeholder displayed when there are no matching search results (shared with Select) + */ + noResultsText?: string; + /** + * field placeholder; displayed when there's no value (shared with Select) + */ + placeholder?: string; + + /** + * label to prompt for search input + */ + searchPromptText?: string; + + /** + * message to display while options are loading + */ + searchingText?: string; } interface ReactSelect extends __React.ReactElement { }