Skip to content

Commit

Permalink
Merge pull request JedWatson#1 from HubSpot/add-isopen-prop
Browse files Browse the repository at this point in the history
Allow isOpen to be controlled by the parent component
  • Loading branch information
TrevorBurnham committed Feb 24, 2016
2 parents 6cd44b7 + 57a22f9 commit a245c13
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion dist/react-select-plus.js
Expand Up @@ -355,6 +355,7 @@ var Select = _react2['default'].createClass({
ignoreCase: _react2['default'].PropTypes.bool, // whether to perform case-insensitive filtering
inputProps: _react2['default'].PropTypes.object, // custom attributes for the Input
isLoading: _react2['default'].PropTypes.bool, // whether the Select is loading externally or not (such as options being loaded)
isOpen: _react2['default'].PropTypes.bool, // whether the Select dropdown menu is open or not
labelKey: _react2['default'].PropTypes.string, // path of the label value in option objects
matchPos: _react2['default'].PropTypes.string, // (any|start) match the start or entire string when filtering
matchProp: _react2['default'].PropTypes.string, // (any|label|value) which option property to filter on
Expand Down Expand Up @@ -1077,7 +1078,7 @@ var Select = _react2['default'].createClass({
render: function render() {
var valueArray = this.getValueArray();
var options = this._visibleOptions = this.filterOptions(this.props.multi ? valueArray : null);
var isOpen = this.state.isOpen;
var isOpen = typeof this.props.isOpen === 'boolean' ? this.props.isOpen : this.state.isOpen;
if (this.props.multi && !options.length && valueArray.length && !this.state.inputValue) isOpen = false;
var focusedOption = this._focusedOption = this.getFocusableOption(valueArray[0]);
var className = (0, _classnames2['default'])('Select', this.props.className, {
Expand Down
2 changes: 1 addition & 1 deletion dist/react-select-plus.min.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion examples/dist/bundle.js
Expand Up @@ -468,6 +468,7 @@ var Select = _react2['default'].createClass({
ignoreCase: _react2['default'].PropTypes.bool, // whether to perform case-insensitive filtering
inputProps: _react2['default'].PropTypes.object, // custom attributes for the Input
isLoading: _react2['default'].PropTypes.bool, // whether the Select is loading externally or not (such as options being loaded)
isOpen: _react2['default'].PropTypes.bool, // whether the Select dropdown menu is open or not
labelKey: _react2['default'].PropTypes.string, // path of the label value in option objects
matchPos: _react2['default'].PropTypes.string, // (any|start) match the start or entire string when filtering
matchProp: _react2['default'].PropTypes.string, // (any|label|value) which option property to filter on
Expand Down Expand Up @@ -1190,7 +1191,7 @@ var Select = _react2['default'].createClass({
render: function render() {
var valueArray = this.getValueArray();
var options = this._visibleOptions = this.filterOptions(this.props.multi ? valueArray : null);
var isOpen = this.state.isOpen;
var isOpen = typeof this.props.isOpen === 'boolean' ? this.props.isOpen : this.state.isOpen;
if (this.props.multi && !options.length && valueArray.length && !this.state.inputValue) isOpen = false;
var focusedOption = this._focusedOption = this.getFocusableOption(valueArray[0]);
var className = (0, _classnames2['default'])('Select', this.props.className, {
Expand Down
3 changes: 2 additions & 1 deletion examples/dist/standalone.js
Expand Up @@ -355,6 +355,7 @@ var Select = _react2['default'].createClass({
ignoreCase: _react2['default'].PropTypes.bool, // whether to perform case-insensitive filtering
inputProps: _react2['default'].PropTypes.object, // custom attributes for the Input
isLoading: _react2['default'].PropTypes.bool, // whether the Select is loading externally or not (such as options being loaded)
isOpen: _react2['default'].PropTypes.bool, // whether the Select dropdown menu is open or not
labelKey: _react2['default'].PropTypes.string, // path of the label value in option objects
matchPos: _react2['default'].PropTypes.string, // (any|start) match the start or entire string when filtering
matchProp: _react2['default'].PropTypes.string, // (any|label|value) which option property to filter on
Expand Down Expand Up @@ -1077,7 +1078,7 @@ var Select = _react2['default'].createClass({
render: function render() {
var valueArray = this.getValueArray();
var options = this._visibleOptions = this.filterOptions(this.props.multi ? valueArray : null);
var isOpen = this.state.isOpen;
var isOpen = typeof this.props.isOpen === 'boolean' ? this.props.isOpen : this.state.isOpen;
if (this.props.multi && !options.length && valueArray.length && !this.state.inputValue) isOpen = false;
var focusedOption = this._focusedOption = this.getFocusableOption(valueArray[0]);
var className = (0, _classnames2['default'])('Select', this.props.className, {
Expand Down
3 changes: 2 additions & 1 deletion lib/Select.js
Expand Up @@ -73,6 +73,7 @@ var Select = _react2['default'].createClass({
ignoreCase: _react2['default'].PropTypes.bool, // whether to perform case-insensitive filtering
inputProps: _react2['default'].PropTypes.object, // custom attributes for the Input
isLoading: _react2['default'].PropTypes.bool, // whether the Select is loading externally or not (such as options being loaded)
isOpen: _react2['default'].PropTypes.bool, // whether the Select dropdown menu is open or not
labelKey: _react2['default'].PropTypes.string, // path of the label value in option objects
matchPos: _react2['default'].PropTypes.string, // (any|start) match the start or entire string when filtering
matchProp: _react2['default'].PropTypes.string, // (any|label|value) which option property to filter on
Expand Down Expand Up @@ -795,7 +796,7 @@ var Select = _react2['default'].createClass({
render: function render() {
var valueArray = this.getValueArray();
var options = this._visibleOptions = this.filterOptions(this.props.multi ? valueArray : null);
var isOpen = this.state.isOpen;
var isOpen = typeof this.props.isOpen === 'boolean' ? this.props.isOpen : this.state.isOpen;
if (this.props.multi && !options.length && valueArray.length && !this.state.inputValue) isOpen = false;
var focusedOption = this._focusedOption = this.getFocusableOption(valueArray[0]);
var className = (0, _classnames2['default'])('Select', this.props.className, {
Expand Down
3 changes: 2 additions & 1 deletion src/Select.js
Expand Up @@ -45,6 +45,7 @@ const Select = React.createClass({
ignoreCase: React.PropTypes.bool, // whether to perform case-insensitive filtering
inputProps: React.PropTypes.object, // custom attributes for the Input
isLoading: React.PropTypes.bool, // whether the Select is loading externally or not (such as options being loaded)
isOpen: React.PropTypes.bool, // whether the Select dropdown menu is open or not
labelKey: React.PropTypes.string, // path of the label value in option objects
matchPos: React.PropTypes.string, // (any|start) match the start or entire string when filtering
matchProp: React.PropTypes.string, // (any|label|value) which option property to filter on
Expand Down Expand Up @@ -736,7 +737,7 @@ const Select = React.createClass({
render () {
let valueArray = this.getValueArray();
let options = this._visibleOptions = this.filterOptions(this.props.multi ? valueArray : null);
let isOpen = this.state.isOpen;
let isOpen = typeof this.props.isOpen === 'boolean' ? this.props.isOpen : this.state.isOpen;
if (this.props.multi && !options.length && valueArray.length && !this.state.inputValue) isOpen = false;
let focusedOption = this._focusedOption = this.getFocusableOption(valueArray[0]);
let className = classNames('Select', this.props.className, {
Expand Down

0 comments on commit a245c13

Please sign in to comment.