@jetbrains/ring-ui-built 7.0.0-beta.2 → 7.0.0-beta.3

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 (236) hide show
  1. package/components/_helpers/_rollupPluginBabelHelpers.js +1 -504
  2. package/components/_helpers/anchor.js +7 -5
  3. package/components/_helpers/button__classes.js +15 -13
  4. package/components/_helpers/caption.js +11 -17
  5. package/components/_helpers/card.js +92 -96
  6. package/components/_helpers/dialog__body-scroll-preventer.js +10 -17
  7. package/components/_helpers/icon__svg.js +27 -23
  8. package/components/_helpers/input.js +150 -171
  9. package/components/_helpers/query-assist__suggestions.js +78 -93
  10. package/components/_helpers/select__filter.js +56 -67
  11. package/components/_helpers/services-link.js +23 -29
  12. package/components/_helpers/sidebar.js +91 -93
  13. package/components/_helpers/tab-link.js +8 -6
  14. package/components/_helpers/theme.js +41 -50
  15. package/components/_helpers/title.js +59 -69
  16. package/components/alert/alert.js +112 -156
  17. package/components/alert/container.js +32 -39
  18. package/components/alert-service/alert-service.js +104 -161
  19. package/components/analytics/analytics.js +12 -20
  20. package/components/analytics/analytics__custom-plugin.js +52 -68
  21. package/components/auth/auth.js +2 -27
  22. package/components/auth/auth__core.d.ts +1 -1
  23. package/components/auth/auth__core.js +742 -1428
  24. package/components/auth/background-flow.js +84 -121
  25. package/components/auth/down-notification.js +31 -69
  26. package/components/auth/iframe-flow.js +70 -123
  27. package/components/auth/request-builder.js +46 -77
  28. package/components/auth/response-parser.js +84 -112
  29. package/components/auth/storage.js +160 -318
  30. package/components/auth/token-validator.js +132 -227
  31. package/components/auth/window-flow.js +84 -121
  32. package/components/auth-dialog/auth-dialog.js +99 -150
  33. package/components/auth-dialog-service/auth-dialog-service.js +6 -26
  34. package/components/avatar/avatar-example-datauri.js +1 -1
  35. package/components/avatar/avatar.js +94 -123
  36. package/components/avatar/fallback-avatar.js +20 -34
  37. package/components/badge/badge.js +32 -38
  38. package/components/breadcrumbs/breadcrumbs.js +13 -17
  39. package/components/button/button.js +67 -80
  40. package/components/button-group/button-group.js +27 -36
  41. package/components/button-set/button-set.js +19 -27
  42. package/components/button-toolbar/button-toolbar.js +17 -25
  43. package/components/caret/caret.js +184 -211
  44. package/components/checkbox/checkbox.js +69 -86
  45. package/components/clipboard/clipboard-fallback.js +7 -7
  46. package/components/clipboard/clipboard.js +36 -128
  47. package/components/code/code.js +83 -151
  48. package/components/collapse/collapse-content.js +42 -60
  49. package/components/collapse/collapse-context.js +2 -2
  50. package/components/collapse/collapse-control.js +12 -12
  51. package/components/collapse/collapse.js +12 -17
  52. package/components/collapse/consts.js +4 -4
  53. package/components/collapse/utils.js +1 -3
  54. package/components/confirm/confirm.js +57 -87
  55. package/components/confirm-service/confirm-service.js +23 -44
  56. package/components/content-layout/content-layout.js +41 -56
  57. package/components/content-layout/sidebar.js +1 -1
  58. package/components/contenteditable/contenteditable.js +38 -46
  59. package/components/control-help/control-help.js +5 -3
  60. package/components/control-label/control-label.js +9 -8
  61. package/components/data-list/data-list.js +113 -156
  62. package/components/data-list/data-list.mock.js +3 -5
  63. package/components/data-list/item.js +120 -140
  64. package/components/data-list/selection.js +77 -135
  65. package/components/data-list/title.js +2 -10
  66. package/components/date-picker/consts.js +16 -22
  67. package/components/date-picker/date-input.js +99 -124
  68. package/components/date-picker/date-picker.js +140 -184
  69. package/components/date-picker/date-popup.js +280 -327
  70. package/components/date-picker/day.js +71 -94
  71. package/components/date-picker/month-names.js +41 -59
  72. package/components/date-picker/month-slider.js +42 -61
  73. package/components/date-picker/month.js +17 -24
  74. package/components/date-picker/months.js +44 -49
  75. package/components/date-picker/weekdays.js +12 -21
  76. package/components/date-picker/years.js +77 -98
  77. package/components/dialog/dialog.js +151 -187
  78. package/components/dialog/dialog__body-scroll-preventer.js +0 -3
  79. package/components/dropdown/anchor.js +0 -6
  80. package/components/dropdown/dropdown.js +134 -154
  81. package/components/dropdown-menu/dropdown-menu.js +59 -87
  82. package/components/editable-heading/editable-heading.js +69 -116
  83. package/components/error-bubble/error-bubble.js +29 -54
  84. package/components/error-message/error-message.js +34 -49
  85. package/components/footer/footer.js +27 -28
  86. package/components/global/compose.js +1 -8
  87. package/components/global/composeRefs.d.ts +0 -3
  88. package/components/global/composeRefs.js +8 -15
  89. package/components/global/controls-height.js +2 -2
  90. package/components/global/create-stateful-context.js +14 -13
  91. package/components/global/data-tests.js +7 -12
  92. package/components/global/dom.js +49 -82
  93. package/components/global/focus-sensor-hoc.js +99 -106
  94. package/components/global/fuzzy-highlight.js +23 -34
  95. package/components/global/get-event-key.js +8 -8
  96. package/components/global/get-uid.js +3 -7
  97. package/components/global/inject-styles.js +7 -14
  98. package/components/global/listeners.js +28 -47
  99. package/components/global/memoize.js +6 -10
  100. package/components/global/normalize-indent.js +19 -46
  101. package/components/global/promise-with-timeout.js +6 -8
  102. package/components/global/prop-types.js +3 -5
  103. package/components/global/react-dom-renderer.js +29 -40
  104. package/components/global/rerender-hoc.js +16 -32
  105. package/components/global/schedule-raf.js +4 -4
  106. package/components/global/sniffer.js +1 -1
  107. package/components/global/theme.js +1 -18
  108. package/components/global/trivial-template-tag.js +4 -9
  109. package/components/global/typescript-utils.js +2 -6
  110. package/components/global/url.js +20 -23
  111. package/components/global/use-event-callback.js +7 -4
  112. package/components/grid/col.js +27 -39
  113. package/components/grid/grid.js +18 -27
  114. package/components/grid/row.js +23 -30
  115. package/components/group/group.js +16 -22
  116. package/components/header/header-icon.js +19 -31
  117. package/components/header/header.d.ts +0 -1
  118. package/components/header/header.js +30 -64
  119. package/components/header/links.js +6 -3
  120. package/components/header/logo.js +15 -26
  121. package/components/header/profile.js +124 -150
  122. package/components/header/services-link.js +1 -3
  123. package/components/header/services.js +64 -97
  124. package/components/header/smart-profile.js +101 -178
  125. package/components/header/smart-services.js +55 -90
  126. package/components/header/tray.js +21 -30
  127. package/components/heading/heading.js +21 -20
  128. package/components/http/http.js +162 -319
  129. package/components/http/http.mock.js +50 -98
  130. package/components/hub-source/hub-source.js +77 -182
  131. package/components/hub-source/hub-source__user.js +9 -37
  132. package/components/hub-source/hub-source__users-groups.js +34 -60
  133. package/components/i18n/i18n-context.js +7 -8
  134. package/components/i18n/i18n.js +3 -6
  135. package/components/icon/icon.js +60 -74
  136. package/components/icon/icon__svg.js +0 -5
  137. package/components/icon/index.js +0 -5
  138. package/components/input/input.js +1 -11
  139. package/components/island/adaptive-island-hoc.js +29 -37
  140. package/components/island/content.js +100 -110
  141. package/components/island/header.js +56 -66
  142. package/components/island/island.js +25 -33
  143. package/components/island-legacy/content-legacy.js +16 -22
  144. package/components/island-legacy/header-legacy.js +19 -25
  145. package/components/island-legacy/island-legacy.js +16 -22
  146. package/components/link/clickableLink.js +33 -42
  147. package/components/link/link.js +47 -55
  148. package/components/list/consts.js +2 -2
  149. package/components/list/list.js +399 -486
  150. package/components/list/list__custom.js +51 -61
  151. package/components/list/list__hint.js +9 -17
  152. package/components/list/list__item.js +147 -178
  153. package/components/list/list__link.js +38 -47
  154. package/components/list/list__separator.js +15 -24
  155. package/components/list/list__title.js +25 -34
  156. package/components/list/list__users-groups-source.js +55 -121
  157. package/components/loader/loader.js +38 -60
  158. package/components/loader/loader__core.js +123 -184
  159. package/components/loader-inline/loader-inline.js +24 -32
  160. package/components/loader-screen/loader-screen.js +24 -40
  161. package/components/login-dialog/login-dialog.js +81 -121
  162. package/components/login-dialog/service.js +6 -29
  163. package/components/markdown/markdown.js +16 -24
  164. package/components/message/message.js +170 -201
  165. package/components/old-browsers-message/old-browsers-message.js +11 -14
  166. package/components/old-browsers-message/old-browsers-message__stop.js +1 -4
  167. package/components/old-browsers-message/white-list.js +8 -13
  168. package/components/pager/pager.js +212 -257
  169. package/components/panel/panel.js +16 -22
  170. package/components/permissions/permissions.js +118 -161
  171. package/components/permissions/permissions__cache.js +191 -218
  172. package/components/popup/popup.consts.js +1 -1
  173. package/components/popup/popup.js +237 -288
  174. package/components/popup/popup.target.js +9 -7
  175. package/components/popup/position.js +94 -101
  176. package/components/popup-menu/popup-menu.js +33 -67
  177. package/components/progress-bar/progress-bar.js +57 -68
  178. package/components/query-assist/query-assist.js +583 -652
  179. package/components/query-assist/query-assist__suggestions.js +2 -26
  180. package/components/radio/radio.js +15 -27
  181. package/components/radio/radio__item.js +52 -62
  182. package/components/scrollable-section/scrollable-section.js +22 -32
  183. package/components/select/select.js +693 -793
  184. package/components/select/select__filter.js +1 -26
  185. package/components/select/select__popup.js +316 -413
  186. package/components/shortcuts/core.js +147 -195
  187. package/components/shortcuts/shortcut-title.js +6 -10
  188. package/components/shortcuts/shortcuts-hoc.js +23 -41
  189. package/components/shortcuts/shortcuts.js +41 -64
  190. package/components/slider/slider.js +93 -112
  191. package/components/slider/slider.utils.js +16 -23
  192. package/components/storage/storage.js +3 -27
  193. package/components/storage/storage__fallback.js +137 -210
  194. package/components/storage/storage__local.js +89 -147
  195. package/components/style.css +1 -1
  196. package/components/tab-trap/tab-trap.js +35 -53
  197. package/components/table/cell.js +11 -21
  198. package/components/table/disable-hover-hoc.js +27 -42
  199. package/components/table/header-cell.js +59 -75
  200. package/components/table/header.js +89 -110
  201. package/components/table/multitable.js +83 -89
  202. package/components/table/row-with-focus-sensor.js +25 -57
  203. package/components/table/row.js +169 -200
  204. package/components/table/selection-adapter.js +2 -2
  205. package/components/table/selection-shortcuts-hoc.js +108 -113
  206. package/components/table/selection.js +150 -217
  207. package/components/table/simple-table.js +19 -55
  208. package/components/table/smart-table.js +42 -76
  209. package/components/table/table.js +267 -327
  210. package/components/tabs/collapsible-more.js +47 -73
  211. package/components/tabs/collapsible-tab.js +32 -36
  212. package/components/tabs/collapsible-tabs.js +89 -148
  213. package/components/tabs/custom-item.js +4 -2
  214. package/components/tabs/dumb-tabs.js +60 -92
  215. package/components/tabs/smart-tabs.js +29 -61
  216. package/components/tabs/tab-link.js +1 -3
  217. package/components/tabs/tab.js +15 -24
  218. package/components/tabs/tabs.js +1 -26
  219. package/components/tag/tag.d.ts +0 -2
  220. package/components/tag/tag.js +120 -162
  221. package/components/tags-input/tags-input.js +222 -304
  222. package/components/tags-list/tags-list.js +45 -61
  223. package/components/text/text.js +28 -37
  224. package/components/toggle/toggle.js +51 -61
  225. package/components/tooltip/tooltip.js +109 -141
  226. package/components/user-agreement/service.js +259 -400
  227. package/components/user-agreement/user-agreement.js +80 -108
  228. package/components/user-card/card.js +1 -25
  229. package/components/user-card/smart-user-card-tooltip.js +52 -103
  230. package/components/user-card/tooltip.js +35 -65
  231. package/components/user-card/user-card.js +1 -25
  232. package/package.json +1 -1
  233. package/components/global/react-render-adapter.d.ts +0 -1
  234. package/components/global/react-render-adapter.js +0 -6
  235. package/components/header/tray-icon.d.ts +0 -1
  236. package/components/header/tray-icon.js +0 -26
