Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

1578 строки
71 KiB

  1. "use strict";
  2. function _interopDefault(ex) {
  3. return ex && "object" == typeof ex && "default" in ex ? ex.default : ex;
  4. }
  5. var React = require("react"), React__default = _interopDefault(React), memoizeOne = _interopDefault(require("memoize-one")), core = require("@emotion/core"), reactDom = require("react-dom"), utils = require("./utils-2db2ca57.cjs.prod.js"), index = require("./index-4f270825.cjs.prod.js"), _css = _interopDefault(require("@emotion/css")), diacritics = [ {
  6. base: "A",
  7. 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
  8. }, {
  9. base: "AA",
  10. letters: /[\uA732]/g
  11. }, {
  12. base: "AE",
  13. letters: /[\u00C6\u01FC\u01E2]/g
  14. }, {
  15. base: "AO",
  16. letters: /[\uA734]/g
  17. }, {
  18. base: "AU",
  19. letters: /[\uA736]/g
  20. }, {
  21. base: "AV",
  22. letters: /[\uA738\uA73A]/g
  23. }, {
  24. base: "AY",
  25. letters: /[\uA73C]/g
  26. }, {
  27. base: "B",
  28. letters: /[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g
  29. }, {
  30. base: "C",
  31. letters: /[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g
  32. }, {
  33. base: "D",
  34. letters: /[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g
  35. }, {
  36. base: "DZ",
  37. letters: /[\u01F1\u01C4]/g
  38. }, {
  39. base: "Dz",
  40. letters: /[\u01F2\u01C5]/g
  41. }, {
  42. base: "E",
  43. 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
  44. }, {
  45. base: "F",
  46. letters: /[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g
  47. }, {
  48. base: "G",
  49. letters: /[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g
  50. }, {
  51. base: "H",
  52. letters: /[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g
  53. }, {
  54. base: "I",
  55. letters: /[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g
  56. }, {
  57. base: "J",
  58. letters: /[\u004A\u24BF\uFF2A\u0134\u0248]/g
  59. }, {
  60. base: "K",
  61. letters: /[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g
  62. }, {
  63. base: "L",
  64. letters: /[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g
  65. }, {
  66. base: "LJ",
  67. letters: /[\u01C7]/g
  68. }, {
  69. base: "Lj",
  70. letters: /[\u01C8]/g
  71. }, {
  72. base: "M",
  73. letters: /[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g
  74. }, {
  75. base: "N",
  76. letters: /[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g
  77. }, {
  78. base: "NJ",
  79. letters: /[\u01CA]/g
  80. }, {
  81. base: "Nj",
  82. letters: /[\u01CB]/g
  83. }, {
  84. base: "O",
  85. 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
  86. }, {
  87. base: "OI",
  88. letters: /[\u01A2]/g
  89. }, {
  90. base: "OO",
  91. letters: /[\uA74E]/g
  92. }, {
  93. base: "OU",
  94. letters: /[\u0222]/g
  95. }, {
  96. base: "P",
  97. letters: /[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g
  98. }, {
  99. base: "Q",
  100. letters: /[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g
  101. }, {
  102. base: "R",
  103. letters: /[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g
  104. }, {
  105. base: "S",
  106. letters: /[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g
  107. }, {
  108. base: "T",
  109. letters: /[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g
  110. }, {
  111. base: "TZ",
  112. letters: /[\uA728]/g
  113. }, {
  114. base: "U",
  115. 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
  116. }, {
  117. base: "V",
  118. letters: /[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g
  119. }, {
  120. base: "VY",
  121. letters: /[\uA760]/g
  122. }, {
  123. base: "W",
  124. letters: /[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g
  125. }, {
  126. base: "X",
  127. letters: /[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g
  128. }, {
  129. base: "Y",
  130. letters: /[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g
  131. }, {
  132. base: "Z",
  133. letters: /[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g
  134. }, {
  135. base: "a",
  136. 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
  137. }, {
  138. base: "aa",
  139. letters: /[\uA733]/g
  140. }, {
  141. base: "ae",
  142. letters: /[\u00E6\u01FD\u01E3]/g
  143. }, {
  144. base: "ao",
  145. letters: /[\uA735]/g
  146. }, {
  147. base: "au",
  148. letters: /[\uA737]/g
  149. }, {
  150. base: "av",
  151. letters: /[\uA739\uA73B]/g
  152. }, {
  153. base: "ay",
  154. letters: /[\uA73D]/g
  155. }, {
  156. base: "b",
  157. letters: /[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g
  158. }, {
  159. base: "c",
  160. letters: /[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g
  161. }, {
  162. base: "d",
  163. letters: /[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g
  164. }, {
  165. base: "dz",
  166. letters: /[\u01F3\u01C6]/g
  167. }, {
  168. base: "e",
  169. 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
  170. }, {
  171. base: "f",
  172. letters: /[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g
  173. }, {
  174. base: "g",
  175. letters: /[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g
  176. }, {
  177. base: "h",
  178. letters: /[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g
  179. }, {
  180. base: "hv",
  181. letters: /[\u0195]/g
  182. }, {
  183. base: "i",
  184. letters: /[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g
  185. }, {
  186. base: "j",
  187. letters: /[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g
  188. }, {
  189. base: "k",
  190. letters: /[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g
  191. }, {
  192. base: "l",
  193. letters: /[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g
  194. }, {
  195. base: "lj",
  196. letters: /[\u01C9]/g
  197. }, {
  198. base: "m",
  199. letters: /[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g
  200. }, {
  201. base: "n",
  202. letters: /[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g
  203. }, {
  204. base: "nj",
  205. letters: /[\u01CC]/g
  206. }, {
  207. base: "o",
  208. 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
  209. }, {
  210. base: "oi",
  211. letters: /[\u01A3]/g
  212. }, {
  213. base: "ou",
  214. letters: /[\u0223]/g
  215. }, {
  216. base: "oo",
  217. letters: /[\uA74F]/g
  218. }, {
  219. base: "p",
  220. letters: /[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g
  221. }, {
  222. base: "q",
  223. letters: /[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g
  224. }, {
  225. base: "r",
  226. letters: /[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g
  227. }, {
  228. base: "s",
  229. letters: /[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g
  230. }, {
  231. base: "t",
  232. letters: /[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g
  233. }, {
  234. base: "tz",
  235. letters: /[\uA729]/g
  236. }, {
  237. base: "u",
  238. 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
  239. }, {
  240. base: "v",
  241. letters: /[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g
  242. }, {
  243. base: "vy",
  244. letters: /[\uA761]/g
  245. }, {
  246. base: "w",
  247. letters: /[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g
  248. }, {
  249. base: "x",
  250. letters: /[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g
  251. }, {
  252. base: "y",
  253. letters: /[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g
  254. }, {
  255. base: "z",
  256. letters: /[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g
  257. } ], stripDiacritics = function(str) {
  258. for (var i = 0; i < diacritics.length; i++) str = str.replace(diacritics[i].letters, diacritics[i].base);
  259. return str;
  260. };
  261. function _extends() {
  262. return (_extends = Object.assign || function(target) {
  263. for (var i = 1; i < arguments.length; i++) {
  264. var source = arguments[i];
  265. for (var key in source) Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
  266. }
  267. return target;
  268. }).apply(this, arguments);
  269. }
  270. var trimString = function(str) {
  271. return str.replace(/^\s+|\s+$/g, "");
  272. }, defaultStringify = function(option) {
  273. return option.label + " " + option.value;
  274. }, createFilter = function(config) {
  275. return function(option, rawInput) {
  276. var _ignoreCase$ignoreAcc = _extends({
  277. ignoreCase: !0,
  278. ignoreAccents: !0,
  279. stringify: defaultStringify,
  280. trim: !0,
  281. matchFrom: "any"
  282. }, config), ignoreCase = _ignoreCase$ignoreAcc.ignoreCase, ignoreAccents = _ignoreCase$ignoreAcc.ignoreAccents, stringify = _ignoreCase$ignoreAcc.stringify, trim = _ignoreCase$ignoreAcc.trim, matchFrom = _ignoreCase$ignoreAcc.matchFrom, input = trim ? trimString(rawInput) : rawInput, candidate = trim ? trimString(stringify(option)) : stringify(option);
  283. return ignoreCase && (input = input.toLowerCase(), candidate = candidate.toLowerCase()),
  284. ignoreAccents && (input = stripDiacritics(input), candidate = stripDiacritics(candidate)),
  285. "start" === matchFrom ? candidate.substr(0, input.length) === input : candidate.indexOf(input) > -1;
  286. };
  287. };
  288. function _extends$1() {
  289. return (_extends$1 = Object.assign || function(target) {
  290. for (var i = 1; i < arguments.length; i++) {
  291. var source = arguments[i];
  292. for (var key in source) Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
  293. }
  294. return target;
  295. }).apply(this, arguments);
  296. }
  297. var _ref = {
  298. name: "1laao21-a11yText",
  299. styles: "label:a11yText;z-index:9999;border:0;clip:rect(1px, 1px, 1px, 1px);height:1px;width:1px;position:absolute;overflow:hidden;padding:0;white-space:nowrap;"
  300. }, A11yText = function(props) {
  301. return core.jsx("span", _extends$1({
  302. css: _ref
  303. }, props));
  304. };
  305. function _extends$2() {
  306. return (_extends$2 = Object.assign || function(target) {
  307. for (var i = 1; i < arguments.length; i++) {
  308. var source = arguments[i];
  309. for (var key in source) Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
  310. }
  311. return target;
  312. }).apply(this, arguments);
  313. }
  314. function _objectWithoutPropertiesLoose(source, excluded) {
  315. if (null == source) return {};
  316. var key, i, target = {}, sourceKeys = Object.keys(source);
  317. for (i = 0; i < sourceKeys.length; i++) key = sourceKeys[i], excluded.indexOf(key) >= 0 || (target[key] = source[key]);
  318. return target;
  319. }
  320. function DummyInput(_ref) {
  321. _ref.in, _ref.out, _ref.onExited, _ref.appear, _ref.enter, _ref.exit;
  322. var innerRef = _ref.innerRef, props = (_ref.emotion, _objectWithoutPropertiesLoose(_ref, [ "in", "out", "onExited", "appear", "enter", "exit", "innerRef", "emotion" ]));
  323. return core.jsx("input", _extends$2({
  324. ref: innerRef
  325. }, props, {
  326. css: _css({
  327. label: "dummyInput",
  328. background: 0,
  329. border: 0,
  330. fontSize: "inherit",
  331. outline: 0,
  332. padding: 0,
  333. width: 1,
  334. color: "transparent",
  335. left: -100,
  336. opacity: 0,
  337. position: "relative",
  338. transform: "scale(0)"
  339. }, "")
  340. }));
  341. }
  342. function _inheritsLoose(subClass, superClass) {
  343. subClass.prototype = Object.create(superClass.prototype), subClass.prototype.constructor = subClass,
  344. subClass.__proto__ = superClass;
  345. }
  346. var NodeResolver = function(_Component) {
  347. function NodeResolver() {
  348. return _Component.apply(this, arguments) || this;
  349. }
  350. _inheritsLoose(NodeResolver, _Component);
  351. var _proto = NodeResolver.prototype;
  352. return _proto.componentDidMount = function() {
  353. this.props.innerRef(reactDom.findDOMNode(this));
  354. }, _proto.componentWillUnmount = function() {
  355. this.props.innerRef(null);
  356. }, _proto.render = function() {
  357. return this.props.children;
  358. }, NodeResolver;
  359. }(React.Component), STYLE_KEYS = [ "boxSizing", "height", "overflow", "paddingRight", "position" ], LOCK_STYLES = {
  360. boxSizing: "border-box",
  361. overflow: "hidden",
  362. position: "relative",
  363. height: "100%"
  364. };
  365. function preventTouchMove(e) {
  366. e.preventDefault();
  367. }
  368. function allowTouchMove(e) {
  369. e.stopPropagation();
  370. }
  371. function preventInertiaScroll() {
  372. var top = this.scrollTop, totalScroll = this.scrollHeight, currentScroll = top + this.offsetHeight;
  373. 0 === top ? this.scrollTop = 1 : currentScroll === totalScroll && (this.scrollTop = top - 1);
  374. }
  375. function isTouchDevice() {
  376. return "ontouchstart" in window || navigator.maxTouchPoints;
  377. }
  378. function _inheritsLoose$1(subClass, superClass) {
  379. subClass.prototype = Object.create(superClass.prototype), subClass.prototype.constructor = subClass,
  380. subClass.__proto__ = superClass;
  381. }
  382. var canUseDOM = !("undefined" == typeof window || !window.document || !window.document.createElement), activeScrollLocks = 0, ScrollLock = function(_Component) {
  383. function ScrollLock() {
  384. for (var _this, _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
  385. return (_this = _Component.call.apply(_Component, [ this ].concat(args)) || this).originalStyles = {},
  386. _this.listenerOptions = {
  387. capture: !1,
  388. passive: !1
  389. }, _this;
  390. }
  391. _inheritsLoose$1(ScrollLock, _Component);
  392. var _proto = ScrollLock.prototype;
  393. return _proto.componentDidMount = function() {
  394. var _this2 = this;
  395. if (canUseDOM) {
  396. var _this$props = this.props, accountForScrollbars = _this$props.accountForScrollbars, touchScrollTarget = _this$props.touchScrollTarget, target = document.body, targetStyle = target && target.style;
  397. if (accountForScrollbars && STYLE_KEYS.forEach((function(key) {
  398. var val = targetStyle && targetStyle[key];
  399. _this2.originalStyles[key] = val;
  400. })), accountForScrollbars && activeScrollLocks < 1) {
  401. var currentPadding = parseInt(this.originalStyles.paddingRight, 10) || 0, clientWidth = document.body ? document.body.clientWidth : 0, adjustedPadding = window.innerWidth - clientWidth + currentPadding || 0;
  402. Object.keys(LOCK_STYLES).forEach((function(key) {
  403. var val = LOCK_STYLES[key];
  404. targetStyle && (targetStyle[key] = val);
  405. })), targetStyle && (targetStyle.paddingRight = adjustedPadding + "px");
  406. }
  407. target && isTouchDevice() && (target.addEventListener("touchmove", preventTouchMove, this.listenerOptions),
  408. touchScrollTarget && (touchScrollTarget.addEventListener("touchstart", preventInertiaScroll, this.listenerOptions),
  409. touchScrollTarget.addEventListener("touchmove", allowTouchMove, this.listenerOptions))),
  410. activeScrollLocks += 1;
  411. }
  412. }, _proto.componentWillUnmount = function() {
  413. var _this3 = this;
  414. if (canUseDOM) {
  415. var _this$props2 = this.props, accountForScrollbars = _this$props2.accountForScrollbars, touchScrollTarget = _this$props2.touchScrollTarget, target = document.body, targetStyle = target && target.style;
  416. activeScrollLocks = Math.max(activeScrollLocks - 1, 0), accountForScrollbars && activeScrollLocks < 1 && STYLE_KEYS.forEach((function(key) {
  417. var val = _this3.originalStyles[key];
  418. targetStyle && (targetStyle[key] = val);
  419. })), target && isTouchDevice() && (target.removeEventListener("touchmove", preventTouchMove, this.listenerOptions),
  420. touchScrollTarget && (touchScrollTarget.removeEventListener("touchstart", preventInertiaScroll, this.listenerOptions),
  421. touchScrollTarget.removeEventListener("touchmove", allowTouchMove, this.listenerOptions)));
  422. }
  423. }, _proto.render = function() {
  424. return null;
  425. }, ScrollLock;
  426. }(React.Component);
  427. function _inheritsLoose$2(subClass, superClass) {
  428. subClass.prototype = Object.create(superClass.prototype), subClass.prototype.constructor = subClass,
  429. subClass.__proto__ = superClass;
  430. }
  431. ScrollLock.defaultProps = {
  432. accountForScrollbars: !0
  433. };
  434. var _ref$1 = {
  435. name: "1dsbpcp",
  436. styles: "position:fixed;left:0;bottom:0;right:0;top:0;"
  437. }, ScrollBlock = function(_PureComponent) {
  438. function ScrollBlock() {
  439. for (var _this, _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
  440. return (_this = _PureComponent.call.apply(_PureComponent, [ this ].concat(args)) || this).state = {
  441. touchScrollTarget: null
  442. }, _this.getScrollTarget = function(ref) {
  443. ref !== _this.state.touchScrollTarget && _this.setState({
  444. touchScrollTarget: ref
  445. });
  446. }, _this.blurSelectInput = function() {
  447. document.activeElement && document.activeElement.blur();
  448. }, _this;
  449. }
  450. return _inheritsLoose$2(ScrollBlock, _PureComponent), ScrollBlock.prototype.render = function() {
  451. var _this$props = this.props, children = _this$props.children, isEnabled = _this$props.isEnabled, touchScrollTarget = this.state.touchScrollTarget;
  452. return isEnabled ? core.jsx("div", null, core.jsx("div", {
  453. onClick: this.blurSelectInput,
  454. css: _ref$1
  455. }), core.jsx(NodeResolver, {
  456. innerRef: this.getScrollTarget
  457. }, children), touchScrollTarget ? core.jsx(ScrollLock, {
  458. touchScrollTarget: touchScrollTarget
  459. }) : null) : children;
  460. }, ScrollBlock;
  461. }(React.PureComponent);
  462. function _objectWithoutPropertiesLoose$1(source, excluded) {
  463. if (null == source) return {};
  464. var key, i, target = {}, sourceKeys = Object.keys(source);
  465. for (i = 0; i < sourceKeys.length; i++) key = sourceKeys[i], excluded.indexOf(key) >= 0 || (target[key] = source[key]);
  466. return target;
  467. }
  468. function _inheritsLoose$3(subClass, superClass) {
  469. subClass.prototype = Object.create(superClass.prototype), subClass.prototype.constructor = subClass,
  470. subClass.__proto__ = superClass;
  471. }
  472. var ScrollCaptor = function(_Component) {
  473. function ScrollCaptor() {
  474. for (var _this, _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
  475. return (_this = _Component.call.apply(_Component, [ this ].concat(args)) || this).isBottom = !1,
  476. _this.isTop = !1, _this.scrollTarget = void 0, _this.touchStart = void 0, _this.cancelScroll = function(event) {
  477. event.preventDefault(), event.stopPropagation();
  478. }, _this.handleEventDelta = function(event, delta) {
  479. var _this$props = _this.props, onBottomArrive = _this$props.onBottomArrive, onBottomLeave = _this$props.onBottomLeave, onTopArrive = _this$props.onTopArrive, onTopLeave = _this$props.onTopLeave, _this$scrollTarget = _this.scrollTarget, scrollTop = _this$scrollTarget.scrollTop, scrollHeight = _this$scrollTarget.scrollHeight, clientHeight = _this$scrollTarget.clientHeight, target = _this.scrollTarget, isDeltaPositive = delta > 0, availableScroll = scrollHeight - clientHeight - scrollTop, shouldCancelScroll = !1;
  480. availableScroll > delta && _this.isBottom && (onBottomLeave && onBottomLeave(event),
  481. _this.isBottom = !1), isDeltaPositive && _this.isTop && (onTopLeave && onTopLeave(event),
  482. _this.isTop = !1), isDeltaPositive && delta > availableScroll ? (onBottomArrive && !_this.isBottom && onBottomArrive(event),
  483. target.scrollTop = scrollHeight, shouldCancelScroll = !0, _this.isBottom = !0) : !isDeltaPositive && -delta > scrollTop && (onTopArrive && !_this.isTop && onTopArrive(event),
  484. target.scrollTop = 0, shouldCancelScroll = !0, _this.isTop = !0), shouldCancelScroll && _this.cancelScroll(event);
  485. }, _this.onWheel = function(event) {
  486. _this.handleEventDelta(event, event.deltaY);
  487. }, _this.onTouchStart = function(event) {
  488. _this.touchStart = event.changedTouches[0].clientY;
  489. }, _this.onTouchMove = function(event) {
  490. var deltaY = _this.touchStart - event.changedTouches[0].clientY;
  491. _this.handleEventDelta(event, deltaY);
  492. }, _this.getScrollTarget = function(ref) {
  493. _this.scrollTarget = ref;
  494. }, _this;
  495. }
  496. _inheritsLoose$3(ScrollCaptor, _Component);
  497. var _proto = ScrollCaptor.prototype;
  498. return _proto.componentDidMount = function() {
  499. this.startListening(this.scrollTarget);
  500. }, _proto.componentWillUnmount = function() {
  501. this.stopListening(this.scrollTarget);
  502. }, _proto.startListening = function(el) {
  503. el && ("function" == typeof el.addEventListener && el.addEventListener("wheel", this.onWheel, !1),
  504. "function" == typeof el.addEventListener && el.addEventListener("touchstart", this.onTouchStart, !1),
  505. "function" == typeof el.addEventListener && el.addEventListener("touchmove", this.onTouchMove, !1));
  506. }, _proto.stopListening = function(el) {
  507. "function" == typeof el.removeEventListener && el.removeEventListener("wheel", this.onWheel, !1),
  508. "function" == typeof el.removeEventListener && el.removeEventListener("touchstart", this.onTouchStart, !1),
  509. "function" == typeof el.removeEventListener && el.removeEventListener("touchmove", this.onTouchMove, !1);
  510. }, _proto.render = function() {
  511. return React__default.createElement(NodeResolver, {
  512. innerRef: this.getScrollTarget
  513. }, this.props.children);
  514. }, ScrollCaptor;
  515. }(React.Component);
  516. function ScrollCaptorSwitch(_ref) {
  517. var _ref$isEnabled = _ref.isEnabled, isEnabled = void 0 === _ref$isEnabled || _ref$isEnabled, props = _objectWithoutPropertiesLoose$1(_ref, [ "isEnabled" ]);
  518. return isEnabled ? React__default.createElement(ScrollCaptor, props) : props.children;
  519. }
  520. var instructionsAriaMessage = function(event, context) {
  521. void 0 === context && (context = {});
  522. var _context = context, isSearchable = _context.isSearchable, isMulti = _context.isMulti, label = _context.label, isDisabled = _context.isDisabled;
  523. switch (event) {
  524. case "menu":
  525. return "Use Up and Down to choose options" + (isDisabled ? "" : ", press Enter to select the currently focused option") + ", press Escape to exit the menu, press Tab to select the option and exit the menu.";
  526. case "input":
  527. return (label || "Select") + " is focused " + (isSearchable ? ",type to refine list" : "") + ", press Down to open the menu, " + (isMulti ? " press left to focus selected values" : "");
  528. case "value":
  529. return "Use left and right to toggle between focused values, press Backspace to remove the currently focused value";
  530. }
  531. }, valueEventAriaMessage = function(event, context) {
  532. var value = context.value, isDisabled = context.isDisabled;
  533. if (value) switch (event) {
  534. case "deselect-option":
  535. case "pop-value":
  536. case "remove-value":
  537. return "option " + value + ", deselected.";
  538. case "select-option":
  539. return isDisabled ? "option " + value + " is disabled. Select another option." : "option " + value + ", selected.";
  540. }
  541. }, valueFocusAriaMessage = function(_ref) {
  542. var focusedValue = _ref.focusedValue, getOptionLabel = _ref.getOptionLabel, selectValue = _ref.selectValue;
  543. return "value " + getOptionLabel(focusedValue) + " focused, " + (selectValue.indexOf(focusedValue) + 1) + " of " + selectValue.length + ".";
  544. }, optionFocusAriaMessage = function(_ref2) {
  545. var focusedOption = _ref2.focusedOption, getOptionLabel = _ref2.getOptionLabel, options = _ref2.options;
  546. return "option " + getOptionLabel(focusedOption) + " focused" + (focusedOption.isDisabled ? " disabled" : "") + ", " + (options.indexOf(focusedOption) + 1) + " of " + options.length + ".";
  547. }, resultsAriaMessage = function(_ref3) {
  548. var inputValue = _ref3.inputValue;
  549. return _ref3.screenReaderMessage + (inputValue ? " for search term " + inputValue : "") + ".";
  550. }, formatGroupLabel = function(group) {
  551. return group.label;
  552. }, getOptionLabel = function(option) {
  553. return option.label;
  554. }, getOptionValue = function(option) {
  555. return option.value;
  556. }, isOptionDisabled = function(option) {
  557. return !!option.isDisabled;
  558. };
  559. function _extends$3() {
  560. return (_extends$3 = Object.assign || function(target) {
  561. for (var i = 1; i < arguments.length; i++) {
  562. var source = arguments[i];
  563. for (var key in source) Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
  564. }
  565. return target;
  566. }).apply(this, arguments);
  567. }
  568. var defaultStyles = {
  569. clearIndicator: index.clearIndicatorCSS,
  570. container: index.containerCSS,
  571. control: index.css,
  572. dropdownIndicator: index.dropdownIndicatorCSS,
  573. group: index.groupCSS,
  574. groupHeading: index.groupHeadingCSS,
  575. indicatorsContainer: index.indicatorsContainerCSS,
  576. indicatorSeparator: index.indicatorSeparatorCSS,
  577. input: index.inputCSS,
  578. loadingIndicator: index.loadingIndicatorCSS,
  579. loadingMessage: index.loadingMessageCSS,
  580. menu: index.menuCSS,
  581. menuList: index.menuListCSS,
  582. menuPortal: index.menuPortalCSS,
  583. multiValue: index.multiValueCSS,
  584. multiValueLabel: index.multiValueLabelCSS,
  585. multiValueRemove: index.multiValueRemoveCSS,
  586. noOptionsMessage: index.noOptionsMessageCSS,
  587. option: index.optionCSS,
  588. placeholder: index.placeholderCSS,
  589. singleValue: index.css$1,
  590. valueContainer: index.valueContainerCSS
  591. };
  592. function mergeStyles(source, target) {
  593. void 0 === target && (target = {});
  594. var styles = _extends$3({}, source);
  595. return Object.keys(target).forEach((function(key) {
  596. source[key] ? styles[key] = function(rsCss, props) {
  597. return target[key](source[key](rsCss, props), props);
  598. } : styles[key] = target[key];
  599. })), styles;
  600. }
  601. var colors = {
  602. primary: "#2684FF",
  603. primary75: "#4C9AFF",
  604. primary50: "#B2D4FF",
  605. primary25: "#DEEBFF",
  606. danger: "#DE350B",
  607. dangerLight: "#FFBDAD",
  608. neutral0: "hsl(0, 0%, 100%)",
  609. neutral5: "hsl(0, 0%, 95%)",
  610. neutral10: "hsl(0, 0%, 90%)",
  611. neutral20: "hsl(0, 0%, 80%)",
  612. neutral30: "hsl(0, 0%, 70%)",
  613. neutral40: "hsl(0, 0%, 60%)",
  614. neutral50: "hsl(0, 0%, 50%)",
  615. neutral60: "hsl(0, 0%, 40%)",
  616. neutral70: "hsl(0, 0%, 30%)",
  617. neutral80: "hsl(0, 0%, 20%)",
  618. neutral90: "hsl(0, 0%, 10%)"
  619. }, borderRadius = 4, baseUnit = 4, controlHeight = 38, menuGutter = 2 * baseUnit, spacing = {
  620. baseUnit: baseUnit,
  621. controlHeight: controlHeight,
  622. menuGutter: menuGutter
  623. }, defaultTheme = {
  624. borderRadius: borderRadius,
  625. colors: colors,
  626. spacing: spacing
  627. };
  628. function _objectWithoutPropertiesLoose$2(source, excluded) {
  629. if (null == source) return {};
  630. var key, i, target = {}, sourceKeys = Object.keys(source);
  631. for (i = 0; i < sourceKeys.length; i++) key = sourceKeys[i], excluded.indexOf(key) >= 0 || (target[key] = source[key]);
  632. return target;
  633. }
  634. function _extends$4() {
  635. return (_extends$4 = Object.assign || function(target) {
  636. for (var i = 1; i < arguments.length; i++) {
  637. var source = arguments[i];
  638. for (var key in source) Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
  639. }
  640. return target;
  641. }).apply(this, arguments);
  642. }
  643. function _inheritsLoose$4(subClass, superClass) {
  644. subClass.prototype = Object.create(superClass.prototype), subClass.prototype.constructor = subClass,
  645. subClass.__proto__ = superClass;
  646. }
  647. function _assertThisInitialized(self) {
  648. if (void 0 === self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  649. return self;
  650. }
  651. var defaultProps = {
  652. backspaceRemovesValue: !0,
  653. blurInputOnSelect: utils.isTouchCapable(),
  654. captureMenuScroll: !utils.isTouchCapable(),
  655. closeMenuOnSelect: !0,
  656. closeMenuOnScroll: !1,
  657. components: {},
  658. controlShouldRenderValue: !0,
  659. escapeClearsValue: !1,
  660. filterOption: createFilter(),
  661. formatGroupLabel: formatGroupLabel,
  662. getOptionLabel: getOptionLabel,
  663. getOptionValue: getOptionValue,
  664. isDisabled: !1,
  665. isLoading: !1,
  666. isMulti: !1,
  667. isRtl: !1,
  668. isSearchable: !0,
  669. isOptionDisabled: isOptionDisabled,
  670. loadingMessage: function() {
  671. return "Loading...";
  672. },
  673. maxMenuHeight: 300,
  674. minMenuHeight: 140,
  675. menuIsOpen: !1,
  676. menuPlacement: "bottom",
  677. menuPosition: "absolute",
  678. menuShouldBlockScroll: !1,
  679. menuShouldScrollIntoView: !utils.isMobileDevice(),
  680. noOptionsMessage: function() {
  681. return "No options";
  682. },
  683. openMenuOnFocus: !1,
  684. openMenuOnClick: !0,
  685. options: [],
  686. pageSize: 5,
  687. placeholder: "Select...",
  688. screenReaderStatus: function(_ref) {
  689. var count = _ref.count;
  690. return count + " result" + (1 !== count ? "s" : "") + " available";
  691. },
  692. styles: {},
  693. tabIndex: "0",
  694. tabSelectsValue: !0
  695. }, instanceId = 1, Select = function(_Component) {
  696. function Select(_props) {
  697. var _this;
  698. (_this = _Component.call(this, _props) || this).state = {
  699. ariaLiveSelection: "",
  700. ariaLiveContext: "",
  701. focusedOption: null,
  702. focusedValue: null,
  703. inputIsHidden: !1,
  704. isFocused: !1,
  705. menuOptions: {
  706. render: [],
  707. focusable: []
  708. },
  709. selectValue: []
  710. }, _this.blockOptionHover = !1, _this.isComposing = !1, _this.clearFocusValueOnUpdate = !1,
  711. _this.commonProps = void 0, _this.components = void 0, _this.hasGroups = !1, _this.initialTouchX = 0,
  712. _this.initialTouchY = 0, _this.inputIsHiddenAfterUpdate = void 0, _this.instancePrefix = "",
  713. _this.openAfterFocus = !1, _this.scrollToFocusedOptionOnUpdate = !1, _this.userIsDragging = void 0,
  714. _this.controlRef = null, _this.getControlRef = function(ref) {
  715. _this.controlRef = ref;
  716. }, _this.focusedOptionRef = null, _this.getFocusedOptionRef = function(ref) {
  717. _this.focusedOptionRef = ref;
  718. }, _this.menuListRef = null, _this.getMenuListRef = function(ref) {
  719. _this.menuListRef = ref;
  720. }, _this.inputRef = null, _this.getInputRef = function(ref) {
  721. _this.inputRef = ref;
  722. }, _this.cacheComponents = function(components) {
  723. _this.components = index.defaultComponents({
  724. components: components
  725. });
  726. }, _this.focus = _this.focusInput, _this.blur = _this.blurInput, _this.onChange = function(newValue, actionMeta) {
  727. var _this$props = _this.props;
  728. (0, _this$props.onChange)(newValue, _extends$4({}, actionMeta, {
  729. name: _this$props.name
  730. }));
  731. }, _this.setValue = function(newValue, action, option) {
  732. void 0 === action && (action = "set-value");
  733. var _this$props2 = _this.props, closeMenuOnSelect = _this$props2.closeMenuOnSelect, isMulti = _this$props2.isMulti;
  734. _this.onInputChange("", {
  735. action: "set-value"
  736. }), closeMenuOnSelect && (_this.inputIsHiddenAfterUpdate = !isMulti, _this.onMenuClose()),
  737. _this.clearFocusValueOnUpdate = !0, _this.onChange(newValue, {
  738. action: action,
  739. option: option
  740. });
  741. }, _this.selectOption = function(newValue) {
  742. var _this$props3 = _this.props, blurInputOnSelect = _this$props3.blurInputOnSelect, isMulti = _this$props3.isMulti, selectValue = _this.state.selectValue;
  743. if (isMulti) if (_this.isOptionSelected(newValue, selectValue)) {
  744. var candidate = _this.getOptionValue(newValue);
  745. _this.setValue(selectValue.filter((function(i) {
  746. return _this.getOptionValue(i) !== candidate;
  747. })), "deselect-option", newValue), _this.announceAriaLiveSelection({
  748. event: "deselect-option",
  749. context: {
  750. value: _this.getOptionLabel(newValue)
  751. }
  752. });
  753. } else _this.isOptionDisabled(newValue, selectValue) ? _this.announceAriaLiveSelection({
  754. event: "select-option",
  755. context: {
  756. value: _this.getOptionLabel(newValue),
  757. isDisabled: !0
  758. }
  759. }) : (_this.setValue([].concat(selectValue, [ newValue ]), "select-option", newValue),
  760. _this.announceAriaLiveSelection({
  761. event: "select-option",
  762. context: {
  763. value: _this.getOptionLabel(newValue)
  764. }
  765. })); else _this.isOptionDisabled(newValue, selectValue) ? _this.announceAriaLiveSelection({
  766. event: "select-option",
  767. context: {
  768. value: _this.getOptionLabel(newValue),
  769. isDisabled: !0
  770. }
  771. }) : (_this.setValue(newValue, "select-option"), _this.announceAriaLiveSelection({
  772. event: "select-option",
  773. context: {
  774. value: _this.getOptionLabel(newValue)
  775. }
  776. }));
  777. blurInputOnSelect && _this.blurInput();
  778. }, _this.removeValue = function(removedValue) {
  779. var selectValue = _this.state.selectValue, candidate = _this.getOptionValue(removedValue), newValue = selectValue.filter((function(i) {
  780. return _this.getOptionValue(i) !== candidate;
  781. }));
  782. _this.onChange(newValue.length ? newValue : null, {
  783. action: "remove-value",
  784. removedValue: removedValue
  785. }), _this.announceAriaLiveSelection({
  786. event: "remove-value",
  787. context: {
  788. value: removedValue ? _this.getOptionLabel(removedValue) : ""
  789. }
  790. }), _this.focusInput();
  791. }, _this.clearValue = function() {
  792. var isMulti = _this.props.isMulti;
  793. _this.onChange(isMulti ? [] : null, {
  794. action: "clear"
  795. });
  796. }, _this.popValue = function() {
  797. var selectValue = _this.state.selectValue, lastSelectedValue = selectValue[selectValue.length - 1], newValue = selectValue.slice(0, selectValue.length - 1);
  798. _this.announceAriaLiveSelection({
  799. event: "pop-value",
  800. context: {
  801. value: lastSelectedValue ? _this.getOptionLabel(lastSelectedValue) : ""
  802. }
  803. }), _this.onChange(newValue.length ? newValue : null, {
  804. action: "pop-value",
  805. removedValue: lastSelectedValue
  806. });
  807. }, _this.getOptionLabel = function(data) {
  808. return _this.props.getOptionLabel(data);
  809. }, _this.getOptionValue = function(data) {
  810. return _this.props.getOptionValue(data);
  811. }, _this.getStyles = function(key, props) {
  812. var base = defaultStyles[key](props);
  813. base.boxSizing = "border-box";
  814. var custom = _this.props.styles[key];
  815. return custom ? custom(base, props) : base;
  816. }, _this.getElementId = function(element) {
  817. return _this.instancePrefix + "-" + element;
  818. }, _this.getActiveDescendentId = function() {
  819. var menuIsOpen = _this.props.menuIsOpen, _this$state = _this.state, menuOptions = _this$state.menuOptions, focusedOption = _this$state.focusedOption;
  820. if (focusedOption && menuIsOpen) {
  821. var index = menuOptions.focusable.indexOf(focusedOption), option = menuOptions.render[index];
  822. return option && option.key;
  823. }
  824. }, _this.announceAriaLiveSelection = function(_ref2) {
  825. var event = _ref2.event, context = _ref2.context;
  826. _this.setState({
  827. ariaLiveSelection: valueEventAriaMessage(event, context)
  828. });
  829. }, _this.announceAriaLiveContext = function(_ref3) {
  830. var event = _ref3.event, context = _ref3.context;
  831. _this.setState({
  832. ariaLiveContext: instructionsAriaMessage(event, _extends$4({}, context, {
  833. label: _this.props["aria-label"]
  834. }))
  835. });
  836. }, _this.onMenuMouseDown = function(event) {
  837. 0 === event.button && (event.stopPropagation(), event.preventDefault(), _this.focusInput());
  838. }, _this.onMenuMouseMove = function(event) {
  839. _this.blockOptionHover = !1;
  840. }, _this.onControlMouseDown = function(event) {
  841. var openMenuOnClick = _this.props.openMenuOnClick;
  842. _this.state.isFocused ? _this.props.menuIsOpen ? "INPUT" !== event.target.tagName && "TEXTAREA" !== event.target.tagName && _this.onMenuClose() : openMenuOnClick && _this.openMenu("first") : (openMenuOnClick && (_this.openAfterFocus = !0),
  843. _this.focusInput()), "INPUT" !== event.target.tagName && "TEXTAREA" !== event.target.tagName && event.preventDefault();
  844. }, _this.onDropdownIndicatorMouseDown = function(event) {
  845. if (!(event && "mousedown" === event.type && 0 !== event.button || _this.props.isDisabled)) {
  846. var _this$props4 = _this.props, isMulti = _this$props4.isMulti, menuIsOpen = _this$props4.menuIsOpen;
  847. _this.focusInput(), menuIsOpen ? (_this.inputIsHiddenAfterUpdate = !isMulti, _this.onMenuClose()) : _this.openMenu("first"),
  848. event.preventDefault(), event.stopPropagation();
  849. }
  850. }, _this.onClearIndicatorMouseDown = function(event) {
  851. event && "mousedown" === event.type && 0 !== event.button || (_this.clearValue(),
  852. event.stopPropagation(), _this.openAfterFocus = !1, "touchend" === event.type ? _this.focusInput() : setTimeout((function() {
  853. return _this.focusInput();
  854. })));
  855. }, _this.onScroll = function(event) {
  856. "boolean" == typeof _this.props.closeMenuOnScroll ? event.target instanceof HTMLElement && utils.isDocumentElement(event.target) && _this.props.onMenuClose() : "function" == typeof _this.props.closeMenuOnScroll && _this.props.closeMenuOnScroll(event) && _this.props.onMenuClose();
  857. }, _this.onCompositionStart = function() {
  858. _this.isComposing = !0;
  859. }, _this.onCompositionEnd = function() {
  860. _this.isComposing = !1;
  861. }, _this.onTouchStart = function(_ref4) {
  862. var touch = _ref4.touches.item(0);
  863. touch && (_this.initialTouchX = touch.clientX, _this.initialTouchY = touch.clientY,
  864. _this.userIsDragging = !1);
  865. }, _this.onTouchMove = function(_ref5) {
  866. var touch = _ref5.touches.item(0);
  867. if (touch) {
  868. var deltaX = Math.abs(touch.clientX - _this.initialTouchX), deltaY = Math.abs(touch.clientY - _this.initialTouchY);
  869. _this.userIsDragging = deltaX > 5 || deltaY > 5;
  870. }
  871. }, _this.onTouchEnd = function(event) {
  872. _this.userIsDragging || (_this.controlRef && !_this.controlRef.contains(event.target) && _this.menuListRef && !_this.menuListRef.contains(event.target) && _this.blurInput(),
  873. _this.initialTouchX = 0, _this.initialTouchY = 0);
  874. }, _this.onControlTouchEnd = function(event) {
  875. _this.userIsDragging || _this.onControlMouseDown(event);
  876. }, _this.onClearIndicatorTouchEnd = function(event) {
  877. _this.userIsDragging || _this.onClearIndicatorMouseDown(event);
  878. }, _this.onDropdownIndicatorTouchEnd = function(event) {
  879. _this.userIsDragging || _this.onDropdownIndicatorMouseDown(event);
  880. }, _this.handleInputChange = function(event) {
  881. var inputValue = event.currentTarget.value;
  882. _this.inputIsHiddenAfterUpdate = !1, _this.onInputChange(inputValue, {
  883. action: "input-change"
  884. }), _this.onMenuOpen();
  885. }, _this.onInputFocus = function(event) {
  886. var _this$props5 = _this.props, isSearchable = _this$props5.isSearchable, isMulti = _this$props5.isMulti;
  887. _this.props.onFocus && _this.props.onFocus(event), _this.inputIsHiddenAfterUpdate = !1,
  888. _this.announceAriaLiveContext({
  889. event: "input",
  890. context: {
  891. isSearchable: isSearchable,
  892. isMulti: isMulti
  893. }
  894. }), _this.setState({
  895. isFocused: !0
  896. }), (_this.openAfterFocus || _this.props.openMenuOnFocus) && _this.openMenu("first"),
  897. _this.openAfterFocus = !1;
  898. }, _this.onInputBlur = function(event) {
  899. _this.menuListRef && _this.menuListRef.contains(document.activeElement) ? _this.inputRef.focus() : (_this.props.onBlur && _this.props.onBlur(event),
  900. _this.onInputChange("", {
  901. action: "input-blur"
  902. }), _this.onMenuClose(), _this.setState({
  903. focusedValue: null,
  904. isFocused: !1
  905. }));
  906. }, _this.onOptionHover = function(focusedOption) {
  907. _this.blockOptionHover || _this.state.focusedOption === focusedOption || _this.setState({
  908. focusedOption: focusedOption
  909. });
  910. }, _this.shouldHideSelectedOptions = function() {
  911. var _this$props6 = _this.props, hideSelectedOptions = _this$props6.hideSelectedOptions, isMulti = _this$props6.isMulti;
  912. return void 0 === hideSelectedOptions ? isMulti : hideSelectedOptions;
  913. }, _this.onKeyDown = function(event) {
  914. var _this$props7 = _this.props, isMulti = _this$props7.isMulti, backspaceRemovesValue = _this$props7.backspaceRemovesValue, escapeClearsValue = _this$props7.escapeClearsValue, inputValue = _this$props7.inputValue, isClearable = _this$props7.isClearable, isDisabled = _this$props7.isDisabled, menuIsOpen = _this$props7.menuIsOpen, onKeyDown = _this$props7.onKeyDown, tabSelectsValue = _this$props7.tabSelectsValue, openMenuOnFocus = _this$props7.openMenuOnFocus, _this$state2 = _this.state, focusedOption = _this$state2.focusedOption, focusedValue = _this$state2.focusedValue, selectValue = _this$state2.selectValue;
  915. if (!(isDisabled || "function" == typeof onKeyDown && (onKeyDown(event), event.defaultPrevented))) {
  916. switch (_this.blockOptionHover = !0, event.key) {
  917. case "ArrowLeft":
  918. if (!isMulti || inputValue) return;
  919. _this.focusValue("previous");
  920. break;
  921. case "ArrowRight":
  922. if (!isMulti || inputValue) return;
  923. _this.focusValue("next");
  924. break;
  925. case "Delete":
  926. case "Backspace":
  927. if (inputValue) return;
  928. if (focusedValue) _this.removeValue(focusedValue); else {
  929. if (!backspaceRemovesValue) return;
  930. isMulti ? _this.popValue() : isClearable && _this.clearValue();
  931. }
  932. break;
  933. case "Tab":
  934. if (_this.isComposing) return;
  935. if (event.shiftKey || !menuIsOpen || !tabSelectsValue || !focusedOption || openMenuOnFocus && _this.isOptionSelected(focusedOption, selectValue)) return;
  936. _this.selectOption(focusedOption);
  937. break;
  938. case "Enter":
  939. if (229 === event.keyCode) break;
  940. if (menuIsOpen) {
  941. if (!focusedOption) return;
  942. if (_this.isComposing) return;
  943. _this.selectOption(focusedOption);
  944. break;
  945. }
  946. return;
  947. case "Escape":
  948. menuIsOpen ? (_this.inputIsHiddenAfterUpdate = !1, _this.onInputChange("", {
  949. action: "menu-close"
  950. }), _this.onMenuClose()) : isClearable && escapeClearsValue && _this.clearValue();
  951. break;
  952. case " ":
  953. if (inputValue) return;
  954. if (!menuIsOpen) {
  955. _this.openMenu("first");
  956. break;
  957. }
  958. if (!focusedOption) return;
  959. _this.selectOption(focusedOption);
  960. break;
  961. case "ArrowUp":
  962. menuIsOpen ? _this.focusOption("up") : _this.openMenu("last");
  963. break;
  964. case "ArrowDown":
  965. menuIsOpen ? _this.focusOption("down") : _this.openMenu("first");
  966. break;
  967. case "PageUp":
  968. if (!menuIsOpen) return;
  969. _this.focusOption("pageup");
  970. break;
  971. case "PageDown":
  972. if (!menuIsOpen) return;
  973. _this.focusOption("pagedown");
  974. break;
  975. case "Home":
  976. if (!menuIsOpen) return;
  977. _this.focusOption("first");
  978. break;
  979. case "End":
  980. if (!menuIsOpen) return;
  981. _this.focusOption("last");
  982. break;
  983. default:
  984. return;
  985. }
  986. event.preventDefault();
  987. }
  988. }, _this.buildMenuOptions = function(props, selectValue) {
  989. var _props$inputValue = props.inputValue, inputValue = void 0 === _props$inputValue ? "" : _props$inputValue, options = props.options, toOption = function(option, id) {
  990. var isDisabled = _this.isOptionDisabled(option, selectValue), isSelected = _this.isOptionSelected(option, selectValue), label = _this.getOptionLabel(option), value = _this.getOptionValue(option);
  991. if (!(_this.shouldHideSelectedOptions() && isSelected || !_this.filterOption({
  992. label: label,
  993. value: value,
  994. data: option
  995. }, inputValue))) {
  996. var onHover = isDisabled ? void 0 : function() {
  997. return _this.onOptionHover(option);
  998. }, onSelect = isDisabled ? void 0 : function() {
  999. return _this.selectOption(option);
  1000. }, optionId = _this.getElementId("option") + "-" + id;
  1001. return {
  1002. innerProps: {
  1003. id: optionId,
  1004. onClick: onSelect,
  1005. onMouseMove: onHover,
  1006. onMouseOver: onHover,
  1007. tabIndex: -1
  1008. },
  1009. data: option,
  1010. isDisabled: isDisabled,
  1011. isSelected: isSelected,
  1012. key: optionId,
  1013. label: label,
  1014. type: "option",
  1015. value: value
  1016. };
  1017. }
  1018. };
  1019. return options.reduce((function(acc, item, itemIndex) {
  1020. if (item.options) {
  1021. _this.hasGroups || (_this.hasGroups = !0);
  1022. var children = item.options.map((function(child, i) {
  1023. var option = toOption(child, itemIndex + "-" + i);
  1024. return option && acc.focusable.push(child), option;
  1025. })).filter(Boolean);
  1026. if (children.length) {
  1027. var groupId = _this.getElementId("group") + "-" + itemIndex;
  1028. acc.render.push({
  1029. type: "group",
  1030. key: groupId,
  1031. data: item,
  1032. options: children
  1033. });
  1034. }
  1035. } else {
  1036. var option = toOption(item, "" + itemIndex);
  1037. option && (acc.render.push(option), acc.focusable.push(item));
  1038. }
  1039. return acc;
  1040. }), {
  1041. render: [],
  1042. focusable: []
  1043. });
  1044. };
  1045. var _value = _props.value;
  1046. _this.cacheComponents = memoizeOne(_this.cacheComponents, index.exportedEqual).bind(_assertThisInitialized(_assertThisInitialized(_this))),
  1047. _this.cacheComponents(_props.components), _this.instancePrefix = "react-select-" + (_this.props.instanceId || ++instanceId);
  1048. var _selectValue = utils.cleanValue(_value);
  1049. _this.buildMenuOptions = memoizeOne(_this.buildMenuOptions, (function(newArgs, lastArgs) {
  1050. var _ref6 = newArgs, newProps = _ref6[0], newSelectValue = _ref6[1], _ref7 = lastArgs, lastProps = _ref7[0], lastSelectValue = _ref7[1];
  1051. return index.exportedEqual(newSelectValue, lastSelectValue) && index.exportedEqual(newProps.inputValue, lastProps.inputValue) && index.exportedEqual(newProps.options, lastProps.options);
  1052. })).bind(_assertThisInitialized(_assertThisInitialized(_this)));
  1053. var _menuOptions = _props.menuIsOpen ? _this.buildMenuOptions(_props, _selectValue) : {
  1054. render: [],
  1055. focusable: []
  1056. };
  1057. return _this.state.menuOptions = _menuOptions, _this.state.selectValue = _selectValue,
  1058. _this;
  1059. }
  1060. _inheritsLoose$4(Select, _Component);
  1061. var _proto = Select.prototype;
  1062. return _proto.componentDidMount = function() {
  1063. this.startListeningComposition(), this.startListeningToTouch(), this.props.closeMenuOnScroll && document && document.addEventListener && document.addEventListener("scroll", this.onScroll, !0),
  1064. this.props.autoFocus && this.focusInput();
  1065. }, _proto.UNSAFE_componentWillReceiveProps = function(nextProps) {
  1066. var _this$props8 = this.props, options = _this$props8.options, value = _this$props8.value, menuIsOpen = _this$props8.menuIsOpen, inputValue = _this$props8.inputValue;
  1067. if (this.cacheComponents(nextProps.components), nextProps.value !== value || nextProps.options !== options || nextProps.menuIsOpen !== menuIsOpen || nextProps.inputValue !== inputValue) {
  1068. var selectValue = utils.cleanValue(nextProps.value), menuOptions = nextProps.menuIsOpen ? this.buildMenuOptions(nextProps, selectValue) : {
  1069. render: [],
  1070. focusable: []
  1071. }, focusedValue = this.getNextFocusedValue(selectValue), focusedOption = this.getNextFocusedOption(menuOptions.focusable);
  1072. this.setState({
  1073. menuOptions: menuOptions,
  1074. selectValue: selectValue,
  1075. focusedOption: focusedOption,
  1076. focusedValue: focusedValue
  1077. });
  1078. }
  1079. null != this.inputIsHiddenAfterUpdate && (this.setState({
  1080. inputIsHidden: this.inputIsHiddenAfterUpdate
  1081. }), delete this.inputIsHiddenAfterUpdate);
  1082. }, _proto.componentDidUpdate = function(prevProps) {
  1083. var _this$props9 = this.props, isDisabled = _this$props9.isDisabled, menuIsOpen = _this$props9.menuIsOpen, isFocused = this.state.isFocused;
  1084. (isFocused && !isDisabled && prevProps.isDisabled || isFocused && menuIsOpen && !prevProps.menuIsOpen) && this.focusInput(),
  1085. this.menuListRef && this.focusedOptionRef && this.scrollToFocusedOptionOnUpdate && (utils.scrollIntoView(this.menuListRef, this.focusedOptionRef),
  1086. this.scrollToFocusedOptionOnUpdate = !1);
  1087. }, _proto.componentWillUnmount = function() {
  1088. this.stopListeningComposition(), this.stopListeningToTouch(), document.removeEventListener("scroll", this.onScroll, !0);
  1089. }, _proto.onMenuOpen = function() {
  1090. this.props.onMenuOpen();
  1091. }, _proto.onMenuClose = function() {
  1092. var _this$props10 = this.props, isSearchable = _this$props10.isSearchable, isMulti = _this$props10.isMulti;
  1093. this.announceAriaLiveContext({
  1094. event: "input",
  1095. context: {
  1096. isSearchable: isSearchable,
  1097. isMulti: isMulti
  1098. }
  1099. }), this.onInputChange("", {
  1100. action: "menu-close"
  1101. }), this.props.onMenuClose();
  1102. }, _proto.onInputChange = function(newValue, actionMeta) {
  1103. this.props.onInputChange(newValue, actionMeta);
  1104. }, _proto.focusInput = function() {
  1105. this.inputRef && this.inputRef.focus();
  1106. }, _proto.blurInput = function() {
  1107. this.inputRef && this.inputRef.blur();
  1108. }, _proto.openMenu = function(focusOption) {
  1109. var _this2 = this, _this$state3 = this.state, selectValue = _this$state3.selectValue, isFocused = _this$state3.isFocused, menuOptions = this.buildMenuOptions(this.props, selectValue), isMulti = this.props.isMulti, openAtIndex = "first" === focusOption ? 0 : menuOptions.focusable.length - 1;
  1110. if (!isMulti) {
  1111. var selectedIndex = menuOptions.focusable.indexOf(selectValue[0]);
  1112. selectedIndex > -1 && (openAtIndex = selectedIndex);
  1113. }
  1114. this.scrollToFocusedOptionOnUpdate = !(isFocused && this.menuListRef), this.inputIsHiddenAfterUpdate = !1,
  1115. this.setState({
  1116. menuOptions: menuOptions,
  1117. focusedValue: null,
  1118. focusedOption: menuOptions.focusable[openAtIndex]
  1119. }, (function() {
  1120. _this2.onMenuOpen(), _this2.announceAriaLiveContext({
  1121. event: "menu"
  1122. });
  1123. }));
  1124. }, _proto.focusValue = function(direction) {
  1125. var _this$props11 = this.props, isMulti = _this$props11.isMulti, isSearchable = _this$props11.isSearchable, _this$state4 = this.state, selectValue = _this$state4.selectValue, focusedValue = _this$state4.focusedValue;
  1126. if (isMulti) {
  1127. this.setState({
  1128. focusedOption: null
  1129. });
  1130. var focusedIndex = selectValue.indexOf(focusedValue);
  1131. focusedValue || (focusedIndex = -1, this.announceAriaLiveContext({
  1132. event: "value"
  1133. }));
  1134. var lastIndex = selectValue.length - 1, nextFocus = -1;
  1135. if (selectValue.length) {
  1136. switch (direction) {
  1137. case "previous":
  1138. nextFocus = 0 === focusedIndex ? 0 : -1 === focusedIndex ? lastIndex : focusedIndex - 1;
  1139. break;
  1140. case "next":
  1141. focusedIndex > -1 && focusedIndex < lastIndex && (nextFocus = focusedIndex + 1);
  1142. }
  1143. -1 === nextFocus && this.announceAriaLiveContext({
  1144. event: "input",
  1145. context: {
  1146. isSearchable: isSearchable,
  1147. isMulti: isMulti
  1148. }
  1149. }), this.setState({
  1150. inputIsHidden: -1 !== nextFocus,
  1151. focusedValue: selectValue[nextFocus]
  1152. });
  1153. }
  1154. }
  1155. }, _proto.focusOption = function(direction) {
  1156. void 0 === direction && (direction = "first");
  1157. var pageSize = this.props.pageSize, _this$state5 = this.state, focusedOption = _this$state5.focusedOption, options = _this$state5.menuOptions.focusable;
  1158. if (options.length) {
  1159. var nextFocus = 0, focusedIndex = options.indexOf(focusedOption);
  1160. focusedOption || (focusedIndex = -1, this.announceAriaLiveContext({
  1161. event: "menu"
  1162. })), "up" === direction ? nextFocus = focusedIndex > 0 ? focusedIndex - 1 : options.length - 1 : "down" === direction ? nextFocus = (focusedIndex + 1) % options.length : "pageup" === direction ? (nextFocus = focusedIndex - pageSize) < 0 && (nextFocus = 0) : "pagedown" === direction ? (nextFocus = focusedIndex + pageSize) > options.length - 1 && (nextFocus = options.length - 1) : "last" === direction && (nextFocus = options.length - 1),
  1163. this.scrollToFocusedOptionOnUpdate = !0, this.setState({
  1164. focusedOption: options[nextFocus],
  1165. focusedValue: null
  1166. }), this.announceAriaLiveContext({
  1167. event: "menu",
  1168. context: {
  1169. isDisabled: isOptionDisabled(options[nextFocus])
  1170. }
  1171. });
  1172. }
  1173. }, _proto.getTheme = function() {
  1174. return this.props.theme ? "function" == typeof this.props.theme ? this.props.theme(defaultTheme) : _extends$4({}, defaultTheme, this.props.theme) : defaultTheme;
  1175. }, _proto.getCommonProps = function() {
  1176. var clearValue = this.clearValue, getStyles = this.getStyles, setValue = this.setValue, selectOption = this.selectOption, props = this.props, classNamePrefix = props.classNamePrefix, isMulti = props.isMulti, isRtl = props.isRtl, options = props.options, selectValue = this.state.selectValue, hasValue = this.hasValue();
  1177. return {
  1178. cx: utils.classNames.bind(null, classNamePrefix),
  1179. clearValue: clearValue,
  1180. getStyles: getStyles,
  1181. getValue: function() {
  1182. return selectValue;
  1183. },
  1184. hasValue: hasValue,
  1185. isMulti: isMulti,
  1186. isRtl: isRtl,
  1187. options: options,
  1188. selectOption: selectOption,
  1189. setValue: setValue,
  1190. selectProps: props,
  1191. theme: this.getTheme()
  1192. };
  1193. }, _proto.getNextFocusedValue = function(nextSelectValue) {
  1194. if (this.clearFocusValueOnUpdate) return this.clearFocusValueOnUpdate = !1, null;
  1195. var _this$state6 = this.state, focusedValue = _this$state6.focusedValue, lastFocusedIndex = _this$state6.selectValue.indexOf(focusedValue);
  1196. if (lastFocusedIndex > -1) {
  1197. if (nextSelectValue.indexOf(focusedValue) > -1) return focusedValue;
  1198. if (lastFocusedIndex < nextSelectValue.length) return nextSelectValue[lastFocusedIndex];
  1199. }
  1200. return null;
  1201. }, _proto.getNextFocusedOption = function(options) {
  1202. var lastFocusedOption = this.state.focusedOption;
  1203. return lastFocusedOption && options.indexOf(lastFocusedOption) > -1 ? lastFocusedOption : options[0];
  1204. }, _proto.hasValue = function() {
  1205. return this.state.selectValue.length > 0;
  1206. }, _proto.hasOptions = function() {
  1207. return !!this.state.menuOptions.render.length;
  1208. }, _proto.countOptions = function() {
  1209. return this.state.menuOptions.focusable.length;
  1210. }, _proto.isClearable = function() {
  1211. var _this$props12 = this.props, isClearable = _this$props12.isClearable, isMulti = _this$props12.isMulti;
  1212. return void 0 === isClearable ? isMulti : isClearable;
  1213. }, _proto.isOptionDisabled = function(option, selectValue) {
  1214. return "function" == typeof this.props.isOptionDisabled && this.props.isOptionDisabled(option, selectValue);
  1215. }, _proto.isOptionSelected = function(option, selectValue) {
  1216. var _this3 = this;
  1217. if (selectValue.indexOf(option) > -1) return !0;
  1218. if ("function" == typeof this.props.isOptionSelected) return this.props.isOptionSelected(option, selectValue);
  1219. var candidate = this.getOptionValue(option);
  1220. return selectValue.some((function(i) {
  1221. return _this3.getOptionValue(i) === candidate;
  1222. }));
  1223. }, _proto.filterOption = function(option, inputValue) {
  1224. return !this.props.filterOption || this.props.filterOption(option, inputValue);
  1225. }, _proto.formatOptionLabel = function(data, context) {
  1226. if ("function" == typeof this.props.formatOptionLabel) {
  1227. var inputValue = this.props.inputValue, selectValue = this.state.selectValue;
  1228. return this.props.formatOptionLabel(data, {
  1229. context: context,
  1230. inputValue: inputValue,
  1231. selectValue: selectValue
  1232. });
  1233. }
  1234. return this.getOptionLabel(data);
  1235. }, _proto.formatGroupLabel = function(data) {
  1236. return this.props.formatGroupLabel(data);
  1237. }, _proto.startListeningComposition = function() {
  1238. document && document.addEventListener && (document.addEventListener("compositionstart", this.onCompositionStart, !1),
  1239. document.addEventListener("compositionend", this.onCompositionEnd, !1));
  1240. }, _proto.stopListeningComposition = function() {
  1241. document && document.removeEventListener && (document.removeEventListener("compositionstart", this.onCompositionStart),
  1242. document.removeEventListener("compositionend", this.onCompositionEnd));
  1243. }, _proto.startListeningToTouch = function() {
  1244. document && document.addEventListener && (document.addEventListener("touchstart", this.onTouchStart, !1),
  1245. document.addEventListener("touchmove", this.onTouchMove, !1), document.addEventListener("touchend", this.onTouchEnd, !1));
  1246. }, _proto.stopListeningToTouch = function() {
  1247. document && document.removeEventListener && (document.removeEventListener("touchstart", this.onTouchStart),
  1248. document.removeEventListener("touchmove", this.onTouchMove), document.removeEventListener("touchend", this.onTouchEnd));
  1249. }, _proto.constructAriaLiveMessage = function() {
  1250. var _this$state7 = this.state, ariaLiveContext = _this$state7.ariaLiveContext, selectValue = _this$state7.selectValue, focusedValue = _this$state7.focusedValue, focusedOption = _this$state7.focusedOption, _this$props13 = this.props, options = _this$props13.options, menuIsOpen = _this$props13.menuIsOpen, inputValue = _this$props13.inputValue, screenReaderStatus = _this$props13.screenReaderStatus;
  1251. return (focusedValue ? valueFocusAriaMessage({
  1252. focusedValue: focusedValue,
  1253. getOptionLabel: this.getOptionLabel,
  1254. selectValue: selectValue
  1255. }) : "") + " " + (focusedOption && menuIsOpen ? optionFocusAriaMessage({
  1256. focusedOption: focusedOption,
  1257. getOptionLabel: this.getOptionLabel,
  1258. options: options
  1259. }) : "") + " " + resultsAriaMessage({
  1260. inputValue: inputValue,
  1261. screenReaderMessage: screenReaderStatus({
  1262. count: this.countOptions()
  1263. })
  1264. }) + " " + ariaLiveContext;
  1265. }, _proto.renderInput = function() {
  1266. var _this$props14 = this.props, isDisabled = _this$props14.isDisabled, isSearchable = _this$props14.isSearchable, inputId = _this$props14.inputId, inputValue = _this$props14.inputValue, tabIndex = _this$props14.tabIndex, Input = this.components.Input, inputIsHidden = this.state.inputIsHidden, id = inputId || this.getElementId("input"), ariaAttributes = {
  1267. "aria-autocomplete": "list",
  1268. "aria-label": this.props["aria-label"],
  1269. "aria-labelledby": this.props["aria-labelledby"]
  1270. };
  1271. if (!isSearchable) return React__default.createElement(DummyInput, _extends$4({
  1272. id: id,
  1273. innerRef: this.getInputRef,
  1274. onBlur: this.onInputBlur,
  1275. onChange: utils.noop,
  1276. onFocus: this.onInputFocus,
  1277. readOnly: !0,
  1278. disabled: isDisabled,
  1279. tabIndex: tabIndex,
  1280. value: ""
  1281. }, ariaAttributes));
  1282. var _this$commonProps = this.commonProps, cx = _this$commonProps.cx, theme = _this$commonProps.theme, selectProps = _this$commonProps.selectProps;
  1283. return React__default.createElement(Input, _extends$4({
  1284. autoCapitalize: "none",
  1285. autoComplete: "off",
  1286. autoCorrect: "off",
  1287. cx: cx,
  1288. getStyles: this.getStyles,
  1289. id: id,
  1290. innerRef: this.getInputRef,
  1291. isDisabled: isDisabled,
  1292. isHidden: inputIsHidden,
  1293. onBlur: this.onInputBlur,
  1294. onChange: this.handleInputChange,
  1295. onFocus: this.onInputFocus,
  1296. selectProps: selectProps,
  1297. spellCheck: "false",
  1298. tabIndex: tabIndex,
  1299. theme: theme,
  1300. type: "text",
  1301. value: inputValue
  1302. }, ariaAttributes));
  1303. }, _proto.renderPlaceholderOrValue = function() {
  1304. var _this4 = this, _this$components = this.components, MultiValue = _this$components.MultiValue, MultiValueContainer = _this$components.MultiValueContainer, MultiValueLabel = _this$components.MultiValueLabel, MultiValueRemove = _this$components.MultiValueRemove, SingleValue = _this$components.SingleValue, Placeholder = _this$components.Placeholder, commonProps = this.commonProps, _this$props15 = this.props, controlShouldRenderValue = _this$props15.controlShouldRenderValue, isDisabled = _this$props15.isDisabled, isMulti = _this$props15.isMulti, inputValue = _this$props15.inputValue, placeholder = _this$props15.placeholder, _this$state8 = this.state, selectValue = _this$state8.selectValue, focusedValue = _this$state8.focusedValue, isFocused = _this$state8.isFocused;
  1305. if (!this.hasValue() || !controlShouldRenderValue) return inputValue ? null : React__default.createElement(Placeholder, _extends$4({}, commonProps, {
  1306. key: "placeholder",
  1307. isDisabled: isDisabled,
  1308. isFocused: isFocused
  1309. }), placeholder);
  1310. if (isMulti) return selectValue.map((function(opt, index) {
  1311. var isOptionFocused = opt === focusedValue;
  1312. return React__default.createElement(MultiValue, _extends$4({}, commonProps, {
  1313. components: {
  1314. Container: MultiValueContainer,
  1315. Label: MultiValueLabel,
  1316. Remove: MultiValueRemove
  1317. },
  1318. isFocused: isOptionFocused,
  1319. isDisabled: isDisabled,
  1320. key: _this4.getOptionValue(opt),
  1321. index: index,
  1322. removeProps: {
  1323. onClick: function() {
  1324. return _this4.removeValue(opt);
  1325. },
  1326. onTouchEnd: function() {
  1327. return _this4.removeValue(opt);
  1328. },
  1329. onMouseDown: function(e) {
  1330. e.preventDefault(), e.stopPropagation();
  1331. }
  1332. },
  1333. data: opt
  1334. }), _this4.formatOptionLabel(opt, "value"));
  1335. }));
  1336. if (inputValue) return null;
  1337. var singleValue = selectValue[0];
  1338. return React__default.createElement(SingleValue, _extends$4({}, commonProps, {
  1339. data: singleValue,
  1340. isDisabled: isDisabled
  1341. }), this.formatOptionLabel(singleValue, "value"));
  1342. }, _proto.renderClearIndicator = function() {
  1343. var ClearIndicator = this.components.ClearIndicator, commonProps = this.commonProps, _this$props16 = this.props, isDisabled = _this$props16.isDisabled, isLoading = _this$props16.isLoading, isFocused = this.state.isFocused;
  1344. if (!this.isClearable() || !ClearIndicator || isDisabled || !this.hasValue() || isLoading) return null;
  1345. var innerProps = {
  1346. onMouseDown: this.onClearIndicatorMouseDown,
  1347. onTouchEnd: this.onClearIndicatorTouchEnd,
  1348. "aria-hidden": "true"
  1349. };
  1350. return React__default.createElement(ClearIndicator, _extends$4({}, commonProps, {
  1351. innerProps: innerProps,
  1352. isFocused: isFocused
  1353. }));
  1354. }, _proto.renderLoadingIndicator = function() {
  1355. var LoadingIndicator = this.components.LoadingIndicator, commonProps = this.commonProps, _this$props17 = this.props, isDisabled = _this$props17.isDisabled, isLoading = _this$props17.isLoading, isFocused = this.state.isFocused;
  1356. if (!LoadingIndicator || !isLoading) return null;
  1357. return React__default.createElement(LoadingIndicator, _extends$4({}, commonProps, {
  1358. innerProps: {
  1359. "aria-hidden": "true"
  1360. },
  1361. isDisabled: isDisabled,
  1362. isFocused: isFocused
  1363. }));
  1364. }, _proto.renderIndicatorSeparator = function() {
  1365. var _this$components2 = this.components, DropdownIndicator = _this$components2.DropdownIndicator, IndicatorSeparator = _this$components2.IndicatorSeparator;
  1366. if (!DropdownIndicator || !IndicatorSeparator) return null;
  1367. var commonProps = this.commonProps, isDisabled = this.props.isDisabled, isFocused = this.state.isFocused;
  1368. return React__default.createElement(IndicatorSeparator, _extends$4({}, commonProps, {
  1369. isDisabled: isDisabled,
  1370. isFocused: isFocused
  1371. }));
  1372. }, _proto.renderDropdownIndicator = function() {
  1373. var DropdownIndicator = this.components.DropdownIndicator;
  1374. if (!DropdownIndicator) return null;
  1375. var commonProps = this.commonProps, isDisabled = this.props.isDisabled, isFocused = this.state.isFocused, innerProps = {
  1376. onMouseDown: this.onDropdownIndicatorMouseDown,
  1377. onTouchEnd: this.onDropdownIndicatorTouchEnd,
  1378. "aria-hidden": "true"
  1379. };
  1380. return React__default.createElement(DropdownIndicator, _extends$4({}, commonProps, {
  1381. innerProps: innerProps,
  1382. isDisabled: isDisabled,
  1383. isFocused: isFocused
  1384. }));
  1385. }, _proto.renderMenu = function() {
  1386. var _this5 = this, _this$components3 = this.components, Group = _this$components3.Group, GroupHeading = _this$components3.GroupHeading, Menu = _this$components3.Menu, MenuList = _this$components3.MenuList, MenuPortal = _this$components3.MenuPortal, LoadingMessage = _this$components3.LoadingMessage, NoOptionsMessage = _this$components3.NoOptionsMessage, Option = _this$components3.Option, commonProps = this.commonProps, _this$state9 = this.state, focusedOption = _this$state9.focusedOption, menuOptions = _this$state9.menuOptions, _this$props18 = this.props, captureMenuScroll = _this$props18.captureMenuScroll, inputValue = _this$props18.inputValue, isLoading = _this$props18.isLoading, loadingMessage = _this$props18.loadingMessage, minMenuHeight = _this$props18.minMenuHeight, maxMenuHeight = _this$props18.maxMenuHeight, menuIsOpen = _this$props18.menuIsOpen, menuPlacement = _this$props18.menuPlacement, menuPosition = _this$props18.menuPosition, menuPortalTarget = _this$props18.menuPortalTarget, menuShouldBlockScroll = _this$props18.menuShouldBlockScroll, menuShouldScrollIntoView = _this$props18.menuShouldScrollIntoView, noOptionsMessage = _this$props18.noOptionsMessage, onMenuScrollToTop = _this$props18.onMenuScrollToTop, onMenuScrollToBottom = _this$props18.onMenuScrollToBottom;
  1387. if (!menuIsOpen) return null;
  1388. var menuUI, render = function(props) {
  1389. var isFocused = focusedOption === props.data;
  1390. return props.innerRef = isFocused ? _this5.getFocusedOptionRef : void 0, React__default.createElement(Option, _extends$4({}, commonProps, props, {
  1391. isFocused: isFocused
  1392. }), _this5.formatOptionLabel(props.data, "menu"));
  1393. };
  1394. if (this.hasOptions()) menuUI = menuOptions.render.map((function(item) {
  1395. if ("group" === item.type) {
  1396. item.type;
  1397. var group = _objectWithoutPropertiesLoose$2(item, [ "type" ]), headingId = item.key + "-heading";
  1398. return React__default.createElement(Group, _extends$4({}, commonProps, group, {
  1399. Heading: GroupHeading,
  1400. headingProps: {
  1401. id: headingId
  1402. },
  1403. label: _this5.formatGroupLabel(item.data)
  1404. }), item.options.map((function(option) {
  1405. return render(option);
  1406. })));
  1407. }
  1408. if ("option" === item.type) return render(item);
  1409. })); else if (isLoading) {
  1410. var message = loadingMessage({
  1411. inputValue: inputValue
  1412. });
  1413. if (null === message) return null;
  1414. menuUI = React__default.createElement(LoadingMessage, commonProps, message);
  1415. } else {
  1416. var _message = noOptionsMessage({
  1417. inputValue: inputValue
  1418. });
  1419. if (null === _message) return null;
  1420. menuUI = React__default.createElement(NoOptionsMessage, commonProps, _message);
  1421. }
  1422. var menuPlacementProps = {
  1423. minMenuHeight: minMenuHeight,
  1424. maxMenuHeight: maxMenuHeight,
  1425. menuPlacement: menuPlacement,
  1426. menuPosition: menuPosition,
  1427. menuShouldScrollIntoView: menuShouldScrollIntoView
  1428. }, menuElement = React__default.createElement(index.MenuPlacer, _extends$4({}, commonProps, menuPlacementProps), (function(_ref8) {
  1429. var ref = _ref8.ref, _ref8$placerProps = _ref8.placerProps, placement = _ref8$placerProps.placement, maxHeight = _ref8$placerProps.maxHeight;
  1430. return React__default.createElement(Menu, _extends$4({}, commonProps, menuPlacementProps, {
  1431. innerRef: ref,
  1432. innerProps: {
  1433. onMouseDown: _this5.onMenuMouseDown,
  1434. onMouseMove: _this5.onMenuMouseMove
  1435. },
  1436. isLoading: isLoading,
  1437. placement: placement
  1438. }), React__default.createElement(ScrollCaptorSwitch, {
  1439. isEnabled: captureMenuScroll,
  1440. onTopArrive: onMenuScrollToTop,
  1441. onBottomArrive: onMenuScrollToBottom
  1442. }, React__default.createElement(ScrollBlock, {
  1443. isEnabled: menuShouldBlockScroll
  1444. }, React__default.createElement(MenuList, _extends$4({}, commonProps, {
  1445. innerRef: _this5.getMenuListRef,
  1446. isLoading: isLoading,
  1447. maxHeight: maxHeight
  1448. }), menuUI))));
  1449. }));
  1450. return menuPortalTarget || "fixed" === menuPosition ? React__default.createElement(MenuPortal, _extends$4({}, commonProps, {
  1451. appendTo: menuPortalTarget,
  1452. controlElement: this.controlRef,
  1453. menuPlacement: menuPlacement,
  1454. menuPosition: menuPosition
  1455. }), menuElement) : menuElement;
  1456. }, _proto.renderFormField = function() {
  1457. var _this6 = this, _this$props19 = this.props, delimiter = _this$props19.delimiter, isDisabled = _this$props19.isDisabled, isMulti = _this$props19.isMulti, name = _this$props19.name, selectValue = this.state.selectValue;
  1458. if (name && !isDisabled) {
  1459. if (isMulti) {
  1460. if (delimiter) {
  1461. var value = selectValue.map((function(opt) {
  1462. return _this6.getOptionValue(opt);
  1463. })).join(delimiter);
  1464. return React__default.createElement("input", {
  1465. name: name,
  1466. type: "hidden",
  1467. value: value
  1468. });
  1469. }
  1470. var input = selectValue.length > 0 ? selectValue.map((function(opt, i) {
  1471. return React__default.createElement("input", {
  1472. key: "i-" + i,
  1473. name: name,
  1474. type: "hidden",
  1475. value: _this6.getOptionValue(opt)
  1476. });
  1477. })) : React__default.createElement("input", {
  1478. name: name,
  1479. type: "hidden"
  1480. });
  1481. return React__default.createElement("div", null, input);
  1482. }
  1483. var _value2 = selectValue[0] ? this.getOptionValue(selectValue[0]) : "";
  1484. return React__default.createElement("input", {
  1485. name: name,
  1486. type: "hidden",
  1487. value: _value2
  1488. });
  1489. }
  1490. }, _proto.renderLiveRegion = function() {
  1491. return this.state.isFocused ? React__default.createElement(A11yText, {
  1492. "aria-live": "polite"
  1493. }, React__default.createElement("p", {
  1494. id: "aria-selection-event"
  1495. }, " ", this.state.ariaLiveSelection), React__default.createElement("p", {
  1496. id: "aria-context"
  1497. }, " ", this.constructAriaLiveMessage())) : null;
  1498. }, _proto.render = function() {
  1499. var _this$components4 = this.components, Control = _this$components4.Control, IndicatorsContainer = _this$components4.IndicatorsContainer, SelectContainer = _this$components4.SelectContainer, ValueContainer = _this$components4.ValueContainer, _this$props20 = this.props, className = _this$props20.className, id = _this$props20.id, isDisabled = _this$props20.isDisabled, menuIsOpen = _this$props20.menuIsOpen, isFocused = this.state.isFocused, commonProps = this.commonProps = this.getCommonProps();
  1500. return React__default.createElement(SelectContainer, _extends$4({}, commonProps, {
  1501. className: className,
  1502. innerProps: {
  1503. id: id,
  1504. onKeyDown: this.onKeyDown
  1505. },
  1506. isDisabled: isDisabled,
  1507. isFocused: isFocused
  1508. }), this.renderLiveRegion(), React__default.createElement(Control, _extends$4({}, commonProps, {
  1509. innerRef: this.getControlRef,
  1510. innerProps: {
  1511. onMouseDown: this.onControlMouseDown,
  1512. onTouchEnd: this.onControlTouchEnd
  1513. },
  1514. isDisabled: isDisabled,
  1515. isFocused: isFocused,
  1516. menuIsOpen: menuIsOpen
  1517. }), React__default.createElement(ValueContainer, _extends$4({}, commonProps, {
  1518. isDisabled: isDisabled
  1519. }), this.renderPlaceholderOrValue(), this.renderInput()), React__default.createElement(IndicatorsContainer, _extends$4({}, commonProps, {
  1520. isDisabled: isDisabled
  1521. }), this.renderClearIndicator(), this.renderLoadingIndicator(), this.renderIndicatorSeparator(), this.renderDropdownIndicator())), this.renderMenu(), this.renderFormField());
  1522. }, Select;
  1523. }(React.Component);
  1524. Select.defaultProps = defaultProps, exports.Select = Select, exports.createFilter = createFilter,
  1525. exports.defaultProps = defaultProps, exports.defaultTheme = defaultTheme, exports.mergeStyles = mergeStyles;