@jetbrains/ring-ui-built 6.0.1

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