@jetbrains/ring-ui-built 6.0.5-beta.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 (445) hide show
  1. package/LICENSE.txt +202 -0
  2. package/README.md +99 -0
  3. package/babel.config.js +25 -0
  4. package/components/_helpers/_rollupPluginBabelHelpers.js +648 -0
  5. package/components/_helpers/anchor.js +31 -0
  6. package/components/_helpers/badge.js +3 -0
  7. package/components/_helpers/button__classes.js +34 -0
  8. package/components/_helpers/caption.js +31 -0
  9. package/components/_helpers/card.js +132 -0
  10. package/components/_helpers/date-picker.js +3 -0
  11. package/components/_helpers/dialog__body-scroll-preventer.js +54 -0
  12. package/components/_helpers/grid.js +3 -0
  13. package/components/_helpers/header.js +3 -0
  14. package/components/_helpers/heading.js +3 -0
  15. package/components/_helpers/icon__svg.js +75 -0
  16. package/components/_helpers/input.js +235 -0
  17. package/components/_helpers/island.js +3 -0
  18. package/components/_helpers/link.js +3 -0
  19. package/components/_helpers/list.js +3 -0
  20. package/components/_helpers/query-assist__suggestions.js +102 -0
  21. package/components/_helpers/select__filter.js +94 -0
  22. package/components/_helpers/services-link.js +48 -0
  23. package/components/_helpers/sidebar.js +123 -0
  24. package/components/_helpers/tab-link.js +34 -0
  25. package/components/_helpers/table.js +3 -0
  26. package/components/_helpers/theme.js +95 -0
  27. package/components/_helpers/title.js +103 -0
  28. package/components/alert/alert.d.ts +113 -0
  29. package/components/alert/alert.js +292 -0
  30. package/components/alert/container.d.ts +15 -0
  31. package/components/alert/container.js +52 -0
  32. package/components/alert-service/alert-service.d.ts +36 -0
  33. package/components/alert-service/alert-service.js +218 -0
  34. package/components/analytics/analytics.d.ts +18 -0
  35. package/components/analytics/analytics.js +31 -0
  36. package/components/analytics/analytics__custom-plugin.d.ts +28 -0
  37. package/components/analytics/analytics__custom-plugin.js +90 -0
  38. package/components/auth/auth.d.ts +3 -0
  39. package/components/auth/auth.js +130 -0
  40. package/components/auth/auth__core.d.ts +236 -0
  41. package/components/auth/auth__core.js +1650 -0
  42. package/components/auth/background-flow.d.ts +31 -0
  43. package/components/auth/background-flow.js +146 -0
  44. package/components/auth/down-notification.d.ts +15 -0
  45. package/components/auth/down-notification.js +155 -0
  46. package/components/auth/iframe-flow.d.ts +20 -0
  47. package/components/auth/iframe-flow.js +192 -0
  48. package/components/auth/request-builder.d.ts +47 -0
  49. package/components/auth/request-builder.js +101 -0
  50. package/components/auth/response-parser.d.ts +70 -0
  51. package/components/auth/response-parser.js +137 -0
  52. package/components/auth/storage.d.ts +112 -0
  53. package/components/auth/storage.js +422 -0
  54. package/components/auth/token-validator.d.ts +93 -0
  55. package/components/auth/token-validator.js +267 -0
  56. package/components/auth/window-flow.d.ts +26 -0
  57. package/components/auth/window-flow.js +153 -0
  58. package/components/auth-dialog/auth-dialog.d.ts +60 -0
  59. package/components/auth-dialog/auth-dialog.js +219 -0
  60. package/components/auth-dialog-service/auth-dialog-service.d.ts +6 -0
  61. package/components/auth-dialog-service/auth-dialog-service.js +90 -0
  62. package/components/avatar/avatar-example-datauri.d.ts +1 -0
  63. package/components/avatar/avatar-example-datauri.js +4 -0
  64. package/components/avatar/avatar.d.ts +52 -0
  65. package/components/avatar/avatar.js +180 -0
  66. package/components/avatar/fallback-avatar.d.ts +17 -0
  67. package/components/avatar/fallback-avatar.js +150 -0
  68. package/components/badge/badge.d.ts +24 -0
  69. package/components/badge/badge.js +59 -0
  70. package/components/button/button.d.ts +67 -0
  71. package/components/button/button.js +131 -0
  72. package/components/button/button__classes.d.ts +2 -0
  73. package/components/button/button__classes.js +2 -0
  74. package/components/button-group/button-group.d.ts +18 -0
  75. package/components/button-group/button-group.js +48 -0
  76. package/components/button-group/caption.d.ts +8 -0
  77. package/components/button-group/caption.js +5 -0
  78. package/components/button-set/button-set.d.ts +16 -0
  79. package/components/button-set/button-set.js +47 -0
  80. package/components/button-toolbar/button-toolbar.d.ts +16 -0
  81. package/components/button-toolbar/button-toolbar.js +46 -0
  82. package/components/caret/caret.d.ts +66 -0
  83. package/components/caret/caret.js +258 -0
  84. package/components/checkbox/checkbox.d.ts +45 -0
  85. package/components/checkbox/checkbox.js +130 -0
  86. package/components/clipboard/clipboard-fallback.d.ts +2 -0
  87. package/components/clipboard/clipboard-fallback.js +42 -0
  88. package/components/clipboard/clipboard.d.ts +5 -0
  89. package/components/clipboard/clipboard.js +183 -0
  90. package/components/code/code.d.ts +43 -0
  91. package/components/code/code.js +192 -0
  92. package/components/confirm/confirm.d.ts +48 -0
  93. package/components/confirm/confirm.js +151 -0
  94. package/components/confirm-service/confirm-service.d.ts +21 -0
  95. package/components/confirm-service/confirm-service.js +139 -0
  96. package/components/content-layout/content-layout.d.ts +26 -0
  97. package/components/content-layout/content-layout.js +79 -0
  98. package/components/content-layout/sidebar.d.ts +31 -0
  99. package/components/content-layout/sidebar.js +7 -0
  100. package/components/contenteditable/contenteditable.d.ts +47 -0
  101. package/components/contenteditable/contenteditable.js +84 -0
  102. package/components/control-label/control-label.d.ts +11 -0
  103. package/components/control-label/control-label.js +36 -0
  104. package/components/data-list/data-list.d.ts +85 -0
  105. package/components/data-list/data-list.js +246 -0
  106. package/components/data-list/data-list.mock.d.ts +16 -0
  107. package/components/data-list/data-list.mock.js +192 -0
  108. package/components/data-list/item.d.ts +50 -0
  109. package/components/data-list/item.js +234 -0
  110. package/components/data-list/selection.d.ts +16 -0
  111. package/components/data-list/selection.js +146 -0
  112. package/components/data-list/title.d.ts +26 -0
  113. package/components/data-list/title.js +28 -0
  114. package/components/date-picker/consts.d.ts +98 -0
  115. package/components/date-picker/consts.js +46 -0
  116. package/components/date-picker/date-input.d.ts +47 -0
  117. package/components/date-picker/date-input.js +177 -0
  118. package/components/date-picker/date-picker.d.ts +77 -0
  119. package/components/date-picker/date-picker.js +402 -0
  120. package/components/date-picker/date-popup.d.ts +55 -0
  121. package/components/date-picker/date-popup.js +488 -0
  122. package/components/date-picker/day.d.ts +30 -0
  123. package/components/date-picker/day.js +133 -0
  124. package/components/date-picker/formats.d.ts +2 -0
  125. package/components/date-picker/formats.js +3 -0
  126. package/components/date-picker/month-names.d.ts +13 -0
  127. package/components/date-picker/month-names.js +110 -0
  128. package/components/date-picker/month-slider.d.ts +29 -0
  129. package/components/date-picker/month-slider.js +93 -0
  130. package/components/date-picker/month.d.ts +14 -0
  131. package/components/date-picker/month.js +58 -0
  132. package/components/date-picker/months.d.ts +11 -0
  133. package/components/date-picker/months.js +133 -0
  134. package/components/date-picker/weekdays.d.ts +13 -0
  135. package/components/date-picker/weekdays.js +39 -0
  136. package/components/date-picker/years.d.ts +25 -0
  137. package/components/date-picker/years.js +134 -0
  138. package/components/dialog/dialog.d.ts +64 -0
  139. package/components/dialog/dialog.js +238 -0
  140. package/components/dialog/dialog__body-scroll-preventer.d.ts +9 -0
  141. package/components/dialog/dialog__body-scroll-preventer.js +6 -0
  142. package/components/dropdown/anchor.d.ts +11 -0
  143. package/components/dropdown/anchor.js +24 -0
  144. package/components/dropdown/dropdown.d.ts +87 -0
  145. package/components/dropdown/dropdown.js +247 -0
  146. package/components/dropdown-menu/dropdown-menu.d.ts +36 -0
  147. package/components/dropdown-menu/dropdown-menu.js +194 -0
  148. package/components/editable-heading/editable-heading.d.ts +32 -0
  149. package/components/editable-heading/editable-heading.js +245 -0
  150. package/components/error-bubble/error-bubble.d.ts +18 -0
  151. package/components/error-bubble/error-bubble.js +86 -0
  152. package/components/error-message/error-message.d.ts +27 -0
  153. package/components/error-message/error-message.js +78 -0
  154. package/components/footer/footer.d.ts +28 -0
  155. package/components/footer/footer.js +118 -0
  156. package/components/global/compose.d.ts +7 -0
  157. package/components/global/compose.js +17 -0
  158. package/components/global/composeRefs.d.ts +3 -0
  159. package/components/global/composeRefs.js +19 -0
  160. package/components/global/controls-height.d.ts +9 -0
  161. package/components/global/controls-height.js +19 -0
  162. package/components/global/create-stateful-context.d.ts +27 -0
  163. package/components/global/create-stateful-context.js +49 -0
  164. package/components/global/data-tests.d.ts +3 -0
  165. package/components/global/data-tests.js +30 -0
  166. package/components/global/dom.d.ts +37 -0
  167. package/components/global/dom.js +150 -0
  168. package/components/global/focus-sensor-hoc.d.ts +19 -0
  169. package/components/global/focus-sensor-hoc.js +165 -0
  170. package/components/global/fuzzy-highlight.d.ts +11 -0
  171. package/components/global/fuzzy-highlight.js +90 -0
  172. package/components/global/get-event-key.d.ts +2 -0
  173. package/components/global/get-event-key.js +101 -0
  174. package/components/global/get-uid.d.ts +1 -0
  175. package/components/global/get-uid.js +22 -0
  176. package/components/global/inject-styles.d.ts +3 -0
  177. package/components/global/inject-styles.js +22 -0
  178. package/components/global/linear-function.d.ts +6 -0
  179. package/components/global/linear-function.js +15 -0
  180. package/components/global/listeners.d.ts +8 -0
  181. package/components/global/listeners.js +58 -0
  182. package/components/global/memoize.d.ts +1 -0
  183. package/components/global/memoize.js +23 -0
  184. package/components/global/normalize-indent.d.ts +1 -0
  185. package/components/global/normalize-indent.js +61 -0
  186. package/components/global/promise-with-timeout.d.ts +5 -0
  187. package/components/global/promise-with-timeout.js +19 -0
  188. package/components/global/prop-types.d.ts +4 -0
  189. package/components/global/prop-types.js +9 -0
  190. package/components/global/react-dom-renderer.d.ts +16 -0
  191. package/components/global/react-dom-renderer.js +53 -0
  192. package/components/global/react-render-adapter.d.ts +1 -0
  193. package/components/global/react-render-adapter.js +6 -0
  194. package/components/global/rerender-hoc.d.ts +10 -0
  195. package/components/global/rerender-hoc.js +46 -0
  196. package/components/global/schedule-raf.d.ts +1 -0
  197. package/components/global/schedule-raf.js +28 -0
  198. package/components/global/sniffer.d.ts +3 -0
  199. package/components/global/sniffer.js +6 -0
  200. package/components/global/theme.d.ts +21 -0
  201. package/components/global/theme.js +40 -0
  202. package/components/global/trivial-template-tag.d.ts +1 -0
  203. package/components/global/trivial-template-tag.js +21 -0
  204. package/components/global/typescript-utils.d.ts +2 -0
  205. package/components/global/typescript-utils.js +8 -0
  206. package/components/global/url.d.ts +57 -0
  207. package/components/global/url.js +141 -0
  208. package/components/global/use-event-callback.d.ts +1 -0
  209. package/components/global/use-event-callback.js +17 -0
  210. package/components/global/variables.d.ts +89 -0
  211. package/components/global/variables.js +1 -0
  212. package/components/grid/col.d.ts +31 -0
  213. package/components/grid/col.js +81 -0
  214. package/components/grid/grid.d.ts +14 -0
  215. package/components/grid/grid.js +47 -0
  216. package/components/grid/row.d.ts +40 -0
  217. package/components/grid/row.js +70 -0
  218. package/components/group/group.d.ts +12 -0
  219. package/components/group/group.js +39 -0
  220. package/components/header/header.d.ts +34 -0
  221. package/components/header/header.js +184 -0
  222. package/components/header/logo.d.ts +14 -0
  223. package/components/header/logo.js +51 -0
  224. package/components/header/profile.d.ts +75 -0
  225. package/components/header/profile.js +252 -0
  226. package/components/header/services-link.d.ts +25 -0
  227. package/components/header/services-link.js +13 -0
  228. package/components/header/services.d.ts +33 -0
  229. package/components/header/services.js +172 -0
  230. package/components/header/smart-profile.d.ts +36 -0
  231. package/components/header/smart-profile.js +298 -0
  232. package/components/header/smart-services.d.ts +26 -0
  233. package/components/header/smart-services.js +189 -0
  234. package/components/header/tray-icon.d.ts +32 -0
  235. package/components/header/tray-icon.js +57 -0
  236. package/components/header/tray.d.ts +9 -0
  237. package/components/header/tray.js +41 -0
  238. package/components/heading/heading.d.ts +25 -0
  239. package/components/heading/heading.js +69 -0
  240. package/components/http/http.d.ts +61 -0
  241. package/components/http/http.js +385 -0
  242. package/components/http/http.mock.d.ts +20 -0
  243. package/components/http/http.mock.js +112 -0
  244. package/components/hub-source/hub-source.d.ts +44 -0
  245. package/components/hub-source/hub-source.js +215 -0
  246. package/components/hub-source/hub-source__user.d.ts +4 -0
  247. package/components/hub-source/hub-source__user.js +59 -0
  248. package/components/hub-source/hub-source__users-groups.d.ts +24 -0
  249. package/components/hub-source/hub-source__users-groups.js +84 -0
  250. package/components/i18n/i18n-context.d.ts +13 -0
  251. package/components/i18n/i18n-context.js +27 -0
  252. package/components/i18n/i18n.d.ts +59 -0
  253. package/components/i18n/i18n.js +139 -0
  254. package/components/icon/icon.d.ts +43 -0
  255. package/components/icon/icon.js +109 -0
  256. package/components/icon/icon__constants.d.ts +30 -0
  257. package/components/icon/icon__constants.js +34 -0
  258. package/components/icon/icon__svg.d.ts +15 -0
  259. package/components/icon/icon__svg.js +14 -0
  260. package/components/icon/index.d.ts +2 -0
  261. package/components/icon/index.js +17 -0
  262. package/components/input/input.d.ts +77 -0
  263. package/components/input/input.js +35 -0
  264. package/components/island/adaptive-island-hoc.d.ts +61 -0
  265. package/components/island/adaptive-island-hoc.js +53 -0
  266. package/components/island/content.d.ts +43 -0
  267. package/components/island/content.js +151 -0
  268. package/components/island/header.d.ts +8 -0
  269. package/components/island/header.js +99 -0
  270. package/components/island/island.d.ts +78 -0
  271. package/components/island/island.js +60 -0
  272. package/components/island-legacy/content-legacy.d.ts +10 -0
  273. package/components/island-legacy/content-legacy.js +34 -0
  274. package/components/island-legacy/header-legacy.d.ts +10 -0
  275. package/components/island-legacy/header-legacy.js +36 -0
  276. package/components/island-legacy/island-legacy.d.ts +12 -0
  277. package/components/island-legacy/island-legacy.js +36 -0
  278. package/components/link/clickableLink.d.ts +20 -0
  279. package/components/link/clickableLink.js +69 -0
  280. package/components/link/link.d.ts +138 -0
  281. package/components/link/link.js +86 -0
  282. package/components/list/consts.d.ts +77 -0
  283. package/components/list/consts.js +27 -0
  284. package/components/list/list.d.ts +206 -0
  285. package/components/list/list.js +795 -0
  286. package/components/list/list__custom.d.ts +6 -0
  287. package/components/list/list__custom.js +92 -0
  288. package/components/list/list__hint.d.ts +15 -0
  289. package/components/list/list__hint.js +33 -0
  290. package/components/list/list__item.d.ts +8 -0
  291. package/components/list/list__item.js +234 -0
  292. package/components/list/list__link.d.ts +9 -0
  293. package/components/list/list__link.js +76 -0
  294. package/components/list/list__separator.d.ts +5 -0
  295. package/components/list/list__separator.js +39 -0
  296. package/components/list/list__title.d.ts +5 -0
  297. package/components/list/list__title.js +48 -0
  298. package/components/list/list__users-groups-source.d.ts +27 -0
  299. package/components/list/list__users-groups-source.js +190 -0
  300. package/components/loader/loader.d.ts +28 -0
  301. package/components/loader/loader.js +91 -0
  302. package/components/loader/loader__core.d.ts +75 -0
  303. package/components/loader/loader__core.js +313 -0
  304. package/components/loader-inline/loader-inline.d.ts +18 -0
  305. package/components/loader-inline/loader-inline.js +50 -0
  306. package/components/loader-screen/loader-screen.d.ts +17 -0
  307. package/components/loader-screen/loader-screen.js +62 -0
  308. package/components/login-dialog/login-dialog.d.ts +47 -0
  309. package/components/login-dialog/login-dialog.js +212 -0
  310. package/components/login-dialog/service.d.ts +2 -0
  311. package/components/login-dialog/service.js +94 -0
  312. package/components/markdown/markdown.d.ts +12 -0
  313. package/components/markdown/markdown.js +43 -0
  314. package/components/message/message.d.ts +55 -0
  315. package/components/message/message.js +265 -0
  316. package/components/old-browsers-message/old-browsers-message.d.ts +2 -0
  317. package/components/old-browsers-message/old-browsers-message.js +92 -0
  318. package/components/old-browsers-message/old-browsers-message__stop.d.ts +1 -0
  319. package/components/old-browsers-message/old-browsers-message__stop.js +11 -0
  320. package/components/old-browsers-message/white-list.d.ts +2 -0
  321. package/components/old-browsers-message/white-list.js +37 -0
  322. package/components/pager/pager.d.ts +78 -0
  323. package/components/pager/pager.js +385 -0
  324. package/components/panel/panel.d.ts +12 -0
  325. package/components/panel/panel.js +39 -0
  326. package/components/permissions/permissions.d.ts +111 -0
  327. package/components/permissions/permissions.js +220 -0
  328. package/components/permissions/permissions__cache.d.ts +93 -0
  329. package/components/permissions/permissions__cache.js +257 -0
  330. package/components/popup/popup.consts.d.ts +37 -0
  331. package/components/popup/popup.consts.js +44 -0
  332. package/components/popup/popup.d.ts +147 -0
  333. package/components/popup/popup.js +419 -0
  334. package/components/popup/popup.target.d.ts +7 -0
  335. package/components/popup/popup.target.js +24 -0
  336. package/components/popup/position.d.ts +30 -0
  337. package/components/popup/position.js +270 -0
  338. package/components/popup-menu/popup-menu.d.ts +80 -0
  339. package/components/popup-menu/popup-menu.js +136 -0
  340. package/components/progress-bar/progress-bar.d.ts +58 -0
  341. package/components/progress-bar/progress-bar.js +113 -0
  342. package/components/query-assist/query-assist.d.ts +306 -0
  343. package/components/query-assist/query-assist.js +1092 -0
  344. package/components/query-assist/query-assist__suggestions.d.ts +29 -0
  345. package/components/query-assist/query-assist__suggestions.js +70 -0
  346. package/components/radio/radio.d.ts +18 -0
  347. package/components/radio/radio.js +48 -0
  348. package/components/radio/radio__item.d.ts +28 -0
  349. package/components/radio/radio__item.js +88 -0
  350. package/components/select/select.d.ts +276 -0
  351. package/components/select/select.js +1285 -0
  352. package/components/select/select__filter.d.ts +19 -0
  353. package/components/select/select__filter.js +80 -0
  354. package/components/select/select__popup.d.ts +166 -0
  355. package/components/select/select__popup.js +626 -0
  356. package/components/shortcuts/core.d.ts +74 -0
  357. package/components/shortcuts/core.js +247 -0
  358. package/components/shortcuts/shortcut-title.d.ts +1 -0
  359. package/components/shortcuts/shortcut-title.js +56 -0
  360. package/components/shortcuts/shortcuts-hoc.d.ts +65 -0
  361. package/components/shortcuts/shortcuts-hoc.js +59 -0
  362. package/components/shortcuts/shortcuts.d.ts +28 -0
  363. package/components/shortcuts/shortcuts.js +90 -0
  364. package/components/storage/storage.d.ts +18 -0
  365. package/components/storage/storage.js +89 -0
  366. package/components/storage/storage__fallback.d.ts +79 -0
  367. package/components/storage/storage__fallback.js +251 -0
  368. package/components/storage/storage__local.d.ts +38 -0
  369. package/components/storage/storage__local.js +215 -0
  370. package/components/style.css +1 -0
  371. package/components/tab-trap/tab-trap.d.ts +43 -0
  372. package/components/tab-trap/tab-trap.js +179 -0
  373. package/components/table/cell.d.ts +13 -0
  374. package/components/table/cell.js +37 -0
  375. package/components/table/disable-hover-hoc.d.ts +64 -0
  376. package/components/table/disable-hover-hoc.js +62 -0
  377. package/components/table/header-cell.d.ts +43 -0
  378. package/components/table/header-cell.js +109 -0
  379. package/components/table/header.d.ts +56 -0
  380. package/components/table/header.js +151 -0
  381. package/components/table/multitable.d.ts +25 -0
  382. package/components/table/multitable.js +139 -0
  383. package/components/table/row-with-focus-sensor.d.ts +18 -0
  384. package/components/table/row-with-focus-sensor.js +115 -0
  385. package/components/table/row.d.ts +59 -0
  386. package/components/table/row.js +297 -0
  387. package/components/table/selection-adapter.d.ts +5 -0
  388. package/components/table/selection-adapter.js +14 -0
  389. package/components/table/selection-shortcuts-hoc.d.ts +17 -0
  390. package/components/table/selection-shortcuts-hoc.js +204 -0
  391. package/components/table/selection.d.ts +47 -0
  392. package/components/table/selection.js +256 -0
  393. package/components/table/smart-table.d.ts +64 -0
  394. package/components/table/smart-table.js +145 -0
  395. package/components/table/table.d.ts +159 -0
  396. package/components/table/table.js +459 -0
  397. package/components/tabs/collapsible-more.d.ts +29 -0
  398. package/components/tabs/collapsible-more.js +217 -0
  399. package/components/tabs/collapsible-tab.d.ts +16 -0
  400. package/components/tabs/collapsible-tab.js +88 -0
  401. package/components/tabs/collapsible-tabs.d.ts +43 -0
  402. package/components/tabs/collapsible-tabs.js +349 -0
  403. package/components/tabs/custom-item.d.ts +9 -0
  404. package/components/tabs/custom-item.js +11 -0
  405. package/components/tabs/dumb-tabs.d.ts +35 -0
  406. package/components/tabs/dumb-tabs.js +184 -0
  407. package/components/tabs/smart-tabs.d.ts +20 -0
  408. package/components/tabs/smart-tabs.js +136 -0
  409. package/components/tabs/tab-link.d.ts +18 -0
  410. package/components/tabs/tab-link.js +13 -0
  411. package/components/tabs/tab.d.ts +27 -0
  412. package/components/tabs/tab.js +41 -0
  413. package/components/tabs/tabs.d.ts +7 -0
  414. package/components/tabs/tabs.js +94 -0
  415. package/components/tag/tag.d.ts +64 -0
  416. package/components/tag/tag.js +213 -0
  417. package/components/tags-input/tags-input.d.ts +138 -0
  418. package/components/tags-input/tags-input.js +529 -0
  419. package/components/tags-list/tags-list.d.ts +46 -0
  420. package/components/tags-list/tags-list.js +102 -0
  421. package/components/text/text.d.ts +23 -0
  422. package/components/text/text.js +57 -0
  423. package/components/toggle/toggle.d.ts +39 -0
  424. package/components/toggle/toggle.js +86 -0
  425. package/components/tooltip/tooltip.d.ts +65 -0
  426. package/components/tooltip/tooltip.js +227 -0
  427. package/components/user-agreement/service.d.ts +69 -0
  428. package/components/user-agreement/service.js +484 -0
  429. package/components/user-agreement/toolbox.eula.d.ts +2 -0
  430. package/components/user-agreement/toolbox.eula.js +3 -0
  431. package/components/user-agreement/user-agreement.d.ts +60 -0
  432. package/components/user-agreement/user-agreement.js +170 -0
  433. package/components/user-card/card.d.ts +70 -0
  434. package/components/user-card/card.js +76 -0
  435. package/components/user-card/smart-user-card-tooltip.d.ts +20 -0
  436. package/components/user-card/smart-user-card-tooltip.js +168 -0
  437. package/components/user-card/tooltip.d.ts +36 -0
  438. package/components/user-card/tooltip.js +140 -0
  439. package/components/user-card/user-card.d.ts +11 -0
  440. package/components/user-card/user-card.js +81 -0
  441. package/jslint-xml.js +38 -0
  442. package/package.json +127 -0
  443. package/postcss.config.js +20 -0
  444. package/typings.d.ts +97 -0
  445. package/webpack.config.js +118 -0
