@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,51 +1,39 @@
|
|
|
1
|
-
import { _ as _defineProperty } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import 'core-js/modules/es.regexp.exec.js';
|
|
3
1
|
import Combokeys from 'combokeys';
|
|
4
2
|
import sniffr from '../global/sniffer.js';
|
|
5
3
|
import 'sniffr';
|
|
6
4
|
|
|
7
5
|
class Shortcuts {
|
|
6
|
+
ALLOW_SHORTCUTS_SELECTOR = '.ring-js-shortcuts';
|
|
7
|
+
ROOT_SCOPE = {
|
|
8
|
+
scopeId: 'ROOT',
|
|
9
|
+
options: {}
|
|
10
|
+
};
|
|
11
|
+
_scopes = {};
|
|
12
|
+
_scopeChain = [];
|
|
13
|
+
combokeys = new Combokeys(document.documentElement);
|
|
14
|
+
trigger = combo => this.combokeys.trigger(combo);
|
|
8
15
|
constructor() {
|
|
9
|
-
_defineProperty(this, "ALLOW_SHORTCUTS_SELECTOR", '.ring-js-shortcuts');
|
|
10
|
-
_defineProperty(this, "ROOT_SCOPE", {
|
|
11
|
-
scopeId: 'ROOT',
|
|
12
|
-
options: {}
|
|
13
|
-
});
|
|
14
|
-
_defineProperty(this, "_scopes", {});
|
|
15
|
-
_defineProperty(this, "_scopeChain", []);
|
|
16
|
-
_defineProperty(this, "combokeys", new Combokeys(document.documentElement));
|
|
17
|
-
_defineProperty(this, "trigger", combo => this.combokeys.trigger(combo));
|
|
18
|
-
_defineProperty(this, "_dispatcher", (e, key) => {
|
|
19
|
-
let currentScope;
|
|
20
|
-
for (let i = this._scopeChain.length - 1; i >= 0; i--) {
|
|
21
|
-
const scopeInChain = this._scopeChain[i];
|
|
22
|
-
currentScope = this._scopes[scopeInChain.scopeId];
|
|
23
|
-
if (currentScope && key !== null && key !== undefined && currentScope[key]) {
|
|
24
|
-
const ret = currentScope[key](e, key, scopeInChain.scopeId);
|
|
25
|
-
// Fall down in chain when returning true
|
|
26
|
-
if (ret !== true) {
|
|
27
|
-
return ret;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
if (scopeInChain.options.modal) {
|
|
31
|
-
return true;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return undefined;
|
|
35
|
-
});
|
|
36
|
-
_defineProperty(this, "_defaultFilter", (e, element, key) => {
|
|
37
|
-
// if the element or its parents have the class "ring-js-shortcuts" then no need to stop
|
|
38
|
-
if (element === document || !(element instanceof HTMLElement) || key === null || element.matches(this.ALLOW_SHORTCUTS_SELECTOR) || (element.dataset.enabledShortcuts ? key && element.dataset.enabledShortcuts.split(',').includes(key) : !!element.closest(this.ALLOW_SHORTCUTS_SELECTOR))) {
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
const elementContentEditableAttribute = element.contentEditable;
|
|
42
|
-
const isElementContentEditable = elementContentEditableAttribute === 'true' || elementContentEditableAttribute === 'plaintext-only';
|
|
43
|
-
// stop for input, select, textarea and content-editable elements
|
|
44
|
-
return element.matches('input:not([type=checkbox]),select,textarea') || isElementContentEditable;
|
|
45
|
-
});
|
|
46
16
|
this.setFilter();
|
|
47
17
|
this.setScope();
|
|
48
18
|
}
|
|
19
|
+
_dispatcher = (e, key) => {
|
|
20
|
+
let currentScope;
|
|
21
|
+
for (let i = this._scopeChain.length - 1; i >= 0; i--) {
|
|
22
|
+
const scopeInChain = this._scopeChain[i];
|
|
23
|
+
currentScope = this._scopes[scopeInChain.scopeId];
|
|
24
|
+
if (currentScope && key !== null && key !== undefined && currentScope[key]) {
|
|
25
|
+
const ret = currentScope[key](e, key, scopeInChain.scopeId);
|
|
26
|
+
// Fall down in chain when returning true
|
|
27
|
+
if (ret !== true) {
|
|
28
|
+
return ret;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (scopeInChain.options.modal) {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return undefined;
|
|
36
|
+
};
|
|
49
37
|
/**
|
|
50
38
|
* Binds a handler to a shortcut
|
|
51
39
|
*
|
|
@@ -115,8 +103,7 @@ class Shortcuts {
|
|
|
115
103
|
* @param options.modal whether keys should fall through this scope or not.
|
|
116
104
|
* Useful for modals or overlays
|
|
117
105
|
*/
|
|
118
|
-
pushScope(scopeId) {
|
|
119
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
106
|
+
pushScope(scopeId, options = {}) {
|
|
120
107
|
if (scopeId) {
|
|
121
108
|
const position = this.indexOfScope(scopeId);
|
|
122
109
|
if (position !== -1) {
|
|
@@ -162,17 +149,25 @@ class Shortcuts {
|
|
|
162
149
|
this._scopeChain = [this.ROOT_SCOPE];
|
|
163
150
|
}
|
|
164
151
|
}
|
|
165
|
-
wrapScope(scopeId) {
|
|
166
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
152
|
+
wrapScope(scopeId, options = {}) {
|
|
167
153
|
return {
|
|
168
154
|
scopeId,
|
|
169
155
|
options
|
|
170
156
|
};
|
|
171
157
|
}
|
|
172
158
|
hasKey(key, scope) {
|
|
173
|
-
|
|
174
|
-
return !!((_this$_scopes$scope = this._scopes[scope]) !== null && _this$_scopes$scope !== void 0 && _this$_scopes$scope[key]);
|
|
159
|
+
return !!this._scopes[scope]?.[key];
|
|
175
160
|
}
|
|
161
|
+
_defaultFilter = (e, element, key) => {
|
|
162
|
+
// if the element or its parents have the class "ring-js-shortcuts" then no need to stop
|
|
163
|
+
if (element === document || !(element instanceof HTMLElement) || key === null || element.matches(this.ALLOW_SHORTCUTS_SELECTOR) || (element.dataset.enabledShortcuts ? key && element.dataset.enabledShortcuts.split(',').includes(key) : !!element.closest(this.ALLOW_SHORTCUTS_SELECTOR))) {
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
const elementContentEditableAttribute = element.contentEditable;
|
|
167
|
+
const isElementContentEditable = elementContentEditableAttribute === 'true' || elementContentEditableAttribute === 'plaintext-only';
|
|
168
|
+
// stop for input, select, textarea and content-editable elements
|
|
169
|
+
return element.matches('input:not([type=checkbox]),select,textarea') || isElementContentEditable;
|
|
170
|
+
};
|
|
176
171
|
_getKeyboardEventType(params) {
|
|
177
172
|
if (!params.type && sniffr.os.name === 'windows') {
|
|
178
173
|
const isSystemShortcut = typeof params.key === 'string' && params.key.match(/ctrl/i) && params.key.match(/shift/i) && params.key.match(/[0-9]/);
|
|
@@ -1,35 +1,29 @@
|
|
|
1
|
-
import { _ as _defineProperty, 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 { Component } from 'react';
|
|
5
3
|
import getUID from '../global/get-uid.js';
|
|
6
4
|
import Shortcuts from './shortcuts.js';
|
|
7
5
|
import './core.js';
|
|
8
|
-
import 'core-js/modules/es.regexp.exec.js';
|
|
9
6
|
import 'combokeys';
|
|
10
7
|
import '../global/sniffer.js';
|
|
11
8
|
import 'sniffr';
|
|
12
9
|
|
|
13
|
-
const _excluded = ["rgShortcutsOptions", "rgShortcutsMap"];
|
|
14
10
|
function shortcutsHOC(ComposedComponent) {
|
|
15
11
|
return class WithShortcuts extends Component {
|
|
16
|
-
|
|
17
|
-
super(...arguments);
|
|
18
|
-
_defineProperty(this, "_shortcutsScopeUid", getUID('rg-shortcuts-'));
|
|
19
|
-
}
|
|
12
|
+
_shortcutsScopeUid = getUID('rg-shortcuts-');
|
|
20
13
|
render() {
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
props = _objectWithoutProperties(_this$props, _excluded);
|
|
14
|
+
const {
|
|
15
|
+
rgShortcutsOptions,
|
|
16
|
+
rgShortcutsMap,
|
|
17
|
+
...props
|
|
18
|
+
} = this.props;
|
|
27
19
|
return jsx(Shortcuts, {
|
|
28
20
|
scope: this._shortcutsScopeUid,
|
|
29
21
|
map: rgShortcutsMap,
|
|
30
22
|
options: rgShortcutsOptions,
|
|
31
23
|
disabled: rgShortcutsOptions.disabled,
|
|
32
|
-
children: jsx(ComposedComponent,
|
|
24
|
+
children: jsx(ComposedComponent, {
|
|
25
|
+
...props
|
|
26
|
+
})
|
|
33
27
|
});
|
|
34
28
|
}
|
|
35
29
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { _ as _defineProperty } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
1
|
import { PureComponent } from 'react';
|
|
3
2
|
import shortcuts from './core.js';
|
|
4
|
-
import 'core-js/modules/es.regexp.exec.js';
|
|
5
3
|
import 'combokeys';
|
|
6
4
|
import '../global/sniffer.js';
|
|
7
5
|
import 'sniffr';
|
|
8
6
|
|
|
9
7
|
class Shortcuts extends PureComponent {
|
|
8
|
+
static defaultProps = {
|
|
9
|
+
options: {}
|
|
10
|
+
};
|
|
10
11
|
componentDidMount() {
|
|
11
12
|
if (!this.props.disabled) {
|
|
12
13
|
this.turnShorcutsOn();
|
|
@@ -52,8 +53,5 @@ class Shortcuts extends PureComponent {
|
|
|
52
53
|
return this.props.children || null;
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
|
-
_defineProperty(Shortcuts, "defaultProps", {
|
|
56
|
-
options: {}
|
|
57
|
-
});
|
|
58
56
|
|
|
59
57
|
export { Shortcuts as default };
|
|
@@ -1,36 +1,31 @@
|
|
|
1
|
-
import { b as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import 'core-js/modules/es.array.reverse.js';
|
|
3
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
4
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
2
|
import { useRef, useState, useMemo, useCallback, useEffect, Fragment } from 'react';
|
|
6
3
|
import classNames from 'classnames';
|
|
7
4
|
import { isArray } from '../global/typescript-utils.js';
|
|
8
5
|
import Shortcuts from '../shortcuts/shortcuts.js';
|
|
9
6
|
import getUID from '../global/get-uid.js';
|
|
10
|
-
import {
|
|
7
|
+
import { toRange, HUNDRED, validateValue, calculateMarks, toPercent, calculateValue, adjustValues } from './slider.utils.js';
|
|
11
8
|
import '../shortcuts/core.js';
|
|
12
|
-
import 'core-js/modules/es.regexp.exec.js';
|
|
13
9
|
import 'combokeys';
|
|
14
10
|
import '../global/sniffer.js';
|
|
15
11
|
import 'sniffr';
|
|
16
12
|
|
|
17
13
|
var styles = {"slider":"ring-slider-slider","disabled":"ring-slider-disabled","marked":"ring-slider-marked","rail":"ring-slider-rail","rounded":"ring-slider-rounded","track":"ring-slider-track","thumb":"ring-slider-thumb ring-global-resetButton","dragged":"ring-slider-dragged","tick":"ring-slider-tick","active":"ring-slider-active","markValue":"ring-slider-markValue","tag":"ring-slider-tag"};
|
|
18
14
|
|
|
19
|
-
const Slider =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
} = _ref;
|
|
15
|
+
const Slider = ({
|
|
16
|
+
defaultValue,
|
|
17
|
+
value,
|
|
18
|
+
min = 0,
|
|
19
|
+
max = HUNDRED,
|
|
20
|
+
step = 1,
|
|
21
|
+
disabled,
|
|
22
|
+
marks,
|
|
23
|
+
showTicks,
|
|
24
|
+
showTag,
|
|
25
|
+
className,
|
|
26
|
+
renderTag,
|
|
27
|
+
onChange
|
|
28
|
+
}) => {
|
|
34
29
|
const ref = useRef(null);
|
|
35
30
|
const previouslyDragged = useRef(false);
|
|
36
31
|
const [values, setValues] = useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : min);
|
|
@@ -42,7 +37,8 @@ const Slider = _ref => {
|
|
|
42
37
|
const [shortcutsScope] = useState(getUID('ring-slider-'));
|
|
43
38
|
const markValues = useMemo(() => {
|
|
44
39
|
if (isArray(marks)) {
|
|
45
|
-
return marks.map(mark =>
|
|
40
|
+
return marks.map(mark => ({
|
|
41
|
+
...mark,
|
|
46
42
|
value: validateValue(mark.value, min, max)
|
|
47
43
|
}));
|
|
48
44
|
}
|
|
@@ -61,49 +57,44 @@ const Slider = _ref => {
|
|
|
61
57
|
const trackLength = useMemo(() => toPercent(Math.max(...validValues), min, max) - trackStart, [max, min, trackStart, validValues]);
|
|
62
58
|
const handleValueChange = useCallback(nextValues => {
|
|
63
59
|
setValues(nextValues);
|
|
64
|
-
onChange
|
|
60
|
+
onChange?.(isRange ? nextValues : nextValues[0]);
|
|
65
61
|
}, [isRange, onChange]);
|
|
66
62
|
const shortcutsMap = useMemo(() => {
|
|
67
63
|
const setValueAndSwap = (nextValue, index) => {
|
|
68
64
|
const nextValues = [...validValues];
|
|
69
65
|
nextValues[index] = nextValue;
|
|
70
66
|
if (nextValues[0] > nextValues[1]) {
|
|
71
|
-
var _ref$current;
|
|
72
67
|
const previousValue = nextValues[index];
|
|
73
68
|
nextValues.reverse();
|
|
74
|
-
const thumb =
|
|
75
|
-
thumb
|
|
69
|
+
const thumb = ref.current?.querySelector(`[role="slider"][data-index="${nextValues.indexOf(previousValue)}"]`);
|
|
70
|
+
thumb?.focus();
|
|
76
71
|
}
|
|
77
72
|
handleValueChange(nextValues);
|
|
78
73
|
};
|
|
79
|
-
const getIndex = target => Number(target
|
|
74
|
+
const getIndex = target => Number(target?.getAttribute('data-index'));
|
|
80
75
|
const map = {};
|
|
81
76
|
if (!disabled) {
|
|
82
|
-
map.left = map.down =
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
} = _ref2;
|
|
77
|
+
map.left = map.down = ({
|
|
78
|
+
target
|
|
79
|
+
}) => {
|
|
86
80
|
const index = getIndex(target);
|
|
87
81
|
setValueAndSwap(Math.max(min, validValues[index] - validStep), index);
|
|
88
82
|
};
|
|
89
|
-
map.right = map.up =
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
} = _ref3;
|
|
83
|
+
map.right = map.up = ({
|
|
84
|
+
target
|
|
85
|
+
}) => {
|
|
93
86
|
const index = getIndex(target);
|
|
94
87
|
setValueAndSwap(Math.min(max, validValues[index] + validStep), index);
|
|
95
88
|
};
|
|
96
|
-
map.home =
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
} = _ref4;
|
|
89
|
+
map.home = ({
|
|
90
|
+
target
|
|
91
|
+
}) => {
|
|
100
92
|
const index = getIndex(target);
|
|
101
93
|
setValueAndSwap(min, index);
|
|
102
94
|
};
|
|
103
|
-
map.end =
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
} = _ref5;
|
|
95
|
+
map.end = ({
|
|
96
|
+
target
|
|
97
|
+
}) => {
|
|
107
98
|
const index = getIndex(target);
|
|
108
99
|
setValueAndSwap(max, index);
|
|
109
100
|
};
|
|
@@ -117,7 +108,7 @@ const Slider = _ref => {
|
|
|
117
108
|
}
|
|
118
109
|
const index = e.currentTarget.getAttribute('data-index');
|
|
119
110
|
const nextValue = calculateValue(ref, e.pageX, min, max, validStep);
|
|
120
|
-
if (nextValue && !isNaN(nextValue) && !index) {
|
|
111
|
+
if (nextValue !== null && !isNaN(nextValue) && !index) {
|
|
121
112
|
const rangeIndex = Number(Math.abs(validValues[0] - nextValue) > Math.abs(validValues[1] - nextValue));
|
|
122
113
|
setDraggedIndex(isRange ? rangeIndex : 0);
|
|
123
114
|
} else {
|
|
@@ -126,10 +117,9 @@ const Slider = _ref => {
|
|
|
126
117
|
setIsDragging(true);
|
|
127
118
|
previouslyDragged.current = false;
|
|
128
119
|
}, [disabled, isRange, max, min, validStep, validValues]);
|
|
129
|
-
const handleMouseUp = useCallback(
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
} = _ref6;
|
|
120
|
+
const handleMouseUp = useCallback(({
|
|
121
|
+
pageX
|
|
122
|
+
}) => {
|
|
133
123
|
const nextValues = adjustValues(validValues, ref, draggedIndex, pageX, max, min, validStep);
|
|
134
124
|
if (nextValues[0] > nextValues[1]) {
|
|
135
125
|
nextValues.reverse();
|
|
@@ -139,10 +129,9 @@ const Slider = _ref => {
|
|
|
139
129
|
setIsDragging(false);
|
|
140
130
|
previouslyDragged.current = true;
|
|
141
131
|
}, [validValues, draggedIndex, handleValueChange, max, min, validStep]);
|
|
142
|
-
const handleMouseMove = useCallback(
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
} = _ref7;
|
|
132
|
+
const handleMouseMove = useCallback(({
|
|
133
|
+
pageX
|
|
134
|
+
}) => {
|
|
146
135
|
const nextValues = adjustValues(validValues, ref, draggedIndex, pageX, max, min, validStep);
|
|
147
136
|
if (nextValues[0] > nextValues[1]) {
|
|
148
137
|
nextValues.reverse();
|
|
@@ -186,8 +175,8 @@ const Slider = _ref => {
|
|
|
186
175
|
})
|
|
187
176
|
}), jsx("div", {
|
|
188
177
|
style: {
|
|
189
|
-
left:
|
|
190
|
-
width:
|
|
178
|
+
left: `${trackStart}%`,
|
|
179
|
+
width: `${trackLength}%`
|
|
191
180
|
},
|
|
192
181
|
className: classNames(styles.track, {
|
|
193
182
|
[styles.rounded]: !showTicks,
|
|
@@ -207,7 +196,7 @@ const Slider = _ref => {
|
|
|
207
196
|
"aria-valuenow": numValue,
|
|
208
197
|
"data-index": index,
|
|
209
198
|
style: {
|
|
210
|
-
left:
|
|
199
|
+
left: `${percent}%`
|
|
211
200
|
},
|
|
212
201
|
className: classNames(styles.thumb, {
|
|
213
202
|
[styles.disabled]: disabled,
|
|
@@ -216,7 +205,7 @@ const Slider = _ref => {
|
|
|
216
205
|
onMouseDown: handleMouseDown
|
|
217
206
|
}), showTag && jsx("div", {
|
|
218
207
|
style: {
|
|
219
|
-
left:
|
|
208
|
+
left: `${percent}%`
|
|
220
209
|
},
|
|
221
210
|
className: classNames(styles.tag, {
|
|
222
211
|
[styles.disabled]: disabled
|
|
@@ -226,25 +215,23 @@ const Slider = _ref => {
|
|
|
226
215
|
})]
|
|
227
216
|
}, index)
|
|
228
217
|
);
|
|
229
|
-
}), markValues.map((
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
} = _ref8;
|
|
218
|
+
}), markValues.map(({
|
|
219
|
+
value: markValue,
|
|
220
|
+
label
|
|
221
|
+
}, index) => {
|
|
234
222
|
const percent = toPercent(markValue, min, max);
|
|
235
223
|
return jsx("div", {
|
|
236
224
|
style: {
|
|
237
|
-
left:
|
|
225
|
+
left: `${percent}%`
|
|
238
226
|
},
|
|
239
227
|
className: classNames(styles.markValue, {
|
|
240
228
|
[styles.disabled]: disabled
|
|
241
229
|
}),
|
|
242
230
|
children: label !== null && label !== void 0 ? label : markValue
|
|
243
231
|
}, index);
|
|
244
|
-
}), tickMarks.map((
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
} = _ref9;
|
|
232
|
+
}), tickMarks.map(({
|
|
233
|
+
value: tickValue
|
|
234
|
+
}, index) => {
|
|
248
235
|
const percent = toPercent(tickValue, min, max);
|
|
249
236
|
const isActive = isRange ? tickValue >= validValues[0] && tickValue <= validValues[validValues.length - 1] : tickValue <= validValues[0];
|
|
250
237
|
return jsx("div", {
|
|
@@ -253,7 +240,7 @@ const Slider = _ref => {
|
|
|
253
240
|
[styles.disabled]: disabled
|
|
254
241
|
}),
|
|
255
242
|
style: {
|
|
256
|
-
left:
|
|
243
|
+
left: `${percent}%`
|
|
257
244
|
}
|
|
258
245
|
}, index);
|
|
259
246
|
})]
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import 'core-js/modules/es.array.reverse.js';
|
|
2
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
1
|
import { isArray } from '../global/typescript-utils.js';
|
|
4
2
|
|
|
5
3
|
const HUNDRED = 100;
|
|
@@ -13,7 +11,6 @@ function roundToStep(value, step, min) {
|
|
|
13
11
|
return Math.round((value - min) / step) * step + min;
|
|
14
12
|
}
|
|
15
13
|
function calculateValue(ref, x, min, max, step) {
|
|
16
|
-
var _step$toString$split;
|
|
17
14
|
if (!ref.current) {
|
|
18
15
|
return null;
|
|
19
16
|
}
|
|
@@ -22,7 +19,7 @@ function calculateValue(ref, x, min, max, step) {
|
|
|
22
19
|
left
|
|
23
20
|
} = ref.current.getBoundingClientRect();
|
|
24
21
|
const value = toValue((x - left) / width, min, max);
|
|
25
|
-
const precision =
|
|
22
|
+
const precision = step.toString().split('.')?.[1]?.length;
|
|
26
23
|
return Number(roundToStep(value, step, min).toFixed(precision));
|
|
27
24
|
}
|
|
28
25
|
function validateValue(value, min, max) {
|
|
@@ -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 alertService from '../alert-service/alert-service.js';
|
|
4
2
|
import 'react/jsx-runtime';
|
|
5
3
|
import 'react-dom/client';
|
|
@@ -15,8 +13,6 @@ import '../icon/icon.js';
|
|
|
15
13
|
import 'util-deprecate';
|
|
16
14
|
import '../icon/icon.constants.js';
|
|
17
15
|
import '../_helpers/icon-svg.js';
|
|
18
|
-
import 'core-js/modules/es.regexp.exec.js';
|
|
19
|
-
import 'core-js/modules/es.string.replace.js';
|
|
20
16
|
import '../global/memoize.js';
|
|
21
17
|
import '../loader-inline/loader-inline.js';
|
|
22
18
|
import '../global/data-tests.js';
|
|
@@ -40,7 +36,6 @@ import '../global/sniffer.js';
|
|
|
40
36
|
import 'sniffr';
|
|
41
37
|
import '../tab-trap/tab-trap.js';
|
|
42
38
|
import '../popup/position.js';
|
|
43
|
-
import 'core-js/modules/es.array.sort.js';
|
|
44
39
|
import '../popup/popup.consts.js';
|
|
45
40
|
import '../popup/position-css.js';
|
|
46
41
|
import '../alert/container.js';
|
|
@@ -61,9 +56,8 @@ class LocalStorage {
|
|
|
61
56
|
throw e;
|
|
62
57
|
}
|
|
63
58
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
_defineProperty(this, "storageType", void 0);
|
|
59
|
+
storageType;
|
|
60
|
+
constructor(config = {}) {
|
|
67
61
|
this.storageType = config.type === 'session' ? 'sessionStorage' : 'localStorage';
|
|
68
62
|
}
|
|
69
63
|
/**
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import LocalStorage from './storage-local.js';
|
|
2
|
-
import '../_helpers/_rollupPluginBabelHelpers.js';
|
|
3
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
4
2
|
import '../alert-service/alert-service.js';
|
|
5
3
|
import 'react/jsx-runtime';
|
|
6
4
|
import 'react-dom/client';
|
|
@@ -16,8 +14,6 @@ import '../icon/icon.js';
|
|
|
16
14
|
import 'util-deprecate';
|
|
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 '../loader-inline/loader-inline.js';
|
|
23
19
|
import '../global/data-tests.js';
|
|
@@ -41,7 +37,6 @@ import '../global/sniffer.js';
|
|
|
41
37
|
import 'sniffr';
|
|
42
38
|
import '../tab-trap/tab-trap.js';
|
|
43
39
|
import '../popup/position.js';
|
|
44
|
-
import 'core-js/modules/es.array.sort.js';
|
|
45
40
|
import '../popup/popup.consts.js';
|
|
46
41
|
import '../popup/position-css.js';
|
|
47
42
|
import '../alert/container.js';
|