@jetbrains/ring-ui 4.1.0-beta.3 → 4.1.1

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 (234) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +17 -15
  3. package/babel.config.js +3 -2
  4. package/components/alert/alert.js +9 -3
  5. package/components/alert/alert.test.js +21 -48
  6. package/components/alert/container.css +1 -1
  7. package/components/alert/container.test.js +3 -13
  8. package/components/alert-service/alert-service.examples.css +18 -0
  9. package/components/alert-service/alert-service.examples.js +21 -0
  10. package/components/alert-service/alert-service.js +10 -3
  11. package/components/analytics/analytics__fus-plugin.js +3 -3
  12. package/components/analytics/analytics__ga-plugin.js +2 -2
  13. package/components/auth/auth.test.js +14 -7
  14. package/components/auth/auth__core.js +64 -33
  15. package/components/auth-dialog/auth-dialog.css +2 -3
  16. package/components/auth-dialog/auth-dialog.js +4 -1
  17. package/components/auth-dialog/auth-dialog.test.js +3 -19
  18. package/components/avatar/avatar.css +4 -1
  19. package/components/avatar/avatar.examples.js +3 -2
  20. package/components/avatar/avatar.js +34 -6
  21. package/components/avatar/avatar.test.js +20 -17
  22. package/components/avatar/fallback-avatar.js +136 -0
  23. package/components/avatar-editor-ng/avatar-editor-ng.css +2 -2
  24. package/components/avatar-editor-ng/avatar-editor-ng.js +2 -1
  25. package/components/avatar-editor-ng/{avatar-editor-ng.html → avatar-editor-ng__template.js} +2 -2
  26. package/components/badge/badge.test.js +13 -20
  27. package/components/button/button.css +2 -2
  28. package/components/button/button.js +4 -1
  29. package/components/button/button.test.js +32 -33
  30. package/components/button-group/button-group.js +1 -1
  31. package/components/button-group/caption.js +1 -1
  32. package/components/button-ng/button-ng.js +1 -1
  33. package/components/button-set-ng/button-set-ng.js +3 -1
  34. package/components/checkbox/checkbox.css +1 -1
  35. package/components/code/code.js +2 -5
  36. package/components/confirm/confirm.js +1 -0
  37. package/components/confirm-service/confirm-service.js +5 -5
  38. package/components/content-layout/content-layout.css +1 -1
  39. package/components/data-list/data-list.css +1 -1
  40. package/components/date-picker/date-input.js +5 -4
  41. package/components/date-picker/date-picker.css +34 -22
  42. package/components/date-picker/date-picker.js +16 -14
  43. package/components/date-picker/date-popup.js +22 -7
  44. package/components/date-picker/month-names.js +8 -5
  45. package/components/date-picker/month.js +6 -2
  46. package/components/date-picker/weekdays.js +10 -2
  47. package/components/dialog/dialog.examples.js +3 -1
  48. package/components/dialog/dialog.js +10 -5
  49. package/components/dialog/dialog.test.js +1 -1
  50. package/components/dialog/dialog__body-scroll-preventer.js +51 -31
  51. package/components/dialog-ng/dialog-ng.js +10 -10
  52. package/components/dialog-ng/{dialog-ng.html → dialog-ng__template.js} +2 -2
  53. package/components/dropdown/dropdown.examples.js +36 -1
  54. package/components/dropdown/dropdown.test.js +2 -2
  55. package/components/dropdown-menu/dropdown-menu.examples.js +47 -0
  56. package/components/dropdown-menu/dropdown-menu.js +117 -0
  57. package/components/dropdown-menu/dropdown-menu.test.js +76 -0
  58. package/components/error-bubble/error-bubble-legacy.css +1 -1
  59. package/components/error-bubble/error-bubble.css +1 -1
  60. package/components/error-bubble/error-bubble.examples.js +1 -1
  61. package/components/error-page/error-page.css +2 -2
  62. package/components/footer-ng/footer-ng.js +13 -3
  63. package/components/form/form.css +2 -2
  64. package/components/form-ng/form-ng.js +3 -1
  65. package/components/global/global.css +1 -1
  66. package/components/global/theme.js +1 -1
  67. package/components/global/variables.css +8 -1
  68. package/components/grid/grid.css +10 -9
  69. package/components/header/header.css +1 -1
  70. package/components/header/header.examples.js +7 -8
  71. package/components/header/profile.js +10 -11
  72. package/components/http/http.js +1 -1
  73. package/components/icon/icon.css +5 -4
  74. package/components/input/input-legacy.css +7 -7
  75. package/components/island/header.js +2 -2
  76. package/components/island/island.css +8 -3
  77. package/components/island-legacy/island-legacy.css +3 -1
  78. package/components/list/list.js +6 -1
  79. package/components/list/list__custom.js +9 -3
  80. package/components/list/list__item.js +8 -2
  81. package/components/list/list__link.js +2 -1
  82. package/components/loader-inline/loader-inline.css +1 -1
  83. package/components/loader-screen/loader-screen.css +1 -1
  84. package/components/message/message.css +1 -1
  85. package/components/message/message.examples.js +8 -7
  86. package/components/pager/pager.js +5 -3
  87. package/components/permissions/permissions.js +1 -1
  88. package/components/popup/popup.js +1 -1
  89. package/components/popup/popup.test.js +15 -13
  90. package/components/progress-bar/progress-bar.css +1 -1
  91. package/components/progress-bar/progress-bar.examples.js +3 -3
  92. package/components/progress-bar/progress-bar.js +5 -2
  93. package/components/progress-bar/progress-bar.test.js +12 -13
  94. package/components/progress-bar-ng/progress-bar-ng.examples.js +3 -3
  95. package/components/query-assist/query-assist.css +13 -3
  96. package/components/query-assist/query-assist.examples.js +3 -4
  97. package/components/query-assist/query-assist.js +56 -12
  98. package/components/query-assist/query-assist.test.js +37 -5
  99. package/components/save-field-ng/save-field-ng.css +0 -3
  100. package/components/save-field-ng/save-field-ng.js +3 -1
  101. package/components/save-field-ng/{save-field-ng.html → save-field-ng__template.js} +2 -2
  102. package/components/select/select.css +12 -7
  103. package/components/select/select.examples.js +13 -0
  104. package/components/select/select.js +30 -43
  105. package/components/select/select.test.js +4 -5
  106. package/components/select/select__popup.js +1 -0
  107. package/components/shortcuts-hint-ng/shortcuts-hint-ng.css +1 -1
  108. package/components/shortcuts-hint-ng/shortcuts-hint-ng.js +1 -1
  109. package/components/shortcuts-hint-ng/{shortcuts-hint-ng.html → shortcuts-hint-ng__template.js} +2 -2
  110. package/components/sidebar/sidebar.css +1 -0
  111. package/components/sidebar-ng/sidebar-ng.js +6 -2
  112. package/components/sidebar-ng/{sidebar-ng__button.html → sidebar-ng__button-template.js} +2 -2
  113. package/components/sidebar-ng/{sidebar-ng.html → sidebar-ng__template.js} +2 -2
  114. package/components/table/header.js +9 -1
  115. package/components/table/row.js +2 -1
  116. package/components/table/table.css +2 -1
  117. package/components/table-legacy/table-legacy.css +2 -2
  118. package/components/table-legacy/table-legacy__toolbar.css +2 -2
  119. package/components/table-legacy-ng/table-legacy-ng.js +38 -5
  120. package/components/table-legacy-ng/table-legacy-ng__pager.js +7 -1
  121. package/components/tabs/collapsible-tab.js +2 -2
  122. package/components/tabs/collapsible-tabs.js +5 -9
  123. package/components/tabs/tab-link.js +4 -2
  124. package/components/tabs/tabs.css +32 -5
  125. package/components/tabs-ng/tabs-ng.js +4 -2
  126. package/components/tabs-ng/{tabs-ng.html → tabs-ng__template.js} +6 -2
  127. package/components/tag/tag.css +5 -2
  128. package/components/tag/tag.examples.js +3 -0
  129. package/components/tag/tag.js +19 -16
  130. package/components/tags-input/tag-input.examples.js +1 -1
  131. package/components/tags-input/tags-input.js +5 -2
  132. package/components/template-ng/template-ng.js +1 -1
  133. package/components/tooltip/tooltip.js +7 -2
  134. package/components/user-agreement/user-agreement.css +1 -5
  135. package/components/user-agreement/user-agreement.examples.js +7 -6
  136. package/components/user-agreement/user-agreement.js +11 -3
  137. package/package.json +85 -83
  138. package/webpack.config.js +14 -10
  139. package/components/button-set-ng/button-set-ng.html +0 -1
  140. package/components/footer-ng/footer-ng.html +0 -13
  141. package/components/form-ng/form-ng__error-bubble.html +0 -3
  142. package/components/table-legacy-ng/table-legacy-ng.html +0 -4
  143. package/components/table-legacy-ng/table-legacy-ng__column.html +0 -12
  144. package/components/table-legacy-ng/table-legacy-ng__header.html +0 -4
  145. package/components/table-legacy-ng/table-legacy-ng__pager.html +0 -7
  146. package/components/table-legacy-ng/table-legacy-ng__row.html +0 -12
  147. package/components/table-legacy-ng/table-legacy-ng__title.html +0 -9
  148. package/dist/_helpers/_rollupPluginBabelHelpers.js +0 -123
  149. package/dist/_helpers/background-flow.js +0 -232
  150. package/dist/_helpers/badge.js +0 -3
  151. package/dist/_helpers/button.js +0 -145
  152. package/dist/_helpers/clickableLink.js +0 -65
  153. package/dist/_helpers/data-tests.js +0 -15
  154. package/dist/_helpers/disable-hover-hoc.js +0 -407
  155. package/dist/_helpers/dom.js +0 -101
  156. package/dist/_helpers/get-uid.js +0 -15
  157. package/dist/_helpers/linear-function.js +0 -17
  158. package/dist/_helpers/list.js +0 -1327
  159. package/dist/_helpers/logo.js +0 -36
  160. package/dist/_helpers/memoize.js +0 -17
  161. package/dist/_helpers/popup.js +0 -691
  162. package/dist/_helpers/popup.target.js +0 -27
  163. package/dist/_helpers/rerender-hoc.js +0 -49
  164. package/dist/_helpers/schedule-raf.js +0 -31
  165. package/dist/_helpers/sniffer.js +0 -6
  166. package/dist/_helpers/theme.js +0 -40
  167. package/dist/_helpers/url.js +0 -125
  168. package/dist/alert-service.js +0 -149
  169. package/dist/alert.js +0 -284
  170. package/dist/analytics.js +0 -116
  171. package/dist/auth-dialog-service.js +0 -56
  172. package/dist/auth-dialog.js +0 -122
  173. package/dist/auth.js +0 -1744
  174. package/dist/avatar.js +0 -152
  175. package/dist/badge.js +0 -52
  176. package/dist/button-group.js +0 -48
  177. package/dist/button-set.js +0 -27
  178. package/dist/button-toolbar.js +0 -30
  179. package/dist/button.js +0 -12
  180. package/dist/caret.js +0 -262
  181. package/dist/checkbox.js +0 -108
  182. package/dist/confirm-service.js +0 -102
  183. package/dist/confirm.js +0 -113
  184. package/dist/content-layout.js +0 -184
  185. package/dist/contenteditable.js +0 -81
  186. package/dist/data-list.js +0 -466
  187. package/dist/date-picker.js +0 -1398
  188. package/dist/dialog.js +0 -223
  189. package/dist/dropdown.js +0 -250
  190. package/dist/error-bubble.js +0 -56
  191. package/dist/error-message.js +0 -53
  192. package/dist/footer.js +0 -124
  193. package/dist/grid.js +0 -148
  194. package/dist/group.js +0 -34
  195. package/dist/header.js +0 -658
  196. package/dist/heading.js +0 -76
  197. package/dist/http.js +0 -207
  198. package/dist/hub-source.js +0 -130
  199. package/dist/icon.js +0 -211
  200. package/dist/input.js +0 -228
  201. package/dist/island.js +0 -314
  202. package/dist/link.js +0 -117
  203. package/dist/list.js +0 -29
  204. package/dist/loader-inline.js +0 -165
  205. package/dist/loader-screen.js +0 -45
  206. package/dist/loader.js +0 -338
  207. package/dist/login-dialog.js +0 -173
  208. package/dist/logo.js +0 -8
  209. package/dist/message.js +0 -226
  210. package/dist/old-browsers-message.js +0 -129
  211. package/dist/pager.js +0 -325
  212. package/dist/panel.js +0 -34
  213. package/dist/permissions.js +0 -466
  214. package/dist/popup-menu.js +0 -93
  215. package/dist/popup.js +0 -16
  216. package/dist/progress-bar.js +0 -111
  217. package/dist/proxy-attrs.js +0 -19
  218. package/dist/query-assist.js +0 -1081
  219. package/dist/radio.js +0 -112
  220. package/dist/select.js +0 -1920
  221. package/dist/selection.js +0 -213
  222. package/dist/shortcuts.js +0 -307
  223. package/dist/storage.js +0 -373
  224. package/dist/style.css +0 -1
  225. package/dist/tab-trap.js +0 -174
  226. package/dist/table.js +0 -903
  227. package/dist/tabs.js +0 -721
  228. package/dist/tag.js +0 -187
  229. package/dist/tags-input.js +0 -440
  230. package/dist/tags-list.js +0 -91
  231. package/dist/text.js +0 -38
  232. package/dist/toggle.js +0 -80
  233. package/dist/tooltip.js +0 -202
  234. package/dist/user-card.js +0 -218
