@jetbrains/ring-ui-built 6.1.1-beta.0 → 7.0.0-beta.10

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 (351) hide show
  1. package/components/_helpers/_rollupPluginBabelHelpers.js +1 -504
  2. package/components/_helpers/anchor.js +7 -10
  3. package/components/_helpers/button__classes.js +23 -20
  4. package/components/_helpers/caption.js +11 -21
  5. package/components/_helpers/card.js +91 -123
  6. package/components/_helpers/dialog__body-scroll-preventer.js +10 -17
  7. package/components/_helpers/header.js +1 -1
  8. package/components/_helpers/icon__svg.js +27 -29
  9. package/components/_helpers/input.js +151 -193
  10. package/components/_helpers/query-assist__suggestions.js +79 -94
  11. package/components/_helpers/select__filter.js +56 -75
  12. package/components/_helpers/services-link.js +23 -39
  13. package/components/_helpers/sidebar.js +91 -102
  14. package/components/_helpers/tab-link.js +8 -12
  15. package/components/_helpers/table.js +1 -1
  16. package/components/_helpers/theme.js +61 -51
  17. package/components/_helpers/title.js +59 -84
  18. package/components/alert/alert.d.ts +7 -24
  19. package/components/alert/alert.js +111 -179
  20. package/components/alert/container.d.ts +0 -5
  21. package/components/alert/container.js +32 -44
  22. package/components/alert-service/alert-service.js +104 -162
  23. package/components/analytics/analytics.js +12 -20
  24. package/components/analytics/analytics__custom-plugin.js +52 -68
  25. package/components/auth/auth.js +2 -31
  26. package/components/auth/auth__core.d.ts +1 -1
  27. package/components/auth/auth__core.js +754 -1440
  28. package/components/auth/background-flow.js +84 -121
  29. package/components/auth/down-notification.js +32 -79
  30. package/components/auth/iframe-flow.js +71 -125
  31. package/components/auth/request-builder.js +46 -77
  32. package/components/auth/response-parser.js +84 -112
  33. package/components/auth/storage.js +162 -324
  34. package/components/auth/token-validator.js +132 -227
  35. package/components/auth/window-flow.js +84 -121
  36. package/components/auth-dialog/auth-dialog.d.ts +0 -18
  37. package/components/auth-dialog/auth-dialog.js +107 -176
  38. package/components/auth-dialog-service/auth-dialog-service.js +12 -33
  39. package/components/avatar/avatar-example-datauri.js +1 -1
  40. package/components/avatar/avatar.d.ts +0 -13
  41. package/components/avatar/avatar.js +94 -136
  42. package/components/avatar/fallback-avatar.d.ts +1 -10
  43. package/components/avatar/fallback-avatar.js +20 -40
  44. package/components/badge/badge.d.ts +0 -10
  45. package/components/badge/badge.js +32 -48
  46. package/components/breadcrumbs/breadcrumbs.js +13 -17
  47. package/components/button/button.d.ts +0 -21
  48. package/components/button/button.js +68 -104
  49. package/components/button/button__classes.d.ts +1 -1
  50. package/components/button-group/button-group.d.ts +0 -5
  51. package/components/button-group/button-group.js +27 -41
  52. package/components/button-group/caption.d.ts +0 -4
  53. package/components/button-group/caption.js +0 -1
  54. package/components/button-set/button-set.d.ts +0 -6
  55. package/components/button-set/button-set.js +19 -33
  56. package/components/button-toolbar/button-toolbar.d.ts +0 -6
  57. package/components/button-toolbar/button-toolbar.js +17 -31
  58. package/components/caret/caret.js +184 -211
  59. package/components/checkbox/checkbox.d.ts +0 -19
  60. package/components/checkbox/checkbox.js +69 -104
  61. package/components/clipboard/clipboard-fallback.js +7 -7
  62. package/components/clipboard/clipboard.js +36 -129
  63. package/components/code/code.d.ts +0 -12
  64. package/components/code/code.js +83 -163
  65. package/components/collapse/collapse-content.js +42 -60
  66. package/components/collapse/collapse-context.js +2 -2
  67. package/components/collapse/collapse-control.js +12 -12
  68. package/components/collapse/collapse.js +12 -17
  69. package/components/collapse/consts.js +4 -4
  70. package/components/collapse/utils.js +1 -3
  71. package/components/confirm/confirm.d.ts +0 -14
  72. package/components/confirm/confirm.js +68 -112
  73. package/components/confirm-service/confirm-service.js +25 -47
  74. package/components/content-layout/content-layout.d.ts +0 -7
  75. package/components/content-layout/content-layout.js +41 -63
  76. package/components/content-layout/sidebar.d.ts +0 -9
  77. package/components/content-layout/sidebar.js +1 -2
  78. package/components/contenteditable/contenteditable.d.ts +1 -22
  79. package/components/contenteditable/contenteditable.js +37 -60
  80. package/components/control-help/control-help.js +5 -3
  81. package/components/control-label/control-label.js +9 -14
  82. package/components/data-list/data-list.d.ts +4 -6
  83. package/components/data-list/data-list.js +115 -179
  84. package/components/data-list/data-list.mock.js +3 -6
  85. package/components/data-list/item.js +119 -165
  86. package/components/data-list/selection.js +77 -135
  87. package/components/data-list/title.d.ts +2 -2
  88. package/components/data-list/title.js +2 -12
  89. package/components/date-picker/consts.d.ts +0 -2
  90. package/components/date-picker/consts.js +16 -24
  91. package/components/date-picker/date-input.d.ts +0 -20
  92. package/components/date-picker/date-input.js +100 -148
  93. package/components/date-picker/date-picker.d.ts +0 -29
  94. package/components/date-picker/date-picker.js +143 -224
  95. package/components/date-picker/date-popup.d.ts +0 -22
  96. package/components/date-picker/date-popup.js +282 -352
  97. package/components/date-picker/day.d.ts +0 -14
  98. package/components/date-picker/day.js +72 -109
  99. package/components/date-picker/month-names.d.ts +1 -11
  100. package/components/date-picker/month-names.js +42 -72
  101. package/components/date-picker/month-slider.d.ts +0 -9
  102. package/components/date-picker/month-slider.js +43 -71
  103. package/components/date-picker/month.d.ts +1 -9
  104. package/components/date-picker/month.js +18 -30
  105. package/components/date-picker/months.d.ts +1 -9
  106. package/components/date-picker/months.js +45 -55
  107. package/components/date-picker/weekdays.d.ts +2 -8
  108. package/components/date-picker/weekdays.js +12 -25
  109. package/components/date-picker/years.d.ts +0 -6
  110. package/components/date-picker/years.js +77 -104
  111. package/components/dialog/dialog.d.ts +0 -20
  112. package/components/dialog/dialog.js +153 -210
  113. package/components/dialog/dialog__body-scroll-preventer.js +0 -3
  114. package/components/dropdown/anchor.d.ts +1 -8
  115. package/components/dropdown/anchor.js +0 -7
  116. package/components/dropdown/dropdown.d.ts +4 -22
  117. package/components/dropdown/dropdown.js +134 -176
  118. package/components/dropdown-menu/dropdown-menu.js +51 -103
  119. package/components/editable-heading/editable-heading.js +69 -118
  120. package/components/error-bubble/error-bubble.d.ts +0 -6
  121. package/components/error-bubble/error-bubble.js +30 -60
  122. package/components/error-message/error-message.d.ts +0 -10
  123. package/components/error-message/error-message.js +34 -59
  124. package/components/footer/footer.js +28 -44
  125. package/components/form/form.js +1 -1
  126. package/components/global/compose.js +1 -8
  127. package/components/global/composeRefs.d.ts +0 -3
  128. package/components/global/composeRefs.js +8 -15
  129. package/components/global/controls-height.js +2 -2
  130. package/components/global/create-stateful-context.d.ts +0 -4
  131. package/components/global/create-stateful-context.js +14 -17
  132. package/components/global/data-tests.js +7 -12
  133. package/components/global/dom.js +49 -82
  134. package/components/global/focus-sensor-hoc.js +95 -122
  135. package/components/global/fuzzy-highlight.js +23 -34
  136. package/components/global/get-event-key.js +8 -8
  137. package/components/global/get-uid.js +3 -7
  138. package/components/global/inject-styles.js +7 -14
  139. package/components/global/listeners.js +28 -47
  140. package/components/global/memoize.js +6 -10
  141. package/components/global/normalize-indent.js +19 -46
  142. package/components/global/promise-with-timeout.js +6 -8
  143. package/components/global/react-dom-renderer.d.ts +0 -5
  144. package/components/global/react-dom-renderer.js +29 -45
  145. package/components/global/rerender-hoc.d.ts +2 -2
  146. package/components/global/rerender-hoc.js +16 -32
  147. package/components/global/schedule-raf.js +4 -4
  148. package/components/global/sniffer.js +1 -1
  149. package/components/global/theme.d.ts +8 -2
  150. package/components/global/theme.js +2 -20
  151. package/components/global/trivial-template-tag.js +4 -9
  152. package/components/global/typescript-utils.js +2 -6
  153. package/components/global/url.js +20 -23
  154. package/components/global/use-event-callback.js +7 -4
  155. package/components/grid/col.d.ts +0 -14
  156. package/components/grid/col.js +27 -53
  157. package/components/grid/grid.d.ts +0 -5
  158. package/components/grid/grid.js +20 -32
  159. package/components/grid/row.d.ts +0 -18
  160. package/components/grid/row.js +23 -47
  161. package/components/group/group.d.ts +0 -5
  162. package/components/group/group.js +18 -27
  163. package/components/header/header-icon.d.ts +10 -0
  164. package/components/header/header-icon.js +39 -0
  165. package/components/header/header.d.ts +3 -7
  166. package/components/header/header.js +32 -74
  167. package/components/header/links.d.ts +2 -0
  168. package/components/header/links.js +20 -0
  169. package/components/header/logo.d.ts +0 -4
  170. package/components/header/logo.js +15 -30
  171. package/components/header/profile.d.ts +1 -39
  172. package/components/header/profile.js +126 -190
  173. package/components/header/services-link.d.ts +0 -10
  174. package/components/header/services-link.js +1 -4
  175. package/components/header/services.d.ts +0 -14
  176. package/components/header/services.js +67 -112
  177. package/components/header/smart-profile.d.ts +0 -9
  178. package/components/header/smart-profile.js +116 -205
  179. package/components/header/smart-services.d.ts +0 -4
  180. package/components/header/smart-services.js +73 -142
  181. package/components/header/tray.d.ts +0 -5
  182. package/components/header/tray.js +21 -35
  183. package/components/heading/heading.d.ts +1 -4
  184. package/components/heading/heading.js +25 -42
  185. package/components/http/http.js +162 -319
  186. package/components/http/http.mock.js +50 -98
  187. package/components/hub-source/hub-source.js +77 -182
  188. package/components/hub-source/hub-source__user.js +9 -37
  189. package/components/hub-source/hub-source__users-groups.js +34 -60
  190. package/components/i18n/i18n-context.js +7 -8
  191. package/components/i18n/i18n.js +3 -6
  192. package/components/icon/icon.d.ts +0 -11
  193. package/components/icon/icon.js +60 -85
  194. package/components/icon/icon__svg.d.ts +0 -8
  195. package/components/icon/icon__svg.js +0 -6
  196. package/components/icon/index.js +0 -6
  197. package/components/input/input-legacy.js +1 -1
  198. package/components/input/input.js +2 -14
  199. package/components/input-size/input-size.js +1 -1
  200. package/components/island/adaptive-island-hoc.d.ts +4 -5
  201. package/components/island/adaptive-island-hoc.js +30 -39
  202. package/components/island/content.d.ts +0 -10
  203. package/components/island/content.js +99 -119
  204. package/components/island/header.js +55 -73
  205. package/components/island/island.d.ts +4 -13
  206. package/components/island/island.js +25 -41
  207. package/components/island-legacy/content-legacy.d.ts +0 -5
  208. package/components/island-legacy/content-legacy.js +16 -27
  209. package/components/island-legacy/header-legacy.d.ts +0 -5
  210. package/components/island-legacy/header-legacy.js +19 -30
  211. package/components/island-legacy/island-legacy.d.ts +0 -5
  212. package/components/island-legacy/island-legacy.js +16 -27
  213. package/components/link/clickableLink.d.ts +0 -9
  214. package/components/link/clickableLink.js +33 -51
  215. package/components/link/link.d.ts +8 -33
  216. package/components/link/link.js +47 -68
  217. package/components/list/consts.js +2 -2
  218. package/components/list/list.d.ts +0 -32
  219. package/components/list/list.js +399 -516
  220. package/components/list/list__custom.js +51 -78
  221. package/components/list/list__hint.d.ts +0 -4
  222. package/components/list/list__hint.js +8 -21
  223. package/components/list/list__item.js +147 -211
  224. package/components/list/list__link.js +39 -59
  225. package/components/list/list__separator.js +15 -30
  226. package/components/list/list__title.js +25 -41
  227. package/components/list/list__users-groups-source.js +55 -123
  228. package/components/loader/loader.d.ts +0 -10
  229. package/components/loader/loader.js +38 -70
  230. package/components/loader/loader__core.js +123 -184
  231. package/components/loader-inline/loader-inline.d.ts +0 -6
  232. package/components/loader-inline/loader-inline.js +24 -38
  233. package/components/loader-screen/loader-screen.d.ts +0 -6
  234. package/components/loader-screen/loader-screen.js +24 -46
  235. package/components/login-dialog/login-dialog.d.ts +0 -11
  236. package/components/login-dialog/login-dialog.js +94 -145
  237. package/components/login-dialog/service.js +11 -33
  238. package/components/markdown/markdown.js +16 -29
  239. package/components/message/message.js +171 -218
  240. package/components/old-browsers-message/old-browsers-message.js +11 -14
  241. package/components/old-browsers-message/old-browsers-message__stop.js +1 -4
  242. package/components/old-browsers-message/white-list.js +8 -13
  243. package/components/pager/pager.d.ts +1 -0
  244. package/components/pager/pager.js +211 -275
  245. package/components/panel/panel.d.ts +0 -5
  246. package/components/panel/panel.js +16 -27
  247. package/components/permissions/permissions.js +118 -161
  248. package/components/permissions/permissions__cache.js +191 -218
  249. package/components/popup/popup.consts.js +1 -1
  250. package/components/popup/popup.js +237 -329
  251. package/components/popup/popup.target.js +9 -12
  252. package/components/popup/position.js +94 -101
  253. package/components/popup-menu/popup-menu.js +31 -76
  254. package/components/progress-bar/progress-bar.d.ts +19 -33
  255. package/components/progress-bar/progress-bar.js +55 -99
  256. package/components/query-assist/query-assist.d.ts +63 -93
  257. package/components/query-assist/query-assist.js +585 -748
  258. package/components/query-assist/query-assist__suggestions.js +2 -28
  259. package/components/radio/radio.d.ts +0 -8
  260. package/components/radio/radio.js +15 -35
  261. package/components/radio/radio__item.d.ts +0 -9
  262. package/components/radio/radio__item.js +52 -72
  263. package/components/scrollable-section/scrollable-section.d.ts +2 -0
  264. package/components/scrollable-section/scrollable-section.js +53 -0
  265. package/components/select/select.d.ts +3 -0
  266. package/components/select/select.js +714 -863
  267. package/components/select/select__filter.js +2 -29
  268. package/components/select/select__popup.js +317 -465
  269. package/components/shortcuts/core.js +147 -195
  270. package/components/shortcuts/shortcut-title.js +6 -10
  271. package/components/shortcuts/shortcuts-hoc.d.ts +4 -9
  272. package/components/shortcuts/shortcuts-hoc.js +23 -46
  273. package/components/shortcuts/shortcuts.d.ts +0 -8
  274. package/components/shortcuts/shortcuts.js +41 -72
  275. package/components/slider/slider.js +93 -113
  276. package/components/slider/slider.utils.js +16 -23
  277. package/components/storage/storage.d.ts +2 -3
  278. package/components/storage/storage.js +2 -46
  279. package/components/storage/storage__local.js +89 -148
  280. package/components/style.css +1 -1
  281. package/components/tab-trap/tab-trap.js +35 -61
  282. package/components/table/cell.d.ts +0 -6
  283. package/components/table/cell.js +11 -27
  284. package/components/table/disable-hover-hoc.d.ts +4 -5
  285. package/components/table/disable-hover-hoc.js +27 -42
  286. package/components/table/header-cell.d.ts +0 -10
  287. package/components/table/header-cell.js +59 -85
  288. package/components/table/header.d.ts +1 -23
  289. package/components/table/header.js +89 -126
  290. package/components/table/multitable.d.ts +0 -4
  291. package/components/table/multitable.js +83 -93
  292. package/components/table/row-with-focus-sensor.d.ts +2 -2
  293. package/components/table/row-with-focus-sensor.js +26 -60
  294. package/components/table/row.js +170 -235
  295. package/components/table/selection-adapter.js +2 -2
  296. package/components/table/selection-shortcuts-hoc.js +102 -126
  297. package/components/table/selection.js +150 -217
  298. package/components/table/simple-table.d.ts +17 -0
  299. package/components/table/simple-table.js +83 -0
  300. package/components/table/smart-table.d.ts +0 -46
  301. package/components/table/smart-table.js +41 -83
  302. package/components/table/table.d.ts +9 -6
  303. package/components/table/table.js +270 -372
  304. package/components/tabs/collapsible-more.d.ts +1 -9
  305. package/components/tabs/collapsible-more.js +47 -97
  306. package/components/tabs/collapsible-tab.js +32 -44
  307. package/components/tabs/collapsible-tabs.d.ts +2 -29
  308. package/components/tabs/collapsible-tabs.js +89 -161
  309. package/components/tabs/custom-item.d.ts +1 -7
  310. package/components/tabs/custom-item.js +4 -7
  311. package/components/tabs/dumb-tabs.d.ts +0 -11
  312. package/components/tabs/dumb-tabs.js +60 -104
  313. package/components/tabs/smart-tabs.d.ts +0 -6
  314. package/components/tabs/smart-tabs.js +29 -68
  315. package/components/tabs/tab-link.d.ts +0 -8
  316. package/components/tabs/tab-link.js +1 -4
  317. package/components/tabs/tab.d.ts +0 -8
  318. package/components/tabs/tab.js +14 -32
  319. package/components/tabs/tabs.js +1 -28
  320. package/components/tag/tag.d.ts +0 -19
  321. package/components/tag/tag.js +120 -179
  322. package/components/tags-input/tags-input.d.ts +7 -33
  323. package/components/tags-input/tags-input.js +224 -339
  324. package/components/tags-list/tags-list.d.ts +0 -13
  325. package/components/tags-list/tags-list.js +45 -74
  326. package/components/text/text.d.ts +0 -7
  327. package/components/text/text.js +27 -43
  328. package/components/toggle/toggle.d.ts +0 -15
  329. package/components/toggle/toggle.js +53 -78
  330. package/components/tooltip/tooltip.d.ts +4 -10
  331. package/components/tooltip/tooltip.js +105 -137
  332. package/components/user-agreement/service.d.ts +2 -1
  333. package/components/user-agreement/service.js +260 -405
  334. package/components/user-agreement/user-agreement.d.ts +0 -18
  335. package/components/user-agreement/user-agreement.js +92 -138
  336. package/components/user-card/card.d.ts +0 -35
  337. package/components/user-card/card.js +2 -27
  338. package/components/user-card/smart-user-card-tooltip.d.ts +0 -5
  339. package/components/user-card/smart-user-card-tooltip.js +52 -108
  340. package/components/user-card/tooltip.d.ts +0 -9
  341. package/components/user-card/tooltip.js +35 -74
  342. package/components/user-card/user-card.js +1 -26
  343. package/package.json +5 -7
  344. package/components/global/prop-types.d.ts +0 -4
  345. package/components/global/prop-types.js +0 -9
  346. package/components/global/react-render-adapter.d.ts +0 -1
  347. package/components/global/react-render-adapter.js +0 -6
  348. package/components/header/tray-icon.d.ts +0 -32
  349. package/components/header/tray-icon.js +0 -56
  350. package/components/storage/storage__fallback.d.ts +0 -79
  351. package/components/storage/storage__fallback.js +0 -253
