-
Notifications
You must be signed in to change notification settings - Fork 4.1k
/
Copy pathSelect.js
697 lines (625 loc) · 23.1 KB
/
Select.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
'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; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _reactDom = require('react-dom');
var _reactDom2 = _interopRequireDefault(_reactDom);
var _reactInputAutosize = require('react-input-autosize');
var _reactInputAutosize2 = _interopRequireDefault(_reactInputAutosize);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _utilsStripDiacritics = require('./utils/stripDiacritics');
var _utilsStripDiacritics2 = _interopRequireDefault(_utilsStripDiacritics);
var _Async = require('./Async');
var _Async2 = _interopRequireDefault(_Async);
var _Option = require('./Option');
var _Option2 = _interopRequireDefault(_Option);
var _Value = require('./Value');
var _Value2 = _interopRequireDefault(_Value);
var Select = _react2['default'].createClass({
statics: { Async: _Async2['default'] },
displayName: 'Select',
propTypes: {
addLabelText: _react2['default'].PropTypes.string, // placeholder displayed when you want to add a label on a multi-value input
allowCreate: _react2['default'].PropTypes.bool, // whether to allow creation of new entries
backspaceRemoves: _react2['default'].PropTypes.bool, // whether backspace removes an item if there is no text input
className: _react2['default'].PropTypes.string, // className for the outer element
clearAllText: _react2['default'].PropTypes.string, // title for the "clear" control when multi: true
clearValueText: _react2['default'].PropTypes.string, // title for the "clear" control
clearable: _react2['default'].PropTypes.bool, // should it be possible to reset value
delimiter: _react2['default'].PropTypes.string, // delimiter to use to join multiple values for the hidden field value
disabled: _react2['default'].PropTypes.bool, // whether the Select is disabled or not
escapeClearsValue: _react2['default'].PropTypes.bool, // whether escape clears the value when the menu is closed
filterOption: _react2['default'].PropTypes.func, // method to filter a single option (option, filterString)
filterOptions: _react2['default'].PropTypes.any, // boolean to enable default filtering or function to filter the options array ([options], filterString, [values])
ignoreAccents: _react2['default'].PropTypes.bool, // whether to strip diacritics when filtering
ignoreCase: _react2['default'].PropTypes.bool, // whether to perform case-insensitive filtering
inputProps: _react2['default'].PropTypes.object, // custom attributes for the Input (in the Select-control) e.g: {'data-foo': 'bar'}
isLoading: _react2['default'].PropTypes.bool, // whether the Select is loading externally or not (such as options being loaded)
labelKey: _react2['default'].PropTypes.string, // path of the label value in option objects
matchPos: _react2['default'].PropTypes.string, // (any|start) match the start or entire string when filtering
matchProp: _react2['default'].PropTypes.string, // (any|label|value) which option property to filter on
multi: _react2['default'].PropTypes.bool, // multi-value input
name: _react2['default'].PropTypes.string, // generates a hidden <input /> tag with this field name for html forms
newOptionCreator: _react2['default'].PropTypes.func, // factory to create new options when allowCreate set
noResultsText: _react2['default'].PropTypes.string, // placeholder displayed when there are no matching search results
onBlur: _react2['default'].PropTypes.func, // onBlur handler: function (event) {}
onChange: _react2['default'].PropTypes.func, // onChange handler: function (newValue) {}
onFocus: _react2['default'].PropTypes.func, // onFocus handler: function (event) {}
onInputChange: _react2['default'].PropTypes.func, // onInputChange handler: function (inputValue) {}
onValueClick: _react2['default'].PropTypes.func, // onClick handler for value labels: function (value, event) {}
onMenuScrollToBottom: _react2['default'].PropTypes.func, // fires when the menu is scrolled to the bottom; can be used to paginate options
optionComponent: _react2['default'].PropTypes.func, // option component to render in dropdown
optionRenderer: _react2['default'].PropTypes.func, // optionRenderer: function (option) {}
options: _react2['default'].PropTypes.array, // array of options
placeholder: _react2['default'].PropTypes.string, // field placeholder, displayed when there's no value
searchable: _react2['default'].PropTypes.bool, // whether to enable searching feature or not
simpleValue: _react2['default'].PropTypes.bool, // pass the value to onChange as a simple value (legacy pre 1.0 mode), defaults to false
value: _react2['default'].PropTypes.any, // initial field value
valueComponent: _react2['default'].PropTypes.func, // value component to render
valueKey: _react2['default'].PropTypes.string, // path of the label value in option objects
valueRenderer: _react2['default'].PropTypes.func // valueRenderer: function (option) {}
},
getDefaultProps: function getDefaultProps() {
return {
addLabelText: 'Add "{label}"?',
allowCreate: false,
backspaceRemoves: true,
clearAllText: 'Clear all',
clearValueText: 'Clear value',
clearable: true,
delimiter: ',',
disabled: false,
escapeClearsValue: true,
filterOptions: true,
ignoreAccents: true,
ignoreCase: true,
inputProps: {},
isLoading: false,
labelKey: 'label',
matchPos: 'any',
matchProp: 'any',
multi: false,
noResultsText: 'No results found',
optionComponent: _Option2['default'],
placeholder: 'Select...',
searchable: true,
simpleValue: false,
valueComponent: _Value2['default'],
valueKey: 'value'
};
},
getInitialState: function getInitialState() {
return {
inputValue: '',
isFocused: false,
isLoading: false,
isOpen: false,
isPseudoFocused: false
};
},
componentDidUpdate: function componentDidUpdate(prevProps, prevState) {
if (prevState.inputValue !== this.state.inputValue && this.props.onInputChange) {
this.props.onInputChange(this.state.inputValue);
}
if (this._scrollToFocusedOptionOnUpdate && this.refs.focused && this.refs.menu) {
this._scrollToFocusedOptionOnUpdate = false;
var focusedDOM = _reactDom2['default'].findDOMNode(this.refs.focused);
var menuDOM = _reactDom2['default'].findDOMNode(this.refs.menu);
var focusedRect = focusedDOM.getBoundingClientRect();
var menuRect = menuDOM.getBoundingClientRect();
if (focusedRect.bottom > menuRect.bottom || focusedRect.top < menuRect.top) {
menuDOM.scrollTop = focusedDOM.offsetTop + focusedDOM.clientHeight - menuDOM.offsetHeight;
}
}
},
focus: function focus() {
if (!this.refs.input) return;
this.refs.input.focus();
},
handleMouseDown: function handleMouseDown(event) {
// if the event was triggered by a mousedown and not the primary
// button, or if the component is disabled, ignore it.
if (this.props.disabled || event.type === 'mousedown' && event.button !== 0) {
return;
}
// prevent default event handlers
event.stopPropagation();
event.preventDefault();
// for the non-searchable select, close the dropdown when button is clicked
if (this.state.isOpen && !this.props.searchable) {
this.setState({
isOpen: false
});
return;
}
if (this.state.isFocused) {
// if the input is focused, ensure the menu is open
this.setState({
isOpen: true,
isPseudoFocused: false
});
} else {
// otherwise, focus the input and open the menu
this._openAfterFocus = true;
this.focus();
}
},
handleMouseDownOnArrow: function handleMouseDownOnArrow(event) {
// if the event was triggered by a mousedown and not the primary
// button, or if the component is disabled, ignore it.
if (this.props.disabled || event.type === 'mousedown' && event.button !== 0) {
return;
}
// If the menu isn't open, let the event bubble to the main handleMouseDown
if (!this.state.isOpen) {
return;
}
// prevent default event handlers
event.stopPropagation();
event.preventDefault();
// close the menu
this.closeMenu();
},
closeMenu: function closeMenu() {
this.setState({
isOpen: false,
isPseudoFocused: this.state.isFocused && !this.props.multi
});
},
handleInputFocus: function handleInputFocus(event) {
var isOpen = this.state.isOpen || this._openAfterFocus;
if (this.props.onFocus) {
this.props.onFocus(event);
}
this.setState({
isFocused: true,
isOpen: isOpen
});
this._openAfterFocus = false;
},
handleInputBlur: function handleInputBlur(event) {
if (document.activeElement.isEqualNode(this.refs.menu)) {
return;
}
if (this.props.onBlur) {
this.props.onBlur(event);
}
this.setState({
inputValue: '',
isFocused: false,
isOpen: false,
isPseudoFocused: false
});
},
handleInputChange: function handleInputChange(event) {
this.setState({
isOpen: true,
isPseudoFocused: false,
inputValue: event.target.value
});
},
handleKeyDown: function handleKeyDown(event) {
if (this.props.disabled) return;
switch (event.keyCode) {
case 8:
// backspace
if (!this.state.inputValue && this.props.backspaceRemoves) {
event.preventDefault();
this.popValue();
}
return;
case 9:
// tab
if (event.shiftKey || !this.state.isOpen) {
return;
}
this.selectFocusedOption();
break;
case 13:
// enter
if (!this.state.isOpen) return;
this.selectFocusedOption();
break;
case 27:
// escape
if (this.state.isOpen) {
this.closeMenu();
} else if (this.props.clearable && this.props.escapeClearsValue) {
this.clearValue(event);
}
break;
case 38:
// up
this.focusPreviousOption();
break;
case 40:
// down
this.focusNextOption();
break;
// case 188: // ,
// if (this.props.allowCreate && this.props.multi) {
// event.preventDefault();
// event.stopPropagation();
// this.selectFocusedOption();
// } else {
// return;
// }
// break;
default:
return;
}
event.preventDefault();
},
handleValueClick: function handleValueClick(option, event) {
if (!this.props.onValueClick) return;
this.props.onValueClick(option, event);
},
handleMenuScroll: function handleMenuScroll(event) {
if (!this.props.onMenuScrollToBottom) return;
var target = event.target;
if (target.scrollHeight > target.offsetHeight && !(target.scrollHeight - target.offsetHeight - target.scrollTop)) {
this.props.onMenuScrollToBottom();
}
},
getOptionLabel: function getOptionLabel(op) {
return op[this.props.labelKey];
},
getValueArray: function getValueArray() {
var value = this.props.value;
if (this.props.multi) {
if (typeof value === 'string') value = value.split(this.props.delimiter);
if (!Array.isArray(value)) {
if (!value) return [];
value = [value];
}
return value.map(this.expandValue).filter(function (i) {
return i;
});
}
var expandedValue = this.expandValue(value);
return expandedValue ? [expandedValue] : [];
},
expandValue: function expandValue(value) {
if (typeof value !== 'string' && typeof value !== 'number') return value;
var _props = this.props;
var options = _props.options;
var valueKey = _props.valueKey;
if (!options) return;
for (var i = 0; i < options.length; i++) {
if (options[i][valueKey] === value) return options[i];
}
},
setValue: function setValue(value) {
var _this = this;
if (!this.props.onChange) return;
if (this.props.simpleValue && value) {
value = this.props.multi ? value && value.map(function (i) {
return i[_this.props.valueKey];
}).join(this.props.delimiter) : value[this.props.valueKey];
}
this.props.onChange(value);
},
selectValue: function selectValue(value) {
if (this.props.multi) {
this.addValue(value);
this.setState({
inputValue: ''
});
} else {
this.setValue(value);
this.setState({
isOpen: false,
inputValue: '',
isPseudoFocused: this.state.isFocused
});
}
},
addValue: function addValue(value) {
var valueArray = this.getValueArray();
this.setValue(valueArray.concat(value));
},
popValue: function popValue() {
var valueArray = this.getValueArray();
if (!valueArray.length) return;
this.setValue(valueArray.slice(0, valueArray.length - 1));
},
removeValue: function removeValue(value) {
var valueArray = this.getValueArray();
this.setValue(valueArray.filter(function (i) {
return i !== value;
}));
this.focus();
},
clearValue: function clearValue(event) {
// if the event was triggered by a mousedown and not the primary
// button, ignore it.
if (event && event.type === 'mousedown' && event.button !== 0) {
return;
}
event.stopPropagation();
event.preventDefault();
this.setValue(null);
this.setState({
isOpen: false,
inputValue: ''
}, this.focus);
},
focusOption: function focusOption(option) {
this.setState({
focusedOption: option
});
},
focusNextOption: function focusNextOption() {
this.focusAdjacentOption('next');
},
focusPreviousOption: function focusPreviousOption() {
this.focusAdjacentOption('previous');
},
focusAdjacentOption: function focusAdjacentOption(dir) {
var options = this._visibleOptions.filter(function (i) {
return !i.disabled;
});
this._scrollToFocusedOptionOnUpdate = true;
if (!this.state.isOpen) {
this.setState({
isOpen: true,
inputValue: '',
focusedOption: this._focusedOption || options[dir === 'next' ? 0 : options.length - 1]
});
return;
}
if (!options.length) return;
var focusedIndex = -1;
for (var i = 0; i < options.length; i++) {
if (this._focusedOption === options[i]) {
focusedIndex = i;
break;
}
}
var focusedOption = options[0];
if (dir === 'next' && focusedIndex > -1 && focusedIndex < options.length - 1) {
focusedOption = options[focusedIndex + 1];
} else if (dir === 'previous') {
if (focusedIndex > 0) {
focusedOption = options[focusedIndex - 1];
} else {
focusedOption = options[options.length - 1];
}
}
this.setState({
focusedOption: focusedOption
});
},
selectFocusedOption: function selectFocusedOption() {
// if (this.props.allowCreate && !this.state.focusedOption) {
// return this.selectValue(this.state.inputValue);
// }
if (this._focusedOption) {
return this.selectValue(this._focusedOption);
}
},
renderLoading: function renderLoading() {
if (!this.props.isLoading) return;
return _react2['default'].createElement(
'span',
{ className: 'Select-loading-zone', 'aria-hidden': 'true' },
_react2['default'].createElement('span', { className: 'Select-loading' })
);
},
renderValue: function renderValue(valueArray, isOpen) {
var _this2 = this;
var renderLabel = this.props.valueRenderer || this.getOptionLabel;
var ValueComponent = this.props.valueComponent;
if (!valueArray.length) {
return !this.state.inputValue ? _react2['default'].createElement(
'div',
{ className: 'Select-placeholder' },
this.props.placeholder
) : null;
}
var onClick = this.props.onValueClick ? this.handleValueClick : null;
if (this.props.multi) {
return valueArray.map(function (i) {
return _react2['default'].createElement(
ValueComponent,
{
disabled: _this2.props.disabled,
key: i[_this2.props.valueKey],
onClick: onClick,
onRemove: _this2.removeValue,
value: i
},
renderLabel(i)
);
});
} else if (!this.state.inputValue) {
if (isOpen) onClick = null;
return _react2['default'].createElement(
ValueComponent,
{
disabled: this.props.disabled,
onClick: onClick,
value: valueArray[0]
},
renderLabel(valueArray[0])
);
}
},
renderInput: function renderInput(valueArray) {
var className = (0, _classnames2['default'])('Select-input', this.props.inputProps.className);
if (this.props.disabled || !this.props.searchable) {
if (this.props.multi && valueArray.length) return;
return _react2['default'].createElement(
'div',
{ className: className },
' '
);
}
return _react2['default'].createElement(_reactInputAutosize2['default'], _extends({}, this.props.inputProps, {
className: className,
tabIndex: this.props.tabIndex,
onBlur: this.handleInputBlur,
onChange: this.handleInputChange,
onFocus: this.handleInputFocus,
minWidth: '5',
ref: 'input',
value: this.state.inputValue
}));
},
renderClear: function renderClear() {
if (!this.props.clearable || !this.props.value || this.props.multi && !this.props.value.length || this.props.disabled || this.props.isLoading) return;
return _react2['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, onTouchEnd: this.clearValue },
_react2['default'].createElement('span', { className: 'Select-clear', dangerouslySetInnerHTML: { __html: '×' } })
);
},
renderArrow: function renderArrow() {
return _react2['default'].createElement(
'span',
{ className: 'Select-arrow-zone', onMouseDown: this.handleMouseDownOnArrow },
_react2['default'].createElement('span', { className: 'Select-arrow', onMouseDown: this.handleMouseDownOnArrow })
);
},
filterOptions: function filterOptions(excludeOptions) {
var _this3 = this;
var filterValue = this.state.inputValue;
var options = this.props.options || [];
if (typeof this.props.filterOptions === 'function') {
return this.props.filterOptions.call(this, options, filterValue, excludeOptions);
} else if (this.props.filterOptions) {
if (this.props.ignoreAccents) {
filterValue = (0, _utilsStripDiacritics2['default'])(filterValue);
}
if (this.props.ignoreCase) {
filterValue = filterValue.toLowerCase();
}
if (excludeOptions) excludeOptions = excludeOptions.map(function (i) {
return i[_this3.props.valueKey];
});
return options.filter(function (option) {
if (excludeOptions && excludeOptions.indexOf(option[_this3.props.valueKey]) > -1) return false;
if (_this3.props.filterOption) return _this3.props.filterOption.call(_this3, option, filterValue);
if (!filterValue) return true;
var valueTest = String(option[_this3.props.valueKey]);
var labelTest = String(option[_this3.props.labelKey]);
if (_this3.props.ignoreAccents) {
if (_this3.props.matchProp !== 'label') valueTest = (0, _utilsStripDiacritics2['default'])(valueTest);
if (_this3.props.matchProp !== 'value') labelTest = (0, _utilsStripDiacritics2['default'])(labelTest);
}
if (_this3.props.ignoreCase) {
if (_this3.props.matchProp !== 'label') valueTest = valueTest.toLowerCase();
if (_this3.props.matchProp !== 'value') labelTest = labelTest.toLowerCase();
}
return _this3.props.matchPos === 'start' ? _this3.props.matchProp !== 'label' && valueTest.substr(0, filterValue.length) === filterValue || _this3.props.matchProp !== 'value' && labelTest.substr(0, filterValue.length) === filterValue : _this3.props.matchProp !== 'label' && valueTest.indexOf(filterValue) >= 0 || _this3.props.matchProp !== 'value' && labelTest.indexOf(filterValue) >= 0;
});
} else {
return options;
}
},
renderMenu: function renderMenu(options, valueArray, focusedOption) {
var _this4 = this;
if (options && options.length) {
var _ret = (function () {
var Option = _this4.props.optionComponent;
var renderLabel = _this4.props.optionRenderer || _this4.getOptionLabel;
return {
v: options.map(function (option) {
var isSelected = valueArray && valueArray.indexOf(option) > -1;
var isFocused = option === focusedOption;
var optionRef = isFocused ? 'focused' : null;
var optionClass = (0, _classnames2['default'])({
'Select-option': true,
'is-selected': isSelected,
'is-focused': isFocused,
'is-disabled': option.disabled
});
return _react2['default'].createElement(
Option,
{
className: optionClass,
isDisabled: option.disabled,
isFocused: isFocused,
key: 'option-' + option[_this4.props.valueKey],
onSelect: _this4.selectValue,
onFocus: _this4.focusOption,
option: option,
isSelected: isSelected,
ref: optionRef
},
renderLabel(option)
);
})
};
})();
if (typeof _ret === 'object') return _ret.v;
} else {
return _react2['default'].createElement(
'div',
{ className: 'Select-noresults' },
this.props.noResultsText
);
}
},
renderHiddenField: function renderHiddenField(valueArray) {
if (!this.props.name) return;
var value = valueArray.join(this.props.delimiter);
return _react2['default'].createElement('input', { type: 'hidden', ref: 'value', name: this.props.name, value: value, disabled: this.props.disabled });
},
getFocusableOption: function getFocusableOption(selectedOption) {
var options = this._visibleOptions;
if (!options.length) return;
var focusedOption = this.state.focusedOption || selectedOption;
if (focusedOption && options.indexOf(focusedOption) > -1) return focusedOption;
for (var i = 0; i < options.length; i++) {
if (!options[i].disabled) return options[i];
}
},
render: function render() {
var valueArray = this.getValueArray();
var options = this._visibleOptions = this.filterOptions(this.props.multi ? valueArray : null);
var isOpen = this.state.isOpen;
if (this.props.multi && !options.length && valueArray.length && !this.state.inputValue) isOpen = false;
var focusedOption = this._focusedOption = this.getFocusableOption(valueArray[0]);
var className = (0, _classnames2['default'])('Select', this.props.className, {
'Select--multi': this.props.multi,
'is-disabled': this.props.disabled,
'is-focused': this.state.isFocused,
'is-loading': this.props.isLoading,
'is-open': isOpen,
'is-pseudo-focused': this.state.isPseudoFocused,
'is-searchable': this.props.searchable,
'has-value': valueArray.length
});
return _react2['default'].createElement(
'div',
{ ref: 'wrapper', className: className },
this.renderHiddenField(valueArray),
_react2['default'].createElement(
'div',
{ className: 'Select-control', ref: 'control', onKeyDown: this.handleKeyDown, onMouseDown: this.handleMouseDown, onTouchEnd: this.handleMouseDown },
this.renderValue(valueArray, isOpen),
this.renderInput(valueArray),
this.renderLoading(),
this.renderClear(),
this.renderArrow()
),
isOpen ? _react2['default'].createElement(
'div',
{ ref: 'menuContainer', className: 'Select-menu-outer' },
_react2['default'].createElement(
'div',
{ ref: 'menu', className: 'Select-menu', onScroll: this.handleMenuScroll, onMouseDown: this.handleMouseDownOnMenu },
this.renderMenu(options, !this.props.multi ? valueArray : null, focusedOption)
)
) : null
);
}
});
exports['default'] = Select;
module.exports = exports['default'];