Select.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537
  1. import _extends from "@babel/runtime/helpers/esm/extends";
  2. import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
  3. import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
  4. import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
  5. import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
  6. import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
  7. import _typeof from "@babel/runtime/helpers/esm/typeof";
  8. var _excluded = ["id", "mode", "prefixCls", "backfill", "fieldNames", "inputValue", "searchValue", "onSearch", "autoClearSearchValue", "onSelect", "onDeselect", "dropdownMatchSelectWidth", "filterOption", "filterSort", "optionFilterProp", "optionLabelProp", "options", "optionRender", "children", "defaultActiveFirstOption", "menuItemSelectedIcon", "virtual", "direction", "listHeight", "listItemHeight", "labelRender", "value", "defaultValue", "labelInValue", "onChange", "maxCount"];
  9. /**
  10. * To match accessibility requirement, we always provide an input in the component.
  11. * Other element will not set `tabIndex` to avoid `onBlur` sequence problem.
  12. * For focused select, we set `aria-live="polite"` to update the accessibility content.
  13. *
  14. * ref:
  15. * - keyboard: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role#Keyboard_interactions
  16. *
  17. * New api:
  18. * - listHeight
  19. * - listItemHeight
  20. * - component
  21. *
  22. * Remove deprecated api:
  23. * - multiple
  24. * - tags
  25. * - combobox
  26. * - firstActiveValue
  27. * - dropdownMenuStyle
  28. * - openClassName (Not list in api)
  29. *
  30. * Update:
  31. * - `backfill` only support `combobox` mode
  32. * - `combobox` mode not support `labelInValue` since it's meaningless
  33. * - `getInputElement` only support `combobox` mode
  34. * - `onChange` return OptionData instead of ReactNode
  35. * - `filterOption` `onChange` `onSelect` accept OptionData instead of ReactNode
  36. * - `combobox` mode trigger `onChange` will get `undefined` if no `value` match in Option
  37. * - `combobox` mode not support `optionLabelProp`
  38. */
  39. import useMergedState from "rc-util/es/hooks/useMergedState";
  40. import warning from "rc-util/es/warning";
  41. import * as React from 'react';
  42. import BaseSelect, { isMultiple } from "./BaseSelect";
  43. import OptGroup from "./OptGroup";
  44. import Option from "./Option";
  45. import OptionList from "./OptionList";
  46. import SelectContext from "./SelectContext";
  47. import useCache from "./hooks/useCache";
  48. import useFilterOptions from "./hooks/useFilterOptions";
  49. import useId from "./hooks/useId";
  50. import useOptions from "./hooks/useOptions";
  51. import useRefFunc from "./hooks/useRefFunc";
  52. import { hasValue, isComboNoValue, toArray } from "./utils/commonUtil";
  53. import { fillFieldNames, flattenOptions, injectPropsWithOption } from "./utils/valueUtil";
  54. import warningProps, { warningNullOptions } from "./utils/warningPropsUtil";
  55. var OMIT_DOM_PROPS = ['inputValue'];
  56. function isRawValue(value) {
  57. return !value || _typeof(value) !== 'object';
  58. }
  59. var Select = /*#__PURE__*/React.forwardRef(function (props, ref) {
  60. var id = props.id,
  61. mode = props.mode,
  62. _props$prefixCls = props.prefixCls,
  63. prefixCls = _props$prefixCls === void 0 ? 'rc-select' : _props$prefixCls,
  64. backfill = props.backfill,
  65. fieldNames = props.fieldNames,
  66. inputValue = props.inputValue,
  67. searchValue = props.searchValue,
  68. onSearch = props.onSearch,
  69. _props$autoClearSearc = props.autoClearSearchValue,
  70. autoClearSearchValue = _props$autoClearSearc === void 0 ? true : _props$autoClearSearc,
  71. onSelect = props.onSelect,
  72. onDeselect = props.onDeselect,
  73. _props$dropdownMatchS = props.dropdownMatchSelectWidth,
  74. dropdownMatchSelectWidth = _props$dropdownMatchS === void 0 ? true : _props$dropdownMatchS,
  75. filterOption = props.filterOption,
  76. filterSort = props.filterSort,
  77. optionFilterProp = props.optionFilterProp,
  78. optionLabelProp = props.optionLabelProp,
  79. options = props.options,
  80. optionRender = props.optionRender,
  81. children = props.children,
  82. defaultActiveFirstOption = props.defaultActiveFirstOption,
  83. menuItemSelectedIcon = props.menuItemSelectedIcon,
  84. virtual = props.virtual,
  85. direction = props.direction,
  86. _props$listHeight = props.listHeight,
  87. listHeight = _props$listHeight === void 0 ? 200 : _props$listHeight,
  88. _props$listItemHeight = props.listItemHeight,
  89. listItemHeight = _props$listItemHeight === void 0 ? 20 : _props$listItemHeight,
  90. labelRender = props.labelRender,
  91. value = props.value,
  92. defaultValue = props.defaultValue,
  93. labelInValue = props.labelInValue,
  94. onChange = props.onChange,
  95. maxCount = props.maxCount,
  96. restProps = _objectWithoutProperties(props, _excluded);
  97. var mergedId = useId(id);
  98. var multiple = isMultiple(mode);
  99. var childrenAsData = !!(!options && children);
  100. var mergedFilterOption = React.useMemo(function () {
  101. if (filterOption === undefined && mode === 'combobox') {
  102. return false;
  103. }
  104. return filterOption;
  105. }, [filterOption, mode]);
  106. // ========================= FieldNames =========================
  107. var mergedFieldNames = React.useMemo(function () {
  108. return fillFieldNames(fieldNames, childrenAsData);
  109. }, /* eslint-disable react-hooks/exhaustive-deps */
  110. [
  111. // We stringify fieldNames to avoid unnecessary re-renders.
  112. JSON.stringify(fieldNames), childrenAsData]
  113. /* eslint-enable react-hooks/exhaustive-deps */);
  114. // =========================== Search ===========================
  115. var _useMergedState = useMergedState('', {
  116. value: searchValue !== undefined ? searchValue : inputValue,
  117. postState: function postState(search) {
  118. return search || '';
  119. }
  120. }),
  121. _useMergedState2 = _slicedToArray(_useMergedState, 2),
  122. mergedSearchValue = _useMergedState2[0],
  123. setSearchValue = _useMergedState2[1];
  124. // =========================== Option ===========================
  125. var parsedOptions = useOptions(options, children, mergedFieldNames, optionFilterProp, optionLabelProp);
  126. var valueOptions = parsedOptions.valueOptions,
  127. labelOptions = parsedOptions.labelOptions,
  128. mergedOptions = parsedOptions.options;
  129. // ========================= Wrap Value =========================
  130. var convert2LabelValues = React.useCallback(function (draftValues) {
  131. // Convert to array
  132. var valueList = toArray(draftValues);
  133. // Convert to labelInValue type
  134. return valueList.map(function (val) {
  135. var rawValue;
  136. var rawLabel;
  137. var rawKey;
  138. var rawDisabled;
  139. var rawTitle;
  140. // Fill label & value
  141. if (isRawValue(val)) {
  142. rawValue = val;
  143. } else {
  144. var _val$value;
  145. rawKey = val.key;
  146. rawLabel = val.label;
  147. rawValue = (_val$value = val.value) !== null && _val$value !== void 0 ? _val$value : rawKey;
  148. }
  149. var option = valueOptions.get(rawValue);
  150. if (option) {
  151. var _option$key;
  152. // Fill missing props
  153. if (rawLabel === undefined) rawLabel = option === null || option === void 0 ? void 0 : option[optionLabelProp || mergedFieldNames.label];
  154. if (rawKey === undefined) rawKey = (_option$key = option === null || option === void 0 ? void 0 : option.key) !== null && _option$key !== void 0 ? _option$key : rawValue;
  155. rawDisabled = option === null || option === void 0 ? void 0 : option.disabled;
  156. rawTitle = option === null || option === void 0 ? void 0 : option.title;
  157. // Warning if label not same as provided
  158. if (process.env.NODE_ENV !== 'production' && !optionLabelProp) {
  159. var optionLabel = option === null || option === void 0 ? void 0 : option[mergedFieldNames.label];
  160. if (optionLabel !== undefined && ! /*#__PURE__*/React.isValidElement(optionLabel) && ! /*#__PURE__*/React.isValidElement(rawLabel) && optionLabel !== rawLabel) {
  161. warning(false, '`label` of `value` is not same as `label` in Select options.');
  162. }
  163. }
  164. }
  165. return {
  166. label: rawLabel,
  167. value: rawValue,
  168. key: rawKey,
  169. disabled: rawDisabled,
  170. title: rawTitle
  171. };
  172. });
  173. }, [mergedFieldNames, optionLabelProp, valueOptions]);
  174. // =========================== Values ===========================
  175. var _useMergedState3 = useMergedState(defaultValue, {
  176. value: value
  177. }),
  178. _useMergedState4 = _slicedToArray(_useMergedState3, 2),
  179. internalValue = _useMergedState4[0],
  180. setInternalValue = _useMergedState4[1];
  181. // Merged value with LabelValueType
  182. var rawLabeledValues = React.useMemo(function () {
  183. var _values$;
  184. var newInternalValue = multiple && internalValue === null ? [] : internalValue;
  185. var values = convert2LabelValues(newInternalValue);
  186. // combobox no need save value when it's no value (exclude value equal 0)
  187. if (mode === 'combobox' && isComboNoValue((_values$ = values[0]) === null || _values$ === void 0 ? void 0 : _values$.value)) {
  188. return [];
  189. }
  190. return values;
  191. }, [internalValue, convert2LabelValues, mode, multiple]);
  192. // Fill label with cache to avoid option remove
  193. var _useCache = useCache(rawLabeledValues, valueOptions),
  194. _useCache2 = _slicedToArray(_useCache, 2),
  195. mergedValues = _useCache2[0],
  196. getMixedOption = _useCache2[1];
  197. var displayValues = React.useMemo(function () {
  198. // `null` need show as placeholder instead
  199. // https://github.com/ant-design/ant-design/issues/25057
  200. if (!mode && mergedValues.length === 1) {
  201. var firstValue = mergedValues[0];
  202. if (firstValue.value === null && (firstValue.label === null || firstValue.label === undefined)) {
  203. return [];
  204. }
  205. }
  206. return mergedValues.map(function (item) {
  207. var _ref;
  208. return _objectSpread(_objectSpread({}, item), {}, {
  209. label: (_ref = typeof labelRender === 'function' ? labelRender(item) : item.label) !== null && _ref !== void 0 ? _ref : item.value
  210. });
  211. });
  212. }, [mode, mergedValues, labelRender]);
  213. /** Convert `displayValues` to raw value type set */
  214. var rawValues = React.useMemo(function () {
  215. return new Set(mergedValues.map(function (val) {
  216. return val.value;
  217. }));
  218. }, [mergedValues]);
  219. React.useEffect(function () {
  220. if (mode === 'combobox') {
  221. var _mergedValues$;
  222. var strValue = (_mergedValues$ = mergedValues[0]) === null || _mergedValues$ === void 0 ? void 0 : _mergedValues$.value;
  223. setSearchValue(hasValue(strValue) ? String(strValue) : '');
  224. }
  225. }, [mergedValues]);
  226. // ======================= Display Option =======================
  227. // Create a placeholder item if not exist in `options`
  228. var createTagOption = useRefFunc(function (val, label) {
  229. var mergedLabel = label !== null && label !== void 0 ? label : val;
  230. return _defineProperty(_defineProperty({}, mergedFieldNames.value, val), mergedFieldNames.label, mergedLabel);
  231. });
  232. // Fill tag as option if mode is `tags`
  233. var filledTagOptions = React.useMemo(function () {
  234. if (mode !== 'tags') {
  235. return mergedOptions;
  236. }
  237. // >>> Tag mode
  238. var cloneOptions = _toConsumableArray(mergedOptions);
  239. // Check if value exist in options (include new patch item)
  240. var existOptions = function existOptions(val) {
  241. return valueOptions.has(val);
  242. };
  243. // Fill current value as option
  244. _toConsumableArray(mergedValues).sort(function (a, b) {
  245. return a.value < b.value ? -1 : 1;
  246. }).forEach(function (item) {
  247. var val = item.value;
  248. if (!existOptions(val)) {
  249. cloneOptions.push(createTagOption(val, item.label));
  250. }
  251. });
  252. return cloneOptions;
  253. }, [createTagOption, mergedOptions, valueOptions, mergedValues, mode]);
  254. var filteredOptions = useFilterOptions(filledTagOptions, mergedFieldNames, mergedSearchValue, mergedFilterOption, optionFilterProp);
  255. // Fill options with search value if needed
  256. var filledSearchOptions = React.useMemo(function () {
  257. if (mode !== 'tags' || !mergedSearchValue || filteredOptions.some(function (item) {
  258. return item[optionFilterProp || 'value'] === mergedSearchValue;
  259. })) {
  260. return filteredOptions;
  261. }
  262. // ignore when search value equal select input value
  263. if (filteredOptions.some(function (item) {
  264. return item[mergedFieldNames.value] === mergedSearchValue;
  265. })) {
  266. return filteredOptions;
  267. }
  268. // Fill search value as option
  269. return [createTagOption(mergedSearchValue)].concat(_toConsumableArray(filteredOptions));
  270. }, [createTagOption, optionFilterProp, mode, filteredOptions, mergedSearchValue, mergedFieldNames]);
  271. var sorter = function sorter(inputOptions) {
  272. var sortedOptions = _toConsumableArray(inputOptions).sort(function (a, b) {
  273. return filterSort(a, b, {
  274. searchValue: mergedSearchValue
  275. });
  276. });
  277. return sortedOptions.map(function (item) {
  278. if (Array.isArray(item.options)) {
  279. return _objectSpread(_objectSpread({}, item), {}, {
  280. options: item.options.length > 0 ? sorter(item.options) : item.options
  281. });
  282. }
  283. return item;
  284. });
  285. };
  286. var orderedFilteredOptions = React.useMemo(function () {
  287. if (!filterSort) {
  288. return filledSearchOptions;
  289. }
  290. return sorter(filledSearchOptions);
  291. }, [filledSearchOptions, filterSort, mergedSearchValue]);
  292. var displayOptions = React.useMemo(function () {
  293. return flattenOptions(orderedFilteredOptions, {
  294. fieldNames: mergedFieldNames,
  295. childrenAsData: childrenAsData
  296. });
  297. }, [orderedFilteredOptions, mergedFieldNames, childrenAsData]);
  298. // =========================== Change ===========================
  299. var triggerChange = function triggerChange(values) {
  300. var labeledValues = convert2LabelValues(values);
  301. setInternalValue(labeledValues);
  302. if (onChange && (
  303. // Trigger event only when value changed
  304. labeledValues.length !== mergedValues.length || labeledValues.some(function (newVal, index) {
  305. var _mergedValues$index;
  306. return ((_mergedValues$index = mergedValues[index]) === null || _mergedValues$index === void 0 ? void 0 : _mergedValues$index.value) !== (newVal === null || newVal === void 0 ? void 0 : newVal.value);
  307. }))) {
  308. var returnValues = labelInValue ? labeledValues : labeledValues.map(function (v) {
  309. return v.value;
  310. });
  311. var returnOptions = labeledValues.map(function (v) {
  312. return injectPropsWithOption(getMixedOption(v.value));
  313. });
  314. onChange(
  315. // Value
  316. multiple ? returnValues : returnValues[0],
  317. // Option
  318. multiple ? returnOptions : returnOptions[0]);
  319. }
  320. };
  321. // ======================= Accessibility ========================
  322. var _React$useState = React.useState(null),
  323. _React$useState2 = _slicedToArray(_React$useState, 2),
  324. activeValue = _React$useState2[0],
  325. setActiveValue = _React$useState2[1];
  326. var _React$useState3 = React.useState(0),
  327. _React$useState4 = _slicedToArray(_React$useState3, 2),
  328. accessibilityIndex = _React$useState4[0],
  329. setAccessibilityIndex = _React$useState4[1];
  330. var mergedDefaultActiveFirstOption = defaultActiveFirstOption !== undefined ? defaultActiveFirstOption : mode !== 'combobox';
  331. var onActiveValue = React.useCallback(function (active, index) {
  332. var _ref3 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
  333. _ref3$source = _ref3.source,
  334. source = _ref3$source === void 0 ? 'keyboard' : _ref3$source;
  335. setAccessibilityIndex(index);
  336. if (backfill && mode === 'combobox' && active !== null && source === 'keyboard') {
  337. setActiveValue(String(active));
  338. }
  339. }, [backfill, mode]);
  340. // ========================= OptionList =========================
  341. var triggerSelect = function triggerSelect(val, selected, type) {
  342. var getSelectEnt = function getSelectEnt() {
  343. var _option$key2;
  344. var option = getMixedOption(val);
  345. return [labelInValue ? {
  346. label: option === null || option === void 0 ? void 0 : option[mergedFieldNames.label],
  347. value: val,
  348. key: (_option$key2 = option === null || option === void 0 ? void 0 : option.key) !== null && _option$key2 !== void 0 ? _option$key2 : val
  349. } : val, injectPropsWithOption(option)];
  350. };
  351. if (selected && onSelect) {
  352. var _getSelectEnt = getSelectEnt(),
  353. _getSelectEnt2 = _slicedToArray(_getSelectEnt, 2),
  354. wrappedValue = _getSelectEnt2[0],
  355. _option = _getSelectEnt2[1];
  356. onSelect(wrappedValue, _option);
  357. } else if (!selected && onDeselect && type !== 'clear') {
  358. var _getSelectEnt3 = getSelectEnt(),
  359. _getSelectEnt4 = _slicedToArray(_getSelectEnt3, 2),
  360. _wrappedValue = _getSelectEnt4[0],
  361. _option2 = _getSelectEnt4[1];
  362. onDeselect(_wrappedValue, _option2);
  363. }
  364. };
  365. // Used for OptionList selection
  366. var onInternalSelect = useRefFunc(function (val, info) {
  367. var cloneValues;
  368. // Single mode always trigger select only with option list
  369. var mergedSelect = multiple ? info.selected : true;
  370. if (mergedSelect) {
  371. cloneValues = multiple ? [].concat(_toConsumableArray(mergedValues), [val]) : [val];
  372. } else {
  373. cloneValues = mergedValues.filter(function (v) {
  374. return v.value !== val;
  375. });
  376. }
  377. triggerChange(cloneValues);
  378. triggerSelect(val, mergedSelect);
  379. // Clean search value if single or configured
  380. if (mode === 'combobox') {
  381. // setSearchValue(String(val));
  382. setActiveValue('');
  383. } else if (!isMultiple || autoClearSearchValue) {
  384. setSearchValue('');
  385. setActiveValue('');
  386. }
  387. });
  388. // ======================= Display Change =======================
  389. // BaseSelect display values change
  390. var onDisplayValuesChange = function onDisplayValuesChange(nextValues, info) {
  391. triggerChange(nextValues);
  392. var type = info.type,
  393. values = info.values;
  394. if (type === 'remove' || type === 'clear') {
  395. values.forEach(function (item) {
  396. triggerSelect(item.value, false, type);
  397. });
  398. }
  399. };
  400. // =========================== Search ===========================
  401. var onInternalSearch = function onInternalSearch(searchText, info) {
  402. setSearchValue(searchText);
  403. setActiveValue(null);
  404. // [Submit] Tag mode should flush input
  405. if (info.source === 'submit') {
  406. var formatted = (searchText || '').trim();
  407. // prevent empty tags from appearing when you click the Enter button
  408. if (formatted) {
  409. var newRawValues = Array.from(new Set([].concat(_toConsumableArray(rawValues), [formatted])));
  410. triggerChange(newRawValues);
  411. triggerSelect(formatted, true);
  412. setSearchValue('');
  413. }
  414. return;
  415. }
  416. if (info.source !== 'blur') {
  417. if (mode === 'combobox') {
  418. triggerChange(searchText);
  419. }
  420. onSearch === null || onSearch === void 0 || onSearch(searchText);
  421. }
  422. };
  423. var onInternalSearchSplit = function onInternalSearchSplit(words) {
  424. var patchValues = words;
  425. if (mode !== 'tags') {
  426. patchValues = words.map(function (word) {
  427. var opt = labelOptions.get(word);
  428. return opt === null || opt === void 0 ? void 0 : opt.value;
  429. }).filter(function (val) {
  430. return val !== undefined;
  431. });
  432. }
  433. var newRawValues = Array.from(new Set([].concat(_toConsumableArray(rawValues), _toConsumableArray(patchValues))));
  434. triggerChange(newRawValues);
  435. newRawValues.forEach(function (newRawValue) {
  436. triggerSelect(newRawValue, true);
  437. });
  438. };
  439. // ========================== Context ===========================
  440. var selectContext = React.useMemo(function () {
  441. var realVirtual = virtual !== false && dropdownMatchSelectWidth !== false;
  442. return _objectSpread(_objectSpread({}, parsedOptions), {}, {
  443. flattenOptions: displayOptions,
  444. onActiveValue: onActiveValue,
  445. defaultActiveFirstOption: mergedDefaultActiveFirstOption,
  446. onSelect: onInternalSelect,
  447. menuItemSelectedIcon: menuItemSelectedIcon,
  448. rawValues: rawValues,
  449. fieldNames: mergedFieldNames,
  450. virtual: realVirtual,
  451. direction: direction,
  452. listHeight: listHeight,
  453. listItemHeight: listItemHeight,
  454. childrenAsData: childrenAsData,
  455. maxCount: maxCount,
  456. optionRender: optionRender
  457. });
  458. }, [maxCount, parsedOptions, displayOptions, onActiveValue, mergedDefaultActiveFirstOption, onInternalSelect, menuItemSelectedIcon, rawValues, mergedFieldNames, virtual, dropdownMatchSelectWidth, direction, listHeight, listItemHeight, childrenAsData, optionRender]);
  459. // ========================== Warning ===========================
  460. if (process.env.NODE_ENV !== 'production') {
  461. warningProps(props);
  462. warningNullOptions(mergedOptions, mergedFieldNames);
  463. }
  464. // ==============================================================
  465. // == Render ==
  466. // ==============================================================
  467. return /*#__PURE__*/React.createElement(SelectContext.Provider, {
  468. value: selectContext
  469. }, /*#__PURE__*/React.createElement(BaseSelect, _extends({}, restProps, {
  470. // >>> MISC
  471. id: mergedId,
  472. prefixCls: prefixCls,
  473. ref: ref,
  474. omitDomProps: OMIT_DOM_PROPS,
  475. mode: mode
  476. // >>> Values
  477. ,
  478. displayValues: displayValues,
  479. onDisplayValuesChange: onDisplayValuesChange
  480. // >>> Trigger
  481. ,
  482. direction: direction
  483. // >>> Search
  484. ,
  485. searchValue: mergedSearchValue,
  486. onSearch: onInternalSearch,
  487. autoClearSearchValue: autoClearSearchValue,
  488. onSearchSplit: onInternalSearchSplit,
  489. dropdownMatchSelectWidth: dropdownMatchSelectWidth
  490. // >>> OptionList
  491. ,
  492. OptionList: OptionList,
  493. emptyOptions: !displayOptions.length
  494. // >>> Accessibility
  495. ,
  496. activeValue: activeValue,
  497. activeDescendantId: "".concat(mergedId, "_list_").concat(accessibilityIndex)
  498. })));
  499. });
  500. if (process.env.NODE_ENV !== 'production') {
  501. Select.displayName = 'Select';
  502. }
  503. var TypedSelect = Select;
  504. TypedSelect.Option = Option;
  505. TypedSelect.OptGroup = OptGroup;
  506. export default TypedSelect;