@@ -1,15 +1,10 @@
1
- import { _ as _defineProperty, a as _inherits, b as _createClass, e as _classCallCheck, f as _callSuper } from '../_helpers/_rollupPluginBabelHelpers.js';
2
- import 'core-js/modules/es.array.concat.js';
3
- import 'core-js/modules/es.array.filter.js';
4
- import 'core-js/modules/es.array.index-of.js';
1
+ import { _ as _defineProperty } from '../_helpers/_rollupPluginBabelHelpers.js';
5
2
  import 'core-js/modules/es.array.reduce.js';
6
- import 'core-js/modules/es.array.slice.js';
7
- import 'core-js/modules/es.object.to-string.js';
3
+ import 'core-js/modules/web.dom-collections.iterator.js';
8
4
  import { PureComponent } from 'react';
9
5
  import classNames from 'classnames';
10
6
  import searchIcon from '@jetbrains/icons/search';
11
7
  import memoizeOne from 'memoize-one';
12
- import PropTypes from 'prop-types';
13
8
  import Icon from '../icon/icon.js';
14
9
  import Popup, { getPopupContainer } from '../popup/popup.js';
15
10
  import { maxHeightForDirection } from '../popup/position.js';
@@ -26,39 +21,21 @@ import Shortcuts from '../shortcuts/shortcuts.js';
26
21
  import { Button } from '../button/button.js';
