@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/dialog.js DELETED
@@ -1,223 +0,0 @@
1
- import { b as _defineProperty, _ as _objectWithoutProperties, a as _extends } from './_helpers/_rollupPluginBabelHelpers.js';
2
- import React, { PureComponent } from 'react';
3
- import { createPortal } from 'react-dom';
4
- import PropTypes from 'prop-types';
5
- import classNames from 'classnames';
6
- import closeIcon from '@jetbrains/icons/close';
7
- import { AdaptiveIsland } from './island.js';
8
- import { g as getUID } from './_helpers/get-uid.js';
9
- import { j as joinDataTestAttributes } from './_helpers/data-tests.js';
10
- import Shortcuts from './shortcuts.js';
11
- import TabTrap from './tab-trap.js';
12
- import { B as Button } from './_helpers/button.js';
13
- import { P as PopupTarget } from './_helpers/popup.target.js';
14
- import scrollbarWidth from 'scrollbar-width';
15
- import './_helpers/linear-function.js';
16
- import 'element-resize-detector';
17
- import './_helpers/schedule-raf.js';
18
- import 'combokeys';
19
- import './_helpers/sniffer.js';
20
- import 'sniffr';
21
- import './_helpers/dom.js';
22
- import 'focus-visible';
23
- import '@jetbrains/icons/chevron-10px';
24
- import './icon.js';
25
- import 'util-deprecate';
26
- import './_helpers/memoize.js';
27
- import './_helpers/theme.js';
28
- import './_helpers/clickableLink.js';
29
-
30
- var modules_5e9b8c03 = {"unit":"8px","container":"dialog_container__16e57f84","innerContainer":"dialog_innerContainer__16e57f84","content":"dialog_content__16e57f84","panel":"dialog_panel__16e57f84","clickableOverlay":"dialog_clickableOverlay__16e57f84","closeIcon":"dialog_closeIcon__16e57f84","closeButton":"dialog_closeButton__16e57f84","closeButtonOutside":"dialog_closeButtonOutside__16e57f84","closeButtonInside":"dialog_closeButtonInside__16e57f84","documentWithoutScroll":"dialog_documentWithoutScroll__16e57f84","popupTarget":"dialog_popupTarget__16e57f84"};
31
-
32
- let isPrevented = false;
33
- let previousDocumentWidth = null;
34
- var ScrollPreventer = {
35
- prevent() {
36
- if (isPrevented) {
37
- return;
38
- }
39
-
40
- isPrevented = true;
41
- const documentHasScroll = document.documentElement.scrollHeight > window.innerHeight || getComputedStyle(document.documentElement).overflowY === 'scroll';
42
- document.documentElement.classList.add(modules_5e9b8c03.documentWithoutScroll);
43
- const scrollWidth = scrollbarWidth();
44
-
45
- if (documentHasScroll && scrollWidth > 0) {
46
- previousDocumentWidth = document.documentElement.style.width;
47
- document.documentElement.style.width = `calc(100% - ${scrollWidth}px)`;
48
- }
49
- },
50
-
51
- reset() {
52
- if (!isPrevented) {
53
- return;
54
- }
55
-
56
- isPrevented = false;
57
- document.documentElement.classList.remove(modules_5e9b8c03.documentWithoutScroll);
58
-
59
- if (previousDocumentWidth !== null) {
60
- document.documentElement.style.width = previousDocumentWidth;
61
- previousDocumentWidth = null;
62
- }
63
- }
64
-
65
- };
66
-
67
- /**
68
- * @name Dialog
69
- */
70
-
71
- function noop() {}
72
-
73
- class Dialog extends PureComponent {
74
- constructor(...args) {
75
- super(...args);
76
-
77
- _defineProperty(this, "state", {
78
- shortcutsScope: getUID('ring-dialog-')
79
- });
80
-
81
- _defineProperty(this, "uid", getUID('dialog-'));
82
-
83
- _defineProperty(this, "handleClick", event => {
84
- this.props.onOverlayClick(event);
85
- this.props.onCloseAttempt(event);
86
- });
87
-
88
- _defineProperty(this, "onCloseClick", event => {
89
- this.props.onCloseClick(event);
90
- this.props.onCloseAttempt(event);
91
- });
92
-
93
- _defineProperty(this, "getShortcutsMap", () => {
94
- const onEscape = event => {
95
- if (this.props.show) {
96
- this.props.onEscPress(event);
97
- this.props.onCloseAttempt(event);
98
- }
99
- };
100
-
101
- return {
102
- esc: onEscape
103
- };
104
- });
105
-
106
- _defineProperty(this, "dialogRef", tabTrap => {
107
- this.dialog = tabTrap && tabTrap.node;
108
- });
109
- }
110
-
111
- componentDidMount() {
112
- this.toggleScrollPreventer();
113
- }
114
-
115
- componentDidUpdate(prevProps) {
116
- if (prevProps.show !== this.props.show) {
117
- this.toggleScrollPreventer();
118
- }
119
- }
120
-
121
- componentWillUnmount() {
122
- ScrollPreventer.reset();
123
- }
124
-
125
- toggleScrollPreventer() {
126
- if (this.props.show) {
127
- ScrollPreventer.prevent();
128
- } else {
129
- ScrollPreventer.reset();
130
- }
131
- }
132
-
133
- render() {
134
- const _this$props = this.props,
135
- {
136
- show,
137
- showCloseButton,
138
- onOverlayClick,
139
- onCloseAttempt,
140
- onEscPress,
141
- onCloseClick,
142
- children,
143
- className,
144
- contentClassName,
145
- trapFocus,
146
- 'data-test': dataTest,
147
- closeButtonInside,
148
- portalTarget
149
- } = _this$props,
150
- restProps = _objectWithoutProperties(_this$props, ["show", "showCloseButton", "onOverlayClick", "onCloseAttempt", "onEscPress", "onCloseClick", "children", "className", "contentClassName", "trapFocus", "data-test", "closeButtonInside", "portalTarget"]);
151
-
152
- const classes = classNames(modules_5e9b8c03.container, className);
153
- const shortcutsMap = this.getShortcutsMap();
154
- return show && /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement(PopupTarget, {
155
- id: this.uid,
156
- className: modules_5e9b8c03.popupTarget
157
- }, target => /*#__PURE__*/React.createElement(TabTrap, _extends({
158
- trapDisabled: !trapFocus,
159
- "data-test": joinDataTestAttributes('ring-dialog-container', dataTest),
160
- ref: this.dialogRef,
161
- className: classes,
162
- role: "presentation"
163
- }, restProps), /*#__PURE__*/React.createElement(Shortcuts, {
164
- map: shortcutsMap,
165
- scope: this.state.shortcutsScope
166
- }), (onOverlayClick !== noop || onCloseAttempt !== noop) && /*#__PURE__*/React.createElement("div", {
167
- // click handler is duplicated in close button
168
- role: "presentation",
169
- className: modules_5e9b8c03.clickableOverlay,
170
- onClick: this.handleClick
171
- }), /*#__PURE__*/React.createElement("div", {
172
- className: modules_5e9b8c03.innerContainer
173
- }, /*#__PURE__*/React.createElement(AdaptiveIsland, {
174
- className: classNames(modules_5e9b8c03.content, contentClassName),
175
- "data-test": "ring-dialog",
176
- role: "dialog"
177
- }, children, showCloseButton && /*#__PURE__*/React.createElement(Button, {
178
- icon: closeIcon,
179
- "data-test": "ring-dialog-close-button",
180
- className: classNames(modules_5e9b8c03.closeButton, {
181
- [modules_5e9b8c03.closeButtonOutside]: !closeButtonInside,
182
- [modules_5e9b8c03.closeButtonInside]: closeButtonInside
183
- }),
184
- iconClassName: modules_5e9b8c03.closeIcon,
185
- onClick: this.onCloseClick,
186
- "aria-label": "close dialog"
187
- }))), target)), portalTarget instanceof HTMLElement ? portalTarget : document.body);
188
- }
189
-
190
- }
191
-
192
- _defineProperty(Dialog, "propTypes", {
193
- className: PropTypes.string,
194
- contentClassName: PropTypes.string,
195
- children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
196
- show: PropTypes.bool.isRequired,
197
- showCloseButton: PropTypes.bool,
198
- closeButtonInside: PropTypes.bool,
199
- onOverlayClick: PropTypes.func,
200
- onEscPress: PropTypes.func,
201
- onCloseClick: PropTypes.func,
202
- // onCloseAttempt is a common callback for ESC pressing and overlay clicking.
203
- // Use it if you don't need different behaviors for this cases.
204
- onCloseAttempt: PropTypes.func,
205
- // focusTrap may break popups inside dialog, so use it carefully
206
- trapFocus: PropTypes.bool,
207
- portalTarget: PropTypes.instanceOf(HTMLElement),
208
- autoFocusFirst: PropTypes.bool,
209
- 'data-test': PropTypes.string
210
- });
211
-
212
- _defineProperty(Dialog, "defaultProps", {
213
- onOverlayClick: noop,
214
- onEscPress: noop,
215
- onCloseClick: noop,
216
- onCloseAttempt: noop,
217
- showCloseButton: false,
218
- closeButtonInside: false,
219
- trapFocus: false,
220
- autoFocusFirst: true
221
- });
222
-
223
- export default Dialog;
package/dist/dropdown.js DELETED
@@ -1,250 +0,0 @@
1
- import { _ as _objectWithoutProperties, a as _extends, b as _defineProperty } from './_helpers/_rollupPluginBabelHelpers.js';
2
- import React, { memo, Component, cloneElement } from 'react';
3
- import PropTypes from 'prop-types';
4
- import classNames from 'classnames';
5
- import { j as joinDataTestAttributes } from './_helpers/data-tests.js';
6
- import chevronDown from '@jetbrains/icons/chevron-10px';
7
- import Icon from './icon.js';
8
- import { B as Button } from './_helpers/button.js';
9
- import 'util-deprecate';
10
- import './_helpers/memoize.js';
11
- import 'focus-visible';
12
- import './_helpers/theme.js';
13
- import './_helpers/clickableLink.js';
14
-
15
- var modules_d9414203 = {"dropdown":"dropdown_dropdown__15def50d","anchor":"dropdown_anchor__15def50d","chevron":"dropdown_chevron__15def50d"};
16
-
17
- const Anchor = (_ref) => {
18
- let {
19
- children,
20
- className
21
- } = _ref,
22
- restProps = _objectWithoutProperties(_ref, ["children", "className"]);
23
-
24
- return /*#__PURE__*/React.createElement(Button, _extends({
25
- text: true,
26
- className: classNames(modules_d9414203.anchor, className)
27
- }, restProps), children, /*#__PURE__*/React.createElement(Icon, {
28
- glyph: chevronDown,
29
- className: modules_d9414203.chevron
30
- }));
31
- };
32
-
33
- Anchor.propTypes = {
34
- children: PropTypes.node,
35
- className: PropTypes.string
36
- };
37
- var Anchor$1 = /*#__PURE__*/memo(Anchor);
38
-
39
- /**
40
- * @name Dropdown
41
- */
42
-
43
- class Dropdown extends Component {
44
- constructor(...args) {
45
- super(...args);
46
-
47
- _defineProperty(this, "state", {
48
- show: this.props.initShown,
49
- pinned: false
50
- });
51
-
52
- _defineProperty(this, "onClick", () => {
53
- const {
54
- show,
55
- pinned
56
- } = this.state;
57
- let nextPinned = pinned;
58
-
59
- if (this.props.hoverMode) {
60
- if (!pinned) {
61
- nextPinned = true;
62
-
63
- if (show) {
64
- this.setState({
65
- pinned: true
66
- });
67
- return;
68
- }
69
- } else {
70
- nextPinned = false;
71
- }
72
- }
73
-
74
- this._toggle(!show, nextPinned);
75
- });
76
-
77
- _defineProperty(this, "onChildCloseAttempt", () => {
78
- let nextPinned = this.state.pinned;
79
-
80
- if (this.props.hoverMode) {
81
- nextPinned = false;
82
- }
83
-
84
- this._toggle(false, nextPinned);
85
- });
86
-
87
- _defineProperty(this, "onMouseEnter", event => {
88
- this._clearTimer();
89
-
90
- this.props.onMouseEnter(event);
91
- this.hoverTimer = setTimeout(() => {
92
- if (!this.state.show) {
93
- this._toggle(true);
94
- }
95
- }, this.props.hoverShowTimeOut);
96
- });
97
-
98
- _defineProperty(this, "onMouseLeave", event => {
99
- this.props.onMouseLeave(event);
100
-
101
- if (this.state.pinned) {
102
- return;
103
- }
104
-
105
- this._clearTimer();
106
-
107
- this.hoverTimer = setTimeout(() => {
108
- if (this.state.show) {
109
- this._toggle(false);
110
- }
111
- }, this.props.hoverHideTimeOut);
112
- });
113
-
114
- _defineProperty(this, "handlePopupInteraction", () => {
115
- this.setState(({
116
- pinned
117
- }) => pinned ? null : {
118
- pinned: true
119
- });
120
- });
121
- }
122
-
123
- toggle(show = !this.state.show) {
124
- this._toggle(show);
125
- }
126
-
127
- _toggle(show, pinned = this.state.pinned) {
128
- this.setState({
129
- show,
130
- pinned
131
- }, () => show ? this.props.onShow() : this.props.onHide());
132
- }
133
-
134
- _clearTimer() {
135
- if (this.hoverTimer) {
136
- clearTimeout(this.hoverTimer);
137
- this.hoverTimer = null;
138
- }
139
- }
140
-
141
- render() {
142
- const {
143
- show,
144
- pinned
145
- } = this.state;
146
-
147
- const _this$props = this.props,
148
- {
149
- initShown,
150
- onShow,
151
- onHide,
152
- hoverShowTimeOut,
153
- hoverHideTimeOut,
154
- children,
155
- anchor,
156
- className,
157
- activeClassName,
158
- hoverMode,
159
- clickMode,
160
- 'data-test': dataTest
161
- } = _this$props,
162
- restProps = _objectWithoutProperties(_this$props, ["initShown", "onShow", "onHide", "hoverShowTimeOut", "hoverHideTimeOut", "children", "anchor", "className", "activeClassName", "hoverMode", "clickMode", "data-test"]);
163
-
164
- const classes = classNames(modules_d9414203.dropdown, className, {
165
- [activeClassName]: activeClassName != null && show
166
- });
167
- let anchorElement;
168
- const active = hoverMode ? pinned : show;
169
-
170
- switch (typeof anchor) {
171
- case 'string':
172
- anchorElement = /*#__PURE__*/React.createElement(Anchor$1, {
173
- active: active
174
- }, anchor);
175
- break;
176
-
177
- case 'function':
178
- anchorElement = anchor({
179
- active: show,
180
- pinned
181
- });
182
- break;
183
-
184
- default:
185
- if (typeof anchor.type === 'string' || Array.isArray(anchor)) {
186
- anchorElement = anchor;
187
- } else {
188
- anchorElement = /*#__PURE__*/cloneElement(anchor, {
189
- active
190
- });
191
- }
192
-
193
- }
194
-
195
- const childProps = {
196
- hidden: !show,
197
- onCloseAttempt: this.onChildCloseAttempt,
198
- onMouseDown: hoverMode ? this.handlePopupInteraction : undefined,
199
- onContextMenu: hoverMode ? this.handlePopupInteraction : undefined,
200
- dontCloseOnAnchorClick: true
201
- };
202
- return /*#__PURE__*/React.createElement("div", _extends({
203
- "data-test": joinDataTestAttributes('ring-dropdown', dataTest)
204
- }, restProps, {
205
- onClick: clickMode ? this.onClick : undefined // anchorElement should be a `button` or an `a`
206
- ,
207
- role: "presentation",
208
- onMouseEnter: hoverMode ? this.onMouseEnter : undefined,
209
- onMouseLeave: hoverMode ? this.onMouseLeave : undefined,
210
- className: classes
211
- }), anchorElement, typeof children === 'function' ? children(childProps) : /*#__PURE__*/cloneElement(children, childProps));
212
- }
213
-
214
- }
215
-
216
- _defineProperty(Dropdown, "propTypes", {
217
- /**
218
- * Can be string, React element, or a function accepting an object with {active, pinned} properties and returning a React element
219
- * React element should render some interactive HTML element like `button` or `a`
220
- */
221
- anchor: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
222
- children: PropTypes.oneOfType([PropTypes.element, PropTypes.func]).isRequired,
223
- initShown: PropTypes.bool,
224
- className: PropTypes.string,
225
- activeClassName: PropTypes.string,
226
- clickMode: PropTypes.bool,
227
- hoverMode: PropTypes.bool,
228
- hoverShowTimeOut: PropTypes.number,
229
- hoverHideTimeOut: PropTypes.number,
230
- onShow: PropTypes.func,
231
- onHide: PropTypes.func,
232
- onMouseEnter: PropTypes.func,
233
- onMouseLeave: PropTypes.func,
234
- 'data-test': PropTypes.string
235
- });
236
-
237
- _defineProperty(Dropdown, "defaultProps", {
238
- initShown: false,
239
- clickMode: true,
240
- hoverMode: false,
241
- hoverShowTimeOut: 300,
242
- hoverHideTimeOut: 600,
243
- onShow: () => {},
244
- onHide: () => {},
245
- onMouseEnter: () => {},
246
- onMouseLeave: () => {}
247
- });
248
-
249
- export default Dropdown;
250
- export { Anchor$1 as Anchor };
@@ -1,56 +0,0 @@
1
- import { _ as _objectWithoutProperties, b as _defineProperty } from './_helpers/_rollupPluginBabelHelpers.js';
2
- import React, { PureComponent, Children, cloneElement } from 'react';
3
- import PropTypes from 'prop-types';
4
- import classNames from 'classnames';
5
- import { P as Popup, D as Directions } from './_helpers/popup.js';
6
- import 'react-dom';
7
- import './_helpers/get-uid.js';
8
- import './_helpers/schedule-raf.js';
9
- import './_helpers/dom.js';
10
- import './shortcuts.js';
11
- import 'combokeys';
12
- import './_helpers/sniffer.js';
13
- import 'sniffr';
14
- import './_helpers/data-tests.js';
15
- import './tab-trap.js';
16
- import './_helpers/popup.target.js';
17
-
18
- var modules_ee284100 = {"unit":"8px","errorBubblePopup":"errorBubble_errorBubblePopup__23d4f97d","errorBubbleWrapper":"errorBubble_errorBubbleWrapper__23d4f97d","errorBubble":"errorBubble_errorBubble__23d4f97d"};
19
-
20
- /**
21
- * @name Error Bubble
22
- */
23
-
24
- class ErrorBubble extends PureComponent {
25
- render() {
26
- const _this$props = this.props,
27
- {
28
- children,
29
- className
30
- } = _this$props,
31
- restProps = _objectWithoutProperties(_this$props, ["children", "className"]);
32
-
33
- const errorBubbleClasses = classNames(modules_ee284100.errorBubble, className);
34
- return /*#__PURE__*/React.createElement("div", {
35
- className: modules_ee284100.errorBubbleWrapper
36
- }, Children.map(children, child => /*#__PURE__*/cloneElement(child, restProps)), restProps.error && /*#__PURE__*/React.createElement(Popup, {
37
- trapFocus: false,
38
- className: modules_ee284100.errorBubblePopup,
39
- hidden: false,
40
- attached: false,
41
- directions: [Directions.RIGHT_CENTER, Directions.RIGHT_BOTTOM, Directions.RIGHT_TOP]
42
- }, /*#__PURE__*/React.createElement("div", {
43
- className: errorBubbleClasses,
44
- "data-test": "ring-error-bubble"
45
- }, restProps.error)));
46
- }
47
-
48
- }
49
-
50
- _defineProperty(ErrorBubble, "propTypes", {
51
- error: PropTypes.string,
52
- className: PropTypes.string,
53
- children: PropTypes.node
54
- });
55
-
56
- export default ErrorBubble;
@@ -1,53 +0,0 @@
1
- import { 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
- import Icon, { Size } from './icon.js';
6
- import 'util-deprecate';
7
- import './_helpers/memoize.js';
8
-
9
- var modules_2c5e8509 = {"errorMessage":"errorMessage_errorMessage__dedf193e","title":"errorMessage_title__dedf193e","description":"errorMessage_description__dedf193e","content":"errorMessage_content__dedf193e","icon":"errorMessage_icon__dedf193e"};
10
-
11
- /**
12
- * @name Error Message
13
- */
14
-
15
- class ErrorMessage extends Component {
16
- render() {
17
- const {
18
- className,
19
- icon,
20
- code,
21
- message,
22
- description,
23
- children
24
- } = this.props;
25
- const classes = classNames(modules_2c5e8509.errorMessage, className);
26
- return /*#__PURE__*/React.createElement("div", {
27
- className: classes
28
- }, icon && /*#__PURE__*/React.createElement(Icon, {
29
- className: modules_2c5e8509.icon,
30
- glyph: icon,
31
- size: Size.Size64,
32
- suppressSizeWarning: true
33
- }), /*#__PURE__*/React.createElement("div", {
34
- className: modules_2c5e8509.content
35
- }, /*#__PURE__*/React.createElement("div", {
36
- className: modules_2c5e8509.title
37
- }, code && `${code}:`, " ", message), description && /*#__PURE__*/React.createElement("div", {
38
- className: modules_2c5e8509.description
39
- }, description), children));
40
- }
41
-
42
- }
43
-
44
- _defineProperty(ErrorMessage, "propTypes", {
45
- icon: PropTypes.oneOfType([PropTypes.string, PropTypes.elementType]),
46
- code: PropTypes.string,
47
- message: PropTypes.string,
48
- description: PropTypes.string,
49
- children: PropTypes.node,
50
- className: PropTypes.string
51
- });
52
-
53
- export default ErrorMessage;
package/dist/footer.js DELETED
@@ -1,124 +0,0 @@
1
- import React, { memo, isValidElement } from 'react';
2
- import PropTypes from 'prop-types';
3
- import classNames from 'classnames';
4
- import Link from './link.js';
5
- import './_helpers/_rollupPluginBabelHelpers.js';
6
- import 'focus-visible';
7
- import './_helpers/memoize.js';
8
- import './_helpers/data-tests.js';
9
- import './_helpers/clickableLink.js';
10
-
11
- var modules_7385b3fd = {"unit":"8px","footer-height":"64px","footer":"footer_footer__468241e7 global_font__0f8f4370","footerFloating":"footer_footerFloating__468241e7 footer_footer__468241e7 global_font__0f8f4370","column":"footer_column__468241e7","columnItem":"footer_columnItem__468241e7","columnLeft":"footer_columnLeft__468241e7 footer_column__468241e7","columnCenter":"footer_columnCenter__468241e7 footer_column__468241e7","line":"footer_line__468241e7","columnRight":"footer_columnRight__468241e7 footer_column__468241e7","lineCenter":"footer_lineCenter__468241e7"};
12
-
13
- const FooterColumn = /*#__PURE__*/memo(function FooterColumn({
14
- position,
15
- children
16
- }) {
17
- const classes = classNames({
18
- [modules_7385b3fd.columnLeft]: position === 'left',
19
- [modules_7385b3fd.columnCenter]: position === 'center',
20
- [modules_7385b3fd.columnRight]: position === 'right'
21
- });
22
- return /*#__PURE__*/React.createElement("div", {
23
- className: classes
24
- }, /*#__PURE__*/React.createElement("ul", {
25
- className: modules_7385b3fd.columnItem
26
- }, children));
27
- });
28
- FooterColumn.propTypes = {
29
- position: PropTypes.string,
30
- children: PropTypes.node
31
- };
32
- /**
33
- * Return copyright string
34
- * @param year {int}
35
- * @returns {string}
36
- */
37
-
38
- function copyright(year) {
39
- const currentYear = new Date().getUTCFullYear();
40
- const ndash = '–';
41
- let ret = 'Copyright © ';
42
-
43
- if (year >= currentYear) {
44
- ret += year;
45
- } else {
46
- ret += year + ndash + currentYear;
47
- }
48
-
49
- return ret;
50
- }
51
- /**
52
- * @constructor
53
- * @extends {ReactComponent}
54
- */
55
-
56
- const FooterLine = /*#__PURE__*/memo(function FooterLine(props) {
57
- const items = Array.isArray(props.item) ? props.item : [props.item];
58
-
59
- function renderItem(item) {
60
- if ( /*#__PURE__*/isValidElement(item)) {
61
- return item;
62
- }
63
-
64
- const element = (item.copyright ? copyright(item.copyright) : '') + (item.label || item);
65
-
66
- if (item.url) {
67
- return /*#__PURE__*/React.createElement(Link, {
68
- href: item.url,
69
- target: item.target,
70
- key: item.url + item.title,
71
- title: item.title
72
- }, element);
73
- }
74
-
75
- return element;
76
- }
77
-
78
- return /*#__PURE__*/React.createElement("li", {
79
- className: modules_7385b3fd.line
80
- }, items.map(renderItem));
81
- });
82
- FooterLine.propTypes = {
83
- item: PropTypes.oneOfType([PropTypes.object, PropTypes.array, PropTypes.string])
84
- };
85
- const Footer = /*#__PURE__*/memo(function Footer({
86
- floating,
87
- className,
88
- left,
89
- center,
90
- right
91
- }) {
92
- function content(elements, position) {
93
- if (!elements) {
94
- return false;
95
- }
96
-
97
- return /*#__PURE__*/React.createElement(FooterColumn, {
98
- key: position,
99
- position: position
100
- }, elements.map((item, idx) => /*#__PURE__*/React.createElement(FooterLine // eslint-disable-next-line react/no-array-index-key
101
- , {
102
- key: idx,
103
- item: item
104
- })));
105
- }
106
-
107
- const classes = classNames(modules_7385b3fd.footer, className, {
108
- [modules_7385b3fd.footerFloating]: floating
109
- });
110
- return /*#__PURE__*/React.createElement("footer", {
111
- className: classes,
112
- "data-test": "ring-footer"
113
- }, [content(left, 'left'), content(center, 'center'), content(right, 'right')]);
114
- });
115
- Footer.propTypes = {
116
- className: PropTypes.string,
117
- floating: PropTypes.bool,
118
- left: PropTypes.array,
119
- center: PropTypes.array,
120
- right: PropTypes.array
121
- };
122
-
123
- export default Footer;
124
- export { copyright };