@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/avatar.js DELETED
@@ -1,152 +0,0 @@
1
- import { b as _defineProperty, _ as _objectWithoutProperties, c as _objectSpread2, a as _extends } from './_helpers/_rollupPluginBabelHelpers.js';
2
- import React, { PureComponent } from 'react';
3
- import PropTypes from 'prop-types';
4
- import classNames from 'classnames';
5
- import { i as isDataURI, p as parseQueryString, e as encodeURL } from './_helpers/url.js';
6
- import { a as getPixelRatio } from './_helpers/dom.js';
7
-
8
- var modules_61ca8c75 = {"avatar":"avatar_avatar__fcab4239","subavatar":"avatar_subavatar__fcab4239","empty":"avatar_empty__fcab4239"};
9
-
10
- /**
11
- * @name Avatar
12
- */
13
-
14
- const Size = {
15
- Size18: 18,
16
- Size20: 20,
17
- Size24: 24,
18
- Size32: 32,
19
- Size40: 40,
20
- Size48: 48,
21
- Size56: 56
22
- };
23
- class Avatar extends PureComponent {
24
- constructor(...args) {
25
- super(...args);
26
-
27
- _defineProperty(this, "state", {
28
- errorUrl: ''
29
- });
30
-
31
- _defineProperty(this, "handleError", () => {
32
- this.setState({
33
- errorUrl: this.props.url
34
- });
35
- });
36
-
37
- _defineProperty(this, "handleSuccess", () => {
38
- this.setState({
39
- errorUrl: ''
40
- });
41
- });
42
- }
43
-
44
- render() {
45
- const _this$props = this.props,
46
- {
47
- size,
48
- url,
49
- dpr,
50
- style,
51
- round,
52
- subavatar,
53
- subavatarSize
54
- } = _this$props,
55
- restProps = _objectWithoutProperties(_this$props, ["size", "url", "dpr", "style", "round", "subavatar", "subavatarSize"]);
56
-
57
- const sizeString = `${size}px`;
58
- const subavatarSizeString = `${subavatarSize}px`;
59
- const borderRadius = size <= Size.Size18 ? 'var(--ring-border-radius-small)' : 'var(--ring-border-radius)';
60
-
61
- const styleObj = _objectSpread2({
62
- borderRadius: round ? '50%' : borderRadius,
63
- height: sizeString,
64
- width: sizeString
65
- }, style);
66
-
67
- const styleObjGroup = _objectSpread2({
68
- borderRadius: '2px',
69
- height: subavatarSizeString,
70
- width: subavatarSizeString
71
- }, style);
72
-
73
- if (!url || this.state.errorUrl === url) {
74
- return /*#__PURE__*/React.createElement("span", _extends({}, restProps, {
75
- className: classNames(modules_61ca8c75.avatar, modules_61ca8c75.empty, this.props.className),
76
- style: styleObj
77
- }));
78
- }
79
-
80
- let src = url;
81
-
82
- if (!isDataURI(url)) {
83
- const [urlStart, query] = url.split('?');
84
-
85
- const queryParams = _objectSpread2(_objectSpread2({}, parseQueryString(query)), {}, {
86
- dpr,
87
- size
88
- });
89
-
90
- src = encodeURL(urlStart, queryParams);
91
- }
92
-
93
- let subavatarSrc = null;
94
-
95
- if (subavatar && !isDataURI(subavatar)) {
96
- const [urlStart, query] = subavatar.split('?');
97
-
98
- const queryParams = _objectSpread2(_objectSpread2({}, parseQueryString(query)), {}, {
99
- dpr,
100
- subavatarSizeString
101
- });
102
-
103
- subavatarSrc = encodeURL(urlStart, queryParams);
104
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("img", _extends({}, restProps, {
105
- onError: this.handleError,
106
- onLoad: this.handleSuccess,
107
- className: classNames(modules_61ca8c75.avatar, this.props.className),
108
- style: styleObj,
109
- src: src,
110
- alt: "User avatar"
111
- })), /*#__PURE__*/React.createElement("img", _extends({}, restProps, {
112
- onError: this.handleError,
113
- onLoad: this.handleSuccess,
114
- className: classNames(modules_61ca8c75.subavatar),
115
- style: styleObjGroup,
116
- src: subavatarSrc,
117
- alt: "Subavatar"
118
- })));
119
- } else {
120
- return /*#__PURE__*/React.createElement("img", _extends({}, restProps, {
121
- onError: this.handleError,
122
- onLoad: this.handleSuccess,
123
- className: classNames(modules_61ca8c75.avatar, this.props.className),
124
- style: styleObj,
125
- src: src,
126
- alt: "User avatar"
127
- }));
128
- }
129
- }
130
-
131
- }
132
-
133
- _defineProperty(Avatar, "propTypes", {
134
- dpr: PropTypes.number,
135
- className: PropTypes.string,
136
- size: PropTypes.number,
137
- style: PropTypes.object,
138
- url: PropTypes.string,
139
- round: PropTypes.bool,
140
- subavatar: PropTypes.string,
141
- subavatarSize: PropTypes.number
142
- });
143
-
144
- _defineProperty(Avatar, "defaultProps", {
145
- dpr: getPixelRatio(),
146
- size: Size.Size20,
147
- subavatarSize: Size.Size20 / 2,
148
- style: {}
149
- });
150
-
151
- export default Avatar;
152
- export { Size };
package/dist/badge.js DELETED
@@ -1,52 +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 { j as joinDataTestAttributes } from './_helpers/data-tests.js';
6
- import { m as modules_6c9187df } from './_helpers/badge.js';
7
-
8
- /**
9
- * @name Badge
10
- */
11
-
12
- class Badge extends PureComponent {
13
- render() {
14
- const _this$props = this.props,
15
- {
16
- // Modifiers
17
- gray,
18
- valid,
19
- invalid,
20
- disabled,
21
- // Props
22
- className,
23
- children,
24
- 'data-test': dataTest
25
- } = _this$props,
26
- props = _objectWithoutProperties(_this$props, ["gray", "valid", "invalid", "disabled", "className", "children", "data-test"]);
27
-
28
- const classes = classNames(modules_6c9187df.badge, className, {
29
- [modules_6c9187df.gray]: gray,
30
- [modules_6c9187df.valid]: valid,
31
- [modules_6c9187df.invalid]: invalid,
32
- [modules_6c9187df.disabled]: disabled
33
- });
34
- return /*#__PURE__*/React.createElement("span", _extends({}, props, {
35
- "data-test": joinDataTestAttributes('ring-badge', dataTest),
36
- className: classes
37
- }), children);
38
- }
39
-
40
- }
41
-
42
- _defineProperty(Badge, "propTypes", {
43
- gray: PropTypes.bool,
44
- valid: PropTypes.bool,
45
- invalid: PropTypes.bool,
46
- disabled: PropTypes.bool,
47
- className: PropTypes.string,
48
- children: PropTypes.node,
49
- 'data-test': PropTypes.string
50
- });
51
-
52
- export default Badge;
@@ -1,48 +0,0 @@
1
- import { 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
-
6
- var modules_1068e447 = {"unit":"8px","buttonGroup":"buttonGroup_buttonGroup__e33e6cf7 buttonToolbar_buttonGroup__ec743009","button":"buttonGroup_button__e33e6cf7","caption":"buttonGroup_caption__e33e6cf7 global_font__0f8f4370","active":"buttonGroup_active__e33e6cf7"};
7
-
8
- class Caption extends PureComponent {
9
- render() {
10
- const {
11
- className
12
- } = this.props;
13
- const classes = classNames(modules_1068e447.caption, className);
14
- return /*#__PURE__*/React.createElement("span", _extends({}, this.props, {
15
- className: classes
16
- }));
17
- }
18
-
19
- }
20
-
21
- _defineProperty(Caption, "propTypes", {
22
- className: PropTypes.node
23
- });
24
-
25
- /**
26
- * @name Button Group
27
- */
28
-
29
- class ButtonGroup extends PureComponent {
30
- render() {
31
- const {
32
- className
33
- } = this.props;
34
- const classes = classNames(modules_1068e447.buttonGroup, className);
35
- return /*#__PURE__*/React.createElement("div", _extends({}, this.props, {
36
- className: classes
37
- }));
38
- }
39
-
40
- }
41
-
42
- _defineProperty(ButtonGroup, "propTypes", {
43
- children: PropTypes.node,
44
- className: PropTypes.string
45
- });
46
-
47
- export default ButtonGroup;
48
- export { Caption };
@@ -1,27 +0,0 @@
1
- import { a as _extends, b as _defineProperty } from './_helpers/_rollupPluginBabelHelpers.js';
2
- import React, { PureComponent } from 'react';
3
- import classNames from 'classnames';
4
- import PropTypes from 'prop-types';
5
-
6
- var modules_fd849143 = {"unit":"8px","buttonSet":"buttonSet_buttonSet__40c7f807","button":"buttonSet_button__40c7f807"};
7
-
8
- /**
9
- * @name Button Set
10
- */
11
-
12
- class ButtonSet extends PureComponent {
13
- render() {
14
- const classes = classNames(modules_fd849143.buttonSet, this.props.className);
15
- return /*#__PURE__*/React.createElement("div", _extends({}, this.props, {
16
- className: classes
17
- }), this.props.children);
18
- }
19
-
20
- }
21
-
22
- _defineProperty(ButtonSet, "propTypes", {
23
- children: PropTypes.node,
24
- className: PropTypes.string
25
- });
26
-
27
- export default ButtonSet;
@@ -1,30 +0,0 @@
1
- import { 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
-
6
- var modules_34154ec0 = {"unit":"8px","buttonToolbar":"buttonToolbar_buttonToolbar__ec743009","button":"buttonToolbar_button__ec743009","buttonGroup":"buttonToolbar_buttonGroup__ec743009"};
7
-
8
- /**
9
- * @name Button Toolbar
10
- */
11
-
12
- class ButtonToolbar extends PureComponent {
13
- render() {
14
- const {
15
- className
16
- } = this.props;
17
- const classes = classNames(modules_34154ec0.buttonToolbar, className);
18
- return /*#__PURE__*/React.createElement("div", _extends({}, this.props, {
19
- className: classes
20
- }));
21
- }
22
-
23
- }
24
-
25
- _defineProperty(ButtonToolbar, "propTypes", {
26
- children: PropTypes.node,
27
- className: PropTypes.string
28
- });
29
-
30
- export default ButtonToolbar;
package/dist/button.js DELETED
@@ -1,12 +0,0 @@
1
- import './_helpers/_rollupPluginBabelHelpers.js';
2
- import 'focus-visible';
3
- import 'react';
4
- import 'prop-types';
5
- import 'classnames';
6
- import '@jetbrains/icons/chevron-10px';
7
- export { Size as IconSize } from './icon.js';
8
- import './_helpers/theme.js';
9
- import './_helpers/clickableLink.js';
10
- export { B as default } from './_helpers/button.js';
11
- import 'util-deprecate';
12
- import './_helpers/memoize.js';
package/dist/caret.js DELETED
@@ -1,262 +0,0 @@
1
- import { b as _defineProperty } from './_helpers/_rollupPluginBabelHelpers.js';
2
- import { g as getRect } from './_helpers/dom.js';
3
-
4
- /**
5
- * @name Caret
6
- */
7
-
8
- class Caret {
9
- /**
10
- * Line endings RegExp
11
- * @type {RegExp}
12
- */
13
-
14
- /**
15
- * Line endings normalizer
16
- * Borrowed from jQuery
17
- * @see https://github.com/jquery/jquery/blob/master/src/attributes/val.js
18
- * @param value {*}
19
- * @return {*}
20
- */
21
- static normalizeNewlines(value) {
22
- return typeof value === 'string' ? value.replace(this.returnRE, '') : value;
23
- }
24
-
25
- constructor(target) {
26
- this.target = target;
27
- }
28
-
29
- isContentEditable() {
30
- return this.target.contentEditable === 'true';
31
- }
32
- /**
33
- * Set focus on target if possible
34
- */
35
-
36
-
37
- focus() {
38
- if (!document.activeElement || document.activeElement !== this.target) {
39
- this.target.focus();
40
- }
41
- }
42
- /**
43
- * Get absolute caret position index
44
- * @return {number}
45
- */
46
-
47
-
48
- getAbsolutePosition(node) {
49
- let _curNode = node;
50
- let curPos = 0;
51
-
52
- while (_curNode !== this.target) {
53
- while (_curNode.previousSibling) {
54
- curPos += _curNode.previousSibling.textContent.length;
55
- _curNode = _curNode.previousSibling;
56
- }
57
-
58
- _curNode = _curNode.parentNode;
59
- }
60
-
61
- return curPos;
62
- }
63
- /**
64
- * Get caret position index
65
- * @param {Object} [params]
66
- * @param {boolean} params.avoidFocus
67
- * @return {number}
68
- */
69
-
70
-
71
- getPosition(params = {}) {
72
- if (this.isContentEditable()) {
73
- if (!params.avoidFocus) {
74
- this.focus();
75
- }
76
-
77
- const selection = window.getSelection();
78
-
79
- if (!selection.rangeCount) {
80
- return 0;
81
- }
82
-
83
- const range1 = selection.getRangeAt(0);
84
- const range2 = range1.cloneRange();
85
- range2.selectNodeContents(this.target);
86
- range2.setEnd(range1.endContainer, range1.endOffset);
87
- const _curNode = range1.startContainer;
88
-
89
- if (this.target === _curNode) {
90
- return range1.startOffset === 0 ? 0 : _curNode.textContent.length;
91
- } else if (!this.target.contains(_curNode)) {
92
- return -1;
93
- } else if (!_curNode) {
94
- return this.target.selectionStart;
95
- }
96
-
97
- const curPos = this.getAbsolutePosition(_curNode);
98
-
99
- if (range1.startContainer === range1.endContainer) {
100
- if (range1.startOffset === range1.endOffset) {
101
- return curPos + range1.startOffset;
102
- } else {
103
- return {
104
- startOffset: curPos + range1.startOffset,
105
- endOffset: curPos + range1.endOffset,
106
- position: range2.toString().length
107
- };
108
- }
109
- } else {
110
- const startOffset = curPos + range1.startOffset;
111
- const endPos = this.getAbsolutePosition(range1.endContainer);
112
- const endOffset = endPos + range1.endOffset;
113
- return {
114
- startOffset,
115
- endOffset,
116
- position: range2.toString().length
117
- };
118
- }
119
- }
120
-
121
- return this.target.selectionStart;
122
- }
123
- /**
124
- * Get relative position of query
125
- * @param {Node} curNode
126
- * @param {number} position
127
- * @return {{_correctedPosition: number, _curNode: Node}}
128
- */
129
-
130
-
131
- getRelativePosition(curNode, position) {
132
- let curPos = 0;
133
- let _curNode = curNode;
134
- const nodeTypeText = 3;
135
-
136
- if (!_curNode) {
137
- return {
138
- _curNode: this.target,
139
- _correctedPosition: position
140
- };
141
- }
142
-
143
- if (position === 0) {
144
- while (_curNode.nodeType !== nodeTypeText) {
145
- _curNode = _curNode.childNodes[0];
146
- }
147
-
148
- const _correctedPosition = position;
149
- return {
150
- _curNode,
151
- _correctedPosition
152
- };
153
- }
154
-
155
- let i = -1;
156
-
157
- if (_curNode && _curNode.nodeType !== undefined) {
158
- while (curPos < position && _curNode.nodeType !== nodeTypeText) {
159
- i++;
160
-
161
- if (_curNode.childNodes[i] !== null && _curNode.childNodes[i]) {
162
- curPos += _curNode.childNodes[i].textContent.length;
163
-
164
- if (curPos >= position) {
165
- _curNode = _curNode.childNodes[i];
166
- curPos -= _curNode.textContent.length;
167
- i = -1;
168
- }
169
- } else {
170
- break;
171
- }
172
- }
173
- }
174
-
175
- const _correctedPosition = position - curPos;
176
-
177
- return {
178
- _curNode,
179
- _correctedPosition
180
- };
181
- }
182
- /**
183
- * Set caret position index
184
- * @param {number} position
185
- * @return {number}
186
- */
187
-
188
-
189
- setPosition(position) {
190
- const isContentEditable = this.isContentEditable();
191
- let correctedPosition;
192
- let curNode = this.target && this.target.childNodes[0];
193
-
194
- if (position !== undefined) {
195
- if (position.startOffset !== undefined) {
196
- const range = new Range();
197
- const start = this.getRelativePosition(curNode, position.startOffset);
198
- range.setStart(start._curNode, start._correctedPosition);
199
- const end = this.getRelativePosition(curNode, position.endOffset);
200
- range.setEnd(end._curNode, end._correctedPosition);
201
- correctedPosition = range;
202
- } else if (position === -1) {
203
- const value = isContentEditable ? this.target.textContent : this.constructor.normalizeNewlines(this.target.value);
204
- correctedPosition = value.length;
205
- } else {
206
- const {
207
- _curNode,
208
- _correctedPosition
209
- } = this.getRelativePosition(curNode, position);
210
- curNode = _curNode;
211
- correctedPosition = _correctedPosition;
212
- }
213
- }
214
-
215
- if (isContentEditable) {
216
- this.focus();
217
-
218
- try {
219
- if (correctedPosition instanceof Range) {
220
- window.getSelection().removeAllRanges();
221
- window.getSelection().addRange(correctedPosition);
222
- } else {
223
- window.getSelection().collapse(curNode || this.target, correctedPosition);
224
- }
225
- } catch (e) {// Do nothing
226
- }
227
- } else {
228
- this.target.setSelectionRange(correctedPosition, correctedPosition);
229
- }
230
-
231
- return correctedPosition;
232
- }
233
- /**
234
- * Get caret position in pixels
235
- * @return {number}
236
- */
237
-
238
-
239
- getOffset() {
240
- let offset = 0;
241
- let range;
242
-
243
- try {
244
- // Both statements may throw
245
- range = window.getSelection().getRangeAt(0).cloneRange();
246
- range.setStart(range.startContainer, range.startOffset - 1);
247
- } catch (e) {
248
- return offset;
249
- }
250
-
251
- if (range && range.endOffset !== 0 && range.toString() !== '') {
252
- offset = getRect(range).right - getRect(this.target).left - (range.startContainer.offsetLeft || 0);
253
- }
254
-
255
- return offset;
256
- }
257
-
258
- }
259
-
260
- _defineProperty(Caret, "returnRE", /\r/g);
261
-
262
- export default Caret;
package/dist/checkbox.js DELETED
@@ -1,108 +0,0 @@
1
- import { b as _defineProperty, _ as _objectWithoutProperties, a as _extends } from './_helpers/_rollupPluginBabelHelpers.js';
2
- import React, { PureComponent } from 'react';
3
- import PropTypes from 'prop-types';
4
- import classNames from 'classnames';
5
- import checkmarkIcon from '@jetbrains/icons/checkmark';
6
- import minusIcon from '@jetbrains/icons/remove-10px';
7
- import Icon from './icon.js';
8
- import 'util-deprecate';
9
- import './_helpers/memoize.js';
10
-
11
- var modules_3199090e = {"unit":"8px","checkboxSize":"14px","checkbox":"checkbox_checkbox__50df3ed7","cell":"checkbox_cell__50df3ed7","icon":"checkbox_icon__50df3ed7","check":"checkbox_check__50df3ed7 checkbox_icon__50df3ed7","minus":"checkbox_minus__50df3ed7 checkbox_icon__50df3ed7","input":"checkbox_input__50df3ed7","focus":"checkbox_focus__50df3ed7","label":"checkbox_label__50df3ed7"};
12
-
13
- /**
14
- * @name Checkbox
15
- */
16
-
17
- /**
18
- * Displays a checkbox.
19
- */
20
-
21
- class Checkbox extends PureComponent {
22
- constructor(...args) {
23
- super(...args);
24
-
25
- _defineProperty(this, "inputRef", el => {
26
- if (el != null) {
27
- el.indeterminate = this.props.indeterminate;
28
- }
29
-
30
- this.input = el;
31
- });
32
- }
33
-
34
- componentDidMount() {
35
- if (this.input != null) {
36
- this.input.indeterminate = this.props.indeterminate;
37
- }
38
- }
39
-
40
- componentDidUpdate(prevProps) {
41
- const {
42
- indeterminate
43
- } = this.props;
44
-
45
- if (this.input != null && indeterminate !== prevProps.indeterminate) {
46
- this.input.indeterminate = this.props.indeterminate;
47
- }
48
- }
49
-
50
- render() {
51
- const _this$props = this.props,
52
- {
53
- children,
54
- label,
55
- className,
56
- containerClassName,
57
- containerStyle,
58
- cellClassName,
59
- labelClassName,
60
- indeterminate
61
- } = _this$props,
62
- restProps = _objectWithoutProperties(_this$props, ["children", "label", "className", "containerClassName", "containerStyle", "cellClassName", "labelClassName", "indeterminate"]);
63
-
64
- const classes = classNames(modules_3199090e.input, className);
65
- const containerClasses = classNames(modules_3199090e.checkbox, containerClassName);
66
- const cellClasses = classNames(modules_3199090e.cell, cellClassName);
67
- const labelClasses = classNames(modules_3199090e.label, labelClassName);
68
- return /*#__PURE__*/React.createElement("label", {
69
- className: containerClasses,
70
- style: containerStyle,
71
- "data-test": "ring-checkbox"
72
- }, /*#__PURE__*/React.createElement("input", _extends({}, restProps, {
73
- "data-checked": restProps.checked,
74
- ref: this.inputRef,
75
- type: "checkbox",
76
- className: classes
77
- })), /*#__PURE__*/React.createElement("span", {
78
- className: cellClasses
79
- }, /*#__PURE__*/React.createElement(Icon, {
80
- glyph: checkmarkIcon,
81
- className: modules_3199090e.check
82
- }), /*#__PURE__*/React.createElement(Icon, {
83
- glyph: minusIcon,
84
- className: modules_3199090e.minus
85
- })), /*#__PURE__*/React.createElement("span", {
86
- className: labelClasses
87
- }, label || children));
88
- }
89
-
90
- }
91
-
92
- _defineProperty(Checkbox, "propTypes", {
93
- name: PropTypes.string,
94
- label: PropTypes.string,
95
- className: PropTypes.string,
96
- containerClassName: PropTypes.string,
97
- containerStyle: PropTypes.object,
98
- cellClassName: PropTypes.string,
99
- labelClassName: PropTypes.string,
100
- defaultChecked: PropTypes.bool,
101
- checked: PropTypes.bool,
102
- indeterminate: PropTypes.bool,
103
- disabled: PropTypes.bool,
104
- onChange: PropTypes.func,
105
- children: PropTypes.node
106
- });
107
-
108
- export default Checkbox;