@jetbrains/ring-ui-built 6.0.31 → 6.0.32
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/_rollupPluginBabelHelpers.js +1 -567
- package/components/_helpers/anchor.js +7 -6
- package/components/_helpers/button__classes.js +16 -14
- package/components/_helpers/caption.js +14 -20
- package/components/_helpers/card.js +95 -105
- package/components/_helpers/dialog__body-scroll-preventer.js +11 -19
- package/components/_helpers/icon__svg.js +22 -25
- package/components/_helpers/input.js +146 -177
- package/components/_helpers/query-assist__suggestions.js +74 -90
- package/components/_helpers/select__filter.js +48 -69
- package/components/_helpers/services-link.js +29 -37
- package/components/_helpers/sidebar.js +99 -107
- package/components/_helpers/tab-link.js +7 -7
- package/components/_helpers/theme.js +31 -40
- package/components/_helpers/title.js +57 -72
- package/components/alert/alert.js +150 -202
- package/components/alert/container.js +32 -41
- package/components/alert-service/alert-service.js +105 -170
- package/components/analytics/analytics.js +12 -22
- package/components/analytics/analytics__custom-plugin.js +54 -75
- package/components/auth/auth.js +4 -36
- package/components/auth/auth__core.js +746 -1471
- package/components/auth/background-flow.js +87 -127
- package/components/auth/down-notification.js +30 -73
- package/components/auth/iframe-flow.js +75 -133
- package/components/auth/request-builder.js +46 -82
- package/components/auth/response-parser.js +86 -116
- package/components/auth/storage.js +171 -334
- package/components/auth/token-validator.js +137 -242
- package/components/auth/window-flow.js +92 -134
- package/components/auth-dialog/auth-dialog.js +114 -172
- package/components/auth-dialog-service/auth-dialog-service.js +8 -31
- package/components/avatar/avatar-example-datauri.js +23 -1
- package/components/avatar/avatar.js +119 -152
- package/components/avatar/fallback-avatar.js +22 -38
- package/components/badge/badge.js +35 -45
- package/components/button/button.js +86 -107
- package/components/button-group/button-group.js +19 -33
- package/components/button-set/button-set.js +20 -32
- package/components/button-toolbar/button-toolbar.js +19 -31
- package/components/caret/caret.js +186 -220
- package/components/checkbox/checkbox.js +76 -101
- package/components/clipboard/clipboard-fallback.js +10 -10
- package/components/clipboard/clipboard.js +35 -132
- package/components/code/code.js +92 -166
- package/components/collapse/collapse-content.js +42 -64
- package/components/collapse/collapse-context.js +2 -2
- package/components/collapse/collapse-control.js +12 -14
- package/components/collapse/collapse.js +11 -17
- package/components/collapse/consts.js +4 -4
- package/components/collapse/utils.js +1 -3
- package/components/confirm/confirm.js +66 -104
- package/components/confirm-service/confirm-service.js +37 -59
- package/components/content-layout/content-layout.js +43 -64
- package/components/content-layout/sidebar.js +0 -1
- package/components/contenteditable/contenteditable.js +50 -59
- package/components/control-label/control-label.js +9 -9
- package/components/data-list/data-list.js +129 -182
- package/components/data-list/data-list.mock.js +2 -6
- package/components/data-list/item.js +143 -170
- package/components/data-list/selection.js +76 -136
- package/components/data-list/title.js +1 -12
- package/components/date-picker/consts.js +19 -26
- package/components/date-picker/date-input.js +113 -144
- package/components/date-picker/date-picker.js +227 -282
- package/components/date-picker/date-popup.js +350 -395
- package/components/date-picker/day.js +87 -116
- package/components/date-picker/month-names.js +43 -66
- package/components/date-picker/month-slider.js +51 -76
- package/components/date-picker/month.js +16 -25
- package/components/date-picker/months.js +43 -50
- package/components/date-picker/weekdays.js +12 -22
- package/components/date-picker/years.js +83 -110
- package/components/dialog/dialog.js +142 -190
- package/components/dialog/dialog__body-scroll-preventer.js +0 -4
- package/components/dropdown/anchor.js +0 -9
- package/components/dropdown/dropdown.js +182 -213
- package/components/dropdown-menu/dropdown-menu.js +71 -97
- package/components/editable-heading/editable-heading.js +75 -127
- package/components/error-bubble/error-bubble.js +31 -60
- package/components/error-message/error-message.js +39 -59
- package/components/footer/footer.js +27 -30
- package/components/global/compose.js +1 -10
- package/components/global/composeRefs.js +7 -12
- package/components/global/controls-height.js +2 -2
- package/components/global/create-stateful-context.js +15 -15
- package/components/global/data-tests.js +6 -14
- package/components/global/dom.js +47 -86
- package/components/global/focus-sensor-hoc.js +122 -132
- package/components/global/fuzzy-highlight.js +22 -36
- package/components/global/get-event-key.js +8 -8
- package/components/global/get-uid.js +4 -8
- package/components/global/inject-styles.js +10 -15
- package/components/global/listeners.js +27 -51
- package/components/global/memoize.js +6 -12
- package/components/global/normalize-indent.js +19 -50
- package/components/global/promise-with-timeout.js +6 -8
- package/components/global/prop-types.js +3 -5
- package/components/global/react-dom-renderer.js +28 -44
- package/components/global/react-render-adapter.js +1 -1
- package/components/global/rerender-hoc.js +12 -30
- package/components/global/schedule-raf.js +5 -6
- package/components/global/sniffer.js +1 -1
- package/components/global/theme.js +0 -22
- package/components/global/trivial-template-tag.js +3 -10
- package/components/global/typescript-utils.js +2 -6
- package/components/global/url.js +20 -26
- package/components/global/use-event-callback.js +6 -4
- package/components/grid/col.js +35 -52
- package/components/grid/grid.js +17 -31
- package/components/grid/row.js +35 -47
- package/components/group/group.js +17 -25
- package/components/header/header.js +33 -78
- package/components/header/logo.js +20 -36
- package/components/header/profile.js +166 -199
- package/components/header/services-link.js +0 -4
- package/components/header/services.js +73 -116
- package/components/header/smart-profile.js +111 -203
- package/components/header/smart-services.js +62 -113
- package/components/header/tray-icon.js +21 -37
- package/components/header/tray.js +21 -32
- package/components/heading/heading.js +24 -25
- package/components/http/http.d.ts +1 -3
- package/components/http/http.js +203 -353
- package/components/http/http.mock.js +49 -101
- package/components/hub-source/hub-source.js +83 -190
- package/components/hub-source/hub-source__user.js +11 -44
- package/components/hub-source/hub-source__users-groups.js +37 -65
- package/components/i18n/i18n-context.js +7 -10
- package/components/i18n/i18n.js +7 -10
- package/components/icon/icon.js +76 -93
- package/components/icon/icon__svg.js +0 -8
- package/components/icon/index.js +0 -8
- package/components/input/input.js +0 -13
- package/components/island/adaptive-island-hoc.js +30 -43
- package/components/island/content.js +115 -132
- package/components/island/header.js +57 -70
- package/components/island/island.js +28 -40
- package/components/island-legacy/content-legacy.js +17 -25
- package/components/island-legacy/header-legacy.js +19 -27
- package/components/island-legacy/island-legacy.js +17 -25
- package/components/link/clickableLink.js +44 -59
- package/components/link/link.js +57 -68
- package/components/list/consts.js +2 -2
- package/components/list/list.js +611 -698
- package/components/list/list__custom.js +44 -62
- package/components/list/list__hint.js +10 -19
- package/components/list/list__item.js +133 -174
- package/components/list/list__link.js +37 -50
- package/components/list/list__separator.js +14 -24
- package/components/list/list__title.js +22 -32
- package/components/list/list__users-groups-source.js +54 -126
- package/components/loader/loader.js +43 -74
- package/components/loader/loader__core.js +198 -263
- package/components/loader-inline/loader-inline.js +23 -35
- package/components/loader-screen/loader-screen.js +25 -46
- package/components/login-dialog/login-dialog.js +111 -158
- package/components/login-dialog/service.js +8 -34
- package/components/markdown/markdown.js +15 -23
- package/components/message/message.js +161 -203
- package/components/old-browsers-message/old-browsers-message.js +11 -18
- package/components/old-browsers-message/old-browsers-message__stop.js +0 -7
- package/components/old-browsers-message/white-list.js +8 -16
- package/components/pager/pager.js +212 -271
- package/components/panel/panel.js +17 -25
- package/components/permissions/permissions.js +127 -172
- package/components/permissions/permissions__cache.js +194 -224
- package/components/popup/popup.consts.js +1 -1
- package/components/popup/popup.js +284 -343
- package/components/popup/popup.target.js +9 -8
- package/components/popup/position.js +96 -106
- package/components/popup-menu/popup-menu.js +44 -80
- package/components/progress-bar/progress-bar.js +87 -104
- package/components/query-assist/query-assist.js +838 -916
- package/components/query-assist/query-assist__suggestions.js +1 -30
- package/components/radio/radio.js +19 -34
- package/components/radio/radio__item.js +52 -69
- package/components/select/select.js +852 -957
- package/components/select/select__filter.js +0 -30
- package/components/select/select__popup.js +373 -487
- package/components/shortcuts/core.js +166 -217
- package/components/shortcuts/shortcut-title.js +6 -11
- package/components/shortcuts/shortcuts-hoc.js +19 -45
- package/components/shortcuts/shortcuts.js +50 -75
- package/components/slider/slider.js +99 -122
- package/components/slider/slider.utils.js +14 -24
- package/components/storage/storage.js +4 -33
- package/components/storage/storage__fallback.js +149 -224
- package/components/storage/storage__local.js +90 -153
- package/components/tab-trap/tab-trap.js +122 -153
- package/components/table/cell.js +14 -26
- package/components/table/disable-hover-hoc.js +33 -51
- package/components/table/header-cell.js +64 -89
- package/components/table/header.js +104 -132
- package/components/table/multitable.js +107 -125
- package/components/table/row-with-focus-sensor.js +25 -69
- package/components/table/row.js +175 -216
- package/components/table/selection-adapter.js +1 -3
- package/components/table/selection-shortcuts-hoc.js +180 -181
- package/components/table/selection.js +156 -226
- package/components/table/smart-table.js +50 -88
- package/components/table/table.js +289 -358
- package/components/tabs/collapsible-more.js +46 -79
- package/components/tabs/collapsible-tab.js +31 -38
- package/components/tabs/collapsible-tabs.js +88 -153
- package/components/tabs/custom-item.js +4 -2
- package/components/tabs/dumb-tabs.js +74 -117
- package/components/tabs/smart-tabs.js +29 -69
- package/components/tabs/tab-link.js +1 -5
- package/components/tabs/tab.js +19 -31
- package/components/tabs/tabs.js +0 -31
- package/components/tag/tag.js +133 -173
- package/components/tags-input/tags-input.js +329 -427
- package/components/tags-list/tags-list.js +57 -78
- package/components/text/text.js +28 -39
- package/components/toggle/toggle.js +56 -70
- package/components/tooltip/tooltip.js +146 -190
- package/components/user-agreement/service.js +228 -371
- package/components/user-agreement/toolbox.eula.js +160 -1
- package/components/user-agreement/user-agreement.js +85 -120
- package/components/user-card/card.js +0 -29
- package/components/user-card/smart-user-card-tooltip.js +51 -111
- package/components/user-card/tooltip.js +47 -84
- package/components/user-card/user-card.js +0 -29
- package/package.json +1 -1
@@ -1,90 +1,65 @@
|
|
1
|
-
import { _ as _defineProperty, a as _inherits, b as _createClass, f as _classCallCheck, g as _callSuper } from '../_helpers/_rollupPluginBabelHelpers.js';
|
2
|
-
import 'core-js/modules/es.array.map.js';
|
3
1
|
import { PureComponent } from 'react';
|
4
2
|
import PropTypes from 'prop-types';
|
5
3
|
import shortcuts from './core.js';
|
6
|
-
import 'core-js/modules/es.array.concat.js';
|
7
|
-
import 'core-js/modules/es.array.find-index.js';
|
8
|
-
import 'core-js/modules/es.array.includes.js';
|
9
|
-
import 'core-js/modules/es.array.slice.js';
|
10
|
-
import 'core-js/modules/es.array.splice.js';
|
11
|
-
import 'core-js/modules/es.object.assign.js';
|
12
|
-
import 'core-js/modules/es.regexp.exec.js';
|
13
|
-
import 'core-js/modules/es.string.includes.js';
|
14
|
-
import 'core-js/modules/es.string.match.js';
|
15
4
|
import 'combokeys';
|
16
5
|
import '../global/sniffer.js';
|
17
6
|
import 'sniffr';
|
18
7
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
8
|
+
class Shortcuts extends PureComponent {
|
9
|
+
static propTypes = {
|
10
|
+
map: PropTypes.object.isRequired,
|
11
|
+
scope: PropTypes.string.isRequired,
|
12
|
+
options: PropTypes.object,
|
13
|
+
disabled: PropTypes.bool,
|
14
|
+
children: PropTypes.node
|
15
|
+
};
|
16
|
+
static defaultProps = {
|
17
|
+
options: {}
|
18
|
+
};
|
19
|
+
componentDidMount() {
|
20
|
+
if (!this.props.disabled) {
|
21
|
+
this.turnShorcutsOn();
|
31
22
|
}
|
32
|
-
}
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
}
|
41
|
-
if (prevProps.disabled && !disabled) {
|
42
|
-
this.turnShorcutsOn();
|
43
|
-
}
|
44
|
-
if (prevProps.map !== map) {
|
45
|
-
shortcuts.bindMap(map, this.props);
|
46
|
-
}
|
23
|
+
}
|
24
|
+
componentDidUpdate(prevProps) {
|
25
|
+
const {
|
26
|
+
disabled,
|
27
|
+
map
|
28
|
+
} = this.props;
|
29
|
+
if (!prevProps.disabled && disabled) {
|
30
|
+
this.turnShorcutsOff();
|
47
31
|
}
|
48
|
-
|
49
|
-
|
50
|
-
value: function componentWillUnmount() {
|
51
|
-
if (!this.props.disabled) {
|
52
|
-
this.turnShorcutsOff();
|
53
|
-
}
|
32
|
+
if (prevProps.disabled && !disabled) {
|
33
|
+
this.turnShorcutsOn();
|
54
34
|
}
|
55
|
-
|
56
|
-
key: "turnShorcutsOn",
|
57
|
-
value: function turnShorcutsOn() {
|
58
|
-
var _this$props2 = this.props,
|
59
|
-
map = _this$props2.map,
|
60
|
-
scope = _this$props2.scope,
|
61
|
-
options = _this$props2.options;
|
35
|
+
if (prevProps.map !== map) {
|
62
36
|
shortcuts.bindMap(map, this.props);
|
63
|
-
shortcuts.pushScope(scope, options);
|
64
37
|
}
|
65
|
-
}
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
shortcuts.unbindScope(scope);
|
70
|
-
shortcuts.spliceScope(scope);
|
71
|
-
}
|
72
|
-
}, {
|
73
|
-
key: "render",
|
74
|
-
value: function render() {
|
75
|
-
return this.props.children || null;
|
38
|
+
}
|
39
|
+
componentWillUnmount() {
|
40
|
+
if (!this.props.disabled) {
|
41
|
+
this.turnShorcutsOff();
|
76
42
|
}
|
77
|
-
}
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
43
|
+
}
|
44
|
+
turnShorcutsOn() {
|
45
|
+
const {
|
46
|
+
map,
|
47
|
+
scope,
|
48
|
+
options
|
49
|
+
} = this.props;
|
50
|
+
shortcuts.bindMap(map, this.props);
|
51
|
+
shortcuts.pushScope(scope, options);
|
52
|
+
}
|
53
|
+
turnShorcutsOff() {
|
54
|
+
const {
|
55
|
+
scope
|
56
|
+
} = this.props;
|
57
|
+
shortcuts.unbindScope(scope);
|
58
|
+
shortcuts.spliceScope(scope);
|
59
|
+
}
|
60
|
+
render() {
|
61
|
+
return this.props.children || null;
|
62
|
+
}
|
63
|
+
}
|
89
64
|
|
90
65
|
export { Shortcuts as default };
|
@@ -1,6 +1,3 @@
|
|
1
|
-
import { j as _slicedToArray, d as _objectSpread2, k as _toConsumableArray } from '../_helpers/_rollupPluginBabelHelpers.js';
|
2
|
-
import 'core-js/modules/es.array.index-of.js';
|
3
|
-
import 'core-js/modules/es.array.map.js';
|
4
1
|
import React, { useRef, useState, useMemo, useCallback, useEffect, Fragment } from 'react';
|
5
2
|
import classNames from 'classnames';
|
6
3
|
import { isArray } from '../global/typescript-utils.js';
|
@@ -9,140 +6,114 @@ import getUID from '../global/get-uid.js';
|
|
9
6
|
import { toRange, validateValue, calculateMarks, toPercent, calculateValue, adjustValues, HUNDRED } from './slider.utils.js';
|
10
7
|
import 'prop-types';
|
11
8
|
import '../shortcuts/core.js';
|
12
|
-
import 'core-js/modules/es.array.concat.js';
|
13
|
-
import 'core-js/modules/es.array.find-index.js';
|
14
|
-
import 'core-js/modules/es.array.includes.js';
|
15
|
-
import 'core-js/modules/es.array.slice.js';
|
16
|
-
import 'core-js/modules/es.array.splice.js';
|
17
|
-
import 'core-js/modules/es.object.assign.js';
|
18
|
-
import 'core-js/modules/es.regexp.exec.js';
|
19
|
-
import 'core-js/modules/es.string.includes.js';
|
20
|
-
import 'core-js/modules/es.string.match.js';
|
21
9
|
import 'combokeys';
|
22
10
|
import '../global/sniffer.js';
|
23
11
|
import 'sniffr';
|
24
|
-
import 'core-js/modules/es.object.to-string.js';
|
25
|
-
import 'core-js/modules/es.regexp.to-string.js';
|
26
|
-
import 'core-js/modules/es.array.from.js';
|
27
12
|
|
28
13
|
var modules_b653e84a = {"dark":"dark_rui_f090","slider":"slider_rui_35ea","disabled":"disabled_rui_35ea","marked":"marked_rui_35ea","rail":"rail_rui_35ea","rounded":"rounded_rui_35ea","track":"track_rui_35ea","thumb":"thumb_rui_35ea resetButton_rui_f295","dragged":"dragged_rui_35ea","tick":"tick_rui_35ea","active":"active_rui_35ea","markValue":"markValue_rui_35ea","tag":"tag_rui_35ea"};
|
29
14
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
min =
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
var validStep = step < 0 ? 0 : step;
|
56
|
-
var isRange = isArray(defaultValue !== null && defaultValue !== void 0 ? defaultValue : value);
|
57
|
-
var _useState3 = useState(false),
|
58
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
59
|
-
isDragging = _useState4[0],
|
60
|
-
setIsDragging = _useState4[1];
|
61
|
-
var _useState5 = useState(-1),
|
62
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
63
|
-
draggedIndex = _useState6[0],
|
64
|
-
setDraggedIndex = _useState6[1];
|
65
|
-
var _useState7 = useState(getUID('ring-slider-')),
|
66
|
-
_useState8 = _slicedToArray(_useState7, 1),
|
67
|
-
shortcutsScope = _useState8[0];
|
68
|
-
var markValues = useMemo(function () {
|
15
|
+
const Slider = _ref => {
|
16
|
+
let {
|
17
|
+
defaultValue,
|
18
|
+
value,
|
19
|
+
min = 0,
|
20
|
+
max = HUNDRED,
|
21
|
+
step = 1,
|
22
|
+
disabled,
|
23
|
+
marks,
|
24
|
+
showTicks,
|
25
|
+
showTag,
|
26
|
+
className,
|
27
|
+
renderTag,
|
28
|
+
onChange
|
29
|
+
} = _ref;
|
30
|
+
const ref = useRef(null);
|
31
|
+
const previouslyDragged = useRef(false);
|
32
|
+
const [values, setValues] = useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : min);
|
33
|
+
const validValues = useMemo(() => toRange(value !== null && value !== void 0 ? value : values, min, max), [max, min, value, values]);
|
34
|
+
const validStep = step < 0 ? 0 : step;
|
35
|
+
const isRange = isArray(defaultValue !== null && defaultValue !== void 0 ? defaultValue : value);
|
36
|
+
const [isDragging, setIsDragging] = useState(false);
|
37
|
+
const [draggedIndex, setDraggedIndex] = useState(-1);
|
38
|
+
const [shortcutsScope] = useState(getUID('ring-slider-'));
|
39
|
+
const markValues = useMemo(() => {
|
69
40
|
if (isArray(marks)) {
|
70
|
-
return marks.map(
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
});
|
41
|
+
return marks.map(mark => ({
|
42
|
+
...mark,
|
43
|
+
value: validateValue(mark.value, min, max)
|
44
|
+
}));
|
75
45
|
} else if (marks) {
|
76
46
|
return calculateMarks(min, max, validStep);
|
77
47
|
}
|
78
48
|
return [];
|
79
49
|
}, [marks, max, min, validStep]);
|
80
|
-
|
50
|
+
const tickMarks = useMemo(() => {
|
81
51
|
if (showTicks) {
|
82
52
|
return markValues.length ? markValues : calculateMarks(min, max, validStep);
|
83
53
|
}
|
84
54
|
return [];
|
85
55
|
}, [max, min, markValues, showTicks, validStep]);
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
var trackLength = useMemo(function () {
|
90
|
-
return toPercent(Math.max.apply(Math, _toConsumableArray(validValues)), min, max) - trackStart;
|
91
|
-
}, [max, min, trackStart, validValues]);
|
92
|
-
var handleValueChange = useCallback(function (nextValues) {
|
56
|
+
const trackStart = useMemo(() => toPercent(isRange ? Math.min(...validValues) : min, min, max), [isRange, max, min, validValues]);
|
57
|
+
const trackLength = useMemo(() => toPercent(Math.max(...validValues), min, max) - trackStart, [max, min, trackStart, validValues]);
|
58
|
+
const handleValueChange = useCallback(nextValues => {
|
93
59
|
setValues(nextValues);
|
94
|
-
onChange
|
60
|
+
onChange?.(isRange ? nextValues : nextValues[0]);
|
95
61
|
}, [isRange, onChange]);
|
96
|
-
|
97
|
-
|
98
|
-
|
62
|
+
const shortcutsMap = useMemo(() => {
|
63
|
+
const setValueAndSwap = (nextValue, index) => {
|
64
|
+
const nextValues = [...validValues];
|
99
65
|
nextValues[index] = nextValue;
|
100
66
|
if (nextValues[0] > nextValues[1]) {
|
101
|
-
|
102
|
-
var previousValue = nextValues[index];
|
67
|
+
const previousValue = nextValues[index];
|
103
68
|
nextValues.reverse();
|
104
|
-
|
105
|
-
thumb
|
69
|
+
const thumb = ref.current?.querySelector(`[role="slider"][data-index="${nextValues.indexOf(previousValue)}"]`);
|
70
|
+
thumb?.focus();
|
106
71
|
}
|
107
72
|
handleValueChange(nextValues);
|
108
73
|
};
|
109
|
-
|
110
|
-
|
111
|
-
};
|
112
|
-
var map = {};
|
74
|
+
const getIndex = target => Number(target?.getAttribute('data-index'));
|
75
|
+
const map = {};
|
113
76
|
if (!disabled) {
|
114
|
-
map.left = map.down =
|
115
|
-
|
116
|
-
|
77
|
+
map.left = map.down = _ref2 => {
|
78
|
+
let {
|
79
|
+
target
|
80
|
+
} = _ref2;
|
81
|
+
const index = getIndex(target);
|
117
82
|
setValueAndSwap(Math.max(min, validValues[index] - validStep), index);
|
118
83
|
};
|
119
|
-
map.right = map.up =
|
120
|
-
|
121
|
-
|
84
|
+
map.right = map.up = _ref3 => {
|
85
|
+
let {
|
86
|
+
target
|
87
|
+
} = _ref3;
|
88
|
+
const index = getIndex(target);
|
122
89
|
setValueAndSwap(Math.min(max, validValues[index] + validStep), index);
|
123
90
|
};
|
124
|
-
map.home =
|
125
|
-
|
126
|
-
|
91
|
+
map.home = _ref4 => {
|
92
|
+
let {
|
93
|
+
target
|
94
|
+
} = _ref4;
|
95
|
+
const index = getIndex(target);
|
127
96
|
setValueAndSwap(min, index);
|
128
97
|
};
|
129
|
-
map.end =
|
130
|
-
|
131
|
-
|
98
|
+
map.end = _ref5 => {
|
99
|
+
let {
|
100
|
+
target
|
101
|
+
} = _ref5;
|
102
|
+
const index = getIndex(target);
|
132
103
|
setValueAndSwap(max, index);
|
133
104
|
};
|
134
105
|
}
|
135
106
|
return map;
|
136
107
|
}, [disabled, handleValueChange, max, min, validStep, validValues]);
|
137
|
-
|
108
|
+
const handleMouseDown = useCallback(e => {
|
138
109
|
e.stopPropagation();
|
139
110
|
if (disabled) {
|
140
111
|
return;
|
141
112
|
}
|
142
|
-
|
143
|
-
|
113
|
+
const index = e.currentTarget.getAttribute('data-index');
|
114
|
+
const nextValue = calculateValue(ref, e.pageX, min, max, validStep);
|
144
115
|
if (nextValue !== null && !isNaN(nextValue) && !index) {
|
145
|
-
|
116
|
+
const rangeIndex = Number(Math.abs(validValues[0] - nextValue) > Math.abs(validValues[1] - nextValue));
|
146
117
|
setDraggedIndex(isRange ? rangeIndex : 0);
|
147
118
|
} else {
|
148
119
|
setDraggedIndex(Number(index));
|
@@ -150,9 +121,11 @@ var Slider = function Slider(_ref) {
|
|
150
121
|
setIsDragging(true);
|
151
122
|
previouslyDragged.current = false;
|
152
123
|
}, [disabled, isRange, max, min, validStep, validValues]);
|
153
|
-
|
154
|
-
|
155
|
-
|
124
|
+
const handleMouseUp = useCallback(_ref6 => {
|
125
|
+
let {
|
126
|
+
pageX
|
127
|
+
} = _ref6;
|
128
|
+
const nextValues = adjustValues(validValues, ref, draggedIndex, pageX, max, min, validStep);
|
156
129
|
if (nextValues[0] > nextValues[1]) {
|
157
130
|
nextValues.reverse();
|
158
131
|
}
|
@@ -161,18 +134,18 @@ var Slider = function Slider(_ref) {
|
|
161
134
|
setIsDragging(false);
|
162
135
|
previouslyDragged.current = true;
|
163
136
|
}, [validValues, draggedIndex, handleValueChange, max, min, validStep]);
|
164
|
-
|
165
|
-
|
166
|
-
|
137
|
+
const handleMouseMove = useCallback(_ref7 => {
|
138
|
+
let {
|
139
|
+
pageX
|
140
|
+
} = _ref7;
|
141
|
+
const nextValues = adjustValues(validValues, ref, draggedIndex, pageX, max, min, validStep);
|
167
142
|
if (nextValues[0] > nextValues[1]) {
|
168
143
|
nextValues.reverse();
|
169
|
-
setDraggedIndex(
|
170
|
-
return prevState === 0 ? 1 : 0;
|
171
|
-
});
|
144
|
+
setDraggedIndex(prevState => prevState === 0 ? 1 : 0);
|
172
145
|
}
|
173
146
|
handleValueChange(nextValues);
|
174
147
|
}, [validValues, draggedIndex, max, min, validStep, handleValueChange]);
|
175
|
-
useEffect(
|
148
|
+
useEffect(() => {
|
176
149
|
if (disabled) {
|
177
150
|
return undefined;
|
178
151
|
}
|
@@ -183,7 +156,7 @@ var Slider = function Slider(_ref) {
|
|
183
156
|
window.removeEventListener('mousemove', handleMouseMove);
|
184
157
|
window.removeEventListener('mouseup', handleMouseUp);
|
185
158
|
}
|
186
|
-
return
|
159
|
+
return () => {
|
187
160
|
window.removeEventListener('mousemove', handleMouseMove);
|
188
161
|
window.removeEventListener('mouseup', handleMouseUp);
|
189
162
|
};
|
@@ -208,15 +181,15 @@ var Slider = function Slider(_ref) {
|
|
208
181
|
})
|
209
182
|
}), /*#__PURE__*/React.createElement("div", {
|
210
183
|
style: {
|
211
|
-
left:
|
212
|
-
width:
|
184
|
+
left: `${trackStart}%`,
|
185
|
+
width: `${trackLength}%`
|
213
186
|
},
|
214
187
|
className: classNames(modules_b653e84a.track, {
|
215
188
|
[modules_b653e84a.rounded]: !showTicks,
|
216
189
|
[modules_b653e84a.disabled]: disabled
|
217
190
|
})
|
218
|
-
}), validValues.map(
|
219
|
-
|
191
|
+
}), validValues.map((numValue, index) => {
|
192
|
+
const percent = toPercent(numValue, min, max);
|
220
193
|
return (
|
221
194
|
/*#__PURE__*/
|
222
195
|
// eslint-disable-next-line react/no-array-index-key
|
@@ -231,7 +204,7 @@ var Slider = function Slider(_ref) {
|
|
231
204
|
"aria-valuenow": numValue,
|
232
205
|
"data-index": index,
|
233
206
|
style: {
|
234
|
-
left:
|
207
|
+
left: `${percent}%`
|
235
208
|
},
|
236
209
|
className: classNames(modules_b653e84a.thumb, {
|
237
210
|
[modules_b653e84a.disabled]: disabled,
|
@@ -240,7 +213,7 @@ var Slider = function Slider(_ref) {
|
|
240
213
|
onMouseDown: handleMouseDown
|
241
214
|
}), showTag && /*#__PURE__*/React.createElement("div", {
|
242
215
|
style: {
|
243
|
-
left:
|
216
|
+
left: `${percent}%`
|
244
217
|
},
|
245
218
|
className: classNames(modules_b653e84a.tag, {
|
246
219
|
[modules_b653e84a.disabled]: disabled
|
@@ -248,24 +221,28 @@ var Slider = function Slider(_ref) {
|
|
248
221
|
role: "tooltip"
|
249
222
|
}, renderTag ? renderTag(numValue) : numValue))
|
250
223
|
);
|
251
|
-
}), markValues.map(
|
252
|
-
|
253
|
-
|
254
|
-
|
224
|
+
}), markValues.map((_ref8, index) => {
|
225
|
+
let {
|
226
|
+
value: markValue,
|
227
|
+
label
|
228
|
+
} = _ref8;
|
229
|
+
const percent = toPercent(markValue, min, max);
|
255
230
|
return /*#__PURE__*/React.createElement("div", {
|
256
231
|
// eslint-disable-next-line react/no-array-index-key
|
257
232
|
key: index,
|
258
233
|
style: {
|
259
|
-
left:
|
234
|
+
left: `${percent}%`
|
260
235
|
},
|
261
236
|
className: classNames(modules_b653e84a.markValue, {
|
262
237
|
[modules_b653e84a.disabled]: disabled
|
263
238
|
})
|
264
239
|
}, label !== null && label !== void 0 ? label : markValue);
|
265
|
-
}), tickMarks.map(
|
266
|
-
|
267
|
-
|
268
|
-
|
240
|
+
}), tickMarks.map((_ref9, index) => {
|
241
|
+
let {
|
242
|
+
value: tickValue
|
243
|
+
} = _ref9;
|
244
|
+
const percent = toPercent(tickValue, min, max);
|
245
|
+
const isActive = isRange ? tickValue >= validValues[0] && tickValue <= validValues[validValues.length - 1] : tickValue <= validValues[0];
|
269
246
|
return /*#__PURE__*/React.createElement("div", {
|
270
247
|
// eslint-disable-next-line react/no-array-index-key
|
271
248
|
key: index,
|
@@ -274,7 +251,7 @@ var Slider = function Slider(_ref) {
|
|
274
251
|
[modules_b653e84a.disabled]: disabled
|
275
252
|
}),
|
276
253
|
style: {
|
277
|
-
left:
|
254
|
+
left: `${percent}%`
|
278
255
|
}
|
279
256
|
});
|
280
257
|
}));
|
@@ -1,12 +1,6 @@
|
|
1
|
-
import { k as _toConsumableArray } from '../_helpers/_rollupPluginBabelHelpers.js';
|
2
|
-
import 'core-js/modules/es.array.from.js';
|
3
|
-
import 'core-js/modules/es.array.map.js';
|
4
|
-
import 'core-js/modules/es.array.slice.js';
|
5
|
-
import 'core-js/modules/es.object.to-string.js';
|
6
|
-
import 'core-js/modules/es.regexp.to-string.js';
|
7
1
|
import { isArray } from '../global/typescript-utils.js';
|
8
2
|
|
9
|
-
|
3
|
+
const HUNDRED = 100;
|
10
4
|
function toPercent(value, min, max) {
|
11
5
|
return (value - min) * HUNDRED / (max - min);
|
12
6
|
}
|
@@ -17,15 +11,15 @@ function roundToStep(value, step, min) {
|
|
17
11
|
return Math.round((value - min) / step) * step + min;
|
18
12
|
}
|
19
13
|
function calculateValue(ref, x, min, max, step) {
|
20
|
-
var _step$toString$split;
|
21
14
|
if (!ref.current) {
|
22
15
|
return null;
|
23
16
|
}
|
24
|
-
|
25
|
-
width
|
26
|
-
left
|
27
|
-
|
28
|
-
|
17
|
+
const {
|
18
|
+
width,
|
19
|
+
left
|
20
|
+
} = ref.current.getBoundingClientRect();
|
21
|
+
const value = toValue((x - left) / width, min, max);
|
22
|
+
const precision = step.toString().split('.')?.[1]?.length;
|
29
23
|
return Number(roundToStep(value, step, min).toFixed(precision));
|
30
24
|
}
|
31
25
|
function validateValue(value, min, max) {
|
@@ -39,9 +33,7 @@ function validateValue(value, min, max) {
|
|
39
33
|
}
|
40
34
|
function toRange(value, min, max) {
|
41
35
|
if (isArray(value)) {
|
42
|
-
|
43
|
-
return validateValue(val, min, max);
|
44
|
-
});
|
36
|
+
const nextValues = value.slice(0, 2).map(val => validateValue(val, min, max));
|
45
37
|
if (nextValues[0] > nextValues[1]) {
|
46
38
|
nextValues.reverse();
|
47
39
|
}
|
@@ -51,22 +43,20 @@ function toRange(value, min, max) {
|
|
51
43
|
}
|
52
44
|
}
|
53
45
|
function adjustValues(values, ref, index, x, max, min, step) {
|
54
|
-
|
55
|
-
|
46
|
+
const nextValue = calculateValue(ref, x, min, max, step);
|
47
|
+
const nextValues = [...values];
|
56
48
|
if (nextValue !== null && !isNaN(nextValue)) {
|
57
49
|
nextValues[index] = validateValue(nextValue, min, max);
|
58
50
|
}
|
59
51
|
return nextValues;
|
60
52
|
}
|
61
53
|
function calculateMarks(min, max, step) {
|
62
|
-
|
54
|
+
const numMarks = Math.floor((max - min) / step) + 1;
|
63
55
|
return Array.from({
|
64
56
|
length: numMarks
|
65
|
-
},
|
66
|
-
|
67
|
-
|
68
|
-
};
|
69
|
-
});
|
57
|
+
}, (_, index) => ({
|
58
|
+
value: validateValue(min + step * index, min, max)
|
59
|
+
}));
|
70
60
|
}
|
71
61
|
|
72
62
|
export { HUNDRED, adjustValues, calculateMarks, calculateValue, toPercent, toRange, validateValue };
|
@@ -1,20 +1,11 @@
|
|
1
1
|
import LocalStorage from './storage__local.js';
|
2
2
|
import FallbackStorage from './storage__fallback.js';
|
3
|
-
import '../_helpers/_rollupPluginBabelHelpers.js';
|
4
|
-
import 'core-js/modules/es.array.iterator.js';
|
5
|
-
import 'core-js/modules/es.object.to-string.js';
|
6
|
-
import 'core-js/modules/es.promise.js';
|
7
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
8
3
|
import '../alert-service/alert-service.js';
|
9
|
-
import '
|
10
|
-
import 'core-js/modules/es.array.filter.js';
|
11
|
-
import 'core-js/modules/es.array.map.js';
|
4
|
+
import '../_helpers/_rollupPluginBabelHelpers.js';
|
12
5
|
import 'react';
|
13
6
|
import 'react-dom/client';
|
14
7
|
import '../global/get-uid.js';
|
15
|
-
import 'core-js/modules/es.regexp.to-string.js';
|
16
8
|
import '../alert/alert.js';
|
17
|
-
import 'core-js/modules/es.object.values.js';
|
18
9
|
import 'classnames';
|
19
10
|
import 'prop-types';
|
20
11
|
import '@jetbrains/icons/exception';
|
@@ -25,21 +16,10 @@ import '../icon/icon.js';
|
|
25
16
|
import 'util-deprecate';
|
26
17
|
import '../icon/icon__constants.js';
|
27
18
|
import '../_helpers/icon__svg.js';
|
28
|
-
import 'core-js/modules/es.regexp.exec.js';
|
29
|
-
import 'core-js/modules/es.string.replace.js';
|
30
|
-
import 'core-js/modules/es.string.starts-with.js';
|
31
19
|
import '../global/memoize.js';
|
32
|
-
import 'core-js/modules/es.map.js';
|
33
|
-
import 'core-js/modules/es.weak-map.js';
|
34
20
|
import '../loader-inline/loader-inline.js';
|
35
21
|
import '../global/data-tests.js';
|
36
|
-
import 'core-js/modules/es.array.reduce.js';
|
37
|
-
import 'core-js/modules/es.object.entries.js';
|
38
22
|
import '../global/dom.js';
|
39
|
-
import 'core-js/modules/es.object.assign.js';
|
40
|
-
import 'core-js/modules/es.set.js';
|
41
|
-
import 'core-js/modules/es.string.split.js';
|
42
|
-
import 'core-js/modules/web.dom-collections.for-each.js';
|
43
23
|
import '../button/button.js';
|
44
24
|
import '@jetbrains/icons/chevron-10px';
|
45
25
|
import '../link/clickableLink.js';
|
@@ -52,22 +32,13 @@ import '../popup/popup.js';
|
|
52
32
|
import '../global/schedule-raf.js';
|
53
33
|
import '../shortcuts/shortcuts.js';
|
54
34
|
import '../shortcuts/core.js';
|
55
|
-
import 'core-js/modules/es.array.find-index.js';
|
56
|
-
import 'core-js/modules/es.array.includes.js';
|
57
|
-
import 'core-js/modules/es.array.slice.js';
|
58
|
-
import 'core-js/modules/es.array.splice.js';
|
59
|
-
import 'core-js/modules/es.string.includes.js';
|
60
|
-
import 'core-js/modules/es.string.match.js';
|
61
35
|
import 'combokeys';
|
62
36
|
import '../global/sniffer.js';
|
63
37
|
import 'sniffr';
|
64
38
|
import '../tab-trap/tab-trap.js';
|
65
39
|
import '../popup/position.js';
|
66
|
-
import 'core-js/modules/es.array.sort.js';
|
67
40
|
import '../popup/popup.consts.js';
|
68
41
|
import '../alert/container.js';
|
69
|
-
import 'core-js/modules/es.array.index-of.js';
|
70
|
-
import 'core-js/modules/es.reflect.delete-property.js';
|
71
42
|
import 'deep-equal';
|
72
43
|
|
73
44
|
/**
|
@@ -77,16 +48,16 @@ import 'deep-equal';
|
|
77
48
|
* @constructor
|
78
49
|
* @extends {LocalStorage}
|
79
50
|
*/
|
80
|
-
|
51
|
+
let Storage = LocalStorage;
|
81
52
|
// Using try/catch here because of IE10+ protected mode and other browsers' quirks
|
82
53
|
// See https://github.com/Modernizr/Modernizr/blob/master/feature-detects/storage/localstorage.js
|
83
54
|
try {
|
84
|
-
|
55
|
+
const temp = 'testStorage';
|
85
56
|
localStorage.setItem(temp, temp);
|
86
57
|
localStorage.removeItem(temp);
|
87
58
|
} catch (e) {
|
88
59
|
Storage = FallbackStorage;
|
89
60
|
}
|
90
|
-
|
61
|
+
const ActualStorage = Storage;
|
91
62
|
|
92
63
|
export { ActualStorage as default };
|