react-dropdown
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -37,3 +37,3 @@ 'use strict'; | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Dropdown).call(this, props)); | ||
var _this = _possibleConstructorReturn(this, (Dropdown.__proto__ || Object.getPrototypeOf(Dropdown)).call(this, props)); | ||
@@ -82,5 +82,7 @@ _this.state = { | ||
this.setState({ | ||
isOpen: !this.state.isOpen | ||
}); | ||
if (!this.props.disabled) { | ||
this.setState({ | ||
isOpen: !this.state.isOpen | ||
}); | ||
} | ||
} | ||
@@ -132,5 +134,5 @@ }, { | ||
var _props = this.props; | ||
var options = _props.options; | ||
var baseClassName = _props.baseClassName; | ||
var _props = this.props, | ||
options = _props.options, | ||
baseClassName = _props.baseClassName; | ||
@@ -181,2 +183,3 @@ var ops = options.map(function (option) { | ||
var disabledClass = this.props.disabled ? 'Dropdown-disabled' : ''; | ||
var placeHolderValue = typeof this.state.selected === 'string' ? this.state.selected : this.state.selected.label; | ||
@@ -201,3 +204,3 @@ var value = _react2.default.createElement( | ||
'div', | ||
{ className: baseClassName + '-control', onMouseDown: this.handleMouseDown.bind(this), onTouchEnd: this.handleMouseDown.bind(this) }, | ||
{ className: baseClassName + '-control ' + disabledClass, onMouseDown: this.handleMouseDown.bind(this), onTouchEnd: this.handleMouseDown.bind(this) }, | ||
value, | ||
@@ -215,2 +218,2 @@ _react2.default.createElement('span', { className: baseClassName + '-arrow' }) | ||
Dropdown.defaultProps = { baseClassName: 'Dropdown' }; | ||
exports.default = Dropdown; | ||
exports.default = Dropdown; |
{ | ||
"name": "react-dropdown", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "React dropdown component", | ||
@@ -44,7 +44,14 @@ "main": "dist/index.js", | ||
}, | ||
"babel": { | ||
"presets": [ | ||
"react", | ||
"es2015", | ||
"stage-0" | ||
] | ||
}, | ||
"devDependencies": { | ||
"babel-cli": "^6.5.1", | ||
"babel-preset-es2015": "^6.5.0", | ||
"babel-preset-react": "^6.5.0", | ||
"babel-preset-stage-0": "^6.5.0", | ||
"babel-cli": "^6.18.0", | ||
"babel-preset-es2015": "^6.18.0", | ||
"babel-preset-react": "^6.16.0", | ||
"babel-preset-stage-0": "^6.16.0", | ||
"babelify": "^7.2.0", | ||
@@ -61,3 +68,3 @@ "browserify": "^13.0.0", | ||
"scripts": { | ||
"build": "babel -d dist index.js", | ||
"build": "babel index.js -o dist/index.js", | ||
"test": "standard index.js", | ||
@@ -64,0 +71,0 @@ "watch": "watchify example/main.js -p browserify-hmr -o example/bundle.js -dv", |
@@ -67,2 +67,10 @@ react-dropdown | ||
Disabling the Dropdown: | ||
Just pass a disabled boolean value to the Dropdown to disable it. This will also give you a `.Dropdown-disabled` class on the element, so you can style it yourself. | ||
```JavaScript | ||
<Dropdown disabled onChange={this._onSelect} value={defaultOption} placeholder="Select an option" /> | ||
``` | ||
Check more examples in the example folder. | ||
@@ -69,0 +77,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
14698
265
91