@jetbrains/ring-ui 5.0.35 → 5.0.37

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 (241) hide show
  1. package/components/date-picker/date-popup.js +3 -1
  2. package/components/editable-heading/editable-heading.css +69 -0
  3. package/components/editable-heading/editable-heading.d.ts +21 -0
  4. package/components/editable-heading/editable-heading.js +34 -0
  5. package/components/input/input.css +2 -0
  6. package/components/query-assist/query-assist.js +1 -1
  7. package/dist/_helpers/_rollupPluginBabelHelpers.js +0 -4
  8. package/dist/_helpers/anchor.js +0 -1
  9. package/dist/_helpers/card.js +0 -3
  10. package/dist/_helpers/dialog__body-scroll-preventer.js +0 -11
  11. package/dist/_helpers/footer.js +2 -13
  12. package/dist/_helpers/query-assist__suggestions.js +0 -10
  13. package/dist/_helpers/select__filter.js +0 -11
  14. package/dist/_helpers/services-link.js +0 -2
  15. package/dist/_helpers/sidebar.js +0 -12
  16. package/dist/_helpers/theme.js +0 -3
  17. package/dist/_helpers/title.js +0 -9
  18. package/dist/alert/alert.js +2 -32
  19. package/dist/alert/container.js +0 -5
  20. package/dist/alert-service/alert-service.js +0 -26
  21. package/dist/analytics/analytics.js +0 -22
  22. package/dist/analytics/analytics__custom-plugin.js +0 -38
  23. package/dist/analytics/analytics__fus-plugin.js +0 -20
  24. package/dist/analytics/analytics__ga-plugin.js +0 -13
  25. package/dist/analytics/analytics__plugin-utils.js +0 -8
  26. package/dist/analytics-ng/analytics-ng.js +3 -9
  27. package/dist/auth/auth.js +2 -3
  28. package/dist/auth/auth__core.js +30 -243
  29. package/dist/auth/background-flow.js +2 -25
  30. package/dist/auth/down-notification.js +0 -7
  31. package/dist/auth/iframe-flow.js +2 -26
  32. package/dist/auth/landing.js +2 -6
  33. package/dist/auth/request-builder.js +0 -11
  34. package/dist/auth/response-parser.js +4 -26
  35. package/dist/auth/storage.js +4 -60
  36. package/dist/auth/token-validator.js +6 -42
  37. package/dist/auth/window-flow.js +2 -34
  38. package/dist/auth-dialog/auth-dialog.js +2 -12
  39. package/dist/auth-dialog-service/auth-dialog-service.js +2 -4
  40. package/dist/auth-ng/auth-ng.js +6 -22
  41. package/dist/auth-ng/auth-ng.mock.js +0 -4
  42. package/dist/autofocus-ng/autofocus-ng.js +0 -5
  43. package/dist/avatar/avatar.js +4 -17
  44. package/dist/avatar/fallback-avatar.js +2 -9
  45. package/dist/avatar-editor-ng/avatar-editor-ng.js +1 -17
  46. package/dist/badge/badge.js +0 -3
  47. package/dist/button/button.js +0 -8
  48. package/dist/button-group/button-group.js +0 -3
  49. package/dist/button-group/caption.js +0 -2
  50. package/dist/button-group-ng/button-group-ng.js +0 -4
  51. package/dist/button-ng/button-ng.js +3 -21
  52. package/dist/button-set/button-set.js +0 -3
  53. package/dist/button-set-ng/button-set-ng.js +0 -2
  54. package/dist/button-toolbar/button-toolbar.js +0 -3
  55. package/dist/button-toolbar-ng/button-toolbar-ng.js +0 -2
  56. package/dist/caret/caret.js +2 -53
  57. package/dist/checkbox/checkbox.js +0 -12
  58. package/dist/code/code.js +3 -25
  59. package/dist/compiler-ng/compiler-ng.js +0 -5
  60. package/dist/confirm/confirm.js +0 -6
  61. package/dist/confirm-service/confirm-service.js +10 -8
  62. package/dist/content-layout/content-layout.js +0 -7
  63. package/dist/contenteditable/contenteditable.js +6 -13
  64. package/dist/data-list/data-list.js +4 -28
  65. package/dist/data-list/item.js +0 -15
  66. package/dist/data-list/selection.js +0 -27
  67. package/dist/date-picker/consts.js +0 -7
  68. package/dist/date-picker/date-input.js +0 -20
  69. package/dist/date-picker/date-picker.js +2 -36
  70. package/dist/date-picker/date-popup.js +21 -72
  71. package/dist/date-picker/day.js +0 -14
  72. package/dist/date-picker/month-names.js +0 -9
  73. package/dist/date-picker/month-slider.js +0 -10
  74. package/dist/date-picker/month.js +2 -4
  75. package/dist/date-picker/months.js +6 -13
  76. package/dist/date-picker/years.js +0 -14
  77. package/dist/dialog/dialog.js +0 -19
  78. package/dist/dialog-ng/dialog-ng.js +17 -105
  79. package/dist/docked-panel-ng/docked-panel-ng.js +6 -29
  80. package/dist/dropdown/dropdown.js +2 -33
  81. package/dist/dropdown-menu/dropdown-menu.js +4 -8
  82. package/dist/editable-heading/editable-heading.d.ts +21 -0
  83. package/dist/editable-heading/editable-heading.js +85 -0
  84. package/dist/error-bubble/error-bubble.js +2 -4
  85. package/dist/error-message/error-message.js +0 -3
  86. package/dist/footer-ng/footer-ng.js +0 -13
  87. package/dist/form-ng/form-ng.js +1 -21
  88. package/dist/global/angular-component-factory.js +0 -10
  89. package/dist/global/compose.js +0 -1
  90. package/dist/global/composeRefs.js +0 -1
  91. package/dist/global/controls-height.js +0 -2
  92. package/dist/global/create-stateful-context.js +0 -5
  93. package/dist/global/data-tests.js +0 -4
  94. package/dist/global/dom.js +2 -11
  95. package/dist/global/focus-sensor-hoc.js +4 -33
  96. package/dist/global/fuzzy-highlight.js +2 -16
  97. package/dist/global/get-event-key.js +8 -17
  98. package/dist/global/get-uid.js +0 -2
  99. package/dist/global/linear-function.js +0 -2
  100. package/dist/global/listeners.js +0 -13
  101. package/dist/global/memoize.js +0 -2
  102. package/dist/global/normalize-indent.js +2 -5
  103. package/dist/global/react-dom-renderer.js +0 -8
  104. package/dist/global/react-render-adapter.js +0 -7
  105. package/dist/global/rerender-hoc.js +0 -7
  106. package/dist/global/ring-angular-component.js +0 -5
  107. package/dist/global/schedule-raf.js +0 -5
  108. package/dist/global/trivial-template-tag.js +2 -3
  109. package/dist/global/url.js +0 -27
  110. package/dist/grid/col.js +0 -4
  111. package/dist/grid/grid.js +0 -3
  112. package/dist/grid/row.js +0 -5
  113. package/dist/group/group.js +0 -3
  114. package/dist/header/header.js +0 -5
  115. package/dist/header/logo.js +0 -4
  116. package/dist/header/profile.js +0 -7
  117. package/dist/header/services.js +0 -11
  118. package/dist/header/smart-profile.js +4 -18
  119. package/dist/header/smart-services.js +0 -17
  120. package/dist/header/tray-icon.js +2 -3
  121. package/dist/header/tray.js +0 -3
  122. package/dist/heading/heading.js +0 -5
  123. package/dist/http/http.js +20 -65
  124. package/dist/http/http.mock.js +2 -14
  125. package/dist/hub-source/hub-source.js +0 -32
  126. package/dist/hub-source/hub-source__user.js +0 -1
  127. package/dist/hub-source/hub-source__users-groups.js +0 -12
  128. package/dist/icon/icon.js +0 -13
  129. package/dist/icon/icon__constants.js +0 -4
  130. package/dist/icon/icon__svg.js +0 -10
  131. package/dist/icon-ng/icon-ng.js +2 -7
  132. package/dist/input/input.js +0 -30
  133. package/dist/input-ng/input-ng.js +0 -17
  134. package/dist/island/adaptive-island-hoc.js +0 -7
  135. package/dist/island/content.js +0 -25
  136. package/dist/island/header.js +0 -7
  137. package/dist/island/island.js +0 -4
  138. package/dist/island-legacy/content-legacy.js +0 -2
  139. package/dist/island-legacy/header-legacy.js +0 -2
  140. package/dist/island-legacy/island-legacy.js +0 -2
  141. package/dist/island-ng/island-content-ng.js +0 -3
  142. package/dist/link/clickableLink.js +2 -10
  143. package/dist/link/link.js +2 -9
  144. package/dist/link-ng/link-ng.js +0 -2
  145. package/dist/list/consts.js +0 -4
  146. package/dist/list/list.js +6 -128
  147. package/dist/list/list__custom.js +0 -4
  148. package/dist/list/list__hint.js +0 -3
  149. package/dist/list/list__item.js +0 -8
  150. package/dist/list/list__link.js +2 -3
  151. package/dist/list/list__separator.js +0 -1
  152. package/dist/list/list__title.js +0 -1
  153. package/dist/list/list__users-groups-source.js +4 -17
  154. package/dist/loader/loader.js +0 -10
  155. package/dist/loader/loader__core.js +6 -70
  156. package/dist/loader-inline/loader-inline.js +0 -3
  157. package/dist/loader-ng/loader-ng.js +0 -7
  158. package/dist/loader-screen/loader-screen.js +0 -3
  159. package/dist/loader-screen-ng/loader-screen-ng.js +2 -14
  160. package/dist/login-dialog/login-dialog.js +0 -15
  161. package/dist/login-dialog/service.js +2 -4
  162. package/dist/markdown/code.js +0 -2
  163. package/dist/markdown/heading.js +0 -1
  164. package/dist/markdown/link.js +0 -1
  165. package/dist/markdown/markdown.js +0 -2
  166. package/dist/message/message.js +0 -24
  167. package/dist/message-bundle-ng/message-bundle-ng.js +2 -45
  168. package/dist/old-browsers-message/old-browsers-message.js +2 -21
  169. package/dist/old-browsers-message/white-list.js +2 -6
  170. package/dist/pager/pager.js +2 -39
  171. package/dist/panel/panel.js +0 -3
  172. package/dist/permissions/permissions.js +1 -43
  173. package/dist/permissions/permissions__cache.js +12 -63
  174. package/dist/permissions-ng/permissions-ng.js +11 -19
  175. package/dist/place-under-ng/place-under-ng.js +0 -19
  176. package/dist/popup/popup.consts.js +0 -11
  177. package/dist/popup/popup.js +6 -68
  178. package/dist/popup/position.js +8 -30
  179. package/dist/popup-menu/popup-menu.js +4 -13
  180. package/dist/progress-bar/progress-bar.js +0 -14
  181. package/dist/promised-click-ng/promised-click-ng.js +3 -22
  182. package/dist/query-assist/query-assist.js +17 -201
  183. package/dist/radio/radio.js +0 -6
  184. package/dist/radio/radio__item.js +0 -9
  185. package/dist/radio-ng/radio-ng.js +0 -4
  186. package/dist/save-field-ng/save-field-ng.js +1 -37
  187. package/dist/select/select.js +18 -208
  188. package/dist/select/select__popup.js +4 -76
  189. package/dist/select-ng/select-ng.js +18 -74
  190. package/dist/select-ng/select-ng__lazy.js +2 -17
  191. package/dist/select-ng/select-ng__options.js +3 -29
  192. package/dist/shortcuts/core.js +4 -56
  193. package/dist/shortcuts/shortcuts-hoc.js +0 -4
  194. package/dist/shortcuts/shortcuts.js +0 -10
  195. package/dist/shortcuts-hint-ng/shortcuts-hint-ng.js +0 -13
  196. package/dist/shortcuts-ng/shortcuts-ng.js +16 -46
  197. package/dist/sidebar-ng/sidebar-ng.js +2 -12
  198. package/dist/storage/storage.js +2 -5
  199. package/dist/storage/storage__fallback.js +2 -48
  200. package/dist/storage/storage__local.js +0 -23
  201. package/dist/style.css +1 -1
  202. package/dist/tab-trap/tab-trap.js +0 -37
  203. package/dist/table/cell.js +0 -2
  204. package/dist/table/disable-hover-hoc.js +0 -9
  205. package/dist/table/header-cell.js +0 -8
  206. package/dist/table/header.js +0 -16
  207. package/dist/table/multitable.js +0 -23
  208. package/dist/table/row-with-focus-sensor.js +0 -12
  209. package/dist/table/row.js +0 -18
  210. package/dist/table/selection-adapter.js +0 -2
  211. package/dist/table/selection-shortcuts-hoc.js +8 -42
  212. package/dist/table/selection.js +0 -50
  213. package/dist/table/smart-table.js +0 -9
  214. package/dist/table/table.js +6 -37
  215. package/dist/table-legacy-ng/table-legacy-ng.js +12 -42
  216. package/dist/table-legacy-ng/table-legacy-ng__selection-navigate-actions.js +0 -31
  217. package/dist/table-legacy-ng/table-legacy-ng__selection.js +0 -32
  218. package/dist/table-legacy-ng/table-legacy-ng__toolbar.js +2 -5
  219. package/dist/tabs/collapsible-more.js +0 -5
  220. package/dist/tabs/collapsible-tab.js +0 -4
  221. package/dist/tabs/collapsible-tabs.js +8 -28
  222. package/dist/tabs/dumb-tabs.js +0 -8
  223. package/dist/tabs/smart-tabs.js +0 -6
  224. package/dist/tabs/tab-link.js +0 -1
  225. package/dist/tabs/tab.js +0 -2
  226. package/dist/tabs-ng/tabs-ng.js +13 -29
  227. package/dist/tag/tag.js +0 -24
  228. package/dist/tags-input/tags-input.js +0 -76
  229. package/dist/tags-list/tags-list.js +0 -6
  230. package/dist/template-ng/template-ng.js +0 -12
  231. package/dist/text/text.js +0 -3
  232. package/dist/theme-ng/theme-ng.js +0 -8
  233. package/dist/title-ng/title-ng.js +6 -17
  234. package/dist/toggle/toggle.js +0 -4
  235. package/dist/tooltip/tooltip.js +4 -35
  236. package/dist/tooltip-ng/tooltip-ng.js +2 -8
  237. package/dist/user-agreement/service.js +0 -62
  238. package/dist/user-agreement/user-agreement.js +0 -8
  239. package/dist/user-card/smart-user-card-tooltip.js +2 -8
  240. package/dist/user-card/tooltip.js +0 -3
  241. package/package.json +22 -22