27
22
  import Text from '../text/text.js';
28
23
  import { ControlsHeight } from '../global/controls-height.js';
29
- import { refObject } from '../global/prop-types.js';
30
24
  import { createComposedRef } from '../global/composeRefs.js';
31
25
  import { DEFAULT_DIRECTIONS } from '../popup/popup.consts.js';
32
- import { S as SelectFilter, m as modules_b607bec2 } from '../_helpers/select__filter.js';
26
+ import { m as modules_b607bec2, S as SelectFilter } from '../_helpers/select__filter.js';
33
27
  import { jsxs, jsx } from 'react/jsx-runtime';
34
28
  import 'util-deprecate';
35
29
  import '../icon/icon__constants.js';
36
30
  import '../_helpers/icon__svg.js';
37
31
  import 'core-js/modules/es.regexp.exec.js';
38
32
  import 'core-js/modules/es.string.replace.js';
39
- import 'core-js/modules/es.string.starts-with.js';
40
- import 'core-js/modules/es.array.iterator.js';
41
- import 'core-js/modules/es.map.js';
42
- import 'core-js/modules/es.weak-map.js';
43
- import 'core-js/modules/web.dom-collections.iterator.js';
44
- import 'core-js/modules/es.object.entries.js';
45
- import 'core-js/modules/es.regexp.to-string.js';
46
- import 'core-js/modules/web.dom-collections.for-each.js';
47
33
  import 'react-dom';
48
34
  import '../global/schedule-raf.js';
49
35
  import '../global/data-tests.js';
50
36
  import '../tab-trap/tab-trap.js';
51
- import 'core-js/modules/es.array.includes.js';
52
- import 'core-js/modules/es.array.map.js';
53
37
  import 'core-js/modules/es.array.sort.js';
54
- import 'core-js/modules/es.string.includes.js';
55
- import 'core-js/modules/es.object.assign.js';
56
- import 'core-js/modules/es.set.js';
57
- import 'core-js/modules/es.string.split.js';
58
- import 'core-js/modules/es.symbol.js';
59
38
  import 'core-js/modules/es.symbol.description.js';
60
- import 'core-js/modules/es.array.find.js';
61
- import 'core-js/modules/es.array.find-index.js';
62
39
  import 'react-virtualized/dist/es/List';
63
40
  import 'react-virtualized/dist/es/AutoSizer';
