@jetbrains/ring-ui 6.0.2-beta.0 → 6.0.2

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