@@ -21,79 +21,58 @@ import 'sniffr';
21
21
  var modules_2f69e2e2 = {"popup":"popup_rui_7cd4 font_rui_8bff","hidden":"hidden_rui_7cd4","showing":"showing_rui_7cd4","attached":"attached_rui_7cd4"};
22
22
 
23
23
  const stop = e => e.stopPropagation();
24
-
25
24
  const getPopupContainer = target => typeof target === 'string' ? document.querySelector(`[data-portaltarget=${target}]`) : target;
26
25
  /**
27
26
  * @constructor
28
27
  * @name Popup
29
28
  * @extends {ReactComponent}
30
29
  */
31
-
32
30
  class Popup extends PureComponent {
33
31
  constructor() {
34
32
  super(...arguments);
35
-
36
33
  _defineProperty(this, "state", {
37
34
  display: Display.SHOWING
38
35
  });
39
-
40
36
  _defineProperty(this, "popup", void 0);
41
-
42
37
  _defineProperty(this, "node", void 0);
43
-
44
38
  _defineProperty(this, "parent", void 0);
45
-
46
39
  _defineProperty(this, "container", void 0);
47
-
48
40
  _defineProperty(this, "ringPopupTarget", void 0);
49
-
50
41
  _defineProperty(this, "listeners", new Listeners());
51
-
52
42
  _defineProperty(this, "redrawScheduler", scheduleRAF(true));
53
-
54
43
  _defineProperty(this, "uid", getUID('popup-'));
55
-
56
- _defineProperty(this, "calculateDisplay", prevState => ({ ...prevState,
44
+ _defineProperty(this, "calculateDisplay", prevState => ({
45
+ ...prevState,
57
46
  display: this.props.hidden ? Display.SHOWING : Display.SHOWN
58
47
  }));
59
-
60
48
  _defineProperty(this, "portalRef", el => {
61
49
  this.node = el;
62
50
  this.parent = el && el.parentElement;
63
-
64
51
  if (el && this.getContainer()) {
65
52
  this._redraw();
66
53
  }
67
54
  });
68
-
69
55
  _defineProperty(this, "popupRef", el => {
70
56
  this.popup = el;
71
-
72
57
  this._redraw();
73
58
  });
74
-
75
59
  _defineProperty(this, "containerRef", el => {
76
60
  this.container = el;
77
61
  });
78
-
79
62
  _defineProperty(this, "_updateDirection", newDirection => {
80
63
  if (this.state.direction !== newDirection) {
81
64
  this.setState({
82
65
  direction: newDirection
83
66
  });
84
-
85
67
  if (this.props.onDirectionChange) {
86
68
  this.props.onDirectionChange(newDirection);
87
69
  }
88
70
  }
89
71
  });
90
-
91
72
  _defineProperty(this, "_updatePosition", () => {
92
73
  const popup = this.popup;
93
-
94
74
  if (popup) {
95
75
  popup.style.position = 'absolute';
96
-
97
76
  if (this.isVisible()) {
98
77
  const {
99
78
  styles: style,
@@ -102,90 +81,69 @@ class Popup extends PureComponent {
102
81
  Object.entries(style).forEach(_ref => {
103
82
  let [key, value] = _ref;
104
83
  const propKey = key;
105
-
106
84
  if (typeof value === 'number') {
107
85
  popup.style[propKey] = `${value}px`;
108
86
  } else {
109
87
  popup.style[propKey] = value.toString();
110
88
  }
111
89
  });
112
-
113
90
  if (direction != null) {
114
91
  this._updateDirection(direction);
115
92
  }
116
93
  }
117
-
118
94
  this.setState(this.calculateDisplay);
119
95
  }
120
96
  });
121
-
122
97
  _defineProperty(this, "_redraw", () => {
123
98
  if (this.isVisible()) {
124
99
  this.redrawScheduler(this._updatePosition);
125
100
  }
126
101
  });
127
-
128
102
  _defineProperty(this, "_listenersEnabled", void 0);
129
-
130
103
  _defineProperty(this, "_onEscPress", evt => {
131
104
  this.props.onEscPress(evt);
132
-
133
105
  this._onCloseAttempt(evt, true);
134
106
  });
135
-
136
107
  _defineProperty(this, "_onDocumentClick", evt => {
137
108
  var _this$_getAnchor;
138
-
139
109
  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)) {
140
110
  return;
141
111
  }
142
-
143
112
  this.props.onOutsideClick(evt);
144
-
145
113
  this._onCloseAttempt(evt, false);
146
114
  });
147
-
148
115
  _defineProperty(this, "shortcutsScope", this.uid);
149
-
150
116
  _defineProperty(this, "shortcutsMap", {
151
117
  esc: this._onEscPress
152
118
  });
153
119
  }
154
-
155
120
  componentDidMount() {
156
121
  if (!this.props.client) {
157
122
  this.setState({
158
123
  client: true
159
124
  });
160
125
  }
161
-
162
126
  if (!this.props.hidden) {
163
127
  this._setListenersEnabled(true);
164
128
  }
165
129
  }
166
-
167
130
  componentDidUpdate(prevProps, prevState) {
168
131
  const {
169
132
  hidden
170
133
  } = this.props;
171
-
172
134
  if (this.props !== prevProps) {
173
135
  if (prevProps.hidden !== hidden) {
174
136
  this._setListenersEnabled(!hidden);
175
137
  }
176
-
177
138
  this._redraw();
178
139
  }
179
-
180
140
  if (this.props.onShow && !hidden && this.state.display === Display.SHOWN && (prevProps.hidden || prevState.display !== Display.SHOWN)) {
181
141
  this.props.onShow();
182
142
  }
183
143
  }
184
-
185
144
  componentWillUnmount() {
186
145
  this._setListenersEnabled(false);
187
146
  }
188
-
189
147
  shouldUseShortcuts() {
190
148
  const {
191
149
  shortcuts,
@@ -193,12 +151,10 @@ class Popup extends PureComponent {
193
151
  } = this.props;
194
152
  return shortcuts && !hidden;
195
153
  }
196
-
197
154
  getContainer() {
198
155
  const target = this.props.target || this.ringPopupTarget;
199
156
  return target && getPopupContainer(target);
200
157
  }
201
-
202
158
  position() {
203
159
  const {
204
160
  directions,
@@ -227,11 +183,9 @@ class Popup extends PureComponent {
227
183
  minWidth
228
184
  });
229
185
  }
230
-
231
186
  _getAnchor() {
232
187
  return this.props.anchorElement || this.parent;
233
188
  }
234
-
235
189
  /**
236
190
  * @param {boolean} enable
237
191
  * @private
@@ -241,15 +195,11 @@ class Popup extends PureComponent {
241
195
  setTimeout(() => {
242
196
  this._listenersEnabled = true;
243
197
  this.listeners.add(window, 'resize', this._redraw);
244
-
245
198
  if (this.props.autoPositioningOnScroll) {
246
199
  this.listeners.add(window, 'scroll', this._redraw);
247
200
  }
248
-
249
201
  this.listeners.add(document, 'pointerdown', this._onDocumentClick, true);
250
-
251
202
  let el = this._getAnchor();
252
-
253
203
  while (el) {
254
204
  this.listeners.add(el, 'scroll', this._redraw);
255
205
  el = el.parentElement;
@@ -257,7 +207,6 @@ class Popup extends PureComponent {
257
207
  }, 0);
258
208
  return;
259
209
  }
260
-
261
210
  if (!enable && this._listenersEnabled) {
262
211
  this.listeners.removeAll();
263
212
  this._listenersEnabled = false;
@@ -267,16 +216,12 @@ class Popup extends PureComponent {
267
216
  * Returns visibility state
268
217
  * @return {boolean}
269
218
  */
270
-
271
-
272
219
  isVisible() {
273
220
  return !this.props.hidden;
274
221
  }
275
-
276
222
  _onCloseAttempt(evt, isEsc) {
277
223
  this.props.onCloseAttempt(evt, isEsc);
278
224
  }
279
-
280
225
  getInternalContent() {
281
226
  const {
282
227
  trapFocus,
@@ -288,7 +233,6 @@ class Popup extends PureComponent {
288
233
  focusBackOnExit: true
289
234
  }, children) : children;
290
235
  }
291
-
292
236
  render() {
293
237
  const {
294
238
  className,
@@ -315,7 +259,8 @@ class Popup extends PureComponent {
315
259
  this.ringPopupTarget = value;
316
260
  return /*#__PURE__*/React.createElement("span", {
317
261
  // prevent bubbling through portal
318
- onClick: stop // This handler only blocks bubbling through React portal
262
+ onClick: stop
263
+ // This handler only blocks bubbling through React portal
319
264
  ,
320
265
  role: "presentation",
321
266
  ref: this.portalRef
@@ -338,25 +283,20 @@ class Popup extends PureComponent {
338
283
  className: classes,
339
284
  style: style,
340
285
  onMouseDown: onMouseDown,
341
- onMouseUp: onMouseUp // mouse handlers are used to track clicking on inner elements
286
+ onMouseUp: onMouseUp
287
+ // mouse handlers are used to track clicking on inner elements
342
288
  ,
343
289
  role: "presentation"
344
290
  }, this.getInternalContent())), this.getContainer() || document.body));
345
291
  });
346
292
  }
347
-
348
293
  }
349
-
350
294
  _defineProperty(Popup, "defaultProps", {
351
295
  shortcuts: true,
352
296
  hidden: false,
353
-
354
297
  onOutsideClick() {},
355
-
356
298
  onEscPress() {},
357
-
358
299
  onCloseAttempt() {},
359
-
360
300
  dontCloseOnAnchorClick: false,
361
301
  keepMounted: false,
362
302
  directions: DEFAULT_DIRECTIONS,
@@ -372,14 +312,12 @@ _defineProperty(Popup, "defaultProps", {
372
312
  autoFocusFirst: false,
373
313
  legacy: false
374
314
  });
375
-
376
315
  _defineProperty(Popup, "PopupProps", {
377
316
  Directions,
378
317
  Dimension,
379
318
  MinWidth,
380
319
  MaxHeight
381
320
  });
382
-
383
321
  Popup.propTypes = {
384
322
  anchorElement: PropTypes.instanceOf(Node),
385
323
  target: PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(Element)]),
@@ -10,13 +10,11 @@ function getScrollingCoordinates(container) {
10
10
  left: container.scrollLeft
11
11
  };
12
12
  }
13
-
14
13
  return {
15
14
  top: getDocumentScrollTop(),
16
15
  left: getDocumentScrollLeft()
17
16
  };
18
17
  }
19
-
20
18
  function getPositionStyles(popup, anchorRect, anchorLeft, anchorTop, offset) {
21
19
  const popupWidth = popup.offsetWidth;
22
20
  const popupHeight = popup.offsetHeight;
@@ -79,7 +77,6 @@ function getPositionStyles(popup, anchorRect, anchorLeft, anchorTop, offset) {
79
77
  }
80
78
  };
81
79
  }