64
41
  import 'react-virtualized/dist/es/WindowScroller';
@@ -72,9 +49,7 @@ import '../_helpers/list.js';
72
49
  import '../list/list__item.js';
73
50
  import '../avatar/avatar.js';
74
51
  import '../global/url.js';
75
- import 'core-js/modules/es.string.match.js';
76
52
  import '../avatar/fallback-avatar.js';
77
- import 'core-js/modules/es.array.from.js';
78
53
  import '../checkbox/checkbox.js';
79
54
  import '@jetbrains/icons/checkmark-12px';
80
55
  import '@jetbrains/icons/remove-12px';
@@ -86,7 +61,6 @@ import '../list/list__separator.js';
86
61
  import '../list/list__hint.js';
87
62
  import '../list/consts.js';
88
63
  import '../shortcuts/core.js';
89
- import 'core-js/modules/es.array.splice.js';
90
64
  import 'combokeys';
91
65
  import '../global/sniffer.js';
92
66
  import 'sniffr';
@@ -95,55 +69,49 @@ import '@jetbrains/icons/close-12px';
95
69
  import '@jetbrains/icons/chevron-down';
96
70
  import '../_helpers/button__classes.js';
97
71
  import '../_helpers/input.js';
98
- import 'core-js/modules/es.object.values.js';
99
72
  import '../i18n/i18n-context.js';
100
73
  import '../i18n/i18n.js';
101
74
  import '../control-label/control-label.js';
102
75
 
103
- var FILTER_HEIGHT = 35;
104
- var TOOLBAR_HEIGHT = 49;
76
+ const FILTER_HEIGHT = 35;
77
+ const TOOLBAR_HEIGHT = 49;
105
78
  function noop() {}
