@jetbrains/ring-ui-built 7.0.65 → 7.0.70

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 (231) hide show
  1. package/components/_helpers/anchor.js +12 -17
  2. package/components/_helpers/avatar-info.js +4 -5
  3. package/components/_helpers/button.classes.js +20 -21
  4. package/components/_helpers/caption.js +3 -3
  5. package/components/_helpers/card.js +26 -32
  6. package/components/_helpers/dialog-body-scroll-preventer.js +1 -2
  7. package/components/_helpers/icon-svg.js +9 -12
  8. package/components/_helpers/input.js +78 -86
  9. package/components/_helpers/loader-core.js +260 -0
  10. package/components/_helpers/query-assist-suggestions.js +0 -1
  11. package/components/_helpers/select-filter.js +19 -26
  12. package/components/_helpers/services-link.js +9 -12
  13. package/components/_helpers/sidebar.js +36 -44
  14. package/components/_helpers/tab-link.js +9 -11
  15. package/components/_helpers/theme.js +20 -24
  16. package/components/_helpers/title.js +12 -17
  17. package/components/alert/alert.js +41 -49
  18. package/components/alert/container.js +9 -12
  19. package/components/alert-service/alert-service.js +23 -32
  20. package/components/analytics/analytics-custom-plugin.js +12 -17
  21. package/components/analytics/analytics.js +1 -3
  22. package/components/auth/auth-core.js +128 -170
  23. package/components/auth/auth.js +3 -10
  24. package/components/auth/background-flow.js +5 -8
  25. package/components/auth/down-notification.js +9 -17
  26. package/components/auth/iframe-flow.js +13 -19
  27. package/components/auth/request-builder.js +4 -9
  28. package/components/auth/response-parser.js +9 -12
  29. package/components/auth/storage.js +12 -18
  30. package/components/auth/token-validator.js +19 -30
  31. package/components/auth/window-flow.js +22 -27
  32. package/components/auth-dialog/auth-dialog.js +40 -48
  33. package/components/auth-dialog-service/auth-dialog-service.js +10 -13
  34. package/components/avatar/avatar.figma.js +6 -6
  35. package/components/avatar/avatar.js +58 -59
  36. package/components/avatar/fallback-avatar.js +8 -11
  37. package/components/avatar-stack/avatar-stack.figma.js +10 -11
  38. package/components/avatar-stack/avatar-stack.js +25 -31
  39. package/components/banner/banner.js +0 -6
  40. package/components/breadcrumbs/breadcrumbs.figma.js +8 -6
  41. package/components/breadcrumbs/breadcrumbs.js +4 -5
  42. package/components/button/button.figma.js +15 -10
  43. package/components/button/button.js +59 -64
  44. package/components/button-group/button-group.js +11 -15
  45. package/components/button-group/caption.js +0 -1
  46. package/components/button-set/button-set.js +9 -12
  47. package/components/button-toolbar/button-toolbar.js +8 -11
  48. package/components/caret/caret.js +20 -28
  49. package/components/checkbox/checkbox-group.figma.js +8 -10
  50. package/components/checkbox/checkbox.figma.js +5 -5
  51. package/components/checkbox/checkbox.js +27 -35
  52. package/components/clipboard/clipboard-fallback.js +3 -3
  53. package/components/clipboard/clipboard.js +3 -16
  54. package/components/code/code.js +8 -14
  55. package/components/collapse/collapse-content.js +10 -15
  56. package/components/collapse/collapse-control.js +5 -7
  57. package/components/collapse/collapse.js +9 -11
  58. package/components/collapse/utils.js +1 -1
  59. package/components/confirm/confirm.js +17 -26
  60. package/components/confirm-service/confirm-service.js +30 -31
  61. package/components/content-layout/content-layout.js +21 -28
  62. package/components/content-layout/sidebar.js +0 -2
  63. package/components/contenteditable/contenteditable.js +23 -28
  64. package/components/control-help/control-help.js +8 -10
  65. package/components/control-label/control-label.js +12 -17
  66. package/components/data-list/data-list.js +57 -65
  67. package/components/data-list/data-list.mock.js +0 -4
  68. package/components/data-list/item.js +65 -72
  69. package/components/data-list/selection.js +11 -19
  70. package/components/data-list/title.js +0 -4
  71. package/components/date-picker/consts.js +3 -4
  72. package/components/date-picker/date-input.js +25 -33
  73. package/components/date-picker/date-picker.js +179 -193
  74. package/components/date-picker/date-popup.js +135 -127
  75. package/components/date-picker/day.d.ts +1 -1
  76. package/components/date-picker/day.js +24 -30
  77. package/components/date-picker/month-names.js +7 -12
  78. package/components/date-picker/month-slider.js +16 -22
  79. package/components/date-picker/month.js +3 -5
  80. package/components/date-picker/months.js +6 -6
  81. package/components/date-picker/weekdays.js +0 -1
  82. package/components/date-picker/years.js +20 -26
  83. package/components/dialog/dialog-body-scroll-preventer.js +0 -1
  84. package/components/dialog/dialog.js +73 -83
  85. package/components/dropdown/anchor.js +0 -4
  86. package/components/dropdown/dropdown.js +98 -114
  87. package/components/dropdown-menu/dropdown-menu.js +80 -79
  88. package/components/editable-heading/editable-heading.js +48 -54
  89. package/components/error-bubble/error-bubble.figma.js +4 -4
  90. package/components/error-bubble/error-bubble.js +9 -13
  91. package/components/error-message/error-message.js +1 -6
  92. package/components/footer/footer.js +11 -15
  93. package/components/global/compose-refs.js +1 -4
  94. package/components/global/compose.js +1 -4
  95. package/components/global/configuration.js +3 -3
  96. package/components/global/controls-height.js +0 -1
  97. package/components/global/create-stateful-context.js +10 -14
  98. package/components/global/data-tests.js +2 -10
  99. package/components/global/dom.js +6 -19
  100. package/components/global/focus-sensor-hoc.js +74 -87
  101. package/components/global/fuzzy-highlight.js +3 -8
  102. package/components/global/get-uid.js +1 -1
  103. package/components/global/inject-styles.js +5 -6
  104. package/components/global/listeners.js +2 -11
  105. package/components/global/memoize.js +0 -2
  106. package/components/global/normalize-indent.js +2 -6
  107. package/components/global/promise-with-timeout.js +4 -5
  108. package/components/global/react-dom-renderer.js +4 -9
  109. package/components/global/rerender-hoc.js +8 -11
  110. package/components/global/schedule-raf.js +1 -2
  111. package/components/global/theme.js +0 -5
  112. package/components/global/trivial-template-tag.js +1 -6
  113. package/components/global/url.js +2 -6
  114. package/components/global/use-event-callback.js +2 -3
  115. package/components/grid/col.js +7 -18
  116. package/components/grid/grid.js +9 -14
  117. package/components/grid/row.js +7 -11
  118. package/components/group/group.js +9 -12
  119. package/components/header/header-icon.js +8 -13
  120. package/components/header/header.js +16 -27
  121. package/components/header/links.js +7 -10
  122. package/components/header/logo.js +12 -16
  123. package/components/header/profile.js +73 -83
  124. package/components/header/services-link.js +0 -2
  125. package/components/header/services.js +32 -43
  126. package/components/header/smart-profile.js +44 -59
  127. package/components/header/smart-services.js +33 -45
  128. package/components/header/tray.js +8 -10
  129. package/components/heading/heading.js +27 -27
  130. package/components/http/http.js +120 -125
  131. package/components/http/http.mock.js +6 -10
  132. package/components/hub-source/hub-source-user.js +6 -13
  133. package/components/hub-source/hub-source-users-groups.js +8 -12
  134. package/components/hub-source/hub-source.js +8 -10
  135. package/components/i18n/i18n-context.js +4 -7
  136. package/components/i18n/i18n.js +5 -5
  137. package/components/icon/icon-svg.js +0 -4
  138. package/components/icon/icon.js +28 -32
  139. package/components/icon/index.js +0 -4
  140. package/components/input/input.figma.js +8 -8
  141. package/components/input/input.js +0 -4
  142. package/components/island/adaptive-island-hoc.js +19 -23
  143. package/components/island/content.js +70 -75
  144. package/components/island/header.js +21 -21
  145. package/components/island/island.js +11 -14
  146. package/components/link/clickable-link.js +30 -37
  147. package/components/link/link.js +27 -29
  148. package/components/list/list-custom.js +6 -11
  149. package/components/list/list-item.js +49 -56
  150. package/components/list/list-separator.js +0 -1
  151. package/components/list/list-title.js +0 -1
  152. package/components/list/list-users-groups-source.js +14 -22
  153. package/components/list/list.classes.js +8 -9
  154. package/components/list/list.js +387 -404
  155. package/components/loader/loader-core.js +2 -265
  156. package/components/loader/loader.d.ts +8 -0
  157. package/components/loader/loader.js +43 -29
  158. package/components/loader-inline/loader-inline.js +9 -12
  159. package/components/loader-screen/loader-screen.js +10 -14
  160. package/components/login-dialog/login-dialog.js +46 -54
  161. package/components/login-dialog/service.js +13 -15
  162. package/components/message/message.js +65 -79
  163. package/components/old-browsers-message/old-browsers-message-stop.js +0 -3
  164. package/components/old-browsers-message/old-browsers-message.js +1 -4
  165. package/components/old-browsers-message/white-list.js +5 -7
  166. package/components/pager/pager.js +73 -88
  167. package/components/panel/panel.js +9 -12
  168. package/components/permissions/permissions-cache.js +6 -8
  169. package/components/permissions/permissions.js +19 -21
  170. package/components/popup/popup.js +136 -145
  171. package/components/popup/popup.target.js +8 -10
  172. package/components/popup/position-css.js +19 -27
  173. package/components/popup/position.js +22 -28
  174. package/components/popup-menu/popup-menu.js +27 -37
  175. package/components/progress-bar/progress-bar.js +26 -32
  176. package/components/query-assist/query-assist-suggestions.js +0 -6
  177. package/components/query-assist/query-assist.js +432 -468
  178. package/components/radio/radio-item.js +30 -40
  179. package/components/radio/radio.js +6 -10
  180. package/components/scrollable-section/scrollable-section.js +7 -10
  181. package/components/select/select-filter.js +0 -6
  182. package/components/select/select-popup.js +155 -174
  183. package/components/select/select.js +464 -479
  184. package/components/shortcuts/core.js +40 -45
  185. package/components/shortcuts/shortcut-title.js +0 -1
  186. package/components/shortcuts/shortcuts-hoc.js +9 -15
  187. package/components/shortcuts/shortcuts.js +3 -5
  188. package/components/slider/slider.js +53 -66
  189. package/components/slider/slider.utils.js +1 -4
  190. package/components/storage/storage-local.js +2 -8
  191. package/components/storage/storage.js +0 -5
  192. package/components/style.css +1 -1
  193. package/components/tab-trap/tab-trap.js +21 -30
  194. package/components/table/cell.js +3 -4
  195. package/components/table/disable-hover-hoc.js +24 -28
  196. package/components/table/header-cell.js +30 -38
  197. package/components/table/header.js +20 -28
  198. package/components/table/multitable.js +81 -101
  199. package/components/table/row-with-focus-sensor.js +17 -28
  200. package/components/table/row.js +89 -99
  201. package/components/table/selection-adapter.js +0 -2
  202. package/components/table/selection-shortcuts-hoc.js +159 -161
  203. package/components/table/selection.js +23 -31
  204. package/components/table/simple-table.js +16 -22
  205. package/components/table/smart-table.js +19 -26
  206. package/components/table/table.js +137 -146
  207. package/components/tabs/collapsible-more.js +34 -47
  208. package/components/tabs/collapsible-tab.js +28 -33
  209. package/components/tabs/collapsible-tabs.js +18 -26
  210. package/components/tabs/custom-item.js +3 -6
  211. package/components/tabs/dumb-tabs.js +48 -64
  212. package/components/tabs/smart-tabs.js +14 -23
  213. package/components/tabs/tab-link.js +0 -2
  214. package/components/tabs/tab.js +0 -1
  215. package/components/tabs/tabs.js +0 -7
  216. package/components/tag/tag.js +30 -35
  217. package/components/tags-input/tags-input.js +192 -218
  218. package/components/tags-list/tags-list.js +26 -31
  219. package/components/text/text.js +16 -19
  220. package/components/toggle/toggle.js +19 -23
  221. package/components/tooltip/tooltip.js +110 -121
  222. package/components/upload/upload.js +19 -28
  223. package/components/user-agreement/service.js +247 -252
  224. package/components/user-agreement/toolbox.eula.js +160 -1
  225. package/components/user-agreement/user-agreement.js +23 -32
  226. package/components/user-card/card.js +0 -5
  227. package/components/user-card/smart-user-card-tooltip.js +41 -50
  228. package/components/user-card/tooltip.js +32 -38
  229. package/components/user-card/user-card.js +0 -5
  230. package/package.json +9 -3
  231. package/components/_helpers/_rollupPluginBabelHelpers.js +0 -72
