@popsure/dirty-swan 0.28.0-beta.4 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (357) hide show
  1. package/Readme.md +2 -0
  2. package/dist/{App.d.ts → cjs/App.d.ts} +0 -1
  3. package/dist/{index.d.ts → cjs/index.d.ts} +0 -0
  4. package/dist/{index.js → cjs/index.js} +2811 -1441
  5. package/dist/cjs/index.js.map +1 -0
  6. package/dist/{lib → cjs/lib}/components/autocompleteAddress/demo.d.ts +0 -1
  7. package/dist/cjs/lib/components/autocompleteAddress/index.d.ts +19 -0
  8. package/dist/{lib/components/input/currency → cjs/lib/components/autocompleteAddress}/index.test.d.ts +0 -0
  9. package/dist/{lib/components/autocompleteAddress/util → cjs/lib/components/autocompleteAddress}/mapStyle.d.ts +0 -0
  10. package/dist/{lib → cjs/lib}/components/autocompleteAddress/util/index.d.ts +1 -1
  11. package/dist/{lib → cjs/lib}/components/button/icons/index.d.ts +0 -0
  12. package/dist/cjs/lib/components/button/index.d.ts +13 -0
  13. package/dist/{lib → cjs/lib}/components/cards/cardButton/index.d.ts +0 -0
  14. package/dist/{lib → cjs/lib}/components/cards/cardWithLeftIcon/index.d.ts +0 -0
  15. package/dist/{lib → cjs/lib}/components/cards/cardWithTopIcon/index.d.ts +0 -0
  16. package/dist/{lib → cjs/lib}/components/cards/cardWithTopLeftIcon/index.d.ts +0 -0
  17. package/dist/{lib → cjs/lib}/components/cards/icons/index.d.ts +0 -0
  18. package/dist/{lib → cjs/lib}/components/cards/index.d.ts +0 -0
  19. package/dist/{lib → cjs/lib}/components/cards/infoCard/index.d.ts +0 -0
  20. package/dist/{lib → cjs/lib}/components/chip/index.d.ts +0 -1
  21. package/dist/cjs/lib/components/comparisonTable/components/AccordionItem/AccordionItem.d.ts +9 -0
  22. package/dist/cjs/lib/components/comparisonTable/components/AccordionItem/index.d.ts +1 -0
  23. package/dist/{lib → cjs/lib}/components/comparisonTable/components/Chevron.d.ts +0 -1
  24. package/dist/{lib → cjs/lib}/components/comparisonTable/components/Row/index.d.ts +1 -2
  25. package/dist/{lib → cjs/lib}/components/comparisonTable/components/TableArrows/Arrow.d.ts +0 -1
  26. package/dist/{lib → cjs/lib}/components/comparisonTable/components/TableArrows/index.d.ts +4 -3
  27. package/dist/{lib → cjs/lib}/components/comparisonTable/components/TableInfoButton/index.d.ts +0 -1
  28. package/dist/{lib → cjs/lib}/components/comparisonTable/components/TableRating/StarIcon.d.ts +0 -1
  29. package/dist/{lib → cjs/lib}/components/comparisonTable/components/TableRating/ZapIcon.d.ts +0 -1
  30. package/dist/{lib → cjs/lib}/components/comparisonTable/components/TableRating/index.d.ts +0 -1
  31. package/dist/{lib → cjs/lib}/components/comparisonTable/components/TableRowHeader/index.d.ts +0 -1
  32. package/dist/{lib → cjs/lib}/components/comparisonTable/components/TableTrueFalse.d.ts +0 -1
  33. package/dist/cjs/lib/components/comparisonTable/hooks/useComparisonTable.d.ts +14 -0
  34. package/dist/{lib → cjs/lib}/components/comparisonTable/index.d.ts +10 -4
  35. package/dist/{lib → cjs/lib}/components/dateSelector/index.d.ts +0 -1
  36. package/dist/{lib → cjs/lib}/components/downloadButton/index.d.ts +0 -0
  37. package/dist/{lib → cjs/lib}/components/input/autoSuggestInput/index.d.ts +0 -1
  38. package/dist/{lib → cjs/lib}/components/input/autoSuggestMultiSelect/index.d.ts +0 -1
  39. package/dist/{lib → cjs/lib}/components/input/currency/format/index.d.ts +0 -0
  40. package/dist/{lib → cjs/lib}/components/input/currency/index.d.ts +0 -1
  41. package/dist/cjs/lib/components/input/currency/index.test.d.ts +1 -0
  42. package/dist/{lib → cjs/lib}/components/input/iban/formatIban/index.d.ts +0 -0
  43. package/dist/{lib → cjs/lib}/components/input/iban/index.d.ts +0 -1
  44. package/dist/cjs/lib/components/input/index.d.ts +16 -0
  45. package/dist/{lib → cjs/lib}/components/markdown/index.d.ts +0 -0
  46. package/dist/{lib/components/modal/regularModal → cjs/lib/components/modal/bottomModal}/index.d.ts +0 -1
  47. package/dist/{lib → cjs/lib}/components/modal/bottomOrRegularModal/index.d.ts +0 -1
  48. package/dist/{lib → cjs/lib}/components/modal/hooks/useOnClose.d.ts +0 -0
  49. package/dist/{lib → cjs/lib}/components/modal/index.d.ts +0 -0
  50. package/dist/{lib/components/modal/bottomModal → cjs/lib/components/modal/regularModal}/index.d.ts +0 -1
  51. package/dist/cjs/lib/components/multiDropzone/UploadFileCell/index.d.ts +10 -0
  52. package/dist/cjs/lib/components/multiDropzone/icons/index.d.ts +11 -0
  53. package/dist/cjs/lib/components/multiDropzone/index.d.ts +15 -0
  54. package/dist/cjs/lib/components/multiDropzone/index.test.d.ts +1 -0
  55. package/dist/cjs/lib/components/multiDropzone/types.d.ts +31 -0
  56. package/dist/cjs/lib/components/multiDropzone/utils/index.d.ts +11 -0
  57. package/dist/{lib → cjs/lib}/components/segmentedControl/index.d.ts +0 -1
  58. package/dist/cjs/lib/components/segmentedControl/index.test.d.ts +1 -0
  59. package/dist/{lib → cjs/lib}/components/signaturePad/index.d.ts +0 -0
  60. package/dist/{lib → cjs/lib}/index.d.ts +0 -0
  61. package/dist/{lib → cjs/lib}/models/autoSuggestInput/index.d.ts +0 -0
  62. package/dist/{lib → cjs/lib}/models/download.d.ts +0 -0
  63. package/dist/{lib → cjs/lib}/scss/private/base/demo.d.ts +0 -1
  64. package/dist/{lib → cjs/lib}/scss/public/demo.d.ts +0 -1
  65. package/dist/{lib → cjs/lib}/util/calendarDate/index.d.ts +0 -0
  66. package/dist/cjs/lib/util/formatBytes/index.d.ts +1 -0
  67. package/dist/cjs/lib/util/testUtils/customRender.d.ts +7 -0
  68. package/dist/cjs/lib/util/testUtils/index.d.ts +2 -0
  69. package/dist/{lib → cjs/lib}/util/zeroFill.d.ts +0 -0
  70. package/dist/{mapStyle-32849fbf.js → cjs/mapStyle-a64f125f.js} +1 -1
  71. package/dist/cjs/mapStyle-a64f125f.js.map +1 -0
  72. package/dist/esm/App.d.ts +3 -0
  73. package/dist/esm/_commonjsHelpers-0f86abda.js +23 -0
  74. package/dist/esm/_commonjsHelpers-0f86abda.js.map +1 -0
  75. package/dist/esm/components/autocompleteAddress/demo.js +65 -0
  76. package/dist/esm/components/autocompleteAddress/demo.js.map +1 -0
  77. package/dist/esm/components/autocompleteAddress/index.js +2063 -0
  78. package/dist/esm/components/autocompleteAddress/index.js.map +1 -0
  79. package/dist/esm/components/autocompleteAddress/index.test.js +116 -0
  80. package/dist/esm/components/autocompleteAddress/index.test.js.map +1 -0
  81. package/dist/esm/components/button/index.js +25 -0
  82. package/dist/esm/components/button/index.js.map +1 -0
  83. package/dist/esm/components/cards/cardButton/index.js +6 -0
  84. package/dist/esm/components/cards/cardButton/index.js.map +1 -0
  85. package/dist/esm/components/cards/cardWithLeftIcon/index.js +7 -0
  86. package/dist/esm/components/cards/cardWithLeftIcon/index.js.map +1 -0
  87. package/dist/esm/components/cards/cardWithTopIcon/index.js +7 -0
  88. package/dist/esm/components/cards/cardWithTopIcon/index.js.map +1 -0
  89. package/dist/esm/components/cards/cardWithTopLeftIcon/index.js +7 -0
  90. package/dist/esm/components/cards/cardWithTopLeftIcon/index.js.map +1 -0
  91. package/dist/esm/components/cards/index.js +125 -0
  92. package/dist/esm/components/cards/index.js.map +1 -0
  93. package/dist/esm/components/cards/infoCard/index.js +7 -0
  94. package/dist/esm/components/cards/infoCard/index.js.map +1 -0
  95. package/dist/esm/components/chip/index.js +22 -0
  96. package/dist/esm/components/chip/index.js.map +1 -0
  97. package/dist/esm/components/comparisonTable/components/AccordionItem/AccordionItem.js +32 -0
  98. package/dist/esm/components/comparisonTable/components/AccordionItem/AccordionItem.js.map +1 -0
  99. package/dist/esm/components/comparisonTable/components/AccordionItem/index.js +8 -0
  100. package/dist/esm/components/comparisonTable/components/AccordionItem/index.js.map +1 -0
  101. package/dist/esm/components/comparisonTable/components/Chevron.js +10 -0
  102. package/dist/esm/components/comparisonTable/components/Chevron.js.map +1 -0
  103. package/dist/esm/components/comparisonTable/components/Row/index.js +36 -0
  104. package/dist/esm/components/comparisonTable/components/Row/index.js.map +1 -0
  105. package/dist/esm/components/comparisonTable/components/TableArrows/Arrow.js +10 -0
  106. package/dist/esm/components/comparisonTable/components/TableArrows/Arrow.js.map +1 -0
  107. package/dist/esm/components/comparisonTable/components/TableArrows/index.js +24 -0
  108. package/dist/esm/components/comparisonTable/components/TableArrows/index.js.map +1 -0
  109. package/dist/esm/components/comparisonTable/components/TableInfoButton/index.js +17 -0
  110. package/dist/esm/components/comparisonTable/components/TableInfoButton/index.js.map +1 -0
  111. package/dist/esm/components/comparisonTable/components/TableRating/StarIcon.js +10 -0
  112. package/dist/esm/components/comparisonTable/components/TableRating/StarIcon.js.map +1 -0
  113. package/dist/esm/components/comparisonTable/components/TableRating/ZapIcon.js +10 -0
  114. package/dist/esm/components/comparisonTable/components/TableRating/ZapIcon.js.map +1 -0
  115. package/dist/esm/components/comparisonTable/components/TableRating/index.js +27 -0
  116. package/dist/esm/components/comparisonTable/components/TableRating/index.js.map +1 -0
  117. package/dist/esm/components/comparisonTable/components/TableRowHeader/index.js +22 -0
  118. package/dist/esm/components/comparisonTable/components/TableRowHeader/index.js.map +1 -0
  119. package/dist/esm/components/comparisonTable/components/TableTrueFalse.js +13 -0
  120. package/dist/esm/components/comparisonTable/components/TableTrueFalse.js.map +1 -0
  121. package/dist/esm/components/comparisonTable/index.js +1585 -0
  122. package/dist/esm/components/comparisonTable/index.js.map +1 -0
  123. package/dist/esm/components/dateSelector/index.js +2161 -0
  124. package/dist/esm/components/dateSelector/index.js.map +1 -0
  125. package/dist/esm/components/downloadButton/index.js +36 -0
  126. package/dist/esm/components/downloadButton/index.js.map +1 -0
  127. package/dist/esm/components/input/autoSuggestInput/index.js +2161 -0
  128. package/dist/esm/components/input/autoSuggestInput/index.js.map +1 -0
  129. package/dist/esm/components/input/autoSuggestMultiSelect/index.js +42 -0
  130. package/dist/esm/components/input/autoSuggestMultiSelect/index.js.map +1 -0
  131. package/dist/esm/components/input/currency/index.js +52 -0
  132. package/dist/esm/components/input/currency/index.js.map +1 -0
  133. package/dist/esm/components/input/currency/index.test.js +120 -0
  134. package/dist/esm/components/input/currency/index.test.js.map +1 -0
  135. package/dist/esm/components/input/iban/index.js +34 -0
  136. package/dist/esm/components/input/iban/index.js.map +1 -0
  137. package/dist/esm/components/input/index.js +30 -0
  138. package/dist/esm/components/input/index.js.map +1 -0
  139. package/dist/esm/components/markdown/index.js +22164 -0
  140. package/dist/esm/components/markdown/index.js.map +1 -0
  141. package/dist/esm/components/modal/bottomModal/index.js +31 -0
  142. package/dist/esm/components/modal/bottomModal/index.js.map +1 -0
  143. package/dist/esm/components/modal/bottomOrRegularModal/index.js +35 -0
  144. package/dist/esm/components/modal/bottomOrRegularModal/index.js.map +1 -0
  145. package/dist/esm/components/modal/regularModal/index.js +24 -0
  146. package/dist/esm/components/modal/regularModal/index.js.map +1 -0
  147. package/dist/esm/components/multiDropzone/UploadFileCell/index.js +6 -0
  148. package/dist/esm/components/multiDropzone/UploadFileCell/index.js.map +1 -0
  149. package/dist/esm/components/multiDropzone/index.js +2851 -0
  150. package/dist/esm/components/multiDropzone/index.js.map +1 -0
  151. package/dist/esm/components/multiDropzone/index.test.js +7602 -0
  152. package/dist/esm/components/multiDropzone/index.test.js.map +1 -0
  153. package/dist/esm/components/segmentedControl/index.js +42 -0
  154. package/dist/esm/components/segmentedControl/index.js.map +1 -0
  155. package/dist/esm/components/segmentedControl/index.test.js +63 -0
  156. package/dist/esm/components/segmentedControl/index.test.js.map +1 -0
  157. package/dist/esm/components/signaturePad/index.js +560 -0
  158. package/dist/esm/components/signaturePad/index.js.map +1 -0
  159. package/dist/esm/customRender-39982d87.js +24102 -0
  160. package/dist/esm/customRender-39982d87.js.map +1 -0
  161. package/dist/esm/index-171a0108.js +997 -0
  162. package/dist/esm/index-171a0108.js.map +1 -0
  163. package/dist/esm/index-21239ab0.js +237 -0
  164. package/dist/esm/index-21239ab0.js.map +1 -0
  165. package/dist/esm/index-47663d39.js +48 -0
  166. package/dist/esm/index-47663d39.js.map +1 -0
  167. package/dist/esm/index-51913e93.js +382 -0
  168. package/dist/esm/index-51913e93.js.map +1 -0
  169. package/dist/esm/index-be398f1d.js +69 -0
  170. package/dist/esm/index-be398f1d.js.map +1 -0
  171. package/dist/esm/index-dd80248b.js +91 -0
  172. package/dist/esm/index-dd80248b.js.map +1 -0
  173. package/dist/esm/index-e9e37a34.js +62 -0
  174. package/dist/esm/index-e9e37a34.js.map +1 -0
  175. package/dist/esm/index.d.ts +2 -0
  176. package/dist/esm/index.js +49 -0
  177. package/dist/esm/index.js.map +1 -0
  178. package/dist/esm/lib/components/autocompleteAddress/demo.d.ts +4 -0
  179. package/dist/esm/lib/components/autocompleteAddress/index.d.ts +19 -0
  180. package/dist/esm/lib/components/autocompleteAddress/index.test.d.ts +1 -0
  181. package/dist/esm/lib/components/autocompleteAddress/mapStyle.d.ts +2 -0
  182. package/dist/esm/lib/components/autocompleteAddress/util/index.d.ts +4 -0
  183. package/dist/esm/lib/components/button/icons/index.d.ts +9 -0
  184. package/dist/esm/lib/components/button/index.d.ts +13 -0
  185. package/dist/esm/lib/components/cards/cardButton/index.d.ts +16 -0
  186. package/dist/esm/lib/components/cards/cardWithLeftIcon/index.d.ts +14 -0
  187. package/dist/esm/lib/components/cards/cardWithTopIcon/index.d.ts +15 -0
  188. package/dist/esm/lib/components/cards/cardWithTopLeftIcon/index.d.ts +14 -0
  189. package/dist/esm/lib/components/cards/icons/index.d.ts +13 -0
  190. package/dist/esm/lib/components/cards/index.d.ts +16 -0
  191. package/dist/esm/lib/components/cards/infoCard/index.d.ts +13 -0
  192. package/dist/esm/lib/components/chip/index.d.ts +6 -0
  193. package/dist/esm/lib/components/comparisonTable/components/AccordionItem/AccordionItem.d.ts +9 -0
  194. package/dist/esm/lib/components/comparisonTable/components/AccordionItem/index.d.ts +1 -0
  195. package/dist/esm/lib/components/comparisonTable/components/Chevron.d.ts +4 -0
  196. package/dist/esm/lib/components/comparisonTable/components/Row/index.d.ts +11 -0
  197. package/dist/esm/lib/components/comparisonTable/components/TableArrows/Arrow.d.ts +4 -0
  198. package/dist/esm/lib/components/comparisonTable/components/TableArrows/index.d.ts +10 -0
  199. package/dist/esm/lib/components/comparisonTable/components/TableInfoButton/index.d.ts +5 -0
  200. package/dist/esm/lib/components/comparisonTable/components/TableRating/StarIcon.d.ts +4 -0
  201. package/dist/esm/lib/components/comparisonTable/components/TableRating/ZapIcon.d.ts +4 -0
  202. package/dist/esm/lib/components/comparisonTable/components/TableRating/index.d.ts +7 -0
  203. package/dist/esm/lib/components/comparisonTable/components/TableRowHeader/index.d.ts +7 -0
  204. package/dist/esm/lib/components/comparisonTable/components/TableTrueFalse.d.ts +5 -0
  205. package/dist/esm/lib/components/comparisonTable/hooks/useComparisonTable.d.ts +14 -0
  206. package/dist/esm/lib/components/comparisonTable/index.d.ts +51 -0
  207. package/dist/esm/lib/components/dateSelector/index.d.ts +23 -0
  208. package/dist/esm/lib/components/downloadButton/index.d.ts +10 -0
  209. package/dist/esm/lib/components/input/autoSuggestInput/index.d.ts +13 -0
  210. package/dist/esm/lib/components/input/autoSuggestMultiSelect/index.d.ts +11 -0
  211. package/dist/esm/lib/components/input/currency/format/index.d.ts +2 -0
  212. package/dist/esm/lib/components/input/currency/index.d.ts +7 -0
  213. package/dist/esm/lib/components/input/currency/index.test.d.ts +1 -0
  214. package/dist/esm/lib/components/input/iban/formatIban/index.d.ts +1 -0
  215. package/dist/esm/lib/components/input/iban/index.d.ts +6 -0
  216. package/dist/esm/lib/components/input/index.d.ts +16 -0
  217. package/dist/esm/lib/components/markdown/index.d.ts +9 -0
  218. package/dist/esm/lib/components/modal/bottomModal/index.d.ts +3 -0
  219. package/dist/esm/lib/components/modal/bottomOrRegularModal/index.d.ts +3 -0
  220. package/dist/esm/lib/components/modal/hooks/useOnClose.d.ts +7 -0
  221. package/dist/esm/lib/components/modal/index.d.ts +13 -0
  222. package/dist/esm/lib/components/modal/regularModal/index.d.ts +3 -0
  223. package/dist/esm/lib/components/multiDropzone/UploadFileCell/index.d.ts +10 -0
  224. package/dist/esm/lib/components/multiDropzone/icons/index.d.ts +11 -0
  225. package/dist/esm/lib/components/multiDropzone/index.d.ts +15 -0
  226. package/dist/esm/lib/components/multiDropzone/index.test.d.ts +1 -0
  227. package/dist/esm/lib/components/multiDropzone/types.d.ts +31 -0
  228. package/dist/esm/lib/components/multiDropzone/utils/index.d.ts +11 -0
  229. package/dist/esm/lib/components/segmentedControl/index.d.ts +11 -0
  230. package/dist/esm/lib/components/segmentedControl/index.test.d.ts +1 -0
  231. package/dist/esm/lib/components/signaturePad/index.d.ts +19 -0
  232. package/dist/esm/lib/index.d.ts +20 -0
  233. package/dist/esm/lib/models/autoSuggestInput/index.d.ts +4 -0
  234. package/dist/esm/lib/models/download.d.ts +1 -0
  235. package/dist/esm/lib/scss/private/base/demo.d.ts +5 -0
  236. package/dist/esm/lib/scss/public/demo.d.ts +1 -0
  237. package/dist/esm/lib/util/calendarDate/index.d.ts +3 -0
  238. package/dist/esm/lib/util/formatBytes/index.d.ts +1 -0
  239. package/dist/esm/lib/util/testUtils/customRender.d.ts +7 -0
  240. package/dist/esm/lib/util/testUtils/index.d.ts +2 -0
  241. package/dist/esm/lib/util/zeroFill.d.ts +1 -0
  242. package/dist/esm/mapStyle-1288a869.js +187 -0
  243. package/dist/esm/mapStyle-1288a869.js.map +1 -0
  244. package/dist/esm/scss/private/base/demo.js +80 -0
  245. package/dist/esm/scss/private/base/demo.js.map +1 -0
  246. package/dist/esm/scss/public/demo.js +284 -0
  247. package/dist/esm/scss/public/demo.js.map +1 -0
  248. package/dist/esm/style-inject.es-1f59c1d0.js +29 -0
  249. package/dist/esm/style-inject.es-1f59c1d0.js.map +1 -0
  250. package/dist/esm/tslib.es6-5bc94358.js +104 -0
  251. package/dist/esm/tslib.es6-5bc94358.js.map +1 -0
  252. package/dist/esm/useOnClose-54f9e6b9.js +40 -0
  253. package/dist/esm/useOnClose-54f9e6b9.js.map +1 -0
  254. package/dist/esm/util/testUtils/customRender.js +7 -0
  255. package/dist/esm/util/testUtils/customRender.js.map +1 -0
  256. package/dist/esm/v4-d2999257.js +69 -0
  257. package/dist/esm/v4-d2999257.js.map +1 -0
  258. package/dist/index.css +75 -3
  259. package/dist/index.css.map +1 -1
  260. package/dist/lib/scss/index.scss +2 -0
  261. package/dist/lib/scss/private/components/_input.scss +1 -3
  262. package/dist/lib/scss/public/demo.tsx +1 -1
  263. package/{src/lib/components/autocompleteAddress/modes/dynamic.module.scss → dist/lib/scss/third-party/_google_places.scss} +37 -37
  264. package/dist/lib/scss/third-party/_index.scss +1 -0
  265. package/dist/lib/scss/utils/_index.scss +12 -0
  266. package/package.json +14 -8
  267. package/src/lib/components/autocompleteAddress/demo.tsx +5 -9
  268. package/src/lib/components/autocompleteAddress/index.stories.mdx +1 -1
  269. package/src/lib/components/autocompleteAddress/index.test.tsx +95 -0
  270. package/src/lib/components/autocompleteAddress/index.tsx +315 -113
  271. package/src/lib/components/autocompleteAddress/{util/mapStyle.ts → mapStyle.ts} +0 -0
  272. package/src/lib/components/autocompleteAddress/util/index.ts +1 -1
  273. package/src/lib/components/comparisonTable/components/AccordionItem/AccordionItem.module.scss +44 -0
  274. package/src/lib/components/comparisonTable/components/AccordionItem/AccordionItem.tsx +74 -0
  275. package/src/lib/components/comparisonTable/components/AccordionItem/index.tsx +1 -0
  276. package/src/lib/components/comparisonTable/components/Row/index.tsx +1 -3
  277. package/src/lib/components/comparisonTable/components/Row/style.module.scss +11 -2
  278. package/src/lib/components/comparisonTable/components/TableArrows/index.tsx +2 -4
  279. package/src/lib/components/comparisonTable/components/TableArrows/style.module.scss +3 -1
  280. package/src/lib/components/comparisonTable/hooks/useComparisonTable.ts +124 -0
  281. package/src/lib/components/comparisonTable/index.stories.mdx +226 -8
  282. package/src/lib/components/comparisonTable/index.tsx +175 -122
  283. package/src/lib/components/comparisonTable/style.module.scss +16 -6
  284. package/src/lib/components/input/autoSuggestInput/style.module.scss +4 -1
  285. package/src/lib/components/input/currency/index.stories.mdx +8 -0
  286. package/src/lib/components/input/currency/index.test.tsx +22 -22
  287. package/src/lib/components/input/index.stories.mdx +42 -0
  288. package/src/lib/components/input/index.tsx +77 -41
  289. package/src/lib/components/input/style.module.scss +10 -0
  290. package/src/lib/components/modal/regularModal/index.tsx +14 -12
  291. package/src/lib/components/modal/regularModal/style.module.scss +16 -15
  292. package/src/lib/components/multiDropzone/UploadFileCell/index.tsx +44 -64
  293. package/src/lib/components/multiDropzone/UploadFileCell/style.module.scss +3 -9
  294. package/src/lib/components/multiDropzone/icons/eye.svg +10 -3
  295. package/src/lib/components/multiDropzone/icons/file-error.svg +4 -0
  296. package/src/lib/components/multiDropzone/icons/file-upload.svg +4 -0
  297. package/src/lib/components/multiDropzone/icons/file.svg +4 -0
  298. package/src/lib/components/multiDropzone/icons/index.ts +12 -44
  299. package/src/lib/components/multiDropzone/icons/trash-error.svg +6 -0
  300. package/src/lib/components/multiDropzone/icons/trash.svg +5 -5
  301. package/src/lib/components/multiDropzone/icons/upload-small.svg +12 -0
  302. package/src/lib/components/multiDropzone/index.stories.mdx +75 -0
  303. package/src/lib/components/multiDropzone/index.test.tsx +230 -0
  304. package/src/lib/components/multiDropzone/index.tsx +104 -66
  305. package/src/lib/components/multiDropzone/types.ts +36 -0
  306. package/src/lib/components/multiDropzone/utils/index.test.ts +112 -0
  307. package/src/lib/components/multiDropzone/utils/index.ts +69 -0
  308. package/src/lib/components/segmentedControl/index.test.tsx +45 -0
  309. package/src/lib/components/segmentedControl/index.tsx +1 -0
  310. package/src/lib/scss/index.scss +2 -0
  311. package/src/lib/scss/private/components/_input.scss +1 -3
  312. package/src/lib/scss/public/demo.tsx +1 -1
  313. package/src/lib/scss/third-party/_google_places.scss +62 -0
  314. package/src/lib/scss/third-party/_index.scss +1 -0
  315. package/src/lib/scss/utils/_index.scss +12 -0
  316. package/src/lib/util/formatBytes/index.test.ts +19 -0
  317. package/src/lib/util/formatBytes/index.ts +13 -0
  318. package/src/lib/util/testUtils/customRender.tsx +15 -0
  319. package/src/lib/util/testUtils/index.ts +5 -0
  320. package/src/setupTests.js +50 -2
  321. package/dist/index.js.map +0 -1
  322. package/dist/lib/components/autocompleteAddress/components/GoogleMapsWrapper.d.ts +0 -8
  323. package/dist/lib/components/autocompleteAddress/index.d.ts +0 -23
  324. package/dist/lib/components/autocompleteAddress/modes/dynamic.d.ts +0 -12
  325. package/dist/lib/components/autocompleteAddress/modes/manual.d.ts +0 -9
  326. package/dist/lib/components/autocompleteAddress/util/googleMapsLoader.d.ts +0 -17
  327. package/dist/lib/components/button/index.d.ts +0 -13
  328. package/dist/lib/components/comparisonTable/hooks/useActiveTableArrows.d.ts +0 -10
  329. package/dist/lib/components/input/index.d.ts +0 -10
  330. package/dist/lib/components/multiDropzone/UploadFileCell/index.d.ts +0 -9
  331. package/dist/lib/components/multiDropzone/icons/index.d.ts +0 -25
  332. package/dist/lib/components/multiDropzone/index.d.ts +0 -21
  333. package/dist/mapStyle-32849fbf.js.map +0 -1
  334. package/src/lib/components/autocompleteAddress/components/GoogleMapsWrapper.tsx +0 -81
  335. package/src/lib/components/autocompleteAddress/modes/dynamic.tsx +0 -118
  336. package/src/lib/components/autocompleteAddress/modes/manual.tsx +0 -81
  337. package/src/lib/components/autocompleteAddress/util/googleMapsLoader.tsx +0 -73
  338. package/src/lib/components/comparisonTable/hooks/useActiveTableArrows.ts +0 -63
  339. package/src/lib/components/multiDropzone/icons/bmp-complete.svg +0 -10
  340. package/src/lib/components/multiDropzone/icons/bmp.svg +0 -10
  341. package/src/lib/components/multiDropzone/icons/doc-complete.svg +0 -11
  342. package/src/lib/components/multiDropzone/icons/doc.svg +0 -11
  343. package/src/lib/components/multiDropzone/icons/docx-complete.svg +0 -12
  344. package/src/lib/components/multiDropzone/icons/docx.svg +0 -12
  345. package/src/lib/components/multiDropzone/icons/generic-complete.svg +0 -4
  346. package/src/lib/components/multiDropzone/icons/generic-error.svg +0 -7
  347. package/src/lib/components/multiDropzone/icons/generic.svg +0 -4
  348. package/src/lib/components/multiDropzone/icons/heic-complete.svg +0 -11
  349. package/src/lib/components/multiDropzone/icons/heic.svg +0 -11
  350. package/src/lib/components/multiDropzone/icons/jpeg-complete.svg +0 -11
  351. package/src/lib/components/multiDropzone/icons/jpeg.svg +0 -11
  352. package/src/lib/components/multiDropzone/icons/jpg-complete.svg +0 -10
  353. package/src/lib/components/multiDropzone/icons/jpg.svg +0 -10
  354. package/src/lib/components/multiDropzone/icons/pdf-complete.svg +0 -8
  355. package/src/lib/components/multiDropzone/icons/pdf.svg +0 -8
  356. package/src/lib/components/multiDropzone/icons/png-complete.svg +0 -10
  357. package/src/lib/components/multiDropzone/icons/png.svg +0 -10