@@ -1,39 +1,22 @@
1
- import { _ as _defineProperty, a as _inherits, b as _createClass, e as _classCallCheck, f as _callSuper, d as _objectSpread2, i as _slicedToArray } from '../_helpers/_rollupPluginBabelHelpers.js';
2
- import 'core-js/modules/es.array.concat.js';
3
- import 'core-js/modules/es.object.entries.js';
4
- import 'core-js/modules/es.object.to-string.js';
1
+ import { _ as _defineProperty, b as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
5
2
  import 'core-js/modules/es.regexp.exec.js';
6
- import 'core-js/modules/es.regexp.to-string.js';
7
3
  import 'core-js/modules/es.string.replace.js';
8
- import 'core-js/modules/web.dom-collections.for-each.js';
4
+ import 'core-js/modules/web.dom-collections.iterator.js';
9
5
  import { PureComponent } from 'react';
10
6
  import { createPortal } from 'react-dom';
11
7
  import PropTypes from 'prop-types';
12
8
  import classNames from 'classnames';
13
9
  import getUID from '../global/get-uid.js';
14
10
  import scheduleRAF from '../global/schedule-raf.js';
15
- import { getStyles, Listeners } from '../global/dom.js';
11
+ import { Listeners, getStyles } from '../global/dom.js';
16
12
  import Shortcuts from '../shortcuts/shortcuts.js';
17
13
  import joinDataTestAttributes from '../global/data-tests.js';
18
14
  import TabTrap from '../tab-trap/tab-trap.js';
19
15
  import position from './position.js';
20
- import { DEFAULT_DIRECTIONS, Directions, Dimension, MinWidth, MaxHeight, Display } from './popup.consts.js';
16
+ import { Display, DEFAULT_DIRECTIONS, Directions, Dimension, MinWidth, MaxHeight } from './popup.consts.js';
21
17
  import { PopupTargetContext, PopupTarget } from './popup.target.js';
22
18
  import { jsx, jsxs } from 'react/jsx-runtime';
23
- import 'core-js/modules/es.array.filter.js';
24
- import 'core-js/modules/es.array.iterator.js';
25
- import 'core-js/modules/es.object.assign.js';
26
- import 'core-js/modules/es.set.js';
27
- import 'core-js/modules/es.string.split.js';
28
- import 'core-js/modules/web.dom-collections.iterator.js';
29
- import 'core-js/modules/es.array.map.js';
30
19
  import '../shortcuts/core.js';
31
- import 'core-js/modules/es.array.find-index.js';
32
- import 'core-js/modules/es.array.includes.js';
33
- import 'core-js/modules/es.array.slice.js';
34
- import 'core-js/modules/es.array.splice.js';
35
- import 'core-js/modules/es.string.includes.js';
36
- import 'core-js/modules/es.string.match.js';
37
20
  import 'combokeys';
38
21
  import '../global/sniffer.js';
39
22
  import 'sniffr';
@@ -42,9 +25,9 @@ import 'core-js/modules/es.array.sort.js';
42
25
 
43
26
  var modules_2f69e2e2 = {"light":"light_rui_2ac4","popup":"popup_rui_871b font_rui_f295","hidden":"hidden_rui_871b","showing":"showing_rui_871b","attached":"attached_rui_871b"};
44
27
 
45
- var isPossibleClientSideNavigation = function isPossibleClientSideNavigation(event) {
46
- var target = event.target;
47
- var link = target.closest('a');
28
+ const isPossibleClientSideNavigation = event => {
29
+ const target = event.target;
30
+ const link = target.closest('a');
48
31
  // Taken from https://github.com/nanostores/router/blob/80a333db4cf0789fda21a02715ebabca15192642/index.js#L58-L69
49
32
  return link && event.button === 0 &&
50
33
  // Left mouse button
@@ -68,80 +51,70 @@ var isPossibleClientSideNavigation = function isPossibleClientSideNavigation(eve
68
51
  // Not open in new window by user
69
52
  !event.defaultPrevented;
70
53
  };
71
- var stop = function stop(event) {
54
+ const stop = event => {
72
55
  if (!isPossibleClientSideNavigation(event)) {
73
56
  event.stopPropagation();
74
57
  }
75
58
  };
76
- var getPopupContainer = function getPopupContainer(target) {
77
- return typeof target === 'string' ? document.querySelector("[data-portaltarget=".concat(target, "]")) : target;
78
- };
59
+ const getPopupContainer = target => typeof target === 'string' ? document.querySelector("[data-portaltarget=".concat(target, "]")) : target;
79
60
  /**
80
61
  * @constructor
81
62
  * @name Popup
82
63
  * @extends {ReactComponent}
83
64
  */
84
- var Popup = /*#__PURE__*/function (_PureComponent) {
85
- function Popup() {
86
- var _this;
87
- _classCallCheck(this, Popup);
88
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
89
- args[_key] = arguments[_key];
90
- }
91
- _this = _callSuper(this, Popup, [].concat(args));
92
- _defineProperty(_this, "state", {
65
+ class Popup extends PureComponent {
66
+ constructor() {
67
+ super(...arguments);
68
+ _defineProperty(this, "state", {
93
69
  display: Display.SHOWING
94
70
  });
95
- _defineProperty(_this, "popup", void 0);
96
- _defineProperty(_this, "node", void 0);
97
- _defineProperty(_this, "parent", void 0);
98
- _defineProperty(_this, "container", void 0);
99
- _defineProperty(_this, "ringPopupTarget", void 0);
100
- _defineProperty(_this, "listeners", new Listeners());
101
- _defineProperty(_this, "redrawScheduler", scheduleRAF(true));
102
- _defineProperty(_this, "uid", getUID('popup-'));
103
- _defineProperty(_this, "calculateDisplay", function (prevState) {
104
- return _objectSpread2(_objectSpread2({}, prevState), {}, {
105
- display: _this.props.hidden ? Display.SHOWING : Display.SHOWN
106
- });
107
- });
108
- _defineProperty(_this, "portalRef", function (el) {
109
- _this.node = el;
110
- _this.parent = el && el.parentElement;
111
- if (el && _this.getContainer()) {
112
- _this._redraw();
71
+ _defineProperty(this, "popup", void 0);
72
+ _defineProperty(this, "node", void 0);
73
+ _defineProperty(this, "parent", void 0);
74
+ _defineProperty(this, "container", void 0);
75
+ _defineProperty(this, "ringPopupTarget", void 0);
76
+ _defineProperty(this, "listeners", new Listeners());
77
+ _defineProperty(this, "redrawScheduler", scheduleRAF(true));
78
+ _defineProperty(this, "uid", getUID('popup-'));
79
+ _defineProperty(this, "calculateDisplay", prevState => _objectSpread2(_objectSpread2({}, prevState), {}, {
80
+ display: this.props.hidden ? Display.SHOWING : Display.SHOWN
81
+ }));
82
+ _defineProperty(this, "portalRef", el => {
83
+ this.node = el;
84
+ this.parent = el && el.parentElement;
85
+ if (el && this.getContainer()) {
86
+ this._redraw();
113
87
  }
114
88
  });
115
- _defineProperty(_this, "popupRef", function (el) {
116
- _this.popup = el;
117
- _this._redraw();
89
+ _defineProperty(this, "popupRef", el => {
90
+ this.popup = el;
91
+ this._redraw();
118
92
  });
119
- _defineProperty(_this, "containerRef", function (el) {
120
- _this.container = el;
93
+ _defineProperty(this, "containerRef", el => {
94
+ this.container = el;
121
95
  });
122
- _defineProperty(_this, "_updateDirection", function (newDirection) {
123
- if (_this.state.direction !== newDirection) {
124
- _this.setState({
96
+ _defineProperty(this, "_updateDirection", newDirection => {
97
+ if (this.state.direction !== newDirection) {
98
+ this.setState({
125
99
  direction: newDirection
126
100
  });
127
- if (_this.props.onDirectionChange) {
128
- _this.props.onDirectionChange(newDirection);
101
+ if (this.props.onDirectionChange) {
102
+ this.props.onDirectionChange(newDirection);
129
103
  }
130
104
  }
131
105
  });
132
- _defineProperty(_this, "_updatePosition", function () {
133
- var popup = _this.popup;
106
+ _defineProperty(this, "_updatePosition", () => {
107
+ const popup = this.popup;
134
108
  if (popup) {
135
109
  popup.style.position = 'absolute';
136
- if (_this.isVisible()) {
137
- var _this$position = _this.position(),
138
- style = _this$position.styles,
139
- direction = _this$position.direction;
140
- Object.entries(style).forEach(function (_ref) {
141
- var _ref2 = _slicedToArray(_ref, 2),
142
- key = _ref2[0],
143
- value = _ref2[1];
144
- var propKey = key;
110
+ if (this.isVisible()) {
111
+ const {
112
+ styles: style,
113
+ direction
114
+ } = this.position();
115
+ Object.entries(style).forEach(_ref => {
116
+ let [key, value] = _ref;
117
+ const propKey = key;
145
118
  if (typeof value === 'number') {
146
119
  popup.style[propKey] = "".concat(value, "px");
147
120
  } else {
@@ -149,243 +122,219 @@ var Popup = /*#__PURE__*/function (_PureComponent) {
149
122
  }
150
123
  });
151
124
  if (direction != null) {
152
- _this._updateDirection(direction);
125
+ this._updateDirection(direction);
153
126
  }
154
127
  }
155
- _this.setState(_this.calculateDisplay);
128
+ this.setState(this.calculateDisplay);
156
129
  }
157
130
  });
158
- _defineProperty(_this, "_redraw", function () {
159
- if (_this.isVisible()) {
160
- _this.redrawScheduler(_this._updatePosition);
131
+ _defineProperty(this, "_redraw", () => {
132
+ if (this.isVisible()) {
133
+ this.redrawScheduler(this._updatePosition);
161
134
  }
162
135
  });
163
- _defineProperty(_this, "_listenersEnabled", void 0);
164
- _defineProperty(_this, "_onEscPress", function (evt) {
165
- _this.props.onEscPress(evt);
166
- _this._onCloseAttempt(evt, true);
136
+ _defineProperty(this, "_listenersEnabled", void 0);
137
+ _defineProperty(this, "_onEscPress", evt => {
138
+ this.props.onEscPress(evt);
139
+ this._onCloseAttempt(evt, true);
167
140
  });
168
141
  /**
169
142
  * @param {jQuery.Event} evt
170
143
  * @private
171
144
  */
172
- _defineProperty(_this, "_onDocumentClick", function (evt) {
145
+ _defineProperty(this, "_onDocumentClick", evt => {
173
146
  var _this$_getAnchor;
174
- if (_this.container && evt.target instanceof Node && _this.container.contains(evt.target) || !_this._listenersEnabled || _this.props.dontCloseOnAnchorClick && evt.target instanceof Node && (_this$_getAnchor = _this._getAnchor()) !== null && _this$_getAnchor !== void 0 && _this$_getAnchor.contains(evt.target)) {
147
+ if (this.container && evt.target instanceof Node && this.container.contains(evt.target) || !this._listenersEnabled || this.props.dontCloseOnAnchorClick && evt.target instanceof Node && (_this$_getAnchor = this._getAnchor()) !== null && _this$_getAnchor !== void 0 && _this$_getAnchor.contains(evt.target)) {
175
148
  return;
176
149
  }
177
- _this.props.onOutsideClick(evt);
178
- _this._onCloseAttempt(evt, false);
150
+ this.props.onOutsideClick(evt);
151
+ this._onCloseAttempt(evt, false);
179
152
  });
180
- _defineProperty(_this, "shortcutsScope", _this.uid);
181
- _defineProperty(_this, "shortcutsMap", {
182
- esc: _this._onEscPress
153
+ _defineProperty(this, "shortcutsScope", this.uid);
154
+ _defineProperty(this, "shortcutsMap", {
155
+ esc: this._onEscPress
183
156
  });
184
- return _this;
185
157
  }
186
- _inherits(Popup, _PureComponent);
187
- return _createClass(Popup, [{
188
- key: "componentDidMount",
189
- value: function componentDidMount() {
190
- if (!this.props.client) {
191
- this.setState({
192
- client: true
193
- });
194
- }
195
- if (!this.props.hidden) {
196
- this._setListenersEnabled(true);
197
- }
198
- }
199
- }, {
200
- key: "componentDidUpdate",
201
- value: function componentDidUpdate(prevProps, prevState) {
202
- var hidden = this.props.hidden;
203
- if (this.props !== prevProps) {
204
- if (prevProps.hidden !== hidden) {
205
- this._setListenersEnabled(!hidden);
206
- }
207
- this._redraw();
208
- }
209
- if (this.props.onShow && !hidden && this.state.display === Display.SHOWN && (prevProps.hidden || prevState.display !== Display.SHOWN)) {
210
- this.props.onShow();
211
- }
212
- }
213
- }, {
214
- key: "componentWillUnmount",
215
- value: function componentWillUnmount() {
216
- this._setListenersEnabled(false);
217
- }
218
- }, {
219
- key: "shouldUseShortcuts",
220
- value: function shouldUseShortcuts() {
221
- var _this$props = this.props,
222
- shortcuts = _this$props.shortcuts,
223
- hidden = _this$props.hidden;
224
- return shortcuts && !hidden;
225
- }
226
- }, {
227
- key: "getContainer",
228
- value: function getContainer() {
229
- var target = this.props.target || this.ringPopupTarget;
230
- return target && getPopupContainer(target);
231
- }
232
- }, {
233
- key: "position",
234
- value: function position$1() {
235
- var _this$props2 = this.props,
236
- directions = _this$props2.directions,
237
- autoPositioning = _this$props2.autoPositioning,
238
- autoCorrectTopOverflow = _this$props2.autoCorrectTopOverflow,
239
- sidePadding = _this$props2.sidePadding,
240
- top = _this$props2.top,
241
- left = _this$props2.left,
242
- offset = _this$props2.offset,
243
- maxHeight = _this$props2.maxHeight,
244
- minWidth = _this$props2.minWidth;
245
- var container = this.getContainer();
246
- return position({
247
- popup: this.popup,
248
- container: container && getStyles(container).position !== 'static' ? container : null,
249
- anchor: this._getAnchor(),
250
- directions,
251
- autoPositioning,
252
- autoCorrectTopOverflow,
253
- sidePadding,
254
- top,
255
- left,
256
- offset,
257
- maxHeight,
258
- minWidth
158
+ componentDidMount() {
159
+ if (!this.props.client) {
160
+ this.setState({
161
+ client: true
259
162
  });
260
163
  }
261
- }, {
262
- key: "_getAnchor",
263
- value: function _getAnchor() {
264
- return this.props.anchorElement || this.parent;
164
+ if (!this.props.hidden) {
165
+ this._setListenersEnabled(true);
265
166
  }
266
- }, {
267
- key: "_setListenersEnabled",
268
- value:
269
- /**
270
- * @param {boolean} enable
271
- * @private
272
- */
273
- function _setListenersEnabled(enable) {
274
- var _this2 = this;
275
- if (enable && !this._listenersEnabled) {
276
- setTimeout(function () {
277
- _this2._listenersEnabled = true;
278
- _this2.listeners.add(window, 'resize', _this2._redraw);
279
- if (_this2.props.autoPositioningOnScroll) {
280
- _this2.listeners.add(window, 'scroll', _this2._redraw);
281
- }
282
- _this2.listeners.add(document, 'pointerdown', _this2._onDocumentClick, true);
283
- var el = _this2._getAnchor();
284
- while (el) {
285
- _this2.listeners.add(el, 'scroll', _this2._redraw);
286
- el = el.parentElement;
287
- }
288
- }, 0);
289
- return;
290
- }
291
- if (!enable && this._listenersEnabled) {
292
- this.listeners.removeAll();
293
- this._listenersEnabled = false;
167
+ }
168
+ componentDidUpdate(prevProps, prevState) {
169
+ const {
170
+ hidden
171
+ } = this.props;
172
+ if (this.props !== prevProps) {
173
+ if (prevProps.hidden !== hidden) {
174
+ this._setListenersEnabled(!hidden);
294
175
  }
176
+ this._redraw();
295
177
  }
296
- /**
297
- * Returns visibility state
298
- * @return {boolean}
299
- */
300
- }, {
301
- key: "isVisible",
302
- value: function isVisible() {
303
- return !this.props.hidden;
178
+ if (this.props.onShow && !hidden && this.state.display === Display.SHOWN && (prevProps.hidden || prevState.display !== Display.SHOWN)) {
179
+ this.props.onShow();
304
180
  }
305
- }, {
306
- key: "_onCloseAttempt",
307
- value: function _onCloseAttempt(evt, isEsc) {
308
- this.props.onCloseAttempt(evt, isEsc);
309
- }
310
- }, {
311
- key: "getInternalContent",
312
- value: function getInternalContent() {
313
- var _this$props3 = this.props,
314
- trapFocus = _this$props3.trapFocus,
315
- autoFocusFirst = _this$props3.autoFocusFirst,
316
- children = _this$props3.children;
317
- return trapFocus ? /*#__PURE__*/jsx(TabTrap, {
318
- autoFocusFirst: autoFocusFirst,
319
- focusBackOnExit: true,
320
- children: children
321
- }) : children;
322
- }
323
- }, {
324
- key: "render",
325
- value: function render() {
326
- var _this3 = this;
327
- var _this$props4 = this.props,
328
- className = _this$props4.className,
329
- style = _this$props4.style,
330
- hidden = _this$props4.hidden,
331
- attached = _this$props4.attached,
332
- keepMounted = _this$props4.keepMounted,
333
- client = _this$props4.client,
334
- onMouseDown = _this$props4.onMouseDown,
335
- onMouseUp = _this$props4.onMouseUp,
336
- onMouseOver = _this$props4.onMouseOver,
337
- onMouseOut = _this$props4.onMouseOut,
338
- onContextMenu = _this$props4.onContextMenu,
339
- dataTest = _this$props4['data-test'];
340
- var showing = this.state.display === Display.SHOWING;
341
- var classes = classNames(className, modules_2f69e2e2.popup, {
342
- [modules_2f69e2e2.attached]: attached,
343
- [modules_2f69e2e2.hidden]: hidden,
344
- [modules_2f69e2e2.showing]: showing
345
- });
346
- var direction = (this.state.direction || '').toLowerCase().replace(/[_]/g, '-');
347
- return /*#__PURE__*/jsx(PopupTargetContext.Consumer, {
348
- children: function children(value) {
349
- _this3.ringPopupTarget = value;
350
- return /*#__PURE__*/jsxs("span", {
351
- // prevent bubbling through portal
352
- onClick: stop
353
- // This handler only blocks bubbling through React portal
354
- ,
355
- role: "presentation",
356
- ref: _this3.portalRef,
357
- children: [_this3.shouldUseShortcuts() && /*#__PURE__*/jsx(Shortcuts, {
358
- map: _this3.shortcutsMap,
359
- scope: _this3.shortcutsScope
360
- }), (client || _this3.state.client) && (keepMounted || !hidden) && /*#__PURE__*/createPortal( /*#__PURE__*/jsx(PopupTarget, {
361
- id: _this3.uid,
362
- ref: _this3.containerRef,
363
- onMouseOver: onMouseOver,
364
- onFocus: onMouseOver,
365
- onMouseOut: onMouseOut,
366
- onBlur: onMouseOut,
367
- onContextMenu: onContextMenu,
368
- children: /*#__PURE__*/jsx("div", {
369
- "data-test": joinDataTestAttributes('ring-popup', dataTest),
370
- "data-test-shown": !hidden && !showing,
371
- "data-test-direction": direction,
372
- ref: _this3.popupRef,
373
- className: classes,
374
- style: style,
375
- onMouseDown: onMouseDown,
376
- onMouseUp: onMouseUp
377
- // mouse handlers are used to track clicking on inner elements
378
- ,
379
- role: "presentation",
380
- children: _this3.getInternalContent()
381
- })
382
- }), _this3.getContainer() || document.body)]
383
- });
181
+ }
182
+ componentWillUnmount() {
183
+ this._setListenersEnabled(false);
184
+ }
185
+ shouldUseShortcuts() {
186
+ const {
187
+ shortcuts,
188
+ hidden
189
+ } = this.props;
190
+ return shortcuts && !hidden;
191
+ }
192
+ getContainer() {
193
+ const target = this.props.target || this.ringPopupTarget;
194
+ return target && getPopupContainer(target);
195
+ }
196
+ position() {
197
+ const {
198
+ directions,
199
+ autoPositioning,
200
+ autoCorrectTopOverflow,
201
+ sidePadding,
202
+ top,
203
+ left,
204
+ offset,
205
+ maxHeight,
206
+ minWidth
207
+ } = this.props;
208
+ const container = this.getContainer();
209
+ return position({
210
+ popup: this.popup,
211
+ container: container && getStyles(container).position !== 'static' ? container : null,
212
+ anchor: this._getAnchor(),
213
+ directions,
214
+ autoPositioning,
215
+ autoCorrectTopOverflow,
216
+ sidePadding,
217
+ top,
218
+ left,
219
+ offset,
220
+ maxHeight,
221
+ minWidth
222
+ });
223
+ }
224
+ _getAnchor() {
225
+ return this.props.anchorElement || this.parent;
226
+ }
227
+ /**
228
+ * @param {boolean} enable
229
+ * @private
230
+ */
231
+ _setListenersEnabled(enable) {
232
+ if (enable && !this._listenersEnabled) {
233
+ setTimeout(() => {
234
+ this._listenersEnabled = true;
235
+ this.listeners.add(window, 'resize', this._redraw);
236
+ if (this.props.autoPositioningOnScroll) {
237
+ this.listeners.add(window, 'scroll', this._redraw);
384
238
  }
385
- });
239
+ this.listeners.add(document, 'pointerdown', this._onDocumentClick, true);
240
+ let el = this._getAnchor();
241
+ while (el) {
242
+ this.listeners.add(el, 'scroll', this._redraw);
243
+ el = el.parentElement;
244
+ }
245
+ }, 0);
246
+ return;
247
+ }
248
+ if (!enable && this._listenersEnabled) {
249
+ this.listeners.removeAll();
250
+ this._listenersEnabled = false;
386
251
  }
387
- }]);
388
- }(PureComponent);
252
+ }
253
+ /**
254
+ * Returns visibility state
255
+ * @return {boolean}
256
+ */
257
+ isVisible() {
258
+ return !this.props.hidden;
259
+ }
260
+ _onCloseAttempt(evt, isEsc) {
261
+ this.props.onCloseAttempt(evt, isEsc);
262
+ }
263
+ getInternalContent() {
264
+ const {
265
+ trapFocus,
266
+ autoFocusFirst,
267
+ children
268
+ } = this.props;
269
+ return trapFocus ? /*#__PURE__*/jsx(TabTrap, {
270
+ autoFocusFirst: autoFocusFirst,
271
+ focusBackOnExit: true,
272
+ children: children
273
+ }) : children;
274
+ }
275
+ render() {
276
+ const {
277
+ className,
278
+ style,
279
+ hidden,
280
+ attached,
281
+ keepMounted,
282
+ client,
283
+ onMouseDown,
284
+ onMouseUp,
285
+ onMouseOver,
286
+ onMouseOut,
287
+ onContextMenu,
288
+ 'data-test': dataTest
289
+ } = this.props;
290
+ const showing = this.state.display === Display.SHOWING;
291
+ const classes = classNames(className, modules_2f69e2e2.popup, {
292
+ [modules_2f69e2e2.attached]: attached,
293
+ [modules_2f69e2e2.hidden]: hidden,
294
+ [modules_2f69e2e2.showing]: showing
295
+ });
296
+ const direction = (this.state.direction || '').toLowerCase().replace(/[_]/g, '-');
297
+ return /*#__PURE__*/jsx(PopupTargetContext.Consumer, {
298
+ children: value => {
299
+ this.ringPopupTarget = value;
300
+ return /*#__PURE__*/jsxs("span", {
301
+ // prevent bubbling through portal
302
+ onClick: stop
303
+ // This handler only blocks bubbling through React portal
304
+ ,
305
+ role: "presentation",
306
+ ref: this.portalRef,
307
+ children: [this.shouldUseShortcuts() && /*#__PURE__*/jsx(Shortcuts, {
308
+ map: this.shortcutsMap,
309
+ scope: this.shortcutsScope
310
+ }), (client || this.state.client) && (keepMounted || !hidden) && /*#__PURE__*/createPortal( /*#__PURE__*/jsx(PopupTarget, {
311
+ id: this.uid,
312
+ ref: this.containerRef,
313
+ onMouseOver: onMouseOver,
314
+ onFocus: onMouseOver,
315
+ onMouseOut: onMouseOut,
316
+ onBlur: onMouseOut,
317
+ onContextMenu: onContextMenu,
318
+ children: /*#__PURE__*/jsx("div", {
319
+ "data-test": joinDataTestAttributes('ring-popup', dataTest),
320
+ "data-test-shown": !hidden && !showing,
321
+ "data-test-direction": direction,
322
+ ref: this.popupRef,
323
+ className: classes,
324
+ style: style,
325
+ onMouseDown: onMouseDown,
326
+ onMouseUp: onMouseUp
327
+ // mouse handlers are used to track clicking on inner elements
328
+ ,
329
+ role: "presentation",
330
+ children: this.getInternalContent()
331
+ })
332
+ }), this.getContainer() || document.body)]
333
+ });
334
+ }
335
+ });
336
+ }
337
+ }
389
338
  _defineProperty(Popup, "defaultProps", {
390
339
  shortcuts: true,
391
340
  hidden: false,
@@ -1,15 +1,17 @@
1
- import { c as _objectWithoutProperties, d as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
1
+ import { a as _objectWithoutProperties, b as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
2
2
  import { createContext, forwardRef } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { jsx } from 'react/jsx-runtime';
5
5
 
6
- var _excluded = ["id", "children"];
7
- var PopupTargetContext = /*#__PURE__*/createContext(undefined);
8
- var PopupTarget = /*#__PURE__*/forwardRef(function PopupTarget(_ref, ref) {
9
- var id = _ref.id,
10
- children = _ref.children,
6
+ const _excluded = ["id", "children"];
7
+ const PopupTargetContext = /*#__PURE__*/createContext(undefined);
8
+ const PopupTarget = /*#__PURE__*/forwardRef(function PopupTarget(_ref, ref) {
9
+ let {
10
+ id,
11
+ children
12
+ } = _ref,
11
13
  restProps = _objectWithoutProperties(_ref, _excluded);
12
- var target = /*#__PURE__*/jsx("div", _objectSpread2(_objectSpread2({}, restProps), {}, {
14
+ const target = /*#__PURE__*/jsx("div", _objectSpread2(_objectSpread2({}, restProps), {}, {
13
15
  "data-portaltarget": id,
14
16
  ref: ref,
15
17
  children: typeof children !== 'function' && children