@jetbrains/ring-ui 4.2.4 → 4.2.5

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 (315) hide show
  1. package/package.json +2 -2
  2. package/dist/_helpers/_rollupPluginBabelHelpers.js +0 -34
  3. package/dist/_helpers/anchor.js +0 -33
  4. package/dist/_helpers/badge.js +0 -3
  5. package/dist/_helpers/button-group.js +0 -3
  6. package/dist/_helpers/button-set.js +0 -3
  7. package/dist/_helpers/button-toolbar.js +0 -3
  8. package/dist/_helpers/button__classes.js +0 -39
  9. package/dist/_helpers/card.js +0 -75
  10. package/dist/_helpers/checkbox.js +0 -3
  11. package/dist/_helpers/date-picker.js +0 -3
  12. package/dist/_helpers/dialog__body-scroll-preventer.js +0 -58
  13. package/dist/_helpers/error-message.js +0 -3
  14. package/dist/_helpers/footer.js +0 -121
  15. package/dist/_helpers/grid.js +0 -3
  16. package/dist/_helpers/group.js +0 -3
  17. package/dist/_helpers/header.js +0 -3
  18. package/dist/_helpers/icon.js +0 -3
  19. package/dist/_helpers/inject-styles.js +0 -22
  20. package/dist/_helpers/input.js +0 -3
  21. package/dist/_helpers/island.js +0 -3
  22. package/dist/_helpers/link.js +0 -3
  23. package/dist/_helpers/list.js +0 -3
  24. package/dist/_helpers/loader-screen.js +0 -3
  25. package/dist/_helpers/panel.js +0 -3
  26. package/dist/_helpers/query-assist__suggestions.js +0 -95
  27. package/dist/_helpers/radio.js +0 -3
  28. package/dist/_helpers/select__filter.js +0 -77
  29. package/dist/_helpers/services-link.js +0 -40
  30. package/dist/_helpers/sidebar.js +0 -126
  31. package/dist/_helpers/table.js +0 -3
  32. package/dist/_helpers/tabs.js +0 -3
  33. package/dist/_helpers/title.js +0 -100
  34. package/dist/alert/alert.js +0 -262
  35. package/dist/alert/container.js +0 -48
  36. package/dist/alert-service/alert-service.js +0 -173
  37. package/dist/analytics/analytics.js +0 -118
  38. package/dist/analytics/analytics__custom-plugin.js +0 -128
  39. package/dist/analytics/analytics__fus-plugin.js +0 -102
  40. package/dist/analytics/analytics__ga-plugin.js +0 -75
  41. package/dist/analytics/analytics__plugin-utils.js +0 -80
  42. package/dist/analytics-ng/analytics-ng.js +0 -95
  43. package/dist/auth/auth.js +0 -96
  44. package/dist/auth/auth__core.js +0 -1059
  45. package/dist/auth/background-flow.js +0 -123
  46. package/dist/auth/down-notification.js +0 -117
  47. package/dist/auth/iframe-flow.js +0 -153
  48. package/dist/auth/landing-entry.js +0 -5
  49. package/dist/auth/landing.js +0 -90
  50. package/dist/auth/request-builder.js +0 -76
  51. package/dist/auth/response-parser.js +0 -118
  52. package/dist/auth/storage.js +0 -283
  53. package/dist/auth/token-validator.js +0 -178
  54. package/dist/auth/window-flow.js +0 -134
  55. package/dist/auth-dialog/auth-dialog.js +0 -180
  56. package/dist/auth-dialog-service/auth-dialog-service.js +0 -71
  57. package/dist/auth-ng/auth-ng.js +0 -206
  58. package/dist/auth-ng/auth-ng.mock.js +0 -33
  59. package/dist/autofocus-ng/autofocus-ng.js +0 -51
  60. package/dist/avatar/avatar-example-datauri.js +0 -4
  61. package/dist/avatar/avatar.js +0 -163
  62. package/dist/avatar/fallback-avatar.js +0 -142
  63. package/dist/avatar-editor-ng/avatar-editor-ng.js +0 -167
  64. package/dist/avatar-editor-ng/avatar-editor-ng__template.js +0 -3
  65. package/dist/avatar-ng/avatar-ng.js +0 -21
  66. package/dist/badge/badge.js +0 -51
  67. package/dist/badge-ng/badge-ng.js +0 -18
  68. package/dist/breadcrumb-ng/breadcrumb-ng.js +0 -37
  69. package/dist/button/button.js +0 -125
  70. package/dist/button/button__classes.js +0 -5
  71. package/dist/button-group/button-group.js +0 -30
  72. package/dist/button-group/caption.js +0 -24
  73. package/dist/button-group-ng/button-group-ng.js +0 -39
  74. package/dist/button-ng/button-ng.js +0 -217
  75. package/dist/button-set/button-set.js +0 -26
  76. package/dist/button-set-ng/button-set-ng.js +0 -19
  77. package/dist/button-toolbar/button-toolbar.js +0 -29
  78. package/dist/button-toolbar-ng/button-toolbar-ng.js +0 -24
  79. package/dist/caret/caret.js +0 -266
  80. package/dist/checkbox/checkbox.js +0 -110
  81. package/dist/checkbox-ng/checkbox-ng.js +0 -38
  82. package/dist/code/code.js +0 -137
  83. package/dist/compiler-ng/compiler-ng.js +0 -53
  84. package/dist/confirm/confirm.js +0 -127
  85. package/dist/confirm-ng/confirm-ng.js +0 -69
  86. package/dist/confirm-service/confirm-service.js +0 -117
  87. package/dist/content-layout/content-layout.js +0 -66
  88. package/dist/content-layout/sidebar.js +0 -7
  89. package/dist/contenteditable/contenteditable.js +0 -78
  90. package/dist/data-list/data-list.js +0 -208
  91. package/dist/data-list/data-list.mock.js +0 -191
  92. package/dist/data-list/item.js +0 -229
  93. package/dist/data-list/selection.js +0 -102
  94. package/dist/data-list/title.js +0 -20
  95. package/dist/data-list-ng/data-list-ng.js +0 -62
  96. package/dist/date-picker/consts.js +0 -69
  97. package/dist/date-picker/date-input.js +0 -175
  98. package/dist/date-picker/date-picker.js +0 -367
  99. package/dist/date-picker/date-popup.js +0 -483
  100. package/dist/date-picker/day.js +0 -120
  101. package/dist/date-picker/formats.js +0 -3
  102. package/dist/date-picker/month-names.js +0 -100
  103. package/dist/date-picker/month-slider.js +0 -84
  104. package/dist/date-picker/month.js +0 -55
  105. package/dist/date-picker/months.js +0 -122
  106. package/dist/date-picker/weekdays.js +0 -32
  107. package/dist/date-picker/years.js +0 -110
  108. package/dist/dialog/dialog.js +0 -202
  109. package/dist/dialog/dialog__body-scroll-preventer.js +0 -3
  110. package/dist/dialog-ng/dialog-ng.js +0 -604
  111. package/dist/dialog-ng/dialog-ng__template.js +0 -3
  112. package/dist/docked-panel-ng/docked-panel-ng.js +0 -171
  113. package/dist/dropdown/anchor.js +0 -19
  114. package/dist/dropdown/dropdown.js +0 -236
  115. package/dist/dropdown-menu/dropdown-menu.js +0 -177
  116. package/dist/error-bubble/error-bubble.js +0 -59
  117. package/dist/error-message/error-message.js +0 -57
  118. package/dist/error-message-ng/error-message-ng.js +0 -35
  119. package/dist/footer/footer.js +0 -12
  120. package/dist/footer-ng/footer-ng.js +0 -64
  121. package/dist/form-ng/form-ng.js +0 -167
  122. package/dist/global/angular-component-factory.js +0 -84
  123. package/dist/global/compose.js +0 -9
  124. package/dist/global/composeRefs.js +0 -15
  125. package/dist/global/conic-gradient.js +0 -35
  126. package/dist/global/create-stateful-context.js +0 -55
  127. package/dist/global/data-tests.js +0 -24
  128. package/dist/global/dom.js +0 -125
  129. package/dist/global/focus-sensor-hoc.js +0 -146
  130. package/dist/global/fuzzy-highlight.js +0 -67
  131. package/dist/global/get-event-key.js +0 -111
  132. package/dist/global/get-uid.js +0 -15
  133. package/dist/global/inject-styles.js +0 -15
  134. package/dist/global/linear-function.js +0 -17
  135. package/dist/global/listeners.js +0 -44
  136. package/dist/global/memoize.js +0 -20
  137. package/dist/global/normalize-indent.js +0 -30
  138. package/dist/global/promise-with-timeout.js +0 -17
  139. package/dist/global/radial-gradient-mask.js +0 -38
  140. package/dist/global/react-dom-renderer.js +0 -46
  141. package/dist/global/react-render-adapter.js +0 -41
  142. package/dist/global/rerender-hoc.js +0 -55
  143. package/dist/global/ring-angular-component.js +0 -24
  144. package/dist/global/schedule-raf.js +0 -31
  145. package/dist/global/sniffer.js +0 -6
  146. package/dist/global/supports-css.js +0 -22
  147. package/dist/global/theme.js +0 -54
  148. package/dist/global/trivial-template-tag.js +0 -17
  149. package/dist/global/url.js +0 -165
  150. package/dist/global/variables_dark.js +0 -57
  151. package/dist/grid/col.js +0 -60
  152. package/dist/grid/grid.js +0 -33
  153. package/dist/grid/row.js +0 -64
  154. package/dist/group/group.js +0 -31
  155. package/dist/group-ng/group-ng.js +0 -11
  156. package/dist/header/header.js +0 -150
  157. package/dist/header/logo.js +0 -40
  158. package/dist/header/profile.js +0 -219
  159. package/dist/header/services-link.js +0 -12
  160. package/dist/header/services.js +0 -138
  161. package/dist/header/smart-profile.js +0 -233
  162. package/dist/header/smart-services.js +0 -163
  163. package/dist/header/tray-icon.js +0 -47
  164. package/dist/header/tray.js +0 -31
  165. package/dist/heading/heading.js +0 -73
  166. package/dist/http/http.js +0 -218
  167. package/dist/http/http.mock.js +0 -67
  168. package/dist/hub-source/hub-source.js +0 -130
  169. package/dist/hub-source/hub-source__user.js +0 -30
  170. package/dist/hub-source/hub-source__users-groups.js +0 -63
  171. package/dist/icon/icon.js +0 -105
  172. package/dist/icon/icon__constants.js +0 -33
  173. package/dist/icon/icon__svg.js +0 -83
  174. package/dist/icon/index.js +0 -12
  175. package/dist/icon-ng/icon-ng.js +0 -91
  176. package/dist/input/input.js +0 -230
  177. package/dist/input-ng/input-ng.js +0 -111
  178. package/dist/island/adaptive-island-hoc.js +0 -48
  179. package/dist/island/content.js +0 -160
  180. package/dist/island/header.js +0 -84
  181. package/dist/island/island.js +0 -51
  182. package/dist/island-legacy/content-legacy.js +0 -26
  183. package/dist/island-legacy/header-legacy.js +0 -28
  184. package/dist/island-legacy/island-legacy.js +0 -28
  185. package/dist/island-ng/island-content-ng.js +0 -42
  186. package/dist/island-ng/island-header-ng.js +0 -26
  187. package/dist/island-ng/island-ng-class-fixer.js +0 -11
  188. package/dist/island-ng/island-ng.js +0 -25
  189. package/dist/link/clickableLink.js +0 -64
  190. package/dist/link/link.js +0 -115
  191. package/dist/link-ng/link-ng.js +0 -22
  192. package/dist/list/consts.js +0 -26
  193. package/dist/list/list.js +0 -818
  194. package/dist/list/list__custom.js +0 -86
  195. package/dist/list/list__hint.js +0 -26
  196. package/dist/list/list__item.js +0 -206
  197. package/dist/list/list__link.js +0 -65
  198. package/dist/list/list__separator.js +0 -30
  199. package/dist/list/list__title.js +0 -39
  200. package/dist/list/list__users-groups-source.js +0 -130
  201. package/dist/loader/loader.js +0 -71
  202. package/dist/loader/loader__core.js +0 -273
  203. package/dist/loader-inline/inject-styles.js +0 -13
  204. package/dist/loader-inline/loader-inline.js +0 -58
  205. package/dist/loader-inline-ng/loader-inline-ng.js +0 -44
  206. package/dist/loader-ng/loader-ng.js +0 -44
  207. package/dist/loader-screen/loader-screen.js +0 -44
  208. package/dist/loader-screen-ng/loader-screen-ng.js +0 -95
  209. package/dist/login-dialog/login-dialog.js +0 -188
  210. package/dist/login-dialog/service.js +0 -72
  211. package/dist/markdown/code.js +0 -31
  212. package/dist/markdown/heading.js +0 -23
  213. package/dist/markdown/link.js +0 -31
  214. package/dist/markdown/markdown.js +0 -74
  215. package/dist/message/message.js +0 -235
  216. package/dist/message-bundle-ng/message-bundle-ng.js +0 -111
  217. package/dist/old-browsers-message/old-browsers-message.js +0 -101
  218. package/dist/old-browsers-message/old-browsers-message__stop.js +0 -5
  219. package/dist/old-browsers-message/white-list.js +0 -34
  220. package/dist/pager/pager.js +0 -365
  221. package/dist/pager-ng/pager-ng.js +0 -100
  222. package/dist/panel/panel.js +0 -31
  223. package/dist/panel-ng/panel-ng.js +0 -17
  224. package/dist/permissions/permissions.js +0 -200
  225. package/dist/permissions/permissions__cache.js +0 -272
  226. package/dist/permissions-ng/permissions-ng.js +0 -277
  227. package/dist/place-under-ng/place-under-ng.js +0 -158
  228. package/dist/popup/popup.consts.js +0 -41
  229. package/dist/popup/popup.js +0 -396
  230. package/dist/popup/popup.target.js +0 -26
  231. package/dist/popup/position.js +0 -280
  232. package/dist/popup-menu/popup-menu.js +0 -117
  233. package/dist/progress-bar/progress-bar.js +0 -114
  234. package/dist/progress-bar-ng/progress-bar-ng.js +0 -17
  235. package/dist/promised-click-ng/promised-click-ng.js +0 -128
  236. package/dist/proxy-attrs/proxy-attrs.js +0 -21
  237. package/dist/query-assist/query-assist.js +0 -1096
  238. package/dist/query-assist/query-assist__suggestions.js +0 -49
  239. package/dist/query-assist-ng/query-assist-ng.js +0 -86
  240. package/dist/radio/radio.js +0 -42
  241. package/dist/radio/radio__item.js +0 -78
  242. package/dist/radio-ng/radio-ng.js +0 -47
  243. package/dist/save-field-ng/save-field-ng.js +0 -337
  244. package/dist/save-field-ng/save-field-ng__template.js +0 -3
  245. package/dist/select/select.js +0 -1357
  246. package/dist/select/select__filter.js +0 -56
  247. package/dist/select/select__popup.js +0 -553
  248. package/dist/select-ng/select-ng.js +0 -637
  249. package/dist/select-ng/select-ng__lazy.js +0 -169
  250. package/dist/select-ng/select-ng__options.js +0 -145
  251. package/dist/shortcuts/core.js +0 -245
  252. package/dist/shortcuts/shortcut-title.js +0 -51
  253. package/dist/shortcuts/shortcuts-hoc.js +0 -42
  254. package/dist/shortcuts/shortcuts.js +0 -72
  255. package/dist/shortcuts-hint-ng/shortcuts-hint-ng.js +0 -123
  256. package/dist/shortcuts-hint-ng/shortcuts-hint-ng__template.js +0 -3
  257. package/dist/shortcuts-ng/shortcuts-ng.js +0 -262
  258. package/dist/sidebar-ng/sidebar-ng.js +0 -113
  259. package/dist/sidebar-ng/sidebar-ng__button-template.js +0 -3
  260. package/dist/sidebar-ng/sidebar-ng__template.js +0 -3
  261. package/dist/storage/storage.js +0 -59
  262. package/dist/storage/storage__fallback.js +0 -215
  263. package/dist/storage/storage__local.js +0 -154
  264. package/dist/style.css +0 -1
  265. package/dist/tab-trap/tab-trap.js +0 -177
  266. package/dist/table/cell.js +0 -26
  267. package/dist/table/disable-hover-hoc.js +0 -54
  268. package/dist/table/header-cell.js +0 -92
  269. package/dist/table/header.js +0 -193
  270. package/dist/table/multitable.js +0 -141
  271. package/dist/table/row-with-focus-sensor.js +0 -83
  272. package/dist/table/row.js +0 -273
  273. package/dist/table/selection-adapter.js +0 -16
  274. package/dist/table/selection-shortcuts-hoc.js +0 -215
  275. package/dist/table/selection.js +0 -223
  276. package/dist/table/smart-table.js +0 -125
  277. package/dist/table/table.js +0 -406
  278. package/dist/table-legacy-ng/table-legacy-ng.js +0 -468
  279. package/dist/table-legacy-ng/table-legacy-ng__pager.js +0 -120
  280. package/dist/table-legacy-ng/table-legacy-ng__selection-navigate-actions.js +0 -123
  281. package/dist/table-legacy-ng/table-legacy-ng__selection.js +0 -179
  282. package/dist/table-legacy-ng/table-legacy-ng__toolbar.js +0 -57
  283. package/dist/table-ng/smart-table-ng.js +0 -68
  284. package/dist/table-ng/table-ng.js +0 -67
  285. package/dist/tabs/collapsible-more.js +0 -198
  286. package/dist/tabs/collapsible-tab.js +0 -91
  287. package/dist/tabs/collapsible-tabs.js +0 -362
  288. package/dist/tabs/custom-item.js +0 -13
  289. package/dist/tabs/dumb-tabs.js +0 -164
  290. package/dist/tabs/smart-tabs.js +0 -106
  291. package/dist/tabs/tab-link.js +0 -42
  292. package/dist/tabs/tab.js +0 -33
  293. package/dist/tabs/tabs.js +0 -71
  294. package/dist/tabs-ng/tabs-ng.js +0 -194
  295. package/dist/tabs-ng/tabs-ng__template.js +0 -3
  296. package/dist/tag/tag.js +0 -197
  297. package/dist/tags-input/tags-input.js +0 -482
  298. package/dist/tags-input-ng/tags-input-ng.js +0 -93
  299. package/dist/tags-list/tags-list.js +0 -95
  300. package/dist/template-ng/template-ng.js +0 -71
  301. package/dist/text/text.js +0 -36
  302. package/dist/theme-ng/theme-ng.js +0 -45
  303. package/dist/title-ng/title-ng.js +0 -114
  304. package/dist/toggle/toggle.js +0 -78
  305. package/dist/toggle-ng/toggle-ng.js +0 -18
  306. package/dist/tooltip/tooltip.js +0 -209
  307. package/dist/tooltip-ng/tooltip-ng.js +0 -104
  308. package/dist/user-agreement/service.js +0 -412
  309. package/dist/user-agreement/toolbox.eula.js +0 -3
  310. package/dist/user-agreement/user-agreement.js +0 -169
  311. package/dist/user-card/card.js +0 -19
  312. package/dist/user-card/smart-user-card-tooltip.js +0 -114
  313. package/dist/user-card/tooltip.js +0 -95
  314. package/dist/user-card/user-card.js +0 -51
  315. package/dist/user-card-ng/user-card-ng.js +0 -62
