@jetbrains/ring-ui-built 7.0.66 → 7.0.71
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.
- package/components/_helpers/anchor.js +12 -17
- package/components/_helpers/avatar-info.js +4 -5
- package/components/_helpers/button.classes.js +20 -21
- package/components/_helpers/caption.js +3 -3
- package/components/_helpers/card.js +26 -32
- package/components/_helpers/dialog-body-scroll-preventer.js +1 -2
- package/components/_helpers/icon-svg.js +9 -12
- package/components/_helpers/input.js +78 -86
- package/components/_helpers/loader-core.js +260 -0
- package/components/_helpers/query-assist-suggestions.js +0 -1
- package/components/_helpers/select-filter.js +19 -26
- package/components/_helpers/services-link.js +9 -12
- package/components/_helpers/sidebar.js +36 -44
- package/components/_helpers/tab-link.js +9 -11
- package/components/_helpers/theme.js +20 -24
- package/components/_helpers/title.js +12 -17
- package/components/alert/alert.js +41 -49
- package/components/alert/container.js +9 -12
- package/components/alert-service/alert-service.js +23 -32
- package/components/analytics/analytics-custom-plugin.js +12 -17
- package/components/analytics/analytics.js +1 -3
- package/components/auth/auth-core.js +128 -170
- package/components/auth/auth.js +3 -10
- package/components/auth/background-flow.js +5 -8
- package/components/auth/down-notification.js +9 -17
- package/components/auth/iframe-flow.js +13 -19
- package/components/auth/request-builder.js +4 -9
- package/components/auth/response-parser.js +9 -12
- package/components/auth/storage.js +12 -18
- package/components/auth/token-validator.js +19 -30
- package/components/auth/window-flow.js +22 -27
- package/components/auth-dialog/auth-dialog.js +40 -48
- package/components/auth-dialog-service/auth-dialog-service.js +10 -13
- package/components/avatar/avatar.figma.js +6 -6
- package/components/avatar/avatar.js +58 -59
- package/components/avatar/fallback-avatar.js +8 -11
- package/components/avatar-stack/avatar-stack.figma.js +10 -11
- package/components/avatar-stack/avatar-stack.js +25 -31
- package/components/banner/banner.js +0 -6
- package/components/breadcrumbs/breadcrumbs.figma.js +8 -6
- package/components/breadcrumbs/breadcrumbs.js +4 -5
- package/components/button/button.figma.js +15 -10
- package/components/button/button.js +59 -64
- package/components/button-group/button-group.js +11 -15
- package/components/button-group/caption.js +0 -1
- package/components/button-set/button-set.js +9 -12
- package/components/button-toolbar/button-toolbar.js +8 -11
- package/components/caret/caret.js +20 -28
- package/components/checkbox/checkbox-group.figma.js +8 -10
- package/components/checkbox/checkbox.figma.js +5 -5
- package/components/checkbox/checkbox.js +27 -35
- package/components/clipboard/clipboard-fallback.js +3 -3
- package/components/clipboard/clipboard.js +3 -16
- package/components/code/code.js +8 -14
- package/components/collapse/collapse-content.js +10 -15
- package/components/collapse/collapse-control.js +5 -7
- package/components/collapse/collapse.js +9 -11
- package/components/collapse/utils.js +1 -1
- package/components/confirm/confirm.js +17 -26
- package/components/confirm-service/confirm-service.js +30 -31
- package/components/content-layout/content-layout.js +21 -28
- package/components/content-layout/sidebar.js +0 -2
- package/components/contenteditable/contenteditable.js +23 -28
- package/components/control-help/control-help.js +8 -10
- package/components/control-label/control-label.js +12 -17
- package/components/data-list/data-list.js +57 -65
- package/components/data-list/data-list.mock.js +0 -4
- package/components/data-list/item.js +65 -72
- package/components/data-list/selection.js +11 -19
- package/components/data-list/title.js +0 -4
- package/components/date-picker/consts.js +3 -4
- package/components/date-picker/date-input.js +25 -33
- package/components/date-picker/date-picker.js +179 -193
- package/components/date-picker/date-popup.js +135 -127
- package/components/date-picker/day.d.ts +1 -1
- package/components/date-picker/day.js +24 -30
- package/components/date-picker/month-names.js +7 -12
- package/components/date-picker/month-slider.js +16 -22
- package/components/date-picker/month.js +3 -5
- package/components/date-picker/months.js +6 -6
- package/components/date-picker/weekdays.js +0 -1
- package/components/date-picker/years.js +20 -26
- package/components/dialog/dialog-body-scroll-preventer.js +0 -1
- package/components/dialog/dialog.js +73 -83
- package/components/dropdown/anchor.js +0 -4
- package/components/dropdown/dropdown.js +98 -114
- package/components/dropdown-menu/dropdown-menu.js +80 -79
- package/components/editable-heading/editable-heading.js +48 -54
- package/components/error-bubble/error-bubble.figma.js +4 -4
- package/components/error-bubble/error-bubble.js +9 -13
- package/components/error-message/error-message.js +1 -6
- package/components/footer/footer.js +11 -15
- package/components/global/compose-refs.js +1 -4
- package/components/global/compose.js +1 -4
- package/components/global/configuration.js +3 -3
- package/components/global/controls-height.js +0 -1
- package/components/global/create-stateful-context.js +10 -14
- package/components/global/data-tests.js +2 -10
- package/components/global/dom.js +6 -19
- package/components/global/focus-sensor-hoc.js +74 -87
- package/components/global/fuzzy-highlight.js +3 -8
- package/components/global/get-uid.js +1 -1
- package/components/global/inject-styles.js +5 -6
- package/components/global/listeners.js +2 -11
- package/components/global/memoize.js +0 -2
- package/components/global/normalize-indent.js +2 -6
- package/components/global/promise-with-timeout.js +4 -5
- package/components/global/react-dom-renderer.js +4 -9
- package/components/global/rerender-hoc.js +8 -11
- package/components/global/schedule-raf.js +1 -2
- package/components/global/theme.js +0 -5
- package/components/global/trivial-template-tag.js +1 -6
- package/components/global/url.js +2 -6
- package/components/global/use-event-callback.js +2 -3
- package/components/grid/col.js +7 -18
- package/components/grid/grid.js +9 -14
- package/components/grid/row.js +7 -11
- package/components/group/group.js +9 -12
- package/components/header/header-icon.js +8 -13
- package/components/header/header.js +16 -27
- package/components/header/links.js +7 -10
- package/components/header/logo.js +12 -16
- package/components/header/profile.js +73 -83
- package/components/header/services-link.js +0 -2
- package/components/header/services.js +32 -43
- package/components/header/smart-profile.js +44 -59
- package/components/header/smart-services.js +33 -45
- package/components/header/tray.js +8 -10
- package/components/heading/heading.js +27 -27
- package/components/http/http.js +120 -125
- package/components/http/http.mock.js +6 -10
- package/components/hub-source/hub-source-user.js +6 -13
- package/components/hub-source/hub-source-users-groups.js +8 -12
- package/components/hub-source/hub-source.js +8 -10
- package/components/i18n/i18n-context.js +4 -7
- package/components/i18n/i18n.js +5 -5
- package/components/icon/icon-svg.js +0 -4
- package/components/icon/icon.js +28 -32
- package/components/icon/index.js +0 -4
- package/components/input/input.figma.js +8 -8
- package/components/input/input.js +0 -4
- package/components/island/adaptive-island-hoc.js +19 -23
- package/components/island/content.js +70 -75
- package/components/island/header.js +21 -21
- package/components/island/island.js +11 -14
- package/components/link/clickable-link.js +30 -37
- package/components/link/link.js +27 -29
- package/components/list/list-custom.js +6 -11
- package/components/list/list-item.js +49 -56
- package/components/list/list-separator.js +0 -1
- package/components/list/list-title.js +0 -1
- package/components/list/list-users-groups-source.js +14 -22
- package/components/list/list.classes.js +8 -9
- package/components/list/list.js +387 -404
- package/components/loader/loader-core.js +2 -265
- package/components/loader/loader.d.ts +8 -0
- package/components/loader/loader.js +43 -29
- package/components/loader-inline/loader-inline.js +9 -12
- package/components/loader-screen/loader-screen.js +10 -14
- package/components/login-dialog/login-dialog.js +46 -54
- package/components/login-dialog/service.js +13 -15
- package/components/message/message.js +65 -79
- package/components/old-browsers-message/old-browsers-message-stop.js +0 -3
- package/components/old-browsers-message/old-browsers-message.js +1 -4
- package/components/old-browsers-message/white-list.js +5 -7
- package/components/pager/pager.js +73 -88
- package/components/panel/panel.js +9 -12
- package/components/permissions/permissions-cache.js +6 -8
- package/components/permissions/permissions.js +19 -21
- package/components/popup/popup.js +136 -145
- package/components/popup/popup.target.js +8 -10
- package/components/popup/position-css.js +19 -27
- package/components/popup/position.js +22 -28
- package/components/popup-menu/popup-menu.js +27 -37
- package/components/progress-bar/progress-bar.js +26 -32
- package/components/query-assist/query-assist-suggestions.js +0 -6
- package/components/query-assist/query-assist.js +432 -468
- package/components/radio/radio-item.js +30 -40
- package/components/radio/radio.js +6 -10
- package/components/scrollable-section/scrollable-section.js +7 -10
- package/components/select/select-filter.js +0 -6
- package/components/select/select-popup.js +155 -174
- package/components/select/select.js +464 -479
- package/components/shortcuts/core.js +40 -45
- package/components/shortcuts/shortcut-title.js +0 -1
- package/components/shortcuts/shortcuts-hoc.js +9 -15
- package/components/shortcuts/shortcuts.js +3 -5
- package/components/slider/slider.js +53 -66
- package/components/slider/slider.utils.js +1 -4
- package/components/storage/storage-local.js +2 -8
- package/components/storage/storage.js +0 -5
- package/components/style.css +1 -1
- package/components/tab-trap/tab-trap.js +21 -30
- package/components/table/cell.js +3 -4
- package/components/table/disable-hover-hoc.js +24 -28
- package/components/table/header-cell.js +30 -38
- package/components/table/header.js +20 -28
- package/components/table/multitable.js +81 -101
- package/components/table/row-with-focus-sensor.js +17 -28
- package/components/table/row.js +89 -99
- package/components/table/selection-adapter.js +0 -2
- package/components/table/selection-shortcuts-hoc.js +159 -161
- package/components/table/selection.js +23 -31
- package/components/table/simple-table.js +16 -22
- package/components/table/smart-table.js +19 -26
- package/components/table/table.js +137 -146
- package/components/tabs/collapsible-more.js +34 -47
- package/components/tabs/collapsible-tab.js +28 -33
- package/components/tabs/collapsible-tabs.js +16 -24
- package/components/tabs/custom-item.js +3 -6
- package/components/tabs/dumb-tabs.js +48 -64
- package/components/tabs/smart-tabs.js +14 -23
- package/components/tabs/tab-link.js +0 -2
- package/components/tabs/tab.js +0 -1
- package/components/tabs/tabs.js +0 -7
- package/components/tag/tag.js +30 -35
- package/components/tags-input/tags-input.js +192 -218
- package/components/tags-list/tags-list.js +26 -31
- package/components/text/text.js +16 -19
- package/components/toggle/toggle.js +19 -23
- package/components/tooltip/tooltip.js +110 -121
- package/components/upload/upload.js +19 -28
- package/components/user-agreement/service.js +247 -252
- package/components/user-agreement/toolbox.eula.js +160 -1
- package/components/user-agreement/user-agreement.js +23 -32
- package/components/user-card/card.js +0 -5
- package/components/user-card/smart-user-card-tooltip.js +41 -50
- package/components/user-card/tooltip.js +32 -38
- package/components/user-card/user-card.js +0 -5
- package/package.json +9 -3
- package/components/_helpers/_rollupPluginBabelHelpers.js +0 -72
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { a as _objectWithoutProperties, b as _objectSpread2, _ 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 { forwardRef, createContext, Component } from 'react';
|
|
5
3
|
import classNames from 'classnames';
|
|
@@ -8,42 +6,36 @@ import ControlHelp from '../control-help/control-help.js';
|
|
|
8
6
|
|
|
9
7
|
var styles = {"radio":"ring-radio-radio","circle":"ring-radio-circle","input":"ring-radio-input","focus":"ring-radio-focus","label":"ring-radio-label"};
|
|
10
8
|
|
|
11
|
-
const _excluded = ["className", "children", "help"],
|
|
12
|
-
_excluded2 = ["value", "onChange"];
|
|
13
9
|
const RadioContext = /*#__PURE__*/createContext({});
|
|
14
10
|
class RadioItemInner extends Component {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
this.label = el;
|
|
25
|
-
});
|
|
26
|
-
}
|
|
11
|
+
uid = getUID('ring-radio-item-');
|
|
12
|
+
input;
|
|
13
|
+
inputRef = el => {
|
|
14
|
+
this.input = el;
|
|
15
|
+
};
|
|
16
|
+
label;
|
|
17
|
+
labelRef = el => {
|
|
18
|
+
this.label = el;
|
|
19
|
+
};
|
|
27
20
|
render() {
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
restProps = _objectWithoutProperties(_this$props, _excluded);
|
|
21
|
+
const {
|
|
22
|
+
className,
|
|
23
|
+
children,
|
|
24
|
+
help,
|
|
25
|
+
...restProps
|
|
26
|
+
} = this.props;
|
|
35
27
|
const classes = classNames(styles.radio, className);
|
|
36
28
|
return jsxs("label", {
|
|
37
29
|
ref: this.labelRef,
|
|
38
30
|
className: classes,
|
|
39
31
|
htmlFor: this.uid,
|
|
40
|
-
children: [jsx("input",
|
|
41
|
-
id: this.uid
|
|
42
|
-
|
|
32
|
+
children: [jsx("input", {
|
|
33
|
+
id: this.uid,
|
|
34
|
+
...restProps,
|
|
43
35
|
ref: this.inputRef,
|
|
44
36
|
className: styles.input,
|
|
45
37
|
type: 'radio'
|
|
46
|
-
})
|
|
38
|
+
}), jsx("span", {
|
|
47
39
|
className: styles.circle
|
|
48
40
|
}), jsxs("span", {
|
|
49
41
|
className: styles.label,
|
|
@@ -56,19 +48,17 @@ class RadioItemInner extends Component {
|
|
|
56
48
|
}
|
|
57
49
|
const RadioItem = /*#__PURE__*/forwardRef(function RadioItem(props, ref) {
|
|
58
50
|
return jsx(RadioContext.Consumer, {
|
|
59
|
-
children:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}, props));
|
|
71
|
-
}
|
|
51
|
+
children: ({
|
|
52
|
+
value,
|
|
53
|
+
onChange,
|
|
54
|
+
...restContext
|
|
55
|
+
}) => jsx(RadioItemInner, {
|
|
56
|
+
ref: ref,
|
|
57
|
+
...restContext,
|
|
58
|
+
checked: value !== undefined ? value === props.value : undefined,
|
|
59
|
+
onChange: onChange ? () => onChange(props.value) : undefined,
|
|
60
|
+
...props
|
|
61
|
+
})
|
|
72
62
|
});
|
|
73
63
|
});
|
|
74
64
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { _ as _defineProperty, b as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
1
|
import { jsx } from 'react/jsx-runtime';
|
|
4
2
|
import { Component } from 'react';
|
|
5
3
|
import getUID from '../global/get-uid.js';
|
|
@@ -11,19 +9,17 @@ import '../control-help/control-help.js';
|
|
|
11
9
|
* @name Radio
|
|
12
10
|
*/
|
|
13
11
|
class Radio extends Component {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
_defineProperty(this, "uid", getUID('ring-radio-'));
|
|
17
|
-
}
|
|
12
|
+
static Item = RadioItem;
|
|
13
|
+
uid = getUID('ring-radio-');
|
|
18
14
|
render() {
|
|
19
15
|
return jsx(RadioContext.Provider, {
|
|
20
|
-
value:
|
|
21
|
-
name: this.uid
|
|
22
|
-
|
|
16
|
+
value: {
|
|
17
|
+
name: this.uid,
|
|
18
|
+
...this.props
|
|
19
|
+
},
|
|
23
20
|
children: this.props.children
|
|
24
21
|
});
|
|
25
22
|
}
|
|
26
23
|
}
|
|
27
|
-
_defineProperty(Radio, "Item", RadioItem);
|
|
28
24
|
|
|
29
25
|
export { Radio as default };
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
import { a as _objectWithoutProperties, b as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
1
|
import { jsx } from 'react/jsx-runtime';
|
|
4
2
|
import { useState, useRef, useCallback, useEffect } from 'react';
|
|
5
3
|
import classNames from 'classnames';
|
|
6
4
|
|
|
7
5
|
var styles = {"scrollableSection":"ring-scrollable-section-scrollableSection","withTopBorder":"ring-scrollable-section-withTopBorder","withRightBorder":"ring-scrollable-section-withRightBorder","withBottomBorder":"ring-scrollable-section-withBottomBorder","withLeftBorder":"ring-scrollable-section-withLeftBorder"};
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} = _ref,
|
|
14
|
-
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
7
|
+
function ScrollableSection({
|
|
8
|
+
className,
|
|
9
|
+
...restProps
|
|
10
|
+
}) {
|
|
15
11
|
const [scrolledToTop, setScrolledToTop] = useState(false);
|
|
16
12
|
const [scrolledToRight, setScrolledToRight] = useState(false);
|
|
17
13
|
const [scrolledToBottom, setScrolledToBottom] = useState(false);
|
|
@@ -38,7 +34,8 @@ function ScrollableSection(_ref) {
|
|
|
38
34
|
window.addEventListener('resize', calculateScrollPosition);
|
|
39
35
|
return () => window.removeEventListener('resize', calculateScrollPosition);
|
|
40
36
|
}, [calculateScrollPosition]);
|
|
41
|
-
return jsx("div",
|
|
37
|
+
return jsx("div", {
|
|
38
|
+
...restProps,
|
|
42
39
|
className: classNames(styles.scrollableSection, className, {
|
|
43
40
|
[styles.withTopBorder]: !scrolledToTop,
|
|
44
41
|
[styles.withRightBorder]: !scrolledToRight,
|
|
@@ -47,7 +44,7 @@ function ScrollableSection(_ref) {
|
|
|
47
44
|
}),
|
|
48
45
|
ref: ref,
|
|
49
46
|
onScroll: calculateScrollPosition
|
|
50
|
-
})
|
|
47
|
+
});
|
|
51
48
|
}
|
|
52
49
|
|
|
53
50
|
export { ScrollableSection as default };
|
|
@@ -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';
|
|
@@ -16,8 +14,6 @@ import 'util-deprecate';
|
|
|
16
14
|
import '../icon/icon.js';
|
|
17
15
|
import '../icon/icon.constants.js';
|
|
18
16
|
import '../_helpers/icon-svg.js';
|
|
19
|
-
import 'core-js/modules/es.regexp.exec.js';
|
|
20
|
-
import 'core-js/modules/es.string.replace.js';
|
|
21
17
|
import '../global/memoize.js';
|
|
22
18
|
import '../link/clickable-link.js';
|
|
23
19
|
import '../global/controls-height.js';
|
|
@@ -29,8 +25,6 @@ import 'memoize-one';
|
|
|
29
25
|
import '../control-label/control-label.js';
|
|
30
26
|
import '../control-help/control-help.js';
|
|
31
27
|
import 'sniffr';
|
|
32
|
-
import 'core-js/modules/es.symbol.description.js';
|
|
33
|
-
import 'core-js/modules/es.string.trim.js';
|
|
34
28
|
import 'react-virtualized/dist/es/List';
|
|
35
29
|
import 'react-virtualized/dist/es/AutoSizer';
|
|
36
30
|
import 'react-virtualized/dist/es/WindowScroller';
|
|
@@ -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 { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
2
|
import { PureComponent } from 'react';
|
|
5
3
|
import classNames from 'classnames';
|
|
@@ -28,16 +26,11 @@ import { ControlsHeight } from '../global/configuration.js';
|
|
|
28
26
|
import 'util-deprecate';
|
|
29
27
|
import '../icon/icon.constants.js';
|
|
30
28
|
import '../_helpers/icon-svg.js';
|
|
31
|
-
import 'core-js/modules/es.regexp.exec.js';
|
|
32
|
-
import 'core-js/modules/es.string.replace.js';
|
|
33
29
|
import 'react-dom';
|
|
34
30
|
import '../global/schedule-raf.js';
|
|
35
31
|
import '../global/data-tests.js';
|
|
36
32
|
import '../tab-trap/tab-trap.js';
|
|
37
33
|
import '../popup/position-css.js';
|
|
38
|
-
import 'core-js/modules/es.array.sort.js';
|
|
39
|
-
import 'core-js/modules/es.symbol.description.js';
|
|
40
|
-
import 'core-js/modules/es.string.trim.js';
|
|
41
34
|
import 'react-virtualized/dist/es/List';
|
|
42
35
|
import 'react-virtualized/dist/es/AutoSizer';
|
|
43
36
|
import 'react-virtualized/dist/es/WindowScroller';
|
|
@@ -83,159 +76,56 @@ const TOOLBAR_HEIGHT = 49;
|
|
|
83
76
|
function noop() {}
|
|
84
77
|
const FilterWithShortcuts = shortcutsHOC(SelectFilter);
|
|
85
78
|
class SelectPopup extends PureComponent {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
const customEvent = document.createEvent('Event');
|
|
120
|
-
customEvent.initEvent('select', true, false);
|
|
121
|
-
if (event && 'persist' in event) {
|
|
122
|
-
event.persist();
|
|
123
|
-
}
|
|
124
|
-
customEvent.originalEvent = event;
|
|
125
|
-
return customEvent;
|
|
126
|
-
};
|
|
127
|
-
this.props.onSelect(selected, getSelectItemEvent(), opts);
|
|
128
|
-
});
|
|
129
|
-
_defineProperty(this, "tabPress", event => {
|
|
130
|
-
this.props.onCloseAttempt(event, true);
|
|
131
|
-
});
|
|
132
|
-
_defineProperty(this, "onClickHandler", () => {
|
|
133
|
-
var _this$filter;
|
|
134
|
-
return (_this$filter = this.filter) === null || _this$filter === void 0 ? void 0 : _this$filter.focus();
|
|
135
|
-
});
|
|
136
|
-
_defineProperty(this, "handleRemoveTag", memoize(tag => event => this.removeTag(tag, event)));
|
|
137
|
-
_defineProperty(this, "handleTagClick", memoize(tag => () => {
|
|
138
|
-
if (Array.isArray(this.props.selected)) {
|
|
139
|
-
this.setState({
|
|
140
|
-
tagsActiveIndex: this.props.selected.indexOf(tag)
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
}));
|
|
144
|
-
_defineProperty(this, "handleListResize", () => {
|
|
145
|
-
this.forceUpdate();
|
|
146
|
-
});
|
|
147
|
-
_defineProperty(this, "handleSelectAll", () => {
|
|
148
|
-
if (Array.isArray(this.props.selected)) {
|
|
149
|
-
this.props.onSelectAll(this.props.data.filter(item => !item.disabled).length !== this.props.selected.length);
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
_defineProperty(this, "getSelectAll", () => {
|
|
153
|
-
var _multiple$renderSelec;
|
|
154
|
-
const multiple = this.props.multiple;
|
|
155
|
-
const activeFilters = this.props.data.filter(item => !item.disabled);
|
|
156
|
-
return Array.isArray(this.props.selected) && jsxs("div", {
|
|
157
|
-
className: styles.selectAll,
|
|
158
|
-
children: [activeFilters.length === 0 ? jsx("span", {}) : jsx(Button, {
|
|
159
|
-
inline: true,
|
|
160
|
-
onClick: this.handleSelectAll,
|
|
161
|
-
children: activeFilters.length !== this.props.selected.length ? multiple.selectAllLabel || 'Select all' : multiple.deselectAllLabel || 'Deselect all'
|
|
162
|
-
}), ((_multiple$renderSelec = multiple.renderSelectedItemsDescription) === null || _multiple$renderSelec === void 0 ? void 0 : _multiple$renderSelec.call(multiple, this.props.selected, activeFilters.length)) || jsx(Text, {
|
|
163
|
-
info: true,
|
|
164
|
-
children: "".concat(this.props.selected.length, " selected")
|
|
165
|
-
})]
|
|
166
|
-
});
|
|
167
|
-
});
|
|
168
|
-
// Cache the value because this method is called
|
|
169
|
-
// inside `render` function which can be called N times
|
|
170
|
-
// and should be fast as possible.
|
|
171
|
-
// Cache invalidates each time hidden or userDefinedMaxHeight changes
|
|
172
|
-
_defineProperty(this, "_adjustListMaxHeight", memoizeOne((hidden, userDefinedMaxHeight, ringPopupTarget) => {
|
|
173
|
-
if (hidden) {
|
|
174
|
-
return userDefinedMaxHeight;
|
|
175
|
-
}
|
|
176
|
-
// Calculate list's maximum height that can't
|
|
177
|
-
// get beyond the screen
|
|
178
|
-
// @see RG-1838, JT-48358
|
|
179
|
-
const minMaxHeight = 100;
|
|
180
|
-
const directions = this.props.directions || DEFAULT_DIRECTIONS;
|
|
181
|
-
// Note:
|
|
182
|
-
// Create a method which'll be called only when the popup opens and before
|
|
183
|
-
// render the list would be a better way
|
|
184
|
-
const anchorNode = this.props.anchorElement;
|
|
185
|
-
const containerNode = getPopupContainer(ringPopupTarget) || document.documentElement;
|
|
186
|
-
return anchorNode !== null ? Math.min(directions.reduce((maxHeight, direction) => {
|
|
187
|
-
var _maxHeightForDirectio;
|
|
188
|
-
return Math.max(maxHeight, (_maxHeightForDirectio = maxHeightForDirection(direction, anchorNode, getStyles(containerNode).position !== 'static' ? containerNode : null)) !== null && _maxHeightForDirectio !== void 0 ? _maxHeightForDirectio : 0);
|
|
189
|
-
}, minMaxHeight), userDefinedMaxHeight) : userDefinedMaxHeight;
|
|
190
|
-
}));
|
|
191
|
-
_defineProperty(this, "popupRef", el => {
|
|
192
|
-
this.popup = el;
|
|
193
|
-
});
|
|
194
|
-
_defineProperty(this, "list", void 0);
|
|
195
|
-
_defineProperty(this, "listRef", el => {
|
|
196
|
-
this.list = el;
|
|
197
|
-
});
|
|
198
|
-
_defineProperty(this, "filterRef", el => {
|
|
199
|
-
this.filter = el;
|
|
200
|
-
this.caret = el && new Caret(el);
|
|
201
|
-
});
|
|
202
|
-
_defineProperty(this, "composedFilterRef", createComposedRef());
|
|
203
|
-
_defineProperty(this, "shortcutsScope", getUID('select-popup-'));
|
|
204
|
-
_defineProperty(this, "shortcutsMap", {
|
|
205
|
-
tab: this.tabPress
|
|
206
|
-
});
|
|
207
|
-
_defineProperty(this, "popupFilterShortcutsMap", {
|
|
208
|
-
up: event => this.list && this.list.upHandler(event),
|
|
209
|
-
down: event => this.list && this.list.downHandler(event),
|
|
210
|
-
home: event => this.list && this.list.homeHandler(event),
|
|
211
|
-
end: event => this.list && this.list.endHandler(event),
|
|
212
|
-
enter: event => this.list ? this.list.enterHandler(event) : this.props.onEmptyPopupEnter(event),
|
|
213
|
-
esc: event => this.props.onCloseAttempt(event, true),
|
|
214
|
-
tab: event => this.tabPress(event),
|
|
215
|
-
backspace: event => this.handleBackspace(event),
|
|
216
|
-
del: () => this.removeSelectedTag(),
|
|
217
|
-
left: event => this.handleNavigation(event, true),
|
|
218
|
-
right: event => this.handleNavigation(event)
|
|
219
|
-
});
|
|
220
|
-
}
|
|
79
|
+
static defaultProps = {
|
|
80
|
+
data: [],
|
|
81
|
+
activeIndex: null,
|
|
82
|
+
toolbar: null,
|
|
83
|
+
topbar: null,
|
|
84
|
+
filter: false,
|
|
85
|
+
filterIcon: null,
|
|
86
|
+
filterRef: noop,
|
|
87
|
+
multiple: false,
|
|
88
|
+
message: null,
|
|
89
|
+
anchorElement: null,
|
|
90
|
+
maxHeight: 600,
|
|
91
|
+
minWidth: 240,
|
|
92
|
+
loading: false,
|
|
93
|
+
onSelect: noop,
|
|
94
|
+
onCloseAttempt: noop,
|
|
95
|
+
onOutsideClick: noop,
|
|
96
|
+
onFilter: noop,
|
|
97
|
+
onClear: noop,
|
|
98
|
+
onLoadMore: noop,
|
|
99
|
+
selected: [],
|
|
100
|
+
tags: null,
|
|
101
|
+
ringPopupTarget: null,
|
|
102
|
+
onSelectAll: noop,
|
|
103
|
+
onEmptyPopupEnter: noop
|
|
104
|
+
};
|
|
105
|
+
state = {
|
|
106
|
+
popupFilterShortcutsOptions: {
|
|
107
|
+
modal: true,
|
|
108
|
+
disabled: true
|
|
109
|
+
},
|
|
110
|
+
tagsActiveIndex: null
|
|
111
|
+
};
|
|
221
112
|
componentDidMount() {
|
|
222
113
|
window.document.addEventListener('mouseup', this.mouseUpHandler);
|
|
223
114
|
}
|
|
224
115
|
componentWillUnmount() {
|
|
225
116
|
window.document.removeEventListener('mouseup', this.mouseUpHandler);
|
|
226
117
|
}
|
|
118
|
+
isClickingPopup = false; // This flag is set to true while an item in the popup is being clicked
|
|
119
|
+
filter;
|
|
227
120
|
focusFilter() {
|
|
228
|
-
setTimeout(() =>
|
|
229
|
-
var _this$filter2;
|
|
230
|
-
return (_this$filter2 = this.filter) === null || _this$filter2 === void 0 ? void 0 : _this$filter2.focus();
|
|
231
|
-
});
|
|
121
|
+
setTimeout(() => this.filter?.focus());
|
|
232
122
|
}
|
|
233
123
|
isEventTargetFilter(event) {
|
|
234
124
|
return event.target instanceof Element && event.target.matches('input,textarea');
|
|
235
125
|
}
|
|
126
|
+
caret;
|
|
236
127
|
handleNavigation(event, navigateLeft) {
|
|
237
|
-
|
|
238
|
-
if (this.isEventTargetFilter(event) && this.caret && Number((_this$caret = this.caret) === null || _this$caret === void 0 ? void 0 : _this$caret.getPosition()) > 0 || !Array.isArray(this.props.selected)) {
|
|
128
|
+
if (this.isEventTargetFilter(event) && this.caret && Number(this.caret?.getPosition()) > 0 || !Array.isArray(this.props.selected)) {
|
|
239
129
|
return;
|
|
240
130
|
}
|
|
241
131
|
let newIndex = null;
|
|
@@ -289,6 +179,17 @@ class SelectPopup extends PureComponent {
|
|
|
289
179
|
}
|
|
290
180
|
return true;
|
|
291
181
|
}
|
|
182
|
+
onFilterFocus = () => {
|
|
183
|
+
this._togglePopupFilterShortcuts(false);
|
|
184
|
+
this.setState({
|
|
185
|
+
tagsActiveIndex: null
|
|
186
|
+
});
|
|
187
|
+
};
|
|
188
|
+
popupFilterOnBlur = () => {
|
|
189
|
+
if (this.state.tagsActiveIndex === null) {
|
|
190
|
+
this._togglePopupFilterShortcuts(true);
|
|
191
|
+
}
|
|
192
|
+
};
|
|
292
193
|
_togglePopupFilterShortcuts(shortcutsDisabled) {
|
|
293
194
|
this.setState({
|
|
294
195
|
popupFilterShortcutsOptions: {
|
|
@@ -297,9 +198,32 @@ class SelectPopup extends PureComponent {
|
|
|
297
198
|
}
|
|
298
199
|
});
|
|
299
200
|
}
|
|
201
|
+
mouseDownHandler = () => {
|
|
202
|
+
this.isClickingPopup = true;
|
|
203
|
+
};
|
|
204
|
+
mouseUpHandler = () => {
|
|
205
|
+
this.isClickingPopup = false;
|
|
206
|
+
};
|
|
207
|
+
popup;
|
|
300
208
|
isVisible() {
|
|
301
209
|
return this.popup && this.popup.isVisible();
|
|
302
210
|
}
|
|
211
|
+
onListSelect = (selected, event, opts) => {
|
|
212
|
+
const getSelectItemEvent = () => {
|
|
213
|
+
const customEvent = document.createEvent('Event');
|
|
214
|
+
customEvent.initEvent('select', true, false);
|
|
215
|
+
if (event && 'persist' in event) {
|
|
216
|
+
event.persist();
|
|
217
|
+
}
|
|
218
|
+
customEvent.originalEvent = event;
|
|
219
|
+
return customEvent;
|
|
220
|
+
};
|
|
221
|
+
this.props.onSelect(selected, getSelectItemEvent(), opts);
|
|
222
|
+
};
|
|
223
|
+
tabPress = event => {
|
|
224
|
+
this.props.onCloseAttempt(event, true);
|
|
225
|
+
};
|
|
226
|
+
onClickHandler = () => this.filter?.focus();
|
|
303
227
|
getFilter() {
|
|
304
228
|
if (this.props.filter || this.props.tags) {
|
|
305
229
|
var _this$props$filterIco;
|
|
@@ -334,6 +258,14 @@ class SelectPopup extends PureComponent {
|
|
|
334
258
|
}
|
|
335
259
|
return null;
|
|
336
260
|
}
|
|
261
|
+
handleRemoveTag = memoize(tag => event => this.removeTag(tag, event));
|
|
262
|
+
handleTagClick = memoize(tag => () => {
|
|
263
|
+
if (Array.isArray(this.props.selected)) {
|
|
264
|
+
this.setState({
|
|
265
|
+
tagsActiveIndex: this.props.selected.indexOf(tag)
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
});
|
|
337
269
|
getCustomTag(tags) {
|
|
338
270
|
if (tags !== null && typeof tags !== 'boolean') {
|
|
339
271
|
return tags.customTagComponent;
|
|
@@ -381,6 +313,9 @@ class SelectPopup extends PureComponent {
|
|
|
381
313
|
})]
|
|
382
314
|
});
|
|
383
315
|
}
|
|
316
|
+
handleListResize = () => {
|
|
317
|
+
this.forceUpdate();
|
|
318
|
+
};
|
|
384
319
|
getList(ringPopupTarget) {
|
|
385
320
|
if (this.props.data.length) {
|
|
386
321
|
let {
|
|
@@ -418,6 +353,78 @@ class SelectPopup extends PureComponent {
|
|
|
418
353
|
}
|
|
419
354
|
return null;
|
|
420
355
|
}
|
|
356
|
+
handleSelectAll = () => {
|
|
357
|
+
if (Array.isArray(this.props.selected)) {
|
|
358
|
+
this.props.onSelectAll(this.props.data.filter(item => !item.disabled).length !== this.props.selected.length);
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
getSelectAll = () => {
|
|
362
|
+
const multiple = this.props.multiple;
|
|
363
|
+
const activeFilters = this.props.data.filter(item => !item.disabled);
|
|
364
|
+
return Array.isArray(this.props.selected) && jsxs("div", {
|
|
365
|
+
className: styles.selectAll,
|
|
366
|
+
children: [activeFilters.length === 0 ? jsx("span", {}) : jsx(Button, {
|
|
367
|
+
inline: true,
|
|
368
|
+
onClick: this.handleSelectAll,
|
|
369
|
+
children: activeFilters.length !== this.props.selected.length ? multiple.selectAllLabel || 'Select all' : multiple.deselectAllLabel || 'Deselect all'
|
|
370
|
+
}), multiple.renderSelectedItemsDescription?.(this.props.selected, activeFilters.length) || jsx(Text, {
|
|
371
|
+
info: true,
|
|
372
|
+
children: `${this.props.selected.length} selected`
|
|
373
|
+
})]
|
|
374
|
+
});
|
|
375
|
+
};
|
|
376
|
+
// Cache the value because this method is called
|
|
377
|
+
// inside `render` function which can be called N times
|
|
378
|
+
// and should be fast as possible.
|
|
379
|
+
// Cache invalidates each time hidden or userDefinedMaxHeight changes
|
|
380
|
+
_adjustListMaxHeight = memoizeOne((hidden, userDefinedMaxHeight, ringPopupTarget) => {
|
|
381
|
+
if (hidden) {
|
|
382
|
+
return userDefinedMaxHeight;
|
|
383
|
+
}
|
|
384
|
+
// Calculate list's maximum height that can't
|
|
385
|
+
// get beyond the screen
|
|
386
|
+
// @see RG-1838, JT-48358
|
|
387
|
+
const minMaxHeight = 100;
|
|
388
|
+
const directions = this.props.directions || DEFAULT_DIRECTIONS;
|
|
389
|
+
// Note:
|
|
390
|
+
// Create a method which'll be called only when the popup opens and before
|
|
391
|
+
// render the list would be a better way
|
|
392
|
+
const anchorNode = this.props.anchorElement;
|
|
393
|
+
const containerNode = getPopupContainer(ringPopupTarget) || document.documentElement;
|
|
394
|
+
return anchorNode !== null ? Math.min(directions.reduce((maxHeight, direction) => {
|
|
395
|
+
var _maxHeightForDirectio;
|
|
396
|
+
return Math.max(maxHeight, (_maxHeightForDirectio = maxHeightForDirection(direction, anchorNode, getStyles(containerNode).position !== 'static' ? containerNode : null)) !== null && _maxHeightForDirectio !== void 0 ? _maxHeightForDirectio : 0);
|
|
397
|
+
}, minMaxHeight), userDefinedMaxHeight) : userDefinedMaxHeight;
|
|
398
|
+
});
|
|
399
|
+
popupRef = el => {
|
|
400
|
+
this.popup = el;
|
|
401
|
+
};
|
|
402
|
+
list;
|
|
403
|
+
listRef = el => {
|
|
404
|
+
this.list = el;
|
|
405
|
+
};
|
|
406
|
+
filterRef = el => {
|
|
407
|
+
this.filter = el;
|
|
408
|
+
this.caret = el && new Caret(el);
|
|
409
|
+
};
|
|
410
|
+
composedFilterRef = createComposedRef();
|
|
411
|
+
shortcutsScope = getUID('select-popup-');
|
|
412
|
+
shortcutsMap = {
|
|
413
|
+
tab: this.tabPress
|
|
414
|
+
};
|
|
415
|
+
popupFilterShortcutsMap = {
|
|
416
|
+
up: event => this.list && this.list.upHandler(event),
|
|
417
|
+
down: event => this.list && this.list.downHandler(event),
|
|
418
|
+
home: event => this.list && this.list.homeHandler(event),
|
|
419
|
+
end: event => this.list && this.list.endHandler(event),
|
|
420
|
+
enter: event => this.list ? this.list.enterHandler(event) : this.props.onEmptyPopupEnter(event),
|
|
421
|
+
esc: event => this.props.onCloseAttempt(event, true),
|
|
422
|
+
tab: event => this.tabPress(event),
|
|
423
|
+
backspace: event => this.handleBackspace(event),
|
|
424
|
+
del: () => this.removeSelectedTag(),
|
|
425
|
+
left: event => this.handleNavigation(event, true),
|
|
426
|
+
right: event => this.handleNavigation(event)
|
|
427
|
+
};
|
|
421
428
|
render() {
|
|
422
429
|
const {
|
|
423
430
|
toolbar,
|
|
@@ -478,31 +485,5 @@ class SelectPopup extends PureComponent {
|
|
|
478
485
|
});
|
|
479
486
|
}
|
|
480
487
|
}
|
|
481
|
-
_defineProperty(SelectPopup, "defaultProps", {
|
|
482
|
-
data: [],
|
|
483
|
-
activeIndex: null,
|
|
484
|
-
toolbar: null,
|
|
485
|
-
topbar: null,
|
|
486
|
-
filter: false,
|
|
487
|
-
filterIcon: null,
|
|
488
|
-
filterRef: noop,
|
|
489
|
-
multiple: false,
|
|
490
|
-
message: null,
|
|
491
|
-
anchorElement: null,
|
|
492
|
-
maxHeight: 600,
|
|
493
|
-
minWidth: 240,
|
|
494
|
-
loading: false,
|
|
495
|
-
onSelect: noop,
|
|
496
|
-
onCloseAttempt: noop,
|
|
497
|
-
onOutsideClick: noop,
|
|
498
|
-
onFilter: noop,
|
|
499
|
-
onClear: noop,
|
|
500
|
-
onLoadMore: noop,
|
|
501
|
-
selected: [],
|
|
502
|
-
tags: null,
|
|
503
|
-
ringPopupTarget: null,
|
|
504
|
-
onSelectAll: noop,
|
|
505
|
-
onEmptyPopupEnter: noop
|
|
506
|
-
});
|
|
507
488
|
|
|
508
489
|
export { SelectPopup as default };
|