106
- var FilterWithShortcuts = shortcutsHOC(SelectFilter);
107
- var SelectPopup = /*#__PURE__*/function (_PureComponent) {
108
- function SelectPopup() {
109
- var _this;
110
- _classCallCheck(this, SelectPopup);
111
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
112
- args[_key] = arguments[_key];
113
- }
114
- _this = _callSuper(this, SelectPopup, [].concat(args));
115
- _defineProperty(_this, "state", {
79
+ const FilterWithShortcuts = shortcutsHOC(SelectFilter);
80
+ class SelectPopup extends PureComponent {
81
+ constructor() {
82
+ super(...arguments);
83
+ _defineProperty(this, "state", {
116
84
  popupFilterShortcutsOptions: {
117
85
  modal: true,
118
86
  disabled: true
119
87
  },
120
88
  tagsActiveIndex: null
121
89
  });
122
- _defineProperty(_this, "isClickingPopup", false);
90
+ _defineProperty(this, "isClickingPopup", false);
123
91
  // This flag is set to true while an item in the popup is being clicked
124
- _defineProperty(_this, "filter", void 0);
125
- _defineProperty(_this, "caret", void 0);
126
- _defineProperty(_this, "onFilterFocus", function () {
127
- _this._togglePopupFilterShortcuts(false);
128
- _this.setState({
92
+ _defineProperty(this, "filter", void 0);
93
+ _defineProperty(this, "caret", void 0);
94
+ _defineProperty(this, "onFilterFocus", () => {
95
+ this._togglePopupFilterShortcuts(false);
96
+ this.setState({
129
97
  tagsActiveIndex: null
130
98
  });
131
99
  });
132
- _defineProperty(_this, "popupFilterOnBlur", function () {
133
- if (_this.state.tagsActiveIndex === null) {
134
- _this._togglePopupFilterShortcuts(true);
100
+ _defineProperty(this, "popupFilterOnBlur", () => {
101
+ if (this.state.tagsActiveIndex === null) {
102
+ this._togglePopupFilterShortcuts(true);
135
103
  }
136
104
  });
137
- _defineProperty(_this, "mouseDownHandler", function () {
138
- _this.isClickingPopup = true;
105
+ _defineProperty(this, "mouseDownHandler", () => {
106
+ this.isClickingPopup = true;
139
107
  });
140
- _defineProperty(_this, "mouseUpHandler", function () {
141
- _this.isClickingPopup = false;
108
+ _defineProperty(this, "mouseUpHandler", () => {
109
+ this.isClickingPopup = false;
142
110
  });
143
- _defineProperty(_this, "popup", void 0);
144
- _defineProperty(_this, "onListSelect", function (selected, event, opts) {
145
- var getSelectItemEvent = function getSelectItemEvent() {
146
- var customEvent = document.createEvent('Event');
111
+ _defineProperty(this, "popup", void 0);
112
+ _defineProperty(this, "onListSelect", (selected, event, opts) => {
113
+ const getSelectItemEvent = () => {
114
+ const customEvent = document.createEvent('Event');
147
115
  customEvent.initEvent('select', true, false);
148
116
  if (event && 'persist' in event) {
149
117
  event.persist();
@@ -151,55 +119,45 @@ var SelectPopup = /*#__PURE__*/function (_PureComponent) {
151
119
  customEvent.originalEvent = event;
152
120
  return customEvent;
153
121
  };
154
- _this.props.onSelect(selected, getSelectItemEvent(), opts);
122
+ this.props.onSelect(selected, getSelectItemEvent(), opts);
155
123
  });
156
- _defineProperty(_this, "tabPress", function (event) {
157
- _this.props.onCloseAttempt(event, true);
124
+ _defineProperty(this, "tabPress", event => {
125
+ this.props.onCloseAttempt(event, true);
158
126
  });
159
- _defineProperty(_this, "onClickHandler", function () {
127
+ _defineProperty(this, "onClickHandler", () => {
160
128
  var _this$filter;
161
- return (_this$filter = _this.filter) === null || _this$filter === void 0 ? void 0 : _this$filter.focus();
129
+ return (_this$filter = this.filter) === null || _this$filter === void 0 ? void 0 : _this$filter.focus();
162
130
  });
163
- _defineProperty(_this, "handleRemoveTag", memoize(function (tag) {
164
- return function (event) {
165
- return _this.removeTag(tag, event);
166
- };
167
- }));
168
- _defineProperty(_this, "handleTagClick", memoize(function (tag) {
169
- return function () {
170
- if (Array.isArray(_this.props.selected)) {
171
- _this.setState({
172
- tagsActiveIndex: _this.props.selected.indexOf(tag)
173
- });
174
- }
175
- };
131
+ _defineProperty(this, "handleRemoveTag", memoize(tag => event => this.removeTag(tag, event)));
132
+ _defineProperty(this, "handleTagClick", memoize(tag => () => {
133
+ if (Array.isArray(this.props.selected)) {
134
+ this.setState({
135
+ tagsActiveIndex: this.props.selected.indexOf(tag)
136
+ });
137
+ }
176
138
  }));
177
- _defineProperty(_this, "handleListResize", function () {
178
- _this.forceUpdate();
139
+ _defineProperty(this, "handleListResize", () => {
140
+ this.forceUpdate();
179
141
  });
180
- _defineProperty(_this, "handleSelectAll", function () {
181
- if (Array.isArray(_this.props.selected)) {
182
- _this.props.onSelectAll(_this.props.data.filter(function (item) {
183
- return !item.disabled;
184
- }).length !== _this.props.selected.length);
142
+ _defineProperty(this, "handleSelectAll", () => {
143
+ if (Array.isArray(this.props.selected)) {
144
+ this.props.onSelectAll(this.props.data.filter(item => !item.disabled).length !== this.props.selected.length);
185
145
  }
186
146
  });
187
- _defineProperty(_this, "getSelectAll", function () {
147
+ _defineProperty(this, "getSelectAll", () => {
188
148
  var _multiple$renderSelec;
189
- var multiple = _this.props.multiple;
190
- var activeFilters = _this.props.data.filter(function (item) {
191
- return !item.disabled;
192
- });
193
- return Array.isArray(_this.props.selected) && /*#__PURE__*/jsxs("div", {
149
+ const multiple = this.props.multiple;
150
+ const activeFilters = this.props.data.filter(item => !item.disabled);
151
+ return Array.isArray(this.props.selected) && /*#__PURE__*/jsxs("div", {
194
152
  className: modules_b607bec2.selectAll,
195
153
  children: [activeFilters.length === 0 ? /*#__PURE__*/jsx("span", {}) : /*#__PURE__*/jsx(Button, {
196
154
  text: true,
197
155
  inline: true,
198
- onClick: _this.handleSelectAll,
199
- children: activeFilters.length !== _this.props.selected.length ? multiple.selectAllLabel || 'Select all' : multiple.deselectAllLabel || 'Deselect all'
200
- }), ((_multiple$renderSelec = multiple.renderSelectedItemsDescription) === null || _multiple$renderSelec === void 0 ? void 0 : _multiple$renderSelec.call(multiple, _this.props.selected, activeFilters.length)) || /*#__PURE__*/jsx(Text, {
156
+ onClick: this.handleSelectAll,
157
+ children: activeFilters.length !== this.props.selected.length ? multiple.selectAllLabel || 'Select all' : multiple.deselectAllLabel || 'Deselect all'
158
+ }), ((_multiple$renderSelec = multiple.renderSelectedItemsDescription) === null || _multiple$renderSelec === void 0 ? void 0 : _multiple$renderSelec.call(multiple, this.props.selected, activeFilters.length)) || /*#__PURE__*/jsx(Text, {
201
159
  info: true,
202
- children: "".concat(_this.props.selected.length, " selected")
160
+ children: "".concat(this.props.selected.length, " selected")
203
161
  })]
204
162
  });
205
163
  });
@@ -207,369 +165,312 @@ var SelectPopup = /*#__PURE__*/function (_PureComponent) {
207
165
  // inside `render` function which can be called N times
208
166
  // and should be fast as possible.
209
167
  // Cache invalidates each time hidden or userDefinedMaxHeight changes
210
- _defineProperty(_this, "_adjustListMaxHeight", memoizeOne(function (hidden, userDefinedMaxHeight, ringPopupTarget) {
168
+ _defineProperty(this, "_adjustListMaxHeight", memoizeOne((hidden, userDefinedMaxHeight, ringPopupTarget) => {
211
169
  if (hidden) {
212
170
  return userDefinedMaxHeight;
213
171
  }
214
172
  // Calculate list's maximum height that can't
215
173
  // get beyond the screen
216
174
  // @see RG-1838, JT-48358
217
- var minMaxHeight = 100;
218
- var directions = _this.props.directions || DEFAULT_DIRECTIONS;
175
+ const minMaxHeight = 100;
176
+ const directions = this.props.directions || DEFAULT_DIRECTIONS;
219
177
  // Note:
220
178
  // Create a method which'll be called only when the popup opens and before
221
179
  // render the list would be a better way
222
- var anchorNode = _this.props.anchorElement;
223
- var containerNode = getPopupContainer(ringPopupTarget) || document.documentElement;
224
- return anchorNode != null ? Math.min(directions.reduce(function (maxHeight, direction) {
180
+ const anchorNode = this.props.anchorElement;
181
+ const containerNode = getPopupContainer(ringPopupTarget) || document.documentElement;
182
+ return anchorNode != null ? Math.min(directions.reduce((maxHeight, direction) => {
225
183
  var _maxHeightForDirectio;
226
184
  return Math.max(maxHeight, (_maxHeightForDirectio = maxHeightForDirection(direction, anchorNode, getStyles(containerNode).position !== 'static' ? containerNode : null)) !== null && _maxHeightForDirectio !== void 0 ? _maxHeightForDirectio : 0);
227
185
  }, minMaxHeight), userDefinedMaxHeight) : userDefinedMaxHeight;
228
186
  }));
229
- _defineProperty(_this, "popupRef", function (el) {
230
- _this.popup = el;
187
+ _defineProperty(this, "popupRef", el => {
188
+ this.popup = el;
231
189
  });
232
- _defineProperty(_this, "list", void 0);
233
- _defineProperty(_this, "listRef", function (el) {
234
- _this.list = el;
190
+ _defineProperty(this, "list", void 0);
191
+ _defineProperty(this, "listRef", el => {
192
+ this.list = el;
235
193
  });
236
- _defineProperty(_this, "filterRef", function (el) {
237
- _this.filter = el;
238
- _this.caret = el && new Caret(el);
194
+ _defineProperty(this, "filterRef", el => {
195
+ this.filter = el;
196
+ this.caret = el && new Caret(el);
239
197
  });
240
- _defineProperty(_this, "composedFilterRef", createComposedRef());
241
- _defineProperty(_this, "shortcutsScope", getUID('select-popup-'));
242
- _defineProperty(_this, "shortcutsMap", {
243
- tab: _this.tabPress
198
+ _defineProperty(this, "composedFilterRef", createComposedRef());
199
+ _defineProperty(this, "shortcutsScope", getUID('select-popup-'));
200
+ _defineProperty(this, "shortcutsMap", {
201
+ tab: this.tabPress
244
202
  });
245
- _defineProperty(_this, "popupFilterShortcutsMap", {
246
- up: function up(event) {
247
- return _this.list && _this.list.upHandler(event);
248
- },
249
- down: function down(event) {
250
- return _this.list && _this.list.downHandler(event);
251
- },
252
- home: function home(event) {
253
- return _this.list && _this.list.homeHandler(event);
254
- },
255
- end: function end(event) {
256
- return _this.list && _this.list.endHandler(event);
257
- },
258
- enter: function enter(event) {
259
- return _this.list ? _this.list.enterHandler(event) : _this.props.onEmptyPopupEnter(event);
260
- },
261
- esc: function esc(event) {
262
- return _this.props.onCloseAttempt(event, true);
263
- },
264
- tab: function tab(event) {
265
- return _this.tabPress(event);
266
- },
267
- backspace: function backspace(event) {
268
- return _this.handleBackspace(event);
269
- },
270
- del: function del() {
271
- return _this.removeSelectedTag();
272
- },
273
- left: function left(event) {
274
- return _this.handleNavigation(event, true);
275
- },
276
- right: function right(event) {
277
- return _this.handleNavigation(event);
278
- }
203
+ _defineProperty(this, "popupFilterShortcutsMap", {
204
+ up: event => this.list && this.list.upHandler(event),
205
+ down: event => this.list && this.list.downHandler(event),
206
+ home: event => this.list && this.list.homeHandler(event),
207
+ end: event => this.list && this.list.endHandler(event),
208
+ enter: event => this.list ? this.list.enterHandler(event) : this.props.onEmptyPopupEnter(event),
209
+ esc: event => this.props.onCloseAttempt(event, true),
210
+ tab: event => this.tabPress(event),
211
+ backspace: event => this.handleBackspace(event),
212
+ del: () => this.removeSelectedTag(),
213
+ left: event => this.handleNavigation(event, true),
214
+ right: event => this.handleNavigation(event)
215
+ });
216
+ }
217
+ componentDidMount() {
218
+ window.document.addEventListener('mouseup', this.mouseUpHandler);
219
+ }
220
+ componentWillUnmount() {
221
+ window.document.removeEventListener('mouseup', this.mouseUpHandler);
222
+ }
223
+ focusFilter() {
224
+ setTimeout(() => {
225
+ var _this$filter2;
226
+ return (_this$filter2 = this.filter) === null || _this$filter2 === void 0 ? void 0 : _this$filter2.focus();
279
227
  });
280
- return _this;
281
228
  }
282
- _inherits(SelectPopup, _PureComponent);
283
- return _createClass(SelectPopup, [{
284
- key: "componentDidMount",
285
- value: function componentDidMount() {
286
- window.document.addEventListener('mouseup', this.mouseUpHandler);
229
+ isEventTargetFilter(event) {
230
+ return event.target instanceof Element && event.target.matches('input,textarea');
231
+ }
232
+ handleNavigation(event, navigateLeft) {
233
+ if (this.isEventTargetFilter(event) && this.caret != null && Number(this.caret.getPosition()) > 0 || !Array.isArray(this.props.selected)) {
234
+ return;
287
235
  }
288
- }, {
289
- key: "componentWillUnmount",
290
- value: function componentWillUnmount() {
291
- window.document.removeEventListener('mouseup', this.mouseUpHandler);
236
+ let newIndex = null;
237
+ if (navigateLeft) {
238
+ newIndex = this.state.tagsActiveIndex === null ? this.props.selected.length - 1 : this.state.tagsActiveIndex - 1;
239
+ } else if (this.state.tagsActiveIndex !== null) {
240
+ newIndex = this.state.tagsActiveIndex + 1;
292
241
  }
293
- }, {
294
- key: "focusFilter",
295
- value: function focusFilter() {
296
- var _this2 = this;
297
- setTimeout(function () {
298
- var _this2$filter;
299
- return (_this2$filter = _this2.filter) === null || _this2$filter === void 0 ? void 0 : _this2$filter.focus();
300
- });
242
+ if (newIndex !== null && (newIndex >= this.props.selected.length || newIndex < 0)) {
243
+ newIndex = null;
244
+ this.focusFilter();
301
245
  }
302
- }, {
303
- key: "isEventTargetFilter",
304
- value: function isEventTargetFilter(event) {
305
- return event.target instanceof Element && event.target.matches('input,textarea');
246
+ this.setState({
247
+ tagsActiveIndex: newIndex
248
+ });
249
+ }
250
+ removeTag(tag, event) {
251
+ if (!Array.isArray(this.props.selected)) {
252
+ return;
306
253
  }
307
- }, {
308
- key: "handleNavigation",
309
- value: function handleNavigation(event, navigateLeft) {
310
- if (this.isEventTargetFilter(event) && this.caret != null && Number(this.caret.getPosition()) > 0 || !Array.isArray(this.props.selected)) {
311
- return;
312
- }
313
- var newIndex = null;
314
- if (navigateLeft) {
315
- newIndex = this.state.tagsActiveIndex === null ? this.props.selected.length - 1 : this.state.tagsActiveIndex - 1;
316
- } else if (this.state.tagsActiveIndex !== null) {
317
- newIndex = this.state.tagsActiveIndex + 1;
318
- }
319
- if (newIndex !== null && (newIndex >= this.props.selected.length || newIndex < 0)) {
320
- newIndex = null;
321
- this.focusFilter();
322
- }
254
+ const _tag = tag || this.props.selected.slice(0)[this.props.selected.length - 1];
255
+ if (_tag) {
256
+ this.onListSelect(_tag, event, {
257
+ tryKeepOpen: true
258
+ });
323
259
  this.setState({
324
- tagsActiveIndex: newIndex
260
+ tagsActiveIndex: null
325
261
  });
262
+ this.focusFilter();
326
263
  }
327
- }, {
328
- key: "removeTag",
329
- value: function removeTag(tag, event) {
330
- if (!Array.isArray(this.props.selected)) {
331
- return;
332
- }
333
- var _tag = tag || this.props.selected.slice(0)[this.props.selected.length - 1];
334
- if (_tag) {
335
- this.onListSelect(_tag, event, {
336
- tryKeepOpen: true
337
- });
338
- this.setState({
339
- tagsActiveIndex: null
340
- });
341
- this.focusFilter();
342
- }
343
- }
344
- }, {
345
- key: "removeSelectedTag",
346
- value: function removeSelectedTag() {
347
- if (Array.isArray(this.props.selected) && this.state.tagsActiveIndex != null) {
348
- this.removeTag(this.props.selected[this.state.tagsActiveIndex]);
349
- return false;
350
- }
351
- return true;
264
+ }
265
+ removeSelectedTag() {
266
+ if (Array.isArray(this.props.selected) && this.state.tagsActiveIndex != null) {
267
+ this.removeTag(this.props.selected[this.state.tagsActiveIndex]);
268
+ return false;
352
269
  }
353
- }, {
354
- key: "handleBackspace",
355
- value: function handleBackspace(event) {
356
- if (!this.props.tags) {
357
- return true;
358
- }
359
- if (!this.isEventTargetFilter(event)) {
360
- this.removeSelectedTag();
361
- return false;
362
- }
363
- if ((event.target instanceof HTMLInputElement || event.target instanceof HTMLTextAreaElement) && !event.target.value) {
364
- this.removeTag();
365
- return false;
366
- }
270
+ return true;
271
+ }
272
+ handleBackspace(event) {
273
+ if (!this.props.tags) {
367
274
  return true;
368
275
  }
369
- }, {
370
- key: "_togglePopupFilterShortcuts",
371
- value: function _togglePopupFilterShortcuts(shortcutsDisabled) {
372
- this.setState({
373
- popupFilterShortcutsOptions: {
374
- modal: true,
375
- disabled: shortcutsDisabled
376
- }
377
- });
276
+ if (!this.isEventTargetFilter(event)) {
277
+ this.removeSelectedTag();
278
+ return false;
378
279
  }
379
- }, {
380
- key: "isVisible",
381
- value: function isVisible() {
382
- return this.popup && this.popup.isVisible();
280
+ if ((event.target instanceof HTMLInputElement || event.target instanceof HTMLTextAreaElement) && !event.target.value) {
281
+ this.removeTag();
282
+ return false;
383
283
  }
384
- }, {
385
- key: "getFilter",
386
- value: function getFilter() {
387
- if (this.props.filter || this.props.tags) {
388
- var _this$props$filterIco;
389
- return /*#__PURE__*/jsxs("div", {
390
- className: modules_b607bec2.filterWrapper,
391
- "data-test": "ring-select-popup-filter",
392
- children: [!this.props.tags && /*#__PURE__*/jsx(Icon, {
393
- glyph: (_this$props$filterIco = this.props.filterIcon) !== null && _this$props$filterIco !== void 0 ? _this$props$filterIco : searchIcon,
394
- className: modules_b607bec2.filterIcon,
395
- "data-test-custom": "ring-select-popup-filter-icon"
396
- }), /*#__PURE__*/jsx(FilterWithShortcuts, {
397
- rgShortcutsOptions: this.state.popupFilterShortcutsOptions,
398
- rgShortcutsMap: this.popupFilterShortcutsMap,
399
- value: this.props.filterValue,
400
- inputRef: this.composedFilterRef(this.filterRef, this.props.filterRef),
401
- onBlur: this.popupFilterOnBlur,
402
- onFocus: this.onFilterFocus,
403
- className: "ring-js-shortcuts",
404
- inputClassName: classNames({
405
- [modules_b607bec2.filterWithTagsInput]: this.props.tags
406
- }),
407
- placeholder: typeof this.props.filter === 'object' ? this.props.filter.placeholder : undefined,
408
- height: this.props.tags ? ControlsHeight.S : ControlsHeight.L,
409
- onChange: this.props.onFilter,
410
- onClick: this.onClickHandler,
411
- onClear: this.props.tags ? undefined : this.props.onClear,
412
- "data-test-custom": "ring-select-popup-filter-input",
413
- listId: this.props.listId,
414
- enableShortcuts: Object.keys(this.popupFilterShortcutsMap)
415
- })]
416
- });
284
+ return true;
285
+ }
286
+ _togglePopupFilterShortcuts(shortcutsDisabled) {
287
+ this.setState({
288
+ popupFilterShortcutsOptions: {
289
+ modal: true,
290
+ disabled: shortcutsDisabled
417
291
  }
418
- return null;
292
+ });
293
+ }
294
+ isVisible() {
295
+ return this.popup && this.popup.isVisible();
296
+ }
297
+ getFilter() {
298
+ if (this.props.filter || this.props.tags) {
299
+ var _this$props$filterIco;
300
+ return /*#__PURE__*/jsxs("div", {
301
+ className: modules_b607bec2.filterWrapper,
302
+ "data-test": "ring-select-popup-filter",
303
+ children: [!this.props.tags && /*#__PURE__*/jsx(Icon, {
304
+ glyph: (_this$props$filterIco = this.props.filterIcon) !== null && _this$props$filterIco !== void 0 ? _this$props$filterIco : searchIcon,
305
+ className: modules_b607bec2.filterIcon,
306
+ "data-test-custom": "ring-select-popup-filter-icon"
307
+ }), /*#__PURE__*/jsx(FilterWithShortcuts, {
308
+ rgShortcutsOptions: this.state.popupFilterShortcutsOptions,
309
+ rgShortcutsMap: this.popupFilterShortcutsMap,
310
+ value: this.props.filterValue,
311
+ inputRef: this.composedFilterRef(this.filterRef, this.props.filterRef),
312
+ onBlur: this.popupFilterOnBlur,
313
+ onFocus: this.onFilterFocus,
314
+ className: "ring-js-shortcuts",
315
+ inputClassName: classNames({
316
+ [modules_b607bec2.filterWithTagsInput]: this.props.tags
317
+ }),
318
+ placeholder: typeof this.props.filter === 'object' ? this.props.filter.placeholder : undefined,
319
+ height: this.props.tags ? ControlsHeight.S : ControlsHeight.L,
320
+ onChange: this.props.onFilter,
321
+ onClick: this.onClickHandler,
322
+ onClear: this.props.tags ? undefined : this.props.onClear,
323
+ "data-test-custom": "ring-select-popup-filter-input",
324
+ listId: this.props.listId,
325
+ enableShortcuts: Object.keys(this.popupFilterShortcutsMap)
326
+ })]
327
+ });
419
328
  }
420
- }, {
421
- key: "getCustomTag",
422
- value: function getCustomTag(tags) {
423
- if (tags !== null && typeof tags !== 'boolean') {
424
- return tags.customTagComponent;
425
- }
426
- return undefined;
329
+ return null;
330
+ }
331
+ getCustomTag(tags) {
332
+ if (tags !== null && typeof tags !== 'boolean') {
333
+ return tags.customTagComponent;
427
334
  }
428
- }, {
429
- key: "getTags",
430
- value: function getTags() {
431
- return Array.isArray(this.props.selected) && /*#__PURE__*/jsx("div", {
432
- children: /*#__PURE__*/jsx(TagsList, {
433
- tags: this.props.selected,
434
- activeIndex: this.state.tagsActiveIndex,
435
- handleRemove: this.handleRemoveTag,
436
- handleClick: this.handleTagClick,
437
- disabled: this.props.disabled,
438
- customTagComponent: this.getCustomTag(this.props.tags)
439
- })
335
+ return undefined;
336
+ }
337
+ getTags() {
338
+ return Array.isArray(this.props.selected) && /*#__PURE__*/jsx("div", {
339
+ children: /*#__PURE__*/jsx(TagsList, {
340
+ tags: this.props.selected,
341
+ activeIndex: this.state.tagsActiveIndex,
342
+ handleRemove: this.handleRemoveTag,
343
+ handleClick: this.handleTagClick,
344
+ disabled: this.props.disabled,
345
+ customTagComponent: this.getCustomTag(this.props.tags)
346
+ })
347
+ });
348
+ }
349
+ getFilterWithTags() {
350
+ if (this.props.tags) {
351
+ const classes = classNames([modules_b607bec2.filterWithTags, {
352
+ [modules_b607bec2.filterWithTagsFocused]: !this.state.popupFilterShortcutsOptions.disabled
353
+ }]);
354
+ return /*#__PURE__*/jsxs("div", {
355
+ className: classes,
356
+ children: [this.getTags(), this.getFilter()]
440
357
  });
441
358
  }
442
- }, {
443
- key: "getFilterWithTags",
444
- value: function getFilterWithTags() {
445
- if (this.props.tags) {
446
- var classes = classNames([modules_b607bec2.filterWithTags, {
447
- [modules_b607bec2.filterWithTagsFocused]: !this.state.popupFilterShortcutsOptions.disabled
448
- }]);
449
- return /*#__PURE__*/jsxs("div", {
450
- className: classes,
451
- children: [this.getTags(), this.getFilter()]
452
- });
359
+ return this.getFilter();
360
+ }
361
+ getBottomLine() {
362
+ const {
363
+ loading,
364
+ message,
365
+ data
366
+ } = this.props;
367
+ const hasMoreThanOneItem = data.length > 1;
368
+ return (loading || message) && /*#__PURE__*/jsxs("div", {
369
+ className: classNames(modules_b607bec2.bottomLine, {
370
+ [modules_b607bec2.bottomLineOverItem]: hasMoreThanOneItem
371
+ }),
372
+ children: [loading && /*#__PURE__*/jsx(LoaderInline, {}), message && /*#__PURE__*/jsx("div", {
373
+ className: modules_b607bec2.message,
374
+ children: message
375
+ })]
376
+ });
377
+ }
378
+ getList(ringPopupTarget) {
379
+ if (this.props.data.length) {
380
+ let {
381
+ maxHeight
382
+ } = this.props;
383
+ if (this.props.anchorElement) {
384
+ maxHeight = this._adjustListMaxHeight(this.props.hidden, maxHeight, ringPopupTarget);
453
385
  }
454
- return this.getFilter();
455
- }
456
- }, {
457
- key: "getBottomLine",
458
- value: function getBottomLine() {
459
- var _this$props = this.props,
460
- loading = _this$props.loading,
461
- message = _this$props.message,
462
- data = _this$props.data;
463
- var hasMoreThanOneItem = data.length > 1;
464
- return (loading || message) && /*#__PURE__*/jsxs("div", {
465
- className: classNames(modules_b607bec2.bottomLine, {
466
- [modules_b607bec2.bottomLineOverItem]: hasMoreThanOneItem
467
- }),
468
- children: [loading && /*#__PURE__*/jsx(LoaderInline, {}), message && /*#__PURE__*/jsx("div", {
469
- className: modules_b607bec2.message,
470
- children: message
471
- })]
386
+ if (this.props.filter) {
387
+ maxHeight -= FILTER_HEIGHT;
388
+ }
389
+ if (this.props.toolbar) {
390
+ maxHeight -= TOOLBAR_HEIGHT;
391
+ }
392
+ return /*#__PURE__*/jsx(List, {
393
+ id: this.props.listId,
394
+ maxHeight: maxHeight,
395
+ data: this.props.data,
396
+ activeIndex: this.props.activeIndex,
397
+ ref: this.listRef,
398
+ restoreActiveIndex: true,
399
+ activateFirstItem: true,
400
+ onSelect: this.onListSelect,
401
+ onResize: this.handleListResize,
402
+ onScrollToBottom: this.props.onLoadMore,
403
+ hidden: this.props.hidden,
404
+ shortcuts: !this.props.hidden,
405
+ disableMoveOverflow: this.props.disableMoveOverflow,
406
+ disableMoveDownOverflow: this.props.loading,
407
+ disableScrollToActive: this.props.disableScrollToActive,
408
+ compact: this.props.compact,
409
+ preventListOverscroll: this.props.preventListOverscroll,
410
+ renderOptimization: this.props.renderOptimization
472
411
  });
473
412
  }
474
- }, {
475
- key: "getList",
476
- value: function getList(ringPopupTarget) {
477
- if (this.props.data.length) {
478
- var maxHeight = this.props.maxHeight;
479
- if (this.props.anchorElement) {
480
- maxHeight = this._adjustListMaxHeight(this.props.hidden, maxHeight, ringPopupTarget);
481
- }
482
- if (this.props.filter) {
483
- maxHeight -= FILTER_HEIGHT;
484
- }
485
- if (this.props.toolbar) {
486
- maxHeight -= TOOLBAR_HEIGHT;
487
- }
488
- return /*#__PURE__*/jsx(List, {
489
- id: this.props.listId,
490
- maxHeight: maxHeight,
491
- data: this.props.data,
492
- activeIndex: this.props.activeIndex,
493
- ref: this.listRef,
494
- restoreActiveIndex: true,
495
- activateFirstItem: true,
496
- onSelect: this.onListSelect,
497
- onResize: this.handleListResize,
498
- onScrollToBottom: this.props.onLoadMore,
499
- hidden: this.props.hidden,
500
- shortcuts: !this.props.hidden,
501
- disableMoveOverflow: this.props.disableMoveOverflow,
502
- disableMoveDownOverflow: this.props.loading,
503
- disableScrollToActive: this.props.disableScrollToActive,
504
- compact: this.props.compact,
505
- preventListOverscroll: this.props.preventListOverscroll,
506
- renderOptimization: this.props.renderOptimization
413
+ return null;
414
+ }
415
+ render() {
416
+ const {
417
+ toolbar,
418
+ topbar,
419
+ className,
420
+ multiple,
421
+ hidden,
422
+ isInputMode,
423
+ anchorElement,
424
+ minWidth,
425
+ onCloseAttempt,
426
+ onOutsideClick,
427
+ directions,
428
+ top,
429
+ left,
430
+ offset,
431
+ style,
432
+ dir,
433
+ filter
434
+ } = this.props;
435
+ const classes = classNames(modules_b607bec2.popup, className);
436
+ return /*#__PURE__*/jsx(PopupTargetContext.Consumer, {
437
+ children: ringPopupTarget => {
438
+ const filterWithTags = this.getFilterWithTags();
439
+ const selectAll = multiple && typeof multiple === 'object' && !multiple.limit && multiple.selectAll && this.getSelectAll();
440
+ const list = this.getList(this.props.ringPopupTarget || ringPopupTarget);
441
+ const bottomLine = this.getBottomLine();
442
+ const hasContent = filterWithTags || selectAll || list || bottomLine || toolbar || topbar;
443
+ return /*#__PURE__*/jsx(Popup, {
444
+ trapFocus: false,
445
+ ref: this.popupRef,
446
+ hidden: hidden || !hasContent,
447
+ attached: isInputMode,
448
+ className: classes,
449
+ dontCloseOnAnchorClick: true,
450
+ anchorElement: anchorElement,
451
+ minWidth: minWidth,
452
+ onCloseAttempt: onCloseAttempt,
453
+ onOutsideClick: onOutsideClick,
454
+ directions: directions,
455
+ top: top,
456
+ left: left,
457
+ offset: offset,
458
+ onMouseDown: this.mouseDownHandler,
459
+ target: this.props.ringPopupTarget,
460
+ autoCorrectTopOverflow: false,
461
+ style: style,
462
+ children: /*#__PURE__*/jsxs("div", {
463
+ dir: dir,
464
+ children: [!hidden && filter && /*#__PURE__*/jsx(Shortcuts, {
465
+ map: this.shortcutsMap,
466
+ scope: this.shortcutsScope
467
+ }), topbar, hidden ? /*#__PURE__*/jsx("div", {}) : filterWithTags, selectAll, list, bottomLine, toolbar]
468
+ })
507
469
  });
508
470
  }
509
- return null;
510
- }
511
- }, {
512
- key: "render",
513
- value: function render() {
514
- var _this3 = this;
515
- var _this$props2 = this.props,
516
- toolbar = _this$props2.toolbar,
517
- topbar = _this$props2.topbar,
518
- className = _this$props2.className,
519
- multiple = _this$props2.multiple,
520
- hidden = _this$props2.hidden,
521
- isInputMode = _this$props2.isInputMode,
522
- anchorElement = _this$props2.anchorElement,
523
- minWidth = _this$props2.minWidth,
524
- onCloseAttempt = _this$props2.onCloseAttempt,
525
- onOutsideClick = _this$props2.onOutsideClick,
526
- directions = _this$props2.directions,
527
- top = _this$props2.top,
528
- left = _this$props2.left,
529
- offset = _this$props2.offset,
530
- style = _this$props2.style,
531
- dir = _this$props2.dir,
532
- filter = _this$props2.filter;
533
- var classes = classNames(modules_b607bec2.popup, className);
534
- return /*#__PURE__*/jsx(PopupTargetContext.Consumer, {
535
- children: function children(ringPopupTarget) {
536
- var filterWithTags = _this3.getFilterWithTags();
537
- var selectAll = multiple && typeof multiple === 'object' && !multiple.limit && multiple.selectAll && _this3.getSelectAll();
538
- var list = _this3.getList(_this3.props.ringPopupTarget || ringPopupTarget);
539
- var bottomLine = _this3.getBottomLine();
540
- var hasContent = filterWithTags || selectAll || list || bottomLine || toolbar || topbar;
541
- return /*#__PURE__*/jsx(Popup, {
542
- trapFocus: false,
543
- ref: _this3.popupRef,
544
- hidden: hidden || !hasContent,
545
- attached: isInputMode,
546
- className: classes,
547
- dontCloseOnAnchorClick: true,
548
- anchorElement: anchorElement,
549
- minWidth: minWidth,
550
- onCloseAttempt: onCloseAttempt,
551
- onOutsideClick: onOutsideClick,
552
- directions: directions,
553
- top: top,
554
- left: left,
555
- offset: offset,
556
- onMouseDown: _this3.mouseDownHandler,
557
- target: _this3.props.ringPopupTarget,
558
- autoCorrectTopOverflow: false,
559
- style: style,
560
- children: /*#__PURE__*/jsxs("div", {
561
- dir: dir,
562
- children: [!hidden && filter && /*#__PURE__*/jsx(Shortcuts, {
563
- map: _this3.shortcutsMap,
564
- scope: _this3.shortcutsScope
565
- }), topbar, hidden ? /*#__PURE__*/jsx("div", {}) : filterWithTags, selectAll, list, bottomLine, toolbar]
566
- })
567
- });
568
- }
569
- });
570
- }
571
- }]);
572
- }(PureComponent);
471
+ });
472
+ }
473
+ }
573
474
  _defineProperty(SelectPopup, "defaultProps", {
574
475
  data: [],
575
476
  activeIndex: null,
@@ -596,54 +497,5 @@ _defineProperty(SelectPopup, "defaultProps", {
596
497
  onSelectAll: noop,
597
498
  onEmptyPopupEnter: noop
598
499
  });
599
- SelectPopup.propTypes = {
600
- activeIndex: PropTypes.number,
601
- anchorElement: PropTypes.instanceOf(HTMLElement),
602
- className: PropTypes.string,
603
- compact: PropTypes.bool,
604
- data: PropTypes.array,
605
- dir: PropTypes.oneOf(['ltr', 'rtl']),
606
- directions: PropTypes.array,
607
- disabled: PropTypes.bool,
608
- disableMoveOverflow: PropTypes.bool,
609
- disableScrollToActive: PropTypes.bool,
610
- filter: PropTypes.oneOfType([PropTypes.bool, PropTypes.shape({
611
- value: PropTypes.string,
612
- placeholder: PropTypes.string
613
- })]),
614
- filterValue: PropTypes.string,
615
- filterIcon: PropTypes.oneOfType([PropTypes.string, PropTypes.elementType]),
616
- filterRef: PropTypes.oneOfType([PropTypes.func, refObject(PropTypes.instanceOf(HTMLInputElement))]),
617
- hidden: PropTypes.bool,
618
- isInputMode: PropTypes.bool,
619
- listId: PropTypes.string,
620
- maxHeight: PropTypes.number,
621
- message: PropTypes.string,
622
- minWidth: PropTypes.number,
623
- multiple: PropTypes.oneOfType([PropTypes.bool, PropTypes.shape({
624
- label: PropTypes.string,
625
- limit: PropTypes.number,
626
- selectAll: PropTypes.bool
627
- })]),
628
- left: PropTypes.number,
629
- loading: PropTypes.bool,
630
- onClear: PropTypes.func,
631
- onCloseAttempt: PropTypes.func,
632
- onOutsideClick: PropTypes.func,
633
- onEmptyPopupEnter: PropTypes.func,
634
- onFilter: PropTypes.func,
635
- onLoadMore: PropTypes.func,
636
- onSelect: PropTypes.func,
637
- onSelectAll: PropTypes.func,
638
- renderOptimization: PropTypes.bool,
639
- ringPopupTarget: PropTypes.string,
640
- selected: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
641
- style: PropTypes.object,
642
- tags: PropTypes.object,
643
- toolbar: PropTypes.node,
644
- topbar: PropTypes.node,
645
- top: PropTypes.number,
646
- preventListOverscroll: PropTypes.bool
647
- };
648
500
 
649
501
  export { SelectPopup as default };