@jetbrains/ring-ui-built 6.0.32 → 6.0.33

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 (224) hide show
  1. package/components/_helpers/_rollupPluginBabelHelpers.js +567 -1
  2. package/components/_helpers/anchor.js +6 -7
  3. package/components/_helpers/button__classes.js +14 -16
  4. package/components/_helpers/caption.js +20 -14
  5. package/components/_helpers/card.js +105 -95
  6. package/components/_helpers/dialog__body-scroll-preventer.js +19 -11
  7. package/components/_helpers/icon__svg.js +25 -22
  8. package/components/_helpers/input.js +177 -146
  9. package/components/_helpers/query-assist__suggestions.js +90 -74
  10. package/components/_helpers/select__filter.js +69 -48
  11. package/components/_helpers/services-link.js +37 -29
  12. package/components/_helpers/sidebar.js +107 -99
  13. package/components/_helpers/tab-link.js +7 -7
  14. package/components/_helpers/theme.js +40 -31
  15. package/components/_helpers/title.js +72 -57
  16. package/components/alert/alert.js +202 -150
  17. package/components/alert/container.js +41 -32
  18. package/components/alert-service/alert-service.js +170 -105
  19. package/components/analytics/analytics.js +22 -12
  20. package/components/analytics/analytics__custom-plugin.js +75 -54
  21. package/components/auth/auth.js +36 -4
  22. package/components/auth/auth__core.js +1471 -746
  23. package/components/auth/background-flow.js +127 -87
  24. package/components/auth/down-notification.js +73 -30
  25. package/components/auth/iframe-flow.js +133 -75
  26. package/components/auth/request-builder.js +82 -46
  27. package/components/auth/response-parser.js +116 -86
  28. package/components/auth/storage.js +334 -171
  29. package/components/auth/token-validator.js +242 -137
  30. package/components/auth/window-flow.js +134 -92
  31. package/components/auth-dialog/auth-dialog.js +172 -114
  32. package/components/auth-dialog-service/auth-dialog-service.js +31 -8
  33. package/components/avatar/avatar-example-datauri.js +1 -23
  34. package/components/avatar/avatar.js +152 -119
  35. package/components/avatar/fallback-avatar.js +38 -22
  36. package/components/badge/badge.js +45 -35
  37. package/components/button/button.js +107 -86
  38. package/components/button-group/button-group.js +33 -19
  39. package/components/button-set/button-set.js +32 -20
  40. package/components/button-toolbar/button-toolbar.js +31 -19
  41. package/components/caret/caret.js +220 -186
  42. package/components/checkbox/checkbox.js +101 -76
  43. package/components/clipboard/clipboard-fallback.js +10 -10
  44. package/components/clipboard/clipboard.js +132 -35
  45. package/components/code/code.js +166 -92
  46. package/components/collapse/collapse-content.js +64 -42
  47. package/components/collapse/collapse-context.js +2 -2
  48. package/components/collapse/collapse-control.js +14 -12
  49. package/components/collapse/collapse.js +17 -11
  50. package/components/collapse/consts.js +4 -4
  51. package/components/collapse/utils.js +3 -1
  52. package/components/confirm/confirm.js +104 -66
  53. package/components/confirm-service/confirm-service.js +59 -37
  54. package/components/content-layout/content-layout.js +64 -43
  55. package/components/content-layout/sidebar.js +1 -0
  56. package/components/contenteditable/contenteditable.js +59 -50
  57. package/components/control-label/control-label.js +9 -9
  58. package/components/data-list/data-list.js +182 -129
  59. package/components/data-list/data-list.mock.js +6 -2
  60. package/components/data-list/item.js +170 -143
  61. package/components/data-list/selection.js +136 -76
  62. package/components/data-list/title.js +12 -1
  63. package/components/date-picker/consts.js +26 -19
  64. package/components/date-picker/date-input.js +144 -113
  65. package/components/date-picker/date-picker.js +282 -227
  66. package/components/date-picker/date-popup.js +395 -350
  67. package/components/date-picker/day.js +116 -87
  68. package/components/date-picker/month-names.js +66 -43
  69. package/components/date-picker/month-slider.js +76 -51
  70. package/components/date-picker/month.js +25 -16
  71. package/components/date-picker/months.js +50 -43
  72. package/components/date-picker/weekdays.js +22 -12
  73. package/components/date-picker/years.js +110 -83
  74. package/components/dialog/dialog.js +190 -142
  75. package/components/dialog/dialog__body-scroll-preventer.js +4 -0
  76. package/components/dropdown/anchor.js +9 -0
  77. package/components/dropdown/dropdown.js +213 -182
  78. package/components/dropdown-menu/dropdown-menu.js +97 -71
  79. package/components/editable-heading/editable-heading.js +127 -75
  80. package/components/error-bubble/error-bubble.js +60 -31
  81. package/components/error-message/error-message.js +59 -39
  82. package/components/footer/footer.js +30 -27
  83. package/components/global/compose.js +10 -1
  84. package/components/global/composeRefs.js +12 -7
  85. package/components/global/controls-height.js +2 -2
  86. package/components/global/create-stateful-context.js +15 -15
  87. package/components/global/data-tests.js +14 -6
  88. package/components/global/dom.js +86 -47
  89. package/components/global/focus-sensor-hoc.js +132 -122
  90. package/components/global/fuzzy-highlight.js +36 -22
  91. package/components/global/get-event-key.js +8 -8
  92. package/components/global/get-uid.js +8 -4
  93. package/components/global/inject-styles.js +15 -10
  94. package/components/global/listeners.js +51 -27
  95. package/components/global/memoize.js +12 -6
  96. package/components/global/normalize-indent.js +50 -19
  97. package/components/global/promise-with-timeout.js +8 -6
  98. package/components/global/prop-types.js +5 -3
  99. package/components/global/react-dom-renderer.js +44 -28
  100. package/components/global/react-render-adapter.js +1 -1
  101. package/components/global/rerender-hoc.js +30 -12
  102. package/components/global/schedule-raf.js +6 -5
  103. package/components/global/sniffer.js +1 -1
  104. package/components/global/theme.js +22 -0
  105. package/components/global/trivial-template-tag.js +10 -3
  106. package/components/global/typescript-utils.js +6 -2
  107. package/components/global/url.js +26 -20
  108. package/components/global/use-event-callback.js +4 -6
  109. package/components/grid/col.js +52 -35
  110. package/components/grid/grid.js +31 -17
  111. package/components/grid/row.js +47 -35
  112. package/components/group/group.js +25 -17
  113. package/components/header/header.js +78 -33
  114. package/components/header/logo.js +36 -20
  115. package/components/header/profile.js +199 -166
  116. package/components/header/services-link.js +4 -0
  117. package/components/header/services.js +116 -73
  118. package/components/header/smart-profile.js +203 -111
  119. package/components/header/smart-services.js +113 -62
  120. package/components/header/tray-icon.js +37 -21
  121. package/components/header/tray.js +32 -21
  122. package/components/heading/heading.js +25 -24
  123. package/components/http/http.js +353 -203
  124. package/components/http/http.mock.js +101 -49
  125. package/components/hub-source/hub-source.js +190 -83
  126. package/components/hub-source/hub-source__user.js +44 -11
  127. package/components/hub-source/hub-source__users-groups.js +65 -37
  128. package/components/i18n/i18n-context.js +10 -7
  129. package/components/i18n/i18n.js +10 -7
  130. package/components/icon/icon.js +93 -76
  131. package/components/icon/icon__svg.js +8 -0
  132. package/components/icon/index.js +8 -0
  133. package/components/input/input.js +13 -0
  134. package/components/island/adaptive-island-hoc.js +43 -30
  135. package/components/island/content.js +132 -115
  136. package/components/island/header.js +70 -57
  137. package/components/island/island.js +40 -28
  138. package/components/island-legacy/content-legacy.js +25 -17
  139. package/components/island-legacy/header-legacy.js +27 -19
  140. package/components/island-legacy/island-legacy.js +25 -17
  141. package/components/link/clickableLink.js +59 -44
  142. package/components/link/link.js +68 -57
  143. package/components/list/consts.js +2 -2
  144. package/components/list/list.js +698 -611
  145. package/components/list/list__custom.js +62 -44
  146. package/components/list/list__hint.js +19 -10
  147. package/components/list/list__item.js +174 -133
  148. package/components/list/list__link.js +50 -37
  149. package/components/list/list__separator.js +24 -14
  150. package/components/list/list__title.js +32 -22
  151. package/components/list/list__users-groups-source.js +126 -54
  152. package/components/loader/loader.js +74 -43
  153. package/components/loader/loader__core.js +263 -198
  154. package/components/loader-inline/loader-inline.js +35 -23
  155. package/components/loader-screen/loader-screen.js +46 -25
  156. package/components/login-dialog/login-dialog.js +158 -111
  157. package/components/login-dialog/service.js +34 -8
  158. package/components/markdown/markdown.js +23 -15
  159. package/components/message/message.js +203 -161
  160. package/components/old-browsers-message/old-browsers-message.js +18 -11
  161. package/components/old-browsers-message/old-browsers-message__stop.js +7 -0
  162. package/components/old-browsers-message/white-list.js +16 -8
  163. package/components/pager/pager.js +271 -212
  164. package/components/panel/panel.js +25 -17
  165. package/components/permissions/permissions.js +172 -127
  166. package/components/permissions/permissions__cache.js +224 -194
  167. package/components/popup/popup.consts.js +1 -1
  168. package/components/popup/popup.js +343 -284
  169. package/components/popup/popup.target.js +8 -9
  170. package/components/popup/position.js +106 -96
  171. package/components/popup-menu/popup-menu.js +81 -44
  172. package/components/progress-bar/progress-bar.js +104 -87
  173. package/components/query-assist/query-assist.js +916 -838
  174. package/components/query-assist/query-assist__suggestions.js +30 -1
  175. package/components/radio/radio.js +34 -19
  176. package/components/radio/radio__item.js +69 -52
  177. package/components/select/select.js +957 -852
  178. package/components/select/select__filter.js +30 -0
  179. package/components/select/select__popup.js +487 -373
  180. package/components/shortcuts/core.js +217 -166
  181. package/components/shortcuts/shortcut-title.js +11 -6
  182. package/components/shortcuts/shortcuts-hoc.js +45 -19
  183. package/components/shortcuts/shortcuts.js +75 -50
  184. package/components/slider/slider.js +122 -99
  185. package/components/slider/slider.utils.js +24 -14
  186. package/components/storage/storage.js +33 -4
  187. package/components/storage/storage__fallback.js +224 -149
  188. package/components/storage/storage__local.js +153 -90
  189. package/components/tab-trap/tab-trap.js +153 -122
  190. package/components/table/cell.js +26 -14
  191. package/components/table/disable-hover-hoc.js +51 -33
  192. package/components/table/header-cell.js +89 -64
  193. package/components/table/header.js +132 -104
  194. package/components/table/multitable.js +125 -107
  195. package/components/table/row-with-focus-sensor.js +69 -25
  196. package/components/table/row.js +216 -175
  197. package/components/table/selection-adapter.js +3 -1
  198. package/components/table/selection-shortcuts-hoc.js +181 -180
  199. package/components/table/selection.js +226 -156
  200. package/components/table/smart-table.js +88 -50
  201. package/components/table/table.js +358 -289
  202. package/components/tabs/collapsible-more.js +79 -46
  203. package/components/tabs/collapsible-tab.js +38 -31
  204. package/components/tabs/collapsible-tabs.js +153 -88
  205. package/components/tabs/custom-item.js +2 -4
  206. package/components/tabs/dumb-tabs.js +117 -74
  207. package/components/tabs/smart-tabs.js +69 -29
  208. package/components/tabs/tab-link.js +5 -1
  209. package/components/tabs/tab.js +31 -19
  210. package/components/tabs/tabs.js +31 -0
  211. package/components/tag/tag.js +173 -133
  212. package/components/tags-input/tags-input.js +427 -329
  213. package/components/tags-list/tags-list.js +78 -57
  214. package/components/text/text.js +39 -28
  215. package/components/toggle/toggle.js +70 -56
  216. package/components/tooltip/tooltip.js +190 -146
  217. package/components/user-agreement/service.js +371 -228
  218. package/components/user-agreement/toolbox.eula.js +1 -160
  219. package/components/user-agreement/user-agreement.js +120 -85
  220. package/components/user-card/card.js +29 -0
  221. package/components/user-card/smart-user-card-tooltip.js +111 -51
  222. package/components/user-card/tooltip.js +84 -47
  223. package/components/user-card/user-card.js +29 -0
  224. package/package.json +1 -1
