Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

react-select

Package Overview
Dependencies
Maintainers
1
Versions
180
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-select - npm Package Compare versions

Comparing version 0.8.4 to 0.9.0

scss/components.scss

41

dist/react-select.js

@@ -20,3 +20,2 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Select = f()}})(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){

},
blockEvent: function blockEvent(event) {

@@ -34,3 +33,11 @@ event.preventDefault();

},
handleMouseDown: function handleMouseDown(e) {
this.props.mouseDown(this.props.option, e);
},
handleMouseEnter: function handleMouseEnter(e) {
this.props.mouseEnter(this.props.option, e);
},
handleMouseLeave: function handleMouseLeave(e) {
this.props.mouseLeave(this.props.option, e);
},
render: function render() {

@@ -51,6 +58,6 @@ var option = this.props.option;

style: option.style,
onMouseEnter: this.props.mouseEnter,
onMouseLeave: this.props.mouseLeave,
onMouseDown: this.props.mouseDown,
onClick: this.props.mouseDown,
onMouseDown: this.handleMouseDown,
onMouseEnter: this.handleMouseEnter,
onMouseLeave: this.handleMouseLeave,
onClick: this.handleMouseDown,
title: option.title },

@@ -521,2 +528,3 @@ label

_this7.setState({
inputValue: '',
isFocused: false,

@@ -794,10 +802,9 @@ isOpen: false

renderOptionLabel: function renderOptionLabel(op) {
return op[this.props.labelKey];
},
buildMenu: function buildMenu() {
var _this10 = this;
var focusedValue = this.state.focusedOption ? this.state.focusedOption[this.props.valueKey] : null;
var renderLabel = this.props.optionRenderer;
if (!renderLabel) renderLabel = function (op) {
return op[_this10.props.labelKey];
};
var renderLabel = this.props.optionRenderer || this.renderOptionLabel;
if (this.state.filteredOptions.length > 0) {

@@ -829,5 +836,2 @@ focusedValue = focusedValue == null ? this.state.filteredOptions[0] : focusedValue;

var ref = isFocused ? 'focused' : null;
var mouseEnter = this.focusOption.bind(this, op);
var mouseLeave = this.unfocusOption.bind(this, op);
var mouseDown = this.selectValue.bind(this, op);
var optionResult = React.createElement(this.props.optionComponent, {

@@ -837,6 +841,5 @@ key: 'option-' + op[this.props.valueKey],

renderFunc: renderLabel,
mouseEnter: mouseEnter,
mouseLeave: mouseLeave,
mouseDown: mouseDown,
click: mouseDown,
mouseDown: this.selectValue,
mouseEnter: this.focusOption,
mouseLeave: this.unfocusOption,
addLabelText: this.props.addLabelText,

@@ -843,0 +846,0 @@ option: op,

@@ -1,1 +0,1 @@

!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Select=e()}}(function(){return function e(t,s,o){function i(a,p){if(!s[a]){if(!t[a]){var r="function"==typeof require&&require;if(!p&&r)return r(a,!0);if(n)return n(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var u=s[a]={exports:{}};t[a][0].call(u.exports,function(e){var s=t[a][1][e];return i(s?s:e)},u,u.exports,e,t,s,o)}return s[a].exports}for(var n="function"==typeof require&&require,a=0;a<o.length;a++)i(o[a]);return i}({1:[function(e,t,s){(function(e){"use strict";var s="undefined"!=typeof window?window.React:"undefined"!=typeof e?e.React:null,o="undefined"!=typeof window?window.classNames:"undefined"!=typeof e?e.classNames:null,i=s.createClass({displayName:"Option",propTypes:{addLabelText:s.PropTypes.string,className:s.PropTypes.string,mouseDown:s.PropTypes.func,mouseEnter:s.PropTypes.func,mouseLeave:s.PropTypes.func,option:s.PropTypes.object.isRequired,renderFunc:s.PropTypes.func},blockEvent:function(e){e.preventDefault(),"A"===e.target.tagName&&"href"in e.target&&(e.target.target?window.open(e.target.href):window.location.href=e.target.href)},render:function(){var e=this.props.option,t=e.create?this.props.addLabelText.replace("{label}",e.label):this.props.renderFunc(e),i=o(this.props.className,e.className);return e.disabled?s.createElement("div",{className:i,onMouseDown:this.blockEvent,onClick:this.blockEvent},t):s.createElement("div",{className:i,style:e.style,onMouseEnter:this.props.mouseEnter,onMouseLeave:this.props.mouseLeave,onMouseDown:this.props.mouseDown,onClick:this.props.mouseDown,title:e.title},t)}});t.exports=i}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,s){(function(s){"use strict";var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var o in s)Object.prototype.hasOwnProperty.call(s,o)&&(e[o]=s[o])}return e},i="undefined"!=typeof window?window.React:"undefined"!=typeof s?s.React:null,n=e("react-dom"),a="undefined"!=typeof window?window.AutosizeInput:"undefined"!=typeof s?s.AutosizeInput:null,p="undefined"!=typeof window?window.classNames:"undefined"!=typeof s?s.classNames:null,r=e("./Value"),l=e("./SingleValue"),u=e("./Option"),c=0,d=i.createClass({displayName:"Select",propTypes:{addLabelText:i.PropTypes.string,allowCreate:i.PropTypes.bool,asyncOptions:i.PropTypes.func,autoload:i.PropTypes.bool,backspaceRemoves:i.PropTypes.bool,cacheAsyncResults:i.PropTypes.bool,className:i.PropTypes.string,clearAllText:i.PropTypes.string,clearValueText:i.PropTypes.string,clearable:i.PropTypes.bool,delimiter:i.PropTypes.string,disabled:i.PropTypes.bool,filterOption:i.PropTypes.func,filterOptions:i.PropTypes.func,ignoreCase:i.PropTypes.bool,inputProps:i.PropTypes.object,isLoading:i.PropTypes.bool,labelKey:i.PropTypes.string,matchPos:i.PropTypes.string,matchProp:i.PropTypes.string,multi:i.PropTypes.bool,name:i.PropTypes.string,newOptionCreator:i.PropTypes.func,noResultsText:i.PropTypes.string,onBlur:i.PropTypes.func,onChange:i.PropTypes.func,onFocus:i.PropTypes.func,onInputChange:i.PropTypes.func,onOptionLabelClick:i.PropTypes.func,optionComponent:i.PropTypes.func,optionRenderer:i.PropTypes.func,options:i.PropTypes.array,placeholder:i.PropTypes.string,searchable:i.PropTypes.bool,searchingText:i.PropTypes.string,searchPromptText:i.PropTypes.string,singleValueComponent:i.PropTypes.func,value:i.PropTypes.any,valueComponent:i.PropTypes.func,valueKey:i.PropTypes.string,valueRenderer:i.PropTypes.func},getDefaultProps:function(){return{addLabelText:'Add "{label}"?',allowCreate:!1,asyncOptions:void 0,autoload:!0,backspaceRemoves:!0,cacheAsyncResults:!0,className:void 0,clearAllText:"Clear all",clearValueText:"Clear value",clearable:!0,delimiter:",",disabled:!1,ignoreCase:!0,inputProps:{},isLoading:!1,labelKey:"label",matchPos:"any",matchProp:"any",name:void 0,newOptionCreator:void 0,noResultsText:"No results found",onChange:void 0,onInputChange:void 0,onOptionLabelClick:void 0,optionComponent:u,options:void 0,placeholder:"Select...",searchable:!0,searchingText:"Searching...",searchPromptText:"Type to search",singleValueComponent:l,value:void 0,valueComponent:r,valueKey:"value"}},getInitialState:function(){return{isFocused:!1,isLoading:!1,isOpen:!1,options:this.props.options}},componentWillMount:function(){var e=this;this._optionsCache={},this._optionsFilterString="",this._closeMenuIfClickedOutside=function(t){if(e.state.isOpen){var s=n.findDOMNode(e.refs.selectMenuContainer),o=n.findDOMNode(e.refs.control),i=e.clickedOutsideElement(s,t),a=e.clickedOutsideElement(o,t);i&&a&&e.setState({isOpen:!1},e._unbindCloseMenuIfClickedOutside)}},this._bindCloseMenuIfClickedOutside=function(){!document.addEventListener&&document.attachEvent?document.attachEvent("onclick",e._closeMenuIfClickedOutside):document.addEventListener("click",e._closeMenuIfClickedOutside)},this._unbindCloseMenuIfClickedOutside=function(){!document.removeEventListener&&document.detachEvent?document.detachEvent("onclick",e._closeMenuIfClickedOutside):document.removeEventListener("click",e._closeMenuIfClickedOutside)},this.setState(this.getStateFromValue(this.props.value))},componentDidMount:function(){this.props.asyncOptions&&this.props.autoload&&this.autoloadAsyncOptions()},componentWillUnmount:function(){clearTimeout(this._blurTimeout),clearTimeout(this._focusTimeout),this.state.isOpen&&this._unbindCloseMenuIfClickedOutside()},componentWillReceiveProps:function(e){var t=this,s=!1;if(JSON.stringify(e.options)!==JSON.stringify(this.props.options)&&(s=!0,this.setState({options:e.options,filteredOptions:this.filterOptions(e.options)})),e.value!==this.state.value||e.placeholder!==this.props.placeholder||s){var o=function(s){t.setState(t.getStateFromValue(e.value,s&&s.options||e.options,e.placeholder))};this.props.asyncOptions?this.loadAsyncOptions(e.value,{},o):o()}},componentDidUpdate:function(){var e=this;if(!this.props.disabled&&this._focusAfterUpdate&&(clearTimeout(this._blurTimeout),clearTimeout(this._focusTimeout),this._focusTimeout=setTimeout(function(){e.isMounted()&&(e.getInputNode().focus(),e._focusAfterUpdate=!1)},50)),this._focusedOptionReveal){if(this.refs.focused&&this.refs.menu){var t=n.findDOMNode(this.refs.focused),s=n.findDOMNode(this.refs.menu),o=t.getBoundingClientRect(),i=s.getBoundingClientRect();(o.bottom>i.bottom||o.top<i.top)&&(s.scrollTop=t.offsetTop+t.clientHeight-s.offsetHeight)}this._focusedOptionReveal=!1}},focus:function(){this.getInputNode().focus()},clickedOutsideElement:function(e,t){for(var s=t.target?t.target:t.srcElement;null!=s;){if(s===e)return!1;s=s.offsetParent}return!0},getStateFromValue:function(e,t,s){var o=this;t||(t=this.state.options),s||(s=this.props.placeholder),this._optionsFilterString="";var i,n=this.initValuesArray(e,t),a=this.filterOptions(t,n),p=null;return!this.props.multi&&n.length?(i=n[0],p=n[0][this.props.valueKey]):(i=this.getFirstFocusableOption(a),p=n.map(function(e){return e[o.props.valueKey]}).join(this.props.delimiter)),{value:p,values:n,inputValue:"",filteredOptions:a,placeholder:!this.props.multi&&n.length?n[0][this.props.labelKey]:s,focusedOption:i}},getFirstFocusableOption:function(e){for(var t=0;t<e.length;++t)if(!e[t].disabled)return e[t]},initValuesArray:function(e,t){var s=this;return Array.isArray(e)||(e="string"==typeof e?""===e?[]:this.props.multi?e.split(this.props.delimiter):[e]:void 0!==e&&null!==e?[e]:[]),e.map(function(e){if("string"==typeof e||"number"==typeof e){for(var o in t)if(t.hasOwnProperty(o)&&t[o]&&(t[o][s.props.valueKey]===e||"number"==typeof t[o][s.props.valueKey]&&t[o][s.props.valueKey].toString()===e))return t[o];return{value:e,label:e}}return e})},setValue:function(e,t){(t||void 0===t)&&(this._focusAfterUpdate=!0);var s=this.getStateFromValue(e);s.isOpen=!1,this.fireChangeEvent(s),this.setState(s)},selectValue:function(e){this.props.multi?e&&this.addValue(e):this.setValue(e),this._unbindCloseMenuIfClickedOutside()},addValue:function(e){this.setValue(this.state.values.concat(e))},popValue:function(){this.setValue(this.state.values.slice(0,this.state.values.length-1))},removeValue:function(e){this.setValue(this.state.values.filter(function(t){return t!==e}))},clearValue:function(e){e&&"mousedown"===e.type&&0!==e.button||(e.stopPropagation(),e.preventDefault(),this.setValue(null))},resetValue:function(){this.setValue(""===this.state.value?null:this.state.value)},getInputNode:function(){var e=this.refs.input;return this.props.searchable?e:n.findDOMNode(e)},fireChangeEvent:function(e){e.value!==this.state.value&&this.props.onChange&&this.props.onChange(e.value,e.values)},handleMouseDown:function(e){return this.props.disabled||"mousedown"===e.type&&0!==e.button?void 0:(e.stopPropagation(),e.preventDefault(),this.state.isOpen&&!this.props.searchable?void this.setState({isOpen:!1},this._unbindCloseMenuIfClickedOutside):void(this.state.isFocused?this.setState({isOpen:!0},this._bindCloseMenuIfClickedOutside):(this._openAfterFocus=!0,this.getInputNode().focus())))},handleMouseDownOnMenu:function(e){this.props.disabled||"mousedown"===e.type&&0!==e.button||(e.stopPropagation(),e.preventDefault())},handleMouseDownOnArrow:function(e){this.props.disabled||"mousedown"===e.type&&0!==e.button||this.state.isOpen&&(e.stopPropagation(),e.preventDefault(),this.setState({isOpen:!1},this._unbindCloseMenuIfClickedOutside))},handleInputFocus:function(e){var t=this,s=this.state.isOpen||this._openAfterFocus;this.setState({isFocused:!0,isOpen:s},function(){s?t._bindCloseMenuIfClickedOutside():t._unbindCloseMenuIfClickedOutside()}),this._openAfterFocus=!1,this.props.onFocus&&this.props.onFocus(e)},handleInputBlur:function(e){var t=this,s=n.findDOMNode(this.refs.menu);document.activeElement.isEqualNode(s)||(this._blurTimeout=setTimeout(function(){!t._focusAfterUpdate&&t.isMounted()&&t.setState({isFocused:!1,isOpen:!1})},50),this.props.onBlur&&this.props.onBlur(e))},handleKeyDown:function(e){if(!this.props.disabled){switch(e.keyCode){case 8:return void(!this.state.inputValue&&this.props.backspaceRemoves&&(e.preventDefault(),this.popValue()));case 9:if(e.shiftKey||!this.state.isOpen||!this.state.focusedOption)return;this.selectFocusedOption();break;case 13:if(!this.state.isOpen)return;this.selectFocusedOption();break;case 27:this.state.isOpen?this.resetValue():this.props.clearable&&this.clearValue(e);break;case 38:this.focusPreviousOption();break;case 40:this.focusNextOption();break;case 188:if(!this.props.allowCreate||!this.props.multi)return;e.preventDefault(),e.stopPropagation(),this.selectFocusedOption();break;default:return}e.preventDefault()}},_getNewFocusedOption:function(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t]===this.state.focusedOption)return e[t];return this.getFirstFocusableOption(e)},handleInputChange:function(e){if(this._optionsFilterString=e.target.value,this.props.onInputChange&&this.props.onInputChange(e.target.value),this.props.asyncOptions)this.setState({isLoading:!0,inputValue:e.target.value}),this.loadAsyncOptions(e.target.value,{isLoading:!1,isOpen:!0},this._bindCloseMenuIfClickedOutside);else{var t=this.filterOptions(this.state.options);this.setState({isOpen:!0,inputValue:e.target.value,filteredOptions:t,focusedOption:this._getNewFocusedOption(t)},this._bindCloseMenuIfClickedOutside)}},autoloadAsyncOptions:function(){var e=this;this.setState({isLoading:!0}),this.loadAsyncOptions(this.props.value||"",{isLoading:!1},function(){e.setValue(e.props.value,!1)})},loadAsyncOptions:function(e,t,s){void 0===e&&(e="");var o=this,i=this._currentRequestId=c++;if(this.props.cacheAsyncResults)for(var n=0;n<=e.length;n++){var a=e.slice(0,n);if(this._optionsCache[a]&&(e===a||this._optionsCache[a].complete)){var p=this._optionsCache[a].options,r=this.filterOptions(p),l={options:p,filteredOptions:r,focusedOption:this._getNewFocusedOption(r)};for(var u in t)t.hasOwnProperty(u)&&(l[u]=t[u]);return this.setState(l),void(s&&s.call(this,l))}}var d=function(n,a){if(n)throw n;if(o.props.cacheAsyncResults&&(o._optionsCache[e]=a),i===o._currentRequestId){var p=o.filterOptions(a.options),r={options:a.options,filteredOptions:p,focusedOption:o._getNewFocusedOption(p)};for(var l in t)t.hasOwnProperty(l)&&(r[l]=t[l]);o.setState(r),s&&s.call(o,r)}},h=this.props.asyncOptions(e,d);h&&"function"==typeof h.then&&h.then(function(e){d(null,e)},function(e){d(e)})},filterOptions:function(e,t){var s=this._optionsFilterString,o=(t||this.state.values).map(function(e){return e.value});if(this.props.filterOptions)return this.props.filterOptions.call(this,e,s,o);var i=function(e){if(this.props.multi&&o.indexOf(e[this.props.valueKey])>-1)return!1;if(this.props.filterOption)return this.props.filterOption.call(this,e,s);var t=String(e[this.props.valueKey]),i=String(e[this.props.labelKey]);return this.props.ignoreCase&&(t=t.toLowerCase(),i=i.toLowerCase(),s=s.toLowerCase()),s&&"start"!==this.props.matchPos?"label"!==this.props.matchProp&&t.indexOf(s)>=0||"value"!==this.props.matchProp&&i.indexOf(s)>=0:"label"!==this.props.matchProp&&t.substr(0,s.length)===s||"value"!==this.props.matchProp&&i.substr(0,s.length)===s};return(e||[]).filter(i,this)},selectFocusedOption:function(){return this.props.allowCreate&&!this.state.focusedOption?this.selectValue(this.state.inputValue):this.state.focusedOption?this.selectValue(this.state.focusedOption):void 0},focusOption:function(e){this.setState({focusedOption:e})},focusNextOption:function(){this.focusAdjacentOption("next")},focusPreviousOption:function(){this.focusAdjacentOption("previous")},focusAdjacentOption:function(e){this._focusedOptionReveal=!0;var t=this.state.filteredOptions.filter(function(e){return!e.disabled});if(!this.state.isOpen)return void this.setState({isOpen:!0,inputValue:"",focusedOption:this.state.focusedOption||t["next"===e?0:t.length-1]},this._bindCloseMenuIfClickedOutside);if(t.length){for(var s=-1,o=0;o<t.length;o++)if(this.state.focusedOption===t[o]){s=o;break}var i=t[0];"next"===e&&s>-1&&s<t.length-1?i=t[s+1]:"previous"===e&&(i=s>0?t[s-1]:t[t.length-1]),this.setState({focusedOption:i})}},unfocusOption:function(e){this.state.focusedOption===e&&this.setState({focusedOption:null})},buildMenu:function(){var e=this,t=this.state.focusedOption?this.state.focusedOption[this.props.valueKey]:null,s=this.props.optionRenderer;s||(s=function(t){return t[e.props.labelKey]}),this.state.filteredOptions.length>0&&(t=null==t?this.state.filteredOptions[0]:t);var o=this.state.filteredOptions;if(this.props.allowCreate&&this.state.inputValue.trim()){var n=this.state.inputValue;o=o.slice();var a=this.props.newOptionCreator?this.props.newOptionCreator(n):{value:n,label:n,create:!0};o.unshift(a)}var r=Object.keys(o).map(function(e){var n=o[e],a=this.state.value===n[this.props.valueKey],r=t===n[this.props.valueKey],l=p({"Select-option":!0,"is-selected":a,"is-focused":r,"is-disabled":n.disabled}),u=r?"focused":null,c=this.focusOption.bind(this,n),d=this.unfocusOption.bind(this,n),h=this.selectValue.bind(this,n),f=i.createElement(this.props.optionComponent,{key:"option-"+n[this.props.valueKey],className:l,renderFunc:s,mouseEnter:c,mouseLeave:d,mouseDown:h,click:h,addLabelText:this.props.addLabelText,option:n,ref:u});return f},this);if(r.length)return r;var l,u;return this.isLoading()?(u="Select-searching",l=this.props.searchingText):this.state.inputValue||!this.props.asyncOptions?(u="Select-noresults",l=this.props.noResultsText):(u="Select-search-prompt",l=this.props.searchPromptText),i.createElement("div",{className:u},l)},handleOptionLabelClick:function(e,t){this.props.onOptionLabelClick&&this.props.onOptionLabelClick(e,t)},isLoading:function(){return this.props.isLoading||this.state.isLoading},render:function(){var e=p("Select",this.props.className,{"Select--multi":this.props.multi,"is-searchable":this.props.searchable,"is-open":this.state.isOpen,"is-focused":this.state.isFocused,"is-loading":this.isLoading(),"is-disabled":this.props.disabled,"has-value":this.state.value}),t=[];if(this.props.multi&&this.state.values.forEach(function(e){var s=this.handleOptionLabelClick.bind(this,e),o=this.removeValue.bind(this,e),n=i.createElement(this.props.valueComponent,{key:e.value,option:e,renderer:this.props.valueRenderer,optionLabelClick:!!this.props.onOptionLabelClick,onOptionLabelClick:s,onRemove:o,disabled:this.props.disabled});t.push(n)},this),!(this.state.inputValue||this.props.multi&&t.length)){var s=this.state.values[0]||null;if(this.props.valueRenderer&&this.state.values.length)t.push(i.createElement(r,{key:0,option:s,renderer:this.props.valueRenderer,disabled:this.props.disabled}));else{var n=i.createElement(this.props.singleValueComponent,{key:"placeholder",value:s,placeholder:this.state.placeholder});t.push(n)}}var l,u,c=this.isLoading()?i.createElement("span",{className:"Select-loading-zone","aria-hidden":"true"},i.createElement("span",{className:"Select-loading"})):null,d=this.props.clearable&&this.state.value&&!this.props.disabled&&!this.isLoading()?i.createElement("span",{className:"Select-clear-zone",title:this.props.multi?this.props.clearAllText:this.props.clearValueText,"aria-label":this.props.multi?this.props.clearAllText:this.props.clearValueText,onMouseDown:this.clearValue,onTouchEnd:this.clearValue,onClick:this.clearValue},i.createElement("span",{className:"Select-clear",dangerouslySetInnerHTML:{__html:"&times;"}})):null,h=i.createElement("span",{className:"Select-arrow-zone",onMouseDown:this.handleMouseDownOnArrow},i.createElement("span",{className:"Select-arrow",onMouseDown:this.handleMouseDownOnArrow}));this.state.isOpen&&(u={ref:"menu",className:"Select-menu",onMouseDown:this.handleMouseDownOnMenu},l=i.createElement("div",{ref:"selectMenuContainer",className:"Select-menu-outer"},i.createElement("div",u,this.buildMenu())));var f,v={ref:"input",className:"Select-input "+(this.props.inputProps.className||""),tabIndex:this.props.tabIndex||0,onFocus:this.handleInputFocus,onBlur:this.handleInputBlur};for(var m in this.props.inputProps)this.props.inputProps.hasOwnProperty(m)&&"className"!==m&&(v[m]=this.props.inputProps[m]);return this.props.disabled?this.props.multi&&this.state.values.length||(f=i.createElement("div",{className:"Select-input"}," ")):f=this.props.searchable?i.createElement(a,o({value:this.state.inputValue,onChange:this.handleInputChange,minWidth:"5"},v)):i.createElement("div",v," "),i.createElement("div",{ref:"wrapper",className:e},i.createElement("input",{type:"hidden",ref:"value",name:this.props.name,value:this.state.value,disabled:this.props.disabled}),i.createElement("div",{className:"Select-control",ref:"control",onKeyDown:this.handleKeyDown,onMouseDown:this.handleMouseDown,onTouchEnd:this.handleMouseDown},t,f,c,d,h),l)}});t.exports=d}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./Option":1,"./SingleValue":3,"./Value":4,"react-dom":void 0}],3:[function(e,t,s){(function(e){"use strict";var s="undefined"!=typeof window?window.React:"undefined"!=typeof e?e.React:null,o="undefined"!=typeof window?window.classNames:"undefined"!=typeof e?e.classNames:null,i=s.createClass({displayName:"SingleValue",propTypes:{placeholder:s.PropTypes.string,value:s.PropTypes.object},render:function(){var e=o("Select-placeholder",this.props.value&&this.props.value.className);return s.createElement("div",{className:e,style:this.props.value&&this.props.value.style,title:this.props.value&&this.props.value.title},this.props.placeholder)}});t.exports=i}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],4:[function(e,t,s){(function(e){"use strict";var s="undefined"!=typeof window?window.React:"undefined"!=typeof e?e.React:null,o="undefined"!=typeof window?window.classNames:"undefined"!=typeof e?e.classNames:null,i=s.createClass({displayName:"Value",propTypes:{disabled:s.PropTypes.bool,onOptionLabelClick:s.PropTypes.func,onRemove:s.PropTypes.func,option:s.PropTypes.object.isRequired,optionLabelClick:s.PropTypes.bool,renderer:s.PropTypes.func},blockEvent:function(e){e.stopPropagation()},handleOnRemove:function(e){this.props.disabled||this.props.onRemove(e)},render:function(){var e=this.props.option.label;return this.props.renderer&&(e=this.props.renderer(this.props.option)),this.props.onRemove||this.props.optionLabelClick?(this.props.optionLabelClick&&(e=s.createElement("a",{className:o("Select-item-label__a",this.props.option.className),onMouseDown:this.blockEvent,onTouchEnd:this.props.onOptionLabelClick,onClick:this.props.onOptionLabelClick,style:this.props.option.style,title:this.props.option.title},e)),s.createElement("div",{className:o("Select-item",this.props.option.className),style:this.props.option.style,title:this.props.option.title},s.createElement("span",{className:"Select-item-icon",onMouseDown:this.blockEvent,onClick:this.handleOnRemove,onTouchEnd:this.handleOnRemove},"×"),s.createElement("span",{className:"Select-item-label"},e))):s.createElement("div",{className:o("Select-value",this.props.option.className),style:this.props.option.style,title:this.props.option.title},e)}});t.exports=i}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[2])(2)});
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Select=e()}}(function(){return function e(t,s,o){function i(a,p){if(!s[a]){if(!t[a]){var r="function"==typeof require&&require;if(!p&&r)return r(a,!0);if(n)return n(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var u=s[a]={exports:{}};t[a][0].call(u.exports,function(e){var s=t[a][1][e];return i(s?s:e)},u,u.exports,e,t,s,o)}return s[a].exports}for(var n="function"==typeof require&&require,a=0;a<o.length;a++)i(o[a]);return i}({1:[function(e,t,s){(function(e){"use strict";var s="undefined"!=typeof window?window.React:"undefined"!=typeof e?e.React:null,o="undefined"!=typeof window?window.classNames:"undefined"!=typeof e?e.classNames:null,i=s.createClass({displayName:"Option",propTypes:{addLabelText:s.PropTypes.string,className:s.PropTypes.string,mouseDown:s.PropTypes.func,mouseEnter:s.PropTypes.func,mouseLeave:s.PropTypes.func,option:s.PropTypes.object.isRequired,renderFunc:s.PropTypes.func},blockEvent:function(e){e.preventDefault(),"A"===e.target.tagName&&"href"in e.target&&(e.target.target?window.open(e.target.href):window.location.href=e.target.href)},handleMouseDown:function(e){this.props.mouseDown(this.props.option,e)},handleMouseEnter:function(e){this.props.mouseEnter(this.props.option,e)},handleMouseLeave:function(e){this.props.mouseLeave(this.props.option,e)},render:function(){var e=this.props.option,t=e.create?this.props.addLabelText.replace("{label}",e.label):this.props.renderFunc(e),i=o(this.props.className,e.className);return e.disabled?s.createElement("div",{className:i,onMouseDown:this.blockEvent,onClick:this.blockEvent},t):s.createElement("div",{className:i,style:e.style,onMouseDown:this.handleMouseDown,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,onClick:this.handleMouseDown,title:e.title},t)}});t.exports=i}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,s){(function(s){"use strict";var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var o in s)Object.prototype.hasOwnProperty.call(s,o)&&(e[o]=s[o])}return e},i="undefined"!=typeof window?window.React:"undefined"!=typeof s?s.React:null,n=e("react-dom"),a="undefined"!=typeof window?window.AutosizeInput:"undefined"!=typeof s?s.AutosizeInput:null,p="undefined"!=typeof window?window.classNames:"undefined"!=typeof s?s.classNames:null,r=e("./Value"),l=e("./SingleValue"),u=e("./Option"),c=0,h=i.createClass({displayName:"Select",propTypes:{addLabelText:i.PropTypes.string,allowCreate:i.PropTypes.bool,asyncOptions:i.PropTypes.func,autoload:i.PropTypes.bool,backspaceRemoves:i.PropTypes.bool,cacheAsyncResults:i.PropTypes.bool,className:i.PropTypes.string,clearAllText:i.PropTypes.string,clearValueText:i.PropTypes.string,clearable:i.PropTypes.bool,delimiter:i.PropTypes.string,disabled:i.PropTypes.bool,filterOption:i.PropTypes.func,filterOptions:i.PropTypes.func,ignoreCase:i.PropTypes.bool,inputProps:i.PropTypes.object,isLoading:i.PropTypes.bool,labelKey:i.PropTypes.string,matchPos:i.PropTypes.string,matchProp:i.PropTypes.string,multi:i.PropTypes.bool,name:i.PropTypes.string,newOptionCreator:i.PropTypes.func,noResultsText:i.PropTypes.string,onBlur:i.PropTypes.func,onChange:i.PropTypes.func,onFocus:i.PropTypes.func,onInputChange:i.PropTypes.func,onOptionLabelClick:i.PropTypes.func,optionComponent:i.PropTypes.func,optionRenderer:i.PropTypes.func,options:i.PropTypes.array,placeholder:i.PropTypes.string,searchable:i.PropTypes.bool,searchingText:i.PropTypes.string,searchPromptText:i.PropTypes.string,singleValueComponent:i.PropTypes.func,value:i.PropTypes.any,valueComponent:i.PropTypes.func,valueKey:i.PropTypes.string,valueRenderer:i.PropTypes.func},getDefaultProps:function(){return{addLabelText:'Add "{label}"?',allowCreate:!1,asyncOptions:void 0,autoload:!0,backspaceRemoves:!0,cacheAsyncResults:!0,className:void 0,clearAllText:"Clear all",clearValueText:"Clear value",clearable:!0,delimiter:",",disabled:!1,ignoreCase:!0,inputProps:{},isLoading:!1,labelKey:"label",matchPos:"any",matchProp:"any",name:void 0,newOptionCreator:void 0,noResultsText:"No results found",onChange:void 0,onInputChange:void 0,onOptionLabelClick:void 0,optionComponent:u,options:void 0,placeholder:"Select...",searchable:!0,searchingText:"Searching...",searchPromptText:"Type to search",singleValueComponent:l,value:void 0,valueComponent:r,valueKey:"value"}},getInitialState:function(){return{isFocused:!1,isLoading:!1,isOpen:!1,options:this.props.options}},componentWillMount:function(){var e=this;this._optionsCache={},this._optionsFilterString="",this._closeMenuIfClickedOutside=function(t){if(e.state.isOpen){var s=n.findDOMNode(e.refs.selectMenuContainer),o=n.findDOMNode(e.refs.control),i=e.clickedOutsideElement(s,t),a=e.clickedOutsideElement(o,t);i&&a&&e.setState({isOpen:!1},e._unbindCloseMenuIfClickedOutside)}},this._bindCloseMenuIfClickedOutside=function(){!document.addEventListener&&document.attachEvent?document.attachEvent("onclick",e._closeMenuIfClickedOutside):document.addEventListener("click",e._closeMenuIfClickedOutside)},this._unbindCloseMenuIfClickedOutside=function(){!document.removeEventListener&&document.detachEvent?document.detachEvent("onclick",e._closeMenuIfClickedOutside):document.removeEventListener("click",e._closeMenuIfClickedOutside)},this.setState(this.getStateFromValue(this.props.value))},componentDidMount:function(){this.props.asyncOptions&&this.props.autoload&&this.autoloadAsyncOptions()},componentWillUnmount:function(){clearTimeout(this._blurTimeout),clearTimeout(this._focusTimeout),this.state.isOpen&&this._unbindCloseMenuIfClickedOutside()},componentWillReceiveProps:function(e){var t=this,s=!1;if(JSON.stringify(e.options)!==JSON.stringify(this.props.options)&&(s=!0,this.setState({options:e.options,filteredOptions:this.filterOptions(e.options)})),e.value!==this.state.value||e.placeholder!==this.props.placeholder||s){var o=function(s){t.setState(t.getStateFromValue(e.value,s&&s.options||e.options,e.placeholder))};this.props.asyncOptions?this.loadAsyncOptions(e.value,{},o):o()}},componentDidUpdate:function(){var e=this;if(!this.props.disabled&&this._focusAfterUpdate&&(clearTimeout(this._blurTimeout),clearTimeout(this._focusTimeout),this._focusTimeout=setTimeout(function(){e.isMounted()&&(e.getInputNode().focus(),e._focusAfterUpdate=!1)},50)),this._focusedOptionReveal){if(this.refs.focused&&this.refs.menu){var t=n.findDOMNode(this.refs.focused),s=n.findDOMNode(this.refs.menu),o=t.getBoundingClientRect(),i=s.getBoundingClientRect();(o.bottom>i.bottom||o.top<i.top)&&(s.scrollTop=t.offsetTop+t.clientHeight-s.offsetHeight)}this._focusedOptionReveal=!1}},focus:function(){this.getInputNode().focus()},clickedOutsideElement:function(e,t){for(var s=t.target?t.target:t.srcElement;null!=s;){if(s===e)return!1;s=s.offsetParent}return!0},getStateFromValue:function(e,t,s){var o=this;t||(t=this.state.options),s||(s=this.props.placeholder),this._optionsFilterString="";var i,n=this.initValuesArray(e,t),a=this.filterOptions(t,n),p=null;return!this.props.multi&&n.length?(i=n[0],p=n[0][this.props.valueKey]):(i=this.getFirstFocusableOption(a),p=n.map(function(e){return e[o.props.valueKey]}).join(this.props.delimiter)),{value:p,values:n,inputValue:"",filteredOptions:a,placeholder:!this.props.multi&&n.length?n[0][this.props.labelKey]:s,focusedOption:i}},getFirstFocusableOption:function(e){for(var t=0;t<e.length;++t)if(!e[t].disabled)return e[t]},initValuesArray:function(e,t){var s=this;return Array.isArray(e)||(e="string"==typeof e?""===e?[]:this.props.multi?e.split(this.props.delimiter):[e]:void 0!==e&&null!==e?[e]:[]),e.map(function(e){if("string"==typeof e||"number"==typeof e){for(var o in t)if(t.hasOwnProperty(o)&&t[o]&&(t[o][s.props.valueKey]===e||"number"==typeof t[o][s.props.valueKey]&&t[o][s.props.valueKey].toString()===e))return t[o];return{value:e,label:e}}return e})},setValue:function(e,t){(t||void 0===t)&&(this._focusAfterUpdate=!0);var s=this.getStateFromValue(e);s.isOpen=!1,this.fireChangeEvent(s),this.setState(s)},selectValue:function(e){this.props.multi?e&&this.addValue(e):this.setValue(e),this._unbindCloseMenuIfClickedOutside()},addValue:function(e){this.setValue(this.state.values.concat(e))},popValue:function(){this.setValue(this.state.values.slice(0,this.state.values.length-1))},removeValue:function(e){this.setValue(this.state.values.filter(function(t){return t!==e}))},clearValue:function(e){e&&"mousedown"===e.type&&0!==e.button||(e.stopPropagation(),e.preventDefault(),this.setValue(null))},resetValue:function(){this.setValue(""===this.state.value?null:this.state.value)},getInputNode:function(){var e=this.refs.input;return this.props.searchable?e:n.findDOMNode(e)},fireChangeEvent:function(e){e.value!==this.state.value&&this.props.onChange&&this.props.onChange(e.value,e.values)},handleMouseDown:function(e){return this.props.disabled||"mousedown"===e.type&&0!==e.button?void 0:(e.stopPropagation(),e.preventDefault(),this.state.isOpen&&!this.props.searchable?void this.setState({isOpen:!1},this._unbindCloseMenuIfClickedOutside):void(this.state.isFocused?this.setState({isOpen:!0},this._bindCloseMenuIfClickedOutside):(this._openAfterFocus=!0,this.getInputNode().focus())))},handleMouseDownOnMenu:function(e){this.props.disabled||"mousedown"===e.type&&0!==e.button||(e.stopPropagation(),e.preventDefault())},handleMouseDownOnArrow:function(e){this.props.disabled||"mousedown"===e.type&&0!==e.button||this.state.isOpen&&(e.stopPropagation(),e.preventDefault(),this.setState({isOpen:!1},this._unbindCloseMenuIfClickedOutside))},handleInputFocus:function(e){var t=this,s=this.state.isOpen||this._openAfterFocus;this.setState({isFocused:!0,isOpen:s},function(){s?t._bindCloseMenuIfClickedOutside():t._unbindCloseMenuIfClickedOutside()}),this._openAfterFocus=!1,this.props.onFocus&&this.props.onFocus(e)},handleInputBlur:function(e){var t=this,s=n.findDOMNode(this.refs.menu);document.activeElement.isEqualNode(s)||(this._blurTimeout=setTimeout(function(){!t._focusAfterUpdate&&t.isMounted()&&t.setState({inputValue:"",isFocused:!1,isOpen:!1})},50),this.props.onBlur&&this.props.onBlur(e))},handleKeyDown:function(e){if(!this.props.disabled){switch(e.keyCode){case 8:return void(!this.state.inputValue&&this.props.backspaceRemoves&&(e.preventDefault(),this.popValue()));case 9:if(e.shiftKey||!this.state.isOpen||!this.state.focusedOption)return;this.selectFocusedOption();break;case 13:if(!this.state.isOpen)return;this.selectFocusedOption();break;case 27:this.state.isOpen?this.resetValue():this.props.clearable&&this.clearValue(e);break;case 38:this.focusPreviousOption();break;case 40:this.focusNextOption();break;case 188:if(!this.props.allowCreate||!this.props.multi)return;e.preventDefault(),e.stopPropagation(),this.selectFocusedOption();break;default:return}e.preventDefault()}},_getNewFocusedOption:function(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t]===this.state.focusedOption)return e[t];return this.getFirstFocusableOption(e)},handleInputChange:function(e){if(this._optionsFilterString=e.target.value,this.props.onInputChange&&this.props.onInputChange(e.target.value),this.props.asyncOptions)this.setState({isLoading:!0,inputValue:e.target.value}),this.loadAsyncOptions(e.target.value,{isLoading:!1,isOpen:!0},this._bindCloseMenuIfClickedOutside);else{var t=this.filterOptions(this.state.options);this.setState({isOpen:!0,inputValue:e.target.value,filteredOptions:t,focusedOption:this._getNewFocusedOption(t)},this._bindCloseMenuIfClickedOutside)}},autoloadAsyncOptions:function(){var e=this;this.setState({isLoading:!0}),this.loadAsyncOptions(this.props.value||"",{isLoading:!1},function(){e.setValue(e.props.value,!1)})},loadAsyncOptions:function(e,t,s){void 0===e&&(e="");var o=this,i=this._currentRequestId=c++;if(this.props.cacheAsyncResults)for(var n=0;n<=e.length;n++){var a=e.slice(0,n);if(this._optionsCache[a]&&(e===a||this._optionsCache[a].complete)){var p=this._optionsCache[a].options,r=this.filterOptions(p),l={options:p,filteredOptions:r,focusedOption:this._getNewFocusedOption(r)};for(var u in t)t.hasOwnProperty(u)&&(l[u]=t[u]);return this.setState(l),void(s&&s.call(this,l))}}var h=function(n,a){if(n)throw n;if(o.props.cacheAsyncResults&&(o._optionsCache[e]=a),i===o._currentRequestId){var p=o.filterOptions(a.options),r={options:a.options,filteredOptions:p,focusedOption:o._getNewFocusedOption(p)};for(var l in t)t.hasOwnProperty(l)&&(r[l]=t[l]);o.setState(r),s&&s.call(o,r)}},d=this.props.asyncOptions(e,h);d&&"function"==typeof d.then&&d.then(function(e){h(null,e)},function(e){h(e)})},filterOptions:function(e,t){var s=this._optionsFilterString,o=(t||this.state.values).map(function(e){return e.value});if(this.props.filterOptions)return this.props.filterOptions.call(this,e,s,o);var i=function(e){if(this.props.multi&&o.indexOf(e[this.props.valueKey])>-1)return!1;if(this.props.filterOption)return this.props.filterOption.call(this,e,s);var t=String(e[this.props.valueKey]),i=String(e[this.props.labelKey]);return this.props.ignoreCase&&(t=t.toLowerCase(),i=i.toLowerCase(),s=s.toLowerCase()),s&&"start"!==this.props.matchPos?"label"!==this.props.matchProp&&t.indexOf(s)>=0||"value"!==this.props.matchProp&&i.indexOf(s)>=0:"label"!==this.props.matchProp&&t.substr(0,s.length)===s||"value"!==this.props.matchProp&&i.substr(0,s.length)===s};return(e||[]).filter(i,this)},selectFocusedOption:function(){return this.props.allowCreate&&!this.state.focusedOption?this.selectValue(this.state.inputValue):this.state.focusedOption?this.selectValue(this.state.focusedOption):void 0},focusOption:function(e){this.setState({focusedOption:e})},focusNextOption:function(){this.focusAdjacentOption("next")},focusPreviousOption:function(){this.focusAdjacentOption("previous")},focusAdjacentOption:function(e){this._focusedOptionReveal=!0;var t=this.state.filteredOptions.filter(function(e){return!e.disabled});if(!this.state.isOpen)return void this.setState({isOpen:!0,inputValue:"",focusedOption:this.state.focusedOption||t["next"===e?0:t.length-1]},this._bindCloseMenuIfClickedOutside);if(t.length){for(var s=-1,o=0;o<t.length;o++)if(this.state.focusedOption===t[o]){s=o;break}var i=t[0];"next"===e&&s>-1&&s<t.length-1?i=t[s+1]:"previous"===e&&(i=s>0?t[s-1]:t[t.length-1]),this.setState({focusedOption:i})}},unfocusOption:function(e){this.state.focusedOption===e&&this.setState({focusedOption:null})},renderOptionLabel:function(e){return e[this.props.labelKey]},buildMenu:function(){var e=this.state.focusedOption?this.state.focusedOption[this.props.valueKey]:null,t=this.props.optionRenderer||this.renderOptionLabel;this.state.filteredOptions.length>0&&(e=null==e?this.state.filteredOptions[0]:e);var s=this.state.filteredOptions;if(this.props.allowCreate&&this.state.inputValue.trim()){var o=this.state.inputValue;s=s.slice();var n=this.props.newOptionCreator?this.props.newOptionCreator(o):{value:o,label:o,create:!0};s.unshift(n)}var a=Object.keys(s).map(function(o){var n=s[o],a=this.state.value===n[this.props.valueKey],r=e===n[this.props.valueKey],l=p({"Select-option":!0,"is-selected":a,"is-focused":r,"is-disabled":n.disabled}),u=r?"focused":null,c=i.createElement(this.props.optionComponent,{key:"option-"+n[this.props.valueKey],className:l,renderFunc:t,mouseDown:this.selectValue,mouseEnter:this.focusOption,mouseLeave:this.unfocusOption,addLabelText:this.props.addLabelText,option:n,ref:u});return c},this);if(a.length)return a;var r,l;return this.isLoading()?(l="Select-searching",r=this.props.searchingText):this.state.inputValue||!this.props.asyncOptions?(l="Select-noresults",r=this.props.noResultsText):(l="Select-search-prompt",r=this.props.searchPromptText),i.createElement("div",{className:l},r)},handleOptionLabelClick:function(e,t){this.props.onOptionLabelClick&&this.props.onOptionLabelClick(e,t)},isLoading:function(){return this.props.isLoading||this.state.isLoading},render:function(){var e=p("Select",this.props.className,{"Select--multi":this.props.multi,"is-searchable":this.props.searchable,"is-open":this.state.isOpen,"is-focused":this.state.isFocused,"is-loading":this.isLoading(),"is-disabled":this.props.disabled,"has-value":this.state.value}),t=[];if(this.props.multi&&this.state.values.forEach(function(e){var s=this.handleOptionLabelClick.bind(this,e),o=this.removeValue.bind(this,e),n=i.createElement(this.props.valueComponent,{key:e.value,option:e,renderer:this.props.valueRenderer,optionLabelClick:!!this.props.onOptionLabelClick,onOptionLabelClick:s,onRemove:o,disabled:this.props.disabled});t.push(n)},this),!(this.state.inputValue||this.props.multi&&t.length)){var s=this.state.values[0]||null;if(this.props.valueRenderer&&this.state.values.length)t.push(i.createElement(r,{key:0,option:s,renderer:this.props.valueRenderer,disabled:this.props.disabled}));else{var n=i.createElement(this.props.singleValueComponent,{key:"placeholder",value:s,placeholder:this.state.placeholder});t.push(n)}}var l,u,c=this.isLoading()?i.createElement("span",{className:"Select-loading-zone","aria-hidden":"true"},i.createElement("span",{className:"Select-loading"})):null,h=this.props.clearable&&this.state.value&&!this.props.disabled&&!this.isLoading()?i.createElement("span",{className:"Select-clear-zone",title:this.props.multi?this.props.clearAllText:this.props.clearValueText,"aria-label":this.props.multi?this.props.clearAllText:this.props.clearValueText,onMouseDown:this.clearValue,onTouchEnd:this.clearValue,onClick:this.clearValue},i.createElement("span",{className:"Select-clear",dangerouslySetInnerHTML:{__html:"&times;"}})):null,d=i.createElement("span",{className:"Select-arrow-zone",onMouseDown:this.handleMouseDownOnArrow},i.createElement("span",{className:"Select-arrow",onMouseDown:this.handleMouseDownOnArrow}));this.state.isOpen&&(u={ref:"menu",className:"Select-menu",onMouseDown:this.handleMouseDownOnMenu},l=i.createElement("div",{ref:"selectMenuContainer",className:"Select-menu-outer"},i.createElement("div",u,this.buildMenu())));var f,v={ref:"input",className:"Select-input "+(this.props.inputProps.className||""),tabIndex:this.props.tabIndex||0,onFocus:this.handleInputFocus,onBlur:this.handleInputBlur};for(var m in this.props.inputProps)this.props.inputProps.hasOwnProperty(m)&&"className"!==m&&(v[m]=this.props.inputProps[m]);return this.props.disabled?this.props.multi&&this.state.values.length||(f=i.createElement("div",{className:"Select-input"}," ")):f=this.props.searchable?i.createElement(a,o({value:this.state.inputValue,onChange:this.handleInputChange,minWidth:"5"},v)):i.createElement("div",v," "),i.createElement("div",{ref:"wrapper",className:e},i.createElement("input",{type:"hidden",ref:"value",name:this.props.name,value:this.state.value,disabled:this.props.disabled}),i.createElement("div",{className:"Select-control",ref:"control",onKeyDown:this.handleKeyDown,onMouseDown:this.handleMouseDown,onTouchEnd:this.handleMouseDown},t,f,c,h,d),l)}});t.exports=h}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./Option":1,"./SingleValue":3,"./Value":4,"react-dom":void 0}],3:[function(e,t,s){(function(e){"use strict";var s="undefined"!=typeof window?window.React:"undefined"!=typeof e?e.React:null,o="undefined"!=typeof window?window.classNames:"undefined"!=typeof e?e.classNames:null,i=s.createClass({displayName:"SingleValue",propTypes:{placeholder:s.PropTypes.string,value:s.PropTypes.object},render:function(){var e=o("Select-placeholder",this.props.value&&this.props.value.className);return s.createElement("div",{className:e,style:this.props.value&&this.props.value.style,title:this.props.value&&this.props.value.title},this.props.placeholder)}});t.exports=i}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],4:[function(e,t,s){(function(e){"use strict";var s="undefined"!=typeof window?window.React:"undefined"!=typeof e?e.React:null,o="undefined"!=typeof window?window.classNames:"undefined"!=typeof e?e.classNames:null,i=s.createClass({displayName:"Value",propTypes:{disabled:s.PropTypes.bool,onOptionLabelClick:s.PropTypes.func,onRemove:s.PropTypes.func,option:s.PropTypes.object.isRequired,optionLabelClick:s.PropTypes.bool,renderer:s.PropTypes.func},blockEvent:function(e){e.stopPropagation()},handleOnRemove:function(e){this.props.disabled||this.props.onRemove(e)},render:function(){var e=this.props.option.label;return this.props.renderer&&(e=this.props.renderer(this.props.option)),this.props.onRemove||this.props.optionLabelClick?(this.props.optionLabelClick&&(e=s.createElement("a",{className:o("Select-item-label__a",this.props.option.className),onMouseDown:this.blockEvent,onTouchEnd:this.props.onOptionLabelClick,onClick:this.props.onOptionLabelClick,style:this.props.option.style,title:this.props.option.title},e)),s.createElement("div",{className:o("Select-item",this.props.option.className),style:this.props.option.style,title:this.props.option.title},s.createElement("span",{className:"Select-item-icon",onMouseDown:this.blockEvent,onClick:this.handleOnRemove,onTouchEnd:this.handleOnRemove},"×"),s.createElement("span",{className:"Select-item-label"},e))):s.createElement("div",{className:o("Select-value",this.props.option.className),style:this.props.option.style,title:this.props.option.title},e)}});t.exports=i}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[2])(2)});

@@ -14,2 +14,11 @@ import React from 'react';

},
handleMouseDown (e) {
this.props.mouseDown(this.props.option, e);
},
handleMouseEnter (e) {
this.props.mouseEnter(this.props.option, e);
},
handleMouseLeave (e) {
this.props.mouseLeave(this.props.option, e);
},
render () {

@@ -28,6 +37,6 @@ var obj = this.props.option;

<div className={this.props.className}
onMouseEnter={this.props.mouseEnter}
onMouseLeave={this.props.mouseLeave}
onMouseDown={this.props.mouseDown}
onClick={this.props.mouseDown}>
onMouseEnter={this.handleMouseEnter}
onMouseLeave={this.handleMouseLeave}
onMouseDown={this.handleMouseDown}
onClick={this.handleMouseDown}>
<Gravatar email={obj.email} size={size} style={gravatarStyle} />

@@ -34,0 +43,0 @@ {obj.value}

# React-Select
## v0.9.0 / 2015-10-29
* added; SCSS stylesheets!
* improved; Options rendering should be more performant
* breaking change; Custom `Option` components now need to pass their `option` prop to event handlers; see [this commit](https://github.com/JedWatson/react-select/commit/89af12a80a972794222b193a767f44234bbe9817) for an example of the required change.
## v0.8.4 / 2015-10-27

@@ -4,0 +10,0 @@

@@ -18,3 +18,2 @@ 'use strict';

},
blockEvent: function blockEvent(event) {

@@ -32,3 +31,11 @@ event.preventDefault();

},
handleMouseDown: function handleMouseDown(e) {
this.props.mouseDown(this.props.option, e);
},
handleMouseEnter: function handleMouseEnter(e) {
this.props.mouseEnter(this.props.option, e);
},
handleMouseLeave: function handleMouseLeave(e) {
this.props.mouseLeave(this.props.option, e);
},
render: function render() {

@@ -49,6 +56,6 @@ var option = this.props.option;

style: option.style,
onMouseEnter: this.props.mouseEnter,
onMouseLeave: this.props.mouseLeave,
onMouseDown: this.props.mouseDown,
onClick: this.props.mouseDown,
onMouseDown: this.handleMouseDown,
onMouseEnter: this.handleMouseEnter,
onMouseLeave: this.handleMouseLeave,
onClick: this.handleMouseDown,
title: option.title },

@@ -55,0 +62,0 @@ label

@@ -455,2 +455,3 @@ /* disable some rules until we refactor more completely; fixing them now would

_this7.setState({
inputValue: '',
isFocused: false,

@@ -728,10 +729,9 @@ isOpen: false

renderOptionLabel: function renderOptionLabel(op) {
return op[this.props.labelKey];
},
buildMenu: function buildMenu() {
var _this10 = this;
var focusedValue = this.state.focusedOption ? this.state.focusedOption[this.props.valueKey] : null;
var renderLabel = this.props.optionRenderer;
if (!renderLabel) renderLabel = function (op) {
return op[_this10.props.labelKey];
};
var renderLabel = this.props.optionRenderer || this.renderOptionLabel;
if (this.state.filteredOptions.length > 0) {

@@ -763,5 +763,2 @@ focusedValue = focusedValue == null ? this.state.filteredOptions[0] : focusedValue;

var ref = isFocused ? 'focused' : null;
var mouseEnter = this.focusOption.bind(this, op);
var mouseLeave = this.unfocusOption.bind(this, op);
var mouseDown = this.selectValue.bind(this, op);
var optionResult = React.createElement(this.props.optionComponent, {

@@ -771,6 +768,5 @@ key: 'option-' + op[this.props.valueKey],

renderFunc: renderLabel,
mouseEnter: mouseEnter,
mouseLeave: mouseLeave,
mouseDown: mouseDown,
click: mouseDown,
mouseDown: this.selectValue,
mouseEnter: this.focusOption,
mouseLeave: this.unfocusOption,
addLabelText: this.props.addLabelText,

@@ -777,0 +773,0 @@ option: op,

{
"name": "react-select",
"version": "0.8.4",
"version": "0.9.0",
"description": "A Select control built with and for ReactJS",

@@ -5,0 +5,0 @@ "main": "lib/Select.js",

@@ -14,3 +14,2 @@ var React = require('react');

},
blockEvent (event) {

@@ -28,3 +27,11 @@ event.preventDefault();

},
handleMouseDown (e) {
this.props.mouseDown(this.props.option, e);
},
handleMouseEnter (e) {
this.props.mouseEnter(this.props.option, e);
},
handleMouseLeave (e) {
this.props.mouseLeave(this.props.option, e);
},
render () {

@@ -44,6 +51,6 @@ var option = this.props.option;

style={option.style}
onMouseEnter={this.props.mouseEnter}
onMouseLeave={this.props.mouseLeave}
onMouseDown={this.props.mouseDown}
onClick={this.props.mouseDown}
onMouseDown={this.handleMouseDown}
onMouseEnter={this.handleMouseEnter}
onMouseLeave={this.handleMouseLeave}
onClick={this.handleMouseDown}
title={option.title}>

@@ -50,0 +57,0 @@ {label}

@@ -448,2 +448,3 @@ /* disable some rules until we refactor more completely; fixing them now would

this.setState({
inputValue: '',
isFocused: false,

@@ -713,6 +714,9 @@ isOpen: false

renderOptionLabel (op) {
return op[this.props.labelKey];
},
buildMenu () {
var focusedValue = this.state.focusedOption ? this.state.focusedOption[this.props.valueKey] : null;
var renderLabel = this.props.optionRenderer;
if (!renderLabel) renderLabel = (op) => op[this.props.labelKey];
var renderLabel = this.props.optionRenderer || this.renderOptionLabel;
if (this.state.filteredOptions.length > 0) {

@@ -744,5 +748,2 @@ focusedValue = focusedValue == null ? this.state.filteredOptions[0] : focusedValue;

var ref = isFocused ? 'focused' : null;
var mouseEnter = this.focusOption.bind(this, op);
var mouseLeave = this.unfocusOption.bind(this, op);
var mouseDown = this.selectValue.bind(this, op);
var optionResult = React.createElement(this.props.optionComponent, {

@@ -752,6 +753,5 @@ key: 'option-' + op[this.props.valueKey],

renderFunc: renderLabel,
mouseEnter: mouseEnter,
mouseLeave: mouseLeave,
mouseDown: mouseDown,
click: mouseDown,
mouseDown: this.selectValue,
mouseEnter: this.focusOption,
mouseLeave: this.unfocusOption,
addLabelText: this.props.addLabelText,

@@ -758,0 +758,0 @@ option: op,

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc