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

react-select-plus

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-select-plus - npm Package Compare versions

Comparing version 1.0.0-rc.1.patch3 to 1.0.0-rc.3

.gitattributes

1

CHANGES.md

@@ -22,3 +22,2 @@ # Changes

`loadingPlaceholder` prop
`autoload` changed to `minimumInput` and now controls the minimum input to load options
`cacheAsyncResults` -> `cache` (new external cache support) - defaults to true

@@ -25,0 +24,0 @@

@@ -1,2 +0,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,u,n){function o(i,r){if(!u[i]){if(!t[i]){var a="function"==typeof require&&require;if(!r&&a)return a(i,!0);if(s)return s(i,!0);var l=new Error("Cannot find module '"+i+"'");throw l.code="MODULE_NOT_FOUND",l}var p=u[i]={exports:{}};t[i][0].call(p.exports,function(e){var u=t[i][1][e];return o(u?u:e)},p,p.exports,e,t,u,n)}return u[i].exports}for(var s="function"==typeof require&&require,i=0;i<n.length;i++)o(n[i]);return o}({1:[function(e,t,u){(function(u){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var u={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(u[n]=e[n]);return u}function s(e){return e&&"object"!=typeof e&&(e={}),e?e:null}function i(e,t,u){e&&(e[t]=u)}function r(e,t){if(e)for(var u=t.length;u>=0;--u){var n=t.slice(0,u);if(e[n]&&(t===n||e[n].complete))return e[n]}}function a(e,t){if(e&&"function"==typeof e.then)return e.then(function(e){t(null,e)},function(e){t(e)})}function l(e){return c["default"].createElement(h["default"],e)}var p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var u=arguments[t];for(var n in u)Object.prototype.hasOwnProperty.call(u,n)&&(e[n]=u[n])}return e},d="undefined"!=typeof window?window.React:"undefined"!=typeof u?u.React:null,c=n(d),f=e("./Select"),h=n(f),E=e("./utils/stripDiacritics"),g=n(E),y=0,b=c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.node]),v=c["default"].createClass({displayName:"Async",propTypes:{cache:c["default"].PropTypes.any,children:c["default"].PropTypes.func,ignoreAccents:c["default"].PropTypes.bool,ignoreCase:c["default"].PropTypes.bool,isLoading:c["default"].PropTypes.bool,loadOptions:c["default"].PropTypes.func.isRequired,loadingPlaceholder:c["default"].PropTypes.string,minimumInput:c["default"].PropTypes.number,noResultsText:b,onInputChange:c["default"].PropTypes.func,placeholder:b,searchPromptText:b,searchingText:c["default"].PropTypes.string},getDefaultProps:function(){return{cache:!0,ignoreAccents:!0,ignoreCase:!0,loadingPlaceholder:"Loading...",minimumInput:0,searchingText:"Searching...",searchPromptText:"Type to search"}},getInitialState:function(){return{cache:s(this.props.cache),isLoading:!1,options:[]}},componentWillMount:function(){this._lastInput=""},componentDidMount:function(){this.loadOptions("")},componentWillReceiveProps:function(e){e.cache!==this.props.cache&&this.setState({cache:s(e.cache)})},focus:function(){this.select.focus()},resetState:function(){this._currentRequestId=-1,this.setState({isLoading:!1,options:[]})},getResponseHandler:function(e){var t=this,u=this._currentRequestId=y++;return function(n,o){if(n)throw n;t.isMounted()&&(i(t.state.cache,e,o),u===t._currentRequestId&&t.setState({isLoading:!1,options:o&&o.options||[]}))}},loadOptions:function(e){if(this.props.onInputChange){var t=this.props.onInputChange(e);null!=t&&(e=""+t)}if(this.props.ignoreAccents&&(e=(0,g["default"])(e)),this.props.ignoreCase&&(e=e.toLowerCase()),this._lastInput=e,e.length<this.props.minimumInput)return this.resetState();var u=r(this.state.cache,e);if(u&&Array.isArray(u.options))return this.setState({options:u.options});this.setState({isLoading:!0});var n=this.getResponseHandler(e),o=a(this.props.loadOptions(e,n),n);return o?o.then(function(){return e}):e},render:function(){var e=this,t=this.props,u=t.children,n=void 0===u?l:u,s=t.noResultsText,i=o(t,["children","noResultsText"]),r=this.state,a=r.isLoading,d=r.options;this.props.isLoading&&(a=!0);var c=a?this.props.loadingPlaceholder:this.props.placeholder;a?s=this.props.searchingText:!d.length&&this._lastInput.length<this.props.minimumInput&&(s=this.props.searchPromptText);var f=p({},i,{isLoading:a,noResultsText:s,onInputChange:this.loadOptions,options:d,placeholder:c,ref:function(t){e.select=t}});return n(f)}});t.exports=v}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./Select":7,"./utils/stripDiacritics":12}],2:[function(e,t,u){(function(u){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var u=arguments[t];for(var n in u)Object.prototype.hasOwnProperty.call(u,n)&&(e[n]=u[n])}return e},s="undefined"!=typeof window?window.React:"undefined"!=typeof u?u.React:null,i=n(s),r=e("./Select"),a=n(r),l=i["default"].createClass({displayName:"AsyncCreatableSelect",render:function(){var e=this;return i["default"].createElement(a["default"].Async,this.props,function(t){return i["default"].createElement(a["default"].Creatable,e.props,function(e){return i["default"].createElement(a["default"],o({},t,e,{onInputChange:function(u){return e.onInputChange(u),t.onInputChange(u)},ref:function(u){e.ref(u),t.ref(u)}}))})})}});t.exports=l}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./Select":7}],3:[function(e,t,u){(function(u){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var u={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(u[n]=e[n]);return u}function s(e){return f["default"].createElement(E["default"],e)}function i(e){var t=e.option,u=e.options,n=e.labelKey,o=e.valueKey;return 0===u.filter(function(e){return e[n]===t[n]||e[o]===t[o]}).length}function r(e){var t=e.label;return!!t}function a(e){var t=e.label,u=e.labelKey,n=e.valueKey,o={};return o[n]=t,o[u]=t,o.className="Select-create-option-placeholder",o}function l(e){return'Create option "'+e+'"'}function p(e){var t=e.keyCode;switch(t){case 9:case 13:case 188:return!0}return!1}var d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var u=arguments[t];for(var n in u)Object.prototype.hasOwnProperty.call(u,n)&&(e[n]=u[n])}return e},c="undefined"!=typeof window?window.React:"undefined"!=typeof u?u.React:null,f=n(c),h=e("./Select"),E=n(h),g=e("./utils/defaultFilterOptions"),y=n(g),b=e("./utils/defaultMenuRenderer"),v=n(b),m=f["default"].createClass({displayName:"CreatableSelect",propTypes:{children:f["default"].PropTypes.func,filterOptions:f["default"].PropTypes.any,isOptionUnique:f["default"].PropTypes.func,isValidNewOption:f["default"].PropTypes.func,menuRenderer:f["default"].PropTypes.any,newOptionCreator:f["default"].PropTypes.func,options:f["default"].PropTypes.array,promptTextCreator:f["default"].PropTypes.func,shouldKeyDownEventCreateNewOption:f["default"].PropTypes.func},statics:{isOptionUnique:i,isValidNewOption:r,newOptionCreator:a,promptTextCreator:l,shouldKeyDownEventCreateNewOption:p},getDefaultProps:function(){return{filterOptions:y["default"],isOptionUnique:i,isValidNewOption:r,menuRenderer:v["default"],newOptionCreator:a,promptTextCreator:l,shouldKeyDownEventCreateNewOption:p}},createNewOption:function(){var e=this.props,t=e.isValidNewOption,u=e.newOptionCreator,n=e.options,o=void 0===n?[]:n;e.shouldKeyDownEventCreateNewOption;if(t({label:this.inputValue})){var s=u({label:this.inputValue,labelKey:this.labelKey,valueKey:this.valueKey}),i=this.isOptionUnique({option:s});i&&(o.unshift(s),this.select.selectValue(s))}},filterOptions:function C(){var e=this.props,C=e.filterOptions,t=e.isValidNewOption,u=(e.options,e.promptTextCreator),n=arguments[2]||[],o=C.apply(void 0,arguments)||[];if(t({label:this.inputValue})){var s=this.props.newOptionCreator,i=s({label:this.inputValue,labelKey:this.labelKey,valueKey:this.valueKey}),r=this.isOptionUnique({option:i,options:n.concat(o)});if(r){var a=u(this.inputValue);this._createPlaceholderOption=s({label:a,labelKey:this.labelKey,valueKey:this.valueKey}),o.unshift(this._createPlaceholderOption)}}return o},isOptionUnique:function F(e){var t=e.option,u=e.options,F=this.props.isOptionUnique;return u=u||this.select.filterFlatOptions(),F({labelKey:this.labelKey,option:t,options:u,valueKey:this.valueKey})},menuRenderer:function w(e){var w=this.props.menuRenderer;return w(d({},e,{onSelect:this.onOptionSelect}))},onInputChange:function(e){this.inputValue=e},onInputKeyDown:function(e){var t=this.props.shouldKeyDownEventCreateNewOption,u=this.select.getFocusedOption();u&&u===this._createPlaceholderOption&&t({keyCode:e.keyCode})&&(this.createNewOption(),e.preventDefault())},onOptionSelect:function(e,t){e===this._createPlaceholderOption?this.createNewOption():this.select.selectValue(e)},render:function(){var e=this,t=this.props,u=t.children,n=void 0===u?s:u,i=(t.newOptionCreator,t.shouldKeyDownEventCreateNewOption,o(t,["children","newOptionCreator","shouldKeyDownEventCreateNewOption"])),r=d({},i,{allowCreate:!0,filterOptions:this.filterOptions,menuRenderer:this.menuRenderer,onInputChange:this.onInputChange,onInputKeyDown:this.onInputKeyDown,ref:function(t){e.select=t,t&&(e.labelKey=t.props.labelKey,e.valueKey=t.props.valueKey)}});return n(r)}});t.exports=m}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./Select":7,"./utils/defaultFilterOptions":10,"./utils/defaultMenuRenderer":11}],4:[function(e,t,u){(function(e){"use strict";function u(e){return e&&e.__esModule?e:{"default":e}}var n="undefined"!=typeof window?window.React:"undefined"!=typeof e?e.React:null,o=u(n),s=o["default"].createClass({displayName:"Dropdown",propTypes:{children:o["default"].PropTypes.node},render:function(){return this.props.children}});t.exports=s}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],5:[function(e,t,u){(function(e){"use strict";function u(e){return e&&e.__esModule?e:{"default":e}}var n="undefined"!=typeof window?window.React:"undefined"!=typeof e?e.React:null,o=u(n),s="undefined"!=typeof window?window.classNames:"undefined"!=typeof e?e.classNames:null,i=u(s),r=o["default"].createClass({displayName:"Option",propTypes:{children:o["default"].PropTypes.node,className:o["default"].PropTypes.string,instancePrefix:o["default"].PropTypes.string.isRequired,isDisabled:o["default"].PropTypes.bool,isFocused:o["default"].PropTypes.bool,isSelected:o["default"].PropTypes.bool,onFocus:o["default"].PropTypes.func,onSelect:o["default"].PropTypes.func,onUnfocus:o["default"].PropTypes.func,option:o["default"].PropTypes.object.isRequired,optionIndex:o["default"].PropTypes.number},blockEvent:function(e){e.preventDefault(),e.stopPropagation(),"A"===e.target.tagName&&"href"in e.target&&(e.target.target?window.open(e.target.href,e.target.target):window.location.href=e.target.href)},handleMouseDown:function(e){e.preventDefault(),e.stopPropagation(),this.props.onSelect(this.props.option,e)},handleMouseEnter:function(e){this.onFocus(e)},handleMouseMove:function(e){this.onFocus(e)},handleTouchEnd:function(e){this.dragging||this.handleMouseDown(e)},handleTouchMove:function(e){this.dragging=!0},handleTouchStart:function(e){this.dragging=!1},onFocus:function(e){this.props.isFocused||this.props.onFocus(this.props.option,e)},render:function(){var e=this.props,t=e.option,u=e.instancePrefix,n=e.optionIndex,s=(0,i["default"])(this.props.className,t.className);return t.disabled?o["default"].createElement("div",{className:s,onMouseDown:this.blockEvent,onClick:this.blockEvent},this.props.children):o["default"].createElement("div",{className:s,style:t.style,role:"option",onMouseDown:this.handleMouseDown,onMouseEnter:this.handleMouseEnter,onMouseMove:this.handleMouseMove,onTouchStart:this.handleTouchStart,onTouchMove:this.handleTouchMove,onTouchEnd:this.handleTouchEnd,id:u+"-option-"+n,title:t.title},this.props.children)}});t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],6:[function(e,t,u){(function(e){"use strict";function u(e){return e&&e.__esModule?e:{"default":e}}var n="undefined"!=typeof window?window.React:"undefined"!=typeof e?e.React:null,o=u(n),s="undefined"!=typeof window?window.classNames:"undefined"!=typeof e?e.classNames:null,i=u(s),r=o["default"].createClass({displayName:"OptionGroup",propTypes:{children:o["default"].PropTypes.any,className:o["default"].PropTypes.string,label:o["default"].PropTypes.node,option:o["default"].PropTypes.object.isRequired},blockEvent:function(e){e.preventDefault(),e.stopPropagation(),"A"===e.target.tagName&&"href"in e.target&&(e.target.target?window.open(e.target.href,e.target.target):window.location.href=e.target.href)},handleMouseDown:function(e){e.preventDefault(),e.stopPropagation()},handleTouchEnd:function(e){this.dragging||this.handleMouseDown(e)},handleTouchMove:function(e){this.dragging=!0},handleTouchStart:function(e){this.dragging=!1},render:function(){var e=this.props.option,t=(0,i["default"])(this.props.className,e.className);return e.disabled?o["default"].createElement("div",{className:t,onMouseDown:this.blockEvent,onClick:this.blockEvent},this.props.children):o["default"].createElement("div",{className:t,style:e.style,onMouseDown:this.handleMouseDown,onMouseEnter:this.handleMouseEnter,onMouseMove:this.handleMouseMove,onTouchStart:this.handleTouchStart,onTouchMove:this.handleTouchMove,onTouchEnd:this.handleTouchEnd,title:e.title},o["default"].createElement("div",{className:"Select-option-group-label"},this.props.label),this.props.children)}});t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],7:[function(e,t,u){(function(n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){var u={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(u[n]=e[n]);return u}function i(e,t,u){return t in e?Object.defineProperty(e,t,{value:u,enumerable:!0,configurable:!0,writable:!0}):e[t]=u,e}function r(e){var t={};for(var u in e)e.hasOwnProperty(u)&&(t[u]=e[u]);return t}function a(e){return e&&Array.isArray(e.options)}function l(e){return"string"==typeof e?e:"object"==typeof e?JSON.stringify(e):e||0===e?String(e):""}Object.defineProperty(u,"__esModule",{value:!0});var p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var u=arguments[t];for(var n in u)Object.prototype.hasOwnProperty.call(u,n)&&(e[n]=u[n])}return e},d="undefined"!=typeof window?window.React:"undefined"!=typeof n?n.React:null,c=o(d),f="undefined"!=typeof window?window.ReactDOM:"undefined"!=typeof n?n.ReactDOM:null,h=o(f),E="undefined"!=typeof window?window.AutosizeInput:"undefined"!=typeof n?n.AutosizeInput:null,g=o(E),y="undefined"!=typeof window?window.classNames:"undefined"!=typeof n?n.classNames:null,b=o(y),v=e("./utils/defaultArrowRenderer"),m=o(v),C=e("./utils/defaultFilterOptions"),F=o(C),w=e("./utils/defaultMenuRenderer"),O=o(w),A=e("./Async"),T=o(A),P=e("./AsyncCreatable"),D=o(P),S=e("./Creatable"),V=o(S),M=e("./Dropdown"),x=o(M),B=e("./Option"),R=o(B),N=e("./OptionGroup"),I=o(N),_=e("./Value"),K=o(_),k=c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.node]),j=1,L={},q=c["default"].createClass({displayName:"Select",propTypes:{addLabelText:c["default"].PropTypes.string,"aria-label":c["default"].PropTypes.string,"aria-labelledby":c["default"].PropTypes.string,arrowRenderer:c["default"].PropTypes.func,autoBlur:c["default"].PropTypes.bool,autofocus:c["default"].PropTypes.bool,autosize:c["default"].PropTypes.bool,backspaceRemoves:c["default"].PropTypes.bool,backspaceToRemoveMessage:c["default"].PropTypes.string,className:c["default"].PropTypes.string,clearAllText:k,clearValueText:k,clearable:c["default"].PropTypes.bool,delimiter:c["default"].PropTypes.string,disabled:c["default"].PropTypes.bool,dropdownComponent:c["default"].PropTypes.func,escapeClearsValue:c["default"].PropTypes.bool,filterOption:c["default"].PropTypes.func,filterOptions:c["default"].PropTypes.any,ignoreAccents:c["default"].PropTypes.bool,ignoreCase:c["default"].PropTypes.bool,inputProps:c["default"].PropTypes.object,inputRenderer:c["default"].PropTypes.func,instanceId:c["default"].PropTypes.string,isLoading:c["default"].PropTypes.bool,isOpen:c["default"].PropTypes.bool,joinValues:c["default"].PropTypes.bool,labelKey:c["default"].PropTypes.string,matchPos:c["default"].PropTypes.string,matchProp:c["default"].PropTypes.string,menuBuffer:c["default"].PropTypes.number,menuContainerStyle:c["default"].PropTypes.object,menuRenderer:c["default"].PropTypes.func,menuStyle:c["default"].PropTypes.object,multi:c["default"].PropTypes.bool,name:c["default"].PropTypes.string,noResultsText:k,onBlur:c["default"].PropTypes.func,onBlurResetsInput:c["default"].PropTypes.bool,onChange:c["default"].PropTypes.func,onClose:c["default"].PropTypes.func,onCloseResetsInput:c["default"].PropTypes.bool,onFocus:c["default"].PropTypes.func,onInputChange:c["default"].PropTypes.func,onInputKeyDown:c["default"].PropTypes.func,onMenuScrollToBottom:c["default"].PropTypes.func,onOpen:c["default"].PropTypes.func,onValueClick:c["default"].PropTypes.func,openAfterFocus:c["default"].PropTypes.bool,openOnFocus:c["default"].PropTypes.bool,optionClassName:c["default"].PropTypes.string,optionComponent:c["default"].PropTypes.func,optionGroupComponent:c["default"].PropTypes.func,optionRenderer:c["default"].PropTypes.func,options:c["default"].PropTypes.array,pageSize:c["default"].PropTypes.number,placeholder:k,renderInvalidValues:c["default"].PropTypes.bool,required:c["default"].PropTypes.bool,resetValue:c["default"].PropTypes.any,scrollMenuIntoView:c["default"].PropTypes.bool,searchable:c["default"].PropTypes.bool,simpleValue:c["default"].PropTypes.bool,style:c["default"].PropTypes.object,tabIndex:c["default"].PropTypes.string,tabSelectsValue:c["default"].PropTypes.bool,value:c["default"].PropTypes.any,valueComponent:c["default"].PropTypes.func,valueKey:c["default"].PropTypes.string,valueRenderer:c["default"].PropTypes.func,wrapperStyle:c["default"].PropTypes.object},statics:{Async:T["default"],AsyncCreatable:D["default"],Creatable:V["default"]},getDefaultProps:function(){return{addLabelText:'Add "{label}"?',arrowRenderer:m["default"],autosize:!0,backspaceRemoves:!0,backspaceToRemoveMessage:"Press backspace to remove {label}",clearable:!0,clearAllText:"Clear all",clearValueText:"Clear value",delimiter:",",disabled:!1,dropdownComponent:x["default"],escapeClearsValue:!0,filterOptions:F["default"],ignoreAccents:!0,ignoreCase:!0,inputProps:{},isLoading:!1,joinValues:!1,labelKey:"label",matchPos:"any",matchProp:"any",menuBuffer:0,menuRenderer:O["default"],multi:!1,noResultsText:"No results found",onBlurResetsInput:!0,onCloseResetsInput:!0,openAfterFocus:!1,optionComponent:R["default"],optionGroupComponent:I["default"],pageSize:5,placeholder:"Select...",renderInvalidValues:!1,required:!1,scrollMenuIntoView:!0,searchable:!0,simpleValue:!1,tabSelectsValue:!0,valueComponent:K["default"],valueKey:"value"}},getInitialState:function(){return{inputValue:"",isFocused:!1,isOpen:!1,isPseudoFocused:!1,required:!1}},componentWillMount:function(){this._flatOptions=this.flattenOptions(this.props.options),this._instancePrefix="react-select-"+(this.props.instanceId||++j)+"-";var e=this.getValueArray(this.props.value);this.props.required&&this.setState({required:this.handleRequired(e[0],this.props.multi)})},componentDidMount:function(){this.props.autofocus&&this.focus()},componentWillReceiveProps:function(e){e.options!==this.props.options&&(this._flatOptions=this.flattenOptions(e.options));var t=this.getValueArray(e.value,e);e.required&&this.setState({required:this.handleRequired(t[0],e.multi)})},componentWillUpdate:function(e,t){if(t.isOpen!==this.state.isOpen){this.toggleTouchOutsideEvent(t.isOpen);var u=t.isOpen?e.onOpen:e.onClose;u&&u()}},componentDidUpdate:function(e,t){if(this.menu&&this.focused&&this.state.isOpen&&!this.hasScrolledToOption){var u=h["default"].findDOMNode(this.focused),n=u.previousSibling,o=u.parentElement,s=h["default"].findDOMNode(this.menu);n?s.scrollTop=n.offsetTop:o&&"Select-menu"===o?s.scrollTop=o.offsetTop:s.scrollTop=u.offsetTop,this.hasScrolledToOption=!0}else this.state.isOpen||(this.hasScrolledToOption=!1);if(this._scrollToFocusedOptionOnUpdate&&this.focused&&this.menu){this._scrollToFocusedOptionOnUpdate=!1;var i=h["default"].findDOMNode(this.focused),r=h["default"].findDOMNode(this.menu),a=i.getBoundingClientRect(),l=r.getBoundingClientRect();(a.bottom>l.bottom||a.top<l.top)&&(r.scrollTop=i.offsetTop+i.clientHeight-r.offsetHeight)}if(this.props.scrollMenuIntoView&&this.menuContainer){var p=this.menuContainer.getBoundingClientRect();window.innerHeight<p.bottom+this.props.menuBuffer&&window.scrollBy(0,p.bottom+this.props.menuBuffer-window.innerHeight)}e.disabled!==this.props.disabled&&(this.setState({isFocused:!1}),this.closeMenu())},componentWillUnmount:function(){document.removeEventListener("touchstart",this.handleTouchOutside)},toggleTouchOutsideEvent:function(e){e?document.addEventListener("touchstart",this.handleTouchOutside):document.removeEventListener("touchstart",this.handleTouchOutside)},handleTouchOutside:function(e){this.wrapper&&!this.wrapper.contains(e.target)&&this.menuContainer&&!this.menuContainer.contains(e.target)&&this.closeMenu()},focus:function(){this.input&&(this.input.focus(),this.props.openAfterFocus&&this.setState({isOpen:!0}))},blurInput:function(){this.input&&this.input.blur()},handleTouchMove:function(e){this.dragging=!0},handleTouchStart:function(e){this.dragging=!1},handleTouchEnd:function(e){this.dragging||this.handleMouseDown(e)},handleTouchEndClearValue:function(e){this.dragging||this.clearValue(e)},handleMouseDown:function(e){if(!(this.props.disabled||"mousedown"===e.type&&0!==e.button)&&"INPUT"!==e.target.tagName){if(e.stopPropagation(),e.preventDefault(),!this.props.searchable)return this.focus(),this.setState({isOpen:!this.state.isOpen});if(this.state.isFocused){this.focus();var t=this.input;"function"==typeof t.getInput&&(t=t.getInput()),t.value="",this.setState({isOpen:!0,isPseudoFocused:!1})}else this._openAfterFocus=!0,this.focus()}},handleMouseDownOnArrow:function(e){this.props.disabled||"mousedown"===e.type&&0!==e.button||this.state.isOpen&&(e.stopPropagation(),e.preventDefault(),this.closeMenu())},handleMouseDownOnMenu:function(e){this.props.disabled||"mousedown"===e.type&&0!==e.button||(e.stopPropagation(),e.preventDefault(),this._openAfterFocus=!0,this.focus())},closeMenu:function(){this.props.onCloseResetsInput?this.setState({isOpen:!1,isPseudoFocused:this.state.isFocused&&!this.props.multi,inputValue:""}):this.setState({isOpen:!1,isPseudoFocused:this.state.isFocused&&!this.props.multi,inputValue:this.state.inputValue}),this.hasScrolledToOption=!1},handleInputFocus:function(e){if(!this.props.disabled){var t=this.state.isOpen||this._openAfterFocus||this.props.openOnFocus;this.props.onFocus&&this.props.onFocus(e),this.setState({isFocused:!0,isOpen:t}),this._openAfterFocus=!1}},handleInputBlur:function(e){if(this.menu&&(this.menu===document.activeElement||this.menu.contains(document.activeElement)))return void this.focus();this.props.onBlur&&this.props.onBlur(e);var t={isFocused:!1,isOpen:!1,isPseudoFocused:!1};this.props.onBlurResetsInput&&(t.inputValue=""),this.setState(t)},handleInputChange:function(e){var t=e.target.value;if(this.state.inputValue!==e.target.value&&this.props.onInputChange){var u=this.props.onInputChange(t);null!=u&&"object"!=typeof u&&(t=""+u)}this.setState({isOpen:!0,isPseudoFocused:!1,inputValue:t})},handleKeyDown:function(e){if(!(this.props.disabled||"function"==typeof this.props.onInputKeyDown&&(this.props.onInputKeyDown(e),e.defaultPrevented))){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.props.tabSelectsValue)return;return void this.selectFocusedOption();case 13:if(!this.state.isOpen)return;e.stopPropagation(),this.selectFocusedOption();break;case 27:this.state.isOpen?(this.closeMenu(),e.stopPropagation()):this.props.clearable&&this.props.escapeClearsValue&&(this.clearValue(e),e.stopPropagation());break;case 38:this.focusPreviousOption();break;case 40:this.focusNextOption();break;case 33:this.focusPageUpOption();break;case 34:this.focusPageDownOption();break;case 35:this.focusEndOption();break;case 36:this.focusStartOption();break;default:return}e.preventDefault()}},handleValueClick:function(e,t){this.props.onValueClick&&this.props.onValueClick(e,t)},handleMenuScroll:function(e){if(this.props.onMenuScrollToBottom){var t=e.target;t.scrollHeight>t.offsetHeight&&!(t.scrollHeight-t.offsetHeight-t.scrollTop)&&this.props.onMenuScrollToBottom()}},handleRequired:function(e,t){return!e||(t?0===e.length:0===Object.keys(e).length)},getOptionLabel:function(e){return e[this.props.labelKey]},getValueArray:function(e,t){var u=this,n="object"==typeof t?t:this.props;if(n.multi){if("string"==typeof e&&(e=e.split(n.delimiter)),!Array.isArray(e)){if(null===e||void 0===e)return[];e=[e]}return e.map(function(e){return u.expandValue(e,n)}).filter(function(e){return e})}var o=this.expandValue(e,n);return o?[o]:[]},expandValue:function(e,t){if("string"!=typeof e&&"number"!=typeof e)return e;var u=this.props,n=u.labelKey,o=u.valueKey,s=u.renderInvalidValues,r=this._flatOptions;if(r&&""!==e){for(var a=0;a<r.length;a++)if(r[a][o]===e)return r[a];if(s){var l;return L[e]=L[e]||(l={invalid:!0},i(l,n,e),i(l,o,e),l),L[e]}}},setValue:function(e){var t=this;if(this.props.autoBlur&&this.blurInput(),this.props.onChange){if(this.props.required){var u=this.handleRequired(e,this.props.multi);this.setState({required:u})}this.props.simpleValue&&e&&(e=this.props.multi?e.map(function(e){return e[t.props.valueKey]}).join(this.props.delimiter):e[this.props.valueKey]),this.props.onChange(e)}},selectValue:function(e){var t=this;this.hasScrolledToOption=!1,this.props.multi?this.setState({inputValue:"",focusedIndex:null},function(){t.addValue(e)}):this.setState({isOpen:!1,inputValue:"",isPseudoFocused:this.state.isFocused},function(){t.setValue(e)})},addValue:function(e){var t=this.getValueArray(this.props.value);this.setValue(t.concat(e))},popValue:function(){var e=this.getValueArray(this.props.value);e.length&&e[e.length-1].clearableValue!==!1&&this.setValue(e.slice(0,e.length-1))},removeValue:function(e){var t=this.getValueArray(this.props.value);this.setValue(t.filter(function(t){return t!==e})),this.focus()},clearValue:function(e){e&&"mousedown"===e.type&&0!==e.button||(e.stopPropagation(),e.preventDefault(),this.setValue(this.getResetValue()),this.setState({isOpen:!1,inputValue:""},this.focus))},getResetValue:function(){return void 0!==this.props.resetValue?this.props.resetValue:this.props.multi?[]:null},focusOption:function(e){this.setState({focusedOption:e})},focusNextOption:function(){this.focusAdjacentOption("next")},focusPreviousOption:function(){this.focusAdjacentOption("previous")},focusPageUpOption:function(){this.focusAdjacentOption("page_up")},focusPageDownOption:function(){this.focusAdjacentOption("page_down")},focusStartOption:function(){this.focusAdjacentOption("start")},focusEndOption:function(){this.focusAdjacentOption("end")},focusAdjacentOption:function(e){var t=this._visibleOptions.map(function(e,t){return{option:e,index:t}}).filter(function(e){return!e.option.disabled});if(this._scrollToFocusedOptionOnUpdate=!0,!this.state.isOpen)return void this.setState({isOpen:!0,inputValue:"",focusedOption:this._focusedOption||t["next"===e?0:t.length-1].option});if(t.length){for(var u=-1,n=0;n<t.length;n++)if(this._focusedOption===t[n].option){u=n;break}if("next"===e&&u!==-1)u=(u+1)%t.length;else if("previous"===e)u>0?u-=1:u=t.length-1;else if("start"===e)u=0;else if("end"===e)u=t.length-1;else if("page_up"===e){var o=u-this.props.pageSize;u=o<0?0:o}else if("page_down"===e){var o=u+this.props.pageSize;u=o>t.length-1?t.length-1:o}u===-1&&(u=0),this.setState({focusedIndex:t[u].index,focusedOption:t[u].option})}},getFocusedOption:function(){return this._focusedOption},getInputValue:function(){return this.state.inputValue},selectFocusedOption:function(){if(this._focusedOption)return this.selectValue(this._focusedOption)},renderLoading:function(){if(this.props.isLoading)return c["default"].createElement("span",{className:"Select-loading-zone","aria-hidden":"true"},c["default"].createElement("span",{className:"Select-loading"}))},renderValue:function(e,t){var u=this,n=this.props.valueRenderer||this.getOptionLabel,o=this.props.valueComponent;if(!e.length)return this.state.inputValue?null:c["default"].createElement("div",{className:"Select-placeholder"},this.props.placeholder);var s=this.props.onValueClick?this.handleValueClick:null;return this.props.multi?e.map(function(e,t){return c["default"].createElement(o,{id:u._instancePrefix+"-value-"+t,instancePrefix:u._instancePrefix,disabled:u.props.disabled||e.clearableValue===!1,key:"value-"+t+"-"+e[u.props.valueKey],onClick:s,onRemove:u.removeValue,value:e},n(e,t),c["default"].createElement("span",{className:"Select-aria-only"}," "))}):this.state.inputValue?void 0:(t&&(s=null),c["default"].createElement(o,{id:this._instancePrefix+"-value-item",disabled:this.props.disabled,instancePrefix:this._instancePrefix,onClick:s,value:e[0]},n(e[0])))},renderInput:function(e,t){var u=this;if(this.props.inputRenderer)return this.props.inputRenderer();var n,o=(0,b["default"])("Select-input",this.props.inputProps.className),r=!!this.state.isOpen,a=(0,b["default"])((n={},i(n,this._instancePrefix+"-list",r),i(n,this._instancePrefix+"-backspace-remove-message",this.props.multi&&!this.props.disabled&&this.state.isFocused&&!this.state.inputValue),n)),l=p({},this.props.inputProps,{role:"combobox","aria-expanded":""+r,"aria-owns":a,"aria-haspopup":""+r,"aria-activedescendant":r?this._instancePrefix+"-option-"+t:this._instancePrefix+"-value","aria-labelledby":this.props["aria-labelledby"],"aria-label":this.props["aria-label"],className:o,tabIndex:this.props.tabIndex,onBlur:this.handleInputBlur,onChange:this.handleInputChange,onFocus:this.handleInputFocus,ref:function(e){return u.input=e},required:this.state.required,value:this.state.inputValue});if(this.props.disabled||!this.props.searchable){var d=this.props.inputProps,f=(d.inputClassName,s(d,["inputClassName"]));return c["default"].createElement("div",p({},f,{role:"combobox","aria-expanded":r,"aria-owns":r?this._instancePrefix+"-list":this._instancePrefix+"-value","aria-activedescendant":r?this._instancePrefix+"-option-"+t:this._instancePrefix+"-value",className:o,tabIndex:this.props.tabIndex||0,onBlur:this.handleInputBlur,onFocus:this.handleInputFocus,ref:function(e){return u.input=e},"aria-readonly":""+!!this.props.disabled,style:{border:0,width:1,display:"inline-block"}}))}return this.props.autosize?c["default"].createElement(g["default"],p({},l,{minWidth:"5px"})):c["default"].createElement("div",{className:o},c["default"].createElement("input",l))},renderClear:function(){if(this.props.clearable&&this.props.value&&0!==this.props.value&&(!this.props.multi||this.props.value.length)&&!this.props.disabled&&!this.props.isLoading)return c["default"].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,onTouchStart:this.handleTouchStart,onTouchMove:this.handleTouchMove,onTouchEnd:this.handleTouchEndClearValue},c["default"].createElement("span",{className:"Select-clear",dangerouslySetInnerHTML:{__html:"&times;"}}))},renderArrow:function(){var e=this.handleMouseDownOnArrow,t=this.props.arrowRenderer({onMouseDown:e});return c["default"].createElement("span",{className:"Select-arrow-zone",onMouseDown:e},t)},filterFlatOptions:function(e){var t=this.state.inputValue,u=this._flatOptions;if(this.props.filterOptions){
var n="function"==typeof this.props.filterOptions?this.props.filterOptions:F["default"];return n(u,t,e,{filterOption:this.props.filterOption,ignoreAccents:this.props.ignoreAccents,ignoreCase:this.props.ignoreCase,labelKey:this.props.labelKey,matchPos:this.props.matchPos,matchProp:this.props.matchProp,valueKey:this.props.valueKey})}return u},flattenOptions:function(e,t){if(!e)return[];for(var u=[],n=0;n<e.length;n++){var o=r(e[n]);o.isInTree=!1,t&&(o.group=t),a(o)?(u=u.concat(this.flattenOptions(o.options,o)),o.options=[]):u.push(o)}return u},unflattenOptions:function(e){var t=[],u=void 0,n=void 0;return e.forEach(function(e){for(e.isInTree=!1,u=e.group;u;)u.isInTree&&(u.options=[],u.isInTree=!1),u=u.group}),e.forEach(function(e){for(n=e,u=n.group;u;)n.isInTree||(u.options.push(n),n.isInTree=!0),n=u,u=n.group;n.isInTree||(t.push(n),n.isInTree=!0)}),t},onOptionRef:function(e,t){t&&(this.focused=e)},renderMenu:function(e,t,u){return e&&e.length?this.props.menuRenderer({focusedOption:u,focusOption:this.focusOption,instancePrefix:this._instancePrefix,labelKey:this.props.labelKey,onFocus:this.focusOption,onOptionRef:this.onOptionRef,onSelect:this.selectValue,optionClassName:this.props.optionClassName,optionComponent:this.props.optionComponent,optionGroupComponent:this.props.optionGroupComponent,optionRenderer:this.props.optionRenderer||this.getOptionLabel,options:e,selectValue:this.selectValue,valueArray:t,valueKey:this.props.valueKey}):this.props.noResultsText?c["default"].createElement("div",{className:"Select-noresults"},this.props.noResultsText):null},renderHiddenField:function(e){var t=this;if(this.props.name){if(this.props.joinValues){var u=e.map(function(e){return l(e[t.props.valueKey])}).join(this.props.delimiter);return c["default"].createElement("input",{type:"hidden",ref:function(e){return t.value=e},name:this.props.name,value:u,disabled:this.props.disabled})}return e.map(function(e,u){return c["default"].createElement("input",{key:"hidden."+u,type:"hidden",ref:"value"+u,name:t.props.name,value:l(e[t.props.valueKey]),disabled:t.props.disabled})})}},getFocusableOptionIndex:function(e){var t=this._visibleOptions;if(!t.length)return null;var u=this.state.focusedOption||e;if(u&&!u.disabled){var n=t.indexOf(u);if(n!==-1)return n}for(var o=0;o<t.length;o++)if(!t[o].disabled)return o;return null},renderOuter:function(e,t,u){var n=this,o=this.props.dropdownComponent,s=this.renderMenu(e,t,u);return s?c["default"].createElement(o,null,c["default"].createElement("div",{ref:function(e){return n.menuContainer=e},className:"Select-menu-outer",style:this.props.menuContainerStyle},c["default"].createElement("div",{ref:function(e){return n.menu=e},role:"listbox",className:"Select-menu",id:this._instancePrefix+"-list",style:this.props.menuStyle,onScroll:this.handleMenuScroll,onMouseDown:this.handleMouseDownOnMenu},s))):null},render:function(){var e=this,t=this.getValueArray(this.props.value);this._visibleOptions=this.filterFlatOptions(this.props.multi?t:null);var u=this.unflattenOptions(this._visibleOptions),n="boolean"==typeof this.props.isOpen?this.props.isOpen:this.state.isOpen;this.props.multi&&!u.length&&t.length&&!this.state.inputValue&&(n=!1);var o=this.getFocusableOptionIndex(t[0]),s=null;s=null!==o?this._focusedOption=this._visibleOptions[o]:this._focusedOption=null;var i=(0,b["default"])("Select",this.props.className,{"Select--multi":this.props.multi,"Select--single":!this.props.multi,"is-disabled":this.props.disabled,"is-focused":this.state.isFocused,"is-loading":this.props.isLoading,"is-open":n,"is-pseudo-focused":this.state.isPseudoFocused,"is-searchable":this.props.searchable,"has-value":t.length}),r=null;return this.props.multi&&!this.props.disabled&&t.length&&!this.state.inputValue&&this.state.isFocused&&this.props.backspaceRemoves&&(r=c["default"].createElement("span",{id:this._instancePrefix+"-backspace-remove-message",className:"Select-aria-only","aria-live":"assertive"},this.props.backspaceToRemoveMessage.replace("{label}",t[t.length-1][this.props.labelKey]))),c["default"].createElement("div",{ref:function(t){return e.wrapper=t},className:i,style:this.props.wrapperStyle},this.renderHiddenField(t),c["default"].createElement("div",{ref:function(t){return e.control=t},className:"Select-control",style:this.props.style,onKeyDown:this.handleKeyDown,onMouseDown:this.handleMouseDown,onTouchEnd:this.handleTouchEnd,onTouchStart:this.handleTouchStart,onTouchMove:this.handleTouchMove},c["default"].createElement("span",{className:"Select-multi-value-wrapper",id:this._instancePrefix+"-value"},this.renderValue(t,n),this.renderInput(t,o)),r,this.renderLoading(),this.renderClear(),this.renderArrow()),n?this.renderOuter(u,this.props.multi?null:t,s):null)}});u["default"]=q,t.exports=u["default"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./Async":1,"./AsyncCreatable":2,"./Creatable":3,"./Dropdown":4,"./Option":5,"./OptionGroup":6,"./Value":8,"./utils/defaultArrowRenderer":9,"./utils/defaultFilterOptions":10,"./utils/defaultMenuRenderer":11}],8:[function(e,t,u){(function(e){"use strict";function u(e){return e&&e.__esModule?e:{"default":e}}var n="undefined"!=typeof window?window.React:"undefined"!=typeof e?e.React:null,o=u(n),s="undefined"!=typeof window?window.classNames:"undefined"!=typeof e?e.classNames:null,i=u(s),r=o["default"].createClass({displayName:"Value",propTypes:{children:o["default"].PropTypes.node,disabled:o["default"].PropTypes.bool,id:o["default"].PropTypes.string,onClick:o["default"].PropTypes.func,onRemove:o["default"].PropTypes.func,value:o["default"].PropTypes.object.isRequired},handleMouseDown:function(e){if("mousedown"!==e.type||0===e.button)return this.props.onClick?(e.stopPropagation(),void this.props.onClick(this.props.value,e)):void(this.props.value.href&&e.stopPropagation())},onRemove:function(e){e.preventDefault(),e.stopPropagation(),this.props.onRemove(this.props.value)},handleTouchEndRemove:function(e){this.dragging||this.onRemove(e)},handleTouchMove:function(e){this.dragging=!0},handleTouchStart:function(e){this.dragging=!1},renderRemoveIcon:function(){if(!this.props.disabled&&this.props.onRemove)return o["default"].createElement("span",{className:"Select-value-icon","aria-hidden":"true",onMouseDown:this.onRemove,onTouchEnd:this.handleTouchEndRemove,onTouchStart:this.handleTouchStart,onTouchMove:this.handleTouchMove},"×")},renderLabel:function(){var e="Select-value-label";return this.props.onClick||this.props.value.href?o["default"].createElement("a",{className:e,href:this.props.value.href,target:this.props.value.target,onMouseDown:this.handleMouseDown,onTouchEnd:this.handleMouseDown},this.props.children):o["default"].createElement("span",{className:e,role:"option","aria-selected":"true",id:this.props.id},this.props.children)},render:function(){return o["default"].createElement("div",{className:(0,i["default"])("Select-value",this.props.value.className),style:this.props.value.style,title:this.props.value.title},this.renderRemoveIcon(),this.renderLabel())}});t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],9:[function(e,t,u){(function(e){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.onMouseDown;return i["default"].createElement("span",{className:"Select-arrow",onMouseDown:t})}Object.defineProperty(u,"__esModule",{value:!0}),u["default"]=o;var s="undefined"!=typeof window?window.React:"undefined"!=typeof e?e.React:null,i=n(s);t.exports=u["default"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],10:[function(e,t,u){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,u,n){var o=this;return n.ignoreAccents&&(t=(0,i["default"])(t)),n.ignoreCase&&(t=t.toLowerCase()),u&&(u=u.map(function(e){return e[n.valueKey]})),e.filter(function(e){if(u&&u.indexOf(e[n.valueKey])>-1)return!1;if(n.filterOption)return n.filterOption.call(o,e,t);if(!t)return!0;var s=String(e[n.valueKey]),r=String(e[n.labelKey]);return n.ignoreAccents&&("label"!==n.matchProp&&(s=(0,i["default"])(s)),"value"!==n.matchProp&&(r=(0,i["default"])(r))),n.ignoreCase&&("label"!==n.matchProp&&(s=s.toLowerCase()),"value"!==n.matchProp&&(r=r.toLowerCase())),"start"===n.matchPos?"label"!==n.matchProp&&s.substr(0,t.length)===t||"value"!==n.matchProp&&r.substr(0,t.length)===t:"label"!==n.matchProp&&s.indexOf(t)>=0||"value"!==n.matchProp&&r.indexOf(t)>=0})}var s=e("./stripDiacritics"),i=n(s);t.exports=o},{"./stripDiacritics":12}],11:[function(e,t,u){(function(e){"use strict";function u(e){return e&&e.__esModule?e:{"default":e}}function n(e){return e&&Array.isArray(e.options)}function o(e){var t=e.focusedOption,u=e.instancePrefix,o=(e.labelKey,e.onFocus),s=e.onOptionRef,r=e.onSelect,l=e.optionClassName,p=e.optionComponent,d=e.optionGroupComponent,c=e.optionRenderer,f=e.options,h=e.valueArray,E=e.valueKey,g=d,y=p,b=c||this.getOptionLabel,v=function m(e){return e.map(function(e,p){if(n(e)){var d=(0,i["default"])({"Select-option-group":!0});return a["default"].createElement(g,{className:d,key:"option-group-"+p,label:b(e),option:e,optionIndex:p},m(e.options))}var c=function(){var n=h&&h.indexOf(e)>-1,d=e===t,c=(0,i["default"])(l,{"Select-option":!0,"is-selected":n,"is-focused":d,"is-disabled":e.disabled});return{v:a["default"].createElement(y,{className:c,instancePrefix:u,isDisabled:e.disabled,isFocused:d,isSelected:n,key:"option-"+p+"-"+e[E],onFocus:o,onSelect:r,option:e,optionIndex:p,ref:function(e){s(e,d)}},b(e,p))}}();if("object"==typeof c)return c.v})};return v(f)}var s="undefined"!=typeof window?window.classNames:"undefined"!=typeof e?e.classNames:null,i=u(s),r="undefined"!=typeof window?window.React:"undefined"!=typeof e?e.React:null,a=u(r);t.exports=o}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],12:[function(e,t,u){"use strict";var n=[{base:"A",letters:/[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g},{base:"AA",letters:/[\uA732]/g},{base:"AE",letters:/[\u00C6\u01FC\u01E2]/g},{base:"AO",letters:/[\uA734]/g},{base:"AU",letters:/[\uA736]/g},{base:"AV",letters:/[\uA738\uA73A]/g},{base:"AY",letters:/[\uA73C]/g},{base:"B",letters:/[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g},{base:"C",letters:/[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g},{base:"D",letters:/[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g},{base:"DZ",letters:/[\u01F1\u01C4]/g},{base:"Dz",letters:/[\u01F2\u01C5]/g},{base:"E",letters:/[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g},{base:"F",letters:/[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g},{base:"G",letters:/[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g},{base:"H",letters:/[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g},{base:"I",letters:/[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g},{base:"J",letters:/[\u004A\u24BF\uFF2A\u0134\u0248]/g},{base:"K",letters:/[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g},{base:"L",letters:/[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g},{base:"LJ",letters:/[\u01C7]/g},{base:"Lj",letters:/[\u01C8]/g},{base:"M",letters:/[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g},{base:"N",letters:/[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g},{base:"NJ",letters:/[\u01CA]/g},{base:"Nj",letters:/[\u01CB]/g},{base:"O",letters:/[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g},{base:"OI",letters:/[\u01A2]/g},{base:"OO",letters:/[\uA74E]/g},{base:"OU",letters:/[\u0222]/g},{base:"P",letters:/[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g},{base:"Q",letters:/[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g},{base:"R",letters:/[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g},{base:"S",letters:/[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g},{base:"T",letters:/[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g},{base:"TZ",letters:/[\uA728]/g},{base:"U",letters:/[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g},{base:"V",letters:/[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g},{base:"VY",letters:/[\uA760]/g},{base:"W",letters:/[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g},{base:"X",letters:/[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g},{base:"Y",letters:/[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g},{base:"Z",letters:/[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g},{base:"a",letters:/[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g},{base:"aa",letters:/[\uA733]/g},{base:"ae",letters:/[\u00E6\u01FD\u01E3]/g},{base:"ao",letters:/[\uA735]/g},{base:"au",letters:/[\uA737]/g},{base:"av",letters:/[\uA739\uA73B]/g},{base:"ay",letters:/[\uA73D]/g},{base:"b",letters:/[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g},{base:"c",letters:/[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g},{base:"d",letters:/[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g},{base:"dz",letters:/[\u01F3\u01C6]/g},{base:"e",letters:/[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g},{base:"f",letters:/[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g},{base:"g",letters:/[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g},{base:"h",letters:/[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g},{base:"hv",letters:/[\u0195]/g},{base:"i",letters:/[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g},{base:"j",letters:/[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g},{base:"k",letters:/[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g},{base:"l",letters:/[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g},{base:"lj",letters:/[\u01C9]/g},{base:"m",letters:/[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g},{base:"n",letters:/[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g},{base:"nj",letters:/[\u01CC]/g},{base:"o",letters:/[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g},{base:"oi",letters:/[\u01A3]/g},{base:"ou",letters:/[\u0223]/g},{base:"oo",letters:/[\uA74F]/g},{base:"p",letters:/[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g},{base:"q",letters:/[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g},{base:"r",letters:/[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g},{base:"s",letters:/[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g},{base:"t",letters:/[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g},{base:"tz",letters:/[\uA729]/g},{base:"u",letters:/[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g},{base:"v",letters:/[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g},{base:"vy",letters:/[\uA761]/g},{base:"w",letters:/[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g},{base:"x",letters:/[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g},{base:"y",letters:/[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g},{base:"z",letters:/[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g}];t.exports=function(e){for(var t=0;t<n.length;t++)e=e.replace(n[t].letters,n[t].base);return e}},{}]},{},[7])(7)});
!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,u,n){function o(i,r){if(!u[i]){if(!t[i]){var a="function"==typeof require&&require;if(!r&&a)return a(i,!0);if(s)return s(i,!0);var l=new Error("Cannot find module '"+i+"'");throw l.code="MODULE_NOT_FOUND",l}var p=u[i]={exports:{}};t[i][0].call(p.exports,function(e){var u=t[i][1][e];return o(u?u:e)},p,p.exports,e,t,u,n)}return u[i].exports}for(var s="function"==typeof require&&require,i=0;i<n.length;i++)o(n[i]);return o}({1:[function(e,t,u){(function(n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function s(e,t,u){return t in e?Object.defineProperty(e,t,{value:u,enumerable:!0,configurable:!0,writable:!0}):e[t]=u,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e){return f["default"].createElement(E["default"],e)}Object.defineProperty(u,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var u=arguments[t];for(var n in u)Object.prototype.hasOwnProperty.call(u,n)&&(e[n]=u[n])}return e},p=function(){function e(e,t){for(var u=0;u<t.length;u++){var n=t[u];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,u,n){return u&&e(t.prototype,u),n&&e(t,n),t}}(),d=function(e,t,u){for(var n=!0;n;){var o=e,s=t,i=u;n=!1,null===o&&(o=Function.prototype);var r=Object.getOwnPropertyDescriptor(o,s);if(void 0!==r){if("value"in r)return r.value;var a=r.get;if(void 0===a)return;return a.call(i)}var l=Object.getPrototypeOf(o);if(null===l)return;e=l,t=s,u=i,n=!0,r=l=void 0}},c="undefined"!=typeof window?window.React:"undefined"!=typeof n?n.React:null,f=o(c),h=e("./Select"),E=o(h),y=e("./utils/stripDiacritics"),g=o(y),v={autoload:f["default"].PropTypes.bool.isRequired,cache:f["default"].PropTypes.any,children:f["default"].PropTypes.func.isRequired,ignoreAccents:f["default"].PropTypes.bool,ignoreCase:f["default"].PropTypes.bool,loadingPlaceholder:f["default"].PropTypes.oneOfType([f["default"].PropTypes.string,f["default"].PropTypes.node]),loadOptions:f["default"].PropTypes.func.isRequired,options:c.PropTypes.array.isRequired,placeholder:f["default"].PropTypes.oneOfType([f["default"].PropTypes.string,f["default"].PropTypes.node]),noResultsText:f["default"].PropTypes.oneOfType([f["default"].PropTypes.string,f["default"].PropTypes.node]),onChange:f["default"].PropTypes.func,searchPromptText:f["default"].PropTypes.oneOfType([f["default"].PropTypes.string,f["default"].PropTypes.node]),onInputChange:f["default"].PropTypes.func,value:f["default"].PropTypes.any},b={},m={autoload:!0,cache:b,children:a,ignoreAccents:!0,ignoreCase:!0,loadingPlaceholder:"Loading...",options:[],searchPromptText:"Type to search"},C=function(e){function t(e,u){i(this,t),d(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e,u),this._cache=e.cache===b?{}:e.cache,this.state={isLoading:!1,options:e.options},this._onInputChange=this._onInputChange.bind(this)}return r(t,e),p(t,[{key:"componentDidMount",value:function(){var e=this.props.autoload;e&&this.loadOptions("")}},{key:"componentWillUpdate",value:function(e,t){var u=this,n=["options"];n.forEach(function(t){u.props[t]!==e[t]&&u.setState(s({},t,e[t]))})}},{key:"clearOptions",value:function(){this.setState({options:[]})}},{key:"loadOptions",value:function u(e){var t=this,u=this.props.loadOptions,n=this._cache;if(n&&n.hasOwnProperty(e))return void this.setState({options:n[e]});var o=function i(u,o){if(i===t._callback){t._callback=null;var s=o&&o.options||[];n&&(n[e]=s),t.setState({isLoading:!1,options:s})}};this._callback=o;var s=u(e,o);return s&&s.then(function(e){return o(null,e)},function(e){return o(e)}),this._callback&&!this.state.isLoading&&this.setState({isLoading:!0}),e}},{key:"_onInputChange",value:function(e){var t=this.props,u=t.ignoreAccents,n=t.ignoreCase,o=t.onInputChange;return u&&(e=(0,g["default"])(e)),n&&(e=e.toLowerCase()),o&&o(e),this.loadOptions(e)}},{key:"inputValue",value:function(){return this.select?this.select.state.inputValue:""}},{key:"noResultsText",value:function n(){var e=this.props,t=e.loadingPlaceholder,n=e.noResultsText,u=e.searchPromptText,o=this.state.isLoading,s=this.inputValue();return o?t:s&&n?n:u}},{key:"focus",value:function(){this.select.focus()}},{key:"render",value:function(){var e=this,t=this.props,u=t.children,n=t.loadingPlaceholder,o=t.placeholder,s=this.state,i=s.isLoading,r=s.options,a={noResultsText:this.noResultsText(),placeholder:i?n:o,options:i&&n?[]:r,ref:function(t){return e.select=t},onChange:function(t){e.props.multi&&e.props.value&&t.length>e.props.value.length&&e.clearOptions(),e.props.onChange(t)}};return u(l({},this.props,a,{isLoading:i,onInputChange:this._onInputChange}))}}]),t}(c.Component);u["default"]=C,C.propTypes=v,C.defaultProps=m,t.exports=u["default"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./Select":7,"./utils/stripDiacritics":13}],2:[function(e,t,u){(function(u){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return Object.keys(e).reduce(function(t,u){var n=e[u];return void 0!==n&&(t[u]=n),t},t)}var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var u=arguments[t];for(var n in u)Object.prototype.hasOwnProperty.call(u,n)&&(e[n]=u[n])}return e},i="undefined"!=typeof window?window.React:"undefined"!=typeof u?u.React:null,r=n(i),a=e("./Select"),l=n(a),p=r["default"].createClass({displayName:"AsyncCreatableSelect",render:function(){var e=this;return r["default"].createElement(l["default"].Async,this.props,function(t){return r["default"].createElement(l["default"].Creatable,e.props,function(e){return r["default"].createElement(l["default"],s({},o(t,o(e,{})),{onInputChange:function(u){return e.onInputChange(u),t.onInputChange(u)},ref:function(u){e.ref(u),t.ref(u)}}))})})}});t.exports=p}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./Select":7}],3:[function(e,t,u){(function(u){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var u={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(u[n]=e[n]);return u}function s(e){return f["default"].createElement(E["default"],e)}function i(e){var t=e.option,u=e.options,n=e.labelKey,o=e.valueKey;return 0===u.filter(function(e){return e[n]===t[n]||e[o]===t[o]}).length}function r(e){var t=e.label;return!!t}function a(e){var t=e.label,u=e.labelKey,n=e.valueKey,o={};return o[n]=t,o[u]=t,o.className="Select-create-option-placeholder",o}function l(e){return'Create option "'+e+'"'}function p(e){var t=e.keyCode;switch(t){case 9:case 13:case 188:return!0}return!1}var d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var u=arguments[t];for(var n in u)Object.prototype.hasOwnProperty.call(u,n)&&(e[n]=u[n])}return e},c="undefined"!=typeof window?window.React:"undefined"!=typeof u?u.React:null,f=n(c),h=e("./Select"),E=n(h),y=e("./utils/defaultFilterOptions"),g=n(y),v=e("./utils/defaultMenuRenderer"),b=n(v),m=f["default"].createClass({displayName:"CreatableSelect",propTypes:{children:f["default"].PropTypes.func,filterOptions:f["default"].PropTypes.any,isOptionUnique:f["default"].PropTypes.func,isValidNewOption:f["default"].PropTypes.func,menuRenderer:f["default"].PropTypes.any,newOptionCreator:f["default"].PropTypes.func,onInputChange:f["default"].PropTypes.func,onInputKeyDown:f["default"].PropTypes.func,onNewOptionClick:f["default"].PropTypes.func,options:f["default"].PropTypes.array,promptTextCreator:f["default"].PropTypes.func,shouldKeyDownEventCreateNewOption:f["default"].PropTypes.func},statics:{isOptionUnique:i,isValidNewOption:r,newOptionCreator:a,promptTextCreator:l,shouldKeyDownEventCreateNewOption:p},getDefaultProps:function(){return{filterOptions:g["default"],isOptionUnique:i,isValidNewOption:r,menuRenderer:b["default"],newOptionCreator:a,promptTextCreator:l,shouldKeyDownEventCreateNewOption:p}},createNewOption:function(){var e=this.props,t=e.isValidNewOption,u=e.newOptionCreator,n=e.onNewOptionClick,o=e.options,s=void 0===o?[]:o;e.shouldKeyDownEventCreateNewOption;if(t({label:this.inputValue})){var i=u({label:this.inputValue,labelKey:this.labelKey,valueKey:this.valueKey}),r=this.isOptionUnique({option:i});r&&(n?n(i):(s.unshift(i),this.select.selectValue(i)))}},filterOptions:function C(){var e=this.props,C=e.filterOptions,t=e.isValidNewOption,u=(e.options,e.promptTextCreator),n=arguments[2]||[],o=C.apply(void 0,arguments)||[];if(t({label:this.inputValue})){var s=this.props.newOptionCreator,i=s({label:this.inputValue,labelKey:this.labelKey,valueKey:this.valueKey}),r=this.isOptionUnique({option:i,options:n.concat(o)});if(r){var a=u(this.inputValue);this._createPlaceholderOption=s({label:a,labelKey:this.labelKey,valueKey:this.valueKey}),o.unshift(this._createPlaceholderOption)}}return o},isOptionUnique:function O(e){var t=e.option,u=e.options,O=this.props.isOptionUnique;return u=u||this.select.filterFlatOptions(),O({labelKey:this.labelKey,option:t,options:u,valueKey:this.valueKey})},menuRenderer:function w(e){var w=this.props.menuRenderer;return w(d({},e,{onSelect:this.onOptionSelect,selectValue:this.onOptionSelect}))},onInputChange:function F(e){var F=this.props.onInputChange;F&&F(e),this.inputValue=e},onInputKeyDown:function T(e){var t=this.props,u=t.shouldKeyDownEventCreateNewOption,T=t.onInputKeyDown,n=this.select.getFocusedOption();n&&n===this._createPlaceholderOption&&u({keyCode:e.keyCode})?(this.createNewOption(),e.preventDefault()):T&&T(e)},onOptionSelect:function(e,t){e===this._createPlaceholderOption?this.createNewOption():this.select.selectValue(e)},render:function(){var e=this,t=this.props,u=(t.newOptionCreator,t.shouldKeyDownEventCreateNewOption,o(t,["newOptionCreator","shouldKeyDownEventCreateNewOption"])),n=this.props.children;n||(n=s);var i=d({},u,{allowCreate:!0,filterOptions:this.filterOptions,menuRenderer:this.menuRenderer,onInputChange:this.onInputChange,onInputKeyDown:this.onInputKeyDown,ref:function(t){e.select=t,t&&(e.labelKey=t.props.labelKey,e.valueKey=t.props.valueKey)}});return n(i)}});t.exports=m}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./Select":7,"./utils/defaultFilterOptions":11,"./utils/defaultMenuRenderer":12}],4:[function(e,t,u){(function(e){"use strict";function u(e){return e&&e.__esModule?e:{"default":e}}var n="undefined"!=typeof window?window.React:"undefined"!=typeof e?e.React:null,o=u(n),s=o["default"].createClass({displayName:"Dropdown",propTypes:{children:o["default"].PropTypes.node},render:function(){return this.props.children}});t.exports=s}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],5:[function(e,t,u){(function(e){"use strict";function u(e){return e&&e.__esModule?e:{"default":e}}var n="undefined"!=typeof window?window.React:"undefined"!=typeof e?e.React:null,o=u(n),s="undefined"!=typeof window?window.classNames:"undefined"!=typeof e?e.classNames:null,i=u(s),r=o["default"].createClass({displayName:"Option",propTypes:{children:o["default"].PropTypes.node,className:o["default"].PropTypes.string,instancePrefix:o["default"].PropTypes.string.isRequired,isDisabled:o["default"].PropTypes.bool,isFocused:o["default"].PropTypes.bool,isSelected:o["default"].PropTypes.bool,onFocus:o["default"].PropTypes.func,onSelect:o["default"].PropTypes.func,onUnfocus:o["default"].PropTypes.func,option:o["default"].PropTypes.object.isRequired,optionIndex:o["default"].PropTypes.number},blockEvent:function(e){e.preventDefault(),e.stopPropagation(),"A"===e.target.tagName&&"href"in e.target&&(e.target.target?window.open(e.target.href,e.target.target):window.location.href=e.target.href)},handleMouseDown:function(e){e.preventDefault(),e.stopPropagation(),this.props.onSelect(this.props.option,e)},handleMouseEnter:function(e){this.onFocus(e)},handleMouseMove:function(e){this.onFocus(e)},handleTouchEnd:function(e){this.dragging||this.handleMouseDown(e)},handleTouchMove:function(e){this.dragging=!0},handleTouchStart:function(e){this.dragging=!1},onFocus:function(e){this.props.isFocused||this.props.onFocus(this.props.option,e)},render:function(){var e=this.props,t=e.option,u=e.instancePrefix,n=e.optionIndex,s=(0,i["default"])(this.props.className,t.className);return t.disabled?o["default"].createElement("div",{className:s,onMouseDown:this.blockEvent,onClick:this.blockEvent},this.props.children):o["default"].createElement("div",{className:s,style:t.style,role:"option",onMouseDown:this.handleMouseDown,onMouseEnter:this.handleMouseEnter,onMouseMove:this.handleMouseMove,onTouchStart:this.handleTouchStart,onTouchMove:this.handleTouchMove,onTouchEnd:this.handleTouchEnd,id:u+"-option-"+n,title:t.title},this.props.children)}});t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],6:[function(e,t,u){(function(e){"use strict";function u(e){return e&&e.__esModule?e:{"default":e}}var n="undefined"!=typeof window?window.React:"undefined"!=typeof e?e.React:null,o=u(n),s="undefined"!=typeof window?window.classNames:"undefined"!=typeof e?e.classNames:null,i=u(s),r=o["default"].createClass({displayName:"OptionGroup",propTypes:{children:o["default"].PropTypes.any,className:o["default"].PropTypes.string,label:o["default"].PropTypes.node,option:o["default"].PropTypes.object.isRequired},blockEvent:function(e){e.preventDefault(),e.stopPropagation(),"A"===e.target.tagName&&"href"in e.target&&(e.target.target?window.open(e.target.href,e.target.target):window.location.href=e.target.href)},handleMouseDown:function(e){e.preventDefault(),e.stopPropagation()},handleTouchEnd:function(e){this.dragging||this.handleMouseDown(e)},handleTouchMove:function(e){this.dragging=!0},handleTouchStart:function(e){this.dragging=!1},render:function(){var e=this.props.option,t=(0,i["default"])(this.props.className,e.className);return e.disabled?o["default"].createElement("div",{className:t,onMouseDown:this.blockEvent,onClick:this.blockEvent},this.props.children):o["default"].createElement("div",{className:t,style:e.style,onMouseDown:this.handleMouseDown,onMouseEnter:this.handleMouseEnter,onMouseMove:this.handleMouseMove,onTouchStart:this.handleTouchStart,onTouchMove:this.handleTouchMove,onTouchEnd:this.handleTouchEnd,title:e.title},o["default"].createElement("div",{className:"Select-option-group-label"},this.props.label),this.props.children)}});t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],7:[function(e,t,u){(function(n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){var u={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(u[n]=e[n]);return u}function i(e,t,u){return t in e?Object.defineProperty(e,t,{value:u,enumerable:!0,configurable:!0,writable:!0}):e[t]=u,e}function r(e){var t={};for(var u in e)e.hasOwnProperty(u)&&(t[u]=e[u]);return t}function a(e){return e&&Array.isArray(e.options)}function l(e){var t=typeof e;return"string"===t?e:"object"===t?JSON.stringify(e):"number"===t||"boolean"===t?String(e):""}Object.defineProperty(u,"__esModule",{value:!0});var p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var u=arguments[t];for(var n in u)Object.prototype.hasOwnProperty.call(u,n)&&(e[n]=u[n])}return e},d="undefined"!=typeof window?window.React:"undefined"!=typeof n?n.React:null,c=o(d),f="undefined"!=typeof window?window.ReactDOM:"undefined"!=typeof n?n.ReactDOM:null,h=o(f),E="undefined"!=typeof window?window.AutosizeInput:"undefined"!=typeof n?n.AutosizeInput:null,y=o(E),g="undefined"!=typeof window?window.classNames:"undefined"!=typeof n?n.classNames:null,v=o(g),b=e("./utils/defaultArrowRenderer"),m=o(b),C=e("./utils/defaultFilterOptions"),O=o(C),w=e("./utils/defaultMenuRenderer"),F=o(w),T=e("./utils/defaultClearRenderer"),P=o(T),A=e("./Async"),D=o(A),S=e("./AsyncCreatable"),R=o(S),V=e("./Creatable"),M=o(V),B=e("./Dropdown"),x=o(B),_=e("./Option"),N=o(_),I=e("./OptionGroup"),K=o(I),k=e("./Value"),j=o(k),L=c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.node]),q=1,U={},z=c["default"].createClass({displayName:"Select",propTypes:{addLabelText:c["default"].PropTypes.string,"aria-label":c["default"].PropTypes.string,"aria-labelledby":c["default"].PropTypes.string,arrowRenderer:c["default"].PropTypes.func,autoBlur:c["default"].PropTypes.bool,autofocus:c["default"].PropTypes.bool,autosize:c["default"].PropTypes.bool,backspaceRemoves:c["default"].PropTypes.bool,backspaceToRemoveMessage:c["default"].PropTypes.string,className:c["default"].PropTypes.string,clearAllText:L,clearRenderer:c["default"].PropTypes.func,clearValueText:L,clearable:c["default"].PropTypes.bool,deleteRemoves:c["default"].PropTypes.bool,delimiter:c["default"].PropTypes.string,disabled:c["default"].PropTypes.bool,dropdownComponent:c["default"].PropTypes.func,escapeClearsValue:c["default"].PropTypes.bool,filterOption:c["default"].PropTypes.func,filterOptions:c["default"].PropTypes.any,ignoreAccents:c["default"].PropTypes.bool,ignoreCase:c["default"].PropTypes.bool,inputProps:c["default"].PropTypes.object,inputRenderer:c["default"].PropTypes.func,instanceId:c["default"].PropTypes.string,isLoading:c["default"].PropTypes.bool,isOpen:c["default"].PropTypes.bool,joinValues:c["default"].PropTypes.bool,labelKey:c["default"].PropTypes.string,matchPos:c["default"].PropTypes.string,matchProp:c["default"].PropTypes.string,menuBuffer:c["default"].PropTypes.number,menuContainerStyle:c["default"].PropTypes.object,menuRenderer:c["default"].PropTypes.func,menuStyle:c["default"].PropTypes.object,multi:c["default"].PropTypes.bool,name:c["default"].PropTypes.string,noResultsText:L,onBlur:c["default"].PropTypes.func,onBlurResetsInput:c["default"].PropTypes.bool,onChange:c["default"].PropTypes.func,onClose:c["default"].PropTypes.func,onCloseResetsInput:c["default"].PropTypes.bool,onFocus:c["default"].PropTypes.func,onInputChange:c["default"].PropTypes.func,onInputKeyDown:c["default"].PropTypes.func,onMenuScrollToBottom:c["default"].PropTypes.func,onOpen:c["default"].PropTypes.func,onValueClick:c["default"].PropTypes.func,openAfterFocus:c["default"].PropTypes.bool,openOnFocus:c["default"].PropTypes.bool,optionClassName:c["default"].PropTypes.string,optionComponent:c["default"].PropTypes.func,optionGroupComponent:c["default"].PropTypes.func,optionRenderer:c["default"].PropTypes.func,options:c["default"].PropTypes.array,pageSize:c["default"].PropTypes.number,placeholder:L,renderInvalidValues:c["default"].PropTypes.bool,required:c["default"].PropTypes.bool,resetValue:c["default"].PropTypes.any,scrollMenuIntoView:c["default"].PropTypes.bool,searchable:c["default"].PropTypes.bool,simpleValue:c["default"].PropTypes.bool,style:c["default"].PropTypes.object,tabIndex:c["default"].PropTypes.string,tabSelectsValue:c["default"].PropTypes.bool,value:c["default"].PropTypes.any,valueComponent:c["default"].PropTypes.func,valueKey:c["default"].PropTypes.string,valueRenderer:c["default"].PropTypes.func,wrapperStyle:c["default"].PropTypes.object},statics:{Async:D["default"],AsyncCreatable:R["default"],Creatable:M["default"]},getDefaultProps:function(){return{addLabelText:'Add "{label}"?',arrowRenderer:m["default"],autosize:!0,backspaceRemoves:!0,backspaceToRemoveMessage:"Press backspace to remove {label}",clearable:!0,clearAllText:"Clear all",clearRenderer:P["default"],clearValueText:"Clear value",deleteRemoves:!0,delimiter:",",disabled:!1,dropdownComponent:x["default"],escapeClearsValue:!0,filterOptions:O["default"],ignoreAccents:!0,ignoreCase:!0,inputProps:{},isLoading:!1,joinValues:!1,labelKey:"label",matchPos:"any",matchProp:"any",menuBuffer:0,menuRenderer:F["default"],multi:!1,noResultsText:"No results found",onBlurResetsInput:!0,onCloseResetsInput:!0,openAfterFocus:!1,optionComponent:N["default"],optionGroupComponent:K["default"],pageSize:5,placeholder:"Select...",renderInvalidValues:!1,required:!1,scrollMenuIntoView:!0,searchable:!0,simpleValue:!1,tabSelectsValue:!0,valueComponent:j["default"],valueKey:"value"}},getInitialState:function(){return{inputValue:"",isFocused:!1,isOpen:!1,isPseudoFocused:!1,required:!1}},componentWillMount:function(){this._flatOptions=this.flattenOptions(this.props.options),this._instancePrefix="react-select-"+(this.props.instanceId||++q)+"-";var e=this.getValueArray(this.props.value);this.props.required&&this.setState({required:this.handleRequired(e[0],this.props.multi)})},componentDidMount:function(){this.props.autofocus&&this.focus()},componentWillReceiveProps:function(e){e.options!==this.props.options&&(this._flatOptions=this.flattenOptions(e.options));var t=this.getValueArray(e.value,e);e.required&&this.setState({required:this.handleRequired(t[0],e.multi)})},componentWillUpdate:function(e,t){if(t.isOpen!==this.state.isOpen){this.toggleTouchOutsideEvent(t.isOpen);var u=t.isOpen?e.onOpen:e.onClose;u&&u()}},componentDidUpdate:function(e,t){if(this.menu&&this.focused&&this.state.isOpen&&!this.hasScrolledToOption){var u=h["default"].findDOMNode(this.focused),n=u.previousSibling,o=u.parentElement,s=h["default"].findDOMNode(this.menu);n?s.scrollTop=n.offsetTop:o&&"Select-menu"===o?s.scrollTop=o.offsetTop:s.scrollTop=u.offsetTop,this.hasScrolledToOption=!0}else this.state.isOpen||(this.hasScrolledToOption=!1);if(this._scrollToFocusedOptionOnUpdate&&this.focused&&this.menu){this._scrollToFocusedOptionOnUpdate=!1;var i=h["default"].findDOMNode(this.focused),r=h["default"].findDOMNode(this.menu),a=i.getBoundingClientRect(),l=r.getBoundingClientRect();(a.bottom>l.bottom||a.top<l.top)&&(r.scrollTop=i.offsetTop+i.clientHeight-r.offsetHeight)}if(this.props.scrollMenuIntoView&&this.menuContainer){var p=this.menuContainer.getBoundingClientRect();window.innerHeight<p.bottom+this.props.menuBuffer&&window.scrollBy(0,p.bottom+this.props.menuBuffer-window.innerHeight)}e.disabled!==this.props.disabled&&(this.setState({isFocused:!1}),this.closeMenu())},componentWillUnmount:function(){!document.removeEventListener&&document.detachEvent?document.detachEvent("ontouchstart",this.handleTouchOutside):document.removeEventListener("touchstart",this.handleTouchOutside)},toggleTouchOutsideEvent:function(e){e?!document.addEventListener&&document.attachEvent?document.attachEvent("ontouchstart",this.handleTouchOutside):document.addEventListener("touchstart",this.handleTouchOutside):!document.removeEventListener&&document.detachEvent?document.detachEvent("ontouchstart",this.handleTouchOutside):document.removeEventListener("touchstart",this.handleTouchOutside)},handleTouchOutside:function(e){this.wrapper&&!this.wrapper.contains(e.target)&&this.menuContainer&&!this.menuContainer.contains(e.target)&&this.closeMenu()},focus:function(){this.input&&(this.input.focus(),this.props.openAfterFocus&&this.setState({isOpen:!0}))},blurInput:function(){this.input&&this.input.blur()},handleTouchMove:function(e){this.dragging=!0},handleTouchStart:function(e){this.dragging=!1},handleTouchEnd:function(e){this.dragging||this.handleMouseDown(e)},handleTouchEndClearValue:function(e){this.dragging||this.clearValue(e)},handleMouseDown:function(e){if(!(this.props.disabled||"mousedown"===e.type&&0!==e.button)&&"INPUT"!==e.target.tagName){if(e.stopPropagation(),e.preventDefault(),!this.props.searchable)return this.focus(),this.setState({isOpen:!this.state.isOpen});if(this.state.isFocused){this.focus();var t=this.input;"function"==typeof t.getInput&&(t=t.getInput()),t.value="",this.setState({isOpen:!0,isPseudoFocused:!1})}else this._openAfterFocus=!0,this.focus()}},handleMouseDownOnArrow:function(e){this.props.disabled||"mousedown"===e.type&&0!==e.button||this.state.isOpen&&(e.stopPropagation(),e.preventDefault(),this.closeMenu())},handleMouseDownOnMenu:function(e){this.props.disabled||"mousedown"===e.type&&0!==e.button||(e.stopPropagation(),e.preventDefault(),this._openAfterFocus=!0,this.focus())},closeMenu:function(){this.props.onCloseResetsInput?this.setState({isOpen:!1,isPseudoFocused:this.state.isFocused&&!this.props.multi,inputValue:""}):this.setState({isOpen:!1,isPseudoFocused:this.state.isFocused&&!this.props.multi,inputValue:this.state.inputValue}),this.hasScrolledToOption=!1},handleInputFocus:function(e){if(!this.props.disabled){var t=this.state.isOpen||this._openAfterFocus||this.props.openOnFocus;this.props.onFocus&&this.props.onFocus(e),this.setState({isFocused:!0,isOpen:t}),this._openAfterFocus=!1}},handleInputBlur:function(e){if(this.menu&&(this.menu===document.activeElement||this.menu.contains(document.activeElement)))return void this.focus();this.props.onBlur&&this.props.onBlur(e);var t={isFocused:!1,isOpen:!1,isPseudoFocused:!1};this.props.onBlurResetsInput&&(t.inputValue=""),this.setState(t)},handleInputChange:function(e){var t=e.target.value;if(this.state.inputValue!==e.target.value&&this.props.onInputChange){var u=this.props.onInputChange(t);null!=u&&"object"!=typeof u&&(t=""+u)}this.setState({isOpen:!0,isPseudoFocused:!1,inputValue:t})},handleKeyDown:function(e){if(!(this.props.disabled||"function"==typeof this.props.onInputKeyDown&&(this.props.onInputKeyDown(e),e.defaultPrevented))){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.props.tabSelectsValue)return;return void this.selectFocusedOption();case 13:if(!this.state.isOpen)return;e.stopPropagation(),this.selectFocusedOption();break;case 27:this.state.isOpen?(this.closeMenu(),e.stopPropagation()):this.props.clearable&&this.props.escapeClearsValue&&(this.clearValue(e),e.stopPropagation());break;case 38:this.focusPreviousOption();break;case 40:this.focusNextOption();break;case 33:this.focusPageUpOption();break;case 34:this.focusPageDownOption();break;case 35:if(e.shiftKey)return;this.focusEndOption();break;case 36:if(e.shiftKey)return;this.focusStartOption();break;case 46:return void(!this.state.inputValue&&this.props.deleteRemoves&&(e.preventDefault(),this.popValue()));default:return}e.preventDefault()}},handleValueClick:function(e,t){this.props.onValueClick&&this.props.onValueClick(e,t)},handleMenuScroll:function(e){if(this.props.onMenuScrollToBottom){var t=e.target;t.scrollHeight>t.offsetHeight&&!(t.scrollHeight-t.offsetHeight-t.scrollTop)&&this.props.onMenuScrollToBottom()}},handleRequired:function(e,t){return!e||(t?0===e.length:0===Object.keys(e).length)},getOptionLabel:function(e){return e[this.props.labelKey]},getValueArray:function(e,t){var u=this,n="object"==typeof t?t:this.props;if(n.multi){if("string"==typeof e&&(e=e.split(n.delimiter)),!Array.isArray(e)){if(null===e||void 0===e)return[];e=[e]}return e.map(function(e){return u.expandValue(e,n)}).filter(function(e){return e})}var o=this.expandValue(e,n);return o?[o]:[]},expandValue:function(e,t){var u=typeof e;if("string"!==u&&"number"!==u&&"boolean"!==u)return e;var n=this.props,o=n.labelKey,s=n.valueKey,r=n.renderInvalidValues,a=this._flatOptions;if(a&&""!==e){for(var l=0;l<a.length;l++)if(a[l][s]===e)return a[l];if(r){var p;return U[e]=U[e]||(p={invalid:!0},i(p,o,e),i(p,s,e),p),U[e]}}},setValue:function(e){var t=this;if(this.props.autoBlur&&this.blurInput(),this.props.onChange){if(this.props.required){var u=this.handleRequired(e,this.props.multi);this.setState({required:u})}this.props.simpleValue&&e&&(e=this.props.multi?e.map(function(e){return e[t.props.valueKey]}).join(this.props.delimiter):e[this.props.valueKey]),this.props.onChange(e)}},selectValue:function(e){var t=this;this.hasScrolledToOption=!1,this.props.multi?this.setState({inputValue:"",focusedIndex:null},function(){t.addValue(e)}):this.setState({isOpen:!1,inputValue:"",isPseudoFocused:this.state.isFocused},function(){t.setValue(e)})},addValue:function(e){var t=this.getValueArray(this.props.value),u=this._visibleOptions.filter(function(e){return!e.disabled}),n=u.indexOf(e);this.setValue(t.concat(e)),u.length-1===n?this.focusOption(u[n-1]):u.length>n&&this.focusOption(u[n+1])},popValue:function(){var e=this.getValueArray(this.props.value);e.length&&e[e.length-1].clearableValue!==!1&&this.setValue(e.slice(0,e.length-1))},removeValue:function(e){var t=this.getValueArray(this.props.value);this.setValue(t.filter(function(t){return t!==e}))},clearValue:function(e){e&&"mousedown"===e.type&&0!==e.button||(e.stopPropagation(),e.preventDefault(),this.setValue(this.getResetValue()),this.setState({isOpen:!1,inputValue:""},this.focus))},getResetValue:function(){return void 0!==this.props.resetValue?this.props.resetValue:this.props.multi?[]:null},focusOption:function(e){this.setState({focusedOption:e})},focusNextOption:function(){this.focusAdjacentOption("next")},focusPreviousOption:function(){this.focusAdjacentOption("previous")},focusPageUpOption:function(){this.focusAdjacentOption("page_up")},focusPageDownOption:function(){this.focusAdjacentOption("page_down")},focusStartOption:function(){this.focusAdjacentOption("start")},focusEndOption:function(){this.focusAdjacentOption("end")},focusAdjacentOption:function(e){var t=this._visibleOptions.map(function(e,t){return{option:e,index:t}}).filter(function(e){return!e.option.disabled});if(this._scrollToFocusedOptionOnUpdate=!0,!this.state.isOpen)return void this.setState({isOpen:!0,inputValue:"",focusedOption:this._focusedOption||(t.length?t["next"===e?0:t.length-1].option:null)});if(t.length){for(var u=-1,n=0;n<t.length;n++)if(this._focusedOption===t[n].option){u=n;break}if("next"===e&&u!==-1)u=(u+1)%t.length;else if("previous"===e)u>0?u-=1:u=t.length-1;else if("start"===e)u=0;else if("end"===e)u=t.length-1;else if("page_up"===e){var o=u-this.props.pageSize;u=o<0?0:o}else if("page_down"===e){var o=u+this.props.pageSize;u=o>t.length-1?t.length-1:o}u===-1&&(u=0),this.setState({focusedIndex:t[u].index,focusedOption:t[u].option})}},getFocusedOption:function(){return this._focusedOption},getInputValue:function(){return this.state.inputValue},selectFocusedOption:function(){if(this._focusedOption)return this.selectValue(this._focusedOption)},renderLoading:function(){if(this.props.isLoading)return c["default"].createElement("span",{className:"Select-loading-zone","aria-hidden":"true"},c["default"].createElement("span",{className:"Select-loading"}))},renderValue:function(e,t){var u=this,n=this.props.valueRenderer||this.getOptionLabel,o=this.props.valueComponent;if(!e.length)return this.state.inputValue?null:c["default"].createElement("div",{className:"Select-placeholder"},this.props.placeholder);var s=this.props.onValueClick?this.handleValueClick:null;return this.props.multi?e.map(function(e,t){return c["default"].createElement(o,{id:u._instancePrefix+"-value-"+t,instancePrefix:u._instancePrefix,disabled:u.props.disabled||e.clearableValue===!1,key:"value-"+t+"-"+e[u.props.valueKey],onClick:s,onRemove:u.removeValue,value:e},n(e,t),c["default"].createElement("span",{className:"Select-aria-only"}," "))}):this.state.inputValue?void 0:(t&&(s=null),c["default"].createElement(o,{id:this._instancePrefix+"-value-item",disabled:this.props.disabled,instancePrefix:this._instancePrefix,onClick:s,value:e[0]},n(e[0])))},renderInput:function(e,t){
var u,n=this,o=(0,v["default"])("Select-input",this.props.inputProps.className),r=!!this.state.isOpen,a=(0,v["default"])((u={},i(u,this._instancePrefix+"-list",r),i(u,this._instancePrefix+"-backspace-remove-message",this.props.multi&&!this.props.disabled&&this.state.isFocused&&!this.state.inputValue),u)),l=p({},this.props.inputProps,{role:"combobox","aria-expanded":""+r,"aria-owns":a,"aria-haspopup":""+r,"aria-activedescendant":r?this._instancePrefix+"-option-"+t:this._instancePrefix+"-value","aria-labelledby":this.props["aria-labelledby"],"aria-label":this.props["aria-label"],className:o,tabIndex:this.props.tabIndex,onBlur:this.handleInputBlur,onChange:this.handleInputChange,onFocus:this.handleInputFocus,ref:function(e){return n.input=e},required:this.state.required,value:this.state.inputValue});if(this.props.inputRenderer)return this.props.inputRenderer(l);if(this.props.disabled||!this.props.searchable){var d=this.props.inputProps,f=(d.inputClassName,s(d,["inputClassName"]));return c["default"].createElement("div",p({},f,{role:"combobox","aria-expanded":r,"aria-owns":r?this._instancePrefix+"-list":this._instancePrefix+"-value","aria-activedescendant":r?this._instancePrefix+"-option-"+t:this._instancePrefix+"-value",className:o,tabIndex:this.props.tabIndex||0,onBlur:this.handleInputBlur,onFocus:this.handleInputFocus,ref:function(e){return n.input=e},"aria-readonly":""+!!this.props.disabled,style:{border:0,width:1,display:"inline-block"}}))}return this.props.autosize?c["default"].createElement(y["default"],p({},l,{minWidth:"5"})):c["default"].createElement("div",{className:o},c["default"].createElement("input",l))},renderClear:function(){if(this.props.clearable&&this.props.value&&0!==this.props.value&&(!this.props.multi||this.props.value.length)&&!this.props.disabled&&!this.props.isLoading){var e=this.props.clearRenderer();return c["default"].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,onTouchStart:this.handleTouchStart,onTouchMove:this.handleTouchMove,onTouchEnd:this.handleTouchEndClearValue},e)}},renderArrow:function(){var e=this.handleMouseDownOnArrow,t=this.state.isOpen,u=this.props.arrowRenderer({onMouseDown:e,isOpen:t});return c["default"].createElement("span",{className:"Select-arrow-zone",onMouseDown:e},u)},filterFlatOptions:function(e){var t=this.state.inputValue,u=this._flatOptions;if(this.props.filterOptions){var n="function"==typeof this.props.filterOptions?this.props.filterOptions:O["default"];return n(u,t,e,{filterOption:this.props.filterOption,ignoreAccents:this.props.ignoreAccents,ignoreCase:this.props.ignoreCase,labelKey:this.props.labelKey,matchPos:this.props.matchPos,matchProp:this.props.matchProp,valueKey:this.props.valueKey})}return u},flattenOptions:function(e,t){if(!e)return[];for(var u=[],n=0;n<e.length;n++){var o=r(e[n]);o.isInTree=!1,t&&(o.group=t),a(o)?(u=u.concat(this.flattenOptions(o.options,o)),o.options=[]):u.push(o)}return u},unflattenOptions:function(e){var t=[],u=void 0,n=void 0;return e.forEach(function(e){for(e.isInTree=!1,u=e.group;u;)u.isInTree&&(u.options=[],u.isInTree=!1),u=u.group}),e.forEach(function(e){for(n=e,u=n.group;u;)n.isInTree||(u.options.push(n),n.isInTree=!0),n=u,u=n.group;n.isInTree||(t.push(n),n.isInTree=!0)}),t},onOptionRef:function(e,t){t&&(this.focused=e)},onOptionRef:function(e,t){t&&(this.focused=e)},renderMenu:function(e,t,u){return e&&e.length?this.props.menuRenderer({focusedOption:u,focusOption:this.focusOption,instancePrefix:this._instancePrefix,labelKey:this.props.labelKey,onFocus:this.focusOption,onOptionRef:this.onOptionRef,onSelect:this.selectValue,optionClassName:this.props.optionClassName,optionComponent:this.props.optionComponent,optionGroupComponent:this.props.optionGroupComponent,optionRenderer:this.props.optionRenderer||this.getOptionLabel,options:e,selectValue:this.selectValue,valueArray:t,valueKey:this.props.valueKey,onOptionRef:this.onOptionRef}):this.props.noResultsText?c["default"].createElement("div",{className:"Select-noresults"},this.props.noResultsText):null},renderHiddenField:function(e){var t=this;if(this.props.name){if(this.props.joinValues){var u=e.map(function(e){return l(e[t.props.valueKey])}).join(this.props.delimiter);return c["default"].createElement("input",{type:"hidden",ref:function(e){return t.value=e},name:this.props.name,value:u,disabled:this.props.disabled})}return e.map(function(e,u){return c["default"].createElement("input",{key:"hidden."+u,type:"hidden",ref:"value"+u,name:t.props.name,value:l(e[t.props.valueKey]),disabled:t.props.disabled})})}},getFocusableOptionIndex:function(e){var t=this._visibleOptions;if(!t.length)return null;var u=this.state.focusedOption||e;if(u&&!u.disabled){var n=t.indexOf(u);if(n!==-1)return n}for(var o=0;o<t.length;o++)if(!t[o].disabled)return o;return null},renderOuter:function(e,t,u){var n=this,o=this.props.dropdownComponent,s=this.renderMenu(e,t,u);return s?c["default"].createElement(o,null,c["default"].createElement("div",{ref:function(e){return n.menuContainer=e},className:"Select-menu-outer",style:this.props.menuContainerStyle},c["default"].createElement("div",{ref:function(e){return n.menu=e},role:"listbox",className:"Select-menu",id:this._instancePrefix+"-list",style:this.props.menuStyle,onScroll:this.handleMenuScroll,onMouseDown:this.handleMouseDownOnMenu},s))):null},render:function(){var e=this,t=this.getValueArray(this.props.value);this._visibleOptions=this.filterFlatOptions(this.props.multi?t:null);var u=this.unflattenOptions(this._visibleOptions),n="boolean"==typeof this.props.isOpen?this.props.isOpen:this.state.isOpen;this.props.multi&&!u.length&&t.length&&!this.state.inputValue&&(n=!1);var o=this.getFocusableOptionIndex(t[0]),s=null;s=null!==o?this._focusedOption=this._visibleOptions[o]:this._focusedOption=null;var i=(0,v["default"])("Select",this.props.className,{"Select--multi":this.props.multi,"Select--single":!this.props.multi,"is-disabled":this.props.disabled,"is-focused":this.state.isFocused,"is-loading":this.props.isLoading,"is-open":n,"is-pseudo-focused":this.state.isPseudoFocused,"is-searchable":this.props.searchable,"has-value":t.length}),r=null;return this.props.multi&&!this.props.disabled&&t.length&&!this.state.inputValue&&this.state.isFocused&&this.props.backspaceRemoves&&(r=c["default"].createElement("span",{id:this._instancePrefix+"-backspace-remove-message",className:"Select-aria-only","aria-live":"assertive"},this.props.backspaceToRemoveMessage.replace("{label}",t[t.length-1][this.props.labelKey]))),c["default"].createElement("div",{ref:function(t){return e.wrapper=t},className:i,style:this.props.wrapperStyle},this.renderHiddenField(t),c["default"].createElement("div",{ref:function(t){return e.control=t},className:"Select-control",style:this.props.style,onKeyDown:this.handleKeyDown,onMouseDown:this.handleMouseDown,onTouchEnd:this.handleTouchEnd,onTouchStart:this.handleTouchStart,onTouchMove:this.handleTouchMove},c["default"].createElement("span",{className:"Select-multi-value-wrapper",id:this._instancePrefix+"-value"},this.renderValue(t,n),this.renderInput(t,o)),r,this.renderLoading(),this.renderClear(),this.renderArrow()),n?this.renderOuter(u,this.props.multi?null:t,s):null)}});u["default"]=z,t.exports=u["default"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./Async":1,"./AsyncCreatable":2,"./Creatable":3,"./Dropdown":4,"./Option":5,"./OptionGroup":6,"./Value":8,"./utils/defaultArrowRenderer":9,"./utils/defaultClearRenderer":10,"./utils/defaultFilterOptions":11,"./utils/defaultMenuRenderer":12}],8:[function(e,t,u){(function(e){"use strict";function u(e){return e&&e.__esModule?e:{"default":e}}var n="undefined"!=typeof window?window.React:"undefined"!=typeof e?e.React:null,o=u(n),s="undefined"!=typeof window?window.classNames:"undefined"!=typeof e?e.classNames:null,i=u(s),r=o["default"].createClass({displayName:"Value",propTypes:{children:o["default"].PropTypes.node,disabled:o["default"].PropTypes.bool,id:o["default"].PropTypes.string,onClick:o["default"].PropTypes.func,onRemove:o["default"].PropTypes.func,value:o["default"].PropTypes.object.isRequired},handleMouseDown:function(e){if("mousedown"!==e.type||0===e.button)return this.props.onClick?(e.stopPropagation(),void this.props.onClick(this.props.value,e)):void(this.props.value.href&&e.stopPropagation())},onRemove:function(e){e.preventDefault(),e.stopPropagation(),this.props.onRemove(this.props.value)},handleTouchEndRemove:function(e){this.dragging||this.onRemove(e)},handleTouchMove:function(e){this.dragging=!0},handleTouchStart:function(e){this.dragging=!1},renderRemoveIcon:function(){if(!this.props.disabled&&this.props.onRemove)return o["default"].createElement("span",{className:"Select-value-icon","aria-hidden":"true",onMouseDown:this.onRemove,onTouchEnd:this.handleTouchEndRemove,onTouchStart:this.handleTouchStart,onTouchMove:this.handleTouchMove},"×")},renderLabel:function(){var e="Select-value-label";return this.props.onClick||this.props.value.href?o["default"].createElement("a",{className:e,href:this.props.value.href,target:this.props.value.target,onMouseDown:this.handleMouseDown,onTouchEnd:this.handleMouseDown},this.props.children):o["default"].createElement("span",{className:e,role:"option","aria-selected":"true",id:this.props.id},this.props.children)},render:function(){return o["default"].createElement("div",{className:(0,i["default"])("Select-value",this.props.value.className),style:this.props.value.style,title:this.props.value.title},this.renderRemoveIcon(),this.renderLabel())}});t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],9:[function(e,t,u){(function(e){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.onMouseDown;return i["default"].createElement("span",{className:"Select-arrow",onMouseDown:t})}Object.defineProperty(u,"__esModule",{value:!0}),u["default"]=o;var s="undefined"!=typeof window?window.React:"undefined"!=typeof e?e.React:null,i=n(s);t.exports=u["default"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],10:[function(e,t,u){(function(e){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(){return i["default"].createElement("span",{className:"Select-clear",dangerouslySetInnerHTML:{__html:"&times;"}})}Object.defineProperty(u,"__esModule",{value:!0}),u["default"]=o;var s="undefined"!=typeof window?window.React:"undefined"!=typeof e?e.React:null,i=n(s);t.exports=u["default"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],11:[function(e,t,u){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,u,n){var o=this;return n.ignoreAccents&&(t=(0,i["default"])(t)),n.ignoreCase&&(t=t.toLowerCase()),u&&(u=u.map(function(e){return e[n.valueKey]})),e.filter(function(e){if(u&&u.indexOf(e[n.valueKey])>-1)return!1;if(n.filterOption)return n.filterOption.call(o,e,t);if(!t)return!0;var s=String(e[n.valueKey]),r=String(e[n.labelKey]);return n.ignoreAccents&&("label"!==n.matchProp&&(s=(0,i["default"])(s)),"value"!==n.matchProp&&(r=(0,i["default"])(r))),n.ignoreCase&&("label"!==n.matchProp&&(s=s.toLowerCase()),"value"!==n.matchProp&&(r=r.toLowerCase())),"start"===n.matchPos?"label"!==n.matchProp&&s.substr(0,t.length)===t||"value"!==n.matchProp&&r.substr(0,t.length)===t:"label"!==n.matchProp&&s.indexOf(t)>=0||"value"!==n.matchProp&&r.indexOf(t)>=0})}var s=e("./stripDiacritics"),i=n(s);t.exports=o},{"./stripDiacritics":13}],12:[function(e,t,u){(function(e){"use strict";function u(e){return e&&e.__esModule?e:{"default":e}}function n(e){return e&&Array.isArray(e.options)}function o(e){var t=e.focusedOption,u=e.instancePrefix,o=(e.labelKey,e.onFocus),s=e.onOptionRef,r=e.onSelect,l=e.optionClassName,p=e.optionComponent,d=e.optionGroupComponent,c=e.optionRenderer,f=e.options,h=e.valueArray,E=e.valueKey,y=d,g=p,v=c||this.getOptionLabel,b=function m(e){return e.map(function(e,p){if(n(e)){var d=(0,i["default"])({"Select-option-group":!0});return a["default"].createElement(y,{className:d,key:"option-group-"+p,label:v(e),option:e,optionIndex:p},m(e.options))}var c=function(){var n=h&&h.indexOf(e)>-1,d=e===t,c=(0,i["default"])(l,{"Select-option":!0,"is-selected":n,"is-focused":d,"is-disabled":e.disabled});return{v:a["default"].createElement(g,{className:c,instancePrefix:u,isDisabled:e.disabled,isFocused:d,isSelected:n,key:"option-"+p+"-"+e[E],onFocus:o,onSelect:r,option:e,optionIndex:p,ref:function(e){s(e,d)}},v(e,p))}}();if("object"==typeof c)return c.v})};return b(f)}var s="undefined"!=typeof window?window.classNames:"undefined"!=typeof e?e.classNames:null,i=u(s),r="undefined"!=typeof window?window.React:"undefined"!=typeof e?e.React:null,a=u(r);t.exports=o}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],13:[function(e,t,u){"use strict";var n=[{base:"A",letters:/[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g},{base:"AA",letters:/[\uA732]/g},{base:"AE",letters:/[\u00C6\u01FC\u01E2]/g},{base:"AO",letters:/[\uA734]/g},{base:"AU",letters:/[\uA736]/g},{base:"AV",letters:/[\uA738\uA73A]/g},{base:"AY",letters:/[\uA73C]/g},{base:"B",letters:/[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g},{base:"C",letters:/[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g},{base:"D",letters:/[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g},{base:"DZ",letters:/[\u01F1\u01C4]/g},{base:"Dz",letters:/[\u01F2\u01C5]/g},{base:"E",letters:/[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g},{base:"F",letters:/[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g},{base:"G",letters:/[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g},{base:"H",letters:/[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g},{base:"I",letters:/[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g},{base:"J",letters:/[\u004A\u24BF\uFF2A\u0134\u0248]/g},{base:"K",letters:/[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g},{base:"L",letters:/[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g},{base:"LJ",letters:/[\u01C7]/g},{base:"Lj",letters:/[\u01C8]/g},{base:"M",letters:/[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g},{base:"N",letters:/[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g},{base:"NJ",letters:/[\u01CA]/g},{base:"Nj",letters:/[\u01CB]/g},{base:"O",letters:/[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g},{base:"OI",letters:/[\u01A2]/g},{base:"OO",letters:/[\uA74E]/g},{base:"OU",letters:/[\u0222]/g},{base:"P",letters:/[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g},{base:"Q",letters:/[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g},{base:"R",letters:/[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g},{base:"S",letters:/[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g},{base:"T",letters:/[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g},{base:"TZ",letters:/[\uA728]/g},{base:"U",letters:/[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g},{base:"V",letters:/[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g},{base:"VY",letters:/[\uA760]/g},{base:"W",letters:/[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g},{base:"X",letters:/[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g},{base:"Y",letters:/[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g},{base:"Z",letters:/[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g},{base:"a",letters:/[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g},{base:"aa",letters:/[\uA733]/g},{base:"ae",letters:/[\u00E6\u01FD\u01E3]/g},{base:"ao",letters:/[\uA735]/g},{base:"au",letters:/[\uA737]/g},{base:"av",letters:/[\uA739\uA73B]/g},{base:"ay",letters:/[\uA73D]/g},{base:"b",letters:/[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g},{base:"c",letters:/[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g},{base:"d",letters:/[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g},{base:"dz",letters:/[\u01F3\u01C6]/g},{base:"e",letters:/[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g},{base:"f",letters:/[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g},{base:"g",letters:/[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g},{base:"h",letters:/[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g},{base:"hv",letters:/[\u0195]/g},{base:"i",letters:/[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g},{base:"j",letters:/[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g},{base:"k",letters:/[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g},{base:"l",letters:/[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g},{base:"lj",letters:/[\u01C9]/g},{base:"m",letters:/[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g},{base:"n",letters:/[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g},{base:"nj",letters:/[\u01CC]/g},{base:"o",letters:/[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g},{base:"oi",letters:/[\u01A3]/g},{base:"ou",letters:/[\u0223]/g},{base:"oo",letters:/[\uA74F]/g},{base:"p",letters:/[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g},{base:"q",letters:/[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g},{base:"r",letters:/[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g},{base:"s",letters:/[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g},{base:"t",letters:/[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g},{base:"tz",letters:/[\uA729]/g},{base:"u",letters:/[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g},{base:"v",letters:/[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g},{base:"vy",letters:/[\uA761]/g},{base:"w",letters:/[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g},{base:"x",letters:/[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g},{base:"y",letters:/[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g},{base:"z",letters:/[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g}];t.exports=function(e){for(var t=0;t<n.length;t++)e=e.replace(n[t].letters,n[t].base);return e}},{}]},{},[7])(7)});

@@ -15,2 +15,3 @@ /* eslint react/prop-types: 0 */

import NumericSelect from './components/NumericSelect';
import BooleanSelect from './components/BooleanSelect';
import Virtualized from './components/Virtualized';

@@ -27,2 +28,3 @@ import States from './components/States';

<NumericSelect label="Numeric Values" />
<BooleanSelect label="Boolean Values" />
<GroupedOptionsField label="Option Groups" />

@@ -29,0 +31,0 @@ <CustomRender label="Custom Render Methods"/>

@@ -15,3 +15,5 @@ import React from 'react';

this.setState({ value });
console.log('Support level selected:', value.label);
if (value) {
console.log('Support level selected:', value.label);
}
},

@@ -18,0 +20,0 @@ renderLink: function() {

@@ -13,2 +13,3 @@ import React from 'react';

return {
backspaceRemoves: true,
multi: true

@@ -35,7 +36,11 @@ };

getUsers (input) {
if (!input) {
return Promise.resolve({ options: [] });
}
return fetch(`https://api.github.com/search/users?q=${input}`)
.then((response) => response.json())
.then((json) => {
return { options: json.items };
});
.then((response) => response.json())
.then((json) => {
return { options: json.items };
});
},

@@ -45,2 +50,7 @@ gotoUser (value, event) {

},
toggleBackspaceRemoves () {
this.setState({
backspaceRemoves: !this.state.backspaceRemoves
});
},
toggleCreatable () {

@@ -59,3 +69,3 @@ this.setState({

<h3 className="section-heading">{this.props.label}</h3>
<AsyncComponent multi={this.state.multi} value={this.state.value} onChange={this.onChange} onValueClick={this.gotoUser} valueKey="id" labelKey="login" loadOptions={this.getUsers} minimumInput={1} backspaceRemoves={false} />
<AsyncComponent multi={this.state.multi} value={this.state.value} onChange={this.onChange} onValueClick={this.gotoUser} valueKey="id" labelKey="login" loadOptions={this.getUsers} backspaceRemoves={this.state.backspaceRemoves} />
<div className="checkbox-list">

@@ -76,2 +86,6 @@ <label className="checkbox">

</label>
<label className="checkbox">
<input type="checkbox" className="checkbox-control" checked={this.state.backspaceRemoves} onChange={this.toggleBackspaceRemoves} />
<span className="checkbox-label">Backspace Removes?</span>
</label>
</div>

@@ -78,0 +92,0 @@ <div className="hint">This example uses fetch.js for showing Async options with Promises</div>

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

## v1.0.0-beta14.patch1 / 2016-07-25
* (react-select-plus) On dropdown open, scroll to element above focused option
instead of scrolling all the way to the top of the option group.
## v1.0.0-rc / 2016-09-04

@@ -18,2 +13,7 @@

## v1.0.0-beta14.patch1 / 2016-07-25
* (react-select-plus) On dropdown open, scroll to element above focused option
instead of scrolling all the way to the top of the option group.
## v1.0.0-beta14 / 2016-07-17

@@ -20,0 +20,0 @@

'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
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; };
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _react = require('react');

@@ -21,182 +33,234 @@

var requestId = 0;
var propTypes = {
autoload: _react2['default'].PropTypes.bool.isRequired, // automatically call the `loadOptions` prop on-mount; defaults to true
cache: _react2['default'].PropTypes.any, // object to use to cache results; set to null/false to disable caching
children: _react2['default'].PropTypes.func.isRequired, // Child function responsible for creating the inner Select component; (props: Object): PropTypes.element
ignoreAccents: _react2['default'].PropTypes.bool, // strip diacritics when filtering; defaults to true
ignoreCase: _react2['default'].PropTypes.bool, // perform case-insensitive filtering; defaults to true
loadingPlaceholder: _react2['default'].PropTypes.oneOfType([// replaces the placeholder while options are loading
_react2['default'].PropTypes.string, _react2['default'].PropTypes.node]),
loadOptions: _react2['default'].PropTypes.func.isRequired, // callback to load options asynchronously; (inputValue: string, callback: Function): ?Promise
options: _react.PropTypes.array.isRequired, // array of options
placeholder: _react2['default'].PropTypes.oneOfType([// field placeholder, displayed when there's no value (shared with Select)
_react2['default'].PropTypes.string, _react2['default'].PropTypes.node]),
noResultsText: _react2['default'].PropTypes.oneOfType([// field noResultsText, displayed when no options come back from the server
_react2['default'].PropTypes.string, _react2['default'].PropTypes.node]),
onChange: _react2['default'].PropTypes.func, // onChange handler: function (newValue) {}
searchPromptText: _react2['default'].PropTypes.oneOfType([// label to prompt for search input
_react2['default'].PropTypes.string, _react2['default'].PropTypes.node]),
onInputChange: _react2['default'].PropTypes.func, // optional for keeping track of what is being typed
value: _react2['default'].PropTypes.any };
function initCache(cache) {
if (cache && typeof cache !== 'object') {
cache = {};
}
return cache ? cache : null;
}
// initial field value
var defaultCache = {};
function updateCache(cache, input, data) {
if (!cache) return;
cache[input] = data;
}
var defaultProps = {
autoload: true,
cache: defaultCache,
children: defaultChildren,
ignoreAccents: true,
ignoreCase: true,
loadingPlaceholder: 'Loading...',
options: [],
searchPromptText: 'Type to search'
};
function getFromCache(cache, input) {
if (!cache) return;
for (var i = input.length; i >= 0; --i) {
var cacheKey = input.slice(0, i);
if (cache[cacheKey] && (input === cacheKey || cache[cacheKey].complete)) {
return cache[cacheKey];
}
}
}
var Async = (function (_Component) {
_inherits(Async, _Component);
function thenPromise(promise, callback) {
if (!promise || typeof promise.then !== 'function') return;
return promise.then(function (data) {
callback(null, data);
}, function (err) {
callback(err);
});
}
function Async(props, context) {
_classCallCheck(this, Async);
var stringOrNode = _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.string, _react2['default'].PropTypes.node]);
_get(Object.getPrototypeOf(Async.prototype), 'constructor', this).call(this, props, context);
var Async = _react2['default'].createClass({
displayName: 'Async',
this._cache = props.cache === defaultCache ? {} : props.cache;
propTypes: {
cache: _react2['default'].PropTypes.any, // object to use to cache results, can be null to disable cache
children: _react2['default'].PropTypes.func, // Child function responsible for creating the inner Select component; (props: Object): PropTypes.element
ignoreAccents: _react2['default'].PropTypes.bool, // whether to strip diacritics when filtering (shared with Select)
ignoreCase: _react2['default'].PropTypes.bool, // whether to perform case-insensitive filtering (shared with Select)
isLoading: _react2['default'].PropTypes.bool, // overrides the isLoading state when set to true
loadOptions: _react2['default'].PropTypes.func.isRequired, // function to call to load options asynchronously
loadingPlaceholder: _react2['default'].PropTypes.string, // replaces the placeholder while options are loading
minimumInput: _react2['default'].PropTypes.number, // the minimum number of characters that trigger loadOptions
noResultsText: stringOrNode, // placeholder displayed when there are no matching search results (shared with Select)
onInputChange: _react2['default'].PropTypes.func, // onInputChange handler: function (inputValue) {}
placeholder: stringOrNode, // field placeholder, displayed when there's no value (shared with Select)
searchPromptText: stringOrNode, // label to prompt for search input
searchingText: _react2['default'].PropTypes.string },
// message to display while options are loading
getDefaultProps: function getDefaultProps() {
return {
cache: true,
ignoreAccents: true,
ignoreCase: true,
loadingPlaceholder: 'Loading...',
minimumInput: 0,
searchingText: 'Searching...',
searchPromptText: 'Type to search'
};
},
getInitialState: function getInitialState() {
return {
cache: initCache(this.props.cache),
this.state = {
isLoading: false,
options: []
options: props.options
};
},
componentWillMount: function componentWillMount() {
this._lastInput = '';
},
componentDidMount: function componentDidMount() {
this.loadOptions('');
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
if (nextProps.cache !== this.props.cache) {
this.setState({
cache: initCache(nextProps.cache)
this._onInputChange = this._onInputChange.bind(this);
}
_createClass(Async, [{
key: 'componentDidMount',
value: function componentDidMount() {
var autoload = this.props.autoload;
if (autoload) {
this.loadOptions('');
}
}
}, {
key: 'componentWillUpdate',
value: function componentWillUpdate(nextProps, nextState) {
var _this = this;
var propertiesToSync = ['options'];
propertiesToSync.forEach(function (prop) {
if (_this.props[prop] !== nextProps[prop]) {
_this.setState(_defineProperty({}, prop, nextProps[prop]));
}
});
}
},
focus: function focus() {
this.select.focus();
},
resetState: function resetState() {
this._currentRequestId = -1;
this.setState({
isLoading: false,
options: []
});
},
getResponseHandler: function getResponseHandler(input) {
var _this = this;
}, {
key: 'clearOptions',
value: function clearOptions() {
this.setState({ options: [] });
}
}, {
key: 'loadOptions',
value: function loadOptions(inputValue) {
var _this2 = this;
var _requestId = this._currentRequestId = requestId++;
return function (err, data) {
if (err) throw err;
if (!_this.isMounted()) return;
updateCache(_this.state.cache, input, data);
if (_requestId !== _this._currentRequestId) return;
_this.setState({
isLoading: false,
options: data && data.options || []
});
};
},
loadOptions: function loadOptions(input) {
if (this.props.onInputChange) {
var nextState = this.props.onInputChange(input);
// Note: != used deliberately here to catch undefined and null
if (nextState != null) {
input = '' + nextState;
var loadOptions = this.props.loadOptions;
var cache = this._cache;
if (cache && cache.hasOwnProperty(inputValue)) {
this.setState({
options: cache[inputValue]
});
return;
}
var callback = function callback(error, data) {
if (callback === _this2._callback) {
_this2._callback = null;
var options = data && data.options || [];
if (cache) {
cache[inputValue] = options;
}
_this2.setState({
isLoading: false,
options: options
});
}
};
// Ignore all but the most recent request
this._callback = callback;
var promise = loadOptions(inputValue, callback);
if (promise) {
promise.then(function (data) {
return callback(null, data);
}, function (error) {
return callback(error);
});
}
if (this._callback && !this.state.isLoading) {
this.setState({
isLoading: true
});
}
return inputValue;
}
if (this.props.ignoreAccents) input = (0, _utilsStripDiacritics2['default'])(input);
if (this.props.ignoreCase) input = input.toLowerCase();
}, {
key: '_onInputChange',
value: function _onInputChange(inputValue) {
var _props = this.props;
var ignoreAccents = _props.ignoreAccents;
var ignoreCase = _props.ignoreCase;
var onInputChange = _props.onInputChange;
this._lastInput = input;
if (input.length < this.props.minimumInput) {
return this.resetState();
if (ignoreAccents) {
inputValue = (0, _utilsStripDiacritics2['default'])(inputValue);
}
if (ignoreCase) {
inputValue = inputValue.toLowerCase();
}
if (onInputChange) {
onInputChange(inputValue);
}
return this.loadOptions(inputValue);
}
var cacheResult = getFromCache(this.state.cache, input);
if (cacheResult && Array.isArray(cacheResult.options)) {
return this.setState({
options: cacheResult.options
});
}, {
key: 'inputValue',
value: function inputValue() {
if (this.select) {
return this.select.state.inputValue;
}
return '';
}
this.setState({
isLoading: true
});
var responseHandler = this.getResponseHandler(input);
var inputPromise = thenPromise(this.props.loadOptions(input, responseHandler), responseHandler);
return inputPromise ? inputPromise.then(function () {
return input;
}) : input;
},
render: function render() {
var _this2 = this;
}, {
key: 'noResultsText',
value: function noResultsText() {
var _props2 = this.props;
var loadingPlaceholder = _props2.loadingPlaceholder;
var noResultsText = _props2.noResultsText;
var searchPromptText = _props2.searchPromptText;
var isLoading = this.state.isLoading;
var _props = this.props;
var _props$children = _props.children;
var children = _props$children === undefined ? defaultChildren : _props$children;
var noResultsText = _props.noResultsText;
var inputValue = this.inputValue();
var restProps = _objectWithoutProperties(_props, ['children', 'noResultsText']);
if (isLoading) {
return loadingPlaceholder;
}
if (inputValue && noResultsText) {
return noResultsText;
}
return searchPromptText;
}
}, {
key: 'focus',
value: function focus() {
this.select.focus();
}
}, {
key: 'render',
value: function render() {
var _this3 = this;
var _state = this.state;
var isLoading = _state.isLoading;
var options = _state.options;
var _props3 = this.props;
var children = _props3.children;
var loadingPlaceholder = _props3.loadingPlaceholder;
var placeholder = _props3.placeholder;
var _state = this.state;
var isLoading = _state.isLoading;
var options = _state.options;
if (this.props.isLoading) isLoading = true;
var placeholder = isLoading ? this.props.loadingPlaceholder : this.props.placeholder;
if (isLoading) {
noResultsText = this.props.searchingText;
} else if (!options.length && this._lastInput.length < this.props.minimumInput) {
noResultsText = this.props.searchPromptText;
var props = {
noResultsText: this.noResultsText(),
placeholder: isLoading ? loadingPlaceholder : placeholder,
options: isLoading && loadingPlaceholder ? [] : options,
ref: function ref(_ref) {
return _this3.select = _ref;
},
onChange: function onChange(newValues) {
if (_this3.props.multi && _this3.props.value && newValues.length > _this3.props.value.length) {
_this3.clearOptions();
}
_this3.props.onChange(newValues);
}
};
return children(_extends({}, this.props, props, {
isLoading: isLoading,
onInputChange: this._onInputChange
}));
}
}]);
var props = _extends({}, restProps, {
isLoading: isLoading,
noResultsText: noResultsText,
onInputChange: this.loadOptions,
options: options,
placeholder: placeholder,
ref: function ref(_ref) {
_this2.select = _ref;
}
});
return Async;
})(_react.Component);
return children(props);
}
});
exports['default'] = Async;
Async.propTypes = propTypes;
Async.defaultProps = defaultProps;
function defaultChildren(props) {
return _react2['default'].createElement(_Select2['default'], props);
};
module.exports = Async;
module.exports = exports['default'];

@@ -15,2 +15,12 @@ 'use strict';

function reduce(obj) {
var props = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
return Object.keys(obj).reduce(function (props, key) {
var value = obj[key];
if (value !== undefined) props[key] = value;
return props;
}, props);
}
var AsyncCreatable = _react2['default'].createClass({

@@ -30,3 +40,3 @@ displayName: 'AsyncCreatableSelect',

function (creatableProps) {
return _react2['default'].createElement(_Select2['default'], _extends({}, asyncProps, creatableProps, {
return _react2['default'].createElement(_Select2['default'], _extends({}, reduce(asyncProps, reduce(creatableProps, {})), {
onInputChange: function (input) {

@@ -33,0 +43,0 @@ creatableProps.onInputChange(input);

@@ -53,2 +53,11 @@ 'use strict';

// input change handler: function (inputValue) {}
onInputChange: _react2['default'].PropTypes.func,
// input keyDown handler: function (event) {}
onInputKeyDown: _react2['default'].PropTypes.func,
// new option click handler: function (option) {}
onNewOptionClick: _react2['default'].PropTypes.func,
// See Select.propTypes.options

@@ -90,2 +99,3 @@ options: _react2['default'].PropTypes.array,

var newOptionCreator = _props.newOptionCreator;
var onNewOptionClick = _props.onNewOptionClick;
var _props$options = _props.options;

@@ -101,5 +111,9 @@ var options = _props$options === undefined ? [] : _props$options;

if (_isOptionUnique) {
options.unshift(option);
if (onNewOptionClick) {
onNewOptionClick(option);
} else {
options.unshift(option);
this.select.selectValue(option);
this.select.selectValue(option);
}
}

@@ -174,3 +188,4 @@ }

return menuRenderer(_extends({}, params, {
onSelect: this.onOptionSelect
onSelect: this.onOptionSelect,
selectValue: this.onOptionSelect
}));

@@ -180,2 +195,8 @@ },

onInputChange: function onInputChange(input) {
var onInputChange = this.props.onInputChange;
if (onInputChange) {
onInputChange(input);
}
// This value may be needed in between Select mounts (when this.select is null)

@@ -186,3 +207,5 @@ this.inputValue = input;

onInputKeyDown: function onInputKeyDown(event) {
var shouldKeyDownEventCreateNewOption = this.props.shouldKeyDownEventCreateNewOption;
var _props3 = this.props;
var shouldKeyDownEventCreateNewOption = _props3.shouldKeyDownEventCreateNewOption;
var onInputKeyDown = _props3.onInputKeyDown;

@@ -196,2 +219,4 @@ var focusedOption = this.select.getFocusedOption();

event.preventDefault();
} else if (onInputKeyDown) {
onInputKeyDown(event);
}

@@ -211,10 +236,17 @@ },

var _props3 = this.props;
var _props3$children = _props3.children;
var children = _props3$children === undefined ? defaultChildren : _props3$children;
var newOptionCreator = _props3.newOptionCreator;
var shouldKeyDownEventCreateNewOption = _props3.shouldKeyDownEventCreateNewOption;
var _props4 = this.props;
var newOptionCreator = _props4.newOptionCreator;
var shouldKeyDownEventCreateNewOption = _props4.shouldKeyDownEventCreateNewOption;
var restProps = _objectWithoutProperties(_props3, ['children', 'newOptionCreator', 'shouldKeyDownEventCreateNewOption']);
var restProps = _objectWithoutProperties(_props4, ['newOptionCreator', 'shouldKeyDownEventCreateNewOption']);
var children = this.props.children;
// We can't use destructuring default values to set the children,
// because it won't apply work if `children` is null. A falsy check is
// more reliable in real world use-cases.
if (!children) {
children = defaultChildren;
}
var props = _extends({}, restProps, {

@@ -221,0 +253,0 @@ allowCreate: true,

@@ -49,2 +49,6 @@ /*!

var _utilsDefaultClearRenderer = require('./utils/defaultClearRenderer');
var _utilsDefaultClearRenderer2 = _interopRequireDefault(_utilsDefaultClearRenderer);
var _Async = require('./Async');

@@ -93,7 +97,8 @@

function stringifyValue(value) {
if (typeof value === 'string') {
var valueType = typeof value;
if (valueType === 'string') {
return value;
} else if (typeof value === 'object') {
} else if (valueType === 'object') {
return JSON.stringify(value);
} else if (value || value === 0) {
} else if (valueType === 'number' || valueType === 'boolean') {
return String(value);

@@ -127,4 +132,6 @@ } else {

clearAllText: stringOrNode, // title for the "clear" control when multi: true
clearRenderer: _react2['default'].PropTypes.func, // create clearable x element
clearValueText: stringOrNode, // title for the "clear" control
clearable: _react2['default'].PropTypes.bool, // should it be possible to reset value
deleteRemoves: _react2['default'].PropTypes.bool, // whether backspace removes an item if there is no text input
delimiter: _react2['default'].PropTypes.string, // delimiter to use to join multiple values for the hidden field value

@@ -201,3 +208,5 @@ disabled: _react2['default'].PropTypes.bool, // whether the Select is disabled or not

clearAllText: 'Clear all',
clearRenderer: _utilsDefaultClearRenderer2['default'],
clearValueText: 'Clear value',
deleteRemoves: true,
delimiter: ',',

@@ -330,3 +339,7 @@ disabled: false,

componentWillUnmount: function componentWillUnmount() {
document.removeEventListener('touchstart', this.handleTouchOutside);
if (!document.removeEventListener && document.detachEvent) {
document.detachEvent('ontouchstart', this.handleTouchOutside);
} else {
document.removeEventListener('touchstart', this.handleTouchOutside);
}
},

@@ -336,5 +349,13 @@

if (enabled) {
document.addEventListener('touchstart', this.handleTouchOutside);
if (!document.addEventListener && document.attachEvent) {
document.attachEvent('ontouchstart', this.handleTouchOutside);
} else {
document.addEventListener('touchstart', this.handleTouchOutside);
}
} else {
document.removeEventListener('touchstart', this.handleTouchOutside);
if (!document.removeEventListener && document.detachEvent) {
document.detachEvent('ontouchstart', this.handleTouchOutside);
} else {
document.removeEventListener('touchstart', this.handleTouchOutside);
}
}

@@ -602,2 +623,5 @@ },

// end key
if (event.shiftKey) {
return;
}
this.focusEndOption();

@@ -607,4 +631,14 @@ break;

// home key
if (event.shiftKey) {
return;
}
this.focusStartOption();
break;
case 46:
// backspace
if (!this.state.inputValue && this.props.deleteRemoves) {
event.preventDefault();
this.popValue();
}
return;
default:

@@ -672,3 +706,4 @@ return;

expandValue: function expandValue(value, props) {
if (typeof value !== 'string' && typeof value !== 'number') return value;
var valueType = typeof value;
if (valueType !== 'string' && valueType !== 'number' && valueType !== 'boolean') return value;
var _props = this.props;

@@ -740,3 +775,14 @@ var labelKey = _props.labelKey;

var valueArray = this.getValueArray(this.props.value);
var visibleOptions = this._visibleOptions.filter(function (val) {
return !val.disabled;
});
var lastValueIndex = visibleOptions.indexOf(value);
this.setValue(valueArray.concat(value));
if (visibleOptions.length - 1 === lastValueIndex) {
// the last option was selected; focus the second-last one
this.focusOption(visibleOptions[lastValueIndex - 1]);
} else if (visibleOptions.length > lastValueIndex) {
// focus the option below the selected one
this.focusOption(visibleOptions[lastValueIndex + 1]);
}
},

@@ -756,3 +802,2 @@

}));
this.focus();
},

@@ -826,3 +871,3 @@

inputValue: '',
focusedOption: this._focusedOption || options[dir === 'next' ? 0 : options.length - 1].option
focusedOption: this._focusedOption || (options.length ? options[dir === 'next' ? 0 : options.length - 1].option : null)
});

@@ -951,66 +996,65 @@ return;

renderInput: function renderInput(valueArray, focusedOptionIndex) {
var _this5 = this;
var _classNames,
_this5 = this;
var className = (0, _classnames2['default'])('Select-input', this.props.inputProps.className);
var isOpen = !!this.state.isOpen;
var ariaOwns = (0, _classnames2['default'])((_classNames = {}, _defineProperty(_classNames, this._instancePrefix + '-list', isOpen), _defineProperty(_classNames, this._instancePrefix + '-backspace-remove-message', this.props.multi && !this.props.disabled && this.state.isFocused && !this.state.inputValue), _classNames));
// TODO: Check how this project includes Object.assign()
var inputProps = _extends({}, this.props.inputProps, {
role: 'combobox',
'aria-expanded': '' + isOpen,
'aria-owns': ariaOwns,
'aria-haspopup': '' + isOpen,
'aria-activedescendant': isOpen ? this._instancePrefix + '-option-' + focusedOptionIndex : this._instancePrefix + '-value',
'aria-labelledby': this.props['aria-labelledby'],
'aria-label': this.props['aria-label'],
className: className,
tabIndex: this.props.tabIndex,
onBlur: this.handleInputBlur,
onChange: this.handleInputChange,
onFocus: this.handleInputFocus,
ref: function ref(_ref2) {
return _this5.input = _ref2;
},
required: this.state.required,
value: this.state.inputValue
});
if (this.props.inputRenderer) {
return this.props.inputRenderer();
} else {
var _classNames;
return this.props.inputRenderer(inputProps);
}
var className = (0, _classnames2['default'])('Select-input', this.props.inputProps.className);
var isOpen = !!this.state.isOpen;
if (this.props.disabled || !this.props.searchable) {
var _props$inputProps = this.props.inputProps;
var inputClassName = _props$inputProps.inputClassName;
var ariaOwns = (0, _classnames2['default'])((_classNames = {}, _defineProperty(_classNames, this._instancePrefix + '-list', isOpen), _defineProperty(_classNames, this._instancePrefix + '-backspace-remove-message', this.props.multi && !this.props.disabled && this.state.isFocused && !this.state.inputValue), _classNames));
var divProps = _objectWithoutProperties(_props$inputProps, ['inputClassName']);
// TODO: Check how this project includes Object.assign()
var inputProps = _extends({}, this.props.inputProps, {
return _react2['default'].createElement('div', _extends({}, divProps, {
role: 'combobox',
'aria-expanded': '' + isOpen,
'aria-owns': ariaOwns,
'aria-haspopup': '' + isOpen,
'aria-expanded': isOpen,
'aria-owns': isOpen ? this._instancePrefix + '-list' : this._instancePrefix + '-value',
'aria-activedescendant': isOpen ? this._instancePrefix + '-option-' + focusedOptionIndex : this._instancePrefix + '-value',
'aria-labelledby': this.props['aria-labelledby'],
'aria-label': this.props['aria-label'],
className: className,
tabIndex: this.props.tabIndex,
tabIndex: this.props.tabIndex || 0,
onBlur: this.handleInputBlur,
onChange: this.handleInputChange,
onFocus: this.handleInputFocus,
ref: function ref(_ref2) {
return _this5.input = _ref2;
ref: function (ref) {
return _this5.input = ref;
},
required: this.state.required,
value: this.state.inputValue
});
'aria-readonly': '' + !!this.props.disabled,
style: { border: 0, width: 1, display: 'inline-block' } }));
}
if (this.props.disabled || !this.props.searchable) {
var _props$inputProps = this.props.inputProps;
var inputClassName = _props$inputProps.inputClassName;
var divProps = _objectWithoutProperties(_props$inputProps, ['inputClassName']);
return _react2['default'].createElement('div', _extends({}, divProps, {
role: 'combobox',
'aria-expanded': isOpen,
'aria-owns': isOpen ? this._instancePrefix + '-list' : this._instancePrefix + '-value',
'aria-activedescendant': isOpen ? this._instancePrefix + '-option-' + focusedOptionIndex : this._instancePrefix + '-value',
className: className,
tabIndex: this.props.tabIndex || 0,
onBlur: this.handleInputBlur,
onFocus: this.handleInputFocus,
ref: function (ref) {
return _this5.input = ref;
},
'aria-readonly': '' + !!this.props.disabled,
style: { border: 0, width: 1, display: 'inline-block' } }));
}
if (this.props.autosize) {
return _react2['default'].createElement(_reactInputAutosize2['default'], _extends({}, inputProps, { minWidth: '5px' }));
}
return _react2['default'].createElement(
'div',
{ className: className },
_react2['default'].createElement('input', inputProps)
);
if (this.props.autosize) {
return _react2['default'].createElement(_reactInputAutosize2['default'], _extends({}, inputProps, { minWidth: '5' }));
}
return _react2['default'].createElement(
'div',
{ className: className },
_react2['default'].createElement('input', inputProps)
);
},

@@ -1020,2 +1064,4 @@

if (!this.props.clearable || !this.props.value || this.props.value === 0 || this.props.multi && !this.props.value.length || this.props.disabled || this.props.isLoading) return;
var clear = this.props.clearRenderer();
return _react2['default'].createElement(

@@ -1030,3 +1076,3 @@ 'span',

},
_react2['default'].createElement('span', { className: 'Select-clear', dangerouslySetInnerHTML: { __html: '&times;' } })
clear
);

@@ -1037,3 +1083,4 @@ },

var onMouseDown = this.handleMouseDownOnArrow;
var arrow = this.props.arrowRenderer({ onMouseDown: onMouseDown });
var isOpen = this.state.isOpen;
var arrow = this.props.arrowRenderer({ onMouseDown: onMouseDown, isOpen: isOpen });

@@ -1136,2 +1183,8 @@ return _react2['default'].createElement(

onOptionRef: function onOptionRef(ref, isFocused) {
if (isFocused) {
this.focused = ref;
}
},
renderMenu: function renderMenu(options, valueArray, focusedOption) {

@@ -1154,3 +1207,4 @@ if (options && options.length) {

valueArray: valueArray,
valueKey: this.props.valueKey
valueKey: this.props.valueKey,
onOptionRef: this.onOptionRef
});

@@ -1157,0 +1211,0 @@ } else if (this.props.noResultsText) {

{
"name": "react-select-plus",
"version": "1.0.0-rc.1.patch3",
"description": "A Select control built with and for ReactJS",
"version": "1.0.0-rc.3",
"description": "A fork of react-select with support for option groups",
"main": "lib/Select.js",

@@ -6,0 +6,0 @@ "style": "dist/react-select-plus.min.css",

React-Select-Plus
=================

@@ -89,2 +88,8 @@ A Select control for [React](http://facebook.github.io/react/index.html) based on [JedWatson/React-Select](https://github.com/JedWatson/react-select/).

### Custom classNames
You can provide a custom `className` prop to the `<Select>` component, which will be added to the base `.Select` className for the outer container.
The built-in Options renderer also support custom classNames, just add a `className` property to objects in the `options` array.
### Multiselect options

@@ -99,3 +104,3 @@

* The `onChange` event provides an array of selected options _or_ a comma-separated string of values (eg `"1,2,3"`) if `simpleValue` is true
* By default, only options in the `options` array can be selected. Setting `allowCreate` to true allows new options to be created if they do not already exist. *NOTE:* `allowCreate` is not implemented in `1.0.0-beta`, if you need this option please stay on `0.9.x`.
* By default, only options in the `options` array can be selected. Use the `Creatable` Component (which wraps `Select`) to allow new options to be created if they do not already exist. Hitting comma (','), ENTER or TAB will add a new option. Versions `0.9.x` and below provided a boolean attribute on the `Select` Component (`allowCreate`) to achieve the same functionality. It is no longer available starting with version `1.0.0`.
* By default, selected options can be cleared. To disable the possibility of clearing a particular option, add `clearableValue: false` to that option:

@@ -218,4 +223,4 @@ ```javascript

`newOptionCreator` | function | Factory to create new option. Expected signature: `({ label: string, labelKey: string, valueKey: string }): Object` |
`promptTextCreator` | function | Creates prompt/placeholder option text. Expected signature: `(filterText: string): string`
`shouldKeyDownEventCreateNewOption` | function | Decides if a keyDown event (eg its `keyCode`) should result in the creation of a new option. ENTER, TAB and comma keys create new options by dfeault. Expected signature: `({ keyCode: number }): boolean` |
`onNewOptionClick` | function | new option click handler, it calls when new option has been selected. `function(option) {}` |
`shouldKeyDownEventCreateNewOption` | function | Decides if a keyDown event (eg its `keyCode`) should result in the creation of a new option. ENTER, TAB and comma keys create new options by default. Expected signature: `({ keyCode: number }): boolean` |
`promptTextCreator` | function | Factory for overriding default option creator prompt label. By default it will read 'Create option "{label}"'. Expected signature: `(label: String): String` |

@@ -248,5 +253,7 @@

* `ignoreCase`: `Boolean`: whether to ignore case or match the text exactly when filtering
* `ignoreAccents`: `Boolean`: whether to ignore accents on characters like ø or å
`matchProp` and `matchPos` both default to `"any"`.
`ignoreCase` defaults to `true`.
`ignoreAccents` defaults to `true`.

@@ -257,4 +264,4 @@ #### Advanced filters

* `filterOption`: `function(Object option, String filter)` returns `Boolean`. Will override `matchPos`, `matchProp` and `ignoreCase` options.
* `filterOptions`: `function(Array options, String filter, Array currentValues)` returns `Array filteredOptions`. Will override `filterOption`, `matchPos`, `matchProp` and `ignoreCase` options.
* `filterOption`: `function(Object option, String filter)` returns `Boolean`. Will override `matchPos`, `matchProp`, `ignoreCase` and `ignoreAccents` options.
* `filterOptions`: `function(Array options, String filter, Array currentValues)` returns `Array filteredOptions`. Will override `filterOption`, `matchPos`, `matchProp`, `ignoreCase` and `ignoreAccents` options.

@@ -286,2 +293,5 @@ For multi-select inputs, when providing a custom `filterOptions` method, remember to exclude current values from the returned array of options.

| labelKey | `String` | Option labels are accessible with this string key. |
| optionClassName | `String` | The className that gets used for options |
| optionComponent | `ReactClass` | The react component that gets used for rendering an option |
| optionRenderer | `Function` | The function that gets used to render the content of an option |
| options | `Array<Object>` | Ordered array of options to render. |

@@ -337,3 +347,3 @@ | selectValue | `Function` | Callback to select a new option; receives the option as a parameter. |

addLabelText | string | 'Add "{label}"?' | text to display when `allowCreate` is true
arrowRenderer | func | undefined | Renders a custom drop-down arrow to be shown in the right-hand side of the select: `arrowRenderer({ onMouseDown })`
arrowRenderer | func | undefined | Renders a custom drop-down arrow to be shown in the right-hand side of the select: `arrowRenderer({ onMouseDown, isOpen })`
autoBlur | bool | false | Blurs the input element after a selection has been made. Handy for lowering the keyboard on mobile devices

@@ -344,2 +354,3 @@ autofocus | bool | undefined | autofocus the component on mount

backspaceRemoves | bool | true | whether pressing backspace removes the last item when there is no input value
backspaceToRemoveMessage | string | 'Press backspace to remove {last label}' | prompt shown in input when at least one option in a multiselect is shown, set to '' to clear
cache | bool | true | enables the options cache for `asyncOptions` (default: `true`)

@@ -349,4 +360,6 @@ className | string | undefined | className for the outer element

clearAllText | string | 'Clear all' | title for the "clear" control when `multi` is true
clearRenderer | func | undefined | Renders a custom clear to be shown in the right-hand side of the select when clearable true: `clearRenderer()`
clearValueText | string | 'Clear value' | title for the "clear" control
resetValue | any | null | value to use when you clear the control
deleteRemoves | bool | true | whether pressing delete key removes the last item when there is no input value
delimiter | string | ',' | delimiter to use to join multiple values

@@ -356,2 +369,3 @@ disabled | bool | false | whether the Select is disabled or not

filterOptions | func | undefined | method to filter the options array: `function([options], filterString, [values])`
ignoreAccents | bool | true | whether to strip accents when filtering
ignoreCase | bool | true | whether to perform case-insensitive filtering

@@ -369,3 +383,3 @@ inputProps | object | {} | custom attributes for the Input (in the Select-control) e.g: `{'data-foo': 'bar'}`

name | string | undefined | field name, for hidden `<input />` tag
noResultsText | string | 'No results found' | placeholder displayed when there are no matching search results or a falsy value to hide it
noResultsText | string | 'No results found' | placeholder displayed when there are no matching search results or a falsy value to hide it (can also be a react component)
onBlur | func | undefined | onBlur handler: `function(event) {}`

@@ -375,3 +389,3 @@ onBlurResetsInput | bool | true | whether to clear input on blur or not

onClose | func | undefined | handler for when the menu closes: `function () {}`
onCloseResetInput | bool | true | whether to clear input when closing the menu through the arrow
onCloseResetsInput | bool | true | whether to clear input when closing the menu through the arrow
onFocus | func | undefined | onFocus handler: `function(event) {}`

@@ -389,3 +403,2 @@ onInputChange | func | undefined | onInputChange handler: `function(inputValue) {}`

searchable | bool | true | whether to enable searching feature or not
searchingText | string | 'Searching...' | message to display whilst options are loading via asyncOptions, or when `isLoading` is true
searchPromptText | string\|node | 'Type to search' | label to prompt for search input

@@ -392,0 +405,0 @@ tabSelectsValue | bool | true | whether to select the currently focused value when the `[tab]` key is pressed

@@ -1,175 +0,212 @@

import React from 'react';
import React, { Component, PropTypes } from 'react';
import Select from './Select';
import stripDiacritics from './utils/stripDiacritics';
let requestId = 0;
const propTypes = {
autoload: React.PropTypes.bool.isRequired, // automatically call the `loadOptions` prop on-mount; defaults to true
cache: React.PropTypes.any, // object to use to cache results; set to null/false to disable caching
children: React.PropTypes.func.isRequired, // Child function responsible for creating the inner Select component; (props: Object): PropTypes.element
ignoreAccents: React.PropTypes.bool, // strip diacritics when filtering; defaults to true
ignoreCase: React.PropTypes.bool, // perform case-insensitive filtering; defaults to true
loadingPlaceholder: React.PropTypes.oneOfType([ // replaces the placeholder while options are loading
React.PropTypes.string,
React.PropTypes.node
]),
loadOptions: React.PropTypes.func.isRequired, // callback to load options asynchronously; (inputValue: string, callback: Function): ?Promise
options: PropTypes.array.isRequired, // array of options
placeholder: React.PropTypes.oneOfType([ // field placeholder, displayed when there's no value (shared with Select)
React.PropTypes.string,
React.PropTypes.node
]),
noResultsText: React.PropTypes.oneOfType([ // field noResultsText, displayed when no options come back from the server
React.PropTypes.string,
React.PropTypes.node
]),
onChange: React.PropTypes.func, // onChange handler: function (newValue) {}
searchPromptText: React.PropTypes.oneOfType([ // label to prompt for search input
React.PropTypes.string,
React.PropTypes.node
]),
onInputChange: React.PropTypes.func, // optional for keeping track of what is being typed
value: React.PropTypes.any, // initial field value
};
function initCache (cache) {
if (cache && typeof cache !== 'object') {
cache = {};
const defaultCache = {};
const defaultProps = {
autoload: true,
cache: defaultCache,
children: defaultChildren,
ignoreAccents: true,
ignoreCase: true,
loadingPlaceholder: 'Loading...',
options: [],
searchPromptText: 'Type to search',
};
export default class Async extends Component {
constructor (props, context) {
super(props, context);
this._cache = props.cache === defaultCache ? {} : props.cache;
this.state = {
isLoading: false,
options: props.options,
};
this._onInputChange = this._onInputChange.bind(this);
}
return cache ? cache : null;
}
function updateCache (cache, input, data) {
if (!cache) return;
cache[input] = data;
}
componentDidMount () {
const { autoload } = this.props;
function getFromCache (cache, input) {
if (!cache) return;
for (let i = input.length; i >= 0; --i) {
let cacheKey = input.slice(0, i);
if (cache[cacheKey] && (input === cacheKey || cache[cacheKey].complete)) {
return cache[cacheKey];
if (autoload) {
this.loadOptions('');
}
}
}
function thenPromise (promise, callback) {
if (!promise || typeof promise.then !== 'function') return;
return promise.then((data) => {
callback(null, data);
}, (err) => {
callback(err);
});
}
componentWillUpdate (nextProps, nextState) {
const propertiesToSync = ['options'];
propertiesToSync.forEach((prop) => {
if (this.props[prop] !== nextProps[prop]) {
this.setState({
[prop]: nextProps[prop]
});
}
});
}
const stringOrNode = React.PropTypes.oneOfType([
React.PropTypes.string,
React.PropTypes.node
]);
clearOptions() {
this.setState({ options: [] });
}
const Async = React.createClass({
propTypes: {
cache: React.PropTypes.any, // object to use to cache results, can be null to disable cache
children: React.PropTypes.func, // Child function responsible for creating the inner Select component; (props: Object): PropTypes.element
ignoreAccents: React.PropTypes.bool, // whether to strip diacritics when filtering (shared with Select)
ignoreCase: React.PropTypes.bool, // whether to perform case-insensitive filtering (shared with Select)
isLoading: React.PropTypes.bool, // overrides the isLoading state when set to true
loadOptions: React.PropTypes.func.isRequired, // function to call to load options asynchronously
loadingPlaceholder: React.PropTypes.string, // replaces the placeholder while options are loading
minimumInput: React.PropTypes.number, // the minimum number of characters that trigger loadOptions
noResultsText: stringOrNode, // placeholder displayed when there are no matching search results (shared with Select)
onInputChange: React.PropTypes.func, // onInputChange handler: function (inputValue) {}
placeholder: stringOrNode, // field placeholder, displayed when there's no value (shared with Select)
searchPromptText: stringOrNode, // label to prompt for search input
searchingText: React.PropTypes.string, // message to display while options are loading
},
getDefaultProps () {
return {
cache: true,
ignoreAccents: true,
ignoreCase: true,
loadingPlaceholder: 'Loading...',
minimumInput: 0,
searchingText: 'Searching...',
searchPromptText: 'Type to search',
};
},
getInitialState () {
return {
cache: initCache(this.props.cache),
isLoading: false,
options: [],
};
},
componentWillMount () {
this._lastInput = '';
},
componentDidMount () {
this.loadOptions('');
},
componentWillReceiveProps (nextProps) {
if (nextProps.cache !== this.props.cache) {
loadOptions (inputValue) {
const { loadOptions } = this.props;
const cache = this._cache;
if (
cache &&
cache.hasOwnProperty(inputValue)
) {
this.setState({
cache: initCache(nextProps.cache),
options: cache[inputValue]
});
return;
}
},
focus () {
this.select.focus();
},
resetState () {
this._currentRequestId = -1;
this.setState({
isLoading: false,
options: [],
});
},
getResponseHandler (input) {
let _requestId = this._currentRequestId = requestId++;
return (err, data) => {
if (err) throw err;
if (!this.isMounted()) return;
updateCache(this.state.cache, input, data);
if (_requestId !== this._currentRequestId) return;
const callback = (error, data) => {
if (callback === this._callback) {
this._callback = null;
const options = data && data.options || [];
if (cache) {
cache[inputValue] = options;
}
this.setState({
isLoading: false,
options
});
}
};
// Ignore all but the most recent request
this._callback = callback;
const promise = loadOptions(inputValue, callback);
if (promise) {
promise.then(
(data) => callback(null, data),
(error) => callback(error)
);
}
if (
this._callback &&
!this.state.isLoading
) {
this.setState({
isLoading: false,
options: data && data.options || [],
isLoading: true
});
};
},
loadOptions (input) {
if (this.props.onInputChange) {
let nextState = this.props.onInputChange(input);
// Note: != used deliberately here to catch undefined and null
if (nextState != null) {
input = '' + nextState;
}
}
if (this.props.ignoreAccents) input = stripDiacritics(input);
if (this.props.ignoreCase) input = input.toLowerCase();
this._lastInput = input;
if (input.length < this.props.minimumInput) {
return this.resetState();
return inputValue;
}
_onInputChange (inputValue) {
const { ignoreAccents, ignoreCase, onInputChange } = this.props;
if (ignoreAccents) {
inputValue = stripDiacritics(inputValue);
}
let cacheResult = getFromCache(this.state.cache, input);
if (cacheResult && Array.isArray(cacheResult.options)) {
return this.setState({
options: cacheResult.options,
});
if (ignoreCase) {
inputValue = inputValue.toLowerCase();
}
this.setState({
isLoading: true,
});
let responseHandler = this.getResponseHandler(input);
let inputPromise = thenPromise(this.props.loadOptions(input, responseHandler), responseHandler);
return inputPromise ? inputPromise.then(() => {
return input;
}) : input;
},
render () {
let {
children = defaultChildren,
noResultsText,
...restProps
} = this.props;
let { isLoading, options } = this.state;
if (this.props.isLoading) isLoading = true;
let placeholder = isLoading ? this.props.loadingPlaceholder : this.props.placeholder;
if (onInputChange) {
onInputChange(inputValue);
}
return this.loadOptions(inputValue);
}
inputValue() {
if (this.select) {
return this.select.state.inputValue;
}
return '';
}
noResultsText() {
const { loadingPlaceholder, noResultsText, searchPromptText } = this.props;
const { isLoading } = this.state;
const inputValue = this.inputValue();
if (isLoading) {
noResultsText = this.props.searchingText;
} else if (!options.length && this._lastInput.length < this.props.minimumInput) {
noResultsText = this.props.searchPromptText;
return loadingPlaceholder;
}
if (inputValue && noResultsText) {
return noResultsText;
}
return searchPromptText;
}
focus () {
this.select.focus();
}
render () {
const { children, loadingPlaceholder, placeholder } = this.props;
const { isLoading, options } = this.state;
const props = {
...restProps,
isLoading,
noResultsText,
onInputChange: this.loadOptions,
options,
placeholder,
ref: (ref) => {
this.select = ref;
noResultsText: this.noResultsText(),
placeholder: isLoading ? loadingPlaceholder : placeholder,
options: (isLoading && loadingPlaceholder) ? [] : options,
ref: (ref) => (this.select = ref),
onChange: (newValues) => {
if (this.props.multi && this.props.value && (newValues.length > this.props.value.length)) {
this.clearOptions();
}
this.props.onChange(newValues);
}
};
return children(props);
return children({
...this.props,
...props,
isLoading,
onInputChange: this._onInputChange
});
}
});
}
Async.propTypes = propTypes;
Async.defaultProps = defaultProps;
function defaultChildren (props) {

@@ -180,3 +217,1 @@ return (

};
module.exports = Async;
import React from 'react';
import Select from './Select';
function reduce(obj, props = {}){
return Object.keys(obj)
.reduce((props, key) => {
const value = obj[key];
if (value !== undefined) props[key] = value;
return props;
}, props);
}
const AsyncCreatable = React.createClass({

@@ -14,4 +23,3 @@ displayName: 'AsyncCreatableSelect',

<Select
{...asyncProps}
{...creatableProps}
{...reduce(asyncProps, reduce(creatableProps, {}))}
onInputChange={(input) => {

@@ -18,0 +26,0 @@ creatableProps.onInputChange(input);

@@ -23,5 +23,5 @@ import React from 'react';

// Determines if the current input text represents a valid option.
// ({ label: string }): boolean
isValidNewOption: React.PropTypes.func,
// Determines if the current input text represents a valid option.
// ({ label: string }): boolean
isValidNewOption: React.PropTypes.func,

@@ -31,11 +31,20 @@ // See Select.propTypes.menuRenderer

// Factory to create new option.
// ({ label: string, labelKey: string, valueKey: string }): Object
// Factory to create new option.
// ({ label: string, labelKey: string, valueKey: string }): Object
newOptionCreator: React.PropTypes.func,
// input change handler: function (inputValue) {}
onInputChange: React.PropTypes.func,
// input keyDown handler: function (event) {}
onInputKeyDown: React.PropTypes.func,
// new option click handler: function (option) {}
onNewOptionClick: React.PropTypes.func,
// See Select.propTypes.options
options: React.PropTypes.array,
// Creates prompt/placeholder option text.
// (filterText: string): string
// Creates prompt/placeholder option text.
// (filterText: string): string
promptTextCreator: React.PropTypes.func,

@@ -72,2 +81,3 @@

newOptionCreator,
onNewOptionClick,
options = [],

@@ -83,5 +93,9 @@ shouldKeyDownEventCreateNewOption

if (isOptionUnique) {
options.unshift(option);
if (onNewOptionClick) {
onNewOptionClick(option);
} else {
options.unshift(option);
this.select.selectValue(option);
this.select.selectValue(option);
}
}

@@ -154,3 +168,4 @@ }

...params,
onSelect: this.onOptionSelect
onSelect: this.onOptionSelect,
selectValue: this.onOptionSelect
});

@@ -160,2 +175,8 @@ },

onInputChange (input) {
const { onInputChange } = this.props;
if (onInputChange) {
onInputChange(input);
}
// This value may be needed in between Select mounts (when this.select is null)

@@ -166,3 +187,3 @@ this.inputValue = input;

onInputKeyDown (event) {
const { shouldKeyDownEventCreateNewOption } = this.props;
const { shouldKeyDownEventCreateNewOption, onInputKeyDown } = this.props;
const focusedOption = this.select.getFocusedOption();

@@ -179,2 +200,4 @@

event.preventDefault();
} else if (onInputKeyDown) {
onInputKeyDown(event);
}

@@ -193,3 +216,2 @@ },

const {
children = defaultChildren,
newOptionCreator,

@@ -200,2 +222,11 @@ shouldKeyDownEventCreateNewOption,

let { children } = this.props;
// We can't use destructuring default values to set the children,
// because it won't apply work if `children` is null. A falsy check is
// more reliable in real world use-cases.
if (!children) {
children = defaultChildren;
}
const props = {

@@ -202,0 +233,0 @@ ...restProps,

@@ -82,3 +82,3 @@ import React from 'react';

role="option"
onMouseDown={this.handleMouseDown}
onMouseDown={this.handleMouseDown}
onMouseEnter={this.handleMouseEnter}

@@ -85,0 +85,0 @@ onMouseMove={this.handleMouseMove}

@@ -15,2 +15,3 @@ /*!

import defaultMenuRenderer from './utils/defaultMenuRenderer';
import defaultClearRenderer from './utils/defaultClearRenderer';

@@ -40,7 +41,8 @@ import Async from './Async';

function stringifyValue (value) {
if (typeof value === 'string') {
const valueType = typeof value;
if (valueType === 'string') {
return value;
} else if (typeof value === 'object') {
} else if (valueType === 'object') {
return JSON.stringify(value);
} else if (value || value === 0) {
} else if (valueType === 'number' || valueType === 'boolean') {
return String(value);

@@ -69,3 +71,3 @@ } else {

'aria-labelledby': React.PropTypes.string, // HTML ID of an element that should be used as the label (for assistive tech)
arrowRenderer: React.PropTypes.func, // Create drop-down caret element
arrowRenderer: React.PropTypes.func, // Create drop-down caret element
autoBlur: React.PropTypes.bool, // automatically blur the component when an option is selected

@@ -78,4 +80,6 @@ autofocus: React.PropTypes.bool, // autofocus the component on mount

clearAllText: stringOrNode, // title for the "clear" control when multi: true
clearRenderer: React.PropTypes.func, // create clearable x element
clearValueText: stringOrNode, // title for the "clear" control
clearable: React.PropTypes.bool, // should it be possible to reset value
deleteRemoves: React.PropTypes.bool, // whether backspace removes an item if there is no text input
delimiter: React.PropTypes.string, // delimiter to use to join multiple values for the hidden field value

@@ -152,3 +156,5 @@ disabled: React.PropTypes.bool, // whether the Select is disabled or not

clearAllText: 'Clear all',
clearRenderer: defaultClearRenderer,
clearValueText: 'Clear value',
deleteRemoves: true,
delimiter: ',',

@@ -199,3 +205,3 @@ disabled: false,

componentWillMount() {
componentWillMount () {
this._flatOptions = this.flattenOptions(this.props.options);

@@ -218,3 +224,3 @@ this._instancePrefix = 'react-select-' + (this.props.instanceId || ++instanceId) + '-';

componentWillReceiveProps(nextProps) {
componentWillReceiveProps (nextProps) {
if (nextProps.options !== this.props.options) {

@@ -282,15 +288,27 @@ this._flatOptions = this.flattenOptions(nextProps.options);

componentWillUnmount() {
document.removeEventListener('touchstart', this.handleTouchOutside);
componentWillUnmount () {
if (!document.removeEventListener && document.detachEvent) {
document.detachEvent('ontouchstart', this.handleTouchOutside);
} else {
document.removeEventListener('touchstart', this.handleTouchOutside);
}
},
toggleTouchOutsideEvent(enabled) {
toggleTouchOutsideEvent (enabled) {
if (enabled) {
document.addEventListener('touchstart', this.handleTouchOutside);
if (!document.addEventListener && document.attachEvent) {
document.attachEvent('ontouchstart', this.handleTouchOutside);
} else {
document.addEventListener('touchstart', this.handleTouchOutside);
}
} else {
document.removeEventListener('touchstart', this.handleTouchOutside);
if (!document.removeEventListener && document.detachEvent) {
document.detachEvent('ontouchstart', this.handleTouchOutside);
} else {
document.removeEventListener('touchstart', this.handleTouchOutside);
}
}
},
handleTouchOutside(event) {
handleTouchOutside (event) {
// handle touch outside on ios to dismiss menu

@@ -314,3 +332,3 @@ if (this.wrapper && !this.wrapper.contains(event.target) &&

blurInput() {
blurInput () {
if (!this.input) return;

@@ -333,3 +351,3 @@ this.input.blur();

// we don't want to fire the click event (because the user only wants to scroll)
if(this.dragging) return;
if (this.dragging) return;

@@ -343,3 +361,3 @@ // Fire the mouse events

// we don't want to fire the click event (because the user only wants to scroll)
if(this.dragging) return;
if (this.dragging) return;

@@ -437,3 +455,3 @@ // Clear the value

});
} else {
} else {
this.setState({

@@ -496,3 +514,3 @@ isOpen: false,

isPseudoFocused: false,
inputValue: newInputValue
inputValue: newInputValue,
});

@@ -551,7 +569,19 @@ },

case 35: // end key
if (event.shiftKey) {
return;
}
this.focusEndOption();
break;
case 36: // home key
if (event.shiftKey) {
return;
}
this.focusStartOption();
break;
case 46: // backspace
if (!this.state.inputValue && this.props.deleteRemoves) {
event.preventDefault();
this.popValue();
}
return;
default: return;

@@ -611,3 +641,4 @@ }

expandValue (value, props) {
if (typeof value !== 'string' && typeof value !== 'number') return value;
const valueType = typeof value;
if (valueType !== 'string' && valueType !== 'number' && valueType !== 'boolean') return value;
let { labelKey, valueKey, renderInvalidValues } = this.props;

@@ -669,3 +700,12 @@ let options = this._flatOptions;

var valueArray = this.getValueArray(this.props.value);
const visibleOptions = this._visibleOptions.filter(val => !val.disabled);
const lastValueIndex = visibleOptions.indexOf(value);
this.setValue(valueArray.concat(value));
if (visibleOptions.length - 1 === lastValueIndex) {
// the last option was selected; focus the second-last one
this.focusOption(visibleOptions[lastValueIndex - 1]);
} else if (visibleOptions.length > lastValueIndex) {
// focus the option below the selected one
this.focusOption(visibleOptions[lastValueIndex + 1]);
}
},

@@ -683,3 +723,2 @@

this.setValue(valueArray.filter(i => i !== value));
this.focus();
},

@@ -702,3 +741,3 @@

getResetValue() {
getResetValue () {
if (this.props.resetValue !== undefined) {

@@ -752,3 +791,3 @@ return this.props.resetValue;

inputValue: '',
focusedOption: this._focusedOption || options[dir === 'next' ? 0 : options.length - 1].option
focusedOption: this._focusedOption || (options.length ? options[dir === 'next' ? 0 : options.length - 1].option : null)
});

@@ -779,3 +818,3 @@ return;

var potentialIndex = focusedIndex - this.props.pageSize;
if ( potentialIndex < 0 ) {
if (potentialIndex < 0) {
focusedIndex = 0;

@@ -787,3 +826,3 @@ } else {

var potentialIndex = focusedIndex + this.props.pageSize;
if ( potentialIndex > options.length - 1 ) {
if (potentialIndex > options.length - 1) {
focusedIndex = options.length - 1;

@@ -869,65 +908,65 @@ } else {

renderInput (valueArray, focusedOptionIndex) {
if (this.props.inputRenderer) {
return this.props.inputRenderer();
} else {
var className = classNames('Select-input', this.props.inputProps.className);
const isOpen = !!this.state.isOpen;
var className = classNames('Select-input', this.props.inputProps.className);
const isOpen = !!this.state.isOpen;
const ariaOwns = classNames({
[this._instancePrefix + '-list']: isOpen,
[this._instancePrefix + '-backspace-remove-message']: this.props.multi
&& !this.props.disabled
&& this.state.isFocused
&& !this.state.inputValue
});
const ariaOwns = classNames({
[this._instancePrefix + '-list']: isOpen,
[this._instancePrefix + '-backspace-remove-message']: this.props.multi
&& !this.props.disabled
&& this.state.isFocused
&& !this.state.inputValue
});
// TODO: Check how this project includes Object.assign()
const inputProps = Object.assign({}, this.props.inputProps, {
role: 'combobox',
'aria-expanded': '' + isOpen,
'aria-owns': ariaOwns,
'aria-haspopup': '' + isOpen,
'aria-activedescendant': isOpen ? this._instancePrefix + '-option-' + focusedOptionIndex : this._instancePrefix + '-value',
'aria-labelledby': this.props['aria-labelledby'],
'aria-label': this.props['aria-label'],
className: className,
tabIndex: this.props.tabIndex,
onBlur: this.handleInputBlur,
onChange: this.handleInputChange,
onFocus: this.handleInputFocus,
ref: ref => this.input = ref,
required: this.state.required,
value: this.state.inputValue
});
// TODO: Check how this project includes Object.assign()
const inputProps = Object.assign({}, this.props.inputProps, {
role: 'combobox',
'aria-expanded': '' + isOpen,
'aria-owns': ariaOwns,
'aria-haspopup': '' + isOpen,
'aria-activedescendant': isOpen ? this._instancePrefix + '-option-' + focusedOptionIndex : this._instancePrefix + '-value',
'aria-labelledby': this.props['aria-labelledby'],
'aria-label': this.props['aria-label'],
className: className,
tabIndex: this.props.tabIndex,
onBlur: this.handleInputBlur,
onChange: this.handleInputChange,
onFocus: this.handleInputFocus,
ref: ref => this.input = ref,
required: this.state.required,
value: this.state.inputValue
});
if (this.props.disabled || !this.props.searchable) {
const { inputClassName, ...divProps } = this.props.inputProps;
return (
<div
{...divProps}
role="combobox"
aria-expanded={isOpen}
aria-owns={isOpen ? this._instancePrefix + '-list' : this._instancePrefix + '-value'}
aria-activedescendant={isOpen ? this._instancePrefix + '-option-' + focusedOptionIndex : this._instancePrefix + '-value'}
className={className}
tabIndex={this.props.tabIndex || 0}
onBlur={this.handleInputBlur}
onFocus={this.handleInputFocus}
ref={ref => this.input = ref}
aria-readonly={'' + !!this.props.disabled}
style={{ border: 0, width: 1, display:'inline-block' }}/>
);
}
if (this.props.inputRenderer) {
return this.props.inputRenderer(inputProps);
}
if (this.props.autosize) {
return (
<AutosizeInput {...inputProps} minWidth="5px" />
);
}
if (this.props.disabled || !this.props.searchable) {
const { inputClassName, ...divProps } = this.props.inputProps;
return (
<div className={ className }>
<input {...inputProps} />
</div>
<div
{...divProps}
role="combobox"
aria-expanded={isOpen}
aria-owns={isOpen ? this._instancePrefix + '-list' : this._instancePrefix + '-value'}
aria-activedescendant={isOpen ? this._instancePrefix + '-option-' + focusedOptionIndex : this._instancePrefix + '-value'}
className={className}
tabIndex={this.props.tabIndex || 0}
onBlur={this.handleInputBlur}
onFocus={this.handleInputFocus}
ref={ref => this.input = ref}
aria-readonly={'' + !!this.props.disabled}
style={{ border: 0, width: 1, display:'inline-block' }}/>
);
}
if (this.props.autosize) {
return (
<AutosizeInput {...inputProps} minWidth="5" />
);
}
return (
<div className={ className }>
<input {...inputProps} />
</div>
);
},

@@ -937,2 +976,4 @@

if (!this.props.clearable || (!this.props.value || this.props.value === 0) || (this.props.multi && !this.props.value.length) || this.props.disabled || this.props.isLoading) return;
const clear = this.props.clearRenderer();
return (

@@ -946,3 +987,3 @@ <span className="Select-clear-zone" title={this.props.multi ? this.props.clearAllText : this.props.clearValueText}

>
<span className="Select-clear" dangerouslySetInnerHTML={{ __html: '&times;' }} />
{clear}
</span>

@@ -954,3 +995,4 @@ );

const onMouseDown = this.handleMouseDownOnArrow;
const arrow = this.props.arrowRenderer({ onMouseDown });
const isOpen = this.state.isOpen;
const arrow = this.props.arrowRenderer({ onMouseDown, isOpen });

@@ -1059,2 +1101,8 @@ return (

onOptionRef(ref, isFocused) {
if (isFocused) {
this.focused = ref;
}
},
renderMenu (options, valueArray, focusedOption) {

@@ -1078,2 +1126,3 @@ if (options && options.length) {

valueKey: this.props.valueKey,
onOptionRef: this.onOptionRef,
});

@@ -1080,0 +1129,0 @@ } else if (this.props.noResultsText) {

@@ -23,482 +23,241 @@ 'use strict';

var Select = require('../src/Select');
describe('Async', () => {
let asyncInstance, asyncNode, filterInputNode, loadOptions;
var renderer;
var loadOptions;
const typeSearchText = function(text) {
const output = renderer.getRenderOutput();
// onInputChange is actually bound to loadOptions(...),
// loadOptions returns the promise, if there is one, so we can use this
// to chain the assertions onto
return output.props.onInputChange(text);
function createControl (props = {}) {
loadOptions = props.loadOptions || sinon.stub();
asyncInstance = TestUtils.renderIntoDocument(
<Select.Async
autoload={false}
openOnFocus
{...props}
loadOptions={loadOptions}
/>
);
asyncNode = ReactDOM.findDOMNode(asyncInstance);
findAndFocusInputControl();
};
beforeEach(() => {
function createOptionsResponse (options) {
return {
options: options.map((option) => ({
label: option,
value: option
}))
};
}
renderer = TestUtils.createRenderer();
loadOptions = sinon.stub();
});
function findAndFocusInputControl () {
filterInputNode = asyncNode.querySelector('input');
if (filterInputNode) {
TestUtils.Simulate.focus(filterInputNode);
}
};
describe('using promises', () => {
function typeSearchText (text) {
TestUtils.Simulate.change(filterInputNode, { target: { value: text } });
};
beforeEach(() => {
// Render an instance of the component
renderer.render(<Select.Async loadOptions={loadOptions} minimumInput={1}/>);
});
it('does not call loadOptions', () => {
describe('autoload', () => {
it('false does not call loadOptions on-mount', () => {
createControl({
autoload: false
});
expect(loadOptions, 'was not called');
});
it('renders the select with no options', () => {
return expect(renderer, 'to have rendered',
<Select options={ [] } noResultsText="Type to search"/>);
it('true calls loadOptions on-mount', () => {
createControl({
autoload: true
});
expect(loadOptions, 'was called');
});
});
it('calls the loadOptions for each input', () => {
typeSearchText('te');
typeSearchText('tes');
typeSearchText('te');
describe('cache', () => {
it('should be used instead of loadOptions if input has been previously loaded', () => {
createControl();
typeSearchText('a');
return expect(loadOptions, 'was called times', 1);
typeSearchText('b');
return expect(loadOptions, 'was called times', 2);
typeSearchText('a');
return expect(loadOptions, 'was called times', 2);
typeSearchText('b');
return expect(loadOptions, 'was called times', 2);
typeSearchText('c');
return expect(loadOptions, 'was called times', 3);
});
it('shows "Loading..." after typing', () => {
typeSearchText('te');
return expect(renderer, 'to have rendered',
<Select
isLoading
placeholder="Loading..."
noResultsText="Searching..."
/>);
});
it('shows the returns options when the result returns', () => {
// Unexpected comes with promises built in - we'll use them
// rather than depending on another library
loadOptions.returns(expect.promise((resolve, reject) => {
resolve({ options: [{ value: 1, label: 'test' }] });
}));
typeSearchText('te');
return loadOptions.firstCall.returnValue.then(() => {
return expect(renderer, 'to have rendered',
<Select
isLoading={false}
placeholder="Select..."
noResultsText="No results found"
options={ [ { value: 1, label: 'test' } ] }
/>);
it('can be disabled by passing null/false', () => {
createControl({
cache: false
});
typeSearchText('a');
return expect(loadOptions, 'was called times', 1);
typeSearchText('b');
return expect(loadOptions, 'was called times', 2);
typeSearchText('a');
return expect(loadOptions, 'was called times', 3);
typeSearchText('b');
return expect(loadOptions, 'was called times', 4);
});
it('shows "Loading..." after typing if refined search matches none of the previous results', () => {
loadOptions.returns(expect.promise((resolve, reject) => {
resolve({ options: [{ value: 1, label: 'test' }] });
}));
typeSearchText('te');
return loadOptions.firstCall.returnValue.then(() => {
typeSearchText('ten');
return expect(renderer, 'to have rendered',
<Select
isLoading
placeholder="Loading..."
noResultsText="Searching..."
/>);
it('can be customized', () => {
createControl({
cache: {
a: []
}
});
typeSearchText('a');
return expect(loadOptions, 'was called times', 0);
typeSearchText('b');
return expect(loadOptions, 'was called times', 1);
typeSearchText('a');
return expect(loadOptions, 'was called times', 1);
});
it('ignores the result of an earlier call, when the responses come in the wrong order', () => {
let promise1Resolve, promise2Resolve;
const promise1 = expect.promise((resolve, reject) => {
promise1Resolve = resolve;
});
const promise2 = expect.promise((resolve, reject) => {
promise2Resolve = resolve;
});
loadOptions.withArgs('te').returns(promise1);
loadOptions.withArgs('tes').returns(promise2);
const firstResult = typeSearchText('te');
const secondResult = typeSearchText('tes');
promise2Resolve({ options: [ { value: 2, label: 'test' } ] });
promise1Resolve({ options: [ { value: 1, label: 'test to ignore' } ] });
return expect.promise.all([firstResult, secondResult]).then(() => {
return expect(renderer, 'to have rendered',
<Select
isLoading={false}
placeholder="Select..."
noResultsText="No results found"
options={ [ { value: 2, label: 'test' } ] }
/>);
});
it('should not use the same cache for every instance by default', () => {
createControl();
const instance1 = asyncInstance;
createControl();
const instance2 = asyncInstance;
expect(instance1._cache !== instance2._cache, 'to equal', true);
});
it('treats a rejected promise as empty options', () => {
let promise1Resolve, promise2Reject;
const promise1 = expect.promise((resolve, reject) => {
promise1Resolve = resolve;
});
const promise2 = expect.promise((resolve, reject) => {
promise2Reject = reject;
});
loadOptions.withArgs('te').returns(promise1);
loadOptions.withArgs('tes').returns(promise2);
const result1 = typeSearchText('te');
const result2 = typeSearchText('tes');
promise1Resolve({ options: [ { value: 1, label: 'from te input' }] });
promise2Reject();
return expect.promise.all([ result1, result2]).then(() => {
// Previous results (from 'te') are thrown away, and we render with an empty options list
return expect(renderer, 'to have rendered', <Select options={ [] }/>);
});
});
});
describe('with an onInputChange prop', () => {
let input;
const onInputChange = v => input = v;
beforeEach(() => {
// Render an instance of the component
renderer.render(<Select.Async
loadOptions={loadOptions}
minimumInput={1}
onInputChange={onInputChange}
/>);
});
it('calls through to the provided onInputChange function', () => {
typeSearchText('hi');
return expect(input, 'to equal', 'hi');
});
});
describe('with an isLoading prop', () => {
beforeEach(() => {
// Render an instance of the component
renderer.render(<Select.Async
loadOptions={loadOptions}
minimumInput={1}
isLoading
/>);
});
it('forces the isLoading prop on Select', () => {
return expect(renderer, 'to have rendered',
<Select
isLoading
noResultsText="Searching..."
placeholder="Loading..."
/>);
});
});
describe('with a cache', () => {
beforeEach(() => {
// Render an instance of the component
renderer.render(<Select.Async
loadOptions={loadOptions}
minimumInput={1}
cache={ {} }
/>);
});
it('caches previous responses', () => {
loadOptions.withArgs('te').returns(expect.promise((resolve,reject) => {
resolve({ options: [{ value: 'te', label: 'test 1' }] });
}));
loadOptions.withArgs('tes').returns(expect.promise((resolve,reject) => {
resolve({ options: [{ value: 'tes', label: 'test 2' } ] });
}));
// Need to wait for the results be returned, otherwise the cache won't be used
return typeSearchText('te')
.then(() => typeSearchText('tes'))
.then(() => typeSearchText('te')) // this should use the cache
.then(() => {
return expect(loadOptions, 'was called times', 2);
});
});
it('does not call `loadOptions` for a longer input, after a `complete=true` response', () => {
loadOptions.withArgs('te').returns(expect.promise((resolve,reject) => {
resolve({
complete: true,
options: [{ value: 'te', label: 'test 1' }]
});
}));
return typeSearchText('te')
.then(() => typeSearchText('tes'))
.then(() => {
return expect(loadOptions, 'was called once');
});
});
it('updates the cache when the cache is reset as a prop', () => {
renderer.render(<Select.Async
loadOptions={loadOptions}
minimumInput={1}
cache={ { 'tes': { options: [ { value: 1, label: 'updated cache' } ] } } }
/>);
typeSearchText('tes');
expect(loadOptions, 'was not called');
return expect(renderer, 'to have rendered',
<Select options={ [ { value: 1, label: 'updated cache' } ] } />
);
});
it('uses the longest complete response if the responses come out-of-order', () => {
let resolveTe, resolveTes;
const promises = [];
promises.push(loadOptions.withArgs('te').returns(expect.promise((resolve, reject) => {
resolveTe = () => resolve({
complete: true,
options: [ { value: 'te', label: 'test 1' } ]
});
})));
promises.push(loadOptions.withArgs('tes').returns(expect.promise((resolve, reject) => {
resolveTes = () => resolve({
complete: true,
options: [ { value: 'tes', label: 'test 2' } ]
});
})));
/* Order is:
* 1. User types 'te'
* 2. loadOptions is called with 'te'
* 3. User types 'tes'
* 4. loadOptions is called with 'tes'
* 5. Response for 'tes' comes back, with { complete: true }
* 6. Response for 'te' comes back, with { complete: true }
* 7. User types 'test'
* 8. Expect that we get the results for 'tes' as options, not 'te'
*/
describe('loadOptions', () => {
it('calls the loadOptions when search input text changes', () => {
createControl();
typeSearchText('te');
typeSearchText('tes');
resolveTes();
resolveTe();
return expect.promise.all(promises).then(() => {
typeSearchText('test');
expect(loadOptions, 'was called times', 2);
return expect(renderer, 'to have rendered', <Select options={
[ { value: 'tes', label: 'test 2' }]
} />);
});
});
});
describe('using callbacks', () => {
beforeEach(() => {
// Render an instance of the component
renderer.render(<Select.Async loadOptions={loadOptions} minimumInput={1}/>);
});
it('shows the returns options when the result returns', () => {
typeSearchText('te');
expect(loadOptions, 'was called');
const callback = loadOptions.args[0][1];
callback(null, { options: [ { value: 1, label: 'test callback' } ] });
return expect(renderer, 'to have rendered',
<Select
isLoading={false}
placeholder="Select..."
noResultsText="No results found"
options={ [ { value: 1, label: 'test callback' } ] }
/>);
return expect(loadOptions, 'was called times', 3);
});
it('renders results for each callback', () => {
it('shows the loadingPlaceholder text while options are being fetched', () => {
function loadOptions (input, callback) {}
createControl({
loadOptions,
loadingPlaceholder: 'Loading'
});
typeSearchText('te');
typeSearchText('tes');
expect(loadOptions, 'was called times', 2);
const callback1 = loadOptions.args[0][1];
const callback2 = loadOptions.args[1][1];
callback1(null, { options: [ { value: 1, label: 'test callback' } ] });
callback2(null, { options: [ { value: 2, label: 'test callback 2' } ] });
return expect(renderer, 'to have rendered',
<Select
isLoading={false}
placeholder="Select..."
noResultsText="No results found"
options={ [ { value: 2, label: 'test callback 2' } ] }
/>);
return expect(asyncNode.textContent, 'to contain', 'Loading');
});
it('ignores callbacks from earlier requests (out-of-order responses)', () => {
typeSearchText('te');
typeSearchText('tes');
expect(loadOptions, 'was called times', 2);
const callback1 = loadOptions.args[0][1];
const callback2 = loadOptions.args[1][1];
callback2(null, { options: [ { value: 2, label: 'test callback 2' } ] });
// Callback1 should be ignored
callback1(null, { options: [ { value: 1, label: 'test callback' } ] });
return expect(renderer, 'to have rendered',
<Select
isLoading={false}
placeholder="Select..."
noResultsText="No results found"
options={ [ { value: 2, label: 'test callback 2' } ] }
/>);
});
it('uses the cache when available', () => {
renderer.render(<Select.Async cache={true} loadOptions={loadOptions} />);
typeSearchText('te');
loadOptions.args[0][1](null, { options: [ { value: 1, label: 'test1' } ] });
typeSearchText('tes');
loadOptions.args[1][1](null, { options: [ { value: 2, label: 'test2' } ] });
typeSearchText('te');
expect(loadOptions, 'was called times', 2);
return expect(renderer, 'to have rendered',
<Select options={ [ { value: 1, label: 'test1' } ] } />);
});
it('throws an error when the callback returns an error', () => {
typeSearchText('te');
expect(() => loadOptions.args[0][1](new Error('Something went wrong')),
'to throw', 'Something went wrong');
});
it('assumes no options when the result has no `options` property', () => {
typeSearchText('te');
loadOptions.args[0][1](null, [ { value: 1, label: 'should be wrapped in an object' } ] );
return expect(renderer, 'to have rendered', <Select options={ [] } />);
});
});
describe('with minimumInput', () => {
describe('=0', () => {
beforeEach(() => {
renderer.render(<Select.Async loadOptions={loadOptions} minimumInput={0} cache={false} />);
describe('with callbacks', () => {
it('should display the loaded options', () => {
function loadOptions (input, resolve) {
resolve(null, createOptionsResponse(['foo']));
}
createControl({
cache: false,
loadOptions
});
expect(asyncNode.querySelectorAll('[role=option]').length, 'to equal', 0);
typeSearchText('foo');
expect(asyncNode.querySelectorAll('[role=option]').length, 'to equal', 1);
expect(asyncNode.querySelector('[role=option]').textContent, 'to equal', 'foo');
});
it('calls loadOptions immediately', () => {
// componentDidMount is not currently called with the shallowRenderer, so we need to fake it here
// When we upgrade to 0.15, we'll be able to use renderer.getMountedInstance()
// (or, componentDidMount will be called with the shallow renderer)
renderer._instance._instance.componentDidMount();
expect(loadOptions, 'was called');
it('should display the most recently-requested loaded options (if results are returned out of order)', () => {
const callbacks = [];
function loadOptions (input, callback) {
callbacks.push(callback);
}
createControl({
cache: false,
loadOptions
});
typeSearchText('foo');
typeSearchText('bar');
expect(asyncNode.querySelectorAll('[role=option]').length, 'to equal', 0);
callbacks[1](null, createOptionsResponse(['bar']));
callbacks[0](null, createOptionsResponse(['foo']));
expect(asyncNode.querySelectorAll('[role=option]').length, 'to equal', 1);
expect(asyncNode.querySelector('[role=option]').textContent, 'to equal', 'bar');
});
it('calls loadOptions again when input returns to empty', () => {
renderer._instance._instance.componentDidMount();
typeSearchText('t');
typeSearchText('');
expect(loadOptions, 'was called times', 3);
it('should handle an error by setting options to an empty array', () => {
function loadOptions (input, resolve) {
resolve(new Error('error'));
}
createControl({
cache: false,
loadOptions,
options: createOptionsResponse(['foo']).options
});
expect(asyncNode.querySelectorAll('[role=option]').length, 'to equal', 1);
typeSearchText('bar');
expect(asyncNode.querySelectorAll('[role=option]').length, 'to equal', 0);
});
});
describe('=3', () => {
beforeEach(() => {
renderer.render(<Select.Async loadOptions={loadOptions} minimumInput={3} cache={false} />);
describe('with promises', () => {
it('should display the loaded options', () => {
let promise;
function loadOptions (input) {
promise = expect.promise((resolve, reject) => {
resolve(createOptionsResponse(['foo']));
});
return promise;
}
createControl({
autoload: false,
cache: false,
loadOptions
});
expect(asyncNode.querySelectorAll('[role=option]').length, 'to equal', 0);
typeSearchText('foo');
return expect.promise.all([promise])
.then(() => expect(asyncNode.querySelectorAll('[role=option]').length, 'to equal', 1))
.then(() => expect(asyncNode.querySelector('[role=option]').textContent, 'to equal', 'foo'));
});
it('does not call loadOptions initially', () => {
renderer._instance._instance.componentDidMount();
expect(loadOptions, 'was not called');
it('should display the most recently-requested loaded options (if results are returned out of order)', () => {
createControl({
autoload: false,
cache: false
});
let resolveFoo, resolveBar;
const promiseFoo = expect.promise((resolve, reject) => {
resolveFoo = resolve;
});
const promiseBar = expect.promise((resolve, reject) => {
resolveBar = resolve;
});
loadOptions.withArgs('foo').returns(promiseFoo);
loadOptions.withArgs('bar').returns(promiseBar);
typeSearchText('foo');
typeSearchText('bar');
expect(asyncNode.querySelectorAll('[role=option]').length, 'to equal', 0);
resolveBar(createOptionsResponse(['bar']));
resolveFoo(createOptionsResponse(['foo']));
return expect.promise.all([promiseFoo, promiseBar])
.then(() => expect(asyncNode.querySelectorAll('[role=option]').length, 'to equal', 1))
.then(() => expect(asyncNode.querySelector('[role=option]').textContent, 'to equal', 'bar'));
});
it('does not call loadOptions when 2 characters are entered', () => {
typeSearchText('te');
expect(loadOptions, 'was not called');
it('should handle an error by setting options to an empty array', () => {
let promise, rejectPromise;
function loadOptions (input, resolve) {
promise = expect.promise((resolve, reject) => {
rejectPromise = reject;
});
return promise;
}
createControl({
autoload: false,
cache: false,
loadOptions,
options: createOptionsResponse(['foo']).options
});
expect(asyncNode.querySelectorAll('[role=option]').length, 'to equal', 1);
typeSearchText('bar');
rejectPromise(new Error('error'));
return expect.promise.all([promise])
.catch(() => expect(asyncNode.querySelectorAll('[role=option]').length, 'to equal', 0));
});
it('calls loadOptions when 3 characters are entered', () => {
typeSearchText('tes');
expect(loadOptions, 'was called');
});
it('resets to `type to search` when text returns to < 3', () => {
typeSearchText('tes');
loadOptions.args[0][1](null, { options: [ { value: 1, label: 'test1' } ] });
typeSearchText('te');
return expect(renderer, 'to have rendered',
<Select
options={ [] }
placeholder="Select..."
noResultsText="Type to search"
/>);
});
});

@@ -508,13 +267,7 @@ });

describe('with ignoreAccents', () => {
beforeEach(() => {
renderer.render(<Select.Async
loadOptions={loadOptions}
ignoreAccents={true}
ignoreCase={false}
cache={false} />);
});
it('calls loadOptions with unchanged text', () => {
createControl({
ignoreAccents: true,
ignoreCase: false
});
typeSearchText('TeSt');

@@ -524,3 +277,7 @@ expect(loadOptions, 'was called with', 'TeSt');

it('calls loadOptions with accents stripped', () => {
it('strips accents before calling loadOptions when enabled', () => {
createControl({
ignoreAccents: true,
ignoreCase: false
});
typeSearchText('Gedünstmaßig');

@@ -530,17 +287,48 @@ // This should really be Gedunstmassig: ß -> ss

});
it('does not strip accents before calling loadOptions when diabled', () => {
createControl({
ignoreAccents: false,
ignoreCase: false
});
typeSearchText('Gedünstmaßig');
expect(loadOptions, 'was called with', 'Gedünstmaßig');
});
});
describe('with ignore case', () => {
it('converts everything to lowercase when enabled', () => {
createControl({
ignoreAccents: false,
ignoreCase: true
});
typeSearchText('TeSt');
expect(loadOptions, 'was called with', 'test');
});
beforeEach(() => {
it('converts accents to lowercase when enabled', () => {
createControl({
ignoreAccents: false,
ignoreCase: true
});
typeSearchText('WÄRE');
expect(loadOptions, 'was called with', 'wäre');
});
renderer.render(<Select.Async
loadOptions={loadOptions}
ignoreAccents={false}
ignoreCase={true}
cache={false} />);
it('does not convert text to lowercase when disabled', () => {
createControl({
ignoreAccents: false,
ignoreCase: false
});
typeSearchText('WÄRE');
expect(loadOptions, 'was called with', 'WÄRE');
});
});
describe('with ignore case and ignore accents', () => {
it('converts everything to lowercase', () => {
createControl({
ignoreAccents: true,
ignoreCase: true
});
typeSearchText('TeSt');

@@ -550,30 +338,70 @@ expect(loadOptions, 'was called with', 'test');

it('converts accents to lowercase', () => {
it('removes accents and converts to lowercase', () => {
createControl({
ignoreAccents: true,
ignoreCase: true
});
typeSearchText('WÄRE');
expect(loadOptions, 'was called with', 'wäre');
expect(loadOptions, 'was called with', 'ware');
});
});
describe('with ignore case and ignore accents', () => {
describe('noResultsText', () => {
beforeEach(() => {
createControl({
searchPromptText: 'searchPromptText',
loadingPlaceholder: 'loadingPlaceholder',
noResultsText: 'noResultsText',
});
});
renderer.render(<Select.Async
loadOptions={loadOptions}
ignoreAccents={true}
ignoreCase={true}
cache={false} />);
describe('before the user inputs text', () => {
it('returns the searchPromptText', () => {
expect(asyncInstance.noResultsText(), 'to equal', 'searchPromptText');
});
});
it('converts everything to lowercase', () => {
typeSearchText('TeSt');
expect(loadOptions, 'was called with', 'test');
describe('while results are loading', () => {
beforeEach((cb) => {
asyncInstance.setState({
isLoading: true,
}, cb);
});
it('returns the loading indicator', () => {
asyncInstance.select = { state: { inputValue: 'asdf' } };
expect(asyncInstance.noResultsText(), 'to equal', 'loadingPlaceholder');
});
});
it('removes accents and converts to lowercase', () => {
describe('after an empty result set loads', () => {
beforeEach((cb) => {
asyncInstance.setState({
isLoading: false,
}, cb);
});
typeSearchText('WÄRE');
expect(loadOptions, 'was called with', 'ware');
describe('if noResultsText has been provided', () => {
it('returns the noResultsText', () => {
asyncInstance.select = { state: { inputValue: 'asdf' } };
expect(asyncInstance.noResultsText(), 'to equal', 'noResultsText');
});
});
describe('if noResultsText is empty', () => {
beforeEach((cb) => {
createControl({
searchPromptText: 'searchPromptText',
loadingPlaceholder: 'loadingPlaceholder'
});
asyncInstance.setState({
isLoading: false,
inputValue: 'asdfkljhadsf'
}, cb);
});
it('falls back to searchPromptText', () => {
asyncInstance.select = { state: { inputValue: 'asdf' } };
expect(asyncInstance.noResultsText(), 'to equal', 'searchPromptText');
});
});
});

@@ -585,13 +413,12 @@ });

let childProps;
const node = ReactDOM.findDOMNode(
TestUtils.renderIntoDocument(
<Select.Async loadOptions={loadOptions}>
{(props) => {
childProps = props;
return <div>faux select</div>;
}}
</Select.Async>
)
);
expect(node.textContent, 'to equal', 'faux select');
createControl({
autoload: true,
children: (props) => {
childProps = props;
return (
<div>faux select</div>
);
}
});
expect(asyncNode.textContent, 'to equal', 'faux select');
expect(childProps.isLoading, 'to equal', true);

@@ -601,10 +428,30 @@ });

it('should render a Select component by default', () => {
const node = ReactDOM.findDOMNode(
TestUtils.renderIntoDocument(
<Select.Async loadOptions={loadOptions} />
)
);
expect(node.className, 'to contain', 'Select');
createControl();
expect(asyncNode.className, 'to contain', 'Select');
});
});
describe('with onInputChange', () => {
it('should call onInputChange', () => {
const onInputChange = sinon.stub();
createControl({
onInputChange,
});
typeSearchText('a');
return expect(onInputChange, 'was called times', 1);
});
});
describe('.focus()', () => {
beforeEach(() => {
createControl({});
});
it('focuses the search input', () => {
var input = asyncNode.querySelector('input');
expect(input, 'not to equal', document.activeElement);
asyncInstance.focus();
expect(input, 'to equal', document.activeElement);
});
});
});

@@ -235,2 +235,7 @@ 'use strict';

});
it('default :onInputKeyDown should run user provided handler.', (done) => {
createControl({ onInputKeyDown: event => done() });
return creatableInstance.onInputKeyDown({ keyCode: 97 });
});
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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