Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

Select-062d63ee.cjs.dev.js 91 KiB

3 lat temu
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743
  1. 'use strict';
  2. function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
  3. var React = require('react');
  4. var React__default = _interopDefault(React);
  5. var memoizeOne = _interopDefault(require('memoize-one'));
  6. var core = require('@emotion/core');
  7. var reactDom = require('react-dom');
  8. var utils = require('./utils-03a02e63.cjs.dev.js');
  9. var index = require('./index-503cf1e8.cjs.dev.js');
  10. var _css = _interopDefault(require('@emotion/css'));
  11. var diacritics = [{
  12. base: 'A',
  13. 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
  14. }, {
  15. base: 'AA',
  16. letters: /[\uA732]/g
  17. }, {
  18. base: 'AE',
  19. letters: /[\u00C6\u01FC\u01E2]/g
  20. }, {
  21. base: 'AO',
  22. letters: /[\uA734]/g
  23. }, {
  24. base: 'AU',
  25. letters: /[\uA736]/g
  26. }, {
  27. base: 'AV',
  28. letters: /[\uA738\uA73A]/g
  29. }, {
  30. base: 'AY',
  31. letters: /[\uA73C]/g
  32. }, {
  33. base: 'B',
  34. letters: /[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g
  35. }, {
  36. base: 'C',
  37. letters: /[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g
  38. }, {
  39. base: 'D',
  40. letters: /[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g
  41. }, {
  42. base: 'DZ',
  43. letters: /[\u01F1\u01C4]/g
  44. }, {
  45. base: 'Dz',
  46. letters: /[\u01F2\u01C5]/g
  47. }, {
  48. base: 'E',
  49. 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
  50. }, {
  51. base: 'F',
  52. letters: /[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g
  53. }, {
  54. base: 'G',
  55. letters: /[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g
  56. }, {
  57. base: 'H',
  58. letters: /[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g
  59. }, {
  60. base: 'I',
  61. letters: /[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g
  62. }, {
  63. base: 'J',
  64. letters: /[\u004A\u24BF\uFF2A\u0134\u0248]/g
  65. }, {
  66. base: 'K',
  67. letters: /[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g
  68. }, {
  69. base: 'L',
  70. letters: /[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g
  71. }, {
  72. base: 'LJ',
  73. letters: /[\u01C7]/g
  74. }, {
  75. base: 'Lj',
  76. letters: /[\u01C8]/g
  77. }, {
  78. base: 'M',
  79. letters: /[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g
  80. }, {
  81. base: 'N',
  82. letters: /[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g
  83. }, {
  84. base: 'NJ',
  85. letters: /[\u01CA]/g
  86. }, {
  87. base: 'Nj',
  88. letters: /[\u01CB]/g
  89. }, {
  90. base: 'O',
  91. 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
  92. }, {
  93. base: 'OI',
  94. letters: /[\u01A2]/g
  95. }, {
  96. base: 'OO',
  97. letters: /[\uA74E]/g
  98. }, {
  99. base: 'OU',
  100. letters: /[\u0222]/g
  101. }, {
  102. base: 'P',
  103. letters: /[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g
  104. }, {
  105. base: 'Q',
  106. letters: /[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g
  107. }, {
  108. base: 'R',
  109. letters: /[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g
  110. }, {
  111. base: 'S',
  112. letters: /[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g
  113. }, {
  114. base: 'T',
  115. letters: /[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g
  116. }, {
  117. base: 'TZ',
  118. letters: /[\uA728]/g
  119. }, {
  120. base: 'U',
  121. 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
  122. }, {
  123. base: 'V',
  124. letters: /[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g
  125. }, {
  126. base: 'VY',
  127. letters: /[\uA760]/g
  128. }, {
  129. base: 'W',
  130. letters: /[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g
  131. }, {
  132. base: 'X',
  133. letters: /[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g
  134. }, {
  135. base: 'Y',
  136. letters: /[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g
  137. }, {
  138. base: 'Z',
  139. letters: /[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g
  140. }, {
  141. base: 'a',
  142. 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
  143. }, {
  144. base: 'aa',
  145. letters: /[\uA733]/g
  146. }, {
  147. base: 'ae',
  148. letters: /[\u00E6\u01FD\u01E3]/g
  149. }, {
  150. base: 'ao',
  151. letters: /[\uA735]/g
  152. }, {
  153. base: 'au',
  154. letters: /[\uA737]/g
  155. }, {
  156. base: 'av',
  157. letters: /[\uA739\uA73B]/g
  158. }, {
  159. base: 'ay',
  160. letters: /[\uA73D]/g
  161. }, {
  162. base: 'b',
  163. letters: /[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g
  164. }, {
  165. base: 'c',
  166. letters: /[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g
  167. }, {
  168. base: 'd',
  169. letters: /[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g
  170. }, {
  171. base: 'dz',
  172. letters: /[\u01F3\u01C6]/g
  173. }, {
  174. base: 'e',
  175. 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
  176. }, {
  177. base: 'f',
  178. letters: /[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g
  179. }, {
  180. base: 'g',
  181. letters: /[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g
  182. }, {
  183. base: 'h',
  184. letters: /[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g
  185. }, {
  186. base: 'hv',
  187. letters: /[\u0195]/g
  188. }, {
  189. base: 'i',
  190. letters: /[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g
  191. }, {
  192. base: 'j',
  193. letters: /[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g
  194. }, {
  195. base: 'k',
  196. letters: /[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g
  197. }, {
  198. base: 'l',
  199. letters: /[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g
  200. }, {
  201. base: 'lj',
  202. letters: /[\u01C9]/g
  203. }, {
  204. base: 'm',
  205. letters: /[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g
  206. }, {
  207. base: 'n',
  208. letters: /[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g
  209. }, {
  210. base: 'nj',
  211. letters: /[\u01CC]/g
  212. }, {
  213. base: 'o',
  214. 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
  215. }, {
  216. base: 'oi',
  217. letters: /[\u01A3]/g
  218. }, {
  219. base: 'ou',
  220. letters: /[\u0223]/g
  221. }, {
  222. base: 'oo',
  223. letters: /[\uA74F]/g
  224. }, {
  225. base: 'p',
  226. letters: /[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g
  227. }, {
  228. base: 'q',
  229. letters: /[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g
  230. }, {
  231. base: 'r',
  232. letters: /[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g
  233. }, {
  234. base: 's',
  235. letters: /[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g
  236. }, {
  237. base: 't',
  238. letters: /[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g
  239. }, {
  240. base: 'tz',
  241. letters: /[\uA729]/g
  242. }, {
  243. base: 'u',
  244. 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
  245. }, {
  246. base: 'v',
  247. letters: /[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g
  248. }, {
  249. base: 'vy',
  250. letters: /[\uA761]/g
  251. }, {
  252. base: 'w',
  253. letters: /[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g
  254. }, {
  255. base: 'x',
  256. letters: /[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g
  257. }, {
  258. base: 'y',
  259. letters: /[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g
  260. }, {
  261. base: 'z',
  262. letters: /[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g
  263. }];
  264. var stripDiacritics = function stripDiacritics(str) {
  265. for (var i = 0; i < diacritics.length; i++) {
  266. str = str.replace(diacritics[i].letters, diacritics[i].base);
  267. }
  268. return str;
  269. };
  270. function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
  271. var trimString = function trimString(str) {
  272. return str.replace(/^\s+|\s+$/g, '');
  273. };
  274. var defaultStringify = function defaultStringify(option) {
  275. return option.label + " " + option.value;
  276. };
  277. var createFilter = function createFilter(config) {
  278. return function (option, rawInput) {
  279. var _ignoreCase$ignoreAcc = _extends({
  280. ignoreCase: true,
  281. ignoreAccents: true,
  282. stringify: defaultStringify,
  283. trim: true,
  284. matchFrom: 'any'
  285. }, config),
  286. ignoreCase = _ignoreCase$ignoreAcc.ignoreCase,
  287. ignoreAccents = _ignoreCase$ignoreAcc.ignoreAccents,
  288. stringify = _ignoreCase$ignoreAcc.stringify,
  289. trim = _ignoreCase$ignoreAcc.trim,
  290. matchFrom = _ignoreCase$ignoreAcc.matchFrom;
  291. var input = trim ? trimString(rawInput) : rawInput;
  292. var candidate = trim ? trimString(stringify(option)) : stringify(option);
  293. if (ignoreCase) {
  294. input = input.toLowerCase();
  295. candidate = candidate.toLowerCase();
  296. }
  297. if (ignoreAccents) {
  298. input = stripDiacritics(input);
  299. candidate = stripDiacritics(candidate);
  300. }
  301. return matchFrom === 'start' ? candidate.substr(0, input.length) === input : candidate.indexOf(input) > -1;
  302. };
  303. };
  304. function _extends$1() { _extends$1 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
  305. var _ref = process.env.NODE_ENV === "production" ? {
  306. name: "1laao21-a11yText",
  307. 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;"
  308. } : {
  309. name: "1laao21-a11yText",
  310. 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;",
  311. map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkExMXlUZXh0LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQVFNIiwiZmlsZSI6IkExMXlUZXh0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8gQGZsb3dcbi8qKiBAanN4IGpzeCAqL1xuaW1wb3J0IHsgdHlwZSBFbGVtZW50Q29uZmlnIH0gZnJvbSAncmVhY3QnO1xuaW1wb3J0IHsganN4IH0gZnJvbSAnQGVtb3Rpb24vY29yZSc7XG5cbi8vIEFzc2lzdGl2ZSB0ZXh0IHRvIGRlc2NyaWJlIHZpc3VhbCBlbGVtZW50cy4gSGlkZGVuIGZvciBzaWdodGVkIHVzZXJzLlxuY29uc3QgQTExeVRleHQgPSAocHJvcHM6IEVsZW1lbnRDb25maWc8J3NwYW4nPikgPT4gKFxuICAgIDxzcGFuXG4gICAgICBjc3M9e3tcbiAgICAgICAgbGFiZWw6ICdhMTF5VGV4dCcsXG4gICAgICAgIHpJbmRleDogOTk5OSxcbiAgICAgICAgYm9yZGVyOiAwLFxuICAgICAgICBjbGlwOiAncmVjdCgxcHgsIDFweCwgMXB4LCAxcHgpJyxcbiAgICAgICAgaGVpZ2h0OiAxLFxuICAgICAgICB3aWR0aDogMSxcbiAgICAgICAgcG9zaXRpb246ICdhYnNvbHV0ZScsXG4gICAgICAgIG92ZXJmbG93OiAnaGlkZGVuJyxcbiAgICAgICAgcGFkZGluZzogMCxcbiAgICAgICAgd2hpdGVTcGFjZTogJ25vd3JhcCcsXG4gICAgICB9fVxuICAgICAgey4uLnByb3BzfVxuICAgIC8+XG4pO1xuXG5leHBvcnQgZGVmYXVsdCBBMTF5VGV4dDtcbiJdfQ== */"
  312. };
  313. var A11yText = function A11yText(props) {
  314. return core.jsx("span", _extends$1({
  315. css: _ref
  316. }, props));
  317. };
  318. function _extends$2() { _extends$2 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
  319. function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
  320. function DummyInput(_ref) {
  321. var inProp = _ref.in,
  322. out = _ref.out,
  323. onExited = _ref.onExited,
  324. appear = _ref.appear,
  325. enter = _ref.enter,
  326. exit = _ref.exit,
  327. innerRef = _ref.innerRef,
  328. emotion = _ref.emotion,
  329. props = _objectWithoutPropertiesLoose(_ref, ["in", "out", "onExited", "appear", "enter", "exit", "innerRef", "emotion"]);
  330. return core.jsx("input", _extends$2({
  331. ref: innerRef
  332. }, props, {
  333. css:
  334. /*#__PURE__*/
  335. _css({
  336. label: 'dummyInput',
  337. // get rid of any default styles
  338. background: 0,
  339. border: 0,
  340. fontSize: 'inherit',
  341. outline: 0,
  342. padding: 0,
  343. // important! without `width` browsers won't allow focus
  344. width: 1,
  345. // remove cursor on desktop
  346. color: 'transparent',
  347. // remove cursor on mobile whilst maintaining "scroll into view" behaviour
  348. left: -100,
  349. opacity: 0,
  350. position: 'relative',
  351. transform: 'scale(0)'
  352. }, process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkR1bW15SW5wdXQuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBbUJNIiwiZmlsZSI6IkR1bW15SW5wdXQuanMiLCJzb3VyY2VzQ29udGVudCI6WyIvLyBAZmxvd1xuLyoqIEBqc3gganN4ICovXG5pbXBvcnQgeyBqc3ggfSBmcm9tICdAZW1vdGlvbi9jb3JlJztcblxuZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24gRHVtbXlJbnB1dCh7XG4gIGluOiBpblByb3AsXG4gIG91dCxcbiAgb25FeGl0ZWQsXG4gIGFwcGVhcixcbiAgZW50ZXIsXG4gIGV4aXQsXG4gIGlubmVyUmVmLFxuICBlbW90aW9uLFxuICAuLi5wcm9wc1xufTogYW55KSB7XG4gIHJldHVybiAoXG4gICAgPGlucHV0XG4gICAgICByZWY9e2lubmVyUmVmfVxuICAgICAgey4uLnByb3BzfVxuICAgICAgY3NzPXt7XG4gICAgICAgIGxhYmVsOiAnZHVtbXlJbnB1dCcsXG4gICAgICAgIC8vIGdldCByaWQgb2YgYW55IGRlZmF1bHQgc3R5bGVzXG4gICAgICAgIGJhY2tncm91bmQ6IDAsXG4gICAgICAgIGJvcmRlcjogMCxcbiAgICAgICAgZm9udFNpemU6ICdpbmhlcml0JyxcbiAgICAgICAgb3V0bGluZTogMCxcbiAgICAgICAgcGFkZGluZzogMCxcbiAgICAgICAgLy8gaW1wb3J0YW50ISB3aXRob3V0IGB3aWR0aGAgYnJvd3NlcnMgd29uJ3QgYWxsb3cgZm9jdXNcbiAgICAgICAgd2lkdGg6IDEsXG5cbiAgICAgICAgLy8gcmVtb3ZlIGN1cnNvciBvbiBkZXNrdG9wXG4gICAgICAgIGNvbG9yOiAndHJhbnNwYXJlbnQnLFxuXG4gICAgICAgIC8vIHJlbW92ZSBjdXJzb3Igb24gbW9iaWxlIHdoaWxzdCBtYWludGFpbmluZyBcInNjcm9sbCBpbnRvIHZpZXdcIiBiZWhhdmlvdXJcbiAgICAgICAgbGVmdDogLTEwMCxcbiAgICAgICAgb3BhY2l0eTogMCxcbiAgICAgICAgcG9zaXRpb246ICdyZWxhdGl2ZScsXG4gICAgICAgIHRyYW5zZm9ybTogJ3NjYWxlKDApJyxcbiAgICAgIH19XG4gICAgLz5cbiAgKTtcbn1cbiJdfQ== */")
  353. }));
  354. }
  355. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
  356. var NodeResolver =
  357. /*#__PURE__*/
  358. function (_Component) {
  359. _inheritsLoose(NodeResolver, _Component);
  360. function NodeResolver() {
  361. return _Component.apply(this, arguments) || this;
  362. }
  363. var _proto = NodeResolver.prototype;
  364. _proto.componentDidMount = function componentDidMount() {
  365. this.props.innerRef(reactDom.findDOMNode(this));
  366. };
  367. _proto.componentWillUnmount = function componentWillUnmount() {
  368. this.props.innerRef(null);
  369. };
  370. _proto.render = function render() {
  371. return this.props.children;
  372. };
  373. return NodeResolver;
  374. }(React.Component);
  375. var STYLE_KEYS = ['boxSizing', 'height', 'overflow', 'paddingRight', 'position'];
  376. var LOCK_STYLES = {
  377. boxSizing: 'border-box',
  378. // account for possible declaration `width: 100%;` on body
  379. overflow: 'hidden',
  380. position: 'relative',
  381. height: '100%'
  382. };
  383. function preventTouchMove(e) {
  384. e.preventDefault();
  385. }
  386. function allowTouchMove(e) {
  387. e.stopPropagation();
  388. }
  389. function preventInertiaScroll() {
  390. var top = this.scrollTop;
  391. var totalScroll = this.scrollHeight;
  392. var currentScroll = top + this.offsetHeight;
  393. if (top === 0) {
  394. this.scrollTop = 1;
  395. } else if (currentScroll === totalScroll) {
  396. this.scrollTop = top - 1;
  397. }
  398. } // `ontouchstart` check works on most browsers
  399. // `maxTouchPoints` works on IE10/11 and Surface
  400. function isTouchDevice() {
  401. return 'ontouchstart' in window || navigator.maxTouchPoints;
  402. }
  403. function _inheritsLoose$1(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
  404. var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
  405. var activeScrollLocks = 0;
  406. var ScrollLock =
  407. /*#__PURE__*/
  408. function (_Component) {
  409. _inheritsLoose$1(ScrollLock, _Component);
  410. function ScrollLock() {
  411. var _this;
  412. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  413. args[_key] = arguments[_key];
  414. }
  415. _this = _Component.call.apply(_Component, [this].concat(args)) || this;
  416. _this.originalStyles = {};
  417. _this.listenerOptions = {
  418. capture: false,
  419. passive: false
  420. };
  421. return _this;
  422. }
  423. var _proto = ScrollLock.prototype;
  424. _proto.componentDidMount = function componentDidMount() {
  425. var _this2 = this;
  426. if (!canUseDOM) return;
  427. var _this$props = this.props,
  428. accountForScrollbars = _this$props.accountForScrollbars,
  429. touchScrollTarget = _this$props.touchScrollTarget;
  430. var target = document.body;
  431. var targetStyle = target && target.style;
  432. if (accountForScrollbars) {
  433. // store any styles already applied to the body
  434. STYLE_KEYS.forEach(function (key) {
  435. var val = targetStyle && targetStyle[key];
  436. _this2.originalStyles[key] = val;
  437. });
  438. } // apply the lock styles and padding if this is the first scroll lock
  439. if (accountForScrollbars && activeScrollLocks < 1) {
  440. var currentPadding = parseInt(this.originalStyles.paddingRight, 10) || 0;
  441. var clientWidth = document.body ? document.body.clientWidth : 0;
  442. var adjustedPadding = window.innerWidth - clientWidth + currentPadding || 0;
  443. Object.keys(LOCK_STYLES).forEach(function (key) {
  444. var val = LOCK_STYLES[key];
  445. if (targetStyle) {
  446. targetStyle[key] = val;
  447. }
  448. });
  449. if (targetStyle) {
  450. targetStyle.paddingRight = adjustedPadding + "px";
  451. }
  452. } // account for touch devices
  453. if (target && isTouchDevice()) {
  454. // Mobile Safari ignores { overflow: hidden } declaration on the body.
  455. target.addEventListener('touchmove', preventTouchMove, this.listenerOptions); // Allow scroll on provided target
  456. if (touchScrollTarget) {
  457. touchScrollTarget.addEventListener('touchstart', preventInertiaScroll, this.listenerOptions);
  458. touchScrollTarget.addEventListener('touchmove', allowTouchMove, this.listenerOptions);
  459. }
  460. } // increment active scroll locks
  461. activeScrollLocks += 1;
  462. };
  463. _proto.componentWillUnmount = function componentWillUnmount() {
  464. var _this3 = this;
  465. if (!canUseDOM) return;
  466. var _this$props2 = this.props,
  467. accountForScrollbars = _this$props2.accountForScrollbars,
  468. touchScrollTarget = _this$props2.touchScrollTarget;
  469. var target = document.body;
  470. var targetStyle = target && target.style; // safely decrement active scroll locks
  471. activeScrollLocks = Math.max(activeScrollLocks - 1, 0); // reapply original body styles, if any
  472. if (accountForScrollbars && activeScrollLocks < 1) {
  473. STYLE_KEYS.forEach(function (key) {
  474. var val = _this3.originalStyles[key];
  475. if (targetStyle) {
  476. targetStyle[key] = val;
  477. }
  478. });
  479. } // remove touch listeners
  480. if (target && isTouchDevice()) {
  481. target.removeEventListener('touchmove', preventTouchMove, this.listenerOptions);
  482. if (touchScrollTarget) {
  483. touchScrollTarget.removeEventListener('touchstart', preventInertiaScroll, this.listenerOptions);
  484. touchScrollTarget.removeEventListener('touchmove', allowTouchMove, this.listenerOptions);
  485. }
  486. }
  487. };
  488. _proto.render = function render() {
  489. return null;
  490. };
  491. return ScrollLock;
  492. }(React.Component);
  493. ScrollLock.defaultProps = {
  494. accountForScrollbars: true
  495. };
  496. function _inheritsLoose$2(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
  497. var _ref$1 = process.env.NODE_ENV === "production" ? {
  498. name: "1dsbpcp",
  499. styles: "position:fixed;left:0;bottom:0;right:0;top:0;"
  500. } : {
  501. name: "1dsbpcp",
  502. styles: "position:fixed;left:0;bottom:0;right:0;top:0;",
  503. map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlNjcm9sbEJsb2NrLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQTZEVSIsImZpbGUiOiJTY3JvbGxCbG9jay5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8vIEBmbG93XG4vKiogQGpzeCBqc3ggKi9cbmltcG9ydCB7IFB1cmVDb21wb25lbnQsIHR5cGUgRWxlbWVudCB9IGZyb20gJ3JlYWN0JztcbmltcG9ydCB7IGpzeCB9IGZyb20gJ0BlbW90aW9uL2NvcmUnO1xuaW1wb3J0IE5vZGVSZXNvbHZlciBmcm9tICcuL05vZGVSZXNvbHZlcic7XG5pbXBvcnQgU2Nyb2xsTG9jayBmcm9tICcuL1Njcm9sbExvY2svaW5kZXgnO1xuXG50eXBlIFByb3BzID0ge1xuICBjaGlsZHJlbjogRWxlbWVudDwqPixcbiAgaXNFbmFibGVkOiBib29sZWFuLFxufTtcbnR5cGUgU3RhdGUgPSB7XG4gIHRvdWNoU2Nyb2xsVGFyZ2V0OiBIVE1MRWxlbWVudCB8IG51bGwsXG59O1xuXG4vLyBOT1RFOlxuLy8gV2Ugc2hvdWxkbid0IG5lZWQgdGhpcyBhZnRlciB1cGRhdGluZyB0byBSZWFjdCB2MTYuMy4wLCB3aGljaCBpbnRyb2R1Y2VzOlxuLy8gLSBjcmVhdGVSZWYoKSBodHRwczovL3JlYWN0anMub3JnL2RvY3MvcmVhY3QtYXBpLmh0bWwjcmVhY3RjcmVhdGVyZWZcbi8vIC0gZm9yd2FyZFJlZigpIGh0dHBzOi8vcmVhY3Rqcy5vcmcvZG9jcy9yZWFjdC1hcGkuaHRtbCNyZWFjdGZvcndhcmRyZWZcblxuZXhwb3J0IGRlZmF1bHQgY2xhc3MgU2Nyb2xsQmxvY2sgZXh0ZW5kcyBQdXJlQ29tcG9uZW50PFByb3BzLCBTdGF0ZT4ge1xuICBzdGF0ZSA9IHsgdG91Y2hTY3JvbGxUYXJnZXQ6IG51bGwgfTtcblxuICAvLyBtdXN0IGJlIGluIHN0YXRlIHRvIHRyaWdnZXIgYSByZS1yZW5kZXIsIG9ubHkgcnVucyBvbmNlIHBlciBpbnN0YW5jZVxuICBnZXRTY3JvbGxUYXJnZXQgPSAocmVmOiBIVE1MRWxlbWVudCkgPT4ge1xuICAgIGlmIChyZWYgPT09IHRoaXMuc3RhdGUudG91Y2hTY3JvbGxUYXJnZXQpIHJldHVybjtcbiAgICB0aGlzLnNldFN0YXRlKHsgdG91Y2hTY3JvbGxUYXJnZXQ6IHJlZiB9KTtcbiAgfTtcblxuICAvLyB0aGlzIHdpbGwgY2xvc2UgdGhlIG1lbnUgd2hlbiBhIHVzZXIgY2xpY2tzIG91dHNpZGVcbiAgYmx1clNlbGVjdElucHV0ID0gKCkgPT4ge1xuICAgIGlmIChkb2N1bWVudC5hY3RpdmVFbGVtZW50KSB7XG4gICAgICBkb2N1bWVudC5hY3RpdmVFbGVtZW50LmJsdXIoKTtcbiAgICB9XG4gIH07XG5cbiAgcmVuZGVyKCkge1xuICAgIGNvbnN0IHsgY2hpbGRyZW4sIGlzRW5hYmxlZCB9ID0gdGhpcy5wcm9wcztcbiAgICBjb25zdCB7IHRvdWNoU2Nyb2xsVGFyZ2V0IH0gPSB0aGlzLnN0YXRlO1xuXG4gICAgLy8gYmFpbCBlYXJseSBpZiBub3QgZW5hYmxlZFxuICAgIGlmICghaXNFbmFibGVkKSByZXR1cm4gY2hpbGRyZW47XG5cbiAgICAvKlxuICAgICAqIERpdlxuICAgICAqIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLVxuICAgICAqIGJsb2NrcyBzY3JvbGxpbmcgb24gbm9uLWJvZHkgZWxlbWVudHMgYmVoaW5kIHRoZSBtZW51XG5cbiAgICAgKiBOb2RlUmVzb2x2ZXJcbiAgICAgKiAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS1cbiAgICAgKiB3ZSBuZWVkIGEgcmVmZXJlbmNlIHRvIHRoZSBzY3JvbGxhYmxlIGVsZW1lbnQgdG8gXCJ1bmxvY2tcIiBzY3JvbGwgb25cbiAgICAgKiBtb2JpbGUgZGV2aWNlc1xuXG4gICAgICogU2Nyb2xsTG9ja1xuICAgICAqIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLVxuICAgICAqIGFjdHVhbGx5IGRvZXMgdGhlIHNjcm9sbCBsb2NraW5nXG4gICAgICovXG4gICAgcmV0dXJuIChcbiAgICAgIDxkaXY+XG4gICAgICAgIDxkaXZcbiAgICAgICAgICBvbkNsaWNrPXt0aGlzLmJsdXJTZWxlY3RJbnB1dH1cbiAgICAgICAgICBjc3M9e3sgcG9zaXRpb246ICdmaXhlZCcsIGxlZnQ6IDAsIGJvdHRvbTogMCwgcmlnaHQ6IDAsIHRvcDogMCB9fVxuICAgICAgICAvPlxuICAgICAgICA8Tm9kZVJlc29sdmVyIGlubmVyUmVmPXt0aGlzLmdldFNjcm9sbFRhcmdldH0+e2NoaWxkcmVufTwvTm9kZVJlc29sdmVyPlxuICAgICAgICB7dG91Y2hTY3JvbGxUYXJnZXQgPyAoXG4gICAgICAgICAgPFNjcm9sbExvY2sgdG91Y2hTY3JvbGxUYXJnZXQ9e3RvdWNoU2Nyb2xsVGFyZ2V0fSAvPlxuICAgICAgICApIDogbnVsbH1cbiAgICAgIDwvZGl2PlxuICAgICk7XG4gIH1cbn1cbiJdfQ== */"
  504. };
  505. // NOTE:
  506. // We shouldn't need this after updating to React v16.3.0, which introduces:
  507. // - createRef() https://reactjs.org/docs/react-api.html#reactcreateref
  508. // - forwardRef() https://reactjs.org/docs/react-api.html#reactforwardref
  509. var ScrollBlock =
  510. /*#__PURE__*/
  511. function (_PureComponent) {
  512. _inheritsLoose$2(ScrollBlock, _PureComponent);
  513. function ScrollBlock() {
  514. var _this;
  515. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  516. args[_key] = arguments[_key];
  517. }
  518. _this = _PureComponent.call.apply(_PureComponent, [this].concat(args)) || this;
  519. _this.state = {
  520. touchScrollTarget: null
  521. };
  522. _this.getScrollTarget = function (ref) {
  523. if (ref === _this.state.touchScrollTarget) return;
  524. _this.setState({
  525. touchScrollTarget: ref
  526. });
  527. };
  528. _this.blurSelectInput = function () {
  529. if (document.activeElement) {
  530. document.activeElement.blur();
  531. }
  532. };
  533. return _this;
  534. }
  535. var _proto = ScrollBlock.prototype;
  536. _proto.render = function render() {
  537. var _this$props = this.props,
  538. children = _this$props.children,
  539. isEnabled = _this$props.isEnabled;
  540. var touchScrollTarget = this.state.touchScrollTarget; // bail early if not enabled
  541. if (!isEnabled) return children;
  542. /*
  543. * Div
  544. * ------------------------------
  545. * blocks scrolling on non-body elements behind the menu
  546. * NodeResolver
  547. * ------------------------------
  548. * we need a reference to the scrollable element to "unlock" scroll on
  549. * mobile devices
  550. * ScrollLock
  551. * ------------------------------
  552. * actually does the scroll locking
  553. */
  554. return core.jsx("div", null, core.jsx("div", {
  555. onClick: this.blurSelectInput,
  556. css: _ref$1
  557. }), core.jsx(NodeResolver, {
  558. innerRef: this.getScrollTarget
  559. }, children), touchScrollTarget ? core.jsx(ScrollLock, {
  560. touchScrollTarget: touchScrollTarget
  561. }) : null);
  562. };
  563. return ScrollBlock;
  564. }(React.PureComponent);
  565. function _objectWithoutPropertiesLoose$1(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
  566. function _inheritsLoose$3(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
  567. var ScrollCaptor =
  568. /*#__PURE__*/
  569. function (_Component) {
  570. _inheritsLoose$3(ScrollCaptor, _Component);
  571. function ScrollCaptor() {
  572. var _this;
  573. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  574. args[_key] = arguments[_key];
  575. }
  576. _this = _Component.call.apply(_Component, [this].concat(args)) || this;
  577. _this.isBottom = false;
  578. _this.isTop = false;
  579. _this.scrollTarget = void 0;
  580. _this.touchStart = void 0;
  581. _this.cancelScroll = function (event) {
  582. event.preventDefault();
  583. event.stopPropagation();
  584. };
  585. _this.handleEventDelta = function (event, delta) {
  586. var _this$props = _this.props,
  587. onBottomArrive = _this$props.onBottomArrive,
  588. onBottomLeave = _this$props.onBottomLeave,
  589. onTopArrive = _this$props.onTopArrive,
  590. onTopLeave = _this$props.onTopLeave;
  591. var _this$scrollTarget = _this.scrollTarget,
  592. scrollTop = _this$scrollTarget.scrollTop,
  593. scrollHeight = _this$scrollTarget.scrollHeight,
  594. clientHeight = _this$scrollTarget.clientHeight;
  595. var target = _this.scrollTarget;
  596. var isDeltaPositive = delta > 0;
  597. var availableScroll = scrollHeight - clientHeight - scrollTop;
  598. var shouldCancelScroll = false; // reset bottom/top flags
  599. if (availableScroll > delta && _this.isBottom) {
  600. if (onBottomLeave) onBottomLeave(event);
  601. _this.isBottom = false;
  602. }
  603. if (isDeltaPositive && _this.isTop) {
  604. if (onTopLeave) onTopLeave(event);
  605. _this.isTop = false;
  606. } // bottom limit
  607. if (isDeltaPositive && delta > availableScroll) {
  608. if (onBottomArrive && !_this.isBottom) {
  609. onBottomArrive(event);
  610. }
  611. target.scrollTop = scrollHeight;
  612. shouldCancelScroll = true;
  613. _this.isBottom = true; // top limit
  614. } else if (!isDeltaPositive && -delta > scrollTop) {
  615. if (onTopArrive && !_this.isTop) {
  616. onTopArrive(event);
  617. }
  618. target.scrollTop = 0;
  619. shouldCancelScroll = true;
  620. _this.isTop = true;
  621. } // cancel scroll
  622. if (shouldCancelScroll) {
  623. _this.cancelScroll(event);
  624. }
  625. };
  626. _this.onWheel = function (event) {
  627. _this.handleEventDelta(event, event.deltaY);
  628. };
  629. _this.onTouchStart = function (event) {
  630. // set touch start so we can calculate touchmove delta
  631. _this.touchStart = event.changedTouches[0].clientY;
  632. };
  633. _this.onTouchMove = function (event) {
  634. var deltaY = _this.touchStart - event.changedTouches[0].clientY;
  635. _this.handleEventDelta(event, deltaY);
  636. };
  637. _this.getScrollTarget = function (ref) {
  638. _this.scrollTarget = ref;
  639. };
  640. return _this;
  641. }
  642. var _proto = ScrollCaptor.prototype;
  643. _proto.componentDidMount = function componentDidMount() {
  644. this.startListening(this.scrollTarget);
  645. };
  646. _proto.componentWillUnmount = function componentWillUnmount() {
  647. this.stopListening(this.scrollTarget);
  648. };
  649. _proto.startListening = function startListening(el) {
  650. // bail early if no element is available to attach to
  651. if (!el) return; // all the if statements are to appease Flow 😢
  652. if (typeof el.addEventListener === 'function') {
  653. el.addEventListener('wheel', this.onWheel, false);
  654. }
  655. if (typeof el.addEventListener === 'function') {
  656. el.addEventListener('touchstart', this.onTouchStart, false);
  657. }
  658. if (typeof el.addEventListener === 'function') {
  659. el.addEventListener('touchmove', this.onTouchMove, false);
  660. }
  661. };
  662. _proto.stopListening = function stopListening(el) {
  663. // all the if statements are to appease Flow 😢
  664. if (typeof el.removeEventListener === 'function') {
  665. el.removeEventListener('wheel', this.onWheel, false);
  666. }
  667. if (typeof el.removeEventListener === 'function') {
  668. el.removeEventListener('touchstart', this.onTouchStart, false);
  669. }
  670. if (typeof el.removeEventListener === 'function') {
  671. el.removeEventListener('touchmove', this.onTouchMove, false);
  672. }
  673. };
  674. _proto.render = function render() {
  675. return React__default.createElement(NodeResolver, {
  676. innerRef: this.getScrollTarget
  677. }, this.props.children);
  678. };
  679. return ScrollCaptor;
  680. }(React.Component);
  681. function ScrollCaptorSwitch(_ref) {
  682. var _ref$isEnabled = _ref.isEnabled,
  683. isEnabled = _ref$isEnabled === void 0 ? true : _ref$isEnabled,
  684. props = _objectWithoutPropertiesLoose$1(_ref, ["isEnabled"]);
  685. return isEnabled ? React__default.createElement(ScrollCaptor, props) : props.children;
  686. }
  687. var instructionsAriaMessage = function instructionsAriaMessage(event, context) {
  688. if (context === void 0) {
  689. context = {};
  690. }
  691. var _context = context,
  692. isSearchable = _context.isSearchable,
  693. isMulti = _context.isMulti,
  694. label = _context.label,
  695. isDisabled = _context.isDisabled;
  696. switch (event) {
  697. case 'menu':
  698. 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.";
  699. case 'input':
  700. return (label ? label : 'Select') + " is focused " + (isSearchable ? ',type to refine list' : '') + ", press Down to open the menu, " + (isMulti ? ' press left to focus selected values' : '');
  701. case 'value':
  702. return 'Use left and right to toggle between focused values, press Backspace to remove the currently focused value';
  703. }
  704. };
  705. var valueEventAriaMessage = function valueEventAriaMessage(event, context) {
  706. var value = context.value,
  707. isDisabled = context.isDisabled;
  708. if (!value) return;
  709. switch (event) {
  710. case 'deselect-option':
  711. case 'pop-value':
  712. case 'remove-value':
  713. return "option " + value + ", deselected.";
  714. case 'select-option':
  715. return isDisabled ? "option " + value + " is disabled. Select another option." : "option " + value + ", selected.";
  716. }
  717. };
  718. var valueFocusAriaMessage = function valueFocusAriaMessage(_ref) {
  719. var focusedValue = _ref.focusedValue,
  720. getOptionLabel = _ref.getOptionLabel,
  721. selectValue = _ref.selectValue;
  722. return "value " + getOptionLabel(focusedValue) + " focused, " + (selectValue.indexOf(focusedValue) + 1) + " of " + selectValue.length + ".";
  723. };
  724. var optionFocusAriaMessage = function optionFocusAriaMessage(_ref2) {
  725. var focusedOption = _ref2.focusedOption,
  726. getOptionLabel = _ref2.getOptionLabel,
  727. options = _ref2.options;
  728. return "option " + getOptionLabel(focusedOption) + " focused" + (focusedOption.isDisabled ? ' disabled' : '') + ", " + (options.indexOf(focusedOption) + 1) + " of " + options.length + ".";
  729. };
  730. var resultsAriaMessage = function resultsAriaMessage(_ref3) {
  731. var inputValue = _ref3.inputValue,
  732. screenReaderMessage = _ref3.screenReaderMessage;
  733. return "" + screenReaderMessage + (inputValue ? ' for search term ' + inputValue : '') + ".";
  734. };
  735. var formatGroupLabel = function formatGroupLabel(group) {
  736. return group.label;
  737. };
  738. var getOptionLabel = function getOptionLabel(option) {
  739. return option.label;
  740. };
  741. var getOptionValue = function getOptionValue(option) {
  742. return option.value;
  743. };
  744. var isOptionDisabled = function isOptionDisabled(option) {
  745. return !!option.isDisabled;
  746. };
  747. function _extends$3() { _extends$3 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$3.apply(this, arguments); }
  748. var defaultStyles = {
  749. clearIndicator: index.clearIndicatorCSS,
  750. container: index.containerCSS,
  751. control: index.css,
  752. dropdownIndicator: index.dropdownIndicatorCSS,
  753. group: index.groupCSS,
  754. groupHeading: index.groupHeadingCSS,
  755. indicatorsContainer: index.indicatorsContainerCSS,
  756. indicatorSeparator: index.indicatorSeparatorCSS,
  757. input: index.inputCSS,
  758. loadingIndicator: index.loadingIndicatorCSS,
  759. loadingMessage: index.loadingMessageCSS,
  760. menu: index.menuCSS,
  761. menuList: index.menuListCSS,
  762. menuPortal: index.menuPortalCSS,
  763. multiValue: index.multiValueCSS,
  764. multiValueLabel: index.multiValueLabelCSS,
  765. multiValueRemove: index.multiValueRemoveCSS,
  766. noOptionsMessage: index.noOptionsMessageCSS,
  767. option: index.optionCSS,
  768. placeholder: index.placeholderCSS,
  769. singleValue: index.css$1,
  770. valueContainer: index.valueContainerCSS
  771. }; // Merge Utility
  772. // Allows consumers to extend a base Select with additional styles
  773. function mergeStyles(source, target) {
  774. if (target === void 0) {
  775. target = {};
  776. }
  777. // initialize with source styles
  778. var styles = _extends$3({}, source); // massage in target styles
  779. Object.keys(target).forEach(function (key) {
  780. if (source[key]) {
  781. styles[key] = function (rsCss, props) {
  782. return target[key](source[key](rsCss, props), props);
  783. };
  784. } else {
  785. styles[key] = target[key];
  786. }
  787. });
  788. return styles;
  789. }
  790. var colors = {
  791. primary: '#2684FF',
  792. primary75: '#4C9AFF',
  793. primary50: '#B2D4FF',
  794. primary25: '#DEEBFF',
  795. danger: '#DE350B',
  796. dangerLight: '#FFBDAD',
  797. neutral0: 'hsl(0, 0%, 100%)',
  798. neutral5: 'hsl(0, 0%, 95%)',
  799. neutral10: 'hsl(0, 0%, 90%)',
  800. neutral20: 'hsl(0, 0%, 80%)',
  801. neutral30: 'hsl(0, 0%, 70%)',
  802. neutral40: 'hsl(0, 0%, 60%)',
  803. neutral50: 'hsl(0, 0%, 50%)',
  804. neutral60: 'hsl(0, 0%, 40%)',
  805. neutral70: 'hsl(0, 0%, 30%)',
  806. neutral80: 'hsl(0, 0%, 20%)',
  807. neutral90: 'hsl(0, 0%, 10%)'
  808. };
  809. var borderRadius = 4; // Used to calculate consistent margin/padding on elements
  810. var baseUnit = 4; // The minimum height of the control
  811. var controlHeight = 38; // The amount of space between the control and menu */
  812. var menuGutter = baseUnit * 2;
  813. var spacing = {
  814. baseUnit: baseUnit,
  815. controlHeight: controlHeight,
  816. menuGutter: menuGutter
  817. };
  818. var defaultTheme = {
  819. borderRadius: borderRadius,
  820. colors: colors,
  821. spacing: spacing
  822. };
  823. function _objectWithoutPropertiesLoose$2(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
  824. function _extends$4() { _extends$4 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$4.apply(this, arguments); }
  825. function _inheritsLoose$4(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
  826. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  827. var defaultProps = {
  828. backspaceRemovesValue: true,
  829. blurInputOnSelect: utils.isTouchCapable(),
  830. captureMenuScroll: !utils.isTouchCapable(),
  831. closeMenuOnSelect: true,
  832. closeMenuOnScroll: false,
  833. components: {},
  834. controlShouldRenderValue: true,
  835. escapeClearsValue: false,
  836. filterOption: createFilter(),
  837. formatGroupLabel: formatGroupLabel,
  838. getOptionLabel: getOptionLabel,
  839. getOptionValue: getOptionValue,
  840. isDisabled: false,
  841. isLoading: false,
  842. isMulti: false,
  843. isRtl: false,
  844. isSearchable: true,
  845. isOptionDisabled: isOptionDisabled,
  846. loadingMessage: function loadingMessage() {
  847. return 'Loading...';
  848. },
  849. maxMenuHeight: 300,
  850. minMenuHeight: 140,
  851. menuIsOpen: false,
  852. menuPlacement: 'bottom',
  853. menuPosition: 'absolute',
  854. menuShouldBlockScroll: false,
  855. menuShouldScrollIntoView: !utils.isMobileDevice(),
  856. noOptionsMessage: function noOptionsMessage() {
  857. return 'No options';
  858. },
  859. openMenuOnFocus: false,
  860. openMenuOnClick: true,
  861. options: [],
  862. pageSize: 5,
  863. placeholder: 'Select...',
  864. screenReaderStatus: function screenReaderStatus(_ref) {
  865. var count = _ref.count;
  866. return count + " result" + (count !== 1 ? 's' : '') + " available";
  867. },
  868. styles: {},
  869. tabIndex: '0',
  870. tabSelectsValue: true
  871. };
  872. var instanceId = 1;
  873. var Select =
  874. /*#__PURE__*/
  875. function (_Component) {
  876. _inheritsLoose$4(Select, _Component);
  877. // Misc. Instance Properties
  878. // ------------------------------
  879. // TODO
  880. // Refs
  881. // ------------------------------
  882. // Lifecycle
  883. // ------------------------------
  884. function Select(_props) {
  885. var _this;
  886. _this = _Component.call(this, _props) || this;
  887. _this.state = {
  888. ariaLiveSelection: '',
  889. ariaLiveContext: '',
  890. focusedOption: null,
  891. focusedValue: null,
  892. inputIsHidden: false,
  893. isFocused: false,
  894. menuOptions: {
  895. render: [],
  896. focusable: []
  897. },
  898. selectValue: []
  899. };
  900. _this.blockOptionHover = false;
  901. _this.isComposing = false;
  902. _this.clearFocusValueOnUpdate = false;
  903. _this.commonProps = void 0;
  904. _this.components = void 0;
  905. _this.hasGroups = false;
  906. _this.initialTouchX = 0;
  907. _this.initialTouchY = 0;
  908. _this.inputIsHiddenAfterUpdate = void 0;
  909. _this.instancePrefix = '';
  910. _this.openAfterFocus = false;
  911. _this.scrollToFocusedOptionOnUpdate = false;
  912. _this.userIsDragging = void 0;
  913. _this.controlRef = null;
  914. _this.getControlRef = function (ref) {
  915. _this.controlRef = ref;
  916. };
  917. _this.focusedOptionRef = null;
  918. _this.getFocusedOptionRef = function (ref) {
  919. _this.focusedOptionRef = ref;
  920. };
  921. _this.menuListRef = null;
  922. _this.getMenuListRef = function (ref) {
  923. _this.menuListRef = ref;
  924. };
  925. _this.inputRef = null;
  926. _this.getInputRef = function (ref) {
  927. _this.inputRef = ref;
  928. };
  929. _this.cacheComponents = function (components) {
  930. _this.components = index.defaultComponents({
  931. components: components
  932. });
  933. };
  934. _this.focus = _this.focusInput;
  935. _this.blur = _this.blurInput;
  936. _this.onChange = function (newValue, actionMeta) {
  937. var _this$props = _this.props,
  938. onChange = _this$props.onChange,
  939. name = _this$props.name;
  940. onChange(newValue, _extends$4({}, actionMeta, {
  941. name: name
  942. }));
  943. };
  944. _this.setValue = function (newValue, action, option) {
  945. if (action === void 0) {
  946. action = 'set-value';
  947. }
  948. var _this$props2 = _this.props,
  949. closeMenuOnSelect = _this$props2.closeMenuOnSelect,
  950. isMulti = _this$props2.isMulti;
  951. _this.onInputChange('', {
  952. action: 'set-value'
  953. });
  954. if (closeMenuOnSelect) {
  955. _this.inputIsHiddenAfterUpdate = !isMulti;
  956. _this.onMenuClose();
  957. } // when the select value should change, we should reset focusedValue
  958. _this.clearFocusValueOnUpdate = true;
  959. _this.onChange(newValue, {
  960. action: action,
  961. option: option
  962. });
  963. };
  964. _this.selectOption = function (newValue) {
  965. var _this$props3 = _this.props,
  966. blurInputOnSelect = _this$props3.blurInputOnSelect,
  967. isMulti = _this$props3.isMulti;
  968. var selectValue = _this.state.selectValue;
  969. if (isMulti) {
  970. if (_this.isOptionSelected(newValue, selectValue)) {
  971. var candidate = _this.getOptionValue(newValue);
  972. _this.setValue(selectValue.filter(function (i) {
  973. return _this.getOptionValue(i) !== candidate;
  974. }), 'deselect-option', newValue);
  975. _this.announceAriaLiveSelection({
  976. event: 'deselect-option',
  977. context: {
  978. value: _this.getOptionLabel(newValue)
  979. }
  980. });
  981. } else {
  982. if (!_this.isOptionDisabled(newValue, selectValue)) {
  983. _this.setValue([].concat(selectValue, [newValue]), 'select-option', newValue);
  984. _this.announceAriaLiveSelection({
  985. event: 'select-option',
  986. context: {
  987. value: _this.getOptionLabel(newValue)
  988. }
  989. });
  990. } else {
  991. // announce that option is disabled
  992. _this.announceAriaLiveSelection({
  993. event: 'select-option',
  994. context: {
  995. value: _this.getOptionLabel(newValue),
  996. isDisabled: true
  997. }
  998. });
  999. }
  1000. }
  1001. } else {
  1002. if (!_this.isOptionDisabled(newValue, selectValue)) {
  1003. _this.setValue(newValue, 'select-option');
  1004. _this.announceAriaLiveSelection({
  1005. event: 'select-option',
  1006. context: {
  1007. value: _this.getOptionLabel(newValue)
  1008. }
  1009. });
  1010. } else {
  1011. // announce that option is disabled
  1012. _this.announceAriaLiveSelection({
  1013. event: 'select-option',
  1014. context: {
  1015. value: _this.getOptionLabel(newValue),
  1016. isDisabled: true
  1017. }
  1018. });
  1019. }
  1020. }
  1021. if (blurInputOnSelect) {
  1022. _this.blurInput();
  1023. }
  1024. };
  1025. _this.removeValue = function (removedValue) {
  1026. var selectValue = _this.state.selectValue;
  1027. var candidate = _this.getOptionValue(removedValue);
  1028. var newValue = selectValue.filter(function (i) {
  1029. return _this.getOptionValue(i) !== candidate;
  1030. });
  1031. _this.onChange(newValue.length ? newValue : null, {
  1032. action: 'remove-value',
  1033. removedValue: removedValue
  1034. });
  1035. _this.announceAriaLiveSelection({
  1036. event: 'remove-value',
  1037. context: {
  1038. value: removedValue ? _this.getOptionLabel(removedValue) : ''
  1039. }
  1040. });
  1041. _this.focusInput();
  1042. };
  1043. _this.clearValue = function () {
  1044. var isMulti = _this.props.isMulti;
  1045. _this.onChange(isMulti ? [] : null, {
  1046. action: 'clear'
  1047. });
  1048. };
  1049. _this.popValue = function () {
  1050. var selectValue = _this.state.selectValue;
  1051. var lastSelectedValue = selectValue[selectValue.length - 1];
  1052. var newValue = selectValue.slice(0, selectValue.length - 1);
  1053. _this.announceAriaLiveSelection({
  1054. event: 'pop-value',
  1055. context: {
  1056. value: lastSelectedValue ? _this.getOptionLabel(lastSelectedValue) : ''
  1057. }
  1058. });
  1059. _this.onChange(newValue.length ? newValue : null, {
  1060. action: 'pop-value',
  1061. removedValue: lastSelectedValue
  1062. });
  1063. };
  1064. _this.getOptionLabel = function (data) {
  1065. return _this.props.getOptionLabel(data);
  1066. };
  1067. _this.getOptionValue = function (data) {
  1068. return _this.props.getOptionValue(data);
  1069. };
  1070. _this.getStyles = function (key, props) {
  1071. var base = defaultStyles[key](props);
  1072. base.boxSizing = 'border-box';
  1073. var custom = _this.props.styles[key];
  1074. return custom ? custom(base, props) : base;
  1075. };
  1076. _this.getElementId = function (element) {
  1077. return _this.instancePrefix + "-" + element;
  1078. };
  1079. _this.getActiveDescendentId = function () {
  1080. var menuIsOpen = _this.props.menuIsOpen;
  1081. var _this$state = _this.state,
  1082. menuOptions = _this$state.menuOptions,
  1083. focusedOption = _this$state.focusedOption;
  1084. if (!focusedOption || !menuIsOpen) return undefined;
  1085. var index = menuOptions.focusable.indexOf(focusedOption);
  1086. var option = menuOptions.render[index];
  1087. return option && option.key;
  1088. };
  1089. _this.announceAriaLiveSelection = function (_ref2) {
  1090. var event = _ref2.event,
  1091. context = _ref2.context;
  1092. _this.setState({
  1093. ariaLiveSelection: valueEventAriaMessage(event, context)
  1094. });
  1095. };
  1096. _this.announceAriaLiveContext = function (_ref3) {
  1097. var event = _ref3.event,
  1098. context = _ref3.context;
  1099. _this.setState({
  1100. ariaLiveContext: instructionsAriaMessage(event, _extends$4({}, context, {
  1101. label: _this.props['aria-label']
  1102. }))
  1103. });
  1104. };
  1105. _this.onMenuMouseDown = function (event) {
  1106. if (event.button !== 0) {
  1107. return;
  1108. }
  1109. event.stopPropagation();
  1110. event.preventDefault();
  1111. _this.focusInput();
  1112. };
  1113. _this.onMenuMouseMove = function (event) {
  1114. _this.blockOptionHover = false;
  1115. };
  1116. _this.onControlMouseDown = function (event) {
  1117. var openMenuOnClick = _this.props.openMenuOnClick;
  1118. if (!_this.state.isFocused) {
  1119. if (openMenuOnClick) {
  1120. _this.openAfterFocus = true;
  1121. }
  1122. _this.focusInput();
  1123. } else if (!_this.props.menuIsOpen) {
  1124. if (openMenuOnClick) {
  1125. _this.openMenu('first');
  1126. }
  1127. } else {
  1128. if ( // $FlowFixMe
  1129. event.target.tagName !== 'INPUT' && event.target.tagName !== 'TEXTAREA') {
  1130. _this.onMenuClose();
  1131. }
  1132. }
  1133. if ( // $FlowFixMe
  1134. event.target.tagName !== 'INPUT' && event.target.tagName !== 'TEXTAREA') {
  1135. event.preventDefault();
  1136. }
  1137. };
  1138. _this.onDropdownIndicatorMouseDown = function (event) {
  1139. // ignore mouse events that weren't triggered by the primary button
  1140. if (event && event.type === 'mousedown' && event.button !== 0) {
  1141. return;
  1142. }
  1143. if (_this.props.isDisabled) return;
  1144. var _this$props4 = _this.props,
  1145. isMulti = _this$props4.isMulti,
  1146. menuIsOpen = _this$props4.menuIsOpen;
  1147. _this.focusInput();
  1148. if (menuIsOpen) {
  1149. _this.inputIsHiddenAfterUpdate = !isMulti;
  1150. _this.onMenuClose();
  1151. } else {
  1152. _this.openMenu('first');
  1153. }
  1154. event.preventDefault();
  1155. event.stopPropagation();
  1156. };
  1157. _this.onClearIndicatorMouseDown = function (event) {
  1158. // ignore mouse events that weren't triggered by the primary button
  1159. if (event && event.type === 'mousedown' && event.button !== 0) {
  1160. return;
  1161. }
  1162. _this.clearValue();
  1163. event.stopPropagation();
  1164. _this.openAfterFocus = false;
  1165. if (event.type === 'touchend') {
  1166. _this.focusInput();
  1167. } else {
  1168. setTimeout(function () {
  1169. return _this.focusInput();
  1170. });
  1171. }
  1172. };
  1173. _this.onScroll = function (event) {
  1174. if (typeof _this.props.closeMenuOnScroll === 'boolean') {
  1175. if (event.target instanceof HTMLElement && utils.isDocumentElement(event.target)) {
  1176. _this.props.onMenuClose();
  1177. }
  1178. } else if (typeof _this.props.closeMenuOnScroll === 'function') {
  1179. if (_this.props.closeMenuOnScroll(event)) {
  1180. _this.props.onMenuClose();
  1181. }
  1182. }
  1183. };
  1184. _this.onCompositionStart = function () {
  1185. _this.isComposing = true;
  1186. };
  1187. _this.onCompositionEnd = function () {
  1188. _this.isComposing = false;
  1189. };
  1190. _this.onTouchStart = function (_ref4) {
  1191. var touches = _ref4.touches;
  1192. var touch = touches.item(0);
  1193. if (!touch) {
  1194. return;
  1195. }
  1196. _this.initialTouchX = touch.clientX;
  1197. _this.initialTouchY = touch.clientY;
  1198. _this.userIsDragging = false;
  1199. };
  1200. _this.onTouchMove = function (_ref5) {
  1201. var touches = _ref5.touches;
  1202. var touch = touches.item(0);
  1203. if (!touch) {
  1204. return;
  1205. }
  1206. var deltaX = Math.abs(touch.clientX - _this.initialTouchX);
  1207. var deltaY = Math.abs(touch.clientY - _this.initialTouchY);
  1208. var moveThreshold = 5;
  1209. _this.userIsDragging = deltaX > moveThreshold || deltaY > moveThreshold;
  1210. };
  1211. _this.onTouchEnd = function (event) {
  1212. if (_this.userIsDragging) return; // close the menu if the user taps outside
  1213. // we're checking on event.target here instead of event.currentTarget, because we want to assert information
  1214. // on events on child elements, not the document (which we've attached this handler to).
  1215. if (_this.controlRef && !_this.controlRef.contains(event.target) && _this.menuListRef && !_this.menuListRef.contains(event.target)) {
  1216. _this.blurInput();
  1217. } // reset move vars
  1218. _this.initialTouchX = 0;
  1219. _this.initialTouchY = 0;
  1220. };
  1221. _this.onControlTouchEnd = function (event) {
  1222. if (_this.userIsDragging) return;
  1223. _this.onControlMouseDown(event);
  1224. };
  1225. _this.onClearIndicatorTouchEnd = function (event) {
  1226. if (_this.userIsDragging) return;
  1227. _this.onClearIndicatorMouseDown(event);
  1228. };
  1229. _this.onDropdownIndicatorTouchEnd = function (event) {
  1230. if (_this.userIsDragging) return;
  1231. _this.onDropdownIndicatorMouseDown(event);
  1232. };
  1233. _this.handleInputChange = function (event) {
  1234. var inputValue = event.currentTarget.value;
  1235. _this.inputIsHiddenAfterUpdate = false;
  1236. _this.onInputChange(inputValue, {
  1237. action: 'input-change'
  1238. });
  1239. _this.onMenuOpen();
  1240. };
  1241. _this.onInputFocus = function (event) {
  1242. var _this$props5 = _this.props,
  1243. isSearchable = _this$props5.isSearchable,
  1244. isMulti = _this$props5.isMulti;
  1245. if (_this.props.onFocus) {
  1246. _this.props.onFocus(event);
  1247. }
  1248. _this.inputIsHiddenAfterUpdate = false;
  1249. _this.announceAriaLiveContext({
  1250. event: 'input',
  1251. context: {
  1252. isSearchable: isSearchable,
  1253. isMulti: isMulti
  1254. }
  1255. });
  1256. _this.setState({
  1257. isFocused: true
  1258. });
  1259. if (_this.openAfterFocus || _this.props.openMenuOnFocus) {
  1260. _this.openMenu('first');
  1261. }
  1262. _this.openAfterFocus = false;
  1263. };
  1264. _this.onInputBlur = function (event) {
  1265. if (_this.menuListRef && _this.menuListRef.contains(document.activeElement)) {
  1266. _this.inputRef.focus();
  1267. return;
  1268. }
  1269. if (_this.props.onBlur) {
  1270. _this.props.onBlur(event);
  1271. }
  1272. _this.onInputChange('', {
  1273. action: 'input-blur'
  1274. });
  1275. _this.onMenuClose();
  1276. _this.setState({
  1277. focusedValue: null,
  1278. isFocused: false
  1279. });
  1280. };
  1281. _this.onOptionHover = function (focusedOption) {
  1282. if (_this.blockOptionHover || _this.state.focusedOption === focusedOption) {
  1283. return;
  1284. }
  1285. _this.setState({
  1286. focusedOption: focusedOption
  1287. });
  1288. };
  1289. _this.shouldHideSelectedOptions = function () {
  1290. var _this$props6 = _this.props,
  1291. hideSelectedOptions = _this$props6.hideSelectedOptions,
  1292. isMulti = _this$props6.isMulti;
  1293. if (hideSelectedOptions === undefined) return isMulti;
  1294. return hideSelectedOptions;
  1295. };
  1296. _this.onKeyDown = function (event) {
  1297. var _this$props7 = _this.props,
  1298. isMulti = _this$props7.isMulti,
  1299. backspaceRemovesValue = _this$props7.backspaceRemovesValue,
  1300. escapeClearsValue = _this$props7.escapeClearsValue,
  1301. inputValue = _this$props7.inputValue,
  1302. isClearable = _this$props7.isClearable,
  1303. isDisabled = _this$props7.isDisabled,
  1304. menuIsOpen = _this$props7.menuIsOpen,
  1305. onKeyDown = _this$props7.onKeyDown,
  1306. tabSelectsValue = _this$props7.tabSelectsValue,
  1307. openMenuOnFocus = _this$props7.openMenuOnFocus;
  1308. var _this$state2 = _this.state,
  1309. focusedOption = _this$state2.focusedOption,
  1310. focusedValue = _this$state2.focusedValue,
  1311. selectValue = _this$state2.selectValue;
  1312. if (isDisabled) return;
  1313. if (typeof onKeyDown === 'function') {
  1314. onKeyDown(event);
  1315. if (event.defaultPrevented) {
  1316. return;
  1317. }
  1318. } // Block option hover events when the user has just pressed a key
  1319. _this.blockOptionHover = true;
  1320. switch (event.key) {
  1321. case 'ArrowLeft':
  1322. if (!isMulti || inputValue) return;
  1323. _this.focusValue('previous');
  1324. break;
  1325. case 'ArrowRight':
  1326. if (!isMulti || inputValue) return;
  1327. _this.focusValue('next');
  1328. break;
  1329. case 'Delete':
  1330. case 'Backspace':
  1331. if (inputValue) return;
  1332. if (focusedValue) {
  1333. _this.removeValue(focusedValue);
  1334. } else {
  1335. if (!backspaceRemovesValue) return;
  1336. if (isMulti) {
  1337. _this.popValue();
  1338. } else if (isClearable) {
  1339. _this.clearValue();
  1340. }
  1341. }
  1342. break;
  1343. case 'Tab':
  1344. if (_this.isComposing) return;
  1345. if (event.shiftKey || !menuIsOpen || !tabSelectsValue || !focusedOption || // don't capture the event if the menu opens on focus and the focused
  1346. // option is already selected; it breaks the flow of navigation
  1347. openMenuOnFocus && _this.isOptionSelected(focusedOption, selectValue)) {
  1348. return;
  1349. }
  1350. _this.selectOption(focusedOption);
  1351. break;
  1352. case 'Enter':
  1353. if (event.keyCode === 229) {
  1354. // ignore the keydown event from an Input Method Editor(IME)
  1355. // ref. https://www.w3.org/TR/uievents/#determine-keydown-keyup-keyCode
  1356. break;
  1357. }
  1358. if (menuIsOpen) {
  1359. if (!focusedOption) return;
  1360. if (_this.isComposing) return;
  1361. _this.selectOption(focusedOption);
  1362. break;
  1363. }
  1364. return;
  1365. case 'Escape':
  1366. if (menuIsOpen) {
  1367. _this.inputIsHiddenAfterUpdate = false;
  1368. _this.onInputChange('', {
  1369. action: 'menu-close'
  1370. });
  1371. _this.onMenuClose();
  1372. } else if (isClearable && escapeClearsValue) {
  1373. _this.clearValue();
  1374. }
  1375. break;
  1376. case ' ':
  1377. // space
  1378. if (inputValue) {
  1379. return;
  1380. }
  1381. if (!menuIsOpen) {
  1382. _this.openMenu('first');
  1383. break;
  1384. }
  1385. if (!focusedOption) return;
  1386. _this.selectOption(focusedOption);
  1387. break;
  1388. case 'ArrowUp':
  1389. if (menuIsOpen) {
  1390. _this.focusOption('up');
  1391. } else {
  1392. _this.openMenu('last');
  1393. }
  1394. break;
  1395. case 'ArrowDown':
  1396. if (menuIsOpen) {
  1397. _this.focusOption('down');
  1398. } else {
  1399. _this.openMenu('first');
  1400. }
  1401. break;
  1402. case 'PageUp':
  1403. if (!menuIsOpen) return;
  1404. _this.focusOption('pageup');
  1405. break;
  1406. case 'PageDown':
  1407. if (!menuIsOpen) return;
  1408. _this.focusOption('pagedown');
  1409. break;
  1410. case 'Home':
  1411. if (!menuIsOpen) return;
  1412. _this.focusOption('first');
  1413. break;
  1414. case 'End':
  1415. if (!menuIsOpen) return;
  1416. _this.focusOption('last');
  1417. break;
  1418. default:
  1419. return;
  1420. }
  1421. event.preventDefault();
  1422. };
  1423. _this.buildMenuOptions = function (props, selectValue) {
  1424. var _props$inputValue = props.inputValue,
  1425. inputValue = _props$inputValue === void 0 ? '' : _props$inputValue,
  1426. options = props.options;
  1427. var toOption = function toOption(option, id) {
  1428. var isDisabled = _this.isOptionDisabled(option, selectValue);
  1429. var isSelected = _this.isOptionSelected(option, selectValue);
  1430. var label = _this.getOptionLabel(option);
  1431. var value = _this.getOptionValue(option);
  1432. if (_this.shouldHideSelectedOptions() && isSelected || !_this.filterOption({
  1433. label: label,
  1434. value: value,
  1435. data: option
  1436. }, inputValue)) {
  1437. return;
  1438. }
  1439. var onHover = isDisabled ? undefined : function () {
  1440. return _this.onOptionHover(option);
  1441. };
  1442. var onSelect = isDisabled ? undefined : function () {
  1443. return _this.selectOption(option);
  1444. };
  1445. var optionId = _this.getElementId('option') + "-" + id;
  1446. return {
  1447. innerProps: {
  1448. id: optionId,
  1449. onClick: onSelect,
  1450. onMouseMove: onHover,
  1451. onMouseOver: onHover,
  1452. tabIndex: -1
  1453. },
  1454. data: option,
  1455. isDisabled: isDisabled,
  1456. isSelected: isSelected,
  1457. key: optionId,
  1458. label: label,
  1459. type: 'option',
  1460. value: value
  1461. };
  1462. };
  1463. return options.reduce(function (acc, item, itemIndex) {
  1464. if (item.options) {
  1465. // TODO needs a tidier implementation
  1466. if (!_this.hasGroups) _this.hasGroups = true;
  1467. var items = item.options;
  1468. var children = items.map(function (child, i) {
  1469. var option = toOption(child, itemIndex + "-" + i);
  1470. if (option) acc.focusable.push(child);
  1471. return option;
  1472. }).filter(Boolean);
  1473. if (children.length) {
  1474. var groupId = _this.getElementId('group') + "-" + itemIndex;
  1475. acc.render.push({
  1476. type: 'group',
  1477. key: groupId,
  1478. data: item,
  1479. options: children
  1480. });
  1481. }
  1482. } else {
  1483. var option = toOption(item, "" + itemIndex);
  1484. if (option) {
  1485. acc.render.push(option);
  1486. acc.focusable.push(item);
  1487. }
  1488. }
  1489. return acc;
  1490. }, {
  1491. render: [],
  1492. focusable: []
  1493. });
  1494. };
  1495. var _value = _props.value;
  1496. _this.cacheComponents = memoizeOne(_this.cacheComponents, index.exportedEqual).bind(_assertThisInitialized(_assertThisInitialized(_this)));
  1497. _this.cacheComponents(_props.components);
  1498. _this.instancePrefix = 'react-select-' + (_this.props.instanceId || ++instanceId);
  1499. var _selectValue = utils.cleanValue(_value);
  1500. _this.buildMenuOptions = memoizeOne(_this.buildMenuOptions, function (newArgs, lastArgs) {
  1501. var _ref6 = newArgs,
  1502. newProps = _ref6[0],
  1503. newSelectValue = _ref6[1];
  1504. var _ref7 = lastArgs,
  1505. lastProps = _ref7[0],
  1506. lastSelectValue = _ref7[1];
  1507. return index.exportedEqual(newSelectValue, lastSelectValue) && index.exportedEqual(newProps.inputValue, lastProps.inputValue) && index.exportedEqual(newProps.options, lastProps.options);
  1508. }).bind(_assertThisInitialized(_assertThisInitialized(_this)));
  1509. var _menuOptions = _props.menuIsOpen ? _this.buildMenuOptions(_props, _selectValue) : {
  1510. render: [],
  1511. focusable: []
  1512. };
  1513. _this.state.menuOptions = _menuOptions;
  1514. _this.state.selectValue = _selectValue;
  1515. return _this;
  1516. }
  1517. var _proto = Select.prototype;
  1518. _proto.componentDidMount = function componentDidMount() {
  1519. this.startListeningComposition();
  1520. this.startListeningToTouch();
  1521. if (this.props.closeMenuOnScroll && document && document.addEventListener) {
  1522. // Listen to all scroll events, and filter them out inside of 'onScroll'
  1523. document.addEventListener('scroll', this.onScroll, true);
  1524. }
  1525. if (this.props.autoFocus) {
  1526. this.focusInput();
  1527. }
  1528. };
  1529. _proto.UNSAFE_componentWillReceiveProps = function UNSAFE_componentWillReceiveProps(nextProps) {
  1530. var _this$props8 = this.props,
  1531. options = _this$props8.options,
  1532. value = _this$props8.value,
  1533. menuIsOpen = _this$props8.menuIsOpen,
  1534. inputValue = _this$props8.inputValue; // re-cache custom components
  1535. this.cacheComponents(nextProps.components); // rebuild the menu options
  1536. if (nextProps.value !== value || nextProps.options !== options || nextProps.menuIsOpen !== menuIsOpen || nextProps.inputValue !== inputValue) {
  1537. var selectValue = utils.cleanValue(nextProps.value);
  1538. var menuOptions = nextProps.menuIsOpen ? this.buildMenuOptions(nextProps, selectValue) : {
  1539. render: [],
  1540. focusable: []
  1541. };
  1542. var focusedValue = this.getNextFocusedValue(selectValue);
  1543. var focusedOption = this.getNextFocusedOption(menuOptions.focusable);
  1544. this.setState({
  1545. menuOptions: menuOptions,
  1546. selectValue: selectValue,
  1547. focusedOption: focusedOption,
  1548. focusedValue: focusedValue
  1549. });
  1550. } // some updates should toggle the state of the input visibility
  1551. if (this.inputIsHiddenAfterUpdate != null) {
  1552. this.setState({
  1553. inputIsHidden: this.inputIsHiddenAfterUpdate
  1554. });
  1555. delete this.inputIsHiddenAfterUpdate;
  1556. }
  1557. };
  1558. _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
  1559. var _this$props9 = this.props,
  1560. isDisabled = _this$props9.isDisabled,
  1561. menuIsOpen = _this$props9.menuIsOpen;
  1562. var isFocused = this.state.isFocused;
  1563. if ( // ensure focus is restored correctly when the control becomes enabled
  1564. isFocused && !isDisabled && prevProps.isDisabled || // ensure focus is on the Input when the menu opens
  1565. isFocused && menuIsOpen && !prevProps.menuIsOpen) {
  1566. this.focusInput();
  1567. } // scroll the focused option into view if necessary
  1568. if (this.menuListRef && this.focusedOptionRef && this.scrollToFocusedOptionOnUpdate) {
  1569. utils.scrollIntoView(this.menuListRef, this.focusedOptionRef);
  1570. this.scrollToFocusedOptionOnUpdate = false;
  1571. }
  1572. };
  1573. _proto.componentWillUnmount = function componentWillUnmount() {
  1574. this.stopListeningComposition();
  1575. this.stopListeningToTouch();
  1576. document.removeEventListener('scroll', this.onScroll, true);
  1577. };
  1578. // ==============================
  1579. // Consumer Handlers
  1580. // ==============================
  1581. _proto.onMenuOpen = function onMenuOpen() {
  1582. this.props.onMenuOpen();
  1583. };
  1584. _proto.onMenuClose = function onMenuClose() {
  1585. var _this$props10 = this.props,
  1586. isSearchable = _this$props10.isSearchable,
  1587. isMulti = _this$props10.isMulti;
  1588. this.announceAriaLiveContext({
  1589. event: 'input',
  1590. context: {
  1591. isSearchable: isSearchable,
  1592. isMulti: isMulti
  1593. }
  1594. });
  1595. this.onInputChange('', {
  1596. action: 'menu-close'
  1597. });
  1598. this.props.onMenuClose();
  1599. };
  1600. _proto.onInputChange = function onInputChange(newValue, actionMeta) {
  1601. this.props.onInputChange(newValue, actionMeta);
  1602. } // ==============================
  1603. // Methods
  1604. // ==============================
  1605. ;
  1606. _proto.focusInput = function focusInput() {
  1607. if (!this.inputRef) return;
  1608. this.inputRef.focus();
  1609. };
  1610. _proto.blurInput = function blurInput() {
  1611. if (!this.inputRef) return;
  1612. this.inputRef.blur();
  1613. } // aliased for consumers
  1614. ;
  1615. _proto.openMenu = function openMenu(focusOption) {
  1616. var _this2 = this;
  1617. var _this$state3 = this.state,
  1618. selectValue = _this$state3.selectValue,
  1619. isFocused = _this$state3.isFocused;
  1620. var menuOptions = this.buildMenuOptions(this.props, selectValue);
  1621. var isMulti = this.props.isMulti;
  1622. var openAtIndex = focusOption === 'first' ? 0 : menuOptions.focusable.length - 1;
  1623. if (!isMulti) {
  1624. var selectedIndex = menuOptions.focusable.indexOf(selectValue[0]);
  1625. if (selectedIndex > -1) {
  1626. openAtIndex = selectedIndex;
  1627. }
  1628. } // only scroll if the menu isn't already open
  1629. this.scrollToFocusedOptionOnUpdate = !(isFocused && this.menuListRef);
  1630. this.inputIsHiddenAfterUpdate = false;
  1631. this.setState({
  1632. menuOptions: menuOptions,
  1633. focusedValue: null,
  1634. focusedOption: menuOptions.focusable[openAtIndex]
  1635. }, function () {
  1636. _this2.onMenuOpen();
  1637. _this2.announceAriaLiveContext({
  1638. event: 'menu'
  1639. });
  1640. });
  1641. };
  1642. _proto.focusValue = function focusValue(direction) {
  1643. var _this$props11 = this.props,
  1644. isMulti = _this$props11.isMulti,
  1645. isSearchable = _this$props11.isSearchable;
  1646. var _this$state4 = this.state,
  1647. selectValue = _this$state4.selectValue,
  1648. focusedValue = _this$state4.focusedValue; // Only multiselects support value focusing
  1649. if (!isMulti) return;
  1650. this.setState({
  1651. focusedOption: null
  1652. });
  1653. var focusedIndex = selectValue.indexOf(focusedValue);
  1654. if (!focusedValue) {
  1655. focusedIndex = -1;
  1656. this.announceAriaLiveContext({
  1657. event: 'value'
  1658. });
  1659. }
  1660. var lastIndex = selectValue.length - 1;
  1661. var nextFocus = -1;
  1662. if (!selectValue.length) return;
  1663. switch (direction) {
  1664. case 'previous':
  1665. if (focusedIndex === 0) {
  1666. // don't cycle from the start to the end
  1667. nextFocus = 0;
  1668. } else if (focusedIndex === -1) {
  1669. // if nothing is focused, focus the last value first
  1670. nextFocus = lastIndex;
  1671. } else {
  1672. nextFocus = focusedIndex - 1;
  1673. }
  1674. break;
  1675. case 'next':
  1676. if (focusedIndex > -1 && focusedIndex < lastIndex) {
  1677. nextFocus = focusedIndex + 1;
  1678. }
  1679. break;
  1680. }
  1681. if (nextFocus === -1) {
  1682. this.announceAriaLiveContext({
  1683. event: 'input',
  1684. context: {
  1685. isSearchable: isSearchable,
  1686. isMulti: isMulti
  1687. }
  1688. });
  1689. }
  1690. this.setState({
  1691. inputIsHidden: nextFocus !== -1,
  1692. focusedValue: selectValue[nextFocus]
  1693. });
  1694. };
  1695. _proto.focusOption = function focusOption(direction) {
  1696. if (direction === void 0) {
  1697. direction = 'first';
  1698. }
  1699. var pageSize = this.props.pageSize;
  1700. var _this$state5 = this.state,
  1701. focusedOption = _this$state5.focusedOption,
  1702. menuOptions = _this$state5.menuOptions;
  1703. var options = menuOptions.focusable;
  1704. if (!options.length) return;
  1705. var nextFocus = 0; // handles 'first'
  1706. var focusedIndex = options.indexOf(focusedOption);
  1707. if (!focusedOption) {
  1708. focusedIndex = -1;
  1709. this.announceAriaLiveContext({
  1710. event: 'menu'
  1711. });
  1712. }
  1713. if (direction === 'up') {
  1714. nextFocus = focusedIndex > 0 ? focusedIndex - 1 : options.length - 1;
  1715. } else if (direction === 'down') {
  1716. nextFocus = (focusedIndex + 1) % options.length;
  1717. } else if (direction === 'pageup') {
  1718. nextFocus = focusedIndex - pageSize;
  1719. if (nextFocus < 0) nextFocus = 0;
  1720. } else if (direction === 'pagedown') {
  1721. nextFocus = focusedIndex + pageSize;
  1722. if (nextFocus > options.length - 1) nextFocus = options.length - 1;
  1723. } else if (direction === 'last') {
  1724. nextFocus = options.length - 1;
  1725. }
  1726. this.scrollToFocusedOptionOnUpdate = true;
  1727. this.setState({
  1728. focusedOption: options[nextFocus],
  1729. focusedValue: null
  1730. });
  1731. this.announceAriaLiveContext({
  1732. event: 'menu',
  1733. context: {
  1734. isDisabled: isOptionDisabled(options[nextFocus])
  1735. }
  1736. });
  1737. };
  1738. // ==============================
  1739. // Getters
  1740. // ==============================
  1741. _proto.getTheme = function getTheme() {
  1742. // Use the default theme if there are no customizations.
  1743. if (!this.props.theme) {
  1744. return defaultTheme;
  1745. } // If the theme prop is a function, assume the function
  1746. // knows how to merge the passed-in default theme with
  1747. // its own modifications.
  1748. if (typeof this.props.theme === 'function') {
  1749. return this.props.theme(defaultTheme);
  1750. } // Otherwise, if a plain theme object was passed in,
  1751. // overlay it with the default theme.
  1752. return _extends$4({}, defaultTheme, this.props.theme);
  1753. };
  1754. _proto.getCommonProps = function getCommonProps() {
  1755. var clearValue = this.clearValue,
  1756. getStyles = this.getStyles,
  1757. setValue = this.setValue,
  1758. selectOption = this.selectOption,
  1759. props = this.props;
  1760. var classNamePrefix = props.classNamePrefix,
  1761. isMulti = props.isMulti,
  1762. isRtl = props.isRtl,
  1763. options = props.options;
  1764. var selectValue = this.state.selectValue;
  1765. var hasValue = this.hasValue();
  1766. var getValue = function getValue() {
  1767. return selectValue;
  1768. };
  1769. var cx = utils.classNames.bind(null, classNamePrefix);
  1770. return {
  1771. cx: cx,
  1772. clearValue: clearValue,
  1773. getStyles: getStyles,
  1774. getValue: getValue,
  1775. hasValue: hasValue,
  1776. isMulti: isMulti,
  1777. isRtl: isRtl,
  1778. options: options,
  1779. selectOption: selectOption,
  1780. setValue: setValue,
  1781. selectProps: props,
  1782. theme: this.getTheme()
  1783. };
  1784. };
  1785. _proto.getNextFocusedValue = function getNextFocusedValue(nextSelectValue) {
  1786. if (this.clearFocusValueOnUpdate) {
  1787. this.clearFocusValueOnUpdate = false;
  1788. return null;
  1789. }
  1790. var _this$state6 = this.state,
  1791. focusedValue = _this$state6.focusedValue,
  1792. lastSelectValue = _this$state6.selectValue;
  1793. var lastFocusedIndex = lastSelectValue.indexOf(focusedValue);
  1794. if (lastFocusedIndex > -1) {
  1795. var nextFocusedIndex = nextSelectValue.indexOf(focusedValue);
  1796. if (nextFocusedIndex > -1) {
  1797. // the focused value is still in the selectValue, return it
  1798. return focusedValue;
  1799. } else if (lastFocusedIndex < nextSelectValue.length) {
  1800. // the focusedValue is not present in the next selectValue array by
  1801. // reference, so return the new value at the same index
  1802. return nextSelectValue[lastFocusedIndex];
  1803. }
  1804. }
  1805. return null;
  1806. };
  1807. _proto.getNextFocusedOption = function getNextFocusedOption(options) {
  1808. var lastFocusedOption = this.state.focusedOption;
  1809. return lastFocusedOption && options.indexOf(lastFocusedOption) > -1 ? lastFocusedOption : options[0];
  1810. };
  1811. _proto.hasValue = function hasValue() {
  1812. var selectValue = this.state.selectValue;
  1813. return selectValue.length > 0;
  1814. };
  1815. _proto.hasOptions = function hasOptions() {
  1816. return !!this.state.menuOptions.render.length;
  1817. };
  1818. _proto.countOptions = function countOptions() {
  1819. return this.state.menuOptions.focusable.length;
  1820. };
  1821. _proto.isClearable = function isClearable() {
  1822. var _this$props12 = this.props,
  1823. isClearable = _this$props12.isClearable,
  1824. isMulti = _this$props12.isMulti; // single select, by default, IS NOT clearable
  1825. // multi select, by default, IS clearable
  1826. if (isClearable === undefined) return isMulti;
  1827. return isClearable;
  1828. };
  1829. _proto.isOptionDisabled = function isOptionDisabled(option, selectValue) {
  1830. return typeof this.props.isOptionDisabled === 'function' ? this.props.isOptionDisabled(option, selectValue) : false;
  1831. };
  1832. _proto.isOptionSelected = function isOptionSelected(option, selectValue) {
  1833. var _this3 = this;
  1834. if (selectValue.indexOf(option) > -1) return true;
  1835. if (typeof this.props.isOptionSelected === 'function') {
  1836. return this.props.isOptionSelected(option, selectValue);
  1837. }
  1838. var candidate = this.getOptionValue(option);
  1839. return selectValue.some(function (i) {
  1840. return _this3.getOptionValue(i) === candidate;
  1841. });
  1842. };
  1843. _proto.filterOption = function filterOption(option, inputValue) {
  1844. return this.props.filterOption ? this.props.filterOption(option, inputValue) : true;
  1845. };
  1846. _proto.formatOptionLabel = function formatOptionLabel(data, context) {
  1847. if (typeof this.props.formatOptionLabel === 'function') {
  1848. var inputValue = this.props.inputValue;
  1849. var selectValue = this.state.selectValue;
  1850. return this.props.formatOptionLabel(data, {
  1851. context: context,
  1852. inputValue: inputValue,
  1853. selectValue: selectValue
  1854. });
  1855. } else {
  1856. return this.getOptionLabel(data);
  1857. }
  1858. };
  1859. _proto.formatGroupLabel = function formatGroupLabel(data) {
  1860. return this.props.formatGroupLabel(data);
  1861. } // ==============================
  1862. // Mouse Handlers
  1863. // ==============================
  1864. ;
  1865. // ==============================
  1866. // Composition Handlers
  1867. // ==============================
  1868. _proto.startListeningComposition = function startListeningComposition() {
  1869. if (document && document.addEventListener) {
  1870. document.addEventListener('compositionstart', this.onCompositionStart, false);
  1871. document.addEventListener('compositionend', this.onCompositionEnd, false);
  1872. }
  1873. };
  1874. _proto.stopListeningComposition = function stopListeningComposition() {
  1875. if (document && document.removeEventListener) {
  1876. document.removeEventListener('compositionstart', this.onCompositionStart);
  1877. document.removeEventListener('compositionend', this.onCompositionEnd);
  1878. }
  1879. };
  1880. // ==============================
  1881. // Touch Handlers
  1882. // ==============================
  1883. _proto.startListeningToTouch = function startListeningToTouch() {
  1884. if (document && document.addEventListener) {
  1885. document.addEventListener('touchstart', this.onTouchStart, false);
  1886. document.addEventListener('touchmove', this.onTouchMove, false);
  1887. document.addEventListener('touchend', this.onTouchEnd, false);
  1888. }
  1889. };
  1890. _proto.stopListeningToTouch = function stopListeningToTouch() {
  1891. if (document && document.removeEventListener) {
  1892. document.removeEventListener('touchstart', this.onTouchStart);
  1893. document.removeEventListener('touchmove', this.onTouchMove);
  1894. document.removeEventListener('touchend', this.onTouchEnd);
  1895. }
  1896. };
  1897. // ==============================
  1898. // Renderers
  1899. // ==============================
  1900. _proto.constructAriaLiveMessage = function constructAriaLiveMessage() {
  1901. var _this$state7 = this.state,
  1902. ariaLiveContext = _this$state7.ariaLiveContext,
  1903. selectValue = _this$state7.selectValue,
  1904. focusedValue = _this$state7.focusedValue,
  1905. focusedOption = _this$state7.focusedOption;
  1906. var _this$props13 = this.props,
  1907. options = _this$props13.options,
  1908. menuIsOpen = _this$props13.menuIsOpen,
  1909. inputValue = _this$props13.inputValue,
  1910. screenReaderStatus = _this$props13.screenReaderStatus; // An aria live message representing the currently focused value in the select.
  1911. var focusedValueMsg = focusedValue ? valueFocusAriaMessage({
  1912. focusedValue: focusedValue,
  1913. getOptionLabel: this.getOptionLabel,
  1914. selectValue: selectValue
  1915. }) : ''; // An aria live message representing the currently focused option in the select.
  1916. var focusedOptionMsg = focusedOption && menuIsOpen ? optionFocusAriaMessage({
  1917. focusedOption: focusedOption,
  1918. getOptionLabel: this.getOptionLabel,
  1919. options: options
  1920. }) : ''; // An aria live message representing the set of focusable results and current searchterm/inputvalue.
  1921. var resultsMsg = resultsAriaMessage({
  1922. inputValue: inputValue,
  1923. screenReaderMessage: screenReaderStatus({
  1924. count: this.countOptions()
  1925. })
  1926. });
  1927. return focusedValueMsg + " " + focusedOptionMsg + " " + resultsMsg + " " + ariaLiveContext;
  1928. };
  1929. _proto.renderInput = function renderInput() {
  1930. var _this$props14 = this.props,
  1931. isDisabled = _this$props14.isDisabled,
  1932. isSearchable = _this$props14.isSearchable,
  1933. inputId = _this$props14.inputId,
  1934. inputValue = _this$props14.inputValue,
  1935. tabIndex = _this$props14.tabIndex;
  1936. var Input = this.components.Input;
  1937. var inputIsHidden = this.state.inputIsHidden;
  1938. var id = inputId || this.getElementId('input'); // aria attributes makes the JSX "noisy", separated for clarity
  1939. var ariaAttributes = {
  1940. 'aria-autocomplete': 'list',
  1941. 'aria-label': this.props['aria-label'],
  1942. 'aria-labelledby': this.props['aria-labelledby']
  1943. };
  1944. if (!isSearchable) {
  1945. // use a dummy input to maintain focus/blur functionality
  1946. return React__default.createElement(DummyInput, _extends$4({
  1947. id: id,
  1948. innerRef: this.getInputRef,
  1949. onBlur: this.onInputBlur,
  1950. onChange: utils.noop,
  1951. onFocus: this.onInputFocus,
  1952. readOnly: true,
  1953. disabled: isDisabled,
  1954. tabIndex: tabIndex,
  1955. value: ""
  1956. }, ariaAttributes));
  1957. }
  1958. var _this$commonProps = this.commonProps,
  1959. cx = _this$commonProps.cx,
  1960. theme = _this$commonProps.theme,
  1961. selectProps = _this$commonProps.selectProps;
  1962. return React__default.createElement(Input, _extends$4({
  1963. autoCapitalize: "none",
  1964. autoComplete: "off",
  1965. autoCorrect: "off",
  1966. cx: cx,
  1967. getStyles: this.getStyles,
  1968. id: id,
  1969. innerRef: this.getInputRef,
  1970. isDisabled: isDisabled,
  1971. isHidden: inputIsHidden,
  1972. onBlur: this.onInputBlur,
  1973. onChange: this.handleInputChange,
  1974. onFocus: this.onInputFocus,
  1975. selectProps: selectProps,
  1976. spellCheck: "false",
  1977. tabIndex: tabIndex,
  1978. theme: theme,
  1979. type: "text",
  1980. value: inputValue
  1981. }, ariaAttributes));
  1982. };
  1983. _proto.renderPlaceholderOrValue = function renderPlaceholderOrValue() {
  1984. var _this4 = this;
  1985. var _this$components = this.components,
  1986. MultiValue = _this$components.MultiValue,
  1987. MultiValueContainer = _this$components.MultiValueContainer,
  1988. MultiValueLabel = _this$components.MultiValueLabel,
  1989. MultiValueRemove = _this$components.MultiValueRemove,
  1990. SingleValue = _this$components.SingleValue,
  1991. Placeholder = _this$components.Placeholder;
  1992. var commonProps = this.commonProps;
  1993. var _this$props15 = this.props,
  1994. controlShouldRenderValue = _this$props15.controlShouldRenderValue,
  1995. isDisabled = _this$props15.isDisabled,
  1996. isMulti = _this$props15.isMulti,
  1997. inputValue = _this$props15.inputValue,
  1998. placeholder = _this$props15.placeholder;
  1999. var _this$state8 = this.state,
  2000. selectValue = _this$state8.selectValue,
  2001. focusedValue = _this$state8.focusedValue,
  2002. isFocused = _this$state8.isFocused;
  2003. if (!this.hasValue() || !controlShouldRenderValue) {
  2004. return inputValue ? null : React__default.createElement(Placeholder, _extends$4({}, commonProps, {
  2005. key: "placeholder",
  2006. isDisabled: isDisabled,
  2007. isFocused: isFocused
  2008. }), placeholder);
  2009. }
  2010. if (isMulti) {
  2011. var selectValues = selectValue.map(function (opt, index) {
  2012. var isOptionFocused = opt === focusedValue;
  2013. return React__default.createElement(MultiValue, _extends$4({}, commonProps, {
  2014. components: {
  2015. Container: MultiValueContainer,
  2016. Label: MultiValueLabel,
  2017. Remove: MultiValueRemove
  2018. },
  2019. isFocused: isOptionFocused,
  2020. isDisabled: isDisabled,
  2021. key: _this4.getOptionValue(opt),
  2022. index: index,
  2023. removeProps: {
  2024. onClick: function onClick() {
  2025. return _this4.removeValue(opt);
  2026. },
  2027. onTouchEnd: function onTouchEnd() {
  2028. return _this4.removeValue(opt);
  2029. },
  2030. onMouseDown: function onMouseDown(e) {
  2031. e.preventDefault();
  2032. e.stopPropagation();
  2033. }
  2034. },
  2035. data: opt
  2036. }), _this4.formatOptionLabel(opt, 'value'));
  2037. });
  2038. return selectValues;
  2039. }
  2040. if (inputValue) {
  2041. return null;
  2042. }
  2043. var singleValue = selectValue[0];
  2044. return React__default.createElement(SingleValue, _extends$4({}, commonProps, {
  2045. data: singleValue,
  2046. isDisabled: isDisabled
  2047. }), this.formatOptionLabel(singleValue, 'value'));
  2048. };
  2049. _proto.renderClearIndicator = function renderClearIndicator() {
  2050. var ClearIndicator = this.components.ClearIndicator;
  2051. var commonProps = this.commonProps;
  2052. var _this$props16 = this.props,
  2053. isDisabled = _this$props16.isDisabled,
  2054. isLoading = _this$props16.isLoading;
  2055. var isFocused = this.state.isFocused;
  2056. if (!this.isClearable() || !ClearIndicator || isDisabled || !this.hasValue() || isLoading) {
  2057. return null;
  2058. }
  2059. var innerProps = {
  2060. onMouseDown: this.onClearIndicatorMouseDown,
  2061. onTouchEnd: this.onClearIndicatorTouchEnd,
  2062. 'aria-hidden': 'true'
  2063. };
  2064. return React__default.createElement(ClearIndicator, _extends$4({}, commonProps, {
  2065. innerProps: innerProps,
  2066. isFocused: isFocused
  2067. }));
  2068. };
  2069. _proto.renderLoadingIndicator = function renderLoadingIndicator() {
  2070. var LoadingIndicator = this.components.LoadingIndicator;
  2071. var commonProps = this.commonProps;
  2072. var _this$props17 = this.props,
  2073. isDisabled = _this$props17.isDisabled,
  2074. isLoading = _this$props17.isLoading;
  2075. var isFocused = this.state.isFocused;
  2076. if (!LoadingIndicator || !isLoading) return null;
  2077. var innerProps = {
  2078. 'aria-hidden': 'true'
  2079. };
  2080. return React__default.createElement(LoadingIndicator, _extends$4({}, commonProps, {
  2081. innerProps: innerProps,
  2082. isDisabled: isDisabled,
  2083. isFocused: isFocused
  2084. }));
  2085. };
  2086. _proto.renderIndicatorSeparator = function renderIndicatorSeparator() {
  2087. var _this$components2 = this.components,
  2088. DropdownIndicator = _this$components2.DropdownIndicator,
  2089. IndicatorSeparator = _this$components2.IndicatorSeparator; // separator doesn't make sense without the dropdown indicator
  2090. if (!DropdownIndicator || !IndicatorSeparator) return null;
  2091. var commonProps = this.commonProps;
  2092. var isDisabled = this.props.isDisabled;
  2093. var isFocused = this.state.isFocused;
  2094. return React__default.createElement(IndicatorSeparator, _extends$4({}, commonProps, {
  2095. isDisabled: isDisabled,
  2096. isFocused: isFocused
  2097. }));
  2098. };
  2099. _proto.renderDropdownIndicator = function renderDropdownIndicator() {
  2100. var DropdownIndicator = this.components.DropdownIndicator;
  2101. if (!DropdownIndicator) return null;
  2102. var commonProps = this.commonProps;
  2103. var isDisabled = this.props.isDisabled;
  2104. var isFocused = this.state.isFocused;
  2105. var innerProps = {
  2106. onMouseDown: this.onDropdownIndicatorMouseDown,
  2107. onTouchEnd: this.onDropdownIndicatorTouchEnd,
  2108. 'aria-hidden': 'true'
  2109. };
  2110. return React__default.createElement(DropdownIndicator, _extends$4({}, commonProps, {
  2111. innerProps: innerProps,
  2112. isDisabled: isDisabled,
  2113. isFocused: isFocused
  2114. }));
  2115. };
  2116. _proto.renderMenu = function renderMenu() {
  2117. var _this5 = this;
  2118. var _this$components3 = this.components,
  2119. Group = _this$components3.Group,
  2120. GroupHeading = _this$components3.GroupHeading,
  2121. Menu = _this$components3.Menu,
  2122. MenuList = _this$components3.MenuList,
  2123. MenuPortal = _this$components3.MenuPortal,
  2124. LoadingMessage = _this$components3.LoadingMessage,
  2125. NoOptionsMessage = _this$components3.NoOptionsMessage,
  2126. Option = _this$components3.Option;
  2127. var commonProps = this.commonProps;
  2128. var _this$state9 = this.state,
  2129. focusedOption = _this$state9.focusedOption,
  2130. menuOptions = _this$state9.menuOptions;
  2131. var _this$props18 = this.props,
  2132. captureMenuScroll = _this$props18.captureMenuScroll,
  2133. inputValue = _this$props18.inputValue,
  2134. isLoading = _this$props18.isLoading,
  2135. loadingMessage = _this$props18.loadingMessage,
  2136. minMenuHeight = _this$props18.minMenuHeight,
  2137. maxMenuHeight = _this$props18.maxMenuHeight,
  2138. menuIsOpen = _this$props18.menuIsOpen,
  2139. menuPlacement = _this$props18.menuPlacement,
  2140. menuPosition = _this$props18.menuPosition,
  2141. menuPortalTarget = _this$props18.menuPortalTarget,
  2142. menuShouldBlockScroll = _this$props18.menuShouldBlockScroll,
  2143. menuShouldScrollIntoView = _this$props18.menuShouldScrollIntoView,
  2144. noOptionsMessage = _this$props18.noOptionsMessage,
  2145. onMenuScrollToTop = _this$props18.onMenuScrollToTop,
  2146. onMenuScrollToBottom = _this$props18.onMenuScrollToBottom;
  2147. if (!menuIsOpen) return null; // TODO: Internal Option Type here
  2148. var render = function render(props) {
  2149. // for performance, the menu options in state aren't changed when the
  2150. // focused option changes so we calculate additional props based on that
  2151. var isFocused = focusedOption === props.data;
  2152. props.innerRef = isFocused ? _this5.getFocusedOptionRef : undefined;
  2153. return React__default.createElement(Option, _extends$4({}, commonProps, props, {
  2154. isFocused: isFocused
  2155. }), _this5.formatOptionLabel(props.data, 'menu'));
  2156. };
  2157. var menuUI;
  2158. if (this.hasOptions()) {
  2159. menuUI = menuOptions.render.map(function (item) {
  2160. if (item.type === 'group') {
  2161. var type = item.type,
  2162. group = _objectWithoutPropertiesLoose$2(item, ["type"]);
  2163. var headingId = item.key + "-heading";
  2164. return React__default.createElement(Group, _extends$4({}, commonProps, group, {
  2165. Heading: GroupHeading,
  2166. headingProps: {
  2167. id: headingId
  2168. },
  2169. label: _this5.formatGroupLabel(item.data)
  2170. }), item.options.map(function (option) {
  2171. return render(option);
  2172. }));
  2173. } else if (item.type === 'option') {
  2174. return render(item);
  2175. }
  2176. });
  2177. } else if (isLoading) {
  2178. var message = loadingMessage({
  2179. inputValue: inputValue
  2180. });
  2181. if (message === null) return null;
  2182. menuUI = React__default.createElement(LoadingMessage, commonProps, message);
  2183. } else {
  2184. var _message = noOptionsMessage({
  2185. inputValue: inputValue
  2186. });
  2187. if (_message === null) return null;
  2188. menuUI = React__default.createElement(NoOptionsMessage, commonProps, _message);
  2189. }
  2190. var menuPlacementProps = {
  2191. minMenuHeight: minMenuHeight,
  2192. maxMenuHeight: maxMenuHeight,
  2193. menuPlacement: menuPlacement,
  2194. menuPosition: menuPosition,
  2195. menuShouldScrollIntoView: menuShouldScrollIntoView
  2196. };
  2197. var menuElement = React__default.createElement(index.MenuPlacer, _extends$4({}, commonProps, menuPlacementProps), function (_ref8) {
  2198. var ref = _ref8.ref,
  2199. _ref8$placerProps = _ref8.placerProps,
  2200. placement = _ref8$placerProps.placement,
  2201. maxHeight = _ref8$placerProps.maxHeight;
  2202. return React__default.createElement(Menu, _extends$4({}, commonProps, menuPlacementProps, {
  2203. innerRef: ref,
  2204. innerProps: {
  2205. onMouseDown: _this5.onMenuMouseDown,
  2206. onMouseMove: _this5.onMenuMouseMove
  2207. },
  2208. isLoading: isLoading,
  2209. placement: placement
  2210. }), React__default.createElement(ScrollCaptorSwitch, {
  2211. isEnabled: captureMenuScroll,
  2212. onTopArrive: onMenuScrollToTop,
  2213. onBottomArrive: onMenuScrollToBottom
  2214. }, React__default.createElement(ScrollBlock, {
  2215. isEnabled: menuShouldBlockScroll
  2216. }, React__default.createElement(MenuList, _extends$4({}, commonProps, {
  2217. innerRef: _this5.getMenuListRef,
  2218. isLoading: isLoading,
  2219. maxHeight: maxHeight
  2220. }), menuUI))));
  2221. }); // positioning behaviour is almost identical for portalled and fixed,
  2222. // so we use the same component. the actual portalling logic is forked
  2223. // within the component based on `menuPosition`
  2224. return menuPortalTarget || menuPosition === 'fixed' ? React__default.createElement(MenuPortal, _extends$4({}, commonProps, {
  2225. appendTo: menuPortalTarget,
  2226. controlElement: this.controlRef,
  2227. menuPlacement: menuPlacement,
  2228. menuPosition: menuPosition
  2229. }), menuElement) : menuElement;
  2230. };
  2231. _proto.renderFormField = function renderFormField() {
  2232. var _this6 = this;
  2233. var _this$props19 = this.props,
  2234. delimiter = _this$props19.delimiter,
  2235. isDisabled = _this$props19.isDisabled,
  2236. isMulti = _this$props19.isMulti,
  2237. name = _this$props19.name;
  2238. var selectValue = this.state.selectValue;
  2239. if (!name || isDisabled) return;
  2240. if (isMulti) {
  2241. if (delimiter) {
  2242. var value = selectValue.map(function (opt) {
  2243. return _this6.getOptionValue(opt);
  2244. }).join(delimiter);
  2245. return React__default.createElement("input", {
  2246. name: name,
  2247. type: "hidden",
  2248. value: value
  2249. });
  2250. } else {
  2251. var input = selectValue.length > 0 ? selectValue.map(function (opt, i) {
  2252. return React__default.createElement("input", {
  2253. key: "i-" + i,
  2254. name: name,
  2255. type: "hidden",
  2256. value: _this6.getOptionValue(opt)
  2257. });
  2258. }) : React__default.createElement("input", {
  2259. name: name,
  2260. type: "hidden"
  2261. });
  2262. return React__default.createElement("div", null, input);
  2263. }
  2264. } else {
  2265. var _value2 = selectValue[0] ? this.getOptionValue(selectValue[0]) : '';
  2266. return React__default.createElement("input", {
  2267. name: name,
  2268. type: "hidden",
  2269. value: _value2
  2270. });
  2271. }
  2272. };
  2273. _proto.renderLiveRegion = function renderLiveRegion() {
  2274. if (!this.state.isFocused) return null;
  2275. return React__default.createElement(A11yText, {
  2276. "aria-live": "polite"
  2277. }, React__default.createElement("p", {
  2278. id: "aria-selection-event"
  2279. }, "\xA0", this.state.ariaLiveSelection), React__default.createElement("p", {
  2280. id: "aria-context"
  2281. }, "\xA0", this.constructAriaLiveMessage()));
  2282. };
  2283. _proto.render = function render() {
  2284. var _this$components4 = this.components,
  2285. Control = _this$components4.Control,
  2286. IndicatorsContainer = _this$components4.IndicatorsContainer,
  2287. SelectContainer = _this$components4.SelectContainer,
  2288. ValueContainer = _this$components4.ValueContainer;
  2289. var _this$props20 = this.props,
  2290. className = _this$props20.className,
  2291. id = _this$props20.id,
  2292. isDisabled = _this$props20.isDisabled,
  2293. menuIsOpen = _this$props20.menuIsOpen;
  2294. var isFocused = this.state.isFocused;
  2295. var commonProps = this.commonProps = this.getCommonProps();
  2296. return React__default.createElement(SelectContainer, _extends$4({}, commonProps, {
  2297. className: className,
  2298. innerProps: {
  2299. id: id,
  2300. onKeyDown: this.onKeyDown
  2301. },
  2302. isDisabled: isDisabled,
  2303. isFocused: isFocused
  2304. }), this.renderLiveRegion(), React__default.createElement(Control, _extends$4({}, commonProps, {
  2305. innerRef: this.getControlRef,
  2306. innerProps: {
  2307. onMouseDown: this.onControlMouseDown,
  2308. onTouchEnd: this.onControlTouchEnd
  2309. },
  2310. isDisabled: isDisabled,
  2311. isFocused: isFocused,
  2312. menuIsOpen: menuIsOpen
  2313. }), React__default.createElement(ValueContainer, _extends$4({}, commonProps, {
  2314. isDisabled: isDisabled
  2315. }), this.renderPlaceholderOrValue(), this.renderInput()), React__default.createElement(IndicatorsContainer, _extends$4({}, commonProps, {
  2316. isDisabled: isDisabled
  2317. }), this.renderClearIndicator(), this.renderLoadingIndicator(), this.renderIndicatorSeparator(), this.renderDropdownIndicator())), this.renderMenu(), this.renderFormField());
  2318. };
  2319. return Select;
  2320. }(React.Component);
  2321. Select.defaultProps = defaultProps;
  2322. exports.Select = Select;
  2323. exports.createFilter = createFilter;
  2324. exports.defaultProps = defaultProps;
  2325. exports.defaultTheme = defaultTheme;
  2326. exports.mergeStyles = mergeStyles;