From 31e96442b240412208a07ad4fdba3444fa750736 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Holhjem?= Date: Mon, 4 Mar 2019 18:00:01 +0100 Subject: [PATCH 1/2] Added allowNew function From documentation: https://github.com/ericgio/react-bootstrap-typeahead/blob/master/docs/Props.md --- types/react-bootstrap-typeahead/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-bootstrap-typeahead/index.d.ts b/types/react-bootstrap-typeahead/index.d.ts index 93fa2c9c6a..18311bccb5 100644 --- a/types/react-bootstrap-typeahead/index.d.ts +++ b/types/react-bootstrap-typeahead/index.d.ts @@ -126,7 +126,7 @@ export interface TypeaheadProps { but not the list of original options unless handled as such by Typeahead's parent. The newly added item will always be returned as an object even if the other options are simply strings, so be sure your onChange callback can handle this. */ - allowNew?: boolean; + allowNew?: boolean | ((results: T[], props: TypeaheadProps) => boolean); /* Autofocus the input when the component initially mounts. */ autoFocus?: boolean; From 55bfcc3dd9681a8fdb07ee44e900198c39270518 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Holhjem?= Date: Tue, 5 Mar 2019 12:57:58 +0100 Subject: [PATCH 2/2] More missing props and some corrections From doc: https://github.com/ericgio/react-bootstrap-typeahead/blob/master/docs/Props.md --- types/react-bootstrap-typeahead/index.d.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/types/react-bootstrap-typeahead/index.d.ts b/types/react-bootstrap-typeahead/index.d.ts index 18311bccb5..f916a4c293 100644 --- a/types/react-bootstrap-typeahead/index.d.ts +++ b/types/react-bootstrap-typeahead/index.d.ts @@ -5,6 +5,7 @@ // Paito Anderson // Andreas Richter // Dale Fenton +// HÃ¥kon Holhjem // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.9 @@ -126,7 +127,7 @@ export interface TypeaheadProps { but not the list of original options unless handled as such by Typeahead's parent. The newly added item will always be returned as an object even if the other options are simply strings, so be sure your onChange callback can handle this. */ - allowNew?: boolean | ((results: T[], props: TypeaheadProps) => boolean); + allowNew?: boolean | ((results: T[], props: AllTypeaheadOwnAndInjectedProps) => boolean); /* Autofocus the input when the component initially mounts. */ autoFocus?: boolean; @@ -172,6 +173,9 @@ export interface TypeaheadProps { Does not work with allowNew. */ highlightOnlyResult?: boolean; + /* An html id attribute, required for assistive technologies such as screen readers. */ + id?: string | number; + /* Whether the filter should ignore accents and other diacritical marks. */ ignoreDiacritics?: boolean; @@ -198,7 +202,7 @@ export interface TypeaheadProps { so as not to render too many DOM nodes in the case of large data sets. */ maxResults?: number; - /* Id applied to the top-level menu element. Required for accessibility. */ + /* DEPRECATED. Id applied to the top-level menu element. Required for accessibility. */ menuId?: string; /* Number of input characters that must be entered before showing results. */ @@ -253,6 +257,10 @@ export interface TypeaheadProps { /* Placeholder text for the input. */ placeholder?: string; + /* Whether to use fixed positioning for the menu, which is useful when rendering inside a + container with overflow: hidden;. Uses absolute positioning by default. */ + positionFixed?: boolean; + /* Callback for custom menu rendering. */ renderMenu?: (results: Array>, menuProps: any) => React.ReactNode;