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