@@ -1,396 +0,0 @@
1
- import { _ as _defineProperty } from '../_helpers/_rollupPluginBabelHelpers.js';
2
- import 'core-js/modules/web.dom-collections.iterator.js';
3
- import 'core-js/modules/es.string.replace.js';
4
- import React, { PureComponent } from 'react';
5
- import { createPortal } from 'react-dom';
6
- import PropTypes from 'prop-types';
7
- import classNames from 'classnames';
8
- import getUID from '../global/get-uid.js';
9
- import scheduleRAF from '../global/schedule-raf.js';
10
- import { Listeners, getStyles } from '../global/dom.js';
11
- import Shortcuts from '../shortcuts/shortcuts.js';
12
- import joinDataTestAttributes from '../global/data-tests.js';
13
- import TabTrap from '../tab-trap/tab-trap.js';
14
- import position, { positionPropKeys } from './position.js';
15
- import { Display, DEFAULT_DIRECTIONS, Directions, Dimension, MinWidth, MaxHeight } from './popup.consts.js';
16
- import { PopupTargetContext, PopupTarget } from './popup.target.js';
17
- export { PopupTarget, PopupTargetContext } from './popup.target.js';
18
- import '../shortcuts/core.js';
19
- import 'combokeys';
20
- import '../global/sniffer.js';
21
- import 'sniffr';
22
-
23
- var modules_2f69e2e2 = {"popup":"popup_rui_7cd4 font_rui_8bff","hidden":"hidden_rui_7cd4","showing":"showing_rui_7cd4","attached":"attached_rui_7cd4"};
24
-
25
- const stop = e => e.stopPropagation();
26
-
27
- const getPopupContainer = target => typeof target === 'string' ? document.querySelector("[data-portaltarget=".concat(target, "]")) : target;
28
- /**
29
- * @constructor
30
- * @name Popup
31
- * @extends {ReactComponent}
32
- */
33
-
34
- class Popup extends PureComponent {
35
- constructor() {
36
- super(...arguments);
37
-
38
- _defineProperty(this, "state", {
39
- display: Display.SHOWING
40
- });
41
-
42
- _defineProperty(this, "listeners", new Listeners());
43
-
44
- _defineProperty(this, "redrawScheduler", scheduleRAF(true));
45
-
46
- _defineProperty(this, "uid", getUID('popup-'));
47
-
48
- _defineProperty(this, "calculateDisplay", prevState => ({ ...prevState,
49
- display: this.props.hidden ? Display.SHOWING : Display.SHOWN
50
- }));
51
-
52
- _defineProperty(this, "portalRef", el => {
53
- this.node = el;
54
- this.parent = el && el.parentElement;
55
-
56
- if (el && this.getContainer()) {
57
- this._redraw();
58
- }
59
- });
60
-
61
- _defineProperty(this, "popupRef", el => {
62
- this.popup = el;
63
-
64
- this._redraw();
65
- });
66
-
67
- _defineProperty(this, "containerRef", el => {
68
- this.container = el;
69
- });
70
-
71
- _defineProperty(this, "_updateDirection", newDirection => {
72
- if (this.state.direction !== newDirection) {
73
- this.setState({
74
- direction: newDirection
75
- });
76
-
77
- if (this.props.onDirectionChange) {
78
- this.props.onDirectionChange(newDirection);
79
- }
80
- }
81
- });
82
-
83
- _defineProperty(this, "_updatePosition", () => {
84
- if (this.popup) {
85
- this.popup.style.position = 'absolute';
86
-
87
- if (this.isVisible()) {
88
- const {
89
- styles: style,
90
- direction
91
- } = this.position();
92
- Object.keys(style).forEach(key => {
93
- const value = style[key];
94
-
95
- if (typeof value === 'number') {
96
- this.popup.style[key] = "".concat(value, "px");
97
- } else {
98
- this.popup.style[key] = value.toString();
99
- }
100
- });
101
-
102
- this._updateDirection(direction);
103
- }
104
-
105
- this.setState(this.calculateDisplay);
106
- }
107
- });
108
-
109
- _defineProperty(this, "_redraw", () => {
110
- if (this.isVisible()) {
111
- this.redrawScheduler(this._updatePosition);
112
- }
113
- });
114
-
115
- _defineProperty(this, "_onEscPress", evt => {
116
- this.props.onEscPress(evt);
117
-
118
- this._onCloseAttempt(evt, true);
119
- });
120
-
121
- _defineProperty(this, "_onDocumentClick", evt => {
122
- if (this.container && this.container.contains(evt.target) || !this._listenersEnabled || this.props.dontCloseOnAnchorClick && this._getAnchor() && this._getAnchor().contains(evt.target)) {
123
- return;
124
- }
125
-
126
- this.props.onOutsideClick(evt);
127
-
128
- this._onCloseAttempt(evt, false);
129
- });
130
-
131
- _defineProperty(this, "shortcutsScope", this.uid);
132
-
133
- _defineProperty(this, "shortcutsMap", {
134
- esc: this._onEscPress
135
- });
136
- }
137
-
138
- componentDidMount() {
139
- if (!this.props.client) {
140
- this.setState({
141
- client: true
142
- });
143
- }
144
-
145
- if (!this.props.hidden) {
146
- this._setListenersEnabled(true);
147
- }
148
- }
149
-
150
- componentDidUpdate(prevProps, prevState) {
151
- const {
152
- hidden
153
- } = this.props;
154
-
155
- if (this.props !== prevProps) {
156
- if (prevProps.hidden !== hidden) {
157
- this._setListenersEnabled(!hidden);
158
- }
159
-
160
- this._redraw();
161
- }
162
-
163
- if (this.props.onShow && !hidden && this.state.display === Display.SHOWN && (prevProps.hidden || prevState.display !== Display.SHOWN)) {
164
- this.props.onShow();
165
- }
166
- }
167
-
168
- componentWillUnmount() {
169
- this._setListenersEnabled(false);
170
-
171
- this.popup = null;
172
- }
173
-
174
- shouldUseShortcuts() {
175
- const {
176
- shortcuts,
177
- hidden
178
- } = this.props;
179
- return shortcuts && !hidden;
180
- }
181
-
182
- getContainer() {
183
- const target = this.props.target || this.ringPopupTarget;
184
- return target && getPopupContainer(target);
185
- }
186
-
187
- position() {
188
- const positionProps = positionPropKeys.reduce((acc, key) => {
189
- acc[key] = this.props[key];
190
- return acc;
191
- }, {});
192
- const container = this.getContainer();
193
- return position({
194
- popup: this.popup,
195
- container: container && getStyles(container).position !== 'static' ? container : null,
196
- anchor: this._getAnchor(),
197
- ...positionProps
198
- });
199
- }
200
-
201
- _getAnchor() {
202
- return this.props.anchorElement || this.parent;
203
- }
204
- /**
205
- * @param {boolean} enable
206
- * @private
207
- */
208
-
209
-
210
- _setListenersEnabled(enable) {
211
- if (enable && !this._listenersEnabled) {
212
- setTimeout(() => {
213
- this._listenersEnabled = true;
214
- this.listeners.add(window, 'resize', this._redraw);
215
-
216
- if (this.props.autoPositioningOnScroll) {
217
- this.listeners.add(window, 'scroll', this._redraw);
218
- }
219
-
220
- this.listeners.add(document, 'pointerdown', this._onDocumentClick, true);
221
-
222
- let el = this._getAnchor();
223
-
224
- while (el) {
225
- this.listeners.add(el, 'scroll', this._redraw);
226
- el = el.parentElement;
227
- }
228
- }, 0);
229
- return;
230
- }
231
-
232
- if (!enable && this._listenersEnabled) {
233
- this.listeners.removeAll();
234
- this._listenersEnabled = false;
235
- }
236
- }
237
- /**
238
- * Returns visibility state
239
- * @return {boolean}
240
- */
241
-
242
-
243
- isVisible() {
244
- return !this.props.hidden;
245
- }
246
-
247
- _onCloseAttempt(evt, isEsc) {
248
- this.props.onCloseAttempt(evt, isEsc);
249
- }
250
-
251
- getInternalContent() {
252
- const {
253
- trapFocus,
254
- autoFocusFirst,
255
- children
256
- } = this.props;
257
- return trapFocus ? /*#__PURE__*/React.createElement(TabTrap, {
258
- autoFocusFirst: autoFocusFirst,
259
- focusBackOnExit: true
260
- }, children) : children;
261
- }
262
-
263
- render() {
264
- const {
265
- className,
266
- style,
267
- hidden,
268
- attached,
269
- keepMounted,
270
- client,
271
- onMouseDown,
272
- onMouseUp,
273
- onMouseOver,
274
- onMouseOut,
275
- onContextMenu,
276
- 'data-test': dataTest
277
- } = this.props;
278
- const showing = this.state.display === Display.SHOWING;
279
- const classes = classNames(className, modules_2f69e2e2.popup, {
280
- [modules_2f69e2e2.attached]: attached,
281
- [modules_2f69e2e2.hidden]: hidden,
282
- [modules_2f69e2e2.showing]: showing
283
- });
284
- const direction = (this.state.direction || '').toLowerCase().replace(/[_]/g, '-');
285
- return /*#__PURE__*/React.createElement(PopupTargetContext.Consumer, null, value => {
286
- this.ringPopupTarget = value;
287
- return /*#__PURE__*/React.createElement("span", {
288
- // prevent bubbling through portal
289
- onClick: stop // This handler only blocks bubbling through React portal
290
- ,
291
- role: "presentation",
292
- ref: this.portalRef
293
- }, this.shouldUseShortcuts() && /*#__PURE__*/React.createElement(Shortcuts, {
294
- map: this.shortcutsMap,
295
- scope: this.shortcutsScope
296
- }), (client || this.state.client) && (keepMounted || !hidden) && /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement(PopupTarget, {
297
- id: this.uid,
298
- ref: this.containerRef,
299
- onMouseOver: onMouseOver,
300
- onFocus: onMouseOver,
301
- onMouseOut: onMouseOut,
302
- onBlur: onMouseOut,
303
- onContextMenu: onContextMenu
304
- }, /*#__PURE__*/React.createElement("div", {
305
- "data-test": joinDataTestAttributes('ring-popup', dataTest),
306
- "data-test-shown": !hidden && !showing,
307
- "data-test-direction": direction,
308
- ref: this.popupRef,
309
- className: classes,
310
- style: style,
311
- onMouseDown: onMouseDown,
312
- onMouseUp: onMouseUp // mouse handlers are used to track clicking on inner elements
313
- ,
314
- role: "presentation"
315
- }, this.getInternalContent())), this.getContainer() || document.body));
316
- });
317
- }
318
-
319
- }
320
-
321
- _defineProperty(Popup, "propTypes", {
322
- anchorElement: PropTypes.instanceOf(Node),
323
- target: PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(Element)]),
324
- className: PropTypes.string,
325
- style: PropTypes.object,
326
- hidden: PropTypes.bool.isRequired,
327
- onOutsideClick: PropTypes.func,
328
- onEscPress: PropTypes.func,
329
- // onCloseAttempt is a common callback for ESC pressing and outside clicking.
330
- // Use it if you don't need different behaviors for this cases.
331
- onCloseAttempt: PropTypes.func,
332
- children: PropTypes.node.isRequired,
333
- dontCloseOnAnchorClick: PropTypes.bool,
334
- shortcuts: PropTypes.bool,
335
- keepMounted: PropTypes.bool,
336
- // pass this prop to preserve the popup's DOM state while hidden
337
- 'data-test': PropTypes.string,
338
- client: PropTypes.bool,
339
- // true means that it's never used in SSR
340
- directions: PropTypes.arrayOf(PropTypes.string),
341
- autoPositioning: PropTypes.bool,
342
- autoPositioningOnScroll: PropTypes.bool,
343
- autoCorrectTopOverflow: PropTypes.bool,
344
- left: PropTypes.number,
345
- top: PropTypes.number,
346
- maxHeight: PropTypes.number,
347
- minWidth: PropTypes.number,
348
- sidePadding: PropTypes.number,
349
- attached: PropTypes.bool,
350
- // Popup adjacent to an input, without upper border and shadow
351
- onMouseDown: PropTypes.func,
352
- onMouseUp: PropTypes.func,
353
- onMouseOver: PropTypes.func,
354
- onMouseOut: PropTypes.func,
355
- onContextMenu: PropTypes.func,
356
- onDirectionChange: PropTypes.func,
357
- onShow: PropTypes.func,
358
- // set to true whenever popup contains focusable and scrollable content
359
- trapFocus: PropTypes.bool,
360
- autoFocusFirst: PropTypes.bool
361
- });
362
-
363
- _defineProperty(Popup, "defaultProps", {
364
- shortcuts: true,
365
- hidden: false,
366
-
367
- onOutsideClick() {},
368
-
369
- onEscPress() {},
370
-
371
- onCloseAttempt() {},
372
-
373
- dontCloseOnAnchorClick: false,
374
- keepMounted: false,
375
- directions: DEFAULT_DIRECTIONS,
376
- autoPositioning: true,
377
- autoPositioningOnScroll: true,
378
- autoCorrectTopOverflow: true,
379
- left: 0,
380
- top: 0,
381
- offset: 0,
382
- sidePadding: 8,
383
- attached: false,
384
- trapFocus: false,
385
- autoFocusFirst: false,
386
- legacy: false
387
- });
388
-
389
- _defineProperty(Popup, "PopupProps", {
390
- Directions,
391
- Dimension,
392
- MinWidth,
393
- MaxHeight
394
- });
395
-
396
- export { Popup as default, getPopupContainer };
@@ -1,26 +0,0 @@
1
- import { a as _extends } from '../_helpers/_rollupPluginBabelHelpers.js';
2
- import React, { createContext, forwardRef } from 'react';
3
- import PropTypes from 'prop-types';
4
-
5
- const PopupTargetContext = /*#__PURE__*/createContext();
6
- const PopupTarget = /*#__PURE__*/forwardRef(function PopupTarget(_ref, ref) {
7
- let {
8
- id,
9
- children,
10
- ...restProps
11
- } = _ref;
12
- const isFunctionChild = typeof children === 'function';
13
- const target = /*#__PURE__*/React.createElement("div", _extends({}, restProps, {
14
- "data-portaltarget": id,
15
- ref: ref
16
- }), !isFunctionChild && children);
17
- return /*#__PURE__*/React.createElement(PopupTargetContext.Provider, {
18
- value: id
19
- }, isFunctionChild ? children(target) : target);
20
- });
21
- PopupTarget.propTypes = {
22
- id: PropTypes.string.isRequired,
23
- children: PropTypes.oneOfType([PropTypes.node, PropTypes.func])
24
- };
25
-
26
- export { PopupTarget, PopupTargetContext };
@@ -1,280 +0,0 @@
1
- import { getRect, isMounted, getDocumentScrollTop, getDocumentScrollLeft, getWindowHeight } from '../global/dom.js';
2
- import { Directions, MaxHeight, Dimension, MinWidth } from './popup.consts.js';
3
- export { Dimension, Directions, MaxHeight, MinWidth } from './popup.consts.js';
4
- import '../_helpers/_rollupPluginBabelHelpers.js';
5
- import 'core-js/modules/web.dom-collections.iterator.js';
6
-
7
- function getScrollingCoordinates(container) {
8
- if (container !== null) {
9
- return {
10
- top: container.scrollTop,
11
- left: container.scrollLeft
12
- };
13
- }
14
-
15
- return {
16
- top: getDocumentScrollTop(),
17
- left: getDocumentScrollLeft()
18
- };
19
- }
20
-
21
- function getPositionStyles(popup, anchorRect, anchorLeft, anchorTop, offset) {
22
- const popupWidth = popup.clientWidth;
23
- const popupHeight = popup.clientHeight;
24
- const anchorBottom = anchorTop + anchorRect.height;
25
- const anchorRight = anchorLeft + anchorRect.width;
26
- const popupLeft = anchorLeft - popupWidth;
27
- const popupTop = anchorTop - popupHeight;
28
- const popupRightToLeft = anchorRight - popupWidth;
29
- const popupHorizontalCenter = anchorLeft + anchorRect.width / 2 - popupWidth / 2;
30
- const popupVerticalCenter = anchorTop + anchorRect.height / 2 - popupHeight / 2;
31
- const popupBottomToTop = anchorBottom - popupHeight;
32
- return {
33
- [Directions.BOTTOM_RIGHT]: {
34
- left: anchorLeft,
35
- top: anchorBottom + offset
36
- },
37
- [Directions.BOTTOM_LEFT]: {
38
- left: popupRightToLeft,
39
- top: anchorBottom + offset
40
- },
41
- [Directions.BOTTOM_CENTER]: {
42
- left: popupHorizontalCenter,
43
- top: anchorBottom + offset
44
- },
45
- [Directions.TOP_RIGHT]: {
46
- left: anchorLeft,
47
- top: popupTop - offset
48
- },
49
- [Directions.TOP_LEFT]: {
50
- left: popupRightToLeft,
51
- top: popupTop - offset
52
- },
53
- [Directions.TOP_CENTER]: {
54
- left: popupHorizontalCenter,
55
- top: popupTop - offset
56
- },
57
- [Directions.LEFT_BOTTOM]: {
58
- left: popupLeft - offset,
59
- top: anchorTop
60
- },
61
- [Directions.LEFT_TOP]: {
62
- left: popupLeft - offset,
63
- top: popupBottomToTop
64
- },
65
- [Directions.LEFT_CENTER]: {
66
- left: popupLeft - offset,
67
- top: popupVerticalCenter
68
- },
69
- [Directions.RIGHT_BOTTOM]: {
70
- left: anchorRight + offset,
71
- top: anchorTop
72
- },
73
- [Directions.RIGHT_TOP]: {
74
- left: anchorRight + offset,
75
- top: popupBottomToTop
76
- },
77
- [Directions.RIGHT_CENTER]: {
78
- left: anchorRight + offset,
79
- top: popupVerticalCenter
80
- }
81
- };
82
- }
83
-
84
- function verticalOverflow(styles, scrollingCoordinates, attrs) {
85
- const containerHeight = attrs.container !== null ? attrs.container.clientHeight : getWindowHeight();
86
- const viewportMinX = scrollingCoordinates.top + attrs.sidePadding;
87
- const viewportMaxX = scrollingCoordinates.top + containerHeight - attrs.sidePadding;
88
- const topOverflow = Math.max(viewportMinX - styles.top, 0);
89
- const popupHeight = attrs.popup.clientHeight;
90
- const verticalDiff = styles.top + popupHeight - viewportMaxX;
91
- const bottomOverflow = Math.max(verticalDiff, 0);
92
- return topOverflow + bottomOverflow;
93
- }
94
-
95
- function horizontalOverflow(styles, scrollingCoordinates, attrs) {
96
- const containerWidth = attrs.container !== null ? attrs.container.clientWidth : window.innerWidth;
97
- const viewportMinY = scrollingCoordinates.left + attrs.sidePadding;
98
- const viewportMaxY = scrollingCoordinates.left + containerWidth - attrs.sidePadding;
99
- const leftOverflow = Math.max(viewportMinY - styles.left, 0);
100
- const popupWidth = attrs.popup.clientWidth;
101
- const horizontalDiff = styles.left + popupWidth - viewportMaxY;
102
- const rightOverflow = Math.max(horizontalDiff, 0);
103
- return leftOverflow + rightOverflow;
104
- }
105
-
106
- const positionPropKeys = ['directions', 'autoPositioning', 'autoCorrectTopOverflow', 'sidePadding', 'top', 'left', 'offset', 'maxHeight', 'minWidth'];
107
- const defaultcontainerRect = {
108
- top: 0,
109
- left: 0
110
- };
111
-
112
- function handleTopOffScreen(_ref) {
113
- let {
114
- sidePadding,
115
- styles,
116
- anchorRect,
117
- maxHeight,
118
- popupScrollHeight,
119
- direction,
120
- scroll
121
- } = _ref;
122
- const BORDER_COMPENSATION = 1;
123
- const {
124
- TOP_LEFT,
125
- TOP_RIGHT,
126
- TOP_CENTER,
127
- RIGHT_TOP,
128
- LEFT_TOP
129
- } = Directions;
130
- const openedToTop = [TOP_LEFT, TOP_RIGHT, TOP_CENTER, RIGHT_TOP, LEFT_TOP].includes(direction);
131
-
132
- if (!openedToTop) {
133
- return styles;
134
- }
135
-
136
- const isAttachedToAnchorTop = [TOP_LEFT, TOP_CENTER, TOP_RIGHT].includes(direction);
137
- const attachingPointY = isAttachedToAnchorTop ? anchorRect.top : anchorRect.bottom;
138
- const effectiveHeight = maxHeight ? Math.min(popupScrollHeight, maxHeight) : popupScrollHeight;
139
- const hypotheticalTop = attachingPointY - effectiveHeight;
140
-
141
- if (hypotheticalTop <= sidePadding) {
142
- styles.top = sidePadding + scroll.top;
143
- styles.maxHeight = attachingPointY - sidePadding + BORDER_COMPENSATION;
144
- }
145
-
146
- return styles;
147
- }
148
-
149
- function maxHeightForDirection(direction, anchorNode, containerNode) {
150
- const container = containerNode || document.documentElement;
151
- const domRect = anchorNode.getBoundingClientRect();
152
- const containerRect = container.getBoundingClientRect();
153
- const topMaxHeight = Math.max(domRect.top - containerRect.top, 0);
154
- const containerHeight = Math.max(containerRect.height, // XXX
155
- // If container is the document element
156
- // then we check client height too because we may have situation when
157
- // "height" from "getBoundingClientRect" less then "clientHeight".
158
- container === document.documentElement ? container.clientHeight : 0);
159
- const bottomMaxHeight = Math.max(containerHeight - (topMaxHeight + domRect.height), 0);
160
-
161
- switch (direction) {
162
- case Directions.TOP_LEFT:
163
- case Directions.TOP_CENTER:
164
- case Directions.TOP_RIGHT:
165
- return topMaxHeight;
166
-
167
- case Directions.BOTTOM_LEFT:
168
- case Directions.BOTTOM_CENTER:
169
- case Directions.BOTTOM_RIGHT:
170
- return bottomMaxHeight;
171
-
172
- case Directions.LEFT_BOTTOM:
173
- case Directions.RIGHT_BOTTOM:
174
- return domRect.height + bottomMaxHeight;
175
-
176
- case Directions.LEFT_TOP:
177
- case Directions.RIGHT_TOP:
178
- return domRect.height + topMaxHeight;
179
-
180
- case Directions.RIGHT_CENTER:
181
- case Directions.LEFT_CENTER:
182
- return domRect.height / 2 + Math.min(bottomMaxHeight / 2, topMaxHeight / 2);
183
-
184
- default:
185
- return null;
186
- }
187
- }
188
- function position(attrs) {
189
- const {
190
- popup,
191
- anchor,
192
- container,
193
- directions,
194
- autoPositioning,
195
- sidePadding,
196
- top,
197
- left,
198
- offset,
199
- maxHeight,
200
- minWidth,
201
- autoCorrectTopOverflow = true
202
- } = attrs;
203
- let styles = {
204
- top: 0,
205
- left: 0
206
- };
207
- let chosenDirection = null;
208
- const containerRect = container !== null ? getRect(container) : defaultcontainerRect;
209
- const defaultAnchor = container !== null ? container : document.body;
210
- const anchorRect = getRect(isMounted(anchor) ? anchor : defaultAnchor);
211
- const scroll = getScrollingCoordinates(container);
212
- const anchorLeft = anchorRect.left + scroll.left + left - containerRect.left;
213
- const anchorTop = anchorRect.top + scroll.top + top - containerRect.top;
214
-
215
- if (popup) {
216
- const directionsMatrix = getPositionStyles(popup, anchorRect, anchorLeft, anchorTop, offset);
217
-
218
- if (!autoPositioning || directions.length === 1) {
219
- styles = directionsMatrix[directions[0]];
220
- chosenDirection = directions[0];
221
- } else {
222
- const sortedByIncreasingOverflow = directions. // Fall back to the first option
223
- concat(directions[0]).filter(direction => directionsMatrix[direction]).map(direction => ({
224
- styles: directionsMatrix[direction],
225
- direction
226
- })).sort((_ref2, _ref3) => {
227
- let {
228
- styles: stylesA
229
- } = _ref2;
230
- let {
231
- styles: stylesB
232
- } = _ref3;
233
- const overflowA = verticalOverflow(stylesA, scroll, attrs) + horizontalOverflow(stylesA, scroll, attrs);
234
- const overflowB = verticalOverflow(stylesB, scroll, attrs) + horizontalOverflow(stylesB, scroll, attrs);
235
- return overflowA - overflowB;
236
- });
237
- styles = sortedByIncreasingOverflow[0].styles;
238
- chosenDirection = sortedByIncreasingOverflow[0].direction;
239
- } // because of the anchor negative margin top and left also may become negative
240
-
241
-
242
- ['left', 'top'].forEach(key => {
243
- if (styles[key] < 0) {
244
- styles[key] = 0;
245
- }
246
- });
247
- }
248
-
249
- if (maxHeight === MaxHeight.SCREEN || maxHeight === 'screen') {
250
- // this feature works properly only when direction is BOTTOM_* or *_BOTTOM
251
- styles.maxHeight = window.innerHeight + scroll.top - styles.top - Dimension.MARGIN;
252
- } else if (maxHeight) {
253
- styles.maxHeight = maxHeight;
254
- }
255
-
256
- if (autoCorrectTopOverflow) {
257
- styles = handleTopOffScreen({
258
- sidePadding,
259
- styles,
260
- anchorRect,
261
- maxHeight,
262
- direction: chosenDirection,
263
- popupScrollHeight: popup.scrollHeight,
264
- scroll
265
- });
266
- }
267
-
268
- if (minWidth === MinWidth.TARGET || minWidth === 'target') {
269
- styles.minWidth = anchorRect.width;
270
- } else if (minWidth) {
271
- styles.minWidth = anchorRect.width < minWidth ? minWidth : anchorRect.width;
272
- }
273
-
274
- return {
275
- styles,
276
- direction: chosenDirection
277
- };
278
- }
279
-
280
- export { position as default, maxHeightForDirection, positionPropKeys };