react-tagsinput
Advanced tools
Comparing version 3.16.1 to 3.17.0
@@ -7,3 +7,3 @@ { | ||
], | ||
"version": "3.16.1", | ||
"version": "3.17.0", | ||
"homepage": "https://github.com/olahol/react-tagsinput", | ||
@@ -10,0 +10,0 @@ "description": "Highly customizable React component for inputing tags", |
@@ -0,1 +1,5 @@ | ||
### 3.17.0 (2017-06-07) | ||
* Ensure input is not cleared when input fails regex validation. | ||
### 3.16.0 (2017-04-09) | ||
@@ -2,0 +6,0 @@ |
@@ -35,1 +35,4 @@ * Ola Holmström (@olahol) | ||
* Ryan Hyslop (@ryanhyslop) | ||
* Kévin Berthommier (@bertho-zero) | ||
* Ilias Tsangaris (@iliastsangaris) | ||
* Hatlen (@Hatlen) |
{ | ||
"name": "react-tagsinput", | ||
"version": "3.16.1", | ||
"version": "3.17.0", | ||
"description": "Highly customizable React component for inputing tags", | ||
@@ -20,3 +20,3 @@ "main": "react-tagsinput.js", | ||
"babel-register": "^6.8.0", | ||
"isparta": "^4.0.0", | ||
"istanbul": "^1.1.0-alpha.1", | ||
"jsdom": "^7.0.2", | ||
@@ -38,3 +38,3 @@ "mocha": "^2.3.3", | ||
"build-example-watch": "reactpack -w --no-extract --no-source-map --no-html example/index.js example/", | ||
"coverage": "./node_modules/.bin/babel-node node_modules/.bin/isparta cover --report text --report html node_modules/.bin/_mocha -- --reporter dot", | ||
"coverage": "istanbul cover --report text --report html _mocha -- --compilers js:babel-register", | ||
"prepublish": "npm run build" | ||
@@ -41,0 +41,0 @@ }, |
@@ -195,2 +195,3 @@ (function (global, factory) { | ||
/* istanbul ignore next */ | ||
function TagsInput() { | ||
@@ -316,2 +317,6 @@ _classCallCheck(this, TagsInput); | ||
if (rejectedTags.length > 0) { | ||
return false; | ||
} | ||
this._clearInput(); | ||
@@ -336,4 +341,4 @@ return false; | ||
value: function focus() { | ||
if (this.refs.input && typeof this.refs.input.focus === 'function') { | ||
this.refs.input.focus(); | ||
if (this.input && typeof this.input.focus === 'function') { | ||
this.input.focus(); | ||
} | ||
@@ -346,4 +351,4 @@ | ||
value: function blur() { | ||
if (this.refs.input && typeof this.refs.input.blur === 'function') { | ||
this.refs.input.blur(); | ||
if (this.input && typeof this.input.blur === 'function') { | ||
this.input.blur(); | ||
} | ||
@@ -431,3 +436,3 @@ | ||
value: function handleClick(e) { | ||
if (e.target === this.refs.div) { | ||
if (e.target === this.div) { | ||
this.focus(); | ||
@@ -538,2 +543,3 @@ } | ||
value: function componentWillReceiveProps(nextProps) { | ||
/* istanbul ignore next */ | ||
if (this.hasControlledInput()) { | ||
@@ -598,3 +604,5 @@ return; | ||
var inputComponent = renderInput(_extends({ | ||
ref: 'input', | ||
ref: function ref(r) { | ||
_this4.input = r; | ||
}, | ||
value: this._tag(), | ||
@@ -611,3 +619,5 @@ onPaste: this.handlePaste.bind(this), | ||
'div', | ||
{ ref: 'div', onClick: this.handleClick.bind(this), className: className }, | ||
{ ref: function ref(r) { | ||
_this4.div = r; | ||
}, onClick: this.handleClick.bind(this), className: className }, | ||
renderLayout(tagComponents, inputComponent) | ||
@@ -614,0 +624,0 @@ ); |
@@ -235,2 +235,3 @@ # react-tagsinput | ||
Callback from the input box, gets one argument `value` which is the content of the input box. | ||
(onChangeInput is only called if the input box is [controlled](https://facebook.github.io/react/docs/forms.html#controlled-components), for this to happen both inputValue and onChangeInput need to be set) | ||
@@ -247,3 +248,3 @@ ##### addKeys | ||
Similar to `currentValue` but needed for controlling the input box. | ||
Similar to `currentValue` but needed for controlling the input box. (inputValue is only useful if you use it together with onChangeInput) | ||
@@ -306,3 +307,9 @@ ##### onlyUnique | ||
Props passed down to every tag component. Defualt is: `{className: 'react-tagsinput-tag', classNameRemove: 'react-tagsinput-remove'}`. | ||
Props passed down to every tag component. Defualt is: | ||
```javascript | ||
{ | ||
className: 'react-tagsinput-tag', | ||
classNameRemove: 'react-tagsinput-remove' | ||
} | ||
``` | ||
@@ -309,0 +316,0 @@ ##### inputProps |
@@ -80,2 +80,3 @@ import React from 'react' | ||
class TagsInput extends React.Component { | ||
/* istanbul ignore next */ | ||
constructor () { | ||
@@ -221,2 +222,6 @@ super() | ||
if (rejectedTags.length > 0) { | ||
return false | ||
} | ||
this._clearInput() | ||
@@ -239,4 +244,4 @@ return false | ||
focus () { | ||
if (this.refs.input && typeof this.refs.input.focus === 'function') { | ||
this.refs.input.focus() | ||
if (this.input && typeof this.input.focus === 'function') { | ||
this.input.focus() | ||
} | ||
@@ -248,4 +253,4 @@ | ||
blur () { | ||
if (this.refs.input && typeof this.refs.input.blur === 'function') { | ||
this.refs.input.blur() | ||
if (this.input && typeof this.input.blur === 'function') { | ||
this.input.blur() | ||
} | ||
@@ -316,3 +321,3 @@ | ||
handleClick (e) { | ||
if (e.target === this.refs.div) { | ||
if (e.target === this.div) { | ||
this.focus() | ||
@@ -408,2 +413,3 @@ } | ||
componentWillReceiveProps (nextProps) { | ||
/* istanbul ignore next */ | ||
if (this.hasControlledInput()) { | ||
@@ -468,3 +474,3 @@ return | ||
let inputComponent = renderInput({ | ||
ref: 'input', | ||
ref: r => { this.input = r }, | ||
value: this._tag(), | ||
@@ -481,3 +487,3 @@ onPaste: ::this.handlePaste, | ||
return ( | ||
<div ref='div' onClick={::this.handleClick} className={className}> | ||
<div ref={r => { this.div = r }} onClick={::this.handleClick} className={className}> | ||
{renderLayout(tagComponents, inputComponent)} | ||
@@ -484,0 +490,0 @@ </div> |
@@ -23,7 +23,7 @@ const jsdom = require("jsdom"); | ||
input() { | ||
return this.refs.tagsinput.refs.input; | ||
return this.refs.tagsinput.input; | ||
} | ||
div() { | ||
return this.refs.tagsinput.refs.div; | ||
return this.refs.tagsinput.div; | ||
} | ||
@@ -144,3 +144,3 @@ | ||
let comp = TestUtils.renderIntoDocument(<TestComponent />); | ||
click(comp.tagsinput().refs.div); | ||
click(comp.tagsinput().div); | ||
}); | ||
@@ -521,3 +521,3 @@ | ||
let comp = TestUtils.renderIntoDocument(<TestComponent disabled={true} />); | ||
assert.ok(comp.tagsinput().refs.input.disabled, "input should be disabled"); | ||
assert.ok(comp.tagsinput().input.disabled, "input should be disabled"); | ||
}); | ||
@@ -718,2 +718,3 @@ | ||
assert.equal(comp.len(), 0, "there should be no tags"); | ||
comp.tagsinput()._clearInput(); | ||
}); | ||
@@ -720,0 +721,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
75531
1616
435