react-typeahead
Advanced tools
Comparing version
@@ -276,3 +276,3 @@ !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.ReactTypeahead=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
defaultSelected: React.PropTypes.array, | ||
defaultValue: React.PropTypes.string, | ||
initialValue: React.PropTypes.string, | ||
placeholder: React.PropTypes.string, | ||
@@ -309,3 +309,3 @@ disabled: React.PropTypes.bool, | ||
allowCustomValues: 0, | ||
defaultValue: "", | ||
initialValue: "", | ||
placeholder: "", | ||
@@ -437,3 +437,3 @@ disabled: false, | ||
options: this._getOptionsForTypeahead(), | ||
defaultValue: this.props.defaultValue, | ||
initialValue: this.props.initialValue, | ||
maxVisible: this.props.maxVisible, | ||
@@ -542,3 +542,3 @@ onOptionSelected: this._addTokenForValue, | ||
allowCustomValues: React.PropTypes.number, | ||
defaultValue: React.PropTypes.string, | ||
initialValue: React.PropTypes.string, | ||
value: React.PropTypes.string, | ||
@@ -569,4 +569,4 @@ placeholder: React.PropTypes.string, | ||
allowCustomValues: 0, | ||
defaultValue: "", | ||
value: null, | ||
initialValue: "", | ||
value: "", | ||
placeholder: "", | ||
@@ -593,6 +593,6 @@ disabled: false, | ||
// The currently visible set of options | ||
visible: this.getOptionsForValue(this.props.defaultValue, this.props.options), | ||
visible: this.getOptionsForValue(this.props.initialValue, this.props.options), | ||
// This should be called something else, "entryValue" | ||
entryValue: this.props.value || this.props.defaultValue, | ||
entryValue: this.props.value || this.props.initialValue, | ||
@@ -702,3 +702,3 @@ // A valid typeahead value | ||
this.setState({ visible: this.getOptionsForValue(value, this.props.options), | ||
selection: null, | ||
selection: '', | ||
entryValue: value }); | ||
@@ -818,3 +818,2 @@ }, | ||
var InputElement = this.props.textarea ? 'textarea' : 'input'; | ||
return React.createElement( | ||
@@ -830,3 +829,2 @@ 'div', | ||
value: this.state.entryValue, | ||
defaultValue: this.props.defaultValue, | ||
onChange: this._onChange, | ||
@@ -833,0 +831,0 @@ onKeyDown: this._onKeyDown, |
@@ -33,3 +33,3 @@ var Accessor = require('../accessor'); | ||
defaultSelected: React.PropTypes.array, | ||
defaultValue: React.PropTypes.string, | ||
initialValue: React.PropTypes.string, | ||
placeholder: React.PropTypes.string, | ||
@@ -66,3 +66,3 @@ disabled: React.PropTypes.bool, | ||
allowCustomValues: 0, | ||
defaultValue: "", | ||
initialValue: "", | ||
placeholder: "", | ||
@@ -194,3 +194,3 @@ disabled: false, | ||
options: this._getOptionsForTypeahead(), | ||
defaultValue: this.props.defaultValue, | ||
initialValue: this.props.initialValue, | ||
maxVisible: this.props.maxVisible, | ||
@@ -197,0 +197,0 @@ onOptionSelected: this._addTokenForValue, |
@@ -25,3 +25,3 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
allowCustomValues: React.PropTypes.number, | ||
defaultValue: React.PropTypes.string, | ||
initialValue: React.PropTypes.string, | ||
value: React.PropTypes.string, | ||
@@ -52,4 +52,4 @@ placeholder: React.PropTypes.string, | ||
allowCustomValues: 0, | ||
defaultValue: "", | ||
value: null, | ||
initialValue: "", | ||
value: "", | ||
placeholder: "", | ||
@@ -76,6 +76,6 @@ disabled: false, | ||
// The currently visible set of options | ||
visible: this.getOptionsForValue(this.props.defaultValue, this.props.options), | ||
visible: this.getOptionsForValue(this.props.initialValue, this.props.options), | ||
// This should be called something else, "entryValue" | ||
entryValue: this.props.value || this.props.defaultValue, | ||
entryValue: this.props.value || this.props.initialValue, | ||
@@ -185,3 +185,3 @@ // A valid typeahead value | ||
this.setState({ visible: this.getOptionsForValue(value, this.props.options), | ||
selection: null, | ||
selection: '', | ||
entryValue: value }); | ||
@@ -301,3 +301,2 @@ }, | ||
var InputElement = this.props.textarea ? 'textarea' : 'input'; | ||
return React.createElement( | ||
@@ -313,3 +312,2 @@ 'div', | ||
value: this.state.entryValue, | ||
defaultValue: this.props.defaultValue, | ||
onChange: this._onChange, | ||
@@ -316,0 +314,0 @@ onKeyDown: this._onKeyDown, |
{ | ||
"name": "react-typeahead", | ||
"version": "1.1.9", | ||
"version": "2.0.0-alpha.1", | ||
"description": "React-based typeahead and typeahead-tokenizer", | ||
@@ -36,6 +36,7 @@ "keywords": [ | ||
"classnames": "^1.2.0", | ||
"fuzzy": "^0.1.0" | ||
"fuzzy": "^0.1.0", | ||
"react": "^15.0.1" | ||
}, | ||
"peerDependencies": { | ||
"react": ">= 0.14.0" | ||
"react": ">= 0.14" | ||
}, | ||
@@ -55,4 +56,2 @@ "main": "lib/react-typeahead.js", | ||
"mocha": "^1.21.4", | ||
"react-addons-test-utils": "^0.14.2", | ||
"react-dom": "^0.14.2", | ||
"react-tools": "^0.13.3", | ||
@@ -68,2 +67,7 @@ "sinon": "^1.10.3", | ||
"watchify": "watchify ./src/react-typeahead.js -t [ babelify --presets [ react ] ] -t literalify -x react -s ReactTypeahead -o ./dist/react-typeahead.js", | ||
"react:14": "npm i react@0.14 react-dom@0.14 react-addons-test-utils@0.14", | ||
"react:15": "npm i react@15 react-dom@15 react-addons-test-utils@15", | ||
"test:react:14": "npm run react:14 && npm test", | ||
"test:react:15": "npm run react:15 && npm test", | ||
"test:all": "npm run test:react:14 && npm run test:react:15", | ||
"lib": "gulp build", | ||
@@ -70,0 +74,0 @@ "prepublish": "npm run lib" |
@@ -31,3 +31,3 @@ var Accessor = require('../accessor'); | ||
defaultSelected: React.PropTypes.array, | ||
defaultValue: React.PropTypes.string, | ||
initialValue: React.PropTypes.string, | ||
placeholder: React.PropTypes.string, | ||
@@ -73,3 +73,3 @@ disabled: React.PropTypes.bool, | ||
allowCustomValues: 0, | ||
defaultValue: "", | ||
initialValue: "", | ||
placeholder: "", | ||
@@ -200,3 +200,3 @@ disabled: false, | ||
options={this._getOptionsForTypeahead()} | ||
defaultValue={this.props.defaultValue} | ||
initialValue={this.props.initialValue} | ||
maxVisible={this.props.maxVisible} | ||
@@ -203,0 +203,0 @@ onOptionSelected={this._addTokenForValue} |
@@ -21,3 +21,3 @@ var Accessor = require('../accessor'); | ||
allowCustomValues: React.PropTypes.number, | ||
defaultValue: React.PropTypes.string, | ||
initialValue: React.PropTypes.string, | ||
value: React.PropTypes.string, | ||
@@ -60,4 +60,4 @@ placeholder: React.PropTypes.string, | ||
allowCustomValues: 0, | ||
defaultValue: "", | ||
value: null, | ||
initialValue: "", | ||
value: "", | ||
placeholder: "", | ||
@@ -84,6 +84,6 @@ disabled: false, | ||
// The currently visible set of options | ||
visible: this.getOptionsForValue(this.props.defaultValue, this.props.options), | ||
visible: this.getOptionsForValue(this.props.initialValue, this.props.options), | ||
// This should be called something else, "entryValue" | ||
entryValue: this.props.value || this.props.defaultValue, | ||
entryValue: this.props.value || this.props.initialValue, | ||
@@ -195,3 +195,3 @@ // A valid typeahead value | ||
this.setState({visible: this.getOptionsForValue(value, this.props.options), | ||
selection: null, | ||
selection: '', | ||
entryValue: value}); | ||
@@ -312,3 +312,2 @@ }, | ||
var InputElement = this.props.textarea ? 'textarea' : 'input'; | ||
return ( | ||
@@ -323,3 +322,2 @@ <div className={classList}> | ||
value={this.state.entryValue} | ||
defaultValue={this.props.defaultValue} | ||
onChange={this._onChange} | ||
@@ -326,0 +324,0 @@ onKeyDown={this._onKeyDown} |
@@ -123,3 +123,3 @@ var _ = require('lodash'); | ||
var input = React.findDOMNode(component.refs.typeahead.refs.entry); | ||
var input = ReactDOM.findDOMNode(component.refs.typeahead.refs.entry); | ||
TestUtils.Simulate.keyPress(input, { keyCode: 87 }); | ||
@@ -126,0 +126,0 @@ }); |
@@ -322,7 +322,7 @@ var _ = require('lodash'); | ||
context('defaultValue', function() { | ||
context('initialValue', function() { | ||
it('should perform an initial search if a default value is provided', function() { | ||
var component = TestUtils.renderIntoDocument(<Typeahead | ||
options={ BEATLES } | ||
defaultValue={ 'o' } | ||
initialValue={ 'o' } | ||
/>); | ||
@@ -329,0 +329,0 @@ |
Sorry, the diff of this file is too big to display
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1559901
0.22%14
-12.5%4
33.33%41300
-4.45%1
Infinity%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed