@jetbrains/ring-ui 5.0.126 → 5.0.128

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 (305) hide show
  1. package/components/alert/alert.js +2 -1
  2. package/components/alert/container.js +2 -1
  3. package/components/auth/auth__core.js +2 -1
  4. package/components/auth/request-builder.js +2 -1
  5. package/components/auth/response-parser.js +2 -1
  6. package/components/auth/token-validator.js +2 -1
  7. package/components/auth-dialog/auth-dialog.js +2 -1
  8. package/components/avatar/avatar.js +2 -1
  9. package/components/badge/badge.js +2 -1
  10. package/components/button/button.js +2 -1
  11. package/components/button-group/button-group.js +2 -1
  12. package/components/button-group/caption.js +2 -1
  13. package/components/button-set/button-set.js +2 -1
  14. package/components/button-toolbar/button-toolbar.js +2 -1
  15. package/components/caret/caret.js +2 -1
  16. package/components/checkbox/checkbox.js +2 -1
  17. package/components/code/code.js +2 -1
  18. package/components/confirm/confirm.js +2 -1
  19. package/components/content-layout/content-layout.js +2 -1
  20. package/components/content-layout/sidebar.js +2 -1
  21. package/components/data-list/data-list.js +2 -1
  22. package/components/data-list/item.js +2 -1
  23. package/components/date-picker/date-input.js +2 -1
  24. package/components/date-picker/date-picker.js +2 -1
  25. package/components/date-picker/date-popup.js +2 -1
  26. package/components/date-picker/day.js +2 -1
  27. package/components/date-picker/month-slider.js +2 -1
  28. package/components/date-picker/years.js +2 -1
  29. package/components/dialog/dialog.d.ts +4 -16
  30. package/components/dialog/dialog.js +6 -3
  31. package/components/dropdown/dropdown.js +2 -1
  32. package/components/editable-heading/editable-heading.css +2 -0
  33. package/components/error-bubble/error-bubble.js +2 -1
  34. package/components/error-message/error-message.js +2 -1
  35. package/components/footer/footer.js +1 -0
  36. package/components/global/react-dom-renderer.js +2 -1
  37. package/components/grid/col.js +2 -1
  38. package/components/grid/grid.js +2 -1
  39. package/components/grid/row.js +2 -1
  40. package/components/group/group.js +2 -1
  41. package/components/header/logo.js +2 -1
  42. package/components/header/profile.js +2 -1
  43. package/components/header/services-link.js +2 -1
  44. package/components/header/services.js +2 -1
  45. package/components/header/smart-profile.js +2 -1
  46. package/components/header/smart-services.js +2 -1
  47. package/components/header/tray-icon.js +2 -1
  48. package/components/header/tray.js +2 -1
  49. package/components/hub-source/hub-source.js +2 -1
  50. package/components/icon/icon.js +2 -1
  51. package/components/input/input.js +2 -1
  52. package/components/island/island.js +2 -1
  53. package/components/island-legacy/content-legacy.js +2 -1
  54. package/components/island-legacy/header-legacy.js +2 -1
  55. package/components/island-legacy/island-legacy.js +2 -1
  56. package/components/link/clickableLink.js +2 -1
  57. package/components/list/list.js +2 -1
  58. package/components/list/list__hint.js +2 -1
  59. package/components/list/list__users-groups-source.js +2 -1
  60. package/components/loader/loader.js +2 -1
  61. package/components/loader/loader__core.js +2 -1
  62. package/components/loader-screen/loader-screen.js +2 -1
  63. package/components/login-dialog/login-dialog.js +2 -1
  64. package/components/message/message.js +2 -1
  65. package/components/pager/pager.js +2 -1
  66. package/components/panel/panel.js +2 -1
  67. package/components/permissions/permissions.js +2 -1
  68. package/components/permissions/permissions__cache.js +2 -1
  69. package/components/popup/popup.js +2 -1
  70. package/components/popup-menu/popup-menu.js +2 -1
  71. package/components/progress-bar/progress-bar.js +2 -1
  72. package/components/query-assist/query-assist.js +4 -3
  73. package/components/radio/radio.js +2 -1
  74. package/components/radio/radio__item.js +2 -1
  75. package/components/select/select.js +3 -2
  76. package/components/select/select__filter.js +2 -1
  77. package/components/select/select__popup.js +4 -2
  78. package/components/shortcuts/shortcuts.js +2 -1
  79. package/components/storage/storage__fallback.js +2 -1
  80. package/components/tab-trap/tab-trap.js +2 -1
  81. package/components/table/cell.js +2 -1
  82. package/components/table/header-cell.js +2 -1
  83. package/components/table/header.js +2 -1
  84. package/components/table/multitable.js +2 -1
  85. package/components/table/row.js +3 -2
  86. package/components/table/table.js +4 -2
  87. package/components/tabs/smart-tabs.js +2 -1
  88. package/components/tabs/tab.js +2 -1
  89. package/components/tag/tag.js +2 -1
  90. package/components/tags-input/tags-input.d.ts +1 -1
  91. package/components/tags-input/tags-input.js +3 -2
  92. package/components/tags-list/tags-list.js +2 -1
  93. package/components/text/text.js +2 -1
  94. package/components/tooltip/tooltip.js +2 -1
  95. package/components/user-agreement/user-agreement.js +2 -1
  96. package/components/user-card/card.js +2 -1
  97. package/components/user-card/smart-user-card-tooltip.d.ts +1 -1
  98. package/components/user-card/smart-user-card-tooltip.js +2 -1
  99. package/components/user-card/tooltip.js +2 -1
  100. package/dist/_helpers/_rollupPluginBabelHelpers.js +1 -29
  101. package/dist/_helpers/anchor.js +1 -1
  102. package/dist/_helpers/card.js +44 -47
  103. package/dist/_helpers/footer.js +1 -0
  104. package/dist/_helpers/select__filter.js +10 -13
  105. package/dist/_helpers/services-link.js +10 -10
  106. package/dist/_helpers/sidebar.js +34 -37
  107. package/dist/_helpers/theme.js +1 -1
  108. package/dist/_helpers/title.js +12 -16
  109. package/dist/alert/alert.js +63 -66
  110. package/dist/alert/container.js +5 -5
  111. package/dist/alert-service/alert-service.js +5 -7
  112. package/dist/analytics/analytics.js +1 -2
  113. package/dist/analytics/analytics__custom-plugin.js +6 -8
  114. package/dist/auth/auth.js +1 -1
  115. package/dist/auth/auth__core.js +26 -26
  116. package/dist/auth/background-flow.js +4 -5
  117. package/dist/auth/iframe-flow.js +12 -12
  118. package/dist/auth/landing.js +1 -1
  119. package/dist/auth/request-builder.js +3 -5
  120. package/dist/auth/response-parser.js +5 -6
  121. package/dist/auth/storage.js +12 -12
  122. package/dist/auth/token-validator.js +13 -16
  123. package/dist/auth/window-flow.js +18 -19
  124. package/dist/auth-dialog/auth-dialog.js +54 -57
  125. package/dist/auth-dialog-service/auth-dialog-service.js +1 -1
  126. package/dist/auth-ng/auth-ng.js +1 -1
  127. package/dist/avatar/avatar.js +30 -33
  128. package/dist/avatar-ng/avatar-ng.js +1 -1
  129. package/dist/badge/badge.js +10 -10
  130. package/dist/badge-ng/badge-ng.js +1 -1
  131. package/dist/breadcrumb-ng/breadcrumb-ng.js +0 -1
  132. package/dist/button/button.js +24 -27
  133. package/dist/button-group/button-group.js +5 -5
  134. package/dist/button-group/caption.js +4 -4
  135. package/dist/button-ng/button-ng.js +68 -69
  136. package/dist/button-set/button-set.js +6 -6
  137. package/dist/button-toolbar/button-toolbar.js +6 -6
  138. package/dist/caret/caret.js +2 -4
  139. package/dist/checkbox/checkbox.js +27 -30
  140. package/dist/checkbox-ng/checkbox-ng.js +0 -1
  141. package/dist/code/code.js +17 -21
  142. package/dist/confirm/confirm.js +31 -34
  143. package/dist/confirm-ng/confirm-ng.js +1 -1
  144. package/dist/confirm-service/confirm-service.js +1 -1
  145. package/dist/content-layout/content-layout.js +17 -20
  146. package/dist/contenteditable/contenteditable.js +11 -11
  147. package/dist/data-list/data-list.js +49 -55
  148. package/dist/data-list/item.js +64 -67
  149. package/dist/data-list/selection.js +0 -1
  150. package/dist/data-list/title.js +1 -1
  151. package/dist/data-list-ng/data-list-ng.js +1 -1
  152. package/dist/date-picker/date-input.js +39 -42
  153. package/dist/date-picker/date-picker.js +162 -165
  154. package/dist/date-picker/date-popup.js +119 -119
  155. package/dist/date-picker/day.js +34 -38
  156. package/dist/date-picker/month-names.js +11 -14
  157. package/dist/date-picker/month-slider.js +24 -28
  158. package/dist/date-picker/month.js +1 -1
  159. package/dist/date-picker/months.js +1 -1
  160. package/dist/date-picker/years.js +9 -13
  161. package/dist/dialog/dialog.d.ts +4 -16
  162. package/dist/dialog/dialog.js +68 -65
  163. package/dist/dialog-ng/dialog-ng.js +21 -22
  164. package/dist/docked-panel-ng/docked-panel-ng.js +0 -1
  165. package/dist/dropdown/dropdown.js +101 -104
  166. package/dist/dropdown-menu/dropdown-menu.js +1 -1
  167. package/dist/editable-heading/editable-heading.js +1 -1
  168. package/dist/error-bubble/error-bubble.js +6 -6
  169. package/dist/error-message/error-message.js +10 -10
  170. package/dist/error-message-ng/error-message-ng.js +0 -1
  171. package/dist/footer-ng/footer-ng.js +19 -21
  172. package/dist/global/angular-component-factory.js +2 -3
  173. package/dist/global/dom.js +1 -5
  174. package/dist/global/focus-sensor-hoc.js +58 -61
  175. package/dist/global/listeners.js +1 -5
  176. package/dist/global/react-dom-renderer.js +8 -12
  177. package/dist/global/rerender-hoc.js +1 -5
  178. package/dist/global/ring-angular-component.js +1 -3
  179. package/dist/grid/col.js +13 -14
  180. package/dist/grid/grid.js +5 -5
  181. package/dist/grid/row.js +16 -17
  182. package/dist/group/group.js +5 -5
  183. package/dist/header/header.js +10 -10
  184. package/dist/header/logo.js +9 -9
  185. package/dist/header/profile.js +58 -58
  186. package/dist/header/services.js +19 -22
  187. package/dist/header/smart-profile.js +40 -43
  188. package/dist/header/smart-services.js +28 -31
  189. package/dist/header/tray-icon.js +6 -6
  190. package/dist/header/tray.js +5 -5
  191. package/dist/heading/heading.js +1 -1
  192. package/dist/heading-ng/heading-ng.js +1 -1
  193. package/dist/http/http.js +111 -107
  194. package/dist/http/http.mock.js +3 -4
  195. package/dist/hub-source/hub-source.js +7 -9
  196. package/dist/hub-source/hub-source__user.js +0 -1
  197. package/dist/hub-source/hub-source__users-groups.js +4 -5
  198. package/dist/icon/icon.js +18 -18
  199. package/dist/icon/icon__svg.js +1 -1
  200. package/dist/icon-ng/icon-ng.js +0 -1
  201. package/dist/input/input.js +35 -38
  202. package/dist/input-ng/input-ng.js +25 -26
  203. package/dist/island/adaptive-island-hoc.js +21 -25
  204. package/dist/island/content.js +62 -65
  205. package/dist/island/header.js +11 -11
  206. package/dist/island/island.js +8 -8
  207. package/dist/island-legacy/content-legacy.js +5 -5
  208. package/dist/island-legacy/header-legacy.js +5 -5
  209. package/dist/island-legacy/island-legacy.js +5 -5
  210. package/dist/link/clickableLink.js +27 -30
  211. package/dist/link/link.js +16 -16
  212. package/dist/list/list.js +389 -391
  213. package/dist/list/list__custom.js +6 -10
  214. package/dist/list/list__hint.js +3 -4
  215. package/dist/list/list__item.js +4 -7
  216. package/dist/list/list__link.js +1 -1
  217. package/dist/list/list__users-groups-source.js +3 -3
  218. package/dist/loader/loader.js +16 -19
  219. package/dist/loader/loader__core.js +62 -62
  220. package/dist/loader-inline/loader-inline.js +6 -6
  221. package/dist/loader-ng/loader-ng.js +3 -4
  222. package/dist/loader-screen/loader-screen.js +6 -6
  223. package/dist/loader-screen-ng/loader-screen-ng.js +0 -1
  224. package/dist/login-dialog/login-dialog.js +55 -58
  225. package/dist/login-dialog/service.js +1 -1
  226. package/dist/markdown/code.js +0 -1
  227. package/dist/markdown/markdown.js +1 -1
  228. package/dist/message/message.js +22 -25
  229. package/dist/old-browsers-message/white-list.js +2 -2
  230. package/dist/pager/pager.js +55 -58
  231. package/dist/pager-ng/pager-ng.js +1 -1
  232. package/dist/panel/panel.js +5 -5
  233. package/dist/panel-ng/panel-ng.js +0 -1
  234. package/dist/permissions/permissions.js +14 -16
  235. package/dist/permissions/permissions__cache.js +4 -6
  236. package/dist/permissions-ng/permissions-ng.js +1 -1
  237. package/dist/place-under-ng/place-under-ng.js +0 -1
  238. package/dist/popup/popup.js +118 -121
  239. package/dist/popup/popup.target.js +1 -1
  240. package/dist/popup/position.js +0 -1
  241. package/dist/popup-menu/popup-menu.js +19 -22
  242. package/dist/progress-bar/progress-bar.js +41 -44
  243. package/dist/progress-bar-ng/progress-bar-ng.js +1 -1
  244. package/dist/promised-click-ng/promised-click-ng.js +0 -1
  245. package/dist/query-assist/query-assist.js +507 -501
  246. package/dist/query-assist/query-assist__suggestions.js +1 -1
  247. package/dist/query-assist-ng/query-assist-ng.js +1 -1
  248. package/dist/radio/radio.js +10 -13
  249. package/dist/radio/radio__item.js +19 -22
  250. package/dist/select/select.js +351 -350
  251. package/dist/select/select__popup.js +148 -152
  252. package/dist/select-ng/select-ng.js +1 -1
  253. package/dist/select-ng/select-ng__lazy.js +4 -4
  254. package/dist/select-ng/select-ng__options.js +14 -15
  255. package/dist/shortcuts/core.js +35 -36
  256. package/dist/shortcuts/shortcuts-hoc.js +7 -11
  257. package/dist/shortcuts/shortcuts.js +10 -11
  258. package/dist/shortcuts-hint-ng/shortcuts-hint-ng.js +0 -1
  259. package/dist/shortcuts-ng/shortcuts-ng.js +0 -1
  260. package/dist/sidebar-ng/sidebar-ng.js +0 -1
  261. package/dist/storage/storage.js +1 -1
  262. package/dist/storage/storage__fallback.js +8 -10
  263. package/dist/storage/storage__local.js +2 -2
  264. package/dist/style.css +1 -1
  265. package/dist/tab-trap/tab-trap.js +84 -86
  266. package/dist/table/cell.js +6 -6
  267. package/dist/table/disable-hover-hoc.js +23 -25
  268. package/dist/table/header-cell.js +28 -31
  269. package/dist/table/header.js +58 -61
  270. package/dist/table/multitable.js +91 -95
  271. package/dist/table/row-with-focus-sensor.js +15 -18
  272. package/dist/table/row.js +51 -54
  273. package/dist/table/selection-shortcuts-hoc.js +145 -147
  274. package/dist/table/selection.js +7 -9
  275. package/dist/table/smart-table.js +21 -24
  276. package/dist/table/table.js +103 -109
  277. package/dist/table-legacy-ng/table-legacy-ng.js +1 -1
  278. package/dist/table-legacy-ng/table-legacy-ng__pager.js +1 -1
  279. package/dist/table-legacy-ng/table-legacy-ng__selection.js +1 -3
  280. package/dist/table-legacy-ng/table-legacy-ng__toolbar.js +0 -1
  281. package/dist/table-ng/smart-table-ng.js +1 -1
  282. package/dist/table-ng/table-ng.js +1 -1
  283. package/dist/tabs/collapsible-more.js +1 -1
  284. package/dist/tabs/collapsible-tab.js +1 -1
  285. package/dist/tabs/dumb-tabs.js +46 -49
  286. package/dist/tabs/smart-tabs.js +10 -10
  287. package/dist/tabs/tab.js +7 -8
  288. package/dist/tag/tag.js +42 -45
  289. package/dist/tags-input/tags-input.d.ts +1 -1
  290. package/dist/tags-input/tags-input.js +214 -213
  291. package/dist/tags-input-ng/tags-input-ng.js +1 -1
  292. package/dist/tags-list/tags-list.js +20 -20
  293. package/dist/template-ng/template-ng.js +25 -26
  294. package/dist/text/text.js +6 -6
  295. package/dist/toggle/toggle.js +19 -19
  296. package/dist/toggle-ng/toggle-ng.js +1 -1
  297. package/dist/tooltip/tooltip.js +86 -89
  298. package/dist/tooltip-ng/tooltip-ng.js +1 -1
  299. package/dist/user-agreement/service.js +207 -205
  300. package/dist/user-agreement/user-agreement.js +39 -42
  301. package/dist/user-card/smart-user-card-tooltip.d.ts +1 -1
  302. package/dist/user-card/smart-user-card-tooltip.js +32 -35
  303. package/dist/user-card/tooltip.js +26 -26
  304. package/dist/user-card-ng/user-card-ng.js +1 -1
  305. package/package.json +15 -15
@@ -1,6 +1,5 @@
1
1
  import angularComponentFactory from '../global/angular-component-factory.js';
2
2
  import Toggle from '../toggle/toggle.js';
3
- import '../_helpers/_rollupPluginBabelHelpers.js';
4
3
  import 'angular';
5
4
  import 'react';
6
5
  import '../global/react-render-adapter.js';
@@ -8,6 +7,7 @@ import 'react-dom';
8
7
  import '../global/ring-angular-component.js';
9
8
  import '../global/react-dom-renderer.js';
10
9
  import 'prop-types';
10
+ import '../_helpers/_rollupPluginBabelHelpers.js';
11
11
  import 'classnames';
12
12
  import '../global/data-tests.js';
13
13
 
@@ -1,4 +1,4 @@
1
- import { _ as _defineProperty, a as _extends } from '../_helpers/_rollupPluginBabelHelpers.js';
1
+ import { _ as _extends } from '../_helpers/_rollupPluginBabelHelpers.js';
2
2
  import React, { Component, createContext } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import classNames from 'classnames';
@@ -26,79 +26,23 @@ const TooltipContext = /*#__PURE__*/createContext(undefined);
26
26
  * @name Tooltip
27
27
  */
28
28
  class Tooltip extends Component {
29
- constructor() {
30
- super(...arguments);
31
- _defineProperty(this, "state", {
32
- showPopup: false,
33
- showNestedPopup: false
34
- });
35
- _defineProperty(this, "timeout", void 0);
36
- _defineProperty(this, "listeners", new Listeners());
37
- _defineProperty(this, "containerNode", void 0);
38
- _defineProperty(this, "containerRef", el => {
39
- this.containerNode = el;
40
- });
41
- _defineProperty(this, "tryToShowPopup", () => {
42
- const {
43
- delay,
44
- title
45
- } = this.props;
46
- if (!title) {
47
- return;
48
- }
49
- if (delay) {
50
- this.timeout = window.setTimeout(this.showPopup, delay);
51
- } else {
52
- this.showPopup();
53
- }
54
- });
55
- _defineProperty(this, "showPopup", () => {
56
- if (this.props.selfOverflowOnly) {
57
- const {
58
- containerNode
59
- } = this;
60
- // rare cases when containerNode is null are possible;
61
- // probably the collision is due to the asynchronous nature of the code,
62
- // i.e. this code runs after the component is unmounted,
63
- // although at first glance it looks unlikely.
64
- if (!containerNode) {
65
- return;
66
- }
67
- // inline element?
68
- if (containerNode.clientWidth === 0 && containerNode.clientHeight === 0) {
69
- return;
70
- }
71
- if (containerNode.scrollWidth <= containerNode.clientWidth && containerNode.scrollHeight <= containerNode.clientHeight) {
72
- return;
73
- }
74
- }
75
- this.context?.onNestedTooltipShow();
76
- this.setState({
77
- showPopup: true
78
- });
79
- });
80
- _defineProperty(this, "hidePopup", () => {
81
- clearTimeout(this.timeout);
82
- this.context?.onNestedTooltipHide();
83
- this.setState({
84
- showPopup: false
85
- });
86
- });
87
- _defineProperty(this, "popup", void 0);
88
- _defineProperty(this, "popupRef", el => {
89
- this.popup = el;
90
- });
91
- _defineProperty(this, "onNestedTooltipShow", () => {
92
- this.setState({
93
- showNestedPopup: true
94
- });
95
- });
96
- _defineProperty(this, "onNestedTooltipHide", () => {
97
- this.setState({
98
- showNestedPopup: false
99
- });
100
- });
101
- }
29
+ static propTypes = {
30
+ delay: PropTypes.number,
31
+ selfOverflowOnly: PropTypes.bool,
32
+ popupProps: PropTypes.object,
33
+ title: PropTypes.node,
34
+ children: PropTypes.node,
35
+ 'data-test': PropTypes.string
36
+ };
37
+ static defaultProps = {
38
+ title: '',
39
+ selfOverflowOnly: false,
40
+ popupProps: {}
41
+ };
42
+ state = {
43
+ showPopup: false,
44
+ showNestedPopup: false
45
+ };
102
46
  componentDidMount() {
103
47
  if (this.props.title) {
104
48
  this.addListeners();
@@ -115,6 +59,60 @@ class Tooltip extends Component {
115
59
  clearTimeout(this.timeout);
116
60
  this.listeners.removeAll();
117
61
  }
62
+ static PopupProps = Popup.PopupProps;
63
+ static contextType = TooltipContext;
64
+ timeout;
65
+ listeners = new Listeners();
66
+ containerNode;
67
+ containerRef = el => {
68
+ this.containerNode = el;
69
+ };
70
+ tryToShowPopup = () => {
71
+ const {
72
+ delay,
73
+ title
74
+ } = this.props;
75
+ if (!title) {
76
+ return;
77
+ }
78
+ if (delay) {
79
+ this.timeout = window.setTimeout(this.showPopup, delay);
80
+ } else {
81
+ this.showPopup();
82
+ }
83
+ };
84
+ showPopup = () => {
85
+ if (this.props.selfOverflowOnly) {
86
+ const {
87
+ containerNode
88
+ } = this;
89
+ // rare cases when containerNode is null are possible;
90
+ // probably the collision is due to the asynchronous nature of the code,
91
+ // i.e. this code runs after the component is unmounted,
92
+ // although at first glance it looks unlikely.
93
+ if (!containerNode) {
94
+ return;
95
+ }
96
+ // inline element?
97
+ if (containerNode.clientWidth === 0 && containerNode.clientHeight === 0) {
98
+ return;
99
+ }
100
+ if (containerNode.scrollWidth <= containerNode.clientWidth && containerNode.scrollHeight <= containerNode.clientHeight) {
101
+ return;
102
+ }
103
+ }
104
+ this.context?.onNestedTooltipShow();
105
+ this.setState({
106
+ showPopup: true
107
+ });
108
+ };
109
+ hidePopup = () => {
110
+ clearTimeout(this.timeout);
111
+ this.context?.onNestedTooltipHide();
112
+ this.setState({
113
+ showPopup: false
114
+ });
115
+ };
118
116
  addListeners() {
119
117
  if (this.containerNode != null) {
120
118
  this.listeners.add(this.containerNode, 'mouseover', this.tryToShowPopup);
@@ -124,6 +122,20 @@ class Tooltip extends Component {
124
122
  passive: true
125
123
  });
126
124
  }
125
+ popup;
126
+ popupRef = el => {
127
+ this.popup = el;
128
+ };
129
+ onNestedTooltipShow = () => {
130
+ this.setState({
131
+ showNestedPopup: true
132
+ });
133
+ };
134
+ onNestedTooltipHide = () => {
135
+ this.setState({
136
+ showNestedPopup: false
137
+ });
138
+ };
127
139
  render() {
128
140
  const {
129
141
  children,
@@ -167,20 +179,5 @@ class Tooltip extends Component {
167
179
  }, popupProps), title)));
168
180
  }
169
181
  }
170
- _defineProperty(Tooltip, "propTypes", {
171
- delay: PropTypes.number,
172
- selfOverflowOnly: PropTypes.bool,
173
- popupProps: PropTypes.object,
174
- title: PropTypes.node,
175
- children: PropTypes.node,
176
- 'data-test': PropTypes.string
177
- });
178
- _defineProperty(Tooltip, "defaultProps", {
179
- title: '',
180
- selfOverflowOnly: false,
181
- popupProps: {}
182
- });
183
- _defineProperty(Tooltip, "PopupProps", Popup.PopupProps);
184
- _defineProperty(Tooltip, "contextType", TooltipContext);
185
182
 
186
183
  export { Tooltip as default };
@@ -4,7 +4,6 @@ import classNames from 'classnames';
4
4
  import { render } from '../global/react-render-adapter.js';
5
5
  import Popup from '../popup/popup.js';
6
6
  import 'react-dom';
7
- import '../_helpers/_rollupPluginBabelHelpers.js';
8
7
  import 'prop-types';
9
8
  import '../global/get-uid.js';
10
9
  import '../global/schedule-raf.js';
@@ -16,6 +15,7 @@ import '../global/sniffer.js';
16
15
  import 'sniffr';
17
16
  import '../global/data-tests.js';