@@ -1,3 +1,5 @@
1
+ import { _ as _defineProperty, a as _inherits, b as _createClass, f as _classCallCheck, g as _callSuper } from './_rollupPluginBabelHelpers.js';
2
+ import 'core-js/modules/es.array.concat.js';
1
3
  import React, { PureComponent } from 'react';
2
4
  import PropTypes from 'prop-types';
3
5
  import classNames from 'classnames';
@@ -8,66 +10,79 @@ import { refObject } from '../global/prop-types.js';
8
10
 
9
11
  var modules_09d014b4 = {"height":"i__const_height_0","compensate":"i__const_compensate_1","light":"light_rui_2ac4","dataListWrapper":"dataListWrapper_rui_be4b","dataList":"dataList_rui_be4b","itemContent":"itemContent_rui_be4b","title":"title_rui_be4b","disabledHover":"disabledHover_rui_be4b","titleSelected":"titleSelected_rui_be4b","titleFocused":"titleFocused_rui_be4b","showMore":"showMore_rui_be4b","boxes":"boxes_rui_be4b","checkboxBox":"checkboxBox_rui_be4b","collapseButton":"collapseButton_rui_be4b","collapseIcon":"collapseIcon_rui_be4b","loadingOverlay":"loadingOverlay_rui_be4b","showMoreLoader":"showMoreLoader_rui_be4b"};