package/dist/text.js DELETED
@@ -1,38 +0,0 @@
1
- import { _ as _objectWithoutProperties, a as _extends, b as _defineProperty } from './_helpers/_rollupPluginBabelHelpers.js';
2
- import React, { Component } from 'react';
3
- import PropTypes from 'prop-types';
4
- import classNames from 'classnames';
5
-
6
- var modules_78d1bce6 = {"text":"text_text__bc47c17b","info":"text_info__bc47c17b"};
7
-
8
- /**
9
- * @name Text
10
- */
11
-
12
- class Text extends Component {
13
- render() {
14
- const _this$props = this.props,
15
- {
16
- children,
17
- className,
18
- info
19
- } = _this$props,
20
- restProps = _objectWithoutProperties(_this$props, ["children", "className", "info"]);
21
-
22
- const classes = classNames(modules_78d1bce6.text, className, {
23
- [modules_78d1bce6.info]: info
24
- });
25
- return /*#__PURE__*/React.createElement("span", _extends({
26
- className: classes
27
- }, restProps), children);
28
- }
29
-
30
- }
31
-
32
- _defineProperty(Text, "propTypes", {
33
- children: PropTypes.node,
34
- info: PropTypes.bool,
35
- className: PropTypes.string
36
- });
37
-
38
- export default Text;
package/dist/toggle.js DELETED
@@ -1,80 +0,0 @@
1
- import { _ as _objectWithoutProperties, a as _extends, b as _defineProperty } from './_helpers/_rollupPluginBabelHelpers.js';
2
- import React, { PureComponent } from 'react';
3
- import PropTypes from 'prop-types';
4
- import classNames from 'classnames';
5
- import { w as withTheme } from './_helpers/theme.js';
6
- import { j as joinDataTestAttributes } from './_helpers/data-tests.js';
7
-
8
- var modules_331c5aa7 = {"unit":"8px","padding":"2px","disabled-line-color":"hsla(0,0%,100%,.9)","duration":".3s","timing-function":"cubic-bezier(.23,1,.32,1)","toggle":"toggle_toggle__ca2e3a7a","switch":"toggle_switch__ca2e3a7a","disabled":"toggle_disabled__ca2e3a7a","label":"toggle_label__ca2e3a7a","leftLabel":"toggle_leftLabel__ca2e3a7a","light":"toggle_light__ca2e3a7a","dark":"toggle_dark__ca2e3a7a","switchWrapper":"toggle_switchWrapper__ca2e3a7a","input":"toggle_input__ca2e3a7a","size20":"toggle_size20__ca2e3a7a","paleSwitch":"toggle_paleSwitch__ca2e3a7a"};
9
-
10
- const Size = {
11
- Size16: modules_331c5aa7.size16,
12
- Size20: modules_331c5aa7.size20
13
- };
14
- /**
15
- * @name Toggle
16
- */
17
-
18
- class Toggle extends PureComponent {
19
- render() {
20
- const _this$props = this.props,
21
- {
22
- className,
23
- children,
24
- disabled,
25
- pale,
26
- title,
27
- leftLabel,
28
- theme,
29
- size = Size.Size16,
30
- 'data-test': dataTest,
31
- onTransitionEnd
32
- } = _this$props,
33
- restProps = _objectWithoutProperties(_this$props, ["className", "children", "disabled", "pale", "title", "leftLabel", "theme", "size", "data-test", "onTransitionEnd"]);
34
-
35
- const classes = classNames(className, size, modules_331c5aa7.toggle, modules_331c5aa7[theme], disabled && modules_331c5aa7.disabled);
36
- return /*#__PURE__*/React.createElement("label", {
37
- className: classes,
38
- title: title,
39
- "data-test": joinDataTestAttributes('ring-toggle', dataTest)
40
- }, leftLabel && /*#__PURE__*/React.createElement("span", {
41
- className: modules_331c5aa7.leftLabel
42
- }, leftLabel), /*#__PURE__*/React.createElement("span", {
43
- className: modules_331c5aa7.switchWrapper
44
- }, /*#__PURE__*/React.createElement("input", _extends({
45
- "data-test": "ring-toggle-input"
46
- }, restProps, {
47
- type: "checkbox",
48
- disabled: disabled,
49
- className: modules_331c5aa7.input
50
- })), /*#__PURE__*/React.createElement("span", {
51
- className: classNames(modules_331c5aa7.switch, pale && modules_331c5aa7.paleSwitch),
52
- onTransitionEnd: onTransitionEnd
53
- })), children && /*#__PURE__*/React.createElement("span", {
54
- className: modules_331c5aa7.label
55
- }, children));
56
- }
57
-
58
- }
59
-
60
- _defineProperty(Toggle, "propTypes", {
61
- children: PropTypes.node,
62
- name: PropTypes.string,
63
- className: PropTypes.string,
64
- title: PropTypes.string,
65
- leftLabel: PropTypes.node,
66
- defaultChecked: PropTypes.bool,
67
- checked: PropTypes.bool,
68
- disabled: PropTypes.bool,
69
- pale: PropTypes.bool,
70
- onChange: PropTypes.func,
71
- onTransitionEnd: PropTypes.func,
72
- theme: PropTypes.string,
73
- size: PropTypes.oneOf(Object.values(Size)),
74
- 'data-test': PropTypes.string
75
- });
76
-
77
- var toggle = withTheme()(Toggle);
78
-
79
- export default toggle;
80
- export { Size };
package/dist/tooltip.js DELETED
@@ -1,202 +0,0 @@
1
- import { b as _defineProperty, _ as _objectWithoutProperties, a as _extends } from './_helpers/_rollupPluginBabelHelpers.js';
2
- import React, { Component, createContext } from 'react';
3
- import PropTypes from 'prop-types';
4
- import { P as Popup } from './_helpers/popup.js';
5
- import { L as Listeners } from './_helpers/dom.js';
6
- import { j as joinDataTestAttributes } from './_helpers/data-tests.js';
7
- import { s as scheduleRAF } from './_helpers/schedule-raf.js';
8
- import 'react-dom';
9
- import 'classnames';
10
- import './_helpers/get-uid.js';
11
- import './shortcuts.js';
12
- import 'combokeys';
13
- import './_helpers/sniffer.js';
14
- import 'sniffr';
15
- import './tab-trap.js';
16
- import './_helpers/popup.target.js';
17
-
18
- var modules_cd5e45a9 = {"unit":"8px","tooltip":"tooltip_tooltip__b9231867"};
19
-
20
- const scheduleScroll = scheduleRAF();
21
- const TooltipContext = /*#__PURE__*/createContext();
22
- /**
23
- * @name Tooltip
24
- */
25
-
26
- class Tooltip extends Component {
27
- constructor(...args) {
28
- super(...args);
29
-
30
- _defineProperty(this, "state", {
31
- showPopup: false,
32
- showNestedPopup: false
33
- });
34
-
35
- _defineProperty(this, "listeners", new Listeners());
36
-
37
- _defineProperty(this, "containerRef", el => {
38
- this.containerNode = el;
39
- });
40
-
41
- _defineProperty(this, "tryToShowPopup", () => {
42
- const {
43
- delay,
44
- title
45
- } = this.props;
46
-
47
- if (!title) {
48
- return;
49
- }
50
-
51
- if (delay) {
52
- this.timeout = setTimeout(this.showPopup, delay);
53
- } else {
54
- this.showPopup();
55
- }
56
- });
57
-
58
- _defineProperty(this, "showPopup", () => {
59
- var _this$context;
60
-
61
- if (this.props.selfOverflowOnly) {
62
- const {
63
- containerNode
64
- } = this; // rare cases when containerNode is null are possible;
65
- // probably the collision is due to the asynchronous nature of the code,
66
- // i.e. this code runs after the component is unmounted,
67
- // although at first glance it looks unlikely.
68
-
69
- if (!containerNode) {
70
- return;
71
- } // inline element?
72
-
73
-
74
- if (containerNode.clientWidth === 0 && containerNode.clientHeight === 0) {
75
- return;
76
- }
77
-
78
- if (containerNode.scrollWidth <= containerNode.clientWidth && containerNode.scrollHeight <= containerNode.clientHeight) {
79
- return;
80
- }
81
- }
82
-
83
- (_this$context = this.context) === null || _this$context === void 0 ? void 0 : _this$context.onNestedTooltipShow();
84
- this.setState({
85
- showPopup: true
86
- });
87
- });
88
-
89
- _defineProperty(this, "hidePopup", () => {
90
- var _this$context2;
91
-
92
- clearTimeout(this.timeout);
93
- (_this$context2 = this.context) === null || _this$context2 === void 0 ? void 0 : _this$context2.onNestedTooltipHide();
94
- this.setState({
95
- showPopup: false
96
- });
97
- });
98
-
99
- _defineProperty(this, "popupRef", el => {
100
- this.popup = el;
101
- });
102
-
103
- _defineProperty(this, "onNestedTooltipShow", () => {
104
- this.setState({
105
- showNestedPopup: true
106
- });
107
- });
108
-
109
- _defineProperty(this, "onNestedTooltipHide", () => {
110
- this.setState({
111
- showNestedPopup: false
112
- });
113
- });
114
- }
115
-
116
- componentDidMount() {
117
- if (this.props.title) {
118
- this.addListeners();
119
- }
120
- }
121
-
122
- componentDidUpdate(prevProps) {
123
- if (!prevProps.title && this.props.title) {
124
- this.addListeners();
125
- } else if (prevProps.title && !this.props.title) {
126
- this.listeners.removeAll();
127
- }
128
- }
129
-
130
- componentWillUnmount() {
131
- clearTimeout(this.timeout);
132
- this.listeners.removeAll();
133
- }
134
-
135
- addListeners() {
136
- this.listeners.add(this.containerNode, 'mouseover', this.tryToShowPopup);
137
- this.listeners.add(this.containerNode, 'mouseout', this.hidePopup);
138
- this.listeners.add(document, 'scroll', () => scheduleScroll(this.hidePopup), {
139
- passive: true
140
- });
141
- }
142
-
143
- render() {
144
- const _this$props = this.props,
145
- {
146
- children,
147
- 'data-test': dataTest,
148
- title,
149
- delay,
150
- selfOverflowOnly,
151
- popupProps
152
- } = _this$props,
153
- restProps = _objectWithoutProperties(_this$props, ["children", "data-test", "title", "delay", "selfOverflowOnly", "popupProps"]);
154
-
155
- const {
156
- onNestedTooltipShow,
157
- onNestedTooltipHide
158
- } = this;
159
- return /*#__PURE__*/React.createElement(TooltipContext.Provider, {
160
- value: {
161
- onNestedTooltipShow,
162
- onNestedTooltipHide
163
- }
164
- }, /*#__PURE__*/React.createElement("span", _extends({}, restProps, {
165
- ref: this.containerRef,
166
- "data-test": joinDataTestAttributes('ring-tooltip', dataTest),
167
- "data-test-title": title
168
- }), children, /*#__PURE__*/React.createElement(Popup, _extends({
169
- trapFocus: false,
170
- hidden: !this.state.showPopup || this.state.showNestedPopup,
171
- onCloseAttempt: this.hidePopup,
172
- maxHeight: 400,
173
- className: modules_cd5e45a9.tooltip,
174
- attached: false,
175
- top: 4,
176
- dontCloseOnAnchorClick: true,
177
- ref: this.popupRef
178
- }, popupProps), title)));
179
- }
180
-
181
- }
182
-
183
- _defineProperty(Tooltip, "propTypes", {
184
- delay: PropTypes.number,
185
- selfOverflowOnly: PropTypes.bool,
186
- popupProps: PropTypes.object,
187
- title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
188
- children: PropTypes.node,
189
- 'data-test': PropTypes.string
190
- });
191
-
192
- _defineProperty(Tooltip, "defaultProps", {
193
- title: '',
194
- selfOverflowOnly: false,
195
- popupProps: {}
196
- });
197
-
198
- _defineProperty(Tooltip, "PopupProps", Popup.PopupProps);
199
-
200
- _defineProperty(Tooltip, "contextType", TooltipContext);
201
-
202
- export default Tooltip;
package/dist/user-card.js DELETED
@@ -1,218 +0,0 @@
1
- import { _ as _objectWithoutProperties, a as _extends, b as _defineProperty, c as _objectSpread2 } from './_helpers/_rollupPluginBabelHelpers.js';
2
- import React, { PureComponent, Component } from 'react';
3
- import PropTypes from 'prop-types';
4
- import classNames from 'classnames';
5
- import Avatar, { Size } from './avatar.js';
6
- import Link from './link.js';
7
- import { m as modules_6c9187df } from './_helpers/badge.js';
8
- import Dropdown from './dropdown.js';
9
- import { P as Popup } from './_helpers/popup.js';
10
- import LoaderInline from './loader-inline.js';
11
- import './_helpers/url.js';
12
- import './_helpers/dom.js';
13
- import 'focus-visible';
14
- import './_helpers/memoize.js';
15
- import './_helpers/data-tests.js';
16
- import './_helpers/clickableLink.js';
17
- import '@jetbrains/icons/chevron-10px';
18
- import './icon.js';
19
- import 'util-deprecate';
20
- import './_helpers/button.js';
21
- import './_helpers/theme.js';
22
- import 'react-dom';
23
- import './_helpers/get-uid.js';
24
- import './_helpers/schedule-raf.js';
25
- import './shortcuts.js';
26
- import 'combokeys';
27
- import './_helpers/sniffer.js';
28
- import 'sniffr';
29
- import './tab-trap.js';
30
- import './_helpers/popup.target.js';
31
- import 'conic-gradient';
32
-
33
- var modules_a4196c17 = {"unit":"8px","userCardSpaced":"userCard_userCardSpaced__2a18ba49","userInformationContainer":"userCard_userInformationContainer__2a18ba49","userInformation":"userCard_userInformation__2a18ba49","userName":"userCard_userName__2a18ba49","userActiveStatus":"userCard_userActiveStatus__2a18ba49","online":"userCard_online__2a18ba49"};
34
-
35
- class UserCard extends PureComponent {
36
- render() {
37
- const _this$props = this.props,
38
- {
39
- children,
40
- className,
41
- user,
42
- wording
43
- } = _this$props,
44
- restProps = _objectWithoutProperties(_this$props, ["children", "className", "user", "wording"]);
45
-
46
- const classes = classNames(className, {});
47
- const userActiveStatusClasses = classNames(modules_a4196c17.userActiveStatus, user.online ? modules_a4196c17.online : '');
48
- return /*#__PURE__*/React.createElement("div", _extends({
49
- className: classes
50
- }, restProps), /*#__PURE__*/React.createElement("div", {
51
- className: modules_a4196c17.userInformationContainer
52
- }, /*#__PURE__*/React.createElement(Avatar, {
53
- size: Size.Size56,
54
- url: user.avatarUrl
55
- }), /*#__PURE__*/React.createElement("div", {
56
- className: modules_a4196c17.userInformation
57
- }, /*#__PURE__*/React.createElement("div", null, user.href && /*#__PURE__*/React.createElement(Link, {
58
- href: user.href,
59
- className: modules_a4196c17.userName
60
- }, user.name), !user.href && /*#__PURE__*/React.createElement("span", {
61
- className: modules_a4196c17.userName
62
- }, user.name), user.banned && /*#__PURE__*/React.createElement("span", {
63
- className: classNames(modules_6c9187df.badge, modules_6c9187df.invalid),
64
- title: user.banReason
65
- }, wording.banned)), /*#__PURE__*/React.createElement("div", null, typeof user.online === 'boolean' && /*#__PURE__*/React.createElement("span", {
66
- className: userActiveStatusClasses,
67
- title: user.online ? wording.online : wording.offline
68
- }), user.login), user.email && /*#__PURE__*/React.createElement("div", null, user.email))), children);
69
- }
70
-
71
- }
72
-
73
- _defineProperty(UserCard, "propTypes", {
74
- children: PropTypes.node,
75
- className: PropTypes.string,
76
- user: PropTypes.shape({
77
- name: PropTypes.string.isRequired,
78
- login: PropTypes.string.isRequired,
79
- avatarUrl: PropTypes.string.isRequired,
80
- email: PropTypes.string,
81
- href: PropTypes.string,
82
- online: PropTypes.bool,
83
- banned: PropTypes.bool,
84
- banReason: PropTypes.string
85
- }).isRequired,
86
- wording: PropTypes.shape({
87
- banned: PropTypes.string.isRequired,
88
- online: PropTypes.string.isRequired,
89
- offline: PropTypes.string.isRequired
90
- })
91
- });
92
-
93
- _defineProperty(UserCard, "defaultProps", {
94
- wording: {
95
- banned: 'banned',
96
- online: 'online',
97
- offline: 'offline'
98
- }
99
- });
100
-
101
- const DEFAULT_TIMEOUT = 300;
102
- class UserCardTooltip extends Component {
103
- render() {
104
- const {
105
- children,
106
- user,
107
- renderUserCard,
108
- renderNoUser,
109
- dropdownProps
110
- } = this.props;
111
- return /*#__PURE__*/React.createElement(Dropdown, _extends({
112
- anchor: children,
113
- hoverMode: true,
114
- clickMode: false
115
- }, dropdownProps), /*#__PURE__*/React.createElement(Popup, {
116
- attached: false
117
- }, user ? renderUserCard(this.props) : renderNoUser()));
118
- }
119
-
120
- }
121
-
122
- _defineProperty(UserCardTooltip, "propTypes", {
123
- className: PropTypes.string,
124
- children: PropTypes.node,
125
- dropdownProps: PropTypes.object,
126
- user: PropTypes.object,
127
- renderUserCard: PropTypes.func,
128
- renderNoUser: PropTypes.func
129
- });
130
-
131
- _defineProperty(UserCardTooltip, "defaultProps", {
132
- renderUserCard: props => {
133
- const {
134
- className,
135
- children,
136
- renderUserCard,
137
- renderNoUser,
138
- dropdownProps
139
- } = props,
140
- restProps = _objectWithoutProperties(props, ["className", "children", "renderUserCard", "renderNoUser", "dropdownProps"]);
141
-
142
- return /*#__PURE__*/React.createElement(UserCard, _extends({}, restProps, {
143
- className: classNames(modules_a4196c17.userCardSpaced, className)
144
- }));
145
- },
146
- renderNoUser: () => '',
147
- dropdownProps: {
148
- hoverShowTimeOut: DEFAULT_TIMEOUT,
149
- hoverHideTimeOut: DEFAULT_TIMEOUT
150
- }
151
- });
152
-
153
- class SmartUserCardTooltip extends Component {
154
- constructor(...args) {
155
- super(...args);
156
-
157
- _defineProperty(this, "state", {
158
- user: null,
159
- loading: false
160
- });
161
-
162
- _defineProperty(this, "loadUser", async () => {
163
- if (this.state.user) {
164
- return;
165
- }
166
-
167
- try {
168
- this.setState({
169
- loading: true
170
- });
171
- const user = await this.props.userDataSource();
172
- this.setState({
173
- user
174
- });
175
- } catch (e) {// Skip it
176
- } finally {
177
- this.setState({
178
- loading: false
179
- });
180
- }
181
- });
182
-
183
- _defineProperty(this, "renderNoUser", () => this.state.loading ? /*#__PURE__*/React.createElement("div", {
184
- className: modules_a4196c17.userCardSpaced
185
- }, /*#__PURE__*/React.createElement(LoaderInline, null)) : '');
186
- }
187
-
188
- render() {
189
- const {
190
- user
191
- } = this.state;
192
-
193
- const _this$props = this.props,
194
- {
195
- children,
196
- userDataSource
197
- } = _this$props,
198
- restProps = _objectWithoutProperties(_this$props, ["children", "userDataSource"]);
199
-
200
- const dropdownProps = _objectSpread2({
201
- onMouseEnter: this.loadUser
202
- }, UserCardTooltip.defaultProps.dropdownProps);
203
-
204
- return /*#__PURE__*/React.createElement(UserCardTooltip, _extends({
205
- user: user,
206
- renderNoUser: this.renderNoUser,
207
- dropdownProps: dropdownProps
208
- }, restProps), children);
209
- }
210
-
211
- }
212
-
213
- _defineProperty(SmartUserCardTooltip, "propTypes", {
214
- children: PropTypes.node,
215
- userDataSource: PropTypes.func
216
- });
217
-
218
- export { SmartUserCardTooltip, UserCard, UserCardTooltip };