@@ -1,10 +1,8 @@
1
- import { a as _objectWithoutProperties, b as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
2
1
  import { jsx } from 'react/jsx-runtime';
3
2
  import classNames from 'classnames';
4
3
 
5
4
  var styles = {"label":"ring-control-label-label","formLabel":"ring-control-label-formLabel","secondaryLabel":"ring-control-label-secondaryLabel","disabledLabel":"ring-control-label-disabledLabel"};
6
5
 
7
- const _excluded = ["children", "type", "disabled"];
8
6
  var LabelType;
9
7
  (function (LabelType) {
10
8
  LabelType["SECONDARY"] = "secondary";
@@ -14,20 +12,17 @@ const classNameByType = {
14
12
  [LabelType.SECONDARY]: styles.secondaryLabel,
15
13
  [LabelType.FORM]: styles.formLabel
16
14
  };
17
- const ControlLabel = _ref => {
18
- let {
19
- children,
20
- type = LabelType.SECONDARY,
21
- disabled
22
- } = _ref,
23
- rest = _objectWithoutProperties(_ref, _excluded);
24
- return jsx("label", _objectSpread2(_objectSpread2({
25
- className: classNames(styles.label, classNameByType[type], {
26
- [styles.disabledLabel]: disabled
27
- })
28
- }, rest), {}, {
29
- children: children
30
- }));
31
- };
15
+ const ControlLabel = ({
16
+ children,
17
+ type = LabelType.SECONDARY,
18
+ disabled,
19
+ ...rest
20
+ }) => jsx("label", {
21
+ className: classNames(styles.label, classNameByType[type], {
22
+ [styles.disabledLabel]: disabled
23
+ }),
24
+ ...rest,
25
+ children: children
26
+ });
32
27
 
33
28
  export { ControlLabel, LabelType, ControlLabel as default };
@@ -1,7 +1,5 @@
1
- import { _ as _defineProperty, b as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
2
- import 'core-js/modules/web.dom-collections.iterator.js';
3
- import { jsxs, jsx } from 'react/jsx-runtime';
4
- import { PureComponent, Component } from 'react';
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { Component, PureComponent } from 'react';
5
3
  import classNames from 'classnames';
6
4
  import focusSensorHOC from '../global/focus-sensor-hoc.js';
7
5
  import selectionShortcutsHOC from '../table/selection-shortcuts-hoc.js';
@@ -14,11 +12,10 @@ import { s as styles } from '../_helpers/title.js';
14
12
  import '../global/compose-refs.js';
15
13
  import 'memoize-one';
16
14
  import '../shortcuts/core.js';
17
- import 'core-js/modules/es.regexp.exec.js';
18
15
  import 'combokeys';
19
16
  import '../global/sniffer.js';
20
17
  import 'sniffr';
21
- import '../loader/loader-core.js';
18
+ import '../_helpers/loader-core.js';
22
19
  import '../global/dom.js';
23
20
  import '@jetbrains/icons/chevron-right';
24
21
  import '@jetbrains/icons/chevron-down';
@@ -34,7 +31,6 @@ import 'util-deprecate';
34
31
  import '../icon/icon.js';
35
32
  import '../icon/icon.constants.js';
36
33
  import '../_helpers/icon-svg.js';
37
- import 'core-js/modules/es.string.replace.js';
38
34
  import '../global/memoize.js';
39
35
  import '../global/controls-height.js';
40
36
  import '../global/configuration.js';
@@ -45,49 +41,12 @@ import '@jetbrains/icons/remove-12px';
45
41
  import '../control-help/control-help.js';
46
42
 
47
43
  class DataList extends PureComponent {
48
- constructor() {
49
- super(...arguments);
50
- _defineProperty(this, "shortcutsScope", getUID('ring-data-list-'));
51
- _defineProperty(this, "onItemFocus", item => {
52
- const {
53
- selection,
54
- onSelect
55
- } = this.props;
56
- onSelect(selection.focus(item));
57
- });
58
- _defineProperty(this, "onItemSelect", (item, selected) => {
59
- const {
60
- selection,
61
- onSelect
62
- } = this.props;
63
- if (selected) {
64
- onSelect(selection.select(item));
65
- } else {
66
- onSelect(selection.deselect(item));
67
- }
68
- });
69
- _defineProperty(this, "onEqualPress", () => {
70
- const {
71
- selection,
72
- itemFormatter
73
- } = this.props;
74
- const focused = selection.getFocused();
75
- if (!focused) {
76
- throw new Error('No focused item');
77
- }
78
- const item = itemFormatter(focused);
79
- if (item.collapsed) {
80
- var _item$onExpand;
81
- (_item$onExpand = item.onExpand) === null || _item$onExpand === void 0 || _item$onExpand.call(item);
82
- } else {
83
- var _item$onCollapse;
84
- (_item$onCollapse = item.onCollapse) === null || _item$onCollapse === void 0 || _item$onCollapse.call(item);
85
- }
86
- });
87
- _defineProperty(this, "shortcutsMap", {
88
- '=': this.onEqualPress
89
- });
90
- }
44
+ static defaultProps = {
45
+ loading: false,
46
+ onItemMoreLess: () => {},
47
+ itemMoreLessState: () => moreLessButtonStates.UNUSED,
48
+ remoteSelection: false
49
+ };
91
50
  componentDidUpdate(prevProps) {
92
51
  const {
93
52
  data,
@@ -104,6 +63,44 @@ class DataList extends PureComponent {
104
63
  onSelect(selection.resetSelection());
105
64
  }
106
65
  }
66
+ shortcutsScope = getUID('ring-data-list-');
67
+ onItemFocus = item => {
68
+ const {
69
+ selection,
70
+ onSelect
71
+ } = this.props;
72
+ onSelect(selection.focus(item));
73
+ };
74
+ onItemSelect = (item, selected) => {
75
+ const {
76
+ selection,
77
+ onSelect
78
+ } = this.props;
79
+ if (selected) {
80
+ onSelect(selection.select(item));
81
+ } else {
82
+ onSelect(selection.deselect(item));
83
+ }
84
+ };
85
+ onEqualPress = () => {
86
+ const {
87
+ selection,
88
+ itemFormatter
89
+ } = this.props;
90
+ const focused = selection.getFocused();
91
+ if (focused === null || focused === undefined) {
92
+ throw new Error('No focused item');
93
+ }
94
+ const item = itemFormatter(focused);
95
+ if (item.collapsed) {
96
+ item.onExpand?.();
97
+ } else {
98
+ item.onCollapse?.();
99
+ }
100
+ };
101
+ shortcutsMap = {
102
+ '=': this.onEqualPress
103
+ };
107
104
  render() {
108
105
  const {
109
106
  data,
@@ -115,7 +112,10 @@ class DataList extends PureComponent {
115
112
  focused,
116
113
  innerRef
117
114
  } = this.props;
118
- const shortcutsMap = _objectSpread2(_objectSpread2({}, this.shortcutsMap), this.props.shortcutsMap);
115
+ const shortcutsMap = {
116
+ ...this.shortcutsMap,
117
+ ...this.props.shortcutsMap
118
+ };
119
119
  const classes = classNames(className, {
120
120
  [styles.dataList]: true,
121
121
  [styles.disabledHover]: disabledHover,
@@ -131,7 +131,6 @@ class DataList extends PureComponent {
131
131
  }), jsx("ul", {
132
132
  className: classes,
133
133
  children: data.map(model => {
134
- var _this$props$itemMoreL, _this$props;
135
134
  const item = itemFormatter(model);
136
135
  const {
137
136
  id,
@@ -139,7 +138,7 @@ class DataList extends PureComponent {
139
138
  title,
140
139
  items
141
140
  } = item;
142
- const showMoreLessButton = (_this$props$itemMoreL = (_this$props = this.props).itemMoreLessState) === null || _this$props$itemMoreL === void 0 ? void 0 : _this$props$itemMoreL.call(_this$props, item);
141
+ const showMoreLessButton = this.props.itemMoreLessState?.(item);
143
142
  return jsx(Item, {
144
143
  item: model,
145
144
  title: title,
@@ -167,22 +166,15 @@ class DataList extends PureComponent {
167
166
  });
168
167
  }
169
168
  }
170
- _defineProperty(DataList, "defaultProps", {
171
- loading: false,
172
- onItemMoreLess: () => {},
173
- itemMoreLessState: () => moreLessButtonStates.UNUSED,
174
- remoteSelection: false
175
- });
176
169
  const getContainer = () => disableHoverHOC(selectionShortcutsHOC(focusSensorHOC(DataList)));
177
170
  // eslint-disable-next-line react/no-multi-comp
178
171
  class DataListContainer extends Component {
179
- constructor() {
180
- super(...arguments);
181
- // https://stackoverflow.com/a/53882322/6304152
182
- _defineProperty(this, "DataList", getContainer());
183
- }
172
+ // https://stackoverflow.com/a/53882322/6304152
173
+ DataList = getContainer();
184
174
  render() {
185
- return jsx(this.DataList, _objectSpread2({}, this.props));
175
+ return jsx(this.DataList, {
176
+ ...this.props
177
+ });
186
178
  }
187
179
  }
188
180
 
@@ -1,11 +1,9 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import Link from '../link/link.js';
3
3
  import Tag from '../tag/tag.js';
4
- import '../_helpers/_rollupPluginBabelHelpers.js';
5
4
  import 'react';
6
5
  import 'classnames';
7
6
  import '../global/data-tests.js';
8
- import 'core-js/modules/web.dom-collections.iterator.js';
9
7
  import '../link/clickable-link.js';
10
8
  import '../_helpers/link.js';
11
9
  import '@jetbrains/icons/close-12px';
@@ -13,8 +11,6 @@ import '../icon/icon.js';
13
11
  import 'util-deprecate';
14
12
  import '../icon/icon.constants.js';
15
13
  import '../_helpers/icon-svg.js';
16
- import 'core-js/modules/es.regexp.exec.js';
17
- import 'core-js/modules/es.string.replace.js';
18
14
  import '../global/memoize.js';
19
15
  import '../button/button.js';
20
16
  import '@jetbrains/icons/chevron-down';
@@ -1,5 +1,3 @@
1
- import { _ as _defineProperty } from '../_helpers/_rollupPluginBabelHelpers.js';
2
- import 'core-js/modules/web.dom-collections.iterator.js';
3
1
  import { jsx, jsxs } from 'react/jsx-runtime';
4
2
  import { PureComponent } from 'react';
5
3
  import chevronRightIcon from '@jetbrains/icons/chevron-right';
@@ -18,8 +16,6 @@ import 'util-deprecate';
18
16
  import '../icon/icon.js';
19
17
  import '../icon/icon.constants.js';
20
18
  import '../_helpers/icon-svg.js';
21
- import 'core-js/modules/es.regexp.exec.js';
22
- import 'core-js/modules/es.string.replace.js';
23
19
  import '../global/memoize.js';
24
20
  import '../global/controls-height.js';
25
21
  import '../global/configuration.js';
@@ -43,66 +39,70 @@ var moreLessButtonStates;
43
39
  const ITEM_LEFT_OFFSET = 32;
44
40
  const LIST_LEFT_OFFSET = 24;
45
41
  class Item extends PureComponent {
46
- constructor() {
47
- super(...arguments);
48
- _defineProperty(this, "onShowMore", () => {
49
- const {
50
- onItemMoreLess,
51
- item
52
- } = this.props;
53
- onItemMoreLess(item, true);
54
- });
55
- _defineProperty(this, "onShowLess", () => {
56
- const {
57
- onItemMoreLess,
58
- item
59
- } = this.props;
60
- onItemMoreLess(item, false);
61
- });
62
- _defineProperty(this, "onFocus", () => {
63
- const {
64
- onFocus,
65
- item
66
- } = this.props;
67
- onFocus(item);
68
- });
69
- _defineProperty(this, "onSelect", selected => {
70
- const {
71
- onSelect,
72
- item
73
- } = this.props;
74
- onSelect(item, selected);
75
- });
76
- _defineProperty(this, "renderItem", (model, parentShift) => {
77
- const {
78
- onFocus,
79
- onSelect,
80
- selection,
81
- level,
82
- itemFormatter
83
- } = this.props;
84
- const item = itemFormatter(model);
85
- return jsx(Item, {
86
- item: model,
87
- title: item.title,
88
- items: item.items,
89
- level: level + 1,
90
- parentShift: parentShift,
91
- itemFormatter: itemFormatter,
92
- collapsible: item.collapsible,
93
- collapsed: item.collapsed,
94
- onCollapse: item.onCollapse,
95
- onExpand: item.onExpand,
96
- showFocus: selection.isFocused(model),
97
- onFocus: onFocus,
98
- selection: selection,
99
- selectable: item.selectable,
100
- selected: selection.isSelected(model),
101
- partialSelected: selection.isPartialSelected(model),
102
- onSelect: onSelect
103
- }, item.key || item.id);
104
- });
105
- }
42
+ static defaultProps = {
43
+ items: [],
44
+ level: 0,
45
+ parentShift: 0,
46
+ showMoreLessButton: moreLessButtonStates.UNUSED,
47
+ onItemMoreLess: () => {}
48
+ };
49
+ onShowMore = () => {
50
+ const {
51
+ onItemMoreLess,
52
+ item
53
+ } = this.props;
54
+ onItemMoreLess(item, true);
55
+ };
56
+ onShowLess = () => {
57
+ const {
58
+ onItemMoreLess,
59
+ item
60
+ } = this.props;
61
+ onItemMoreLess(item, false);
62
+ };
63
+ onFocus = () => {
64
+ const {
65
+ onFocus,
66
+ item
67
+ } = this.props;
68
+ onFocus(item);
69
+ };
70
+ onSelect = selected => {
71
+ const {
72
+ onSelect,
73
+ item
74
+ } = this.props;
75
+ onSelect(item, selected);
76
+ };
77
+ renderItem = (model, parentShift) => {
78
+ const {
79
+ onFocus,
80
+ onSelect,
81
+ selection,
82
+ level,
83
+ itemFormatter
84
+ } = this.props;
85
+ const item = itemFormatter(model);
86
+ return jsx(Item, {
87
+ item: model,
88
+ title: item.title,
89
+ items: item.items,
90
+ level: level + 1,
91
+ parentShift: parentShift,
92
+ itemFormatter: itemFormatter,
93
+ collapsible: item.collapsible,
94
+ collapsed: item.collapsed,
95
+ onCollapse: item.onCollapse,
96
+ onExpand: item.onExpand,
97
+ showFocus: selection.isFocused(model),
98
+ onFocus: onFocus,
99
+ selection: selection,
100
+ selectable: item.selectable,
101
+ selected: selection.isSelected(model),
102
+ partialSelected: selection.isPartialSelected(model),
103
+ onSelect: onSelect
104
+ }, item.key || item.id);
105
+ };
106
106
  render() {
107
107
  const {
108
108
  title,
@@ -167,7 +167,7 @@ class Item extends PureComponent {
167
167
  });
168
168
  }
169
169
  }
170
- const itemIsEmpty = !(items !== null && items !== void 0 && items.length) || collapsible && collapsed;
170
+ const itemIsEmpty = !items?.length || collapsible && collapsed;
171
171
  const offset = level * LIST_LEFT_OFFSET + ITEM_LEFT_OFFSET + parentShift;
172
172
  return jsxs("li", {
173
173
  children: [jsx(Title, {
@@ -191,12 +191,5 @@ class Item extends PureComponent {
191
191
  });
192
192
  }
193
193
  }
194
- _defineProperty(Item, "defaultProps", {
195
- items: [],
196
- level: 0,
197
- parentShift: 0,
198
- showMoreLessButton: moreLessButtonStates.UNUSED,
199
- onItemMoreLess: () => {}
200
- });
201
194
 
202
195
  export { Item as default, moreLessButtonStates };
@@ -1,17 +1,12 @@
1
- import { a as _objectWithoutProperties, _ as _defineProperty } from '../_helpers/_rollupPluginBabelHelpers.js';
2
- import 'core-js/modules/web.dom-collections.iterator.js';
3
1
  import Selection$1 from '../table/selection.js';
4
2
 
5
- const _excluded = ["partialSelected"],
6
- _excluded2 = ["partialSelected"];
7
3
  class Selection extends Selection$1 {
8
- constructor(_ref) {
9
- let {
10
- partialSelected = new Set()
11
- } = _ref,
12
- props = _objectWithoutProperties(_ref, _excluded);
4
+ _partialSelected;
5
+ constructor({
6
+ partialSelected = new Set(),
7
+ ...props
8
+ }) {
13
9
  super(props);
14
- _defineProperty(this, "_partialSelected", void 0);
15
10
  this._partialSelected = partialSelected;
16
11
  }
17
12
  _buildData(data) {
@@ -78,8 +73,7 @@ class Selection extends Selection$1 {
78
73
  selected.delete(ancestor);
79
74
  });
80
75
  }
81
- select() {
82
- let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._focused;
76
+ select(value = this._focused) {
83
77
  if (!value || !this._isItemSelectable(value)) {
84
78
  return this;
85
79
  }
@@ -103,11 +97,10 @@ class Selection extends Selection$1 {
103
97
  resetSelection() {
104
98
  return super.resetSelection();
105
99
  }
106
- cloneWith(_ref2) {
107
- let {
108
- partialSelected = this._partialSelected
109
- } = _ref2,
110
- rest = _objectWithoutProperties(_ref2, _excluded2);
100
+ cloneWith({
101
+ partialSelected = this._partialSelected,
102
+ ...rest
103
+ }) {
111
104
  const parentClone = super.cloneWith(rest);
112
105
  return new this.constructor({
113
106
  // eslint-disable-next-line no-underscore-dangle
@@ -125,8 +118,7 @@ class Selection extends Selection$1 {
125
118
  partialSelected
126
119
  });
127
120
  }
128
- deselect() {
129
- let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._focused;
121
+ deselect(value = this._focused) {
130
122
  if (!value || !this._isItemSelectable(value)) {
131
123
  return this;
132
124
  }
@@ -1,5 +1,3 @@
1
- import '../_helpers/_rollupPluginBabelHelpers.js';
2
- import 'core-js/modules/web.dom-collections.iterator.js';
3
1
  import 'react/jsx-runtime';
4
2
  import 'react';
5
3
  import 'classnames';
@@ -15,7 +13,5 @@ import '../icon/icon.js';
15
13
  import 'util-deprecate';
16
14
  import '../icon/icon.constants.js';
17
15
  import '../_helpers/icon-svg.js';
18
- import 'core-js/modules/es.regexp.exec.js';
19
- import 'core-js/modules/es.string.replace.js';
20
16
  import '../global/memoize.js';
21
17
  import '../control-help/control-help.js';
@@ -1,4 +1,3 @@
1
- import 'core-js/modules/es.regexp.exec.js';
2
1
  import { add } from 'date-fns/add';
3
2
 
4
3
  const unit = 8; // px;
@@ -35,7 +34,7 @@ function parseTime(time) {
35
34
  if (/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(time)) {
36
35
  result = time;
37
36
  } else if (/^([0-9]|2[0-3]):[0-5][0-9]$/.test(time)) {
38
- result = "0".concat(time);
37
+ result = `0${time}`;
39
38
  }
40
39
  return result;
41
40
  }
@@ -44,8 +43,8 @@ function shiftWeekArray(arr, startOfWeek) {
44
43
  return arr.slice(shiftTimes).concat(arr.slice(0, shiftTimes));
45
44
  }
46
45
  function getWeekStartsOn(locale) {
47
- var _locale$options$weekS, _locale$options;
48
- return (_locale$options$weekS = locale === null || locale === void 0 || (_locale$options = locale.options) === null || _locale$options === void 0 ? void 0 : _locale$options.weekStartsOn) !== null && _locale$options$weekS !== void 0 ? _locale$options$weekS : weekdays.MO;
46
+ var _locale$options$weekS;
47
+ return (_locale$options$weekS = locale?.options?.weekStartsOn) !== null && _locale$options$weekS !== void 0 ? _locale$options$weekS : weekdays.MO;
49
48
  }
50
49
  function getDayNumInWeek(locale, day) {
51
50
  const weekDays = shiftWeekArray(Object.values(weekdays), getWeekStartsOn(locale));
@@ -1,7 +1,3 @@
1
- import { _ as _defineProperty } from '../_helpers/_rollupPluginBabelHelpers.js';
2
- import 'core-js/modules/es.regexp.exec.js';
3
- import 'core-js/modules/es.string.replace.js';
4
- import 'core-js/modules/web.dom-collections.iterator.js';
5
1
  import { jsx } from 'react/jsx-runtime';
6
2
  import * as React from 'react';
7
3
  import classNames from 'classnames';
@@ -29,24 +25,6 @@ import '../control-help/control-help.js';
29
25
  import '../i18n/i18n.js';
30
26
 
31
27
  class DateInput extends React.PureComponent {
32
- constructor() {
33
- super(...arguments);
34
- _defineProperty(this, "input", void 0);
35
- _defineProperty(this, "inputRef", el => {
36
- this.input = el;
37
- });
38
- _defineProperty(this, "handleChange", e => this.props.onInput(e.currentTarget.value, e.currentTarget.dataset.name));
39
- _defineProperty(this, "handleKeyDown", e => {
40
- if (e.key === 'Enter') {
41
- // We have to prevent the default behavior, because restoring focus by TabTrap caused by
42
- // pressing Enter will trigger the onClick event on the DatePicker Dropdown anchor,
43
- // so DatePicker will be open again.
44
- // https://youtrack.jetbrains.com/issue/RG-2450/Anchor-should-be-focused-after-closing-datepicker#focus=Comments-27-10044234.0-0.
45
- e.preventDefault();
46
- this.props.onConfirm();
47
- }
48
- });
49
- }
50
28
  componentDidMount() {
51
29
  this.updateInput(this.props);
52
30
  }
@@ -62,11 +40,15 @@ class DateInput extends React.PureComponent {
62
40
  });
63
41
  }
64
42
  }
65
- updateInput(_ref) {
66
- let {
67
- text,
68
- active
69
- } = _ref;
43
+ static contextType = I18nContext;
44
+ input;
45
+ inputRef = el => {
46
+ this.input = el;
47
+ };
48
+ updateInput({
49
+ text,
50
+ active
51
+ }) {
70
52
  const el = this.input;
71
53
  if (!el) {
72
54
  return;
@@ -80,6 +62,17 @@ class DateInput extends React.PureComponent {
80
62
  el.blur();
81
63
  }
82
64
  }
65
+ handleChange = e => this.props.onInput(e.currentTarget.value, e.currentTarget.dataset.name);
66
+ handleKeyDown = e => {
67
+ if (e.key === 'Enter') {
68
+ // We have to prevent the default behavior, because restoring focus by TabTrap caused by
69
+ // pressing Enter will trigger the onClick event on the DatePicker Dropdown anchor,
70
+ // so DatePicker will be open again.
71
+ // https://youtrack.jetbrains.com/issue/RG-2450/Anchor-should-be-focused-after-closing-datepicker#focus=Comments-27-10044234.0-0.
72
+ e.preventDefault();
73
+ this.props.onConfirm();
74
+ }
75
+ };
83
76
  render() {
84
77
  const {
85
78
  active,
@@ -114,16 +107,16 @@ class DateInput extends React.PureComponent {
114
107
  const placeholder = ((_translations$addFirs, _translations$addSeco, _translations$addTime, _translations$selectN) => {
115
108
  switch (name) {
116
109
  case 'from':
117
- return fromPlaceholder || ((_translations$addFirs = translations === null || translations === void 0 ? void 0 : translations.addFirstDate) !== null && _translations$addFirs !== void 0 ? _translations$addFirs : translate('addFirstDate'));
110
+ return fromPlaceholder || ((_translations$addFirs = translations?.addFirstDate) !== null && _translations$addFirs !== void 0 ? _translations$addFirs : translate('addFirstDate'));
118
111
  case 'to':
119
- return toPlaceholder || ((_translations$addSeco = translations === null || translations === void 0 ? void 0 : translations.addSecondDate) !== null && _translations$addSeco !== void 0 ? _translations$addSeco : translate('addSecondDate'));
112
+ return toPlaceholder || ((_translations$addSeco = translations?.addSecondDate) !== null && _translations$addSeco !== void 0 ? _translations$addSeco : translate('addSecondDate'));
120
113
  case 'time':
121
- return timePlaceholder || ((_translations$addTime = translations === null || translations === void 0 ? void 0 : translations.addTime) !== null && _translations$addTime !== void 0 ? _translations$addTime : translate('addTime'));
114
+ return timePlaceholder || ((_translations$addTime = translations?.addTime) !== null && _translations$addTime !== void 0 ? _translations$addTime : translate('addTime'));
122
115
  default:
123
- return ((_translations$selectN = translations === null || translations === void 0 ? void 0 : translations.selectName) !== null && _translations$selectN !== void 0 ? _translations$selectN : translate('selectName')).replace('%name%', name).replace('{{name}}', name);
116
+ return ((_translations$selectN = translations?.selectName) !== null && _translations$selectN !== void 0 ? _translations$selectN : translate('selectName')).replace('%name%', name).replace('{{name}}', name);
124
117
  }
125
118
  })();
126
- const classes = classNames(styles.filter, styles["".concat(name, "Input")], divider && styles["".concat(name, "InputWithDivider")], 'ring-js-shortcuts');
119
+ const classes = classNames(styles.filter, styles[`${name}Input`], divider && styles[`${name}InputWithDivider`], 'ring-js-shortcuts');
127
120
  return jsx(Input, {
128
121
  autoComplete: 'off',
129
122
  borderless: true,
@@ -140,6 +133,5 @@ class DateInput extends React.PureComponent {
140
133
  });
141
134
  }
142
135
  }
143
- _defineProperty(DateInput, "contextType", I18nContext);
144
136
 
145
137
  export { DateInput as default };