10
12
 
11
- class Title extends PureComponent {
12
- static defaultProps = {
13
- selectable: false,
14
- selected: false,
15
- showFocus: false
16
- };
17
- id = getUID('data-list-title');
18
- onCheckboxFocus = () => {
19
- this.props.onFocusRestore();
20
- };
21
- onCheckboxChange = () => {
22
- this.toggleSelection();
23
- };
24
- toggleSelection() {
25
- const {
26
- selectable,
27
- selected,
28
- onSelect
29
- } = this.props;
30
- if (selectable) {
31
- onSelect(!selected);
13
+ var Title = /*#__PURE__*/function (_PureComponent) {
14
+ function Title() {
15
+ var _this;
16
+ _classCallCheck(this, Title);
17
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
18
+ args[_key] = arguments[_key];
32
19
  }
33
- }
34
- render() {
35
- const {
36
- className,
37
- title,
38
- offset,
39
- showFocus,
40
- innerRef,
41
- selectable,
42
- selected,
43
- collapserExpander
44
- } = this.props;
45
- const classes = classNames(className, {
46
- [modules_09d014b4.title]: true,
47
- [modules_09d014b4.titleFocused]: showFocus,
48
- [modules_09d014b4.titleSelected]: selected
20
+ _this = _callSuper(this, Title, [].concat(args));
21
+ _defineProperty(_this, "id", getUID('data-list-title'));
22
+ _defineProperty(_this, "onCheckboxFocus", function () {
23
+ _this.props.onFocusRestore();
24
+ });
25
+ _defineProperty(_this, "onCheckboxChange", function () {
26
+ _this.toggleSelection();
49
27
  });
50
- return /*#__PURE__*/React.createElement("div", {
51
- id: this.id,
52
- className: classes,
53
- style: {
54
- paddingLeft: offset
55
- },
56
- ref: innerRef
57
- }, /*#__PURE__*/React.createElement("div", {
58
- className: modules_09d014b4.boxes
59
- }, selectable && /*#__PURE__*/React.createElement("div", {
60
- className: modules_09d014b4.checkboxBox
61
- }, /*#__PURE__*/React.createElement(Checkbox, {
62
- "aria-labelledby": this.id,
63
- className: showFocus ? 'ring-checkbox_focus' : '',
64
- checked: selected,
65
- onFocus: this.onCheckboxFocus,
66
- onChange: this.onCheckboxChange,
67
- tabIndex: -1
68
- })), collapserExpander), title);
28
+ return _this;
69
29
  }
70
- }
30
+ _inherits(Title, _PureComponent);
31
+ return _createClass(Title, [{
32
+ key: "toggleSelection",
33
+ value: function toggleSelection() {
34
+ var _this$props = this.props,
35
+ selectable = _this$props.selectable,
36
+ selected = _this$props.selected,
37
+ onSelect = _this$props.onSelect;
38
+ if (selectable) {
39
+ onSelect(!selected);
40
+ }
41
+ }
42
+ }, {
43
+ key: "render",
44
+ value: function render() {
45
+ var _this$props2 = this.props,
46
+ className = _this$props2.className,
47
+ title = _this$props2.title,
48
+ offset = _this$props2.offset,
49
+ showFocus = _this$props2.showFocus,
50
+ innerRef = _this$props2.innerRef,
51
+ selectable = _this$props2.selectable,
52
+ selected = _this$props2.selected,
53
+ collapserExpander = _this$props2.collapserExpander;
54
+ var classes = classNames(className, {
55
+ [modules_09d014b4.title]: true,
56
+ [modules_09d014b4.titleFocused]: showFocus,
57
+ [modules_09d014b4.titleSelected]: selected
58
+ });
59
+ return /*#__PURE__*/React.createElement("div", {
60
+ id: this.id,
61
+ className: classes,
62
+ style: {
63
+ paddingLeft: offset
64
+ },
65
+ ref: innerRef
66
+ }, /*#__PURE__*/React.createElement("div", {
67
+ className: modules_09d014b4.boxes
68
+ }, selectable && /*#__PURE__*/React.createElement("div", {
69
+ className: modules_09d014b4.checkboxBox
70
+ }, /*#__PURE__*/React.createElement(Checkbox, {
71
+ "aria-labelledby": this.id,
72
+ className: showFocus ? 'ring-checkbox_focus' : '',
73
+ checked: selected,
74
+ onFocus: this.onCheckboxFocus,
75
+ onChange: this.onCheckboxChange,
76
+ tabIndex: -1
77
+ })), collapserExpander), title);
78
+ }
79
+ }]);
80
+ }(PureComponent);
81
+ _defineProperty(Title, "defaultProps", {
82
+ selectable: false,
83
+ selected: false,
84
+ showFocus: false
85
+ });
71
86
  Title.propTypes = {
72
87
  className: PropTypes.string,
73
88
  title: PropTypes.node,
@@ -1,3 +1,6 @@
1
+ import { _ as _defineProperty, a as _inherits, b as _createClass, f as _classCallCheck, g as _callSuper } from '../_helpers/_rollupPluginBabelHelpers.js';
2
+ import 'core-js/modules/es.array.concat.js';
3
+ import 'core-js/modules/es.object.values.js';
1
4
  import React, { PureComponent } from 'react';
2
5
  import classNames from 'classnames';
3
6
  import PropTypes from 'prop-types';
@@ -13,10 +16,24 @@ import { Button } from '../button/button.js';
13
16
  import { T as Theme, a as ThemeProvider } from '../_helpers/theme.js';
14
17
  export { default as Container } from './container.js';
15
18
  import { Color } from '../icon/icon__constants.js';
16
- import '../_helpers/_rollupPluginBabelHelpers.js';
17
19
  import 'util-deprecate';
18
20
  import '../_helpers/icon__svg.js';
21
+ import 'core-js/modules/es.regexp.exec.js';
22
+ import 'core-js/modules/es.string.replace.js';
23
+ import 'core-js/modules/es.string.starts-with.js';
19
24
  import '../global/memoize.js';
25
+ import 'core-js/modules/es.array.iterator.js';
26
+ import 'core-js/modules/es.map.js';
27
+ import 'core-js/modules/es.object.to-string.js';
28
+ import 'core-js/modules/es.weak-map.js';
29
+ import 'core-js/modules/web.dom-collections.iterator.js';
30
+ import 'core-js/modules/es.array.reduce.js';
31
+ import 'core-js/modules/es.object.entries.js';
32
+ import 'core-js/modules/es.array.filter.js';
33
+ import 'core-js/modules/es.object.assign.js';
34
+ import 'core-js/modules/es.set.js';
35
+ import 'core-js/modules/es.string.split.js';
36
+ import 'core-js/modules/web.dom-collections.for-each.js';
20
37
  import '@jetbrains/icons/chevron-10px';
21
38
  import '../link/clickableLink.js';
22
39
  import '../global/controls-height.js';
@@ -24,20 +41,29 @@ import '../_helpers/button__classes.js';
24
41
  import 'react-dom';
25
42
  import '../popup/popup.target.js';
26
43
  import '../popup/popup.js';
44
+ import 'core-js/modules/es.regexp.to-string.js';
27
45
  import '../global/get-uid.js';
28
46
  import '../global/schedule-raf.js';
29
47
  import '../shortcuts/shortcuts.js';
48
+ import 'core-js/modules/es.array.map.js';
30
49
  import '../shortcuts/core.js';
50
+ import 'core-js/modules/es.array.find-index.js';
51
+ import 'core-js/modules/es.array.includes.js';
52
+ import 'core-js/modules/es.array.slice.js';
53
+ import 'core-js/modules/es.array.splice.js';
54
+ import 'core-js/modules/es.string.includes.js';
55
+ import 'core-js/modules/es.string.match.js';
31
56
  import 'combokeys';
32
57
  import '../global/sniffer.js';
33
58
  import 'sniffr';
34
59
  import '../tab-trap/tab-trap.js';
35
60
  import '../popup/position.js';
61
+ import 'core-js/modules/es.array.sort.js';
36
62
  import '../popup/popup.consts.js';
37
63
 
38
64
  var modules_e02b3280 = {"link":"link_rui_20da","animation-duration":"300ms","animation-easing":"ease-out","light":"light_rui_2ac4","alert":"alert_rui_25ab","alertInline":"alertInline_rui_25ab","error":"error_rui_25ab","icon":"icon_rui_25ab","caption":"caption_rui_25ab","withCloseButton":"withCloseButton_rui_25ab","badge":"badge_rui_25ab","loader":"loader_rui_25ab","close":"close_rui_25ab","animationOpen":"animationOpen_rui_25ab","show":"show_rui_25ab","animationClosing":"animationClosing_rui_25ab","animationShaking":"animationShaking_rui_25ab","shaking":"shaking_rui_25ab"};
39
65
 
40
- const ANIMATION_TIME = 500;
66
+ var ANIMATION_TIME = 500;
41
67
  /**
42
68
  * @name Alert
43
69
  */
@@ -57,7 +83,7 @@ var AlertType;
57
83
  * Lookup table of alert type to icon modifier.
58
84
  * @type {Object.<AlertType, string>}
59
85
  */
60
- const TypeToIcon = {
86
+ var TypeToIcon = {
61
87
  [AlertType.ERROR]: exceptionIcon,
62
88
  [AlertType.SUCCESS]: checkmarkIcon,
63
89
  [AlertType.WARNING]: warningIcon
@@ -66,7 +92,7 @@ const TypeToIcon = {
66
92
  * Lookup table of alert type to icon color.
67
93
  * @type {Object.<AlertType, Icon.Color>}
68
94
  */
69
- const TypeToIconColor = {
95
+ var TypeToIconColor = {
70
96
  [AlertType.ERROR]: Color.RED,
71
97
  [AlertType.SUCCESS]: Color.GREEN,
72
98
  [AlertType.WARNING]: Color.WHITE
@@ -79,162 +105,188 @@ const TypeToIconColor = {
79
105
  /**
80
106
  * **Alert** is a component for displaying contextual notifications. If you want to display a stack of notifications, use **Alerts** instead.
81
107
  */
82
- class Alert extends PureComponent {
83
- static propTypes = {
84
- timeout: PropTypes.number,
108
+ var Alert = /*#__PURE__*/function (_PureComponent) {
109
+ function Alert() {
110
+ var _this;
111
+ _classCallCheck(this, Alert);
112
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
113
+ args[_key] = arguments[_key];
114
+ }
115
+ _this = _callSuper(this, Alert, [].concat(args));
116
+ _defineProperty(_this, "state", {
117
+ height: null
118
+ });
119
+ _defineProperty(_this, "node", void 0);
120
+ _defineProperty(_this, "hideTimeout", void 0);
121
+ _defineProperty(_this, "closeRequest", function (event) {
122
+ _this.startCloseAnimation();
123
+ return _this.props.onCloseRequest(event);
124
+ });
125
+ _defineProperty(_this, "startCloseAnimation", function () {
126
+ var height = getRect(_this.node).height;
127
+ _this.setState({
128
+ height
129
+ });
130
+ });
85
131
  /**
86
- * Fires when alert starts closing if timeout is out or user clicks "Close" button
132
+ * @param {SyntheticEvent} evt
133
+ * @private
87
134
  */
88
- onCloseRequest: PropTypes.func,
89
- onClose: PropTypes.func,
90
- isShaking: PropTypes.bool,
91
- isClosing: PropTypes.bool,
135
+ _defineProperty(_this, "_handleCaptionsLinksClick", function (evt) {
136
+ if (evt.target instanceof Element && evt.target.matches('a')) {
137
+ _this.closeRequest(evt);
138
+ }
139
+ });
140
+ _defineProperty(_this, "storeAlertRef", function (node) {
141
+ _this.node = node;
142
+ });
143
+ return _this;
144
+ }
145
+ _inherits(Alert, _PureComponent);
146
+ return _createClass(Alert, [{
147
+ key: "componentDidMount",
148
+ value: function componentDidMount() {
149
+ if (this.props.timeout > 0) {
150
+ this.hideTimeout = window.setTimeout(this.closeRequest, this.props.timeout);
151
+ }
152
+ }
153
+ }, {
154
+ key: "componentDidUpdate",
155
+ value: function componentDidUpdate() {
156
+ if (this.props.isClosing) {
157
+ this._close();
158
+ }
159
+ }
160
+ }, {
161
+ key: "componentWillUnmount",
162
+ value: function componentWillUnmount() {
163
+ clearTimeout(this.hideTimeout);
164
+ }
165
+ }, {
166
+ key: "_close",
167
+ value: function _close() {
168
+ var _this2 = this;
169
+ this.startCloseAnimation();
170
+ setTimeout(function () {
171
+ _this2.props.onClose();
172
+ }, ANIMATION_TIME);
173
+ }
174
+ }, {
175
+ key: "_getCaption",
176
+ value:
92
177
  /**
93
- * Whether an alert is rendered inside an **Alerts** container
94
- * or standalone.
178
+ * @private
95
179
  */
96
- inline: PropTypes.bool,
97
- showWithAnimation: PropTypes.bool,
98
- closeable: PropTypes.bool,
99
- type: PropTypes.oneOf(Object.values(AlertType)),
100
- children: PropTypes.node,
101
- className: PropTypes.string,
102
- captionClassName: PropTypes.string,
103
- closeButtonClassName: PropTypes.string,
104
- 'data-test': PropTypes.string
105
- };
106
- /** @override */
107
- static defaultProps = {
108
- theme: Theme.DARK,
109
- closeable: true,
110
- showWithAnimation: true,
111
- type: AlertType.MESSAGE,
112
- inline: true,
113
- isClosing: false,
114
- isShaking: false,
115
- timeout: 0,
116
- onClose: () => {},
117
- onCloseRequest: () => {}
118
- };
119
- state = {
120
- height: null
121
- };
122
- componentDidMount() {
123
- if (this.props.timeout > 0) {
124
- this.hideTimeout = window.setTimeout(this.closeRequest, this.props.timeout);
180
+ function _getCaption() {
181
+ return /*#__PURE__*/React.createElement("span", {
182
+ className: classNames(modules_e02b3280.caption, this.props.captionClassName, {
183
+ [modules_e02b3280.withCloseButton]: this.props.closeable
184
+ }),
185
+ onClick: this._handleCaptionsLinksClick
186
+ // We only process clicks on `a` elements, see above
187
+ ,
188
+ role: "presentation"
189
+ }, this.props.children);
125
190
  }
126
- }
127
- componentDidUpdate() {
128
- if (this.props.isClosing) {
129
- this._close();
191
+ /**
192
+ * @private
193
+ * @return {XML|string}
194
+ */
195
+ }, {
196
+ key: "_getIcon",
197
+ value: function _getIcon() {
198
+ var glyph = TypeToIcon[this.props.type];
199
+ if (glyph) {
200
+ return /*#__PURE__*/React.createElement(Icon, {
201
+ glyph: glyph,
202
+ className: modules_e02b3280.icon,
203
+ color: TypeToIconColor[this.props.type] || Color.DEFAULT
204
+ });
205
+ } else if (this.props.type === AlertType.LOADING) {
206
+ return /*#__PURE__*/React.createElement(LoaderInline, {
207
+ className: modules_e02b3280.loader
208
+ });
209
+ }
210
+ return '';
130
211
  }
131
- }
132
- componentWillUnmount() {
133
- clearTimeout(this.hideTimeout);
134
- }
135
- node;
136
- hideTimeout;
137
- static Type = AlertType;
138
- closeRequest = event => {
139
- this.startCloseAnimation();
140
- return this.props.onCloseRequest(event);
141
- };
142
- startCloseAnimation = () => {
143
- const height = getRect(this.node).height;
144
- this.setState({
145
- height
146
- });
147
- };
148
- _close() {
149
- this.startCloseAnimation();
150
- setTimeout(() => {
151
- this.props.onClose();
152
- }, ANIMATION_TIME);
153
- }
154
- /**
155
- * @param {SyntheticEvent} evt
156
- * @private
157
- */
158
- _handleCaptionsLinksClick = evt => {
159
- if (evt.target instanceof Element && evt.target.matches('a')) {
160
- this.closeRequest(evt);
212
+ }, {
213
+ key: "render",
214
+ value: function render() {
215
+ var _this$props = this.props,
216
+ type = _this$props.type,
217
+ inline = _this$props.inline,
218
+ isClosing = _this$props.isClosing,
219
+ isShaking = _this$props.isShaking,
220
+ closeButtonClassName = _this$props.closeButtonClassName,
221
+ showWithAnimation = _this$props.showWithAnimation,
222
+ className = _this$props.className,
223
+ dataTest = _this$props['data-test'],
224
+ theme = _this$props.theme;
225
+ var classes = classNames(className, {
226
+ [modules_e02b3280.alert]: true,
227
+ [modules_e02b3280.animationOpen]: showWithAnimation,
228
+ [modules_e02b3280.error]: type === 'error',
229
+ [modules_e02b3280.alertInline]: inline,
230
+ [modules_e02b3280.animationClosing]: isClosing,
231
+ [modules_e02b3280.animationShaking]: isShaking
232
+ });
233
+ var height = this.state.height;
234
+ var style = height ? {
235
+ marginBottom: -height
236
+ } : undefined;
237
+ return /*#__PURE__*/React.createElement(ThemeProvider, {
238
+ theme: theme,
239
+ className: classes,
240
+ "data-test": joinDataTestAttributes('alert', dataTest),
241
+ "data-test-type": type,
242
+ style: style,
243
+ ref: this.storeAlertRef
244
+ }, this._getIcon(), this._getCaption(), this.props.closeable ? /*#__PURE__*/React.createElement(Button, {
245
+ icon: closeIcon,
246
+ className: classNames(modules_e02b3280.close, closeButtonClassName),
247
+ "data-test": "alert-close",
248
+ "aria-label": "close alert",
249
+ onClick: this.closeRequest
250
+ }) : '');
161
251
  }
162
- };
252
+ }]);
253
+ }(PureComponent);
254
+ _defineProperty(Alert, "propTypes", {
255
+ timeout: PropTypes.number,
163
256
  /**
164
- * @private
257
+ * Fires when alert starts closing if timeout is out or user clicks "Close" button
165
258
  */
166
- _getCaption() {
167
- return /*#__PURE__*/React.createElement("span", {
168
- className: classNames(modules_e02b3280.caption, this.props.captionClassName, {
169
- [modules_e02b3280.withCloseButton]: this.props.closeable
170
- }),
171
- onClick: this._handleCaptionsLinksClick
172
- // We only process clicks on `a` elements, see above
173
- ,
174
- role: "presentation"
175
- }, this.props.children);
176
- }
259
+ onCloseRequest: PropTypes.func,
260
+ onClose: PropTypes.func,
261
+ isShaking: PropTypes.bool,
262
+ isClosing: PropTypes.bool,
177
263
  /**
178
- * @private
179
- * @return {XML|string}
264
+ * Whether an alert is rendered inside an **Alerts** container
265
+ * or standalone.
180
266
  */
181
- _getIcon() {
182
- const glyph = TypeToIcon[this.props.type];
183
- if (glyph) {
184
- return /*#__PURE__*/React.createElement(Icon, {
185
- glyph: glyph,
186
- className: modules_e02b3280.icon,
187
- color: TypeToIconColor[this.props.type] || Color.DEFAULT
188
- });
189
- } else if (this.props.type === AlertType.LOADING) {
190
- return /*#__PURE__*/React.createElement(LoaderInline, {
191
- className: modules_e02b3280.loader
192
- });
193
- }
194
- return '';
195
- }
196
- storeAlertRef = node => {
197
- this.node = node;
198
- };
199
- render() {
200
- const {
201
- type,
202
- inline,
203
- isClosing,
204
- isShaking,
205
- closeButtonClassName,
206
- showWithAnimation,
207
- className,
208
- 'data-test': dataTest,
209
- theme
210
- } = this.props;
211
- const classes = classNames(className, {
212
- [modules_e02b3280.alert]: true,
213
- [modules_e02b3280.animationOpen]: showWithAnimation,
214
- [modules_e02b3280.error]: type === 'error',
215
- [modules_e02b3280.alertInline]: inline,
216
- [modules_e02b3280.animationClosing]: isClosing,
217
- [modules_e02b3280.animationShaking]: isShaking
218
- });
219
- const height = this.state.height;
220
- const style = height ? {
221
- marginBottom: -height
222
- } : undefined;
223
- return /*#__PURE__*/React.createElement(ThemeProvider, {
224
- theme: theme,
225
- className: classes,
226
- "data-test": joinDataTestAttributes('alert', dataTest),
227
- "data-test-type": type,
228
- style: style,
229
- ref: this.storeAlertRef
230
- }, this._getIcon(), this._getCaption(), this.props.closeable ? /*#__PURE__*/React.createElement(Button, {
231
- icon: closeIcon,
232
- className: classNames(modules_e02b3280.close, closeButtonClassName),
233
- "data-test": "alert-close",
234
- "aria-label": "close alert",
235
- onClick: this.closeRequest
236
- }) : '');
237
- }
238
- }
267
+ inline: PropTypes.bool,
268
+ showWithAnimation: PropTypes.bool,
269
+ closeable: PropTypes.bool,
270
+ type: PropTypes.oneOf(Object.values(AlertType)),
271
+ children: PropTypes.node,
272
+ className: PropTypes.string,
273
+ captionClassName: PropTypes.string,
274
+ closeButtonClassName: PropTypes.string,
275
+ 'data-test': PropTypes.string
276
+ });
277
+ /** @override */
278
+ _defineProperty(Alert, "defaultProps", {
279
+ theme: Theme.DARK,
280
+ closeable: true,
281
+ showWithAnimation: true,
282
+ type: AlertType.MESSAGE,
283
+ inline: true,
284
+ isClosing: false,
285
+ isShaking: false,
286
+ timeout: 0,
287
+ onClose: function onClose() {},
288
+ onCloseRequest: function onCloseRequest() {}
289
+ });
290
+ _defineProperty(Alert, "Type", AlertType);
239
291
 
240
292
  export { ANIMATION_TIME, AlertType, Alert as default };
@@ -1,41 +1,50 @@
1
- import { _ as _extends } from '../_helpers/_rollupPluginBabelHelpers.js';
2
- import React, { PureComponent, Children, isValidElement, cloneElement } from 'react';
1
+ import { _ as _defineProperty, a as _inherits, b as _createClass, c as _objectWithoutProperties, e as _extends, f as _classCallCheck, g as _callSuper } from '../_helpers/_rollupPluginBabelHelpers.js';
2
+ import 'core-js/modules/es.array.map.js';
3
+ import React, { Children, isValidElement, cloneElement, PureComponent } from 'react';
3
4
  import { createPortal } from 'react-dom';
4
5
  import classNames from 'classnames';
5
6
  import PropTypes from 'prop-types';
6
7
 
7
8
  var modules_fc8df42d = {"light":"light_rui_2ac4","alertContainer":"alertContainer_rui_971c","alertInContainer":"alertInContainer_rui_971c alert_rui_25ab"};
8
9
 
9
- class Alerts extends PureComponent {
10
- static propTypes = {
11
- children: PropTypes.node,
12
- className: PropTypes.string
13
- };
14
- render() {
15
- const {
16
- children,
17
- className,
18
- ...restProps
19
- } = this.props;
20
- const classes = classNames(modules_fc8df42d.alertContainer, className);
21
- const show = Children.count(children) > 0;
22
- if (!show) {
23
- return null;
24
- }
25
- return /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement("div", _extends({
26
- "data-test": "alert-container",
27
- className: classes,
28
- "aria-live": "polite"
29
- }, restProps), Children.map(children, child => {
30
- if (! /*#__PURE__*/isValidElement(child)) {
31
- return child;
32
- }
33
- const alertClassNames = classNames(modules_fc8df42d.alertInContainer, child.props.className);
34
- return /*#__PURE__*/cloneElement(child, {
35
- className: alertClassNames
36
- });
37
- })), document.body);
10
+ var _excluded = ["children", "className"];
11
+ var Alerts = /*#__PURE__*/function (_PureComponent) {
12
+ function Alerts() {
13
+ _classCallCheck(this, Alerts);
14
+ return _callSuper(this, Alerts, arguments);
38
15
  }
39
- }
16
+ _inherits(Alerts, _PureComponent);
17
+ return _createClass(Alerts, [{
18
+ key: "render",
19
+ value: function render() {
20
+ var _this$props = this.props,
21
+ children = _this$props.children,
22
+ className = _this$props.className,
23
+ restProps = _objectWithoutProperties(_this$props, _excluded);
24
+ var classes = classNames(modules_fc8df42d.alertContainer, className);
25
+ var show = Children.count(children) > 0;
26
+ if (!show) {
27
+ return null;
28
+ }
29
+ return /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement("div", _extends({
30
+ "data-test": "alert-container",
31
+ className: classes,
32
+ "aria-live": "polite"
33
+ }, restProps), Children.map(children, function (child) {
34
+ if (! /*#__PURE__*/isValidElement(child)) {
35
+ return child;
36
+ }
37
+ var alertClassNames = classNames(modules_fc8df42d.alertInContainer, child.props.className);
38
+ return /*#__PURE__*/cloneElement(child, {
39
+ className: alertClassNames
40
+ });
41
+ })), document.body);
42
+ }
43
+ }]);
44
+ }(PureComponent);
45
+ _defineProperty(Alerts, "propTypes", {
46
+ children: PropTypes.node,
47
+ className: PropTypes.string
48
+ });
40
49
 
41
50
  export { Alerts as default };