@@ -0,0 +1,1092 @@
1
+ import { _ as _defineProperty, a as _inherits, b as _createSuper, c as _classCallCheck, k as _assertThisInitialized, l as _toConsumableArray, n as _get, o as _getPrototypeOf, e as _objectWithoutProperties, d as _createClass } from '../_helpers/_rollupPluginBabelHelpers.js';
2
+ import 'core-js/modules/es.regexp.exec.js';
3
+ import 'core-js/modules/es.string.replace.js';
4
+ import 'core-js/modules/es.object.to-string.js';
5
+ import 'core-js/modules/web.dom-collections.for-each.js';
6
+ import 'core-js/modules/es.array.filter.js';
7
+ import 'core-js/modules/es.array.splice.js';
8
+ import 'core-js/modules/es.promise.js';
9
+ import 'core-js/modules/es.symbol.js';
10
+ import 'core-js/modules/es.symbol.description.js';
11
+ import 'core-js/modules/es.array.map.js';
12
+ import React, { Component } from 'react';
13
+ import PropTypes from 'prop-types';
14
+ import debounce from 'just-debounce-it';
15
+ import classNames from 'classnames';
16
+ import deepEqual from 'deep-equal';
17
+ import searchIcon from '@jetbrains/icons/search';
18
+ import closeIcon from '@jetbrains/icons/close-12px';
19
+ import getUID from '../global/get-uid.js';
20
+ import joinDataTestAttributes from '../global/data-tests.js';
21
+ import { preventDefault, getRect } from '../global/dom.js';
22
+ import Caret from '../caret/caret.js';
23
+ import ContentEditable from '../contenteditable/contenteditable.js';
24
+ import PopupMenu from '../popup-menu/popup-menu.js';
25
+ import LoaderInline from '../loader-inline/loader-inline.js';
26
+ import Shortcuts from '../shortcuts/shortcuts.js';
27
+ import rerenderHOC from '../global/rerender-hoc.js';
28
+ import { Button } from '../button/button.js';
29
+ import Icon from '../icon/icon.js';
30
+ import { ControlsHeightContext, ControlsHeight } from '../global/controls-height.js';
31
+ import { S as Size, m as modules_88cfaf40 } from '../_helpers/input.js';
32
+ import { I18nContext } from '../i18n/i18n-context.js';
33
+ import { Q as QueryAssistSuggestions, m as modules_da7ab055 } from '../_helpers/query-assist__suggestions.js';
34
+ import 'core-js/modules/es.regexp.to-string.js';
35
+ import 'core-js/modules/es.array.concat.js';
36
+ import 'core-js/modules/es.array.reduce.js';
37
+ import 'core-js/modules/es.object.entries.js';
38
+ import 'core-js/modules/es.string.split.js';
39
+ import 'core-js/modules/es.array.iterator.js';
40
+ import 'core-js/modules/es.set.js';
41
+ import 'core-js/modules/web.dom-collections.iterator.js';
42
+ import 'react-dom/server';
43
+ import '../popup/popup.js';
44
+ import 'react-dom';
45
+ import '../global/schedule-raf.js';
46
+ import '../tab-trap/tab-trap.js';
47
+ import '../popup/position.js';
48
+ import 'core-js/modules/es.array.includes.js';
49
+ import 'core-js/modules/es.string.includes.js';
50
+ import 'core-js/modules/es.array.sort.js';
51
+ import '../popup/popup.consts.js';
52
+ import '../popup/popup.target.js';
53
+ import '../list/list.js';
54
+ import 'react-virtualized/dist/es/List';
55
+ import 'react-virtualized/dist/es/AutoSizer';
56
+ import 'react-virtualized/dist/es/WindowScroller';
57
+ import 'react-virtualized/dist/es/CellMeasurer';
58
+ import 'util-deprecate';
59
+ import 'memoize-one';
60
+ import '../global/memoize.js';
61
+ import 'core-js/modules/es.map.js';
62
+ import 'core-js/modules/es.weak-map.js';
63
+ import '../global/create-stateful-context.js';
64
+ import '../list/list__link.js';
65
+ import '../link/link.js';
66
+ import '../link/clickableLink.js';
67
+ import '../_helpers/link.js';
68
+ import '../_helpers/list.js';
69
+ import '../list/list__item.js';
70
+ import '../avatar/avatar.js';
71
+ import '../global/url.js';
72
+ import 'core-js/modules/es.string.match.js';
73
+ import '../avatar/fallback-avatar.js';
74
+ import 'core-js/modules/es.array.slice.js';
75
+ import '../checkbox/checkbox.js';
76
+ import '@jetbrains/icons/checkmark-14px';
77
+ import '@jetbrains/icons/remove-14px';
78
+ import '../global/prop-types.js';
79
+ import '../global/composeRefs.js';
80
+ import '../list/list__custom.js';
81
+ import '../global/get-event-key.js';
82
+ import '../list/list__title.js';
83
+ import '../list/list__separator.js';
84
+ import '../list/list__hint.js';
85
+ import '../list/consts.js';
86
+ import '../shortcuts/core.js';
87
+ import 'combokeys';
88
+ import '../global/sniffer.js';
89
+ import 'sniffr';
90
+ import '../icon/icon__constants.js';
91
+ import '../_helpers/icon__svg.js';
92
+ import 'core-js/modules/es.string.starts-with.js';
93
+ import '@jetbrains/icons/chevron-10px';
94
+ import '../_helpers/button__classes.js';
95
+ import 'core-js/modules/es.object.values.js';
96
+ import '../control-label/control-label.js';
97
+ import '../i18n/i18n.js';
98
+
99
+ var _excluded = ["suggestions"];
100
+ var POPUP_COMPENSATION = PopupMenu.ListProps.Dimension.ITEM_PADDING + PopupMenu.PopupProps.Dimension.BORDER_WIDTH;
101
+ var ngModelStateField = 'query';
102
+ function noop() {}
103
+ function cleanText(text) {
104
+ return text.replace(/([\n\r])+/g, ' ');
105
+ }
106
+ /**
107
+ * @name Query Assist
108
+ */
109
+ /**
110
+ * ## Data source function
111
+
112
+ Component class calls a data source function when user input happens and passes an object with fields \`caret\`, \`focus\` and \`query\` as the only argument.
113
+ The function must return an object with the fields described below. The object can be optionally wrapped in a Promise.
114
+
115
+ ### Return object fields
116
+
117
+ \`caret\` and \`query\` should just return server values provided to data source function.
118
+ These fields allow the Query Assist component to recognise and drop earlier responses from the server.
119
+
120
+ + __caret__ (\`string=0\`) Caret from request
121
+ + __query__ (\`string=''\`) Query from request
122
+ + __styleRanges__ (\`Array<suggestion>=\`) Array of \`styleRange\` objects, used to highlight the request in the input field
123
+ + __suggestions__ (\`Array<styleRange>\`) Array of \`suggestion\` objects to show.
124
+
125
+ ### **styleRange** object fields
126
+
127
+ start \`number\` Range start (in characters)
128
+ length \`number\` Range length (in characters)
129
+ style \`string\` Style of the range. Possible values: \`text\`, \`field_value\`, \`field_name\`, \`operator\`
130
+
131
+ ### **suggestion** object fields
132
+
133
+ + __prefix__ \`string=\` Suggestion option prefix
134
+ + __option__ \`string\` Suggestion option
135
+ + __suffix__ \`string=\` Suggestion option suffix
136
+ + __description__ \`string=\` Suggestion option description. Is not visible when a group is set
137
+ + __matchingStart__ \`number\` (required when matchingEnd is set) Start of the highlighted part of an option in the suggestions list (in characters)
138
+ + __matchingEnd__ \`number\` (required when matchingEnd is set) End of the highlighted part of an option in the suggestions list (in characters)
139
+ + __caret__ \`number\` Caret position after option completion (in characters)
140
+ + __completionStart__ \`number\` Where to start insertion (or replacement, when completing with the \`Tab\` key) of the completion option (in characters)
141
+ + __completionEnd__ \`number\` Where to end insertion of the completion option (in characters)
142
+ + __group__ \`string=\` Group title. Options with the same title are grouped under it
143
+ + __icon__ \`string=\` Icon URI, Data URI is possible
144
+ */
145
+ var QueryAssist = /*#__PURE__*/function (_Component) {
146
+ _inherits(QueryAssist, _Component);
147
+ var _super = _createSuper(QueryAssist);
148
+ function QueryAssist(_props) {
149
+ var _thisSuper, _this;
150
+ _classCallCheck(this, QueryAssist);
151
+ _this = _super.call(this, _props);
152
+ _defineProperty(_assertThisInitialized(_this), "state", {
153
+ dirty: !_this.props.query,
154
+ query: _this.props.query,
155
+ placeholderEnabled: !_this.props.query,
156
+ shortcuts: !!_this.props.focus,
157
+ suggestions: [],
158
+ showPopup: false
159
+ });
160
+ _defineProperty(_assertThisInitialized(_this), "immediateState", void 0);
161
+ _defineProperty(_assertThisInitialized(_this), "requestData", void 0);
162
+ _defineProperty(_assertThisInitialized(_this), "ngModelStateField", ngModelStateField);
163
+ // An array of {query: string; caret: number}[]
164
+ _defineProperty(_assertThisInitialized(_this), "historyStack", []);
165
+ _defineProperty(_assertThisInitialized(_this), "mouseIsDownOnPopup", void 0);
166
+ _defineProperty(_assertThisInitialized(_this), "handleFocusChange", function (e) {
167
+ // otherwise it's blur and false
168
+ var focus = e.type === 'focus';
169
+ _this.immediateState.focus = focus;
170
+ if (!focus) {
171
+ _this.blurInput();
172
+ // Close popup on blur by keyboard (mostly shift+tab)
173
+ if (!_this.mouseIsDownOnPopup) {
174
+ _this.closePopup();
175
+ }
176
+ } else {
177
+ _this.setCaretPosition();
178
+ }
179
+ if (!_this.mouseIsDownOnPopup) {
180
+ _this.props.onFocusChange({
181
+ focus
182
+ });
183
+ }
184
+ _this.setState({
185
+ shortcuts: focus
186
+ });
187
+ });
188
+ _defineProperty(_assertThisInitialized(_this), "node", void 0);
189
+ _defineProperty(_assertThisInitialized(_this), "nodeRef", function (node) {
190
+ _this.node = node;
191
+ });
192
+ _defineProperty(_assertThisInitialized(_this), "setCaretPosition", function () {
193
+ var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
194
+ var queryLength = _this.immediateState.query != null ? _this.immediateState.query.length : 0;
195
+ var newCaretPosition = _this.immediateState.caret < queryLength ? _this.immediateState.caret : queryLength;
196
+ if (params.fromContentEditable) {
197
+ _this.immediateState.selection = _this.immediateState.selection ? _this.immediateState.selection : _this.state.query && _this.state.query.length || null;
198
+ }
199
+ if (_this.immediateState.focus && !_this.props.disabled) {
200
+ if (typeof _this.immediateState.selection === 'number' && Number.isInteger(_this.immediateState.selection) && _this.immediateState.selection > -1) {
201
+ var _this$caret;
202
+ // Set to end of field value if newCaretPosition is inappropriate
203
+ (_this$caret = _this.caret) === null || _this$caret === void 0 ? void 0 : _this$caret.setPosition(newCaretPosition >= 0 ? newCaretPosition : -1);
204
+ _this.scrollInput();
205
+ } else if (_this.immediateState.selection && typeof _this.immediateState.selection === 'object' && _this.immediateState.selection.startOffset !== undefined) {
206
+ var _this$caret2;
207
+ (_this$caret2 = _this.caret) === null || _this$caret2 === void 0 ? void 0 : _this$caret2.setPosition(_this.immediateState.selection);
208
+ } else if (_this.immediateState.selection === undefined || params.forceSetCaret) {
209
+ var _this$caret3;
210
+ (_this$caret3 = _this.caret) === null || _this$caret3 === void 0 ? void 0 : _this$caret3.setPosition(-1);
211
+ }
212
+ }
213
+ });
214
+ _defineProperty(_assertThisInitialized(_this), "togglePlaceholder", function () {
215
+ var query = _this.getQuery();
216
+ var currentQueryIsEmpty = _this.immediateState.query === '';
217
+ var newQueryIsEmpty = query === '';
218
+ if (newQueryIsEmpty !== currentQueryIsEmpty) {
219
+ _this.setState({
220
+ placeholderEnabled: newQueryIsEmpty
221
+ });
222
+ }
223
+ });
224
+ _defineProperty(_assertThisInitialized(_this), "isComposing", void 0);
225
+ _defineProperty(_assertThisInitialized(_this), "handleInput", function (e) {
226
+ var _this$caret4, _currentCaret$positio;
227
+ _this.togglePlaceholder();
228
+ var currentCaret = (_this$caret4 = _this.caret) === null || _this$caret4 === void 0 ? void 0 : _this$caret4.getPosition();
229
+ var props = {
230
+ dirty: true,
231
+ query: _this.getQuery(),
232
+ caret: typeof currentCaret === 'number' ? currentCaret : (_currentCaret$positio = currentCaret === null || currentCaret === void 0 ? void 0 : currentCaret.position) !== null && _currentCaret$positio !== void 0 ? _currentCaret$positio : 0,
233
+ focus: true
234
+ };
235
+ if (_this.immediateState.query === props.query && !_this.isComposing) {
236
+ _this.handleCaretMove(e);
237
+ return;
238
+ }
239
+ if (_this.isComposing) {
240
+ return;
241
+ }
242
+ _this.immediateState = props;
243
+ if (_this.state.query) {
244
+ var _this$state$styleRang;
245
+ var i = 0;
246
+ while (_this.state.query[i] === _this.immediateState.query[i] && i < _this.state.query.length - 1) {
247
+ i++;
248
+ }
249
+ var diff = _this.immediateState.query.length - _this.state.query.length;
250
+ var originalIndex = _this.immediateState.caret - diff;
251
+ var ranges = _toConsumableArray((_this$state$styleRang = _this.state.styleRanges) !== null && _this$state$styleRang !== void 0 ? _this$state$styleRang : []);
252
+ var range = ranges.find(function (r) {
253
+ return originalIndex >= r.start && originalIndex <= r.start + r.length;
254
+ });
255
+ if (range) {
256
+ range.length += diff;
257
+ }
258
+ ranges.filter(function (r) {
259
+ return r.start > originalIndex;
260
+ }).forEach(function (r) {
261
+ r.start += diff;
262
+ });
263
+ }
264
+ _this.props.onChange(props);
265
+ if (_this.props.autoOpen === 'force' || props.query.length > 0) {
266
+ var _this$requestData, _this2;
267
+ (_this$requestData = (_this2 = _this).requestData) === null || _this$requestData === void 0 ? void 0 : _this$requestData.call(_this2);
268
+ }
269
+ });
270
+ // It's necessary to prevent new element creation before any other hooks
271
+ _defineProperty(_assertThisInitialized(_this), "handleEnter", function (e) {
272
+ if (e.key === 'Enter') {
273
+ preventDefault(e);
274
+ }
275
+ });
276
+ _defineProperty(_assertThisInitialized(_this), "handleTab", function (e) {
277
+ var list = _this._popup && _this._popup.list;
278
+ var suggestion = list && (list.getSelected() || list.getFirst());
279
+ if (suggestion && _this.state.showPopup) {
280
+ preventDefault(e);
281
+ if (_this.getQuery() !== _this.immediateState.suggestionsQuery) {
282
+ return false;
283
+ }
284
+ return _this.handleComplete(suggestion, true);
285
+ }
286
+ if (_this.state.loading) {
287
+ preventDefault(e);
288
+ return false;
289
+ }
290
+ return true;
291
+ });
292
+ _defineProperty(_assertThisInitialized(_this), "setState", function (state, resolve) {
293
+ _get((_thisSuper = _assertThisInitialized(_this), _getPrototypeOf(QueryAssist.prototype)), "setState", _thisSuper).call(_thisSuper, state, function () {
294
+ _this._pushHistory(state);
295
+ resolve === null || resolve === void 0 ? void 0 : resolve();
296
+ });
297
+ });
298
+ _defineProperty(_assertThisInitialized(_this), "undo", function (e) {
299
+ var previous = _this.historyStack.splice(0, 2)[1];
300
+ if (!previous) {
301
+ return;
302
+ }
303
+ _this.setState({
304
+ query: previous.query
305
+ }, function () {
306
+ var _this$caret5;
307
+ (_this$caret5 = _this.caret) === null || _this$caret5 === void 0 ? void 0 : _this$caret5.setPosition(previous.caret);
308
+ _this.handleInput(e);
309
+ });
310
+ });
311
+ _defineProperty(_assertThisInitialized(_this), "handlePaste", function (e) {
312
+ var INSERT_COMMAND = 'insertText';
313
+ if (e.clipboardData && document.queryCommandSupported(INSERT_COMMAND)) {
314
+ preventDefault(e);
315
+ var text = cleanText(e.clipboardData.getData('text/plain'));
316
+ document.execCommand(INSERT_COMMAND, false, text);
317
+ _this.handleInput(e);
318
+ }
319
+ });
320
+ _defineProperty(_assertThisInitialized(_this), "handleCaretMove", function (e) {
321
+ var _this$caret6, _currentCaret$positio2;
322
+ if (_this.isComposing) {
323
+ return;
324
+ }
325
+ var currentCaret = (_this$caret6 = _this.caret) === null || _this$caret6 === void 0 ? void 0 : _this$caret6.getPosition();
326
+ var caret = typeof currentCaret === 'number' ? currentCaret : (_currentCaret$positio2 = currentCaret === null || currentCaret === void 0 ? void 0 : currentCaret.position) !== null && _currentCaret$positio2 !== void 0 ? _currentCaret$positio2 : 0;
327
+ var popupHidden = !_this.state.showPopup && e.type === 'click';
328
+ if (!_this.props.disabled && (caret !== _this.immediateState.caret || popupHidden)) {
329
+ _this.immediateState.prevCaret = _this.immediateState.caret;
330
+ _this.immediateState.caret = caret;
331
+ _this.scrollInput();
332
+ if (_this.immediateState.query.length > 0) {
333
+ var _this$requestData2, _this3;
334
+ (_this$requestData2 = (_this3 = _this).requestData) === null || _this$requestData2 === void 0 ? void 0 : _this$requestData2.call(_this3);
335
+ }
336
+ }
337
+ if (_this.props.autoOpen !== 'force' && _this.immediateState.query.length < 1) {
338
+ _this.setState({
339
+ showPopup: false
340
+ });
341
+ }
342
+ });
343
+ _defineProperty(_assertThisInitialized(_this), "handleStyleRangesResponse", function (_ref) {
344
+ _ref.suggestions;
345
+ var restProps = _objectWithoutProperties(_ref, _excluded);
346
+ return _this.handleResponse(restProps);
347
+ });
348
+ _defineProperty(_assertThisInitialized(_this), "handleResponse", function (_ref2) {
349
+ var _ref2$query = _ref2.query,
350
+ query = _ref2$query === void 0 ? '' : _ref2$query,
351
+ _ref2$caret = _ref2.caret,
352
+ caret = _ref2$caret === void 0 ? 0 : _ref2$caret,
353
+ styleRanges = _ref2.styleRanges,
354
+ _ref2$suggestions = _ref2.suggestions,
355
+ suggestions = _ref2$suggestions === void 0 ? [] : _ref2$suggestions;
356
+ var afterCompletion = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
357
+ return new Promise(function (resolve, reject) {
358
+ if (query === _this.getQuery() && (caret === _this.immediateState.caret || _this.immediateState.caret === undefined)) {
359
+ var _this$caret7;
360
+ // Do not setState on unmounted component
361
+ if (!_this.node) {
362
+ return;
363
+ }
364
+ var state = {
365
+ dirty: _this.immediateState.dirty,
366
+ loading: false,
367
+ placeholderEnabled: !query,
368
+ query,
369
+ suggestions,
370
+ showPopup: !!suggestions.length && (_this.props.autoOpen === 'force' || !afterCompletion)
371
+ };
372
+ _this.immediateState.suggestionsQuery = query;
373
+ // Do not update deep equal styleRanges to simplify shouldComponentUpdate check
374
+ if (!deepEqual(_this.state.styleRanges, styleRanges)) {
375
+ state.styleRanges = styleRanges;
376
+ }
377
+ _this.immediateState.selection = (_this$caret7 = _this.caret) === null || _this$caret7 === void 0 ? void 0 : _this$caret7.getPosition({
378
+ avoidFocus: true
379
+ });
380
+ _this.setState(state, resolve);
381
+ } else {
382
+ reject(new Error('Current and response queries mismatch'));
383
+ }
384
+ });
385
+ });
386
+ _defineProperty(_assertThisInitialized(_this), "handleApply", function () {
387
+ _this.closePopup();
388
+ _this.immediateState.dirty = false;
389
+ // Only set dirty to false when query is saved already
390
+ if (_this.immediateState.query === _this.state.query) {
391
+ _this.setState({
392
+ dirty: false
393
+ });
394
+ }
395
+ return _this.props.onApply(_this.immediateState);
396
+ });
397
+ _defineProperty(_assertThisInitialized(_this), "handleComplete", function (data, replace) {
398
+ var _suggestion$caret, _suggestion$caret2, _this$requestData3, _this4;
399
+ if (!data || !data.data) {
400
+ _this.handleApply();
401
+ return;
402
+ }
403
+ var query = _this.getQuery();
404
+ var currentCaret = _this.immediateState.caret;
405
+ var suggestion = data.data;
406
+ var prefix = suggestion.prefix || '';
407
+ var suffix = suggestion.suffix || '';
408
+ var state = {
409
+ prevCaret: currentCaret,
410
+ caret: (_suggestion$caret = suggestion.caret) !== null && _suggestion$caret !== void 0 ? _suggestion$caret : 0,
411
+ selection: (_suggestion$caret2 = suggestion.caret) !== null && _suggestion$caret2 !== void 0 ? _suggestion$caret2 : 0,
412
+ query: query.substr(0, suggestion.completionStart) + prefix + suggestion.option + suffix
413
+ };
414
+ if (typeof replace === 'boolean' && replace) {
415
+ var _suggestion$completio;
416
+ state.query += _this.immediateState.query.substr((_suggestion$completio = suggestion.completionEnd) !== null && _suggestion$completio !== void 0 ? _suggestion$completio : 0);
417
+ } else {
418
+ state.query += _this.immediateState.query.substr(_this.immediateState.caret);
419
+ }
420
+ _this.props.onChange(state);
421
+ _this.props.onApplySuggestion(data.data, state);
422
+ var focusState = {
423
+ focus: true
424
+ };
425
+ _this.props.onFocusChange(focusState);
426
+ if (state.query !== _this.immediateState.query) {
427
+ _this.setState({
428
+ placeholderEnabled: !state.query,
429
+ query: state.query
430
+ });
431
+ }
432
+ _this.immediateState = Object.assign(state, focusState);
433
+ if (_this.immediateState.caret !== currentCaret) {
434
+ _this.setCaretPosition();
435
+ }
436
+ _this.closePopup();
437
+ (_this$requestData3 = (_this4 = _this).requestData) === null || _this$requestData3 === void 0 ? void 0 : _this$requestData3.call(_this4, true);
438
+ });
439
+ _defineProperty(_assertThisInitialized(_this), "requestStyleRanges", function () {
440
+ var _this$immediateState = _this.immediateState,
441
+ query = _this$immediateState.query,
442
+ caret = _this$immediateState.caret;
443
+ if (!query) {
444
+ return Promise.reject(new Error('Query is empty'));
445
+ }
446
+ return _this.sendRequest({
447
+ query,
448
+ caret,
449
+ omitSuggestions: true
450
+ }).then(_this.handleStyleRangesResponse).catch(noop);
451
+ });
452
+ _defineProperty(_assertThisInitialized(_this), "requestHandler", function () {
453
+ var afterCompletion = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
454
+ if (_this.props.disabled) {
455
+ return Promise.reject(new Error('QueryAssist(@jetbrains/ring-ui): null exception'));
456
+ }
457
+ var _this$immediateState2 = _this.immediateState,
458
+ query = _this$immediateState2.query,
459
+ caret = _this$immediateState2.caret;
460
+ return _this.sendRequest({
461
+ query,
462
+ caret
463
+ }).then(function (data) {
464
+ return _this.handleResponse(data, afterCompletion);
465
+ }).catch(noop);
466
+ });
467
+ _defineProperty(_assertThisInitialized(_this), "handleCtrlSpace", function (e) {
468
+ preventDefault(e);
469
+ if (!_this.state.showPopup) {
470
+ var _this$requestData4, _this5;
471
+ (_this$requestData4 = (_this5 = _this).requestData) === null || _this$requestData4 === void 0 ? void 0 : _this$requestData4.call(_this5);
472
+ }
473
+ });
474
+ _defineProperty(_assertThisInitialized(_this), "trackPopupMouseState", function (e) {
475
+ _this.mouseIsDownOnPopup = e.type === 'mousedown';
476
+ });
477
+ _defineProperty(_assertThisInitialized(_this), "trackCompositionState", function (e) {
478
+ _this.isComposing = e.type !== 'compositionend';
479
+ });
480
+ _defineProperty(_assertThisInitialized(_this), "closePopup", function () {
481
+ if (_this.node) {
482
+ _this.setState({
483
+ showPopup: false
484
+ });
485
+ }
486
+ });
487
+ _defineProperty(_assertThisInitialized(_this), "clearQuery", function () {
488
+ var state = {
489
+ dirty: false,
490
+ caret: 0,
491
+ query: '',
492
+ focus: true
493
+ };
494
+ _this.props.onChange(state);
495
+ _this.props.onClear();
496
+ _this.immediateState = state;
497
+ _this.setState({
498
+ dirty: false,
499
+ query: '',
500
+ placeholderEnabled: true,
501
+ loading: false
502
+ });
503
+ });
504
+ _defineProperty(_assertThisInitialized(_this), "input", void 0);
505
+ _defineProperty(_assertThisInitialized(_this), "caret", void 0);
506
+ _defineProperty(_assertThisInitialized(_this), "inputRef", function (node) {
507
+ if (!node) {
508
+ return;
509
+ }
510
+ _this.input = node;
511
+ _this.caret = new Caret(_this.input);
512
+ });
513
+ _defineProperty(_assertThisInitialized(_this), "_popup", void 0);
514
+ _defineProperty(_assertThisInitialized(_this), "popupRef", function (node) {
515
+ _this._popup = node;
516
+ });
517
+ _defineProperty(_assertThisInitialized(_this), "placeholder", void 0);
518
+ _defineProperty(_assertThisInitialized(_this), "placeholderRef", function (node) {
519
+ _this.placeholder = node;
520
+ });
521
+ _defineProperty(_assertThisInitialized(_this), "glass", void 0);
522
+ _defineProperty(_assertThisInitialized(_this), "glassRef", function (node) {
523
+ _this.glass = node;
524
+ });
525
+ _defineProperty(_assertThisInitialized(_this), "loader", void 0);
526
+ _defineProperty(_assertThisInitialized(_this), "loaderRef", function (node) {
527
+ _this.loader = node;
528
+ });
529
+ _defineProperty(_assertThisInitialized(_this), "clear", void 0);
530
+ _defineProperty(_assertThisInitialized(_this), "clearRef", function (node) {
531
+ _this.clear = node;
532
+ });
533
+ _defineProperty(_assertThisInitialized(_this), "shortcutsScope", getUID('ring-query-assist-'));
534
+ _defineProperty(_assertThisInitialized(_this), "shortcutsMap", {
535
+ del: noop,
536
+ enter: function enter() {
537
+ return _this.handleComplete();
538
+ },
539
+ 'command+enter': function commandEnter() {
540
+ return _this.handleComplete();
541
+ },
542
+ 'ctrl+enter': function ctrlEnter() {
543
+ return _this.handleComplete();
544
+ },
545
+ 'ctrl+space': _this.handleCtrlSpace,
546
+ tab: _this.handleTab,
547
+ 'meta+z': _this.undo,
548
+ right: noop,
549
+ left: noop,
550
+ space: noop,
551
+ home: noop,
552
+ end: noop
553
+ });
554
+ _defineProperty(_assertThisInitialized(_this), "listShortcutsMap", {
555
+ home: noop,
556
+ end: noop
557
+ });
558
+ var _query = _props.query || '';
559
+ _this.immediateState = {
560
+ query: _query,
561
+ caret: typeof _props.caret === 'number' && Number.isFinite(_props.caret) ? _props.caret : _query.length,
562
+ focus: Boolean(_props.autoOpen || _props.focus)
563
+ };
564
+ return _this;
565
+ }
566
+ _createClass(QueryAssist, [{
567
+ key: "componentDidMount",
568
+ value: function componentDidMount() {
569
+ var query = this.props.query || '';
570
+ this.immediateState = {
571
+ query,
572
+ caret: typeof this.props.caret === 'number' && Number.isFinite(this.props.caret) ? this.props.caret : query.length,
573
+ focus: Boolean(this.props.autoOpen || this.props.focus)
574
+ };
575
+ this.setupRequestHandler(this.props.delay);
576
+ if (this.props.autoOpen === 'force' || this.props.autoOpen && query.length > 0) {
577
+ this.requestHandler().catch(noop);
578
+ } else {
579
+ this.requestStyleRanges().catch(noop);
580
+ }
581
+ this.setCaretPosition();
582
+ this._pushHistory(this.state);
583
+ }
584
+ }, {
585
+ key: "shouldComponentUpdate",
586
+ value: function shouldComponentUpdate(props, state) {
587
+ return state.query !== this.state.query || state.dirty !== this.state.dirty || state.loading !== this.state.loading || state.showPopup !== this.state.showPopup || state.suggestions !== this.state.suggestions || state.styleRanges !== this.state.styleRanges || state.placeholderEnabled !== this.state.placeholderEnabled || props.placeholder !== this.props.placeholder || props.disabled !== this.props.disabled || props.clear !== this.props.clear || props.focus !== this.props.focus || props.actions !== this.props.actions || props.loader !== this.props.loader || props.glass !== this.props.glass;
588
+ }
589
+ }, {
590
+ key: "componentDidUpdate",
591
+ value: function componentDidUpdate(prevProps) {
592
+ var _this$props = this.props,
593
+ caret = _this$props.caret,
594
+ delay = _this$props.delay,
595
+ query = _this$props.query;
596
+ var queryChanged = query !== prevProps.query;
597
+ this.updateFocus(prevProps);
598
+ this.setupRequestHandler(delay);
599
+ var shouldSetCaret = typeof caret === 'number' && caret !== prevProps.caret;
600
+ if (shouldSetCaret) {
601
+ this.immediateState.prevCaret = prevProps.caret;
602
+ this.immediateState.caret = caret;
603
+ }
604
+ if (typeof query === 'string' && queryChanged && query !== this.immediateState.query) {
605
+ this.immediateState.query = query;
606
+ if (query && (this.props.autoOpen === 'force' || prevProps.autoOpen && query.length > 0)) {
607
+ var _this$requestData5;
608
+ (_this$requestData5 = this.requestData) === null || _this$requestData5 === void 0 ? void 0 : _this$requestData5.call(this);
609
+ } else if (query) {
610
+ this.requestStyleRanges();
611
+ }
612
+ }
613
+ }
614
+ }, {
615
+ key: "updateFocus",
616
+ value: function updateFocus(_ref3) {
617
+ var focus = _ref3.focus,
618
+ caret = _ref3.caret;
619
+ var isCaretChanged = caret !== this.props.caret;
620
+ var isFocusChanged = focus !== this.props.focus;
621
+ if (isFocusChanged || isCaretChanged) {
622
+ var focusValue = isFocusChanged ? this.props.focus : true;
623
+ this.setFocus(focusValue);
624
+ }
625
+ }
626
+ }, {
627
+ key: "scrollInput",
628
+ value: function scrollInput() {
629
+ var _this$caret8, _this$input, _this$input2, _this$input3;
630
+ var caretOffset = (_this$caret8 = this.caret) === null || _this$caret8 === void 0 ? void 0 : _this$caret8.getOffset();
631
+ if (((_this$input = this.input) === null || _this$input === void 0 ? void 0 : _this$input.clientWidth) !== ((_this$input2 = this.input) === null || _this$input2 === void 0 ? void 0 : _this$input2.scrollWidth) && caretOffset != null && ((_this$input3 = this.input) === null || _this$input3 === void 0 ? void 0 : _this$input3.clientWidth) != null && caretOffset > this.input.clientWidth) {
632
+ this.input.scrollLeft += caretOffset;
633
+ }
634
+ }
635
+ }, {
636
+ key: "getQuery",
637
+ value: function getQuery() {
638
+ var _this$input$textConte, _this$input4;
639
+ return (_this$input$textConte = (_this$input4 = this.input) === null || _this$input4 === void 0 || (_this$input4 = _this$input4.textContent) === null || _this$input4 === void 0 ? void 0 : _this$input4.replace(/\s/g, ' ')) !== null && _this$input$textConte !== void 0 ? _this$input$textConte : '';
640
+ }
641
+ }, {
642
+ key: "isRenderingGlassOrLoader",
643
+ value: function isRenderingGlassOrLoader() {
644
+ var renderLoader = this.props.loader !== false && this.state.loading;
645
+ return this.props.glass || renderLoader;
646
+ }
647
+ }, {
648
+ key: "_pushHistory",
649
+ value: function _pushHistory(state) {
650
+ var _this$historyStack$;
651
+ var queryIsSet = ('query' in state);
652
+ var queryIsSame = ((_this$historyStack$ = this.historyStack[0]) === null || _this$historyStack$ === void 0 ? void 0 : _this$historyStack$.query) === state.query;
653
+ if (queryIsSet && !queryIsSame) {
654
+ var _this$caret$getPositi, _this$caret9;
655
+ this.historyStack.unshift({
656
+ query: state.query,
657
+ caret: (_this$caret$getPositi = (_this$caret9 = this.caret) === null || _this$caret9 === void 0 ? void 0 : _this$caret9.getPosition({
658
+ avoidFocus: true
659
+ })) !== null && _this$caret$getPositi !== void 0 ? _this$caret$getPositi : -1
660
+ });
661
+ }
662
+ }
663
+ }, {
664
+ key: "sendRequest",
665
+ value: function sendRequest(params) {
666
+ var _this6 = this;
667
+ var value = this.props.dataSource(params);
668
+ var dataPromise = Promise.resolve(value);
669
+ var CLOSE_POPUP_TIMEOUT = 500;
670
+ // Close popup after timeout between long requests
671
+ var timeout = window.setTimeout(function () {
672
+ if (_this6.node) {
673
+ _this6.setState({
674
+ loading: true
675
+ });
676
+ }
677
+ if (params.query === _this6.immediateState.query) {
678
+ _this6.closePopup();
679
+ }
680
+ }, CLOSE_POPUP_TIMEOUT);
681
+ dataPromise.then(function () {
682
+ return window.clearTimeout(timeout);
683
+ }).catch(function () {
684
+ window.clearTimeout(timeout);
685
+ _this6.setState({
686
+ loading: false
687
+ });
688
+ });
689
+ return dataPromise;
690
+ }
691
+ }, {
692
+ key: "getPopupOffset",
693
+ value: function getPopupOffset(suggestions) {
694
+ var ICON_SPACING = 12;
695
+ var minOffset = this.isRenderingGlassOrLoader() ? ICON_SPACING : 0;
696
+ if (!this.input) {
697
+ return minOffset;
698
+ }
699
+ // First suggestion should be enough?
700
+ var suggestion = suggestions && suggestions[0];
701
+ // Check if suggestion begins not from the end
702
+ var completionStart = suggestion && suggestion.completionStart !== suggestion.completionEnd && suggestion.completionStart;
703
+ var inputChildren = this.input.firstChild instanceof Element && this.input.firstChild.children;
704
+ var completionStartNode = inputChildren && typeof completionStart === 'number' && inputChildren[Math.min(completionStart, inputChildren.length - 1)];
705
+ var offset = completionStartNode && getRect(completionStartNode).right - getRect(this.input).left;
706
+ if (!offset) {
707
+ var _this$caret$getOffset, _this$caret10;
708
+ var caret = (_this$caret$getOffset = (_this$caret10 = this.caret) === null || _this$caret10 === void 0 ? void 0 : _this$caret10.getOffset()) !== null && _this$caret$getOffset !== void 0 ? _this$caret$getOffset : 0;
709
+ // Do not compensate caret in the beginning of field
710
+ if (caret === 0) {
711
+ return minOffset;
712
+ } else {
713
+ offset = caret;
714
+ }
715
+ }
716
+ var result = offset - POPUP_COMPENSATION;
717
+ return result < minOffset ? minOffset : result;
718
+ }
719
+ }, {
720
+ key: "blurInput",
721
+ value: function blurInput() {
722
+ this.immediateState.selection = null;
723
+ if (!this.props.focus) {
724
+ var _this$caret11;
725
+ (_this$caret11 = this.caret) === null || _this$caret11 === void 0 ? void 0 : _this$caret11.target.blur();
726
+ }
727
+ }
728
+ /**
729
+ * Optionally setup data request delay. For each component create a separate
730
+ * instance of the delayed function. This may help reduce the load on the server
731
+ * when the user quickly inputs data.
732
+ */
733
+ }, {
734
+ key: "setupRequestHandler",
735
+ value: function setupRequestHandler(delay) {
736
+ var needDelay = typeof delay === 'number';
737
+ var hasDelay = this.requestData !== this.requestHandler;
738
+ if (!this.requestData || hasDelay !== needDelay) {
739
+ if (needDelay) {
740
+ this.requestData = debounce(this.requestHandler, delay);
741
+ } else {
742
+ this.requestData = this.requestHandler;
743
+ }
744
+ }
745
+ }
746
+ }, {
747
+ key: "_renderSuggestion",
748
+ value: function _renderSuggestion(suggestion) {
749
+ var ITEM = PopupMenu.ListProps.Type.ITEM;
750
+ var description = suggestion.description,
751
+ icon = suggestion.icon,
752
+ group = suggestion.group;
753
+ var key = QueryAssistSuggestions.createKey(suggestion);
754
+ var label = QueryAssistSuggestions.renderLabel(suggestion);
755
+ return {
756
+ key,
757
+ icon,
758
+ label,
759
+ description,
760
+ group,
761
+ rgItemType: ITEM,
762
+ data: suggestion
763
+ };
764
+ }
765
+ }, {
766
+ key: "renderSuggestions",
767
+ value: function renderSuggestions() {
768
+ var suggestions = this.state.suggestions;
769
+ if (!suggestions || !suggestions.length) {
770
+ return [];
771
+ }
772
+ return QueryAssistSuggestions.renderList(suggestions, this._renderSuggestion);
773
+ }
774
+ }, {
775
+ key: "renderQuery",
776
+ value: function renderQuery() {
777
+ var _this$state = this.state,
778
+ dirty = _this$state.dirty,
779
+ styleRanges = _this$state.styleRanges,
780
+ query = _this$state.query;
781
+ var classes = [];
782
+ var LETTER_CLASS = 'letter';
783
+ var LETTER_DEFAULT_CLASS = modules_da7ab055.letterDefault;
784
+ if (styleRanges && styleRanges.length) {
785
+ styleRanges.forEach(function (item, index) {
786
+ if (dirty && index === styleRanges.length - 1 && item.style === 'text') {
787
+ return;
788
+ }
789
+ var styleName = "".concat(LETTER_CLASS, "-").concat(item.style.replace('_', '-'));
790
+ for (var i = item.start; i < item.start + item.length; i++) {
791
+ classes[i] = modules_da7ab055[styleName];
792
+ }
793
+ });
794
+ }
795
+ return query && Array.from(query).map(function (letter, index, letters) {
796
+ var className = classNames(modules_da7ab055.letter, classes[index] || LETTER_DEFAULT_CLASS);
797
+ var dataTest = letters.length - 1 === index ? 'ring-query-assist-last-letter' : null;
798
+ // \u00a0 === &nbsp;
799
+ return /*#__PURE__*/React.createElement("span", {
800
+ // eslint-disable-next-line react/no-array-index-key
801
+ key: index + letter,
802
+ className: className,
803
+ "data-test": dataTest
804
+ }, letter === ' ' ? '\u00a0' : letter);
805
+ });
806
+ }
807
+ }, {
808
+ key: "setFocus",
809
+ value: function setFocus(focus) {
810
+ this.setState({
811
+ shortcuts: !!focus
812
+ });
813
+ var isComponentFocused = Boolean(this.immediateState.focus);
814
+ if (focus === false && isComponentFocused) {
815
+ this.immediateState.focus = focus;
816
+ this.blurInput();
817
+ } else if (focus === true && !isComponentFocused) {
818
+ this.immediateState.focus = focus;
819
+ this.setCaretPosition({
820
+ forceSetCaret: true
821
+ });
822
+ }
823
+ }
824
+ }, {
825
+ key: "renderActions",
826
+ value: function renderActions() {
827
+ var _this7 = this;
828
+ var actions = _toConsumableArray(this.props.actions || []);
829
+ var renderClear = this.props.clear && !!this.state.query;
830
+ if (renderClear) {
831
+ actions.push( /*#__PURE__*/React.createElement(I18nContext.Consumer, {
832
+ key: 'clearAction'
833
+ }, function (_ref4) {
834
+ var _this7$props$translat, _this7$props$translat2;
835
+ var translate = _ref4.translate;
836
+ return /*#__PURE__*/React.createElement(Button, {
837
+ icon: closeIcon,
838
+ className: modules_da7ab055.clear,
839
+ title: (_this7$props$translat = (_this7$props$translat2 = _this7.props.translations) === null || _this7$props$translat2 === void 0 ? void 0 : _this7$props$translat2.clearTitle) !== null && _this7$props$translat !== void 0 ? _this7$props$translat : translate('clearTitle'),
840
+ ref: _this7.clearRef,
841
+ onClick: _this7.clearQuery,
842
+ "data-test": "query-assist-clear-icon"
843
+ });
844
+ }));
845
+ }
846
+ return actions;
847
+ }
848
+ }, {
849
+ key: "render",
850
+ value: function render() {
851
+ var _this8 = this;
852
+ var _this$props2 = this.props,
853
+ glass = _this$props2.glass,
854
+ dataTest = _this$props2['data-test'],
855
+ className = _this$props2.className,
856
+ useCustomItemRender = _this$props2.useCustomItemRender,
857
+ huge = _this$props2.huge,
858
+ size = _this$props2.size,
859
+ translations = _this$props2.translations;
860
+ var renderPlaceholder = !!this.props.placeholder && this.state.placeholderEnabled;
861
+ var renderLoader = this.props.loader !== false && this.state.loading;
862
+ var renderGlass = glass && !renderLoader;
863
+ var actions = this.renderActions();
864
+ var containerClasses = classNames(className, modules_88cfaf40["size".concat(huge ? Size.FULL : size)], {
865
+ [modules_da7ab055.queryAssist]: true,
866
+ [modules_da7ab055.withIcon]: renderGlass && !huge || renderLoader,
867
+ [modules_da7ab055.huge]: huge,
868
+ [modules_da7ab055.queryAssistDisabled]: this.props.disabled
869
+ });
870
+ var inputClasses = classNames(this.props.inputClassName, {
871
+ ["".concat(modules_da7ab055.input, " ring-js-shortcuts")]: true,
872
+ [modules_da7ab055.inputGap]: actions.length || this.isRenderingGlassOrLoader() && !glass,
873
+ [modules_da7ab055.inputGap2]: actions.length === 2,
874
+ [modules_da7ab055.inputRevertOrder]: !glass || huge
875
+ });
876
+ var placeholderStyles = classNames({
877
+ [modules_da7ab055.placeholder]: true,
878
+ [modules_da7ab055.hugePlaceholder]: huge,
879
+ [modules_da7ab055.withoutGlass]: !glass || !renderLoader && huge
880
+ });
881
+ return /*#__PURE__*/React.createElement(ControlsHeightContext.Provider, {
882
+ value: ControlsHeight.M
883
+ }, /*#__PURE__*/React.createElement(I18nContext.Consumer, null, function (_ref5) {
884
+ var _translations$searchT, _translations$searchT2, _translations$searchT3;
885
+ var translate = _ref5.translate;
886
+ return /*#__PURE__*/React.createElement("div", {
887
+ "data-test": joinDataTestAttributes('ring-query-assist', dataTest),
888
+ className: containerClasses,
889
+ role: "presentation",
890
+ ref: _this8.nodeRef
891
+ }, _this8.state.shortcuts && /*#__PURE__*/React.createElement(Shortcuts, {
892
+ map: _this8.shortcutsMap,
893
+ scope: _this8.shortcutsScope
894
+ }), renderGlass && !huge && /*#__PURE__*/React.createElement(Icon, {
895
+ glyph: searchIcon,
896
+ className: modules_da7ab055.icon,
897
+ title: (_translations$searchT = translations === null || translations === void 0 ? void 0 : translations.searchTitle) !== null && _translations$searchT !== void 0 ? _translations$searchT : translate('searchTitle'),
898
+ ref: _this8.glassRef,
899
+ "data-test": "query-assist-search-icon"
900
+ }), renderLoader && /*#__PURE__*/React.createElement("div", {
901
+ className: classNames(modules_da7ab055.icon, modules_da7ab055.loader, {
902
+ [modules_da7ab055.loaderOnTheRight]: !glass && !huge,
903
+ [modules_da7ab055.loaderActive]: renderLoader
904
+ }),
905
+ ref: _this8.loaderRef
906
+ }, /*#__PURE__*/React.createElement(LoaderInline, null)), /*#__PURE__*/React.createElement(ContentEditable, {
907
+ "aria-label": (_translations$searchT2 = translations === null || translations === void 0 ? void 0 : translations.searchTitle) !== null && _translations$searchT2 !== void 0 ? _translations$searchT2 : translate('searchTitle'),
908
+ className: inputClasses,
909
+ "data-test": "ring-query-assist-input",
910
+ inputRef: _this8.inputRef,
911
+ disabled: _this8.props.disabled,
912
+ onComponentUpdate: function onComponentUpdate() {
913
+ return _this8.setCaretPosition({
914
+ fromContentEditable: true
915
+ });
916
+ },
917
+ onBlur: _this8.handleFocusChange,
918
+ onClick: _this8.handleCaretMove,
919
+ onCompositionStart: _this8.trackCompositionState,
920
+ onCompositionEnd: _this8.trackCompositionState,
921
+ onFocus: _this8.handleFocusChange,
922
+ onInput: _this8.handleInput // To support IE use the same method
923
+ ,
924
+ onKeyUp: _this8.handleInput // to handle input and key up
925
+ ,
926
+ onKeyDown: _this8.handleEnter,
927
+ onPaste: _this8.handlePaste,
928
+ spellCheck: "false"
929
+ }, _this8.state.query && /*#__PURE__*/React.createElement("span", null, _this8.renderQuery())), renderPlaceholder && /*#__PURE__*/React.createElement("button", {
930
+ type: "button",
931
+ className: placeholderStyles,
932
+ ref: _this8.placeholderRef,
933
+ onClick: _this8.handleCaretMove,
934
+ "data-test": "query-assist-placeholder"
935
+ }, _this8.props.placeholder), actions.length ? /*#__PURE__*/React.createElement("div", {
936
+ "data-test": "ring-query-assist-actions",
937
+ className: modules_da7ab055.actions
938
+ }, actions) : null, /*#__PURE__*/React.createElement(PopupMenu, {
939
+ hidden: !_this8.state.showPopup,
940
+ onCloseAttempt: _this8.closePopup,
941
+ ref: _this8.popupRef,
942
+ anchorElement: _this8.node,
943
+ keepMounted: true,
944
+ attached: true,
945
+ className: _this8.props.popupClassName,
946
+ directions: [PopupMenu.PopupProps.Directions.BOTTOM_RIGHT],
947
+ data: useCustomItemRender ? _this8.state.suggestions : _this8.renderSuggestions(),
948
+ "data-test": "ring-query-assist-popup",
949
+ hint: _this8.props.hint,
950
+ shortcutsMap: _this8.listShortcutsMap,
951
+ hintOnSelection: _this8.props.hintOnSelection,
952
+ left: _this8.getPopupOffset(_this8.state.suggestions),
953
+ maxHeight: PopupMenu.PopupProps.MaxHeight.SCREEN,
954
+ onMouseDown: _this8.trackPopupMouseState,
955
+ onMouseUp: _this8.trackPopupMouseState,
956
+ onSelect: function onSelect(item) {
957
+ return _this8.handleComplete(item);
958
+ }
959
+ }), glass && huge && /*#__PURE__*/React.createElement("div", {
960
+ className: modules_da7ab055.rightSearchButton,
961
+ "data-test": "query-assist-search-button"
962
+ }, /*#__PURE__*/React.createElement(Icon, {
963
+ glyph: searchIcon,
964
+ className: modules_da7ab055.rightSearchIcon,
965
+ title: (_translations$searchT3 = translations === null || translations === void 0 ? void 0 : translations.searchTitle) !== null && _translations$searchT3 !== void 0 ? _translations$searchT3 : translate('searchTitle'),
966
+ onClick: _this8.handleApply,
967
+ ref: _this8.glassRef,
968
+ "data-test": "query-assist-search-icon"
969
+ })));
970
+ }));
971
+ }
972
+ }], [{
973
+ key: "getDerivedStateFromProps",
974
+ value: function getDerivedStateFromProps(_ref6, _ref7) {
975
+ var query = _ref6.query;
976
+ var prevQuery = _ref7.prevQuery;
977
+ var nextState = {
978
+ prevQuery: query
979
+ };
980
+ if (typeof query === 'string' && query !== prevQuery) {
981
+ nextState.query = query;
982
+ nextState.placeholderEnabled = !query;
983
+ }
984
+ return nextState;
985
+ }
986
+ }]);
987
+ return QueryAssist;
988
+ }(Component);
989
+ _defineProperty(QueryAssist, "propTypes", {
990
+ /**
991
+ * Open suggestions popup during the initial render
992
+ */
993
+ autoOpen: PropTypes.oneOf([true, false, 'force']),
994
+ /**
995
+ * Initial caret position
996
+ */
997
+ caret: PropTypes.number,
998
+ /**
999
+ * Show clickable "cross" icon on the right which clears the query
1000
+ */
1001
+ clear: PropTypes.bool,
1002
+ /**
1003
+ * Additional class for the component
1004
+ */
1005
+ className: PropTypes.string,
1006
+ /**
1007
+ * Additional class for the popup
1008
+ */
1009
+ popupClassName: PropTypes.string,
1010
+ /**
1011
+ * Additional class for the input
1012
+ */
1013
+ inputClassName: PropTypes.string,
1014
+ /**
1015
+ * Data source function
1016
+ */
1017
+ dataSource: PropTypes.func.isRequired,
1018
+ /**
1019
+ * Input debounce delay
1020
+ */
1021
+ delay: PropTypes.number,
1022
+ /**
1023
+ * Disable the component
1024
+ */
1025
+ disabled: PropTypes.bool,
1026
+ /**
1027
+ * Initial focus
1028
+ */
1029
+ focus: PropTypes.bool,
1030
+ /**
1031
+ * Hint under the suggestions list
1032
+ */
1033
+ hint: PropTypes.string,
1034
+ /**
1035
+ * Hint under the suggestions list visible when a suggestion is selected
1036
+ */
1037
+ hintOnSelection: PropTypes.string,
1038
+ /**
1039
+ * Show clickable "glass" icon on the right which applies the query
1040
+ */
1041
+ glass: PropTypes.bool,
1042
+ /**
1043
+ * Show loader when a data request is in process
1044
+ */
1045
+ loader: PropTypes.bool,
1046
+ /**
1047
+ * Field placeholder value
1048
+ */
1049
+ placeholder: PropTypes.string,
1050
+ /**
1051
+ * Called when the query is applied. An object with fields `caret`, `focus` and `query` is passed as an argument
1052
+ */
1053
+ onApply: PropTypes.func,
1054
+ /**
1055
+ * Called when the query is changed. An object with fields `caret` and `query` is passed as an argument
1056
+ */
1057
+ onChange: PropTypes.func,
1058
+ /**
1059
+ * Called when the query is cleared. Called without arguments
1060
+ */
1061
+ onClear: PropTypes.func,
1062
+ /**
1063
+ * Called when the suggestion is applied
1064
+ */
1065
+ onApplySuggestion: PropTypes.func,
1066
+ /**
1067
+ * Called when the focus status is changed. An object with fields `focus` is passed as an argument
1068
+ */
1069
+ onFocusChange: PropTypes.func,
1070
+ /**
1071
+ * Initial query
1072
+ */
1073
+ query: PropTypes.string,
1074
+ useCustomItemRender: PropTypes.bool,
1075
+ translations: PropTypes.object,
1076
+ actions: PropTypes.array,
1077
+ 'data-test': PropTypes.string,
1078
+ huge: PropTypes.bool,
1079
+ size: PropTypes.string
1080
+ });
1081
+ _defineProperty(QueryAssist, "defaultProps", {
1082
+ onApply: noop,
1083
+ onChange: noop,
1084
+ onApplySuggestion: noop,
1085
+ onClear: noop,
1086
+ onFocusChange: noop,
1087
+ size: Size.L
1088
+ });
1089
+ _defineProperty(QueryAssist, "ngModelStateField", ngModelStateField);
1090
+ var RerenderableQueryAssist = rerenderHOC(QueryAssist);
1091
+
1092
+ export { RerenderableQueryAssist, QueryAssist as default };