@@ -0,0 +1,2161 @@
1
+ import { _ as __assign } from '../../../tslib.es6-5bc94358.js';
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
+ import { c as classnames } from '../../../index-e9e37a34.js';
4
+ import React__default from 'react';
5
+ import { p as propTypes } from '../../../index-171a0108.js';
6
+ import { s as styleInject } from '../../../style-inject.es-1f59c1d0.js';
7
+ import Input from '../index.js';
8
+ import '../../../index-dd80248b.js';
9
+ import '../../../v4-d2999257.js';
10
+ import 'crypto';
11
+
12
+ var Autosuggest = {};
13
+
14
+ function shallowEqualArrays(arrA, arrB) {
15
+ if (arrA === arrB) {
16
+ return true;
17
+ }
18
+
19
+ if (!arrA || !arrB) {
20
+ return false;
21
+ }
22
+
23
+ var len = arrA.length;
24
+
25
+ if (arrB.length !== len) {
26
+ return false;
27
+ }
28
+
29
+ for (var i = 0; i < len; i++) {
30
+ if (arrA[i] !== arrB[i]) {
31
+ return false;
32
+ }
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ var arrays = shallowEqualArrays;
39
+
40
+ var Autowhatever = {};
41
+
42
+ var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
43
+
44
+ var dist$2 = function (_ref) {
45
+ var data = _ref.data;
46
+ var multiSection = _ref.multiSection;
47
+
48
+ function nextNonEmptySectionIndex(sectionIndex) {
49
+ if (sectionIndex === null) {
50
+ sectionIndex = 0;
51
+ } else {
52
+ sectionIndex++;
53
+ }
54
+
55
+ while (sectionIndex < data.length && data[sectionIndex] === 0) {
56
+ sectionIndex++;
57
+ }
58
+
59
+ return sectionIndex === data.length ? null : sectionIndex;
60
+ }
61
+
62
+ function prevNonEmptySectionIndex(sectionIndex) {
63
+ if (sectionIndex === null) {
64
+ sectionIndex = data.length - 1;
65
+ } else {
66
+ sectionIndex--;
67
+ }
68
+
69
+ while (sectionIndex >= 0 && data[sectionIndex] === 0) {
70
+ sectionIndex--;
71
+ }
72
+
73
+ return sectionIndex === -1 ? null : sectionIndex;
74
+ }
75
+
76
+ function next(position) {
77
+ var _position = _slicedToArray(position, 2);
78
+
79
+ var sectionIndex = _position[0];
80
+ var itemIndex = _position[1];
81
+
82
+
83
+ if (multiSection) {
84
+ if (itemIndex === null || itemIndex === data[sectionIndex] - 1) {
85
+ sectionIndex = nextNonEmptySectionIndex(sectionIndex);
86
+
87
+ if (sectionIndex === null) {
88
+ return [null, null];
89
+ }
90
+
91
+ return [sectionIndex, 0];
92
+ }
93
+
94
+ return [sectionIndex, itemIndex + 1];
95
+ }
96
+
97
+ if (data === 0 || itemIndex === data - 1) {
98
+ return [null, null];
99
+ }
100
+
101
+ if (itemIndex === null) {
102
+ return [null, 0];
103
+ }
104
+
105
+ return [null, itemIndex + 1];
106
+ }
107
+
108
+ function prev(position) {
109
+ var _position2 = _slicedToArray(position, 2);
110
+
111
+ var sectionIndex = _position2[0];
112
+ var itemIndex = _position2[1];
113
+
114
+
115
+ if (multiSection) {
116
+ if (itemIndex === null || itemIndex === 0) {
117
+ sectionIndex = prevNonEmptySectionIndex(sectionIndex);
118
+
119
+ if (sectionIndex === null) {
120
+ return [null, null];
121
+ }
122
+
123
+ return [sectionIndex, data[sectionIndex] - 1];
124
+ }
125
+
126
+ return [sectionIndex, itemIndex - 1];
127
+ }
128
+
129
+ if (data === 0 || itemIndex === 0) {
130
+ return [null, null];
131
+ }
132
+
133
+ if (itemIndex === null) {
134
+ return [null, data - 1];
135
+ }
136
+
137
+ return [null, itemIndex - 1];
138
+ }
139
+
140
+ function isLast(position) {
141
+ return next(position)[1] === null;
142
+ }
143
+
144
+ return {
145
+ next: next,
146
+ prev: prev,
147
+ isLast: isLast
148
+ };
149
+ };
150
+
151
+ var dist$1 = {exports: {}};
152
+
153
+ var propIsEnumerable = Object.prototype.propertyIsEnumerable;
154
+
155
+ function ToObject(val) {
156
+ if (val == null) {
157
+ throw new TypeError('Object.assign cannot be called with null or undefined');
158
+ }
159
+
160
+ return Object(val);
161
+ }
162
+
163
+ function ownEnumerableKeys(obj) {
164
+ var keys = Object.getOwnPropertyNames(obj);
165
+
166
+ if (Object.getOwnPropertySymbols) {
167
+ keys = keys.concat(Object.getOwnPropertySymbols(obj));
168
+ }
169
+
170
+ return keys.filter(function (key) {
171
+ return propIsEnumerable.call(obj, key);
172
+ });
173
+ }
174
+
175
+ var objectAssign = Object.assign || function (target, source) {
176
+ var from;
177
+ var keys;
178
+ var to = ToObject(target);
179
+
180
+ for (var s = 1; s < arguments.length; s++) {
181
+ from = arguments[s];
182
+ keys = ownEnumerableKeys(Object(from));
183
+
184
+ for (var i = 0; i < keys.length; i++) {
185
+ to[keys[i]] = from[keys[i]];
186
+ }
187
+ }
188
+
189
+ return to;
190
+ };
191
+
192
+ (function (module, exports) {
193
+
194
+ Object.defineProperty(exports, '__esModule', {
195
+ value: true
196
+ });
197
+
198
+ var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();
199
+
200
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
201
+
202
+ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }
203
+
204
+ var _objectAssign = objectAssign;
205
+
206
+ var _objectAssign2 = _interopRequireDefault(_objectAssign);
207
+
208
+ var truthy = function truthy(x) {
209
+ return x;
210
+ };
211
+
212
+ exports['default'] = function (input) {
213
+ var _ref = Array.isArray(input) && input.length === 2 ? input : [input, null];
214
+
215
+ var _ref2 = _slicedToArray(_ref, 2);
216
+
217
+ var theme = _ref2[0];
218
+ var classNameDecorator = _ref2[1];
219
+
220
+ return function (key) {
221
+ for (var _len = arguments.length, names = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
222
+ names[_key - 1] = arguments[_key];
223
+ }
224
+
225
+ var styles = names.map(function (name) {
226
+ return theme[name];
227
+ }).filter(truthy);
228
+
229
+ return typeof styles[0] === 'string' || typeof classNameDecorator === 'function' ? { key: key, className: classNameDecorator ? classNameDecorator.apply(undefined, _toConsumableArray(styles)) : styles.join(' ') } : { key: key, style: _objectAssign2['default'].apply(undefined, [{}].concat(_toConsumableArray(styles))) };
230
+ };
231
+ };
232
+
233
+ module.exports = exports['default'];
234
+ }(dist$1, dist$1.exports));
235
+
236
+ var SectionTitle = {};
237
+
238
+ var compareObjects = {};
239
+
240
+ (function (exports) {
241
+
242
+ Object.defineProperty(exports, "__esModule", {
243
+ value: true
244
+ });
245
+ exports["default"] = compareObjects;
246
+
247
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
248
+
249
+ function compareObjects(objA, objB) {
250
+ var keys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
251
+
252
+ if (objA === objB) {
253
+ return false;
254
+ }
255
+
256
+ var aKeys = Object.keys(objA);
257
+ var bKeys = Object.keys(objB);
258
+
259
+ if (aKeys.length !== bKeys.length) {
260
+ return true;
261
+ }
262
+
263
+ var keysMap = {};
264
+ var i, len;
265
+
266
+ for (i = 0, len = keys.length; i < len; i++) {
267
+ keysMap[keys[i]] = true;
268
+ }
269
+
270
+ for (i = 0, len = aKeys.length; i < len; i++) {
271
+ var key = aKeys[i];
272
+ var aValue = objA[key];
273
+ var bValue = objB[key];
274
+
275
+ if (aValue === bValue) {
276
+ continue;
277
+ }
278
+
279
+ if (!keysMap[key] || aValue === null || bValue === null || _typeof(aValue) !== 'object' || _typeof(bValue) !== 'object') {
280
+ return true;
281
+ }
282
+
283
+ var aValueKeys = Object.keys(aValue);
284
+ var bValueKeys = Object.keys(bValue);
285
+
286
+ if (aValueKeys.length !== bValueKeys.length) {
287
+ return true;
288
+ }
289
+
290
+ for (var n = 0, length = aValueKeys.length; n < length; n++) {
291
+ var aValueKey = aValueKeys[n];
292
+
293
+ if (aValue[aValueKey] !== bValue[aValueKey]) {
294
+ return true;
295
+ }
296
+ }
297
+ }
298
+
299
+ return false;
300
+ }
301
+ }(compareObjects));
302
+
303
+ (function (exports) {
304
+
305
+ Object.defineProperty(exports, "__esModule", {
306
+ value: true
307
+ });
308
+ exports["default"] = void 0;
309
+
310
+ var _react = _interopRequireWildcard(React__default);
311
+
312
+ var _propTypes = _interopRequireDefault(propTypes.exports);
313
+
314
+ var _compareObjects = _interopRequireDefault(compareObjects);
315
+
316
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
317
+
318
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
319
+
320
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
321
+
322
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
323
+
324
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
325
+
326
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
327
+
328
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
329
+
330
+ function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
331
+
332
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
333
+
334
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
335
+
336
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
337
+
338
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
339
+
340
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
341
+
342
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
343
+
344
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
345
+
346
+ var SectionTitle = /*#__PURE__*/function (_Component) {
347
+ _inherits(SectionTitle, _Component);
348
+
349
+ var _super = _createSuper(SectionTitle);
350
+
351
+ function SectionTitle() {
352
+ _classCallCheck(this, SectionTitle);
353
+
354
+ return _super.apply(this, arguments);
355
+ }
356
+
357
+ _createClass(SectionTitle, [{
358
+ key: "shouldComponentUpdate",
359
+ value: function shouldComponentUpdate(nextProps) {
360
+ return (0, _compareObjects["default"])(nextProps, this.props);
361
+ }
362
+ }, {
363
+ key: "render",
364
+ value: function render() {
365
+ var _this$props = this.props,
366
+ section = _this$props.section,
367
+ renderSectionTitle = _this$props.renderSectionTitle,
368
+ theme = _this$props.theme,
369
+ sectionKeyPrefix = _this$props.sectionKeyPrefix;
370
+ var sectionTitle = renderSectionTitle(section);
371
+
372
+ if (!sectionTitle) {
373
+ return null;
374
+ }
375
+
376
+ return /*#__PURE__*/_react["default"].createElement("div", theme("".concat(sectionKeyPrefix, "title"), 'sectionTitle'), sectionTitle);
377
+ }
378
+ }]);
379
+
380
+ return SectionTitle;
381
+ }(_react.Component);
382
+
383
+ exports["default"] = SectionTitle;
384
+
385
+ _defineProperty(SectionTitle, "propTypes", {
386
+ section: _propTypes["default"].any.isRequired,
387
+ renderSectionTitle: _propTypes["default"].func.isRequired,
388
+ theme: _propTypes["default"].func.isRequired,
389
+ sectionKeyPrefix: _propTypes["default"].string.isRequired
390
+ });
391
+ }(SectionTitle));
392
+
393
+ var ItemList = {};
394
+
395
+ var Item = {};
396
+
397
+ (function (exports) {
398
+
399
+ Object.defineProperty(exports, "__esModule", {
400
+ value: true
401
+ });
402
+ exports["default"] = void 0;
403
+
404
+ var _react = _interopRequireWildcard(React__default);
405
+
406
+ var _propTypes = _interopRequireDefault(propTypes.exports);
407
+
408
+ var _compareObjects = _interopRequireDefault(compareObjects);
409
+
410
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
411
+
412
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
413
+
414
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
415
+
416
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
417
+
418
+ 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); }
419
+
420
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
421
+
422
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
423
+
424
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
425
+
426
+ 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; }
427
+
428
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
429
+
430
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
431
+
432
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
433
+
434
+ function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
435
+
436
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
437
+
438
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
439
+
440
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
441
+
442
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
443
+
444
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
445
+
446
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
447
+
448
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
449
+
450
+ var Item = /*#__PURE__*/function (_Component) {
451
+ _inherits(Item, _Component);
452
+
453
+ var _super = _createSuper(Item);
454
+
455
+ function Item() {
456
+ var _this;
457
+
458
+ _classCallCheck(this, Item);
459
+
460
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
461
+ args[_key] = arguments[_key];
462
+ }
463
+
464
+ _this = _super.call.apply(_super, [this].concat(args));
465
+
466
+ _defineProperty(_assertThisInitialized(_this), "storeItemReference", function (item) {
467
+ if (item !== null) {
468
+ _this.item = item;
469
+ }
470
+ });
471
+
472
+ _defineProperty(_assertThisInitialized(_this), "onMouseEnter", function (event) {
473
+ var _this$props = _this.props,
474
+ sectionIndex = _this$props.sectionIndex,
475
+ itemIndex = _this$props.itemIndex;
476
+
477
+ _this.props.onMouseEnter(event, {
478
+ sectionIndex: sectionIndex,
479
+ itemIndex: itemIndex
480
+ });
481
+ });
482
+
483
+ _defineProperty(_assertThisInitialized(_this), "onMouseLeave", function (event) {
484
+ var _this$props2 = _this.props,
485
+ sectionIndex = _this$props2.sectionIndex,
486
+ itemIndex = _this$props2.itemIndex;
487
+
488
+ _this.props.onMouseLeave(event, {
489
+ sectionIndex: sectionIndex,
490
+ itemIndex: itemIndex
491
+ });
492
+ });
493
+
494
+ _defineProperty(_assertThisInitialized(_this), "onMouseDown", function (event) {
495
+ var _this$props3 = _this.props,
496
+ sectionIndex = _this$props3.sectionIndex,
497
+ itemIndex = _this$props3.itemIndex;
498
+
499
+ _this.props.onMouseDown(event, {
500
+ sectionIndex: sectionIndex,
501
+ itemIndex: itemIndex
502
+ });
503
+ });
504
+
505
+ _defineProperty(_assertThisInitialized(_this), "onClick", function (event) {
506
+ var _this$props4 = _this.props,
507
+ sectionIndex = _this$props4.sectionIndex,
508
+ itemIndex = _this$props4.itemIndex;
509
+
510
+ _this.props.onClick(event, {
511
+ sectionIndex: sectionIndex,
512
+ itemIndex: itemIndex
513
+ });
514
+ });
515
+
516
+ return _this;
517
+ }
518
+
519
+ _createClass(Item, [{
520
+ key: "shouldComponentUpdate",
521
+ value: function shouldComponentUpdate(nextProps) {
522
+ return (0, _compareObjects["default"])(nextProps, this.props, ['renderItemData']);
523
+ }
524
+ }, {
525
+ key: "render",
526
+ value: function render() {
527
+ var _this$props5 = this.props,
528
+ isHighlighted = _this$props5.isHighlighted,
529
+ item = _this$props5.item,
530
+ renderItem = _this$props5.renderItem,
531
+ renderItemData = _this$props5.renderItemData,
532
+ restProps = _objectWithoutProperties(_this$props5, ["isHighlighted", "item", "renderItem", "renderItemData"]);
533
+
534
+ delete restProps.sectionIndex;
535
+ delete restProps.itemIndex;
536
+
537
+ if (typeof restProps.onMouseEnter === 'function') {
538
+ restProps.onMouseEnter = this.onMouseEnter;
539
+ }
540
+
541
+ if (typeof restProps.onMouseLeave === 'function') {
542
+ restProps.onMouseLeave = this.onMouseLeave;
543
+ }
544
+
545
+ if (typeof restProps.onMouseDown === 'function') {
546
+ restProps.onMouseDown = this.onMouseDown;
547
+ }
548
+
549
+ if (typeof restProps.onClick === 'function') {
550
+ restProps.onClick = this.onClick;
551
+ }
552
+
553
+ return /*#__PURE__*/_react["default"].createElement("li", _extends({
554
+ role: "option"
555
+ }, restProps, {
556
+ ref: this.storeItemReference
557
+ }), renderItem(item, _objectSpread({
558
+ isHighlighted: isHighlighted
559
+ }, renderItemData)));
560
+ }
561
+ }]);
562
+
563
+ return Item;
564
+ }(_react.Component);
565
+
566
+ exports["default"] = Item;
567
+
568
+ _defineProperty(Item, "propTypes", {
569
+ sectionIndex: _propTypes["default"].number,
570
+ isHighlighted: _propTypes["default"].bool.isRequired,
571
+ itemIndex: _propTypes["default"].number.isRequired,
572
+ item: _propTypes["default"].any.isRequired,
573
+ renderItem: _propTypes["default"].func.isRequired,
574
+ renderItemData: _propTypes["default"].object.isRequired,
575
+ onMouseEnter: _propTypes["default"].func,
576
+ onMouseLeave: _propTypes["default"].func,
577
+ onMouseDown: _propTypes["default"].func,
578
+ onClick: _propTypes["default"].func
579
+ });
580
+ }(Item));
581
+
582
+ (function (exports) {
583
+
584
+ Object.defineProperty(exports, "__esModule", {
585
+ value: true
586
+ });
587
+ exports["default"] = void 0;
588
+
589
+ var _react = _interopRequireWildcard(React__default);
590
+
591
+ var _propTypes = _interopRequireDefault(propTypes.exports);
592
+
593
+ var _Item = _interopRequireDefault(Item);
594
+
595
+ var _compareObjects = _interopRequireDefault(compareObjects);
596
+
597
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
598
+
599
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
600
+
601
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
602
+
603
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
604
+
605
+ 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); }
606
+
607
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
608
+
609
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
610
+
611
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
612
+
613
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
614
+
615
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
616
+
617
+ function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
618
+
619
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
620
+
621
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
622
+
623
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
624
+
625
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
626
+
627
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
628
+
629
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
630
+
631
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
632
+
633
+ var ItemsList = /*#__PURE__*/function (_Component) {
634
+ _inherits(ItemsList, _Component);
635
+
636
+ var _super = _createSuper(ItemsList);
637
+
638
+ function ItemsList() {
639
+ var _this;
640
+
641
+ _classCallCheck(this, ItemsList);
642
+
643
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
644
+ args[_key] = arguments[_key];
645
+ }
646
+
647
+ _this = _super.call.apply(_super, [this].concat(args));
648
+
649
+ _defineProperty(_assertThisInitialized(_this), "storeHighlightedItemReference", function (highlightedItem) {
650
+ _this.props.onHighlightedItemChange(highlightedItem === null ? null : highlightedItem.item);
651
+ });
652
+
653
+ return _this;
654
+ }
655
+
656
+ _createClass(ItemsList, [{
657
+ key: "shouldComponentUpdate",
658
+ value: function shouldComponentUpdate(nextProps) {
659
+ return (0, _compareObjects["default"])(nextProps, this.props, ['itemProps']);
660
+ }
661
+ }, {
662
+ key: "render",
663
+ value: function render() {
664
+ var _this2 = this;
665
+
666
+ var _this$props = this.props,
667
+ items = _this$props.items,
668
+ itemProps = _this$props.itemProps,
669
+ renderItem = _this$props.renderItem,
670
+ renderItemData = _this$props.renderItemData,
671
+ sectionIndex = _this$props.sectionIndex,
672
+ highlightedItemIndex = _this$props.highlightedItemIndex,
673
+ getItemId = _this$props.getItemId,
674
+ theme = _this$props.theme,
675
+ keyPrefix = _this$props.keyPrefix;
676
+ var sectionPrefix = sectionIndex === null ? keyPrefix : "".concat(keyPrefix, "section-").concat(sectionIndex, "-");
677
+ var isItemPropsFunction = typeof itemProps === 'function';
678
+ return /*#__PURE__*/_react["default"].createElement("ul", _extends({
679
+ role: "listbox"
680
+ }, theme("".concat(sectionPrefix, "items-list"), 'itemsList')), items.map(function (item, itemIndex) {
681
+ var isFirst = itemIndex === 0;
682
+ var isHighlighted = itemIndex === highlightedItemIndex;
683
+ var itemKey = "".concat(sectionPrefix, "item-").concat(itemIndex);
684
+ var itemPropsObj = isItemPropsFunction ? itemProps({
685
+ sectionIndex: sectionIndex,
686
+ itemIndex: itemIndex
687
+ }) : itemProps;
688
+
689
+ var allItemProps = _objectSpread({
690
+ id: getItemId(sectionIndex, itemIndex),
691
+ 'aria-selected': isHighlighted
692
+ }, theme(itemKey, 'item', isFirst && 'itemFirst', isHighlighted && 'itemHighlighted'), {}, itemPropsObj);
693
+
694
+ if (isHighlighted) {
695
+ allItemProps.ref = _this2.storeHighlightedItemReference;
696
+ } // `key` is provided by theme()
697
+
698
+ /* eslint-disable react/jsx-key */
699
+
700
+
701
+ return /*#__PURE__*/_react["default"].createElement(_Item["default"], _extends({}, allItemProps, {
702
+ sectionIndex: sectionIndex,
703
+ isHighlighted: isHighlighted,
704
+ itemIndex: itemIndex,
705
+ item: item,
706
+ renderItem: renderItem,
707
+ renderItemData: renderItemData
708
+ }));
709
+ /* eslint-enable react/jsx-key */
710
+ }));
711
+ }
712
+ }]);
713
+
714
+ return ItemsList;
715
+ }(_react.Component);
716
+
717
+ exports["default"] = ItemsList;
718
+
719
+ _defineProperty(ItemsList, "propTypes", {
720
+ items: _propTypes["default"].array.isRequired,
721
+ itemProps: _propTypes["default"].oneOfType([_propTypes["default"].object, _propTypes["default"].func]),
722
+ renderItem: _propTypes["default"].func.isRequired,
723
+ renderItemData: _propTypes["default"].object.isRequired,
724
+ sectionIndex: _propTypes["default"].number,
725
+ highlightedItemIndex: _propTypes["default"].number,
726
+ onHighlightedItemChange: _propTypes["default"].func.isRequired,
727
+ getItemId: _propTypes["default"].func.isRequired,
728
+ theme: _propTypes["default"].func.isRequired,
729
+ keyPrefix: _propTypes["default"].string.isRequired
730
+ });
731
+
732
+ _defineProperty(ItemsList, "defaultProps", {
733
+ sectionIndex: null
734
+ });
735
+ }(ItemList));
736
+
737
+ (function (exports) {
738
+
739
+ Object.defineProperty(exports, "__esModule", {
740
+ value: true
741
+ });
742
+ exports["default"] = void 0;
743
+
744
+ var _react = _interopRequireWildcard(React__default);
745
+
746
+ var _propTypes = _interopRequireDefault(propTypes.exports);
747
+
748
+ var _sectionIterator = _interopRequireDefault(dist$2);
749
+
750
+ var _reactThemeable = _interopRequireDefault(dist$1.exports);
751
+
752
+ var _SectionTitle = _interopRequireDefault(SectionTitle);
753
+
754
+ var _ItemList = _interopRequireDefault(ItemList);
755
+
756
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
757
+
758
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
759
+
760
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
761
+
762
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
763
+
764
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
765
+
766
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
767
+
768
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
769
+
770
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
771
+
772
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
773
+
774
+ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
775
+
776
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
777
+
778
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
779
+
780
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
781
+
782
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
783
+
784
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
785
+
786
+ function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
787
+
788
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
789
+
790
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
791
+
792
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
793
+
794
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
795
+
796
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
797
+
798
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
799
+
800
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
801
+
802
+ var emptyObject = {};
803
+
804
+ var defaultRenderInputComponent = function defaultRenderInputComponent(props) {
805
+ return /*#__PURE__*/_react["default"].createElement("input", props);
806
+ };
807
+
808
+ var defaultRenderItemsContainer = function defaultRenderItemsContainer(_ref) {
809
+ var containerProps = _ref.containerProps,
810
+ children = _ref.children;
811
+ return /*#__PURE__*/_react["default"].createElement("div", containerProps, children);
812
+ };
813
+
814
+ var defaultTheme = {
815
+ container: 'react-autowhatever__container',
816
+ containerOpen: 'react-autowhatever__container--open',
817
+ input: 'react-autowhatever__input',
818
+ inputOpen: 'react-autowhatever__input--open',
819
+ inputFocused: 'react-autowhatever__input--focused',
820
+ itemsContainer: 'react-autowhatever__items-container',
821
+ itemsContainerOpen: 'react-autowhatever__items-container--open',
822
+ itemsList: 'react-autowhatever__items-list',
823
+ item: 'react-autowhatever__item',
824
+ itemFirst: 'react-autowhatever__item--first',
825
+ itemHighlighted: 'react-autowhatever__item--highlighted',
826
+ sectionContainer: 'react-autowhatever__section-container',
827
+ sectionContainerFirst: 'react-autowhatever__section-container--first',
828
+ sectionTitle: 'react-autowhatever__section-title'
829
+ };
830
+
831
+ var Autowhatever = /*#__PURE__*/function (_Component) {
832
+ _inherits(Autowhatever, _Component);
833
+
834
+ var _super = _createSuper(Autowhatever);
835
+
836
+ function Autowhatever(props) {
837
+ var _this;
838
+
839
+ _classCallCheck(this, Autowhatever);
840
+
841
+ _this = _super.call(this, props);
842
+
843
+ _defineProperty(_assertThisInitialized(_this), "storeInputReference", function (input) {
844
+ if (input !== null) {
845
+ _this.input = input;
846
+ }
847
+
848
+ var userRef = _this.props.inputProps.ref;
849
+
850
+ if (userRef) {
851
+ if (typeof userRef === 'function') {
852
+ userRef(input);
853
+ } else if (_typeof(userRef) === 'object' && Object.prototype.hasOwnProperty.call(userRef, 'current')) {
854
+ userRef.current = input;
855
+ }
856
+ }
857
+ });
858
+
859
+ _defineProperty(_assertThisInitialized(_this), "storeItemsContainerReference", function (itemsContainer) {
860
+ if (itemsContainer !== null) {
861
+ _this.itemsContainer = itemsContainer;
862
+ }
863
+ });
864
+
865
+ _defineProperty(_assertThisInitialized(_this), "onHighlightedItemChange", function (highlightedItem) {
866
+ _this.highlightedItem = highlightedItem;
867
+ });
868
+
869
+ _defineProperty(_assertThisInitialized(_this), "getItemId", function (sectionIndex, itemIndex) {
870
+ if (itemIndex === null) {
871
+ return null;
872
+ }
873
+
874
+ var id = _this.props.id;
875
+ var section = sectionIndex === null ? '' : "section-".concat(sectionIndex);
876
+ return "react-autowhatever-".concat(id, "-").concat(section, "-item-").concat(itemIndex);
877
+ });
878
+
879
+ _defineProperty(_assertThisInitialized(_this), "onFocus", function (event) {
880
+ var inputProps = _this.props.inputProps;
881
+
882
+ _this.setState({
883
+ isInputFocused: true
884
+ });
885
+
886
+ inputProps.onFocus && inputProps.onFocus(event);
887
+ });
888
+
889
+ _defineProperty(_assertThisInitialized(_this), "onBlur", function (event) {
890
+ var inputProps = _this.props.inputProps;
891
+
892
+ _this.setState({
893
+ isInputFocused: false
894
+ });
895
+
896
+ inputProps.onBlur && inputProps.onBlur(event);
897
+ });
898
+
899
+ _defineProperty(_assertThisInitialized(_this), "onKeyDown", function (event) {
900
+ var _this$props = _this.props,
901
+ inputProps = _this$props.inputProps,
902
+ highlightedSectionIndex = _this$props.highlightedSectionIndex,
903
+ highlightedItemIndex = _this$props.highlightedItemIndex;
904
+ var keyCode = event.keyCode;
905
+
906
+ switch (keyCode) {
907
+ case 40: // ArrowDown
908
+
909
+ case 38:
910
+ {
911
+ // ArrowUp
912
+ var nextPrev = keyCode === 40 ? 'next' : 'prev';
913
+
914
+ var _this$sectionIterator = _this.sectionIterator[nextPrev]([highlightedSectionIndex, highlightedItemIndex]),
915
+ _this$sectionIterator2 = _slicedToArray(_this$sectionIterator, 2),
916
+ newHighlightedSectionIndex = _this$sectionIterator2[0],
917
+ newHighlightedItemIndex = _this$sectionIterator2[1];
918
+
919
+ inputProps.onKeyDown(event, {
920
+ newHighlightedSectionIndex: newHighlightedSectionIndex,
921
+ newHighlightedItemIndex: newHighlightedItemIndex
922
+ });
923
+ break;
924
+ }
925
+
926
+ default:
927
+ inputProps.onKeyDown(event, {
928
+ highlightedSectionIndex: highlightedSectionIndex,
929
+ highlightedItemIndex: highlightedItemIndex
930
+ });
931
+ }
932
+ });
933
+
934
+ _this.highlightedItem = null;
935
+ _this.state = {
936
+ isInputFocused: false
937
+ };
938
+
939
+ _this.setSectionsItems(props);
940
+
941
+ _this.setSectionIterator(props);
942
+
943
+ _this.setTheme(props);
944
+
945
+ return _this;
946
+ }
947
+
948
+ _createClass(Autowhatever, [{
949
+ key: "componentDidMount",
950
+ value: function componentDidMount() {
951
+ this.ensureHighlightedItemIsVisible();
952
+ } // eslint-disable-next-line camelcase, react/sort-comp
953
+
954
+ }, {
955
+ key: "UNSAFE_componentWillReceiveProps",
956
+ value: function UNSAFE_componentWillReceiveProps(nextProps) {
957
+ if (nextProps.items !== this.props.items) {
958
+ this.setSectionsItems(nextProps);
959
+ }
960
+
961
+ if (nextProps.items !== this.props.items || nextProps.multiSection !== this.props.multiSection) {
962
+ this.setSectionIterator(nextProps);
963
+ }
964
+
965
+ if (nextProps.theme !== this.props.theme) {
966
+ this.setTheme(nextProps);
967
+ }
968
+ }
969
+ }, {
970
+ key: "componentDidUpdate",
971
+ value: function componentDidUpdate() {
972
+ this.ensureHighlightedItemIsVisible();
973
+ }
974
+ }, {
975
+ key: "setSectionsItems",
976
+ value: function setSectionsItems(props) {
977
+ if (props.multiSection) {
978
+ this.sectionsItems = props.items.map(function (section) {
979
+ return props.getSectionItems(section);
980
+ });
981
+ this.sectionsLengths = this.sectionsItems.map(function (items) {
982
+ return items.length;
983
+ });
984
+ this.allSectionsAreEmpty = this.sectionsLengths.every(function (itemsCount) {
985
+ return itemsCount === 0;
986
+ });
987
+ }
988
+ }
989
+ }, {
990
+ key: "setSectionIterator",
991
+ value: function setSectionIterator(props) {
992
+ this.sectionIterator = (0, _sectionIterator["default"])({
993
+ multiSection: props.multiSection,
994
+ data: props.multiSection ? this.sectionsLengths : props.items.length
995
+ });
996
+ }
997
+ }, {
998
+ key: "setTheme",
999
+ value: function setTheme(props) {
1000
+ this.theme = (0, _reactThemeable["default"])(props.theme);
1001
+ }
1002
+ }, {
1003
+ key: "renderSections",
1004
+ value: function renderSections() {
1005
+ var _this2 = this;
1006
+
1007
+ if (this.allSectionsAreEmpty) {
1008
+ return null;
1009
+ }
1010
+
1011
+ var theme = this.theme;
1012
+ var _this$props2 = this.props,
1013
+ id = _this$props2.id,
1014
+ items = _this$props2.items,
1015
+ renderItem = _this$props2.renderItem,
1016
+ renderItemData = _this$props2.renderItemData,
1017
+ renderSectionTitle = _this$props2.renderSectionTitle,
1018
+ highlightedSectionIndex = _this$props2.highlightedSectionIndex,
1019
+ highlightedItemIndex = _this$props2.highlightedItemIndex,
1020
+ itemProps = _this$props2.itemProps;
1021
+ return items.map(function (section, sectionIndex) {
1022
+ var keyPrefix = "react-autowhatever-".concat(id, "-");
1023
+ var sectionKeyPrefix = "".concat(keyPrefix, "section-").concat(sectionIndex, "-");
1024
+ var isFirstSection = sectionIndex === 0; // `key` is provided by theme()
1025
+
1026
+ /* eslint-disable react/jsx-key */
1027
+
1028
+ return /*#__PURE__*/_react["default"].createElement("div", theme("".concat(sectionKeyPrefix, "container"), 'sectionContainer', isFirstSection && 'sectionContainerFirst'), /*#__PURE__*/_react["default"].createElement(_SectionTitle["default"], {
1029
+ section: section,
1030
+ renderSectionTitle: renderSectionTitle,
1031
+ theme: theme,
1032
+ sectionKeyPrefix: sectionKeyPrefix
1033
+ }), /*#__PURE__*/_react["default"].createElement(_ItemList["default"], {
1034
+ items: _this2.sectionsItems[sectionIndex],
1035
+ itemProps: itemProps,
1036
+ renderItem: renderItem,
1037
+ renderItemData: renderItemData,
1038
+ sectionIndex: sectionIndex,
1039
+ highlightedItemIndex: highlightedSectionIndex === sectionIndex ? highlightedItemIndex : null,
1040
+ onHighlightedItemChange: _this2.onHighlightedItemChange,
1041
+ getItemId: _this2.getItemId,
1042
+ theme: theme,
1043
+ keyPrefix: keyPrefix,
1044
+ ref: _this2.storeItemsListReference
1045
+ }));
1046
+ /* eslint-enable react/jsx-key */
1047
+ });
1048
+ }
1049
+ }, {
1050
+ key: "renderItems",
1051
+ value: function renderItems() {
1052
+ var items = this.props.items;
1053
+
1054
+ if (items.length === 0) {
1055
+ return null;
1056
+ }
1057
+
1058
+ var theme = this.theme;
1059
+ var _this$props3 = this.props,
1060
+ id = _this$props3.id,
1061
+ renderItem = _this$props3.renderItem,
1062
+ renderItemData = _this$props3.renderItemData,
1063
+ highlightedSectionIndex = _this$props3.highlightedSectionIndex,
1064
+ highlightedItemIndex = _this$props3.highlightedItemIndex,
1065
+ itemProps = _this$props3.itemProps;
1066
+ return /*#__PURE__*/_react["default"].createElement(_ItemList["default"], {
1067
+ items: items,
1068
+ itemProps: itemProps,
1069
+ renderItem: renderItem,
1070
+ renderItemData: renderItemData,
1071
+ highlightedItemIndex: highlightedSectionIndex === null ? highlightedItemIndex : null,
1072
+ onHighlightedItemChange: this.onHighlightedItemChange,
1073
+ getItemId: this.getItemId,
1074
+ theme: theme,
1075
+ keyPrefix: "react-autowhatever-".concat(id, "-")
1076
+ });
1077
+ }
1078
+ }, {
1079
+ key: "ensureHighlightedItemIsVisible",
1080
+ value: function ensureHighlightedItemIsVisible() {
1081
+ var highlightedItem = this.highlightedItem;
1082
+
1083
+ if (!highlightedItem) {
1084
+ return;
1085
+ }
1086
+
1087
+ var itemsContainer = this.itemsContainer;
1088
+ var itemOffsetRelativeToContainer = highlightedItem.offsetParent === itemsContainer ? highlightedItem.offsetTop : highlightedItem.offsetTop - itemsContainer.offsetTop;
1089
+ var scrollTop = itemsContainer.scrollTop; // Top of the visible area
1090
+
1091
+ if (itemOffsetRelativeToContainer < scrollTop) {
1092
+ // Item is off the top of the visible area
1093
+ scrollTop = itemOffsetRelativeToContainer;
1094
+ } else if (itemOffsetRelativeToContainer + highlightedItem.offsetHeight > scrollTop + itemsContainer.offsetHeight) {
1095
+ // Item is off the bottom of the visible area
1096
+ scrollTop = itemOffsetRelativeToContainer + highlightedItem.offsetHeight - itemsContainer.offsetHeight;
1097
+ }
1098
+
1099
+ if (scrollTop !== itemsContainer.scrollTop) {
1100
+ itemsContainer.scrollTop = scrollTop;
1101
+ }
1102
+ }
1103
+ }, {
1104
+ key: "render",
1105
+ value: function render() {
1106
+ var theme = this.theme;
1107
+ var _this$props4 = this.props,
1108
+ id = _this$props4.id,
1109
+ multiSection = _this$props4.multiSection,
1110
+ renderInputComponent = _this$props4.renderInputComponent,
1111
+ renderItemsContainer = _this$props4.renderItemsContainer,
1112
+ highlightedSectionIndex = _this$props4.highlightedSectionIndex,
1113
+ highlightedItemIndex = _this$props4.highlightedItemIndex;
1114
+ var isInputFocused = this.state.isInputFocused;
1115
+ var renderedItems = multiSection ? this.renderSections() : this.renderItems();
1116
+ var isOpen = renderedItems !== null;
1117
+ var ariaActivedescendant = this.getItemId(highlightedSectionIndex, highlightedItemIndex);
1118
+ var itemsContainerId = "react-autowhatever-".concat(id);
1119
+
1120
+ var containerProps = _objectSpread({
1121
+ role: 'combobox',
1122
+ 'aria-haspopup': 'listbox',
1123
+ 'aria-owns': itemsContainerId,
1124
+ 'aria-expanded': isOpen
1125
+ }, theme("react-autowhatever-".concat(id, "-container"), 'container', isOpen && 'containerOpen'), {}, this.props.containerProps);
1126
+
1127
+ var inputComponent = renderInputComponent(_objectSpread({
1128
+ type: 'text',
1129
+ value: '',
1130
+ autoComplete: 'off',
1131
+ 'aria-autocomplete': 'list',
1132
+ 'aria-controls': itemsContainerId,
1133
+ 'aria-activedescendant': ariaActivedescendant
1134
+ }, theme("react-autowhatever-".concat(id, "-input"), 'input', isOpen && 'inputOpen', isInputFocused && 'inputFocused'), {}, this.props.inputProps, {
1135
+ onFocus: this.onFocus,
1136
+ onBlur: this.onBlur,
1137
+ onKeyDown: this.props.inputProps.onKeyDown && this.onKeyDown,
1138
+ ref: this.storeInputReference
1139
+ }));
1140
+ var itemsContainer = renderItemsContainer({
1141
+ containerProps: _objectSpread({
1142
+ id: itemsContainerId,
1143
+ role: 'listbox'
1144
+ }, theme("react-autowhatever-".concat(id, "-items-container"), 'itemsContainer', isOpen && 'itemsContainerOpen'), {
1145
+ ref: this.storeItemsContainerReference
1146
+ }),
1147
+ children: renderedItems
1148
+ });
1149
+ return /*#__PURE__*/_react["default"].createElement("div", containerProps, inputComponent, itemsContainer);
1150
+ }
1151
+ }]);
1152
+
1153
+ return Autowhatever;
1154
+ }(_react.Component);
1155
+
1156
+ exports["default"] = Autowhatever;
1157
+
1158
+ _defineProperty(Autowhatever, "propTypes", {
1159
+ id: _propTypes["default"].string,
1160
+ // Used in aria-* attributes. If multiple Autowhatever's are rendered on a page, they must have unique ids.
1161
+ multiSection: _propTypes["default"].bool,
1162
+ // Indicates whether a multi section layout should be rendered.
1163
+ renderInputComponent: _propTypes["default"].func,
1164
+ // When specified, it is used to render the input element.
1165
+ renderItemsContainer: _propTypes["default"].func,
1166
+ // Renders the items container.
1167
+ items: _propTypes["default"].array.isRequired,
1168
+ // Array of items or sections to render.
1169
+ renderItem: _propTypes["default"].func,
1170
+ // This function renders a single item.
1171
+ renderItemData: _propTypes["default"].object,
1172
+ // Arbitrary data that will be passed to renderItem()
1173
+ renderSectionTitle: _propTypes["default"].func,
1174
+ // This function gets a section and renders its title.
1175
+ getSectionItems: _propTypes["default"].func,
1176
+ // This function gets a section and returns its items, which will be passed into `renderItem` for rendering.
1177
+ containerProps: _propTypes["default"].object,
1178
+ // Arbitrary container props
1179
+ inputProps: _propTypes["default"].object,
1180
+ // Arbitrary input props
1181
+ itemProps: _propTypes["default"].oneOfType([// Arbitrary item props
1182
+ _propTypes["default"].object, _propTypes["default"].func]),
1183
+ highlightedSectionIndex: _propTypes["default"].number,
1184
+ // Section index of the highlighted item
1185
+ highlightedItemIndex: _propTypes["default"].number,
1186
+ // Highlighted item index (within a section)
1187
+ theme: _propTypes["default"].oneOfType([// Styles. See: https://github.com/markdalgleish/react-themeable
1188
+ _propTypes["default"].object, _propTypes["default"].array])
1189
+ });
1190
+
1191
+ _defineProperty(Autowhatever, "defaultProps", {
1192
+ id: '1',
1193
+ multiSection: false,
1194
+ renderInputComponent: defaultRenderInputComponent,
1195
+ renderItemsContainer: defaultRenderItemsContainer,
1196
+ renderItem: function renderItem() {
1197
+ throw new Error('`renderItem` must be provided');
1198
+ },
1199
+ renderItemData: emptyObject,
1200
+ renderSectionTitle: function renderSectionTitle() {
1201
+ throw new Error('`renderSectionTitle` must be provided');
1202
+ },
1203
+ getSectionItems: function getSectionItems() {
1204
+ throw new Error('`getSectionItems` must be provided');
1205
+ },
1206
+ containerProps: emptyObject,
1207
+ inputProps: emptyObject,
1208
+ itemProps: emptyObject,
1209
+ highlightedSectionIndex: null,
1210
+ highlightedItemIndex: null,
1211
+ theme: defaultTheme
1212
+ });
1213
+ }(Autowhatever));
1214
+
1215
+ var theme = {};
1216
+
1217
+ Object.defineProperty(theme, "__esModule", {
1218
+ value: true
1219
+ });
1220
+ theme.mapToAutowhateverTheme = theme.defaultTheme = void 0;
1221
+ var defaultTheme = {
1222
+ container: 'react-autosuggest__container',
1223
+ containerOpen: 'react-autosuggest__container--open',
1224
+ input: 'react-autosuggest__input',
1225
+ inputOpen: 'react-autosuggest__input--open',
1226
+ inputFocused: 'react-autosuggest__input--focused',
1227
+ suggestionsContainer: 'react-autosuggest__suggestions-container',
1228
+ suggestionsContainerOpen: 'react-autosuggest__suggestions-container--open',
1229
+ suggestionsList: 'react-autosuggest__suggestions-list',
1230
+ suggestion: 'react-autosuggest__suggestion',
1231
+ suggestionFirst: 'react-autosuggest__suggestion--first',
1232
+ suggestionHighlighted: 'react-autosuggest__suggestion--highlighted',
1233
+ sectionContainer: 'react-autosuggest__section-container',
1234
+ sectionContainerFirst: 'react-autosuggest__section-container--first',
1235
+ sectionTitle: 'react-autosuggest__section-title'
1236
+ };
1237
+ theme.defaultTheme = defaultTheme;
1238
+
1239
+ var mapToAutowhateverTheme = function mapToAutowhateverTheme(theme) {
1240
+ var result = {};
1241
+
1242
+ for (var key in theme) {
1243
+ switch (key) {
1244
+ case 'suggestionsContainer':
1245
+ result['itemsContainer'] = theme[key];
1246
+ break;
1247
+
1248
+ case 'suggestionsContainerOpen':
1249
+ result['itemsContainerOpen'] = theme[key];
1250
+ break;
1251
+
1252
+ case 'suggestion':
1253
+ result['item'] = theme[key];
1254
+ break;
1255
+
1256
+ case 'suggestionFirst':
1257
+ result['itemFirst'] = theme[key];
1258
+ break;
1259
+
1260
+ case 'suggestionHighlighted':
1261
+ result['itemHighlighted'] = theme[key];
1262
+ break;
1263
+
1264
+ case 'suggestionsList':
1265
+ result['itemsList'] = theme[key];
1266
+ break;
1267
+
1268
+ default:
1269
+ result[key] = theme[key];
1270
+ }
1271
+ }
1272
+
1273
+ return result;
1274
+ };
1275
+
1276
+ theme.mapToAutowhateverTheme = mapToAutowhateverTheme;
1277
+
1278
+ (function (exports) {
1279
+
1280
+ Object.defineProperty(exports, "__esModule", {
1281
+ value: true
1282
+ });
1283
+ exports["default"] = void 0;
1284
+
1285
+ var _react = _interopRequireWildcard(React__default);
1286
+
1287
+ var _propTypes = _interopRequireDefault(propTypes.exports);
1288
+
1289
+ var _arrays = _interopRequireDefault(arrays);
1290
+
1291
+ var _Autowhatever = _interopRequireDefault(Autowhatever);
1292
+
1293
+ var _theme = theme;
1294
+
1295
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
1296
+
1297
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
1298
+
1299
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
1300
+
1301
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
1302
+
1303
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
1304
+
1305
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1306
+
1307
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1308
+
1309
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
1310
+
1311
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
1312
+
1313
+ function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
1314
+
1315
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
1316
+
1317
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
1318
+
1319
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
1320
+
1321
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
1322
+
1323
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
1324
+
1325
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
1326
+
1327
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1328
+
1329
+ var alwaysTrue = function alwaysTrue() {
1330
+ return true;
1331
+ };
1332
+
1333
+ var defaultShouldRenderSuggestions = function defaultShouldRenderSuggestions(value) {
1334
+ return value.trim().length > 0;
1335
+ };
1336
+
1337
+ var defaultRenderSuggestionsContainer = function defaultRenderSuggestionsContainer(_ref) {
1338
+ var containerProps = _ref.containerProps,
1339
+ children = _ref.children;
1340
+ return /*#__PURE__*/_react["default"].createElement("div", containerProps, children);
1341
+ };
1342
+
1343
+ var REASON_SUGGESTIONS_REVEALED = 'suggestions-revealed';
1344
+ var REASON_SUGGESTIONS_UPDATED = 'suggestions-updated';
1345
+ var REASON_SUGGESTION_SELECTED = 'suggestion-selected';
1346
+ var REASON_INPUT_FOCUSED = 'input-focused';
1347
+ var REASON_INPUT_CHANGED = 'input-changed';
1348
+ var REASON_INPUT_BLURRED = 'input-blurred';
1349
+ var REASON_ESCAPE_PRESSED = 'escape-pressed';
1350
+
1351
+ var Autosuggest = /*#__PURE__*/function (_Component) {
1352
+ _inherits(Autosuggest, _Component);
1353
+
1354
+ var _super = _createSuper(Autosuggest);
1355
+
1356
+ function Autosuggest(_ref2) {
1357
+ var _this;
1358
+
1359
+ var _alwaysRenderSuggestions = _ref2.alwaysRenderSuggestions;
1360
+
1361
+ _classCallCheck(this, Autosuggest);
1362
+
1363
+ _this = _super.call(this);
1364
+
1365
+ _defineProperty(_assertThisInitialized(_this), "onDocumentMouseDown", function (event) {
1366
+ _this.justClickedOnSuggestionsContainer = false;
1367
+ var node = event.detail && event.detail.target || // This is for testing only. Please show me a better way to emulate this.
1368
+ event.target;
1369
+
1370
+ while (node !== null && node !== document) {
1371
+ if (node.getAttribute && node.getAttribute('data-suggestion-index') !== null) {
1372
+ // Suggestion was clicked
1373
+ return;
1374
+ }
1375
+
1376
+ if (node === _this.suggestionsContainer) {
1377
+ // Something else inside suggestions container was clicked
1378
+ _this.justClickedOnSuggestionsContainer = true;
1379
+ return;
1380
+ }
1381
+
1382
+ node = node.parentNode;
1383
+ }
1384
+ });
1385
+
1386
+ _defineProperty(_assertThisInitialized(_this), "storeAutowhateverRef", function (autowhatever) {
1387
+ if (autowhatever !== null) {
1388
+ _this.autowhatever = autowhatever;
1389
+ }
1390
+ });
1391
+
1392
+ _defineProperty(_assertThisInitialized(_this), "onSuggestionMouseEnter", function (event, _ref3) {
1393
+ var sectionIndex = _ref3.sectionIndex,
1394
+ itemIndex = _ref3.itemIndex;
1395
+
1396
+ _this.updateHighlightedSuggestion(sectionIndex, itemIndex);
1397
+
1398
+ if (event.target === _this.pressedSuggestion) {
1399
+ _this.justSelectedSuggestion = true;
1400
+ }
1401
+
1402
+ _this.justMouseEntered = true;
1403
+ setTimeout(function () {
1404
+ _this.justMouseEntered = false;
1405
+ });
1406
+ });
1407
+
1408
+ _defineProperty(_assertThisInitialized(_this), "highlightFirstSuggestion", function () {
1409
+ _this.updateHighlightedSuggestion(_this.props.multiSection ? 0 : null, 0);
1410
+ });
1411
+
1412
+ _defineProperty(_assertThisInitialized(_this), "onDocumentMouseUp", function () {
1413
+ if (_this.pressedSuggestion && !_this.justSelectedSuggestion) {
1414
+ _this.input.focus();
1415
+ }
1416
+
1417
+ _this.pressedSuggestion = null;
1418
+ });
1419
+
1420
+ _defineProperty(_assertThisInitialized(_this), "onSuggestionMouseDown", function (event) {
1421
+ // Checking if this.justSelectedSuggestion is already true to not duplicate touch events in chrome
1422
+ // See: https://github.com/facebook/react/issues/9809#issuecomment-413978405
1423
+ if (!_this.justSelectedSuggestion) {
1424
+ _this.justSelectedSuggestion = true;
1425
+ _this.pressedSuggestion = event.target;
1426
+ }
1427
+ });
1428
+
1429
+ _defineProperty(_assertThisInitialized(_this), "onSuggestionsClearRequested", function () {
1430
+ var onSuggestionsClearRequested = _this.props.onSuggestionsClearRequested;
1431
+ onSuggestionsClearRequested && onSuggestionsClearRequested();
1432
+ });
1433
+
1434
+ _defineProperty(_assertThisInitialized(_this), "onSuggestionSelected", function (event, data) {
1435
+ var _this$props = _this.props,
1436
+ alwaysRenderSuggestions = _this$props.alwaysRenderSuggestions,
1437
+ onSuggestionSelected = _this$props.onSuggestionSelected,
1438
+ onSuggestionsFetchRequested = _this$props.onSuggestionsFetchRequested;
1439
+ onSuggestionSelected && onSuggestionSelected(event, data);
1440
+
1441
+ var keepSuggestionsOnSelect = _this.props.shouldKeepSuggestionsOnSelect(data.suggestion);
1442
+
1443
+ if (alwaysRenderSuggestions || keepSuggestionsOnSelect) {
1444
+ onSuggestionsFetchRequested({
1445
+ value: data.suggestionValue,
1446
+ reason: REASON_SUGGESTION_SELECTED
1447
+ });
1448
+ } else {
1449
+ _this.onSuggestionsClearRequested();
1450
+ }
1451
+
1452
+ _this.resetHighlightedSuggestion();
1453
+ });
1454
+
1455
+ _defineProperty(_assertThisInitialized(_this), "onSuggestionClick", function (event) {
1456
+ var _this$props2 = _this.props,
1457
+ alwaysRenderSuggestions = _this$props2.alwaysRenderSuggestions,
1458
+ focusInputOnSuggestionClick = _this$props2.focusInputOnSuggestionClick;
1459
+
1460
+ var _this$getSuggestionIn = _this.getSuggestionIndices(_this.findSuggestionElement(event.target)),
1461
+ sectionIndex = _this$getSuggestionIn.sectionIndex,
1462
+ suggestionIndex = _this$getSuggestionIn.suggestionIndex;
1463
+
1464
+ var clickedSuggestion = _this.getSuggestion(sectionIndex, suggestionIndex);
1465
+
1466
+ var clickedSuggestionValue = _this.props.getSuggestionValue(clickedSuggestion);
1467
+
1468
+ _this.maybeCallOnChange(event, clickedSuggestionValue, 'click');
1469
+
1470
+ _this.onSuggestionSelected(event, {
1471
+ suggestion: clickedSuggestion,
1472
+ suggestionValue: clickedSuggestionValue,
1473
+ suggestionIndex: suggestionIndex,
1474
+ sectionIndex: sectionIndex,
1475
+ method: 'click'
1476
+ });
1477
+
1478
+ var keepSuggestionsOnSelect = _this.props.shouldKeepSuggestionsOnSelect(clickedSuggestion);
1479
+
1480
+ if (!(alwaysRenderSuggestions || keepSuggestionsOnSelect)) {
1481
+ _this.closeSuggestions();
1482
+ }
1483
+
1484
+ if (focusInputOnSuggestionClick === true) {
1485
+ _this.input.focus();
1486
+ } else {
1487
+ _this.onBlur();
1488
+ }
1489
+
1490
+ setTimeout(function () {
1491
+ _this.justSelectedSuggestion = false;
1492
+ });
1493
+ });
1494
+
1495
+ _defineProperty(_assertThisInitialized(_this), "onBlur", function () {
1496
+ var _this$props3 = _this.props,
1497
+ inputProps = _this$props3.inputProps,
1498
+ shouldRenderSuggestions = _this$props3.shouldRenderSuggestions;
1499
+ var value = inputProps.value,
1500
+ onBlur = inputProps.onBlur;
1501
+
1502
+ var highlightedSuggestion = _this.getHighlightedSuggestion();
1503
+
1504
+ var shouldRender = shouldRenderSuggestions(value, REASON_INPUT_BLURRED);
1505
+
1506
+ _this.setState({
1507
+ isFocused: false,
1508
+ highlightedSectionIndex: null,
1509
+ highlightedSuggestionIndex: null,
1510
+ highlightedSuggestion: null,
1511
+ valueBeforeUpDown: null,
1512
+ isCollapsed: !shouldRender
1513
+ });
1514
+
1515
+ onBlur && onBlur(_this.blurEvent, {
1516
+ highlightedSuggestion: highlightedSuggestion
1517
+ });
1518
+ });
1519
+
1520
+ _defineProperty(_assertThisInitialized(_this), "onSuggestionMouseLeave", function (event) {
1521
+ _this.resetHighlightedSuggestion(false); // shouldResetValueBeforeUpDown
1522
+
1523
+
1524
+ if (_this.justSelectedSuggestion && event.target === _this.pressedSuggestion) {
1525
+ _this.justSelectedSuggestion = false;
1526
+ }
1527
+ });
1528
+
1529
+ _defineProperty(_assertThisInitialized(_this), "onSuggestionTouchStart", function () {
1530
+ _this.justSelectedSuggestion = true; // todo: event.preventDefault when https://github.com/facebook/react/issues/2043
1531
+ // todo: gets released so onSuggestionMouseDown won't fire in chrome
1532
+ });
1533
+
1534
+ _defineProperty(_assertThisInitialized(_this), "onSuggestionTouchMove", function () {
1535
+ _this.justSelectedSuggestion = false;
1536
+ _this.pressedSuggestion = null;
1537
+
1538
+ _this.input.focus();
1539
+ });
1540
+
1541
+ _defineProperty(_assertThisInitialized(_this), "itemProps", function (_ref4) {
1542
+ var sectionIndex = _ref4.sectionIndex,
1543
+ itemIndex = _ref4.itemIndex;
1544
+ return {
1545
+ 'data-section-index': sectionIndex,
1546
+ 'data-suggestion-index': itemIndex,
1547
+ onMouseEnter: _this.onSuggestionMouseEnter,
1548
+ onMouseLeave: _this.onSuggestionMouseLeave,
1549
+ onMouseDown: _this.onSuggestionMouseDown,
1550
+ onTouchStart: _this.onSuggestionTouchStart,
1551
+ onTouchMove: _this.onSuggestionTouchMove,
1552
+ onClick: _this.onSuggestionClick
1553
+ };
1554
+ });
1555
+
1556
+ _defineProperty(_assertThisInitialized(_this), "renderSuggestionsContainer", function (_ref5) {
1557
+ var containerProps = _ref5.containerProps,
1558
+ children = _ref5.children;
1559
+ var renderSuggestionsContainer = _this.props.renderSuggestionsContainer;
1560
+ return renderSuggestionsContainer({
1561
+ containerProps: containerProps,
1562
+ children: children,
1563
+ query: _this.getQuery()
1564
+ });
1565
+ });
1566
+
1567
+ _this.state = {
1568
+ isFocused: false,
1569
+ isCollapsed: !_alwaysRenderSuggestions,
1570
+ highlightedSectionIndex: null,
1571
+ highlightedSuggestionIndex: null,
1572
+ highlightedSuggestion: null,
1573
+ valueBeforeUpDown: null
1574
+ };
1575
+ _this.justPressedUpDown = false;
1576
+ _this.justMouseEntered = false;
1577
+ _this.pressedSuggestion = null;
1578
+ return _this;
1579
+ }
1580
+
1581
+ _createClass(Autosuggest, [{
1582
+ key: "componentDidMount",
1583
+ value: function componentDidMount() {
1584
+ document.addEventListener('mousedown', this.onDocumentMouseDown);
1585
+ document.addEventListener('mouseup', this.onDocumentMouseUp);
1586
+ this.input = this.autowhatever.input;
1587
+ this.suggestionsContainer = this.autowhatever.itemsContainer;
1588
+ } // eslint-disable-next-line camelcase, react/sort-comp
1589
+
1590
+ }, {
1591
+ key: "UNSAFE_componentWillReceiveProps",
1592
+ value: function UNSAFE_componentWillReceiveProps(nextProps) {
1593
+ // When highlightFirstSuggestion becomes deactivated, if the first suggestion was
1594
+ // set, we should reset the suggestion back to the unselected default state.
1595
+ var shouldResetHighlighting = this.state.highlightedSuggestionIndex === 0 && this.props.highlightFirstSuggestion && !nextProps.highlightFirstSuggestion;
1596
+
1597
+ if ((0, _arrays["default"])(nextProps.suggestions, this.props.suggestions)) {
1598
+ if (nextProps.highlightFirstSuggestion && nextProps.suggestions.length > 0 && this.justPressedUpDown === false && this.justMouseEntered === false) {
1599
+ this.highlightFirstSuggestion();
1600
+ } else if (shouldResetHighlighting) {
1601
+ this.resetHighlightedSuggestion();
1602
+ }
1603
+ } else {
1604
+ if (this.willRenderSuggestions(nextProps, REASON_SUGGESTIONS_UPDATED)) {
1605
+ if (this.state.isCollapsed && !this.justSelectedSuggestion) {
1606
+ this.revealSuggestions();
1607
+ }
1608
+
1609
+ if (shouldResetHighlighting) {
1610
+ this.resetHighlightedSuggestion();
1611
+ }
1612
+ } else {
1613
+ this.resetHighlightedSuggestion();
1614
+ }
1615
+ }
1616
+ }
1617
+ }, {
1618
+ key: "componentDidUpdate",
1619
+ value: function componentDidUpdate(prevProps, prevState) {
1620
+ var _this$props4 = this.props,
1621
+ suggestions = _this$props4.suggestions,
1622
+ onSuggestionHighlighted = _this$props4.onSuggestionHighlighted,
1623
+ highlightFirstSuggestion = _this$props4.highlightFirstSuggestion;
1624
+
1625
+ if (!(0, _arrays["default"])(suggestions, prevProps.suggestions) && suggestions.length > 0 && highlightFirstSuggestion) {
1626
+ this.highlightFirstSuggestion();
1627
+ return;
1628
+ }
1629
+
1630
+ if (onSuggestionHighlighted) {
1631
+ var highlightedSuggestion = this.getHighlightedSuggestion();
1632
+ var prevHighlightedSuggestion = prevState.highlightedSuggestion;
1633
+
1634
+ if (highlightedSuggestion != prevHighlightedSuggestion) {
1635
+ onSuggestionHighlighted({
1636
+ suggestion: highlightedSuggestion
1637
+ });
1638
+ }
1639
+ }
1640
+ }
1641
+ }, {
1642
+ key: "componentWillUnmount",
1643
+ value: function componentWillUnmount() {
1644
+ document.removeEventListener('mousedown', this.onDocumentMouseDown);
1645
+ document.removeEventListener('mouseup', this.onDocumentMouseUp);
1646
+ }
1647
+ }, {
1648
+ key: "updateHighlightedSuggestion",
1649
+ value: function updateHighlightedSuggestion(sectionIndex, suggestionIndex, prevValue) {
1650
+ var _this2 = this;
1651
+
1652
+ this.setState(function (state) {
1653
+ var valueBeforeUpDown = state.valueBeforeUpDown;
1654
+
1655
+ if (suggestionIndex === null) {
1656
+ valueBeforeUpDown = null;
1657
+ } else if (valueBeforeUpDown === null && typeof prevValue !== 'undefined') {
1658
+ valueBeforeUpDown = prevValue;
1659
+ }
1660
+
1661
+ return {
1662
+ highlightedSectionIndex: sectionIndex,
1663
+ highlightedSuggestionIndex: suggestionIndex,
1664
+ highlightedSuggestion: suggestionIndex === null ? null : _this2.getSuggestion(sectionIndex, suggestionIndex),
1665
+ valueBeforeUpDown: valueBeforeUpDown
1666
+ };
1667
+ });
1668
+ }
1669
+ }, {
1670
+ key: "resetHighlightedSuggestion",
1671
+ value: function resetHighlightedSuggestion() {
1672
+ var shouldResetValueBeforeUpDown = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
1673
+ this.setState(function (state) {
1674
+ var valueBeforeUpDown = state.valueBeforeUpDown;
1675
+ return {
1676
+ highlightedSectionIndex: null,
1677
+ highlightedSuggestionIndex: null,
1678
+ highlightedSuggestion: null,
1679
+ valueBeforeUpDown: shouldResetValueBeforeUpDown ? null : valueBeforeUpDown
1680
+ };
1681
+ });
1682
+ }
1683
+ }, {
1684
+ key: "revealSuggestions",
1685
+ value: function revealSuggestions() {
1686
+ this.setState({
1687
+ isCollapsed: false
1688
+ });
1689
+ }
1690
+ }, {
1691
+ key: "closeSuggestions",
1692
+ value: function closeSuggestions() {
1693
+ this.setState({
1694
+ highlightedSectionIndex: null,
1695
+ highlightedSuggestionIndex: null,
1696
+ highlightedSuggestion: null,
1697
+ valueBeforeUpDown: null,
1698
+ isCollapsed: true
1699
+ });
1700
+ }
1701
+ }, {
1702
+ key: "getSuggestion",
1703
+ value: function getSuggestion(sectionIndex, suggestionIndex) {
1704
+ var _this$props5 = this.props,
1705
+ suggestions = _this$props5.suggestions,
1706
+ multiSection = _this$props5.multiSection,
1707
+ getSectionSuggestions = _this$props5.getSectionSuggestions;
1708
+
1709
+ if (multiSection) {
1710
+ return getSectionSuggestions(suggestions[sectionIndex])[suggestionIndex];
1711
+ }
1712
+
1713
+ return suggestions[suggestionIndex];
1714
+ }
1715
+ }, {
1716
+ key: "getHighlightedSuggestion",
1717
+ value: function getHighlightedSuggestion() {
1718
+ var _this$state = this.state,
1719
+ highlightedSectionIndex = _this$state.highlightedSectionIndex,
1720
+ highlightedSuggestionIndex = _this$state.highlightedSuggestionIndex;
1721
+
1722
+ if (highlightedSuggestionIndex === null) {
1723
+ return null;
1724
+ }
1725
+
1726
+ return this.getSuggestion(highlightedSectionIndex, highlightedSuggestionIndex);
1727
+ }
1728
+ }, {
1729
+ key: "getSuggestionValueByIndex",
1730
+ value: function getSuggestionValueByIndex(sectionIndex, suggestionIndex) {
1731
+ var getSuggestionValue = this.props.getSuggestionValue;
1732
+ return getSuggestionValue(this.getSuggestion(sectionIndex, suggestionIndex));
1733
+ }
1734
+ }, {
1735
+ key: "getSuggestionIndices",
1736
+ value: function getSuggestionIndices(suggestionElement) {
1737
+ var sectionIndex = suggestionElement.getAttribute('data-section-index');
1738
+ var suggestionIndex = suggestionElement.getAttribute('data-suggestion-index');
1739
+ return {
1740
+ sectionIndex: typeof sectionIndex === 'string' ? parseInt(sectionIndex, 10) : null,
1741
+ suggestionIndex: parseInt(suggestionIndex, 10)
1742
+ };
1743
+ }
1744
+ }, {
1745
+ key: "findSuggestionElement",
1746
+ value: function findSuggestionElement(startNode) {
1747
+ var node = startNode;
1748
+
1749
+ do {
1750
+ if (node.getAttribute && node.getAttribute('data-suggestion-index') !== null) {
1751
+ return node;
1752
+ }
1753
+
1754
+ node = node.parentNode;
1755
+ } while (node !== null);
1756
+
1757
+ console.error('Clicked element:', startNode); // eslint-disable-line no-console
1758
+
1759
+ throw new Error("Couldn't find suggestion element");
1760
+ }
1761
+ }, {
1762
+ key: "maybeCallOnChange",
1763
+ value: function maybeCallOnChange(event, newValue, method) {
1764
+ var _this$props$inputProp = this.props.inputProps,
1765
+ value = _this$props$inputProp.value,
1766
+ onChange = _this$props$inputProp.onChange;
1767
+
1768
+ if (newValue !== value) {
1769
+ onChange(event, {
1770
+ newValue: newValue,
1771
+ method: method
1772
+ });
1773
+ }
1774
+ }
1775
+ }, {
1776
+ key: "willRenderSuggestions",
1777
+ value: function willRenderSuggestions(props, reason) {
1778
+ var suggestions = props.suggestions,
1779
+ inputProps = props.inputProps,
1780
+ shouldRenderSuggestions = props.shouldRenderSuggestions;
1781
+ var value = inputProps.value;
1782
+ return suggestions.length > 0 && shouldRenderSuggestions(value, reason);
1783
+ }
1784
+ }, {
1785
+ key: "getQuery",
1786
+ value: function getQuery() {
1787
+ var inputProps = this.props.inputProps;
1788
+ var value = inputProps.value;
1789
+ var valueBeforeUpDown = this.state.valueBeforeUpDown;
1790
+ return (valueBeforeUpDown === null ? value : valueBeforeUpDown).trim();
1791
+ }
1792
+ }, {
1793
+ key: "render",
1794
+ value: function render() {
1795
+ var _this3 = this;
1796
+
1797
+ var _this$props6 = this.props,
1798
+ suggestions = _this$props6.suggestions,
1799
+ renderInputComponent = _this$props6.renderInputComponent,
1800
+ onSuggestionsFetchRequested = _this$props6.onSuggestionsFetchRequested,
1801
+ renderSuggestion = _this$props6.renderSuggestion,
1802
+ inputProps = _this$props6.inputProps,
1803
+ multiSection = _this$props6.multiSection,
1804
+ renderSectionTitle = _this$props6.renderSectionTitle,
1805
+ id = _this$props6.id,
1806
+ getSectionSuggestions = _this$props6.getSectionSuggestions,
1807
+ theme = _this$props6.theme,
1808
+ getSuggestionValue = _this$props6.getSuggestionValue,
1809
+ alwaysRenderSuggestions = _this$props6.alwaysRenderSuggestions,
1810
+ highlightFirstSuggestion = _this$props6.highlightFirstSuggestion,
1811
+ containerProps = _this$props6.containerProps;
1812
+ var _this$state2 = this.state,
1813
+ isFocused = _this$state2.isFocused,
1814
+ isCollapsed = _this$state2.isCollapsed,
1815
+ highlightedSectionIndex = _this$state2.highlightedSectionIndex,
1816
+ highlightedSuggestionIndex = _this$state2.highlightedSuggestionIndex,
1817
+ valueBeforeUpDown = _this$state2.valueBeforeUpDown;
1818
+ var shouldRenderSuggestions = alwaysRenderSuggestions ? alwaysTrue : this.props.shouldRenderSuggestions;
1819
+ var value = inputProps.value,
1820
+ _onFocus = inputProps.onFocus,
1821
+ _onKeyDown = inputProps.onKeyDown;
1822
+ var willRenderSuggestions = this.willRenderSuggestions(this.props, 'render');
1823
+ var isOpen = alwaysRenderSuggestions || isFocused && !isCollapsed && willRenderSuggestions;
1824
+ var items = isOpen ? suggestions : [];
1825
+
1826
+ var autowhateverInputProps = _objectSpread({}, inputProps, {
1827
+ onFocus: function onFocus(event) {
1828
+ if (!_this3.justSelectedSuggestion && !_this3.justClickedOnSuggestionsContainer) {
1829
+ var shouldRender = shouldRenderSuggestions(value, REASON_INPUT_FOCUSED);
1830
+
1831
+ _this3.setState({
1832
+ isFocused: true,
1833
+ isCollapsed: !shouldRender
1834
+ });
1835
+
1836
+ _onFocus && _onFocus(event);
1837
+
1838
+ if (shouldRender) {
1839
+ onSuggestionsFetchRequested({
1840
+ value: value,
1841
+ reason: REASON_INPUT_FOCUSED
1842
+ });
1843
+ }
1844
+ }
1845
+ },
1846
+ onBlur: function onBlur(event) {
1847
+ if (_this3.justClickedOnSuggestionsContainer) {
1848
+ _this3.input.focus();
1849
+
1850
+ return;
1851
+ }
1852
+
1853
+ _this3.blurEvent = event;
1854
+
1855
+ if (!_this3.justSelectedSuggestion) {
1856
+ _this3.onBlur();
1857
+
1858
+ _this3.onSuggestionsClearRequested();
1859
+ }
1860
+ },
1861
+ onChange: function onChange(event) {
1862
+ var value = event.target.value;
1863
+ var shouldRender = shouldRenderSuggestions(value, REASON_INPUT_CHANGED);
1864
+
1865
+ _this3.maybeCallOnChange(event, value, 'type');
1866
+
1867
+ if (_this3.suggestionsContainer) {
1868
+ _this3.suggestionsContainer.scrollTop = 0;
1869
+ }
1870
+
1871
+ _this3.setState(_objectSpread({}, highlightFirstSuggestion ? {} : {
1872
+ highlightedSectionIndex: null,
1873
+ highlightedSuggestionIndex: null,
1874
+ highlightedSuggestion: null
1875
+ }, {
1876
+ valueBeforeUpDown: null,
1877
+ isCollapsed: !shouldRender
1878
+ }));
1879
+
1880
+ if (shouldRender) {
1881
+ onSuggestionsFetchRequested({
1882
+ value: value,
1883
+ reason: REASON_INPUT_CHANGED
1884
+ });
1885
+ } else {
1886
+ _this3.onSuggestionsClearRequested();
1887
+ }
1888
+ },
1889
+ onKeyDown: function onKeyDown(event, data) {
1890
+ var keyCode = event.keyCode;
1891
+
1892
+ switch (keyCode) {
1893
+ case 40: // ArrowDown
1894
+
1895
+ case 38:
1896
+ // ArrowUp
1897
+ if (isCollapsed) {
1898
+ if (shouldRenderSuggestions(value, REASON_SUGGESTIONS_REVEALED)) {
1899
+ onSuggestionsFetchRequested({
1900
+ value: value,
1901
+ reason: REASON_SUGGESTIONS_REVEALED
1902
+ });
1903
+
1904
+ _this3.revealSuggestions();
1905
+
1906
+ event.preventDefault(); // We act on the key.
1907
+ }
1908
+ } else if (suggestions.length > 0) {
1909
+ var newHighlightedSectionIndex = data.newHighlightedSectionIndex,
1910
+ newHighlightedItemIndex = data.newHighlightedItemIndex;
1911
+ var newValue;
1912
+
1913
+ if (newHighlightedItemIndex === null) {
1914
+ // valueBeforeUpDown can be null if, for example, user
1915
+ // hovers on the first suggestion and then pressed Up.
1916
+ // If that happens, use the original input value.
1917
+ newValue = valueBeforeUpDown === null ? value : valueBeforeUpDown;
1918
+ } else {
1919
+ newValue = _this3.getSuggestionValueByIndex(newHighlightedSectionIndex, newHighlightedItemIndex);
1920
+ }
1921
+
1922
+ _this3.updateHighlightedSuggestion(newHighlightedSectionIndex, newHighlightedItemIndex, value);
1923
+
1924
+ _this3.maybeCallOnChange(event, newValue, keyCode === 40 ? 'down' : 'up');
1925
+
1926
+ event.preventDefault(); // We act on the key.
1927
+ }
1928
+
1929
+ _this3.justPressedUpDown = true;
1930
+ setTimeout(function () {
1931
+ _this3.justPressedUpDown = false;
1932
+ });
1933
+ break;
1934
+ // Enter
1935
+
1936
+ case 13:
1937
+ {
1938
+ // See #388
1939
+ if (event.keyCode === 229) {
1940
+ break;
1941
+ }
1942
+
1943
+ var highlightedSuggestion = _this3.getHighlightedSuggestion();
1944
+
1945
+ if (isOpen && !alwaysRenderSuggestions) {
1946
+ _this3.closeSuggestions();
1947
+ }
1948
+
1949
+ if (highlightedSuggestion != null) {
1950
+ event.preventDefault();
1951
+
1952
+ var _newValue = getSuggestionValue(highlightedSuggestion);
1953
+
1954
+ _this3.maybeCallOnChange(event, _newValue, 'enter');
1955
+
1956
+ _this3.onSuggestionSelected(event, {
1957
+ suggestion: highlightedSuggestion,
1958
+ suggestionValue: _newValue,
1959
+ suggestionIndex: highlightedSuggestionIndex,
1960
+ sectionIndex: highlightedSectionIndex,
1961
+ method: 'enter'
1962
+ });
1963
+
1964
+ _this3.justSelectedSuggestion = true;
1965
+ setTimeout(function () {
1966
+ _this3.justSelectedSuggestion = false;
1967
+ });
1968
+ }
1969
+
1970
+ break;
1971
+ }
1972
+ // Escape
1973
+
1974
+ case 27:
1975
+ {
1976
+ if (isOpen) {
1977
+ // If input.type === 'search', the browser clears the input
1978
+ // when Escape is pressed. We want to disable this default
1979
+ // behaviour so that, when suggestions are shown, we just hide
1980
+ // them, without clearing the input.
1981
+ event.preventDefault();
1982
+ }
1983
+
1984
+ var willCloseSuggestions = isOpen && !alwaysRenderSuggestions;
1985
+
1986
+ if (valueBeforeUpDown === null) {
1987
+ // Didn't interact with Up/Down
1988
+ if (!willCloseSuggestions) {
1989
+ var _newValue2 = '';
1990
+
1991
+ _this3.maybeCallOnChange(event, _newValue2, 'escape');
1992
+
1993
+ if (shouldRenderSuggestions(_newValue2, REASON_ESCAPE_PRESSED)) {
1994
+ onSuggestionsFetchRequested({
1995
+ value: _newValue2,
1996
+ reason: REASON_ESCAPE_PRESSED
1997
+ });
1998
+ } else {
1999
+ _this3.onSuggestionsClearRequested();
2000
+ }
2001
+ }
2002
+ } else {
2003
+ // Interacted with Up/Down
2004
+ _this3.maybeCallOnChange(event, valueBeforeUpDown, 'escape');
2005
+ }
2006
+
2007
+ if (willCloseSuggestions) {
2008
+ _this3.onSuggestionsClearRequested();
2009
+
2010
+ _this3.closeSuggestions();
2011
+ } else {
2012
+ _this3.resetHighlightedSuggestion();
2013
+ }
2014
+
2015
+ break;
2016
+ }
2017
+ }
2018
+
2019
+ _onKeyDown && _onKeyDown(event);
2020
+ }
2021
+ });
2022
+
2023
+ var renderSuggestionData = {
2024
+ query: this.getQuery()
2025
+ };
2026
+ return /*#__PURE__*/_react["default"].createElement(_Autowhatever["default"], {
2027
+ multiSection: multiSection,
2028
+ items: items,
2029
+ renderInputComponent: renderInputComponent,
2030
+ renderItemsContainer: this.renderSuggestionsContainer,
2031
+ renderItem: renderSuggestion,
2032
+ renderItemData: renderSuggestionData,
2033
+ renderSectionTitle: renderSectionTitle,
2034
+ getSectionItems: getSectionSuggestions,
2035
+ highlightedSectionIndex: highlightedSectionIndex,
2036
+ highlightedItemIndex: highlightedSuggestionIndex,
2037
+ containerProps: containerProps,
2038
+ inputProps: autowhateverInputProps,
2039
+ itemProps: this.itemProps,
2040
+ theme: (0, _theme.mapToAutowhateverTheme)(theme),
2041
+ id: id,
2042
+ ref: this.storeAutowhateverRef
2043
+ });
2044
+ }
2045
+ }]);
2046
+
2047
+ return Autosuggest;
2048
+ }(_react.Component);
2049
+
2050
+ exports["default"] = Autosuggest;
2051
+
2052
+ _defineProperty(Autosuggest, "propTypes", {
2053
+ suggestions: _propTypes["default"].array.isRequired,
2054
+ onSuggestionsFetchRequested: function onSuggestionsFetchRequested(props, propName) {
2055
+ var onSuggestionsFetchRequested = props[propName];
2056
+
2057
+ if (typeof onSuggestionsFetchRequested !== 'function') {
2058
+ throw new Error("'onSuggestionsFetchRequested' must be implemented. See: https://github.com/moroshko/react-autosuggest#onSuggestionsFetchRequestedProp");
2059
+ }
2060
+ },
2061
+ onSuggestionsClearRequested: function onSuggestionsClearRequested(props, propName) {
2062
+ var onSuggestionsClearRequested = props[propName];
2063
+
2064
+ if (props.alwaysRenderSuggestions === false && typeof onSuggestionsClearRequested !== 'function') {
2065
+ throw new Error("'onSuggestionsClearRequested' must be implemented. See: https://github.com/moroshko/react-autosuggest#onSuggestionsClearRequestedProp");
2066
+ }
2067
+ },
2068
+ shouldKeepSuggestionsOnSelect: _propTypes["default"].func,
2069
+ onSuggestionSelected: _propTypes["default"].func,
2070
+ onSuggestionHighlighted: _propTypes["default"].func,
2071
+ renderInputComponent: _propTypes["default"].func,
2072
+ renderSuggestionsContainer: _propTypes["default"].func,
2073
+ getSuggestionValue: _propTypes["default"].func.isRequired,
2074
+ renderSuggestion: _propTypes["default"].func.isRequired,
2075
+ inputProps: function inputProps(props, propName) {
2076
+ var inputProps = props[propName];
2077
+
2078
+ if (!inputProps) {
2079
+ throw new Error("'inputProps' must be passed.");
2080
+ }
2081
+
2082
+ if (!Object.prototype.hasOwnProperty.call(inputProps, 'value')) {
2083
+ throw new Error("'inputProps' must have 'value'.");
2084
+ }
2085
+
2086
+ if (!Object.prototype.hasOwnProperty.call(inputProps, 'onChange')) {
2087
+ throw new Error("'inputProps' must have 'onChange'.");
2088
+ }
2089
+ },
2090
+ shouldRenderSuggestions: _propTypes["default"].func,
2091
+ alwaysRenderSuggestions: _propTypes["default"].bool,
2092
+ multiSection: _propTypes["default"].bool,
2093
+ renderSectionTitle: function renderSectionTitle(props, propName) {
2094
+ var renderSectionTitle = props[propName];
2095
+
2096
+ if (props.multiSection === true && typeof renderSectionTitle !== 'function') {
2097
+ throw new Error("'renderSectionTitle' must be implemented. See: https://github.com/moroshko/react-autosuggest#renderSectionTitleProp");
2098
+ }
2099
+ },
2100
+ getSectionSuggestions: function getSectionSuggestions(props, propName) {
2101
+ var getSectionSuggestions = props[propName];
2102
+
2103
+ if (props.multiSection === true && typeof getSectionSuggestions !== 'function') {
2104
+ throw new Error("'getSectionSuggestions' must be implemented. See: https://github.com/moroshko/react-autosuggest#getSectionSuggestionsProp");
2105
+ }
2106
+ },
2107
+ focusInputOnSuggestionClick: _propTypes["default"].bool,
2108
+ highlightFirstSuggestion: _propTypes["default"].bool,
2109
+ theme: _propTypes["default"].object,
2110
+ id: _propTypes["default"].string,
2111
+ containerProps: _propTypes["default"].object // Arbitrary container props
2112
+
2113
+ });
2114
+
2115
+ _defineProperty(Autosuggest, "defaultProps", {
2116
+ renderSuggestionsContainer: defaultRenderSuggestionsContainer,
2117
+ shouldRenderSuggestions: defaultShouldRenderSuggestions,
2118
+ alwaysRenderSuggestions: false,
2119
+ multiSection: false,
2120
+ shouldKeepSuggestionsOnSelect: function shouldKeepSuggestionsOnSelect() {
2121
+ return false;
2122
+ },
2123
+ focusInputOnSuggestionClick: true,
2124
+ highlightFirstSuggestion: false,
2125
+ theme: _theme.defaultTheme,
2126
+ id: '1',
2127
+ containerProps: {}
2128
+ });
2129
+ }(Autosuggest));
2130
+
2131
+ var dist = Autosuggest["default"];
2132
+
2133
+ var css_248z = "@keyframes style-module_appearInAnimation__yvH4A {\n from {\n opacity: 0;\n transform: translateY(16px);\n }\n to {\n opacity: 1;\n }\n}\n.style-module_suggestionsContainer__2yVXd {\n position: relative;\n}\n\n.style-module_suggestionsList__11o48 {\n position: absolute;\n z-index: 100;\n overflow: hidden;\n border-radius: 8px;\n border: 1px solid var(--ds-primary-500);\n width: 100%;\n height: fit-content;\n max-height: 216px;\n overflow-y: scroll;\n background-color: white;\n animation-name: style-module_appearInAnimation__yvH4A;\n animation-duration: 0.3s;\n animation-fill-mode: both;\n transform: translateY(8px);\n}\n\n.style-module_suggestion-option__z7pqG {\n display: flex;\n align-items: center;\n cursor: pointer;\n position: relative;\n margin: 0;\n padding: 12px 16px;\n color: var(--ds-grey-900);\n min-height: 48px;\n line-height: 24px;\n}\n\n.style-module_suggestion-img__1TfiA {\n width: 32px;\n height: 24px;\n border-radius: 2px;\n}\n\n.style-module_suggestion-text__7wL31 {\n flex: 1;\n}\n\n.style-module_nowrap__uks9c {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.style-module_suggestionHighlighted__2zu5h {\n background-color: var(--ds-primary-100);\n}";
2134
+ var styles = {"suggestionsContainer":"style-module_suggestionsContainer__2yVXd","suggestionsList":"style-module_suggestionsList__11o48","appearInAnimation":"style-module_appearInAnimation__yvH4A","suggestion-option":"style-module_suggestion-option__z7pqG","suggestion-img":"style-module_suggestion-img__1TfiA","suggestion-text":"style-module_suggestion-text__7wL31","nowrap":"style-module_nowrap__uks9c","suggestionHighlighted":"style-module_suggestionHighlighted__2zu5h"};
2135
+ styleInject(css_248z);
2136
+
2137
+ var AutoSuggestInput = (function (_a) {
2138
+ var currentOption = _a.currentOption, suggestions = _a.suggestions, handleSuggestionSelected = _a.handleSuggestionSelected, onChange = _a.onChange, handleSuggestionFetchRequest = _a.handleSuggestionFetchRequest, handleSuggestionClearRequest = _a.handleSuggestionClearRequest, placeholder = _a.placeholder, className = _a.className, wrapText = _a.wrapText;
2139
+ var renderSuggestion = function (suggestion) {
2140
+ var _a;
2141
+ return (jsxs("div", __assign({ className: "" + styles['suggestion-option'] }, { children: [suggestion.leftIcon && (jsx("img", { className: "mr16 " + styles['suggestion-img'], src: suggestion.leftIcon, alt: suggestion.value }, void 0)),
2142
+ jsx("div", __assign({ className: classnames(styles['suggestion-text'], (_a = {},
2143
+ _a[styles.nowrap] = !wrapText,
2144
+ _a)) }, { children: suggestion.value }), void 0)] }), void 0));
2145
+ };
2146
+ var getSuggestionValue = function (suggestion) { return suggestion.value; };
2147
+ var renderInputComponent = function (inputProps) { return (jsx(Input, __assign({}, inputProps, { placeholder: placeholder, "data-cy": "suggest-multi-select-input" }), void 0)); };
2148
+ return (jsx("div", __assign({ className: className }, { children: jsx(dist, { theme: styles, suggestions: suggestions, onSuggestionsFetchRequested: handleSuggestionFetchRequest, onSuggestionsClearRequested: handleSuggestionClearRequest, getSuggestionValue: getSuggestionValue, renderSuggestion: renderSuggestion, highlightFirstSuggestion: true, inputProps: {
2149
+ value: currentOption,
2150
+ onChange: function (_, _a) {
2151
+ var newValue = _a.newValue;
2152
+ onChange(newValue);
2153
+ },
2154
+ }, onSuggestionSelected: function (_, _a) {
2155
+ var suggestion = _a.suggestion;
2156
+ handleSuggestionSelected(suggestion);
2157
+ }, renderInputComponent: renderInputComponent }, void 0) }), void 0));
2158
+ });
2159
+
2160
+ export default AutoSuggestInput;
2161
+ //# sourceMappingURL=index.js.map