82
-
83
80
  function verticalOverflow(styles, scrollingCoordinates, attrs) {
84
81
  const containerHeight = attrs.container !== null ? attrs.container.clientHeight : getWindowHeight();
85
82
  const viewportMinX = scrollingCoordinates.top + attrs.sidePadding;
@@ -90,7 +87,6 @@ function verticalOverflow(styles, scrollingCoordinates, attrs) {
90
87
  const bottomOverflow = Math.max(verticalDiff, 0);
91
88
  return topOverflow + bottomOverflow;
92
89
  }
93
-
94
90
  function horizontalOverflow(styles, scrollingCoordinates, attrs) {
95
91
  const containerWidth = attrs.container !== null ? attrs.container.clientWidth : window.innerWidth;
96
92
  const viewportMinY = scrollingCoordinates.left + attrs.sidePadding;
@@ -101,13 +97,11 @@ function horizontalOverflow(styles, scrollingCoordinates, attrs) {
101
97
  const rightOverflow = Math.max(horizontalDiff, 0);
102
98
  return leftOverflow + rightOverflow;
103
99
  }
104
-
105
100
  const positionPropKeys = ['directions', 'autoPositioning', 'autoCorrectTopOverflow', 'sidePadding', 'top', 'left', 'offset', 'maxHeight', 'minWidth'];
106
101
  const defaultcontainerRect = {
107
102
  top: 0,
108
103
  left: 0
109
104
  };
110
-
111
105
  function handleTopOffScreen(_ref) {
112
106
  let {
113
107
  sidePadding,
@@ -127,59 +121,49 @@ function handleTopOffScreen(_ref) {
127
121
  LEFT_TOP
128
122
  } = Directions;
129
123
  const openedToTop = direction != null && [TOP_LEFT, TOP_RIGHT, TOP_CENTER, RIGHT_TOP, LEFT_TOP].includes(direction);
130
-
131
124
  if (!openedToTop) {
132
125
  return styles;
133
126
  }
134
-
135
127
  const isAttachedToAnchorTop = direction != null && [TOP_LEFT, TOP_CENTER, TOP_RIGHT].includes(direction);
136
128
  const attachingPointY = isAttachedToAnchorTop ? anchorRect.top : anchorRect.bottom;
137
129
  const effectiveHeight = maxHeight && typeof maxHeight === 'number' ? Math.min(popupScrollHeight, maxHeight) : popupScrollHeight;
138
130
  const hypotheticalTop = attachingPointY - effectiveHeight;
139
-
140
131
  if (hypotheticalTop <= sidePadding) {
141
132
  styles.top = sidePadding + scroll.top;
142
133
  styles.maxHeight = attachingPointY - sidePadding + BORDER_COMPENSATION;
143
134
  }
144
-
145
135
  return styles;
146
136
  }
147
-
148
137
  function maxHeightForDirection(direction, anchorNode, containerNode) {
149
138
  const container = containerNode || document.documentElement;
150
139
  const domRect = anchorNode.getBoundingClientRect();
151
140
  const containerRect = container.getBoundingClientRect();
152
141
  const topMaxHeight = Math.max(domRect.top - containerRect.top, 0);
153
- const containerHeight = Math.max(containerRect.height, // XXX
142
+ const containerHeight = Math.max(containerRect.height,
143
+ // XXX
154
144
  // If container is the document element
155
145
  // then we check client height too because we may have situation when
156
146
  // "height" from "getBoundingClientRect" less then "clientHeight".
157
147
  container === document.documentElement ? container.clientHeight : 0);
158
148
  const bottomMaxHeight = Math.max(containerHeight - (topMaxHeight + domRect.height), 0);
159
-
160
149
  switch (direction) {
161
150
  case Directions.TOP_LEFT:
162
151
  case Directions.TOP_CENTER:
163
152
  case Directions.TOP_RIGHT:
164
153
  return topMaxHeight;
165
-
166
154
  case Directions.BOTTOM_LEFT:
167
155
  case Directions.BOTTOM_CENTER:
168
156
  case Directions.BOTTOM_RIGHT:
169
157
  return bottomMaxHeight;
170
-
171
158
  case Directions.LEFT_BOTTOM:
172
159
  case Directions.RIGHT_BOTTOM:
173
160
  return domRect.height + bottomMaxHeight;
174
-
175
161
  case Directions.LEFT_TOP:
176
162
  case Directions.RIGHT_TOP:
177
163
  return domRect.height + topMaxHeight;
178
-
179
164
  case Directions.RIGHT_CENTER:
180
165
  case Directions.LEFT_CENTER:
181
166
  return domRect.height / 2 + Math.min(bottomMaxHeight / 2, topMaxHeight / 2);
182
-
183
167
  default:
184
168
  return null;
185
169
  }
@@ -210,18 +194,18 @@ function position(attrs) {
210
194
  const scroll = getScrollingCoordinates(container);
211
195
  const anchorLeft = anchorRect.left + scroll.left + left - containerRect.left;
212
196
  const anchorTop = anchorRect.top + scroll.top + top - containerRect.top;
213
-
214
197
  if (popup) {
215
- const overflowAttrs = { ...attrs,
198
+ const overflowAttrs = {
199
+ ...attrs,
216
200
  popup
217
201
  };
218
202
  const directionsMatrix = getPositionStyles(popup, anchorRect, anchorLeft, anchorTop, offset);
219
-
220
203
  if (!autoPositioning || directions.length === 1) {
221
204
  styles = directionsMatrix[directions[0]];
222
205
  chosenDirection = directions[0];
223
206
  } else {
224
- const sortedByIncreasingOverflow = directions. // Fall back to the first option
207
+ const sortedByIncreasingOverflow = directions.
208
+ // Fall back to the first option
225
209
  concat(directions[0]).filter(direction => directionsMatrix[direction]).map(direction => ({
226
210
  styles: directionsMatrix[direction],
227
211
  direction
@@ -238,26 +222,22 @@ function position(attrs) {
238
222
  });
239
223
  styles = sortedByIncreasingOverflow[0].styles;
240
224
  chosenDirection = sortedByIncreasingOverflow[0].direction;
241
- } // because of the anchor negative margin top and left also may become negative
242
-
243
-
225
+ }
226
+ // because of the anchor negative margin top and left also may become negative
244
227
  ['left', 'top'].forEach(key => {
245
228
  if (styles[key] < 0) {
246
229
  styles[key] = 0;
247
230
  }
248
231
  });
249
232
  }
250
-
251
233
  if (maxHeight === MaxHeight.SCREEN || maxHeight === 'screen') {
252
234
  // this feature works properly only when direction is BOTTOM_* or *_BOTTOM
253
235
  styles.maxHeight = window.innerHeight + scroll.top - styles.top - Dimension.MARGIN;
254
236
  } else if (maxHeight) {
255
237
  styles.maxHeight = maxHeight;
256
238
  }
257
-
258
239
  if (autoCorrectTopOverflow) {
259
240
  var _popup$scrollHeight;
260
-
261
241
  styles = handleTopOffScreen({
262
242
  sidePadding,
263
243
  styles,
@@ -268,13 +248,11 @@ function position(attrs) {
268
248
  scroll
269
249
  });
270
250
  }
271
-
272
251
  if (minWidth === MinWidth.TARGET || minWidth === 'target') {
273
252
  styles.minWidth = anchorRect.width;
274
253
  } else if (minWidth) {
275
254
  styles.minWidth = anchorRect.width < minWidth ? minWidth : anchorRect.width;
276
255
  }
277
-
278
256
  return {
279
257
  styles,
280
258
  direction: chosenDirection
@@ -58,26 +58,20 @@ const {
58
58
  /**
59
59
  * @name Popup Menu
60
60
  */
61
-
62
61
  class PopupMenu extends Popup {
63
62
  constructor() {
64
63
  super(...arguments);
65
-
66
64
  _defineProperty(this, "onSelect", (item, event) => {
67
65
  if (this.props.closeOnSelect) {
68
66
  this._onCloseAttempt(event);
69
67
  }
70
-
71
68
  this.props.onSelect(item, event);
72
69
  });
73
-
74
70
  _defineProperty(this, "list", void 0);
75
-
76
71
  _defineProperty(this, "listRef", el => {
77
72
  this.list = el;
78
73
  });
79
74
  }
80
-
81
75
  /** @override */
82
76
  getInternalContent() {
83
77
  const {
@@ -92,20 +86,17 @@ class PopupMenu extends Popup {
92
86
  onSelect: this.onSelect
93
87
  })));
94
88
  }
95
-
96
89
  }
97
-
98
90
  _defineProperty(PopupMenu, "isItemType", List.isItemType);
99
-
100
91
  _defineProperty(PopupMenu, "ListProps", List.ListProps);
101
-
102
- _defineProperty(PopupMenu, "defaultProps", { ...List.defaultProps,
92
+ _defineProperty(PopupMenu, "defaultProps", {
93
+ ...List.defaultProps,
103
94
  ...Popup.defaultProps,
104
95
  renderOptimization: false,
105
96
  closeOnSelect: false
106
97
  });
107
-
108
- PopupMenu.propTypes = { ...popupPropTypes,
98
+ PopupMenu.propTypes = {
99
+ ...popupPropTypes,
109
100
  ...List.propTypes,
110
101
  closeOnSelect: PropTypes.bool
111
102
  };
@@ -8,24 +8,18 @@ var modules_fb7af416 = {"dark":"dark_rui_eb55","unit":"8px","progressBar":"progr
8
8
  /**
9
9
  * @name Progress Bar
10
10
  */
11
-
12
11
  class ProgressBar extends PureComponent {
13
12
  constructor() {
14
13
  super(...arguments);
15
-
16
14
  _defineProperty(this, "progressbarWrapper", void 0);
17
-
18
15
  _defineProperty(this, "progressbarWrapperRef", el => {
19
16
  this.progressbarWrapper = el;
20
17
  });
21
-
22
18
  _defineProperty(this, "progressbar", void 0);
23
-
24
19
  _defineProperty(this, "progressbarRef", el => {
25
20
  this.progressbar = el;
26
21
  });
27
22
  }
28
-
29
23
  /**
30
24
  * @param {number} value The progress task value
31
25
  * @param {number} max The maximum value
@@ -37,7 +31,6 @@ class ProgressBar extends PureComponent {
37
31
  const percents = value * HUNDRED_PERCENT / max;
38
32
  return percents > HUNDRED_PERCENT ? HUNDRED_PERCENT : percents;
39
33
  }
40
-
41
34
  render() {
42
35
  const {
43
36
  className,
@@ -67,12 +60,9 @@ class ProgressBar extends PureComponent {
67
60
  }
68
61
  }));
69
62
  }
70
-
71
63
  }
72
-
73
64
  _defineProperty(ProgressBar, "propTypes", {
74
65
  label: PropTypes.string,
75
-
76
66
  /**
77
67
  * Sets the ring-progress-bar_global class to position the progress bar on top of the screen.
78
68
  * Should be placed directly inside body, will be positioned right below .ring-header
@@ -80,28 +70,24 @@ _defineProperty(ProgressBar, "propTypes", {
80
70
  * @type {boolean}
81
71
  */
82
72
  global: PropTypes.bool,
83
-
84
73
  /**
85
74
  * Custom class
86
75
  * @type {string}
87
76
  */
88
77
  className: PropTypes.string,
89
78
  style: PropTypes.object,
90
-
91
79
  /**
92
80
  * A floating point number that specifies minimum completion rate for a task to be considered
93
81
  * complete. Default value is 1.0.
94
82
  * @type {number}
95
83
  */
96
84
  max: PropTypes.number,
97
-
98
85
  /**
99
86
  * A floating point number that specifies current task completion rate.
100
87
  * @type {number}
101
88
  */
102
89
  value: PropTypes.number
103
90
  });
104
-
105
91
  _defineProperty(ProgressBar, "defaultProps", {
106
92
  max: 1.0,
107
93
  value: 0,
@@ -18,7 +18,6 @@ import 'react';
18
18
 
19
19
  const angularModule = angular.module('Ring.promised-click', []);
20
20
  const DEFAULT_MODE = 'active';
21
-
22
21
  class PromisedClickController extends RingAngularComponent {
23
22
  constructor() {
24
23
  super(...arguments);
@@ -30,20 +29,16 @@ class PromisedClickController extends RingAngularComponent {
30
29
  } = this.$inject;
31
30
  this.element = $element[0];
32
31
  this.active = false;
33
-
34
32
  if ($attrs.rgPromisedClick) {
35
33
  this.onClick(e => $parse($attrs.rgPromisedClick)($scope, {
36
34
  event: e
37
35
  }));
38
36
  }
39
-
40
37
  let currentMode = null;
41
-
42
38
  this.toggleActive = enable => {
43
39
  if (currentMode === 'loader') {
44
40
  applyMethodToClasses(enable ? 'add' : 'remove')(this.element.classList, modules_e81895c9.loader);
45
41
  const loaderNode = this.element.querySelector(LOADER_BACKGROUND_SELECTOR);
46
-
47
42
  if (loaderNode) {
48
43
  applyMethodToClasses(enable ? 'add' : 'remove')(this.element.querySelector(LOADER_BACKGROUND_SELECTOR).classList, modules_e81895c9.loaderBackground);
49
44
  }
@@ -51,13 +46,10 @@ class PromisedClickController extends RingAngularComponent {
51
46
  applyMethodToClasses(enable ? 'add' : 'remove')(this.element.classList, modules_e81895c9.active);
52
47
  }
53
48
  };
54
-
55
49
  const setModeParams = mode => {
56
50
  currentMode = mode;
57
51
  };
58
-
59
52
  setModeParams($attrs.promisedMode || DEFAULT_MODE);
60
-
61
53
  if ($attrs.promisedMode && $attrs.promisedMode.indexOf('{{') !== -1) {
62
54
  $attrs.$observe('promisedMode', newMode => {
63
55
  if (newMode !== currentMode) {
@@ -67,7 +59,6 @@ class PromisedClickController extends RingAngularComponent {
67
59
  });
68
60
  }
69
61
  }
70
-
71
62
  onClick(callback) {
72
63
  this.element.addEventListener('click', e => {
73
64
  if (this.active) {
@@ -77,49 +68,39 @@ class PromisedClickController extends RingAngularComponent {
77
68
  }
78
69
  });
79
70
  }
80
-
81
71
  process(callback, e) {
82
72
  const {
83
73
  $scope
84
74
  } = this.$inject;
85
75
  this.promise = callback(e);
86
-
87
76
  if (this.promise) {
88
77
  this.activate();
89
- } // Do not use $evalAsync here. This code should be invoked in the same animation frame
90
- // otherwise a button may be "pressed" twice – by click and with class change.
91
-
78
+ }
92
79
 
80
+ // Do not use $evalAsync here. This code should be invoked in the same animation frame
81
+ // otherwise a button may be "pressed" twice – by click and with class change.
93
82
  if (!$scope.$root.$$phase) {
94
83
  // eslint-disable-line angular/no-private-call
95
84
  $scope.$apply();
96
85
  }
97
86
  }
98
-
99
87
  activate() {
100
88
  this.active = true;
101
89
  this.toggleActive(true);
102
-
103
90
  const done = () => {
104
91
  this.active = false;
105
92
  this.toggleActive(false);
106
93
  };
107
-
108
94
  this.promise.then(done, done);
109
95
  }
110
-
111
96
  }
112
-
113
97
  PromisedClickController.$inject = [];
114
-
115
98
  _defineProperty(PromisedClickController, "$inject", ['$scope', '$element', '$attrs', '$parse']);
116
-
117
99
  function rgPromisedClickDirective() {
118
100
  return {
119
101
  controller: PromisedClickController
120
102
  };
121
103
  }
122
-
123
104
  angularModule.directive('rgPromisedClick', rgPromisedClickDirective);
124
105
  var PromisedClick = angularModule.name;
125
106