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