18
17
  import '../tab-trap/tab-trap.js';
18
+ import '../_helpers/_rollupPluginBabelHelpers.js';
19
19
  import '../popup/position.js';
20
20
  import '../popup/popup.consts.js';
21
21
  import '../popup/popup.target.js';
@@ -1,4 +1,3 @@
1
- import { _ as _defineProperty } from '../_helpers/_rollupPluginBabelHelpers.js';
2
1
  import React from 'react';
3
2
  import { render, unmountComponentAtNode } from '../global/react-render-adapter.js';
4
3
  import ActualStorage from '../storage/storage.js';
@@ -12,6 +11,7 @@ import 'react-dom';
12
11
  import '../storage/storage__local.js';
13
12
  import '../storage/storage__fallback.js';
14
13
  import 'deep-equal';
14
+ import '../_helpers/_rollupPluginBabelHelpers.js';
15
15
  import '../global/get-uid.js';
16
16
  import '../alert/container.js';
17
17
  import 'classnames';
@@ -92,150 +92,166 @@ const DEFAULT_AGREEMENT = {
92
92
  text: ''
93
93
  };
94
94
  class UserAgreementService {
95
+ config;
95
96
  constructor(config) {
96
- var _this = this;
97
- _defineProperty(this, "config", void 0);
98
- _defineProperty(this, "_dialogPromise", null);
99
- _defineProperty(this, "_alertPromise", null);
100
- _defineProperty(this, "tabId", Math.random());
101
- _defineProperty(this, "interval", ONE_HOUR);
102
- _defineProperty(this, "container", document.createElement('div'));
103
- _defineProperty(this, "storage", new ActualStorage());
104
- _defineProperty(this, "checkingPromise", null);
105
- _defineProperty(this, "guest", false);
106
- _defineProperty(this, "userAgreement", DEFAULT_AGREEMENT);
107
- _defineProperty(this, "userConsent", DEFAULT_CONSENT);
108
- _defineProperty(this, "intervalId", void 0);
109
- _defineProperty(this, "startChecking", () => {
110
- this.intervalId = window.setInterval(this.checkConsentAndShowDialog, this.interval);
111
- window.addEventListener('storage', this.onStorageEvent);
112
- this.checkConsentAndShowDialog();
113
- });
114
- _defineProperty(this, "stopChecking", () => {
115
- clearInterval(this.intervalId);
116
- window.removeEventListener('storage', this.onStorageEvent);
117
- this.hideDialog();
118
- });
119
- _defineProperty(this, "onStorageEvent", event => {
120
- if (event.key === storageKey && event.newValue != null) {
121
- const {
122
- tabId,
123
- command
124
- } = JSON.parse(event.newValue);
125
- if (tabId !== this.tabId) {
126
- if (command === showMessage) {
127
- this.checkConsentAndShowDialog(true);
128
- } else if (command === hideMessage) {
129
- this.hideDialogAndAlert(true);
130
- }
131
- }
132
- }
133
- });
134
- _defineProperty(this, "_notifyAboutShowing", () => {
135
- localStorage.setItem(storageKey, JSON.stringify({
136
- command: showMessage,
137
- tabId: this.tabId
138
- }));
139
- });
140
- _defineProperty(this, "_notifyAboutHiding", () => {
141
- localStorage.setItem(storageKey, JSON.stringify({
142
- command: hideMessage,
143
- tabId: this.tabId
144
- }));
145
- });
146
- _defineProperty(this, "getUserAgreement", async () => {
147
- this.userAgreement = (await this.config.getUserAgreement()) || DEFAULT_AGREEMENT;
148
- return this.userAgreement;
149
- });
150
- _defineProperty(this, "getUserConsent", async () => {
97
+ if (!config) {
98
+ throw new Error('Please pass a config to UserAgreementService');
99
+ }
100
+ if (!config.getUserAgreement) {
101
+ throw new Error('Please pass a "getUserAgreement" option to UserAgreementService');
102
+ }
103
+ if (!config.getUserConsent) {
104
+ throw new Error('Please pass a "getUserConsent" option to UserAgreementService');
105
+ }
106
+ if (!config.setUserConsent) {
107
+ throw new Error('Please pass a "setUserConsent" option to UserAgreementService');
108
+ }
109
+ this.config = config;
110
+ this.interval = config.interval || this.interval;
111
+ }
112
+ _dialogPromise = null;
113
+ _alertPromise = null;
114
+ tabId = Math.random();
115
+ interval = ONE_HOUR;
116
+ container = document.createElement('div');
117
+ storage = new ActualStorage();
118
+ checkingPromise = null;
119
+ guest = false;
120
+ userAgreement = DEFAULT_AGREEMENT;
121
+ userConsent = DEFAULT_CONSENT;
122
+ intervalId;
123
+ startChecking = () => {
124
+ this.intervalId = window.setInterval(this.checkConsentAndShowDialog, this.interval);
125
+ window.addEventListener('storage', this.onStorageEvent);
126
+ this.checkConsentAndShowDialog();
127
+ };
128
+ stopChecking = () => {
129
+ clearInterval(this.intervalId);
130
+ window.removeEventListener('storage', this.onStorageEvent);
131
+ this.hideDialog();
132
+ };
133
+ onStorageEvent = event => {
134
+ if (event.key === storageKey && event.newValue != null) {
151
135
  const {
152
- guest,
153
- endUserAgreementConsent
154
- } = await this.config.getUserConsent();
155
- this.guest = guest;
156
- if (guest) {
157
- this.userConsent = (await this.storage.get(GUEST_SESSION_KEY)) || this.userConsent;
158
- } else {
159
- this.userConsent = endUserAgreementConsent || this.userConsent;
160
- }
161
- return this.userConsent;
162
- });
163
- _defineProperty(this, "checkConsentAndShowDialog", async withoutNotifications => {
164
- if (await this.checkConsent()) {
165
- return this.hideDialogAndAlert(withoutNotifications);
166
- } else {
167
- return this.showDialogOrAlert(withoutNotifications);
168
- }
169
- });
170
- _defineProperty(this, "checkConsent", async () => {
171
- if (!this.checkingPromise) {
172
- this.checkingPromise = Promise.all([this.getUserAgreement(), this.getUserConsent()]);
136
+ tabId,
137
+ command
138
+ } = JSON.parse(event.newValue);
139
+ if (tabId !== this.tabId) {
140
+ if (command === showMessage) {
141
+ this.checkConsentAndShowDialog(true);
142
+ } else if (command === hideMessage) {
143
+ this.hideDialogAndAlert(true);
144
+ }
173
145
  }
174
- const [userAgreement, userConsent] = await this.checkingPromise;
175
- this.checkingPromise = null;
176
- const {
177
- enabled,
178
- majorVersion: actualVersion
179
- } = userAgreement;
146
+ }
147
+ };
148
+ _notifyAboutShowing = () => {
149
+ localStorage.setItem(storageKey, JSON.stringify({
150
+ command: showMessage,
151
+ tabId: this.tabId
152
+ }));
153
+ };
154
+ _notifyAboutHiding = () => {
155
+ localStorage.setItem(storageKey, JSON.stringify({
156
+ command: hideMessage,
157
+ tabId: this.tabId
158
+ }));
159
+ };
160
+ getUserAgreement = async () => {
161
+ this.userAgreement = (await this.config.getUserAgreement()) || DEFAULT_AGREEMENT;
162
+ return this.userAgreement;
163
+ };
164
+ getUserConsent = async () => {
165
+ const {
166
+ guest,
167
+ endUserAgreementConsent
168
+ } = await this.config.getUserConsent();
169
+ this.guest = guest;
170
+ if (guest) {
171
+ this.userConsent = (await this.storage.get(GUEST_SESSION_KEY)) || this.userConsent;
172
+ } else {
173
+ this.userConsent = endUserAgreementConsent || this.userConsent;
174
+ }
175
+ return this.userConsent;
176
+ };
177
+ checkConsentAndShowDialog = async withoutNotifications => {
178
+ if (await this.checkConsent()) {
179
+ return this.hideDialogAndAlert(withoutNotifications);
180
+ } else {
181
+ return this.showDialogOrAlert(withoutNotifications);
182
+ }
183
+ };
184
+ checkConsent = async () => {
185
+ if (!this.checkingPromise) {
186
+ this.checkingPromise = Promise.all([this.getUserAgreement(), this.getUserConsent()]);
187
+ }
188
+ const [userAgreement, userConsent] = await this.checkingPromise;
189
+ this.checkingPromise = null;
190
+ const {
191
+ enabled,
192
+ majorVersion: actualVersion
193
+ } = userAgreement;
194
+ const {
195
+ accepted,
196
+ majorVersion: acceptedVersion
197
+ } = userConsent;
198
+ return !enabled || accepted && actualVersion === acceptedVersion;
199
+ };
200
+ alertKey;
201
+ showAlert = withoutNotifications => {
202
+ if (this._alertPromise) {
203
+ return this._alertPromise;
204
+ }
205
+ this._alertPromise = new Promise((resolve, reject) => {
180
206
  const {
181
- accepted,
182
- majorVersion: acceptedVersion
183
- } = userConsent;
184
- return !enabled || accepted && actualVersion === acceptedVersion;
185
- });
186
- _defineProperty(this, "alertKey", void 0);
187
- _defineProperty(this, "showAlert", withoutNotifications => {
188
- if (this._alertPromise) {
189
- return this._alertPromise;
190
- }
191
- this._alertPromise = new Promise((resolve, reject) => {
192
- const {
193
- userAgreement,
194
- reviewNow,
195
- remindLater
196
- } = this.config.translations || {};
197
- const onRemind = () => {
198
- this.hideDialogAndAlert(withoutNotifications);
199
- reject('Postponed');
200
- };
201
- const onReview = async () => {
202
- await this.showDialog(true, false, {
203
- onRemindLater: onRemind
204
- });
205
- this.hideAlert(withoutNotifications);
206
- resolve();
207
- };
208
- const message = /*#__PURE__*/React.createElement(Group, null, /*#__PURE__*/React.createElement("span", null, userAgreement || 'User Agreement'), /*#__PURE__*/React.createElement(Link, {
209
- onClick: onReview,
210
- "data-test": "review"
211
- }, reviewNow || 'Review now'), /*#__PURE__*/React.createElement(Link, {
212
- onClick: onRemind,
213
- "data-test": "later"
214
- }, remindLater || 'Remind me later'));
215
- this.alertKey = alertService.addAlert(message, Alert.Type.WARNING, 0, {
216
- closeable: false
207
+ userAgreement,
208
+ reviewNow,
209
+ remindLater
210
+ } = this.config.translations || {};
211
+ const onRemind = () => {
212
+ this.hideDialogAndAlert(withoutNotifications);
213
+ reject('Postponed');
214
+ };
215
+ const onReview = async () => {
216
+ await this.showDialog(true, false, {
217
+ onRemindLater: onRemind
217
218
  });
219
+ this.hideAlert(withoutNotifications);
220
+ resolve();
221
+ };
222
+ const message = /*#__PURE__*/React.createElement(Group, null, /*#__PURE__*/React.createElement("span", null, userAgreement || 'User Agreement'), /*#__PURE__*/React.createElement(Link, {
223
+ onClick: onReview,
224
+ "data-test": "review"
225
+ }, reviewNow || 'Review now'), /*#__PURE__*/React.createElement(Link, {
226
+ onClick: onRemind,
227
+ "data-test": "later"
228
+ }, remindLater || 'Remind me later'));
229
+ this.alertKey = alertService.addAlert(message, Alert.Type.WARNING, 0, {
230
+ closeable: false
218
231
  });
219
- if (!withoutNotifications) {
220
- this._notifyAboutShowing();
221
- }
222
- return this._alertPromise;
223
232
  });
224
- _defineProperty(this, "hideAlert", withoutNotifications => {
225
- const {
226
- onRemindLater
227
- } = this.config;
228
- alertService.remove(this.alertKey);
229
- this.alertKey = null;
230
- this._alertPromise = null;
231
- if (onRemindLater) {
232
- onRemindLater();
233
- }
234
- if (!withoutNotifications) {
235
- this._notifyAboutHiding();
236
- }
237
- });
238
- _defineProperty(this, "showDialog", function (withoutNotifications) {
233
+ if (!withoutNotifications) {
234
+ this._notifyAboutShowing();
235
+ }
236
+ return this._alertPromise;
237
+ };
238
+ hideAlert = withoutNotifications => {
239
+ const {
240
+ onRemindLater
241
+ } = this.config;
242
+ alertService.remove(this.alertKey);
243
+ this.alertKey = null;
244
+ this._alertPromise = null;
245
+ if (onRemindLater) {
246
+ onRemindLater();
247
+ }
248
+ if (!withoutNotifications) {
249
+ this._notifyAboutHiding();
250
+ }
251
+ };
252
+ showDialog = (() => {
253
+ var _this = this;
254
+ return function (withoutNotifications) {
239
255
  let preview = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
240
256
  let restOptions = arguments.length > 2 ? arguments[2] : undefined;
241
257
  const {
@@ -279,78 +295,64 @@ class UserAgreementService {
279
295
  }
280
296
  }
281
297
  return _this._dialogPromise;
282
- });
283
- _defineProperty(this, "hideDialog", withoutNotifications => {
284
- const {
285
- onDialogHide
286
- } = this.config;
287
- unmountComponentAtNode(this.container);
288
- if (onDialogHide) {
289
- onDialogHide();
290
- this._dialogPromise = null;
291
- if (!withoutNotifications) {
292
- this._notifyAboutHiding();
293
- }
294
- }
295
- });
296
- _defineProperty(this, "showDialogOrAlert", (withoutNotifications, preview, restOptions) => {
297
- if (this.guest && !this.userAgreement.requiredForREST) {
298
- return this.showAlert(withoutNotifications);
299
- }
300
- return this.showDialog(withoutNotifications, preview, restOptions);
301
- });
302
- _defineProperty(this, "hideDialogAndAlert", withoutNotifications => {
303
- this.hideAlert(withoutNotifications);
304
- this.hideDialog(withoutNotifications);
305
- });
306
- _defineProperty(this, "onAccept", async () => {
307
- const {
308
- setUserConsent,
309
- onAccept
310
- } = this.config;
311
- if (this.guest) {
312
- const {
313
- majorVersion,
314
- minorVersion
315
- } = this.userAgreement;
316
- this.userConsent = {
317
- majorVersion,
318
- minorVersion,
319
- accepted: true
320
- };
321
- await this.storage.set(GUEST_SESSION_KEY, this.userConsent);
322
- } else {
323
- this.userConsent = await setUserConsent();
324
- }
325
- this.hideDialog();
326
- if (onAccept) {
327
- onAccept();
328
- }
329
- });
330
- _defineProperty(this, "onDecline", () => {
331
- const {
332
- onDecline
333
- } = this.config;
334
- this.hideDialog();
335
- if (onDecline) {
336
- onDecline();
298
+ };
299
+ })();
300
+ hideDialog = withoutNotifications => {
301
+ const {
302
+ onDialogHide
303
+ } = this.config;
304
+ unmountComponentAtNode(this.container);
305
+ if (onDialogHide) {
306
+ onDialogHide();
307
+ this._dialogPromise = null;
308
+ if (!withoutNotifications) {
309
+ this._notifyAboutHiding();
337
310
  }
338
- });
339
- if (!config) {
340
- throw new Error('Please pass a config to UserAgreementService');
341
311
  }
342
- if (!config.getUserAgreement) {
343
- throw new Error('Please pass a "getUserAgreement" option to UserAgreementService');
312
+ };
313
+ showDialogOrAlert = (withoutNotifications, preview, restOptions) => {
314
+ if (this.guest && !this.userAgreement.requiredForREST) {
315
+ return this.showAlert(withoutNotifications);
344
316
  }
345
- if (!config.getUserConsent) {
346
- throw new Error('Please pass a "getUserConsent" option to UserAgreementService');
317
+ return this.showDialog(withoutNotifications, preview, restOptions);
318
+ };
319
+ hideDialogAndAlert = withoutNotifications => {
320
+ this.hideAlert(withoutNotifications);
321
+ this.hideDialog(withoutNotifications);
322
+ };
323
+ onAccept = async () => {
324
+ const {
325
+ setUserConsent,
326
+ onAccept
327
+ } = this.config;
328
+ if (this.guest) {
329
+ const {
330
+ majorVersion,
331
+ minorVersion
332
+ } = this.userAgreement;
333
+ this.userConsent = {
334
+ majorVersion,
335
+ minorVersion,
336
+ accepted: true
337
+ };
338
+ await this.storage.set(GUEST_SESSION_KEY, this.userConsent);
339
+ } else {
340
+ this.userConsent = await setUserConsent();
347
341
  }
348
- if (!config.setUserConsent) {
349
- throw new Error('Please pass a "setUserConsent" option to UserAgreementService');
342
+ this.hideDialog();
343
+ if (onAccept) {
344
+ onAccept();
350
345
  }
351
- this.config = config;
352
- this.interval = config.interval || this.interval;
353
- }
346
+ };
347
+ onDecline = () => {
348
+ const {
349
+ onDecline
350
+ } = this.config;
351
+ this.hideDialog();
352
+ if (onDecline) {
353
+ onDecline();
354
+ }
355
+ };
354
356
  }
355
357
 
356
358
  export { UserAgreementService as default, hideMessage, showMessage };