From 3e2ca6f11045f1dd2947d05e190ef308c17dcb5c Mon Sep 17 00:00:00 2001 From: okasha93 Date: Wed, 25 Apr 2018 20:00:10 +0200 Subject: [PATCH 1/8] On option selected clear the input filed value Basic Typeahead ** Customized to my usage ** On option selected clear the input filed value Edit: _onOptionSelected function --- src/typeahead/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/typeahead/index.js b/src/typeahead/index.js index 7e231041..88a5f503 100644 --- a/src/typeahead/index.js +++ b/src/typeahead/index.js @@ -202,7 +202,7 @@ var Typeahead = createReactClass({ nEntry.value = optionString; this.setState({searchResults: this.getOptionsForValue(optionString, this.props.options), selection: formInputOptionString, - entryValue: optionString, + entryValue: '', showResults: false}); return this.props.onOptionSelected(option, event); }, From afa22c303b4b4ab26b676173f655a8011de5f910 Mon Sep 17 00:00:00 2001 From: okasha93 Date: Wed, 25 Apr 2018 22:32:31 +0200 Subject: [PATCH 2/8] Tables for Typeahead and Tokenizer props' --- README.md | 205 +++++++++++++++--------------------------------------- 1 file changed, 56 insertions(+), 149 deletions(-) diff --git a/README.md b/README.md index 733abc66..6e031a38 100644 --- a/README.md +++ b/README.md @@ -55,124 +55,89 @@ Type: React Component Basic typeahead input and results list. -#### props.options - -Type: `Array` +Typeahead(props) | Description +------------ | ------------- +#### props.options | Type: `Array` Default: [] An array supplied to the filtering function. Can be a list of strings or a list of arbitrary objects. In the latter case, `filterOption` and `displayOption` should be provided. -#### props.defaultValue - -Type: `String` +#### props.defaultValue | Type: `String` A default value used when the component has no value. If it matches any options a option list will show. -#### props.value - -Type: `String` +#### props.value | Type: `String` Specify a value for the text input. -#### props.maxVisible - -Type: `Number` +#### props.maxVisible | Type: `Number` Limit the number of options rendered in the results list. -#### props.resultsTruncatedMessage - -Type: `String` +#### props.resultsTruncatedMessage | Type: `String` If `maxVisible` is set, display this custom message at the bottom of the list of results when the result are truncated. -#### props.customClasses - -Type: `Object` +#### props.customClasses | Type: `Object` Allowed Keys: `input`, `results`, `listItem`, `listAnchor`, `hover`, `typeahead`, `resultsTruncated` An object containing custom class names for child elements. Useful for integrating with 3rd party UI kits. -#### props.placeholder - +#### props.placeholder | Type: `String` Placeholder text for the typeahead input. -#### props.disabled - -Type: `Boolean` +#### props.disabled | Type: `Boolean` Set to `true` to add disable attribute in the `` or `