react-selectize
Version:
A Stateless & Flexible Select component for React inspired by Selectize
2 lines • 38.2 kB
JavaScript
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.reactSelectize=e()}}(function(){return function e(n,t,o){function r(s,u){if(!t[s]){if(!n[s]){var l="function"==typeof require&&require;if(!u&&l)return l(s,!0);if(i)return i(s,!0);var p=new Error("Cannot find module '"+s+"'");throw p.code="MODULE_NOT_FOUND",p}var a=t[s]={exports:{}};n[s][0].call(a.exports,function(e){var t=n[s][1][e];return r(t?t:e)},a,a.exports,e,n,t,o)}return t[s].exports}for(var i="function"==typeof require&&require,s=0;s<o.length;s++)r(o[s]);return r}({1:[function(e,n,t){(function(){var t,o,r,i;t=e("./HighlightedText"),o=e("./SimpleSelect"),r=e("./MultiSelect"),i=e("./ReactSelectize"),n.exports={HighlightedText:t,SimpleSelect:o,MultiSelect:r,ReactSelectize:i}}).call(this)},{"./HighlightedText":4,"./MultiSelect":5,"./ReactSelectize":7,"./SimpleSelect":10}],2:[function(e,n,t){(function(e){(function(){var t,o,r;t="undefined"!=typeof window?window.React:"undefined"!=typeof e?e.React:null,o=t.createClass,r=t.DOM.div,n.exports=o({getDefaultProps:function(){return{className:"",onHeightChange:function(){}}},render:function(){return r({className:this.props.className,ref:"dropdown"},this.props.children)},componentDidMount:function(){this.props.onHeightChange(this.refs.dropdown.offsetHeight)},componentDidUpdate:function(){this.props.onHeightChange(this.refs.dropdown.offsetHeight)},componentWillUnmount:function(){this.props.onHeightChange(0)}})}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],3:[function(e,n,t){(function(t){(function(){function o(e,n){var t={}.hasOwnProperty;for(var o in n)t.call(n,o)&&(e[o]=n[o]);return e}var r,i,s,u,l,p,a,c,h,d,f,g,v,w,m,y,O,b;r=e("prelude-ls"),i=r.filter,s=r.id,u=r.map,l=("undefined"!=typeof window?window.preludeExtension:"undefined"!=typeof t?t.preludeExtension:null).isEqualToObject,p="undefined"!=typeof window?window.React:"undefined"!=typeof t?t.React:null,r=p.DOM,a=r.div,c=r.input,h=r.span,d=p.createClass,f=p.createFactory,g=("undefined"!=typeof window?window.ReactDOM:"undefined"!=typeof t?t.ReactDOM:null).findDOMNode,v=f("undefined"!=typeof window?window.React.addons.CSSTransitionGroup:"undefined"!=typeof t?t.React.addons.CSSTransitionGroup:null),w=f(e("./ReactTether")),m=f(e("./Div")),y=f(e("./OptionWrapper")),r=e("./utils"),O=r.cancelEvent,b=r.classNameFromObject,n.exports=d({displayName:"DropdownMenu",getDefaultProps:function(){return{className:"",dropdownDirection:1,groupId:function(e){return e.groupId},groupsAsColumns:!1,highlightedUid:void 0,onHighlightedUidChange:function(e,n){},onOptionClick:function(e){},onScrollLockChange:function(e){},options:[],renderNoResultsFound:function(){return a({className:"no-results-found"},"No results found")},renderGroupTitle:function(e,n){var t,o;return null!=n&&(t=n.groupId,o=n.title),a({className:"simple-group-title",key:t},o)},renderOption:function(e){var n,t,o,r;return null!=e&&(n=e.label,t=e.newOption,o=e.selectable),r="undefined"==typeof o||o,a({className:"simple-option "+(r?"":"not-selectable")},h(null,t?"Add "+n+" ...":n))},scrollLock:!1,style:{},tether:!1,theme:"default",transitionEnter:!1,transitionLeave:!1,transitionEnterTimeout:200,transitionLeaveTimeout:200,uid:s}},render:function(){var e,n;return e=b((n={},n[this.props.theme+""]=1,n[this.props.className+""]=1,n.flipped=-1===this.props.dropdownDirection,n.tethered=this.props.tether,n)),this.props.tether?w({target:this.props.tetherTarget,options:{attachment:"top left",targetAttachment:"bottom left",constraints:[{to:"scrollParent"}]}},this.renderAnimatedDropdown({dynamicClassName:e})):this.renderAnimatedDropdown({dynamicClassName:e})},renderAnimatedDropdown:function(e){var n;return n=e.dynamicClassName,this.props.transitionEnter||this.props.transitionLeave?v({component:"div",transitionName:"custom",transitionEnter:this.props.transitionEnter,transitionLeave:this.props.transitionLeave,transitionEnterTimeout:this.props.transitionEnterTimeout,transitionLeaveTimeout:this.props.transitionLeaveTimeout,className:"dropdown-menu-wrapper "+n,ref:"dropdownMenuWrapper"},this.renderDropdown(e)):this.renderDropdown(e)},renderOptions:function(e){var n=this;return u(function(t){var r,i;return r=e[t],i=n.props.uid(r),y(o({uid:i,ref:"option-"+n.uidToString(i),key:n.uidToString(i),item:r,highlight:l(n.props.highlightedUid,i),selectable:null!=r?r.selectable:void 0,onMouseMove:function(e){var t;t=e.currentTarget,n.props.scrollLock&&n.props.onScrollLockChange(!1)},onMouseOut:function(){n.props.scrollLock||n.props.onHighlightedUidChange(void 0)},renderItem:n.props.renderOption},function(){switch(!1){case!("boolean"==typeof(null!=r?r.selectable:void 0)&&!r.selectable):return{onClick:O};default:return{onClick:function(){n.props.onOptionClick(n.props.highlightedUid)},onMouseOver:function(e){var t;t=e.currentTarget,n.props.scrollLock||n.props.onHighlightedUidChange(i)}}}}()))})(function(){var n,t,o=[];for(n=0,t=e.length;t>n;++n)o.push(n);return o}())},renderDropdown:function(e){var n,t,o,r,s=this;return n=e.dynamicClassName,this.props.open?m({className:"dropdown-menu "+n,ref:"dropdownMenu",onHeightChange:function(e){s.refs.dropdownMenuWrapper&&(g(s.refs.dropdownMenuWrapper).style.height=e+"px")}},0===this.props.options.length?this.props.renderNoResultsFound():(null!=(t=this.props)&&null!=(o=t.groups)?o.length:void 0)>0?(r=u(function(e){var n,t,o;return n=s.props.groups[e],t=n.groupId,o=i(function(e){return s.props.groupId(e)===t})(s.props.options),{index:e,group:n,options:o}})(function(){var e,n,t=[];for(e=0,n=this.props.groups.length;n>e;++e)t.push(e);return t}.call(this)),a({className:"groups "+(this.props.groupsAsColumns?"as-columns":"")},u(function(e){var n,t,o,r;return n=e.index,t=e.group,o=t.groupId,r=e.options,a({key:o},s.props.renderGroupTitle(n,t,r),a({className:"options"},s.renderOptions(r)))})(i(function(e){return e.options.length>0})(r)))):this.renderOptions(this.props.options)):null},componentDidUpdate:function(){var e,n,t;e=n=g(null!=(t=this.refs.dropdownMenuWrapper)?t:this.refs.dropdownMenu),null!=e&&(e.style.bottom=function(){switch(!1){case-1!==this.props.dropdownDirection:return this.props.bottomAnchor().offsetHeight+n.style.marginBottom;default:return""}}.call(this))},highlightAndScrollToOption:function(e,n){var t,o=this;null==n&&(n=function(){}),t=this.props.uid(this.props.options[e]),this.props.onHighlightedUidChange(t,function(){var e,r,i,s,u;return null!=(e=g(null!=(r=o.refs)?r["option-"+o.uidToString(t)]:void 0))&&(i=e),i&&(s=g(o.refs.dropdownMenu),u=i.offsetHeight-1,i.offsetTop-s.scrollTop>=s.offsetHeight?s.scrollTop=i.offsetTop-s.offsetHeight+u:i.offsetTop-s.scrollTop+u<=0&&(s.scrollTop=i.offsetTop)),n()})},highlightAndScrollToSelectableOption:function(e,n,t){var o,r,i;null==t&&(t=function(){}),0>e||e>=this.props.options.length?this.props.onHighlightedUidChange(void 0,function(){return t(!1)}):(o=null!=(r=this.props)&&null!=(i=r.options)?i[e]:void 0,"boolean"!=typeof(null!=o?o.selectable:void 0)||o.selectable?this.highlightAndScrollToOption(e,function(){return t(!0)}):this.highlightAndScrollToSelectableOption(e+n,n,t))},uidToString:function(e){return("object"==typeof e?JSON.stringify:s)(e)}})}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./Div":2,"./OptionWrapper":6,"./ReactTether":8,"./utils":12,"prelude-ls":void 0}],4:[function(e,n,t){(function(t){(function(){var o,r,i,s,u,l;o="undefined"!=typeof window?window.React:"undefined"!=typeof t?t.React:null,r=o.createClass,i=o.DOM,s=i.div,u=i.span,l=e("prelude-ls").map,n.exports=r({getDefaultProps:function(){return{partitions:[],text:"",style:{},highlightStyle:{}}},render:function(){var e=this;return s({className:"highlighted-text",style:this.props.style},l(function(n){var t,o,r;return t=n[0],o=n[1],r=n[2],u({key:e.props.text+""+t+o+r,className:r?"highlight":"",style:r?e.props.highlightStyle:{}},e.props.text.substring(t,o))})(this.props.partitions))}})}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"prelude-ls":void 0}],5:[function(e,n,t){(function(t){(function(){function o(e,n){for(var t=-1,o=n.length>>>0;++t<o;)if(e===n[t])return!0;return!1}function r(e,n){var t,o=function(r){return e.length>1?function(){var i=r?r.concat():[];return t=n?t||this:this,i.push.apply(i,arguments)<e.length&&arguments.length?o.call(t,i):e.apply(t,i)}:e};return o()}function i(e,n){var t={}.hasOwnProperty;for(var o in n)t.call(n,o)&&(e[o]=n[o]);return e}var s,u,l,p,a,c,h,d,f,g,v,w,m,y,O,b,S,C,T,x,D={}.toString;s=e("prelude-ls"),u=s.all,l=s.any,p=s.camelize,a=s.difference,c=s.drop,h=s.filter,d=s.find,f=s.findIndex,g=s.last,v=s.map,w=s.reject,m=("undefined"!=typeof window?window.preludeExtension:"undefined"!=typeof t?t.preludeExtension:null).isEqualToObject,y="undefined"!=typeof window?window.React:"undefined"!=typeof t?t.React:null,O=y.createFactory,s=y.DOM,b=s.div,S=s.img,C=s.span,T=O(e("./ReactSelectize")),x=e("./utils").cancelEvent,n.exports=y.createClass({displayName:"MultiSelect",getDefaultProps:function(){return{className:"",closeOnSelect:!1,defaultValues:[],delimiters:[],filterOptions:r(function(e,n,t){return h(function(e){return e.label.toLowerCase().trim().indexOf(t.toLowerCase().trim())>-1})(w(function(e){return o(e.label.trim(),v(function(e){return e.label.trim()},null!=n?n:[]))})(e))}),onBlur:function(e){},onFocus:function(e){},onPaste:function(e){},serialize:v(function(e){return null!=e?e.value:void 0}),tether:!1}},render:function(){var e,n,t,o,r,s,u,l,p,a,c,h,d,f,v,w,m,y,O,b,S,C,D,N,M,R,E,L,P,A,F=this;return e=this.getComputedState(),n=e.anchor,t=e.filteredOptions,o=e.onAnchorChange,r=e.onOpenChange,s=e.onSearchChange,u=e.onValuesChange,l=e.search,p=e.open,a=e.options,c=e.values,null!=(e=this.props)&&(h=e.autofocus,d=e.autosize,f=e.delimiters,v=e.disabled,w=e.dropdownDirection,m=e.groupId,y=e.groups,O=e.groupsAsColumns,b=e.name,S=e.onKeyboardSelectionFailed,C=e.renderGroupTitle,D=e.serialize,N=e.tether,M=e.theme,R=e.transitionEnter,E=e.transitionLeave,L=e.transitionEnterTimeout,P=e.transitionLeaveTimeout,A=e.uid),T(i(i({autofocus:h,autosize:d,className:"multi-select "+this.props.className,delimiters:f,disabled:v,dropdownDirection:w,groupId:m,groups:y,groupsAsColumns:O,name:b,onKeyboardSelectionFailed:S,renderGroupTitle:C,scrollLock:this.state.scrollLock,onScrollLockChange:function(e){return F.setState({scrollLock:e})},tether:N,theme:M,transitionEnter:R,transitionEnterTimeout:L,transitionLeave:E,transitionLeaveTimeout:P,uid:A,ref:"select",anchor:n,onAnchorChange:o,open:p,onOpenChange:r,highlightedUid:this.state.highlightedUid,onHighlightedUidChange:function(e,n){return F.setState({highlightedUid:e},n)},options:a,renderOption:this.props.renderOption,firstOptionIndexToHighlight:function(){return F.firstOptionIndexToHighlight(a)},search:l,onSearchChange:function(e,n){return s(F.props.maxValues&&c.length>=F.props.maxValues?"":e,n)},values:c,onValuesChange:function(e,n){return u(e,function(){return n(),F.props.closeOnSelect||F.props.maxValues&&F.values().length>=F.props.maxValues?r(!1,function(){}):void 0})},renderValue:this.props.renderValue,serialize:D,onBlur:function(e){s("",function(){return F.props.onBlur({open:p,values:c,originalEvent:e})})},onFocus:function(e){F.props.onFocus({open:p,values:c,originalEvent:e})},onPaste:function(){var e;switch(!1){case"undefined"!=typeof(null!=(e=this.props)?e.valuesFromPaste:void 0):return this.props.onPaste;default:return function(e){var n;return n=e.clipboardData,function(){var e;return e=c.concat(F.props.valuesFromPaste(a,c,n.getData("text"))),u(e,function(){return o(g(e))})}(),x(e)}}}.call(this),placeholder:this.props.placeholder,style:this.props.style},function(){switch(!1){case"function"!=typeof this.props.restoreOnBackspace:return{restoreOnBackspace:this.props.restoreOnBackspace};default:return{}}}.call(this)),function(){switch(!1){case"function"!=typeof this.props.renderNoResultsFound:return{renderNoResultsFound:function(){return F.props.renderNoResultsFound(c,l)}};default:return{}}}.call(this)))},getComputedState:function(){var e,n,t,o,r,s,u,l,a,c,h,d,f,g,w=this;return e=this.props.hasOwnProperty("anchor")?this.props.anchor:this.state.anchor,n=this.isOpen(),t=this.props.hasOwnProperty("search")?this.props.search:this.state.search,o=this.values(),r=v(function(e){switch(!1){case!(w.props.hasOwnProperty(e)&&w.props.hasOwnProperty(p("on-"+e+"-change"))):return function(n,t){return w.props[p("on-"+e+"-change")](n,function(){}),w.setState({},t)};case!(w.props.hasOwnProperty(e)&&!w.props.hasOwnProperty(p("on-"+e+"-change"))):return function(e,n){return n()};case!(!w.props.hasOwnProperty(e)&&w.props.hasOwnProperty(p("on-"+e+"-change"))):return function(n,t){var o;return w.setState((o={},o[e+""]=n,o),function(){return t(),w.props[p("on-"+e+"-change")](n,function(){})})};case!(!w.props.hasOwnProperty(e)&&!w.props.hasOwnProperty(p("on-"+e+"-change"))):return function(n,t){var o;return w.setState((o={},o[e+""]=n,o),t)}}})(["anchor","open","search","values"]),s=r[0],u=r[1],l=r[2],a=r[3],c=function(){var e;switch(!1){case!(null!=(e=this.props)&&e.children):return v(function(e){var n,t,o;return null!=e&&(n=e.props),null!=n&&(t=n.value,o=n.children),{label:o,value:t}})("Array"===D.call(this.props.children).slice(8,-1)?this.props.children:[this.props.children]);default:return[]}}.call(this),h=this.props.hasOwnProperty("options")?null!=(r=this.props.options)?r:[]:c,d=this.props.filterOptions(h,o,t),f=function(){switch(!1){case"function"!=typeof this.props.createFromSearch:return this.props.createFromSearch(d,o,t);default:return null}}.call(this),g=(f?[(r=i({},f),r.newOption=!0,r)]:[]).concat(d),{anchor:e,search:t,values:o,onAnchorChange:s,open:n,onOpenChange:function(e,n){u(function(){switch(!1){case!("undefined"!=typeof this.props.maxValues&&this.values().length>=this.props.maxValues):return!1;default:return e}}.call(w),n)},onSearchChange:l,onValuesChange:a,filteredOptions:d,options:g}},getInitialState:function(){return{anchor:this.props.values?g(this.props.values):void 0,highlightedUid:void 0,open:!1,scrollLock:!1,search:"",values:this.props.defaultValues}},firstOptionIndexToHighlight:function(e){var n;switch(!1){case 1!==e.length:return 0;case"undefined"!=typeof(null!=(n=e[0])?n.newOption:void 0):return 0;default:return u(function(e){return"boolean"==typeof e.selectable&&!e.selectable})(c(1)(e))?0:1}},focus:function(){this.refs.select.focus()},blur:function(){this.refs.select.blur()},highlightFirstSelectableOption:function(){this.state.open&&this.refs.select.highlightAndScrollToSelectableOption(this.firstOptionIndexToHighlight(this.getComputedState().options),1)},values:function(){return this.props.hasOwnProperty("values")?this.props.values:this.state.values},isOpen:function(){return this.props.hasOwnProperty("open")?this.props.open:this.state.open}})}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./ReactSelectize":7,"./utils":12,"prelude-ls":void 0}],6:[function(e,n,t){(function(t){(function(){var o,r,i,s,u;o="undefined"!=typeof window?window.React:"undefined"!=typeof t?t.React:null,r=o.createClass,i=o.DOM.div,s=("undefined"!=typeof window?window.preludeExtension:"undefined"!=typeof t?t.preludeExtension:null).isEqualToObject,u=e("./utils").cancelEvent,n.exports=r({getDefaultProps:function(){return{}},render:function(){var e=this;return i({className:"option-wrapper "+(this.props.highlight?"highlight":""),onMouseDown:function(n){var t;return t=function(n){return e.props.onClick(n),window.removeEventListener("mouseup",t)},window.addEventListener("mouseup",t),u(n)},onMouseMove:this.props.onMouseMove,onMouseOut:this.props.onMouseOut,onMouseOver:this.props.onMouseOver},this.props.renderItem(this.props.item))},shouldComponentUpdate:function(e){var n,t,o;return!s(null!=e?e.uid:void 0,null!=(n=this.props)?n.uid:void 0)||(null!=e?e.highlight:void 0)!==(null!=(t=this.props)?t.highlight:void 0)||(null!=e?e.selectable:void 0)!==(null!=(o=this.props)?o.selectable:void 0)}})}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./utils":12}],7:[function(e,n,t){(function(t){(function(){function o(e,n){var t={}.hasOwnProperty;for(var o in n)t.call(n,o)&&(e[o]=n[o]);return e}function r(e,n){for(var t=-1,o=n.length>>>0;++t<o;)if(e===n[t])return!0;return!1}var i,s,u,l,p,a,c,h,d,f,g,v,w,m,y,O,b,S,C,T,x,D,N,M,R,E,L,P,A,F,k,I,U,H,z,V;i=e("prelude-ls"),s=i.each,u=i.filter,l=i.find,p=i.findIndex,a=i.id,c=i.initial,h=i.last,d=i.map,f=i.objToPairs,g=i.partition,v=i.reject,w=i.reverse,m=i.Str,y=i.sortBy,O=i.sum,b=i.values,i="undefined"!=typeof window?window.preludeExtension:"undefined"!=typeof t?t.preludeExtension:null,S=i.clamp,C=i.isEqualToObject,T="undefined"!=typeof window?window.React:"undefined"!=typeof t?t.React:null,i=T.DOM,x=i.div,D=i.input,N=i.path,M=i.span,R=i.svg,E=T.createClass,L=T.createFactory,P=("undefined"!=typeof window?window.ReactDOM:"undefined"!=typeof t?t.ReactDOM:null).findDOMNode,A=L("undefined"!=typeof window?window.React.addons.CSSTransitionGroup:"undefined"!=typeof t?t.React.addons.CSSTransitionGroup:null),F=L(e("./Div")),k=L(e("./DropdownMenu")),I=L(e("./OptionWrapper")),U=L(e("./ValueWrapper")),H=L(e("./ResizableInput")),i=e("./utils"),z=i.cancelEvent,V=i.classNameFromObject,n.exports=E({displayName:"ReactSelectize",focusLock:!1,getDefaultProps:function(){return{anchor:null,autofocus:!1,delimiters:[],disabled:!1,dropdownDirection:1,firstOptionIndexToHighlight:function(e){return 0},groupId:function(e){return e.groupId},groupsAsColumns:!1,highlightedUid:void 0,onAnchorChange:function(e){},onBlur:function(e){},onEnter:function(e){},onFocus:function(e){},onHighlightedUidChange:function(e,n){},onKeyboardSelectionFailed:function(e){},onOpenChange:function(e,n){},onPaste:function(e){},onScrollLockChange:function(e){},onSearchChange:function(e,n){},onValuesChange:function(e,n){},open:!1,renderValue:function(e){var n;return n=e.label,x({className:"simple-value"},M(null,n))},scrollLock:!1,search:"",style:{},theme:"default",uid:a,values:[]}},render:function(){var e,n,t,r,i,s=this;return e=function(){var e;switch(!1){case!("undefined"==typeof this.props.anchor||null===this.props.anchor):return-1;default:return null!=(e=p(function(e){return s.isEqualToObject(e,s.props.anchor)},this.props.values))?e:this.props.values.length-1}}.call(this),n=function(e){return d(function(e){var n,t;return n=s.props.values[e],t=s.props.uid(n),U({key:s.uidToString(t),uid:t,item:n,renderItem:s.props.renderValue})})(e)},t=-1===this.props.dropdownDirection,x({className:V((r={"react-selectize":1},r[this.props.theme+""]=1,r["control-wrapper"]=1,r[this.props.className+""]=1,r.disabled=this.props.disabled,r.open=this.props.open,r.flipped=t,r.tethered=this.props.tether,r)),style:this.props.style},this.props.name?D({type:"hidden",name:this.props.name,value:this.props.serialize(this.props.values)}):void 0,x({className:"react-selectize-control",ref:"control",onMouseDown:function(e){return function(){return s.props.onAnchorChange(h(s.props.values),function(){return s.onOpenChange(!0,function(){return s.highlightAndFocus()})})}(),z(e)}},0===this.props.search.length&&0===this.props.values.length?x({className:"react-selectize-placeholder"},this.props.placeholder):void 0,x({className:"react-selectize-selected-values"},n(function(){var n,t,o=[];for(n=0,t=e;t>=n;++n)o.push(n);return o}()),H({disabled:this.props.disabled,ref:"search",type:"text",value:this.props.search,onChange:function(e){var n;return n=e.currentTarget.value,s.props.onSearchChange(n,function(){return s.highlightAndScrollToSelectableOption(s.props.firstOptionIndexToHighlight(s.props.options),1)})},onFocus:function(e){!function(){return function(e){return s.focusLock?e(s.focusLock=!1):s.onOpenChange(!0,function(){return e(!0)})}}()(function(){return s.props.onFocus(e)})},onBlur:function(e){return s.refs.dropdownMenu&&document.activeElement===P(s.refs.dropdownMenu)?void 0:s.closeDropdown(function(){return s.props.onBlur(e)})},onPaste:this.props.onPaste,onKeyDown:function(n){return s.handleKeydown({anchorIndex:e},n)}}),n(function(){var n,t,o=[];for(n=e+1,t=this.props.values.length;t>n;++n)o.push(n);return o}.call(this))),this.props.values.length>0?x({className:"react-selectize-reset-container",onClick:function(e){return function(){return s.props.onValuesChange([],function(){return s.props.onSearchChange("",function(){return s.highlightAndFocus()})})}(),z(e)}},R({className:"react-selectize-reset",style:{width:8,height:8}},N({d:"M0 0 L8 8 M8 0 L 0 8"}))):void 0,x({className:"react-selectize-arrow-container",onMouseDown:function(e){return s.props.open?s.onOpenChange(!1,function(){}):s.props.onAnchorChange(h(s.props.values),function(){return s.onOpenChange(!0,function(){})}),z(e)}},R({className:"react-selectize-arrow",style:{width:10,height:8}},N({d:function(){switch(!1){case!(this.props.open&&!t||!this.props.open&&t):return"M0 6 L5 1 L10 6 Z";default:return"M0 1 L5 6 L10 1 Z"}}.call(this)})))),k((r=o({},this.props),r.ref="dropdownMenu",r.className=V((i={"react-selectize":1},i[this.props.className+""]=1,i)),r.theme=this.props.theme,r.scrollLock=this.props.scrollLock,r.onScrollChange=this.props.onScrollChange,r.bottomAnchor=function(){return P(s.refs.control)},r.tetherTarget=function(){return P(s.refs.control)},r.onOptionClick=function(n){s.selectHighlightedUid(e,function(){})},r)))},handleKeydown:function(e,n){var t,o,i=this;switch(t=e.anchorIndex,n.which){case 8:if(this.props.search.length>0||-1===t)return;!function(){var e,n,o,r;return e=t,n=0>t-1?void 0:i.props.values[t-1],o=i.props.values[t],i.props.onValuesChange(null!=(r=v(function(e){return i.isEqualToObject(e,o)})(i.props.values))?r:[],function(){return function(){return function(e){return"undefined"==typeof l(function(e){return i.isEqualToObject(e,o)},i.props.values)?i.props.restoreOnBackspace?i.props.onSearchChange(i.props.restoreOnBackspace(o),function(){return e(!0)}):e(!0):e(!1)}}()(function(o){return o&&(i.highlightAndScrollToSelectableOption(i.props.firstOptionIndexToHighlight(i.props.options),1),t===e&&("undefined"==typeof n||l(function(e){return i.isEqualToObject(e,n)})(i.props.values)))?i.props.onAnchorChange(n,function(){}):void 0})})}(),z(n);break;case 27:!function(){return i.props.open?function(e){return i.onOpenChange(!1,e)}:function(e){return i.props.onValuesChange([],e)}}()(function(){return i.props.onSearchChange("",function(){return i.focusOnInput()})})}if(this.props.open&&r(n.which,[13].concat(this.props.delimiters))&&!(null!=n&&n.metaKey||null!=n&&n.ctrlKey))return this.selectHighlightedUid(t,function(e){return"undefined"==typeof e?i.props.onKeyboardSelectionFailed(n.which):void 0}),z(n);if(0===this.props.search.length)switch(n.which){case 37:this.props.onAnchorChange(0>t-1||n.metaKey?void 0:this.props.values[S(t-1,0,this.props.values.length-1)],function(){});break;case 39:this.props.onAnchorChange(n.metaKey?h(this.props.values):this.props.values[S(t+1,0,this.props.values.length-1)],function(){})}switch(n.which){case 38:return this.props.onScrollLockChange(!0),o=function(){switch(!1){case"undefined"!=typeof this.props.highlightedUid:return 0;default:return-1+this.optionIndexFromUid(this.props.highlightedUid)}}.call(this),this.highlightAndScrollToSelectableOption(o,-1,function(e){return e?void 0:i.highlightAndScrollToSelectableOption(i.props.options.length-1,-1)});case 40:return this.props.onScrollLockChange(!0),o=function(){switch(!1){case"undefined"!=typeof this.props.highlightedUid:return 0;default:return 1+this.optionIndexFromUid(this.props.highlightedUid)}}.call(this),this.highlightAndScrollToSelectableOption(o,1,function(e){return e?void 0:i.highlightAndScrollToSelectableOption(0,1)})}},componentDidMount:function(){this.props.autofocus&&this.focus(),this.props.open&&this.highlightAndFocus()},componentDidUpdate:function(e){this.props.open&&!e.open&&void 0===this.props.highlightedUid&&this.highlightAndFocus(),!this.props.open&&e.open&&this.props.onHighlightedUidChange(void 0)},componentWillReceiveProps:function(e){"undefined"!=typeof this.props.disabled&&this.props.disabled!==!1||"undefined"==typeof e.disabled||e.disabled!==!0||this.onOpenChange(!1,function(){})},optionIndexFromUid:function(e){var n=this;return p(function(t){return C(e,n.props.uid(t))})(this.props.options)},closeDropdown:function(e){var n=this;this.onOpenChange(!1,function(){return n.props.onAnchorChange(h(n.props.values),e)})},blur:function(){this.refs.search.blur()},focus:function(){this.refs.search.focus()},focusOnInput:function(){var e;e=P(this.refs.search),e!==document.activeElement&&(this.focusLock=!0,e.focus(),e.value=e.value)},highlightAndFocus:function(){this.highlightAndScrollToSelectableOption(this.props.firstOptionIndexToHighlight(this.props.options),1),this.focusOnInput()},highlightAndScrollToOption:function(e,n){null==n&&(n=function(){}),this.refs.dropdownMenu.highlightAndScrollToOption(e,n)},highlightAndScrollToSelectableOption:function(e,n,t){var o=this;null==t&&(t=function(){}),function(){return o.props.open?function(e){return e()}:function(e){return o.onOpenChange(!0,e)}}()(function(){return o.refs.dropdownMenu.highlightAndScrollToSelectableOption(e,n,t)})},isEqualToObject:function(){return C(this.props.uid(arguments[0]),this.props.uid(arguments[1]))},onOpenChange:function(e,n){return this.props.onOpenChange(this.props.disabled?!1:e,n)},selectHighlightedUid:function(e,n){var t,o,r=this;return void 0===this.props.highlightedUid?n():(t=this.optionIndexFromUid(this.props.highlightedUid),"number"!=typeof t?n():(o=this.props.options[t],void this.props.onValuesChange(d(function(e){return r.props.values[e]},function(){var n,t,o=[];for(n=0,t=e;t>=n;++n)o.push(n);return o}()).concat([o],d(function(e){return r.props.values[e]},function(){var n,t,o=[];for(n=e+1,t=this.props.values.length;t>n;++n)o.push(n);return o}.call(this))),function(){var e;return e=l(function(e){return r.isEqualToObject(e,o)},r.props.values),e?r.props.onSearchChange("",function(){return r.props.onAnchorChange(e,function(){return r.props.open?r.highlightAndScrollToSelectableOption(t,1,function(t){return t?n(e):r.highlightAndScrollToSelectableOption(r.props.firstOptionIndexToHighlight(r.props.options),1,function(t){return t?n(e):r.onOpenChange(!1,function(){return n(e)})})}):n(e)})}):n()})))},uidToString:function(e){return("object"==typeof e?JSON.stringify:a)(e)}})}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./Div":2,"./DropdownMenu":3,"./OptionWrapper":6,"./ResizableInput":9,"./ValueWrapper":11,"./utils":12,"prelude-ls":void 0}],8:[function(e,n,t){(function(e){(function(){function t(e,n){var t={}.hasOwnProperty;for(var o in n)t.call(n,o)&&(e[o]=n[o]);return e}var o,r,i,s,u,l;o=("undefined"!=typeof window?window.React:"undefined"!=typeof e?e.React:null).createClass,r="undefined"!=typeof window?window.ReactDOM:"undefined"!=typeof e?e.ReactDOM:null,i=r.render,s=r.unmountComponentAtNode,u="undefined"!=typeof window?window.React.addons.shallowCompare:"undefined"!=typeof e?e.React.addons.shallowCompare:null,l="undefined"!=typeof window?window.Tether:"undefined"!=typeof e?e.Tether:null,n.exports=o({getDefaultProps:function(){return{}},render:function(){return null},initTether:function(e){var n=this;this.node=document.createElement("div"),document.body.appendChild(this.node),this.tether=new l(t({element:this.node,target:e.target()},e.options)),i(e.children,this.node,function(){return n.tether.position()})},destroyTether:function(){this.tether&&this.tether.destroy(),this.node&&(s(this.node),this.node.parentElement.removeChild(this.node)),this.node=this.tether=void 0},componentDidMount:function(){this.props.children&&this.initTether(this.props)},componentWillReceiveProps:function(e){var n=this;this.props.children&&!e.children?this.destroyTether():e.children&&!this.props.children?this.initTether(e):e.children&&(this.tether.setOptions(t({element:this.node,target:e.target()},e.options)),i(e.children,this.node,function(){return n.tether.position()}))},shouldComponentUpdate:function(e,n){return u(this,e,n)},componentWillUnmount:function(){this.destroyTether()}})}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],9:[function(e,n,t){(function(t){(function(){function o(e,n){var t={}.hasOwnProperty;for(var o in n)t.call(n,o)&&(e[o]=n[o]);return e}var r,i,s,u,l,p,a,c;r=e("prelude-ls"),i=r.each,s=r.objToPairs,u="undefined"!=typeof window?window.React:"undefined"!=typeof t?t.React:null,l=u.DOM.input,p=u.createClass,a=u.createFactory,c=("undefined"!=typeof window?window.ReactDOM:"undefined"!=typeof t?t.ReactDOM:null).findDOMNode,n.exports=p({displayName:"ResizableInput",render:function(){var e;return l((e=o({},this.props),e.type="input",e.className="resizable-input",e))},autosize:function(){var e,n,t,o,r;return e=n=c(this),e.style.width="0px",0===n.value.length?n.style.width=null!=n&&n.currentStyle?"4px":"2px":n.scrollWidth>0?n.style.width=2+n.scrollWidth+"px":(t=o=document.createElement("div"),t.innerHTML=n.value,function(){var e;return e=o.style,e.display="inline-block",e.width="",e}(i(function(e){var n,t;return n=e[0],t=e[1],o.style[n]=t})(s(n.currentStyle?n.currentStyle:null!=(r=document.defaultView)?r:window.getComputedStyle(n)))),document.body.appendChild(o),n.style.width=4+o.clientWidth+"px",document.body.removeChild(o))},componentDidMount:function(){this.autosize()},componentDidUpdate:function(){this.autosize()},blur:function(){return c(this).blur()},focus:function(){return c(this).focus()}})}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"prelude-ls":void 0}],10:[function(e,n,t){(function(t){(function(){function o(e,n){var t,o=function(r){return e.length>1?function(){var i=r?r.concat():[];return t=n?t||this:this,i.push.apply(i,arguments)<e.length&&arguments.length?o.call(t,i):e.apply(t,i)}:e};return o()}function r(e,n){var t={}.hasOwnProperty;for(var o in n)t.call(n,o)&&(e[o]=n[o]);return e}var i,s,u,l,p,a,c,h,d,f,g,v,w,m,y,O,b,S,C,T,x={}.toString;i=e("prelude-ls"),s=i.all,u=i.any,l=i.drop,p=i.camelize,a=i.difference,c=i.filter,h=i.find,d=i.findIndex,f=i.id,g=i.last,v=i.map,w=i.reject,m=("undefined"!=typeof window?window.preludeExtension:"undefined"!=typeof t?t.preludeExtension:null).isEqualToObject,y="undefined"!=typeof window?window.React:"undefined"!=typeof t?t.React:null,O=y.createFactory,i=y.DOM,b=i.div,S=i.img,C=i.span,T=O(e("./ReactSelectize")),n.exports=y.createClass({displayName:"SimpleSelect",getDefaultProps:function(){return{delimiters:[],filterOptions:o(function(e,n){return c(function(e){return e.label.toLowerCase().trim().indexOf(n.toLowerCase().trim())>-1})(e)}),onBlur:function(e){},onFocus:function(e){},onKeyboardSelectionFailed:function(e){},placeholder:"",renderValue:function(e){var n;return n=e.label,b({className:"simple-value"},C(null,n))},serialize:function(e){return null!=e?e.value:void 0},style:{},tether:!1,uid:f}},render:function(){var e,n,t,o,i,s,u,l,p,a,c,h,d,f,v,w,y,O,b,S,C,x,D,N,M,R,E,L,P=this;return e=this.getComputedState(),n=e.filteredOptions,t=e.onOpenChange,o=e.onSearchChange,i=e.onValueChange,s=e.open,u=e.options,l=e.search,p=e.value,a=e.values,null!=(e=this.props)&&(c=e.autofocus,h=e.autosize,d=e.delimiters,f=e.disabled,v=e.dropdownDirection,w=e.groupId,y=e.groups,O=e.groupsAsColumns,b=e.name,S=e.renderGroupTitle,C=e.serialize,x=e.tether,D=e.theme,N=e.transitionEnter,M=e.transitionLeave,R=e.transitionEnterTimeout,
E=e.transitionLeaveTimeout,L=e.uid),T(r(r({autofocus:c,autosize:h,className:"simple-select"+(this.props.className?" "+this.props.className:""),delimiters:d,disabled:f,dropdownDirection:v,groupId:w,groups:y,groupsAsColumns:O,name:b,renderGroupTitle:S,scrollLock:this.state.scrollLock,onScrollLockChange:function(e){return P.setState({scrollLock:e})},tether:x,theme:D,transitionEnter:N,transitionEnterTimeout:R,transitionLeave:M,transitionLeaveTimeout:E,ref:"select",anchor:g(a),onAnchorChange:function(e,n){return n()},open:s,onOpenChange:t,highlightedUid:this.state.highlightedUid,onHighlightedUidChange:function(e,n){return P.setState({highlightedUid:e},n)},firstOptionIndexToHighlight:function(){return P.firstOptionIndexToHighlight(u,p)},options:u,renderOption:this.props.renderOption,renderNoResultsFound:this.props.renderNoResultsFound,search:l,onSearchChange:function(e,n){return o(e,n)},values:a,onValuesChange:function(e,n){var o,r;return 0===e.length?i(void 0,function(){return n()}):(o=g(e),r=!m(o,p),function(){return function(e){return r?i(o,e):e()}}()(function(){return n(),t(!1,function(){})}))},renderValue:function(e){return s&&(P.props.editable||l.length>0)?null:P.props.renderValue(e)},onKeyboardSelectionFailed:function(e){return o("",function(){return t(!1,function(){return P.props.onKeyboardSelectionFailed(e)})})},uid:function(e){return{uid:P.props.uid(e),open:s,search:l}},serialize:function(e){return C(e[0])},onBlur:function(e){!function(){return function(e){return l.length>0?o("",e):e()}}()(function(){return P.props.onBlur({value:p,open:s,originalEvent:e})})},onFocus:function(e){P.props.onFocus({value:p,open:s,originalEvent:e})},placeholder:this.props.placeholder,style:this.props.style},function(){switch(!1){case"function"!=typeof this.props.restoreOnBackspace:return{restoreOnBackspace:this.props.restoreOnBackspace};default:return{}}}.call(this)),function(){switch(!1){case"function"!=typeof this.props.renderNoResultsFound:return{renderNoResultsFound:function(){return P.props.renderNoResultsFound(p,l)}};default:return{}}}.call(this)))},getComputedState:function(){var e,n,t,o,i,s,u,l,a,c,h,d,f,g=this;return e=this.isOpen(),n=this.props.hasOwnProperty("search")?this.props.search:this.state.search,t=this.value(),o=t?[t]:[],i=v(function(e){var n;return n=function(){switch(!1){case!(this.props.hasOwnProperty(e)&&this.props.hasOwnProperty(p("on-"+e+"-change"))):return function(n,t){return g.props[p("on-"+e+"-change")](n,function(){}),g.setState({},t)};case!(this.props.hasOwnProperty(e)&&!this.props.hasOwnProperty(p("on-"+e+"-change"))):return function(e,n){return n()};case!(!this.props.hasOwnProperty(e)&&this.props.hasOwnProperty(p("on-"+e+"-change"))):return function(n,t){var o;return g.setState((o={},o[e+""]=n,o),function(){return t(),g.props[p("on-"+e+"-change")](n,function(){})})};case!(!this.props.hasOwnProperty(e)&&!this.props.hasOwnProperty(p("on-"+e+"-change"))):return function(n,t){var o;return g.setState((o={},o[e+""]=n,o),t)}}}.call(g)})(["open","search","value"]),s=i[0],u=i[1],l=i[2],a=function(){var e;switch(!1){case!(null!=(e=this.props)&&e.children):return v(function(e){var n,t,o;return null!=(n=null!=e?e.props:void 0)&&(t=n.value,o=n.children),{label:o,value:t}})("Array"===x.call(this.props.children).slice(8,-1)?this.props.children:[this.props.children]);default:return[]}}.call(this),c=this.props.hasOwnProperty("options")?null!=(i=this.props.options)?i:[]:a,h=this.props.filterOptions(c,n),d=function(){switch(!1){case"function"!=typeof this.props.createFromSearch:return this.props.createFromSearch(h,n);default:return null}}.call(this),f=(d?[(i=r({},d),i.newOption=!0,i)]:[]).concat(h),{open:e,search:n,value:t,values:o,onOpenChange:function(e,o){s(e,function(){return o(),g.props.editable&&g.isOpen()&&t?u(g.props.editable(t)+""+(1===n.length?n:""),function(){return g.highlightFirstSelectableOption(function(){})}):void 0})},onSearchChange:u,onValueChange:l,filteredOptions:h,options:f}},getInitialState:function(){var e;return{highlightedUid:void 0,open:!1,scrollLock:!1,search:"",value:null!=(e=this.props)?e.defaultValue:void 0}},firstOptionIndexToHighlight:function(e,n){var t,o;switch(t=n?d(function(e){return m(e,n)},e):void 0,!1){case"undefined"==typeof t:return t;case 1!==e.length:return 0;case"undefined"!=typeof(null!=(o=e[0])?o.newOption:void 0):return 0;default:return s(function(e){return"boolean"==typeof e.selectable&&!e.selectable})(l(1)(e))?0:1}},focus:function(){this.refs.select.focus()},blur:function(){this.refs.select.blur()},highlightFirstSelectableOption:function(e){var n,t,o;null==e&&(e=function(){}),this.state.open?(n=this.getComputedState(),t=n.options,o=n.value,this.refs.select.highlightAndScrollToSelectableOption(this.firstOptionIndexToHighlight(t,o),1,e)):e()},value:function(){return this.props.hasOwnProperty("value")?this.props.value:this.state.value},isOpen:function(){return this.props.hasOwnProperty("open")?this.props.open:this.state.open}})}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./ReactSelectize":7,"prelude-ls":void 0}],11:[function(e,n,t){(function(e){(function(){var t,o,r,i;t="undefined"!=typeof window?window.React:"undefined"!=typeof e?e.React:null,o=t.createClass,r=t.DOM.div,i=("undefined"!=typeof window?window.preludeExtension:"undefined"!=typeof e?e.preludeExtension:null).isEqualToObject,n.exports=o({getDefaultProps:function(){return{}},render:function(){return r({className:"value-wrapper"},this.props.renderItem(this.props.item))},shouldComponentUpdate:function(e){var n;return!i(null!=e?e.uid:void 0,null!=(n=this.props)?n.uid:void 0)}})}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],12:[function(e,n,t){(function(){var n,o,r,i,s,u,l,p="undefined"!=typeof t&&t||this;n=e("prelude-ls"),o=n.filter,r=n.map,i=n.objToPairs,s=n.Str,p.cancelEvent=u=function(e){e.preventDefault(),e.stopPropagation()},p.classNameFromObject=l=function(e){return s.join(" ")(r(function(e){return e[0]})(o(function(e){return!!e[1]})(i(e))))}}).call(this)},{"prelude-ls":void 0}]},{},[1])(1)});