@jetbrains/ring-ui 4.1.0-beta.3 → 4.1.1
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/CHANGELOG.md +13 -0
- package/README.md +17 -15
- package/babel.config.js +3 -2
- package/components/alert/alert.js +9 -3
- package/components/alert/alert.test.js +21 -48
- package/components/alert/container.css +1 -1
- package/components/alert/container.test.js +3 -13
- package/components/alert-service/alert-service.examples.css +18 -0
- package/components/alert-service/alert-service.examples.js +21 -0
- package/components/alert-service/alert-service.js +10 -3
- package/components/analytics/analytics__fus-plugin.js +3 -3
- package/components/analytics/analytics__ga-plugin.js +2 -2
- package/components/auth/auth.test.js +14 -7
- package/components/auth/auth__core.js +64 -33
- package/components/auth-dialog/auth-dialog.css +2 -3
- package/components/auth-dialog/auth-dialog.js +4 -1
- package/components/auth-dialog/auth-dialog.test.js +3 -19
- package/components/avatar/avatar.css +4 -1
- package/components/avatar/avatar.examples.js +3 -2
- package/components/avatar/avatar.js +34 -6
- package/components/avatar/avatar.test.js +20 -17
- package/components/avatar/fallback-avatar.js +136 -0
- package/components/avatar-editor-ng/avatar-editor-ng.css +2 -2
- package/components/avatar-editor-ng/avatar-editor-ng.js +2 -1
- package/components/avatar-editor-ng/{avatar-editor-ng.html → avatar-editor-ng__template.js} +2 -2
- package/components/badge/badge.test.js +13 -20
- package/components/button/button.css +2 -2
- package/components/button/button.js +4 -1
- package/components/button/button.test.js +32 -33
- package/components/button-group/button-group.js +1 -1
- package/components/button-group/caption.js +1 -1
- package/components/button-ng/button-ng.js +1 -1
- package/components/button-set-ng/button-set-ng.js +3 -1
- package/components/checkbox/checkbox.css +1 -1
- package/components/code/code.js +2 -5
- package/components/confirm/confirm.js +1 -0
- package/components/confirm-service/confirm-service.js +5 -5
- package/components/content-layout/content-layout.css +1 -1
- package/components/data-list/data-list.css +1 -1
- package/components/date-picker/date-input.js +5 -4
- package/components/date-picker/date-picker.css +34 -22
- package/components/date-picker/date-picker.js +16 -14
- package/components/date-picker/date-popup.js +22 -7
- package/components/date-picker/month-names.js +8 -5
- package/components/date-picker/month.js +6 -2
- package/components/date-picker/weekdays.js +10 -2
- package/components/dialog/dialog.examples.js +3 -1
- package/components/dialog/dialog.js +10 -5
- package/components/dialog/dialog.test.js +1 -1
- package/components/dialog/dialog__body-scroll-preventer.js +51 -31
- package/components/dialog-ng/dialog-ng.js +10 -10
- package/components/dialog-ng/{dialog-ng.html → dialog-ng__template.js} +2 -2
- package/components/dropdown/dropdown.examples.js +36 -1
- package/components/dropdown/dropdown.test.js +2 -2
- package/components/dropdown-menu/dropdown-menu.examples.js +47 -0
- package/components/dropdown-menu/dropdown-menu.js +117 -0
- package/components/dropdown-menu/dropdown-menu.test.js +76 -0
- package/components/error-bubble/error-bubble-legacy.css +1 -1
- package/components/error-bubble/error-bubble.css +1 -1
- package/components/error-bubble/error-bubble.examples.js +1 -1
- package/components/error-page/error-page.css +2 -2
- package/components/footer-ng/footer-ng.js +13 -3
- package/components/form/form.css +2 -2
- package/components/form-ng/form-ng.js +3 -1
- package/components/global/global.css +1 -1
- package/components/global/theme.js +1 -1
- package/components/global/variables.css +8 -1
- package/components/grid/grid.css +10 -9
- package/components/header/header.css +1 -1
- package/components/header/header.examples.js +7 -8
- package/components/header/profile.js +10 -11
- package/components/http/http.js +1 -1
- package/components/icon/icon.css +5 -4
- package/components/input/input-legacy.css +7 -7
- package/components/island/header.js +2 -2
- package/components/island/island.css +8 -3
- package/components/island-legacy/island-legacy.css +3 -1
- package/components/list/list.js +6 -1
- package/components/list/list__custom.js +9 -3
- package/components/list/list__item.js +8 -2
- package/components/list/list__link.js +2 -1
- package/components/loader-inline/loader-inline.css +1 -1
- package/components/loader-screen/loader-screen.css +1 -1
- package/components/message/message.css +1 -1
- package/components/message/message.examples.js +8 -7
- package/components/pager/pager.js +5 -3
- package/components/permissions/permissions.js +1 -1
- package/components/popup/popup.js +1 -1
- package/components/popup/popup.test.js +15 -13
- package/components/progress-bar/progress-bar.css +1 -1
- package/components/progress-bar/progress-bar.examples.js +3 -3
- package/components/progress-bar/progress-bar.js +5 -2
- package/components/progress-bar/progress-bar.test.js +12 -13
- package/components/progress-bar-ng/progress-bar-ng.examples.js +3 -3
- package/components/query-assist/query-assist.css +13 -3
- package/components/query-assist/query-assist.examples.js +3 -4
- package/components/query-assist/query-assist.js +56 -12
- package/components/query-assist/query-assist.test.js +37 -5
- package/components/save-field-ng/save-field-ng.css +0 -3
- package/components/save-field-ng/save-field-ng.js +3 -1
- package/components/save-field-ng/{save-field-ng.html → save-field-ng__template.js} +2 -2
- package/components/select/select.css +12 -7
- package/components/select/select.examples.js +13 -0
- package/components/select/select.js +30 -43
- package/components/select/select.test.js +4 -5
- package/components/select/select__popup.js +1 -0
- package/components/shortcuts-hint-ng/shortcuts-hint-ng.css +1 -1
- package/components/shortcuts-hint-ng/shortcuts-hint-ng.js +1 -1
- package/components/shortcuts-hint-ng/{shortcuts-hint-ng.html → shortcuts-hint-ng__template.js} +2 -2
- package/components/sidebar/sidebar.css +1 -0
- package/components/sidebar-ng/sidebar-ng.js +6 -2
- package/components/sidebar-ng/{sidebar-ng__button.html → sidebar-ng__button-template.js} +2 -2
- package/components/sidebar-ng/{sidebar-ng.html → sidebar-ng__template.js} +2 -2
- package/components/table/header.js +9 -1
- package/components/table/row.js +2 -1
- package/components/table/table.css +2 -1
- package/components/table-legacy/table-legacy.css +2 -2
- package/components/table-legacy/table-legacy__toolbar.css +2 -2
- package/components/table-legacy-ng/table-legacy-ng.js +38 -5
- package/components/table-legacy-ng/table-legacy-ng__pager.js +7 -1
- package/components/tabs/collapsible-tab.js +2 -2
- package/components/tabs/collapsible-tabs.js +5 -9
- package/components/tabs/tab-link.js +4 -2
- package/components/tabs/tabs.css +32 -5
- package/components/tabs-ng/tabs-ng.js +4 -2
- package/components/tabs-ng/{tabs-ng.html → tabs-ng__template.js} +6 -2
- package/components/tag/tag.css +5 -2
- package/components/tag/tag.examples.js +3 -0
- package/components/tag/tag.js +19 -16
- package/components/tags-input/tag-input.examples.js +1 -1
- package/components/tags-input/tags-input.js +5 -2
- package/components/template-ng/template-ng.js +1 -1
- package/components/tooltip/tooltip.js +7 -2
- package/components/user-agreement/user-agreement.css +1 -5
- package/components/user-agreement/user-agreement.examples.js +7 -6
- package/components/user-agreement/user-agreement.js +11 -3
- package/package.json +85 -83
- package/webpack.config.js +14 -10
- package/components/button-set-ng/button-set-ng.html +0 -1
- package/components/footer-ng/footer-ng.html +0 -13
- package/components/form-ng/form-ng__error-bubble.html +0 -3
- package/components/table-legacy-ng/table-legacy-ng.html +0 -4
- package/components/table-legacy-ng/table-legacy-ng__column.html +0 -12
- package/components/table-legacy-ng/table-legacy-ng__header.html +0 -4
- package/components/table-legacy-ng/table-legacy-ng__pager.html +0 -7
- package/components/table-legacy-ng/table-legacy-ng__row.html +0 -12
- package/components/table-legacy-ng/table-legacy-ng__title.html +0 -9
- package/dist/_helpers/_rollupPluginBabelHelpers.js +0 -123
- package/dist/_helpers/background-flow.js +0 -232
- package/dist/_helpers/badge.js +0 -3
- package/dist/_helpers/button.js +0 -145
- package/dist/_helpers/clickableLink.js +0 -65
- package/dist/_helpers/data-tests.js +0 -15
- package/dist/_helpers/disable-hover-hoc.js +0 -407
- package/dist/_helpers/dom.js +0 -101
- package/dist/_helpers/get-uid.js +0 -15
- package/dist/_helpers/linear-function.js +0 -17
- package/dist/_helpers/list.js +0 -1327
- package/dist/_helpers/logo.js +0 -36
- package/dist/_helpers/memoize.js +0 -17
- package/dist/_helpers/popup.js +0 -691
- package/dist/_helpers/popup.target.js +0 -27
- package/dist/_helpers/rerender-hoc.js +0 -49
- package/dist/_helpers/schedule-raf.js +0 -31
- package/dist/_helpers/sniffer.js +0 -6
- package/dist/_helpers/theme.js +0 -40
- package/dist/_helpers/url.js +0 -125
- package/dist/alert-service.js +0 -149
- package/dist/alert.js +0 -284
- package/dist/analytics.js +0 -116
- package/dist/auth-dialog-service.js +0 -56
- package/dist/auth-dialog.js +0 -122
- package/dist/auth.js +0 -1744
- package/dist/avatar.js +0 -152
- package/dist/badge.js +0 -52
- package/dist/button-group.js +0 -48
- package/dist/button-set.js +0 -27
- package/dist/button-toolbar.js +0 -30
- package/dist/button.js +0 -12
- package/dist/caret.js +0 -262
- package/dist/checkbox.js +0 -108
- package/dist/confirm-service.js +0 -102
- package/dist/confirm.js +0 -113
- package/dist/content-layout.js +0 -184
- package/dist/contenteditable.js +0 -81
- package/dist/data-list.js +0 -466
- package/dist/date-picker.js +0 -1398
- package/dist/dialog.js +0 -223
- package/dist/dropdown.js +0 -250
- package/dist/error-bubble.js +0 -56
- package/dist/error-message.js +0 -53
- package/dist/footer.js +0 -124
- package/dist/grid.js +0 -148
- package/dist/group.js +0 -34
- package/dist/header.js +0 -658
- package/dist/heading.js +0 -76
- package/dist/http.js +0 -207
- package/dist/hub-source.js +0 -130
- package/dist/icon.js +0 -211
- package/dist/input.js +0 -228
- package/dist/island.js +0 -314
- package/dist/link.js +0 -117
- package/dist/list.js +0 -29
- package/dist/loader-inline.js +0 -165
- package/dist/loader-screen.js +0 -45
- package/dist/loader.js +0 -338
- package/dist/login-dialog.js +0 -173
- package/dist/logo.js +0 -8
- package/dist/message.js +0 -226
- package/dist/old-browsers-message.js +0 -129
- package/dist/pager.js +0 -325
- package/dist/panel.js +0 -34
- package/dist/permissions.js +0 -466
- package/dist/popup-menu.js +0 -93
- package/dist/popup.js +0 -16
- package/dist/progress-bar.js +0 -111
- package/dist/proxy-attrs.js +0 -19
- package/dist/query-assist.js +0 -1081
- package/dist/radio.js +0 -112
- package/dist/select.js +0 -1920
- package/dist/selection.js +0 -213
- package/dist/shortcuts.js +0 -307
- package/dist/storage.js +0 -373
- package/dist/style.css +0 -1
- package/dist/tab-trap.js +0 -174
- package/dist/table.js +0 -903
- package/dist/tabs.js +0 -721
- package/dist/tag.js +0 -187
- package/dist/tags-input.js +0 -440
- package/dist/tags-list.js +0 -91
- package/dist/text.js +0 -38
- package/dist/toggle.js +0 -80
- package/dist/tooltip.js +0 -202
- package/dist/user-card.js +0 -218
|
@@ -1,407 +0,0 @@
|
|
|
1
|
-
import { b as _defineProperty, c as _objectSpread2, _ as _objectWithoutProperties, a as _extends } from './_rollupPluginBabelHelpers.js';
|
|
2
|
-
import React, { Component, PureComponent } from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import Selection from '../selection.js';
|
|
5
|
-
|
|
6
|
-
var composeRefs = ((...refs) => value => refs.forEach(ref => {
|
|
7
|
-
if (typeof ref === 'function') {
|
|
8
|
-
ref(value);
|
|
9
|
-
} else if (ref != null) {
|
|
10
|
-
ref.current = value;
|
|
11
|
-
}
|
|
12
|
-
}));
|
|
13
|
-
|
|
14
|
-
function focusSensorHOC(ComposedComponent) {
|
|
15
|
-
var _class, _temp;
|
|
16
|
-
|
|
17
|
-
return _temp = _class = class FocusSensor extends Component {
|
|
18
|
-
constructor(...args) {
|
|
19
|
-
super(...args);
|
|
20
|
-
|
|
21
|
-
_defineProperty(this, "state", {
|
|
22
|
-
focused: this.props.focused
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
_defineProperty(this, "_skipNextCapture", false);
|
|
26
|
-
|
|
27
|
-
_defineProperty(this, "onRefUpdate", node => {
|
|
28
|
-
if (node) {
|
|
29
|
-
this.node = node;
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
_defineProperty(this, "onFocusCapture", ({
|
|
34
|
-
target
|
|
35
|
-
}) => {
|
|
36
|
-
if (this._skipNextCapture) {
|
|
37
|
-
this._skipNextCapture = false;
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const focused = this.node.contains(target);
|
|
42
|
-
|
|
43
|
-
if (focused && !this.state.focused) {
|
|
44
|
-
this.setState({
|
|
45
|
-
focused: true
|
|
46
|
-
});
|
|
47
|
-
this.props.onFocus();
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
_defineProperty(this, "onBlurCapture", ({
|
|
52
|
-
target
|
|
53
|
-
}) => {
|
|
54
|
-
const {
|
|
55
|
-
state: {
|
|
56
|
-
focused
|
|
57
|
-
},
|
|
58
|
-
node
|
|
59
|
-
} = this;
|
|
60
|
-
|
|
61
|
-
if (focused) {
|
|
62
|
-
setTimeout(() => {
|
|
63
|
-
const blurred = node.contains(target) && !node.contains(document.activeElement);
|
|
64
|
-
|
|
65
|
-
if (blurred) {
|
|
66
|
-
this.setState({
|
|
67
|
-
focused: false
|
|
68
|
-
});
|
|
69
|
-
this.props.onBlur();
|
|
70
|
-
}
|
|
71
|
-
}, 1);
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
_defineProperty(this, "onFocusRestore", () => {
|
|
76
|
-
this._skipNextCapture = true;
|
|
77
|
-
this.node.focus();
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
_defineProperty(this, "onFocusReset", () => {
|
|
81
|
-
this.node.blur();
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
componentDidMount() {
|
|
86
|
-
const {
|
|
87
|
-
props: {
|
|
88
|
-
autofocus
|
|
89
|
-
},
|
|
90
|
-
node
|
|
91
|
-
} = this;
|
|
92
|
-
node.setAttribute('tabindex', '0');
|
|
93
|
-
node.style.outline = 'none';
|
|
94
|
-
document.addEventListener('focus', this.onFocusCapture, true);
|
|
95
|
-
document.addEventListener('blur', this.onBlurCapture, true);
|
|
96
|
-
|
|
97
|
-
if (autofocus) {
|
|
98
|
-
node.focus();
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
componentDidUpdate(prevProps) {
|
|
103
|
-
const {
|
|
104
|
-
focused
|
|
105
|
-
} = this.props;
|
|
106
|
-
|
|
107
|
-
if (focused && !prevProps.focused) {
|
|
108
|
-
this.onFocusRestore();
|
|
109
|
-
} else if (!focused && prevProps.focused) {
|
|
110
|
-
this.onFocusReset();
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
componentWillUnmount() {
|
|
115
|
-
document.removeEventListener('focus', this.onFocusCapture, true);
|
|
116
|
-
document.removeEventListener('blur', this.onBlurCapture, true);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
render() {
|
|
120
|
-
const _this$props = this.props,
|
|
121
|
-
{
|
|
122
|
-
autofocus,
|
|
123
|
-
focused,
|
|
124
|
-
onFocus,
|
|
125
|
-
onBlur,
|
|
126
|
-
innerRef
|
|
127
|
-
} = _this$props,
|
|
128
|
-
rest = _objectWithoutProperties(_this$props, ["autofocus", "focused", "onFocus", "onBlur", "innerRef"]);
|
|
129
|
-
|
|
130
|
-
return /*#__PURE__*/React.createElement(ComposedComponent, _extends({}, rest, {
|
|
131
|
-
innerRef: composeRefs(innerRef, this.onRefUpdate),
|
|
132
|
-
focused: this.state.focused,
|
|
133
|
-
onFocusReset: this.onFocusReset,
|
|
134
|
-
onFocusRestore: this.onFocusRestore
|
|
135
|
-
}));
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
}, _defineProperty(_class, "propTypes", _objectSpread2(_objectSpread2({}, ComposedComponent.propTypes), {}, {
|
|
139
|
-
focused: PropTypes.bool,
|
|
140
|
-
autofocus: PropTypes.bool,
|
|
141
|
-
onFocus: PropTypes.func,
|
|
142
|
-
onBlur: PropTypes.func,
|
|
143
|
-
innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
144
|
-
})), _defineProperty(_class, "defaultProps", _objectSpread2(_objectSpread2({}, ComposedComponent.defaultProps), {}, {
|
|
145
|
-
focused: false,
|
|
146
|
-
autofocus: false,
|
|
147
|
-
onFocus: () => {},
|
|
148
|
-
onBlur: () => {}
|
|
149
|
-
})), _temp;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
function selectionShortcutsHOC(ComposedComponent) {
|
|
153
|
-
var _class, _temp;
|
|
154
|
-
|
|
155
|
-
return _temp = _class = class SelectionShortcuts extends PureComponent {
|
|
156
|
-
constructor(...args) {
|
|
157
|
-
super(...args);
|
|
158
|
-
|
|
159
|
-
_defineProperty(this, "onUpPress", () => {
|
|
160
|
-
const {
|
|
161
|
-
selection,
|
|
162
|
-
onSelect
|
|
163
|
-
} = this.props;
|
|
164
|
-
const newSelection = selection.moveUp();
|
|
165
|
-
|
|
166
|
-
if (newSelection) {
|
|
167
|
-
onSelect(newSelection);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
return false;
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
_defineProperty(this, "onDownPress", () => {
|
|
174
|
-
const {
|
|
175
|
-
selection,
|
|
176
|
-
onSelect
|
|
177
|
-
} = this.props;
|
|
178
|
-
const newSelection = selection.moveDown();
|
|
179
|
-
|
|
180
|
-
if (newSelection) {
|
|
181
|
-
onSelect(newSelection);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
return false;
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
_defineProperty(this, "onShiftKeyDown", () => {
|
|
188
|
-
const {
|
|
189
|
-
selection
|
|
190
|
-
} = this.props;
|
|
191
|
-
|
|
192
|
-
if (selection.isSelected(selection.getFocused())) {
|
|
193
|
-
this.shiftSelectionMode = 'deletion';
|
|
194
|
-
} else {
|
|
195
|
-
this.shiftSelectionMode = 'addition';
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
_defineProperty(this, "shiftSelect", selection => {
|
|
200
|
-
if (this.shiftSelectionMode === 'addition') {
|
|
201
|
-
return selection.select();
|
|
202
|
-
} else {
|
|
203
|
-
return selection.deselect();
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
_defineProperty(this, "onShiftUpPress", e => {
|
|
208
|
-
e.preventDefault();
|
|
209
|
-
const {
|
|
210
|
-
selectable,
|
|
211
|
-
selection,
|
|
212
|
-
onSelect
|
|
213
|
-
} = this.props;
|
|
214
|
-
|
|
215
|
-
if (!selectable) {
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
const newSelection = this.shiftSelect(selection);
|
|
220
|
-
const newMovedSelection = newSelection.moveUp();
|
|
221
|
-
|
|
222
|
-
if (newMovedSelection) {
|
|
223
|
-
onSelect(newMovedSelection);
|
|
224
|
-
} else {
|
|
225
|
-
onSelect(newSelection);
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
_defineProperty(this, "onShiftDownPress", e => {
|
|
230
|
-
e.preventDefault();
|
|
231
|
-
const {
|
|
232
|
-
selectable,
|
|
233
|
-
selection,
|
|
234
|
-
onSelect
|
|
235
|
-
} = this.props;
|
|
236
|
-
|
|
237
|
-
if (!selectable) {
|
|
238
|
-
return;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
const newSelection = this.shiftSelect(selection);
|
|
242
|
-
const newMovedSelection = newSelection.moveDown();
|
|
243
|
-
|
|
244
|
-
if (newMovedSelection) {
|
|
245
|
-
onSelect(newMovedSelection);
|
|
246
|
-
} else {
|
|
247
|
-
onSelect(newSelection);
|
|
248
|
-
}
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
_defineProperty(this, "onHomePress", () => {
|
|
252
|
-
const {
|
|
253
|
-
selection,
|
|
254
|
-
onSelect
|
|
255
|
-
} = this.props;
|
|
256
|
-
const newSelection = selection.moveStart();
|
|
257
|
-
|
|
258
|
-
if (newSelection) {
|
|
259
|
-
onSelect(newSelection);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
return false;
|
|
263
|
-
});
|
|
264
|
-
|
|
265
|
-
_defineProperty(this, "onEndPress", () => {
|
|
266
|
-
const {
|
|
267
|
-
selection,
|
|
268
|
-
onSelect
|
|
269
|
-
} = this.props;
|
|
270
|
-
const newSelection = selection.moveEnd();
|
|
271
|
-
|
|
272
|
-
if (newSelection) {
|
|
273
|
-
onSelect(newSelection);
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
return false;
|
|
277
|
-
});
|
|
278
|
-
|
|
279
|
-
_defineProperty(this, "onSpacePress", () => {
|
|
280
|
-
const {
|
|
281
|
-
selectable,
|
|
282
|
-
selection,
|
|
283
|
-
onSelect
|
|
284
|
-
} = this.props;
|
|
285
|
-
|
|
286
|
-
if (!selectable) {
|
|
287
|
-
return true;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
onSelect(selection.toggleSelection());
|
|
291
|
-
return false;
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
_defineProperty(this, "onEscPress", () => {
|
|
295
|
-
const {
|
|
296
|
-
selection,
|
|
297
|
-
onSelect
|
|
298
|
-
} = this.props;
|
|
299
|
-
onSelect(selection.reset()); //this.restoreFocusWithoutScroll();
|
|
300
|
-
});
|
|
301
|
-
|
|
302
|
-
_defineProperty(this, "onCmdAPress", () => {
|
|
303
|
-
const {
|
|
304
|
-
selectable,
|
|
305
|
-
selection,
|
|
306
|
-
onSelect
|
|
307
|
-
} = this.props;
|
|
308
|
-
|
|
309
|
-
if (!selectable) {
|
|
310
|
-
return true;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
onSelect(selection.selectAll());
|
|
314
|
-
return false;
|
|
315
|
-
});
|
|
316
|
-
|
|
317
|
-
_defineProperty(this, "shortcutsMap", {
|
|
318
|
-
up: this.onUpPress,
|
|
319
|
-
down: this.onDownPress,
|
|
320
|
-
shift: this.onShiftKeyDown,
|
|
321
|
-
'shift+up': this.onShiftUpPress,
|
|
322
|
-
'shift+down': this.onShiftDownPress,
|
|
323
|
-
home: this.onHomePress,
|
|
324
|
-
end: this.onEndPress,
|
|
325
|
-
space: this.onSpacePress,
|
|
326
|
-
esc: this.onEscPress,
|
|
327
|
-
'command+a': this.onCmdAPress,
|
|
328
|
-
'ctrl+a': this.onCmdAPress
|
|
329
|
-
});
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
render() {
|
|
333
|
-
const {
|
|
334
|
-
selection,
|
|
335
|
-
selectable,
|
|
336
|
-
onSelect
|
|
337
|
-
} = this.props;
|
|
338
|
-
return /*#__PURE__*/React.createElement(ComposedComponent, _extends({}, this.props, {
|
|
339
|
-
selection: selection,
|
|
340
|
-
selectable: selectable,
|
|
341
|
-
onSelect: onSelect,
|
|
342
|
-
shortcutsMap: _objectSpread2(_objectSpread2({}, this.shortcutsMap), this.props.shortcuts)
|
|
343
|
-
}));
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
}, _defineProperty(_class, "propTypes", _objectSpread2(_objectSpread2({}, ComposedComponent.propTypes), {}, {
|
|
347
|
-
selection: PropTypes.instanceOf(Selection).isRequired,
|
|
348
|
-
selectable: PropTypes.bool,
|
|
349
|
-
onSelect: PropTypes.func,
|
|
350
|
-
shortcuts: PropTypes.object
|
|
351
|
-
})), _defineProperty(_class, "defaultProps", _objectSpread2(_objectSpread2({}, ComposedComponent.defaultProps), {}, {
|
|
352
|
-
selectable: true,
|
|
353
|
-
onSelect: () => {},
|
|
354
|
-
shortcuts: {}
|
|
355
|
-
})), _temp;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
function disableHoverHOC(ComposedComponent) {
|
|
359
|
-
var _class, _temp;
|
|
360
|
-
|
|
361
|
-
return _temp = _class = class DisableHover extends PureComponent {
|
|
362
|
-
constructor(...args) {
|
|
363
|
-
super(...args);
|
|
364
|
-
|
|
365
|
-
_defineProperty(this, "state", {
|
|
366
|
-
disabledHover: false
|
|
367
|
-
});
|
|
368
|
-
|
|
369
|
-
_defineProperty(this, "onMouseMove", () => {
|
|
370
|
-
if (this.state.disabledHover) {
|
|
371
|
-
this.setState({
|
|
372
|
-
disabledHover: false
|
|
373
|
-
});
|
|
374
|
-
}
|
|
375
|
-
});
|
|
376
|
-
|
|
377
|
-
_defineProperty(this, "onKeyDown", e => {
|
|
378
|
-
const metaKeys = [16, 17, 18, 19, 20, 91]; // eslint-disable-line no-magic-numbers
|
|
379
|
-
|
|
380
|
-
if (!this.state.disabledHover && !metaKeys.includes(e.keyCode)) {
|
|
381
|
-
this.setState({
|
|
382
|
-
disabledHover: true
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
|
-
});
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
componentDidMount() {
|
|
389
|
-
document.addEventListener('mousemove', this.onMouseMove);
|
|
390
|
-
document.addEventListener('keydown', this.onKeyDown, true);
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
componentWillUnmount() {
|
|
394
|
-
document.removeEventListener('mousemove', this.onMouseMove);
|
|
395
|
-
document.removeEventListener('keydown', this.onKeyDown, true);
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
render() {
|
|
399
|
-
return /*#__PURE__*/React.createElement(ComposedComponent, _extends({}, this.props, {
|
|
400
|
-
disabledHover: this.state.disabledHover
|
|
401
|
-
}));
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
}, _defineProperty(_class, "propTypes", ComposedComponent.propTypes), _defineProperty(_class, "defaultProps", ComposedComponent.defaultProps), _temp;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
export { composeRefs as c, disableHoverHOC as d, focusSensorHOC as f, selectionShortcutsHOC as s };
|
package/dist/_helpers/dom.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { b as _defineProperty } from './_rollupPluginBabelHelpers.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @name DOM
|
|
5
|
-
*/
|
|
6
|
-
const getStyles = window.getComputedStyle.bind(window);
|
|
7
|
-
function isMounted(node) {
|
|
8
|
-
if (node === document) {
|
|
9
|
-
return true;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
return node instanceof Node && document.documentElement.contains(node.parentNode);
|
|
13
|
-
}
|
|
14
|
-
const rectStub = {
|
|
15
|
-
top: 0,
|
|
16
|
-
right: 0,
|
|
17
|
-
bottom: 0,
|
|
18
|
-
left: 0,
|
|
19
|
-
width: 0,
|
|
20
|
-
height: 0
|
|
21
|
-
};
|
|
22
|
-
function getRect(node) {
|
|
23
|
-
if (node instanceof Range || isMounted(node)) {
|
|
24
|
-
const {
|
|
25
|
-
top,
|
|
26
|
-
right,
|
|
27
|
-
bottom,
|
|
28
|
-
left,
|
|
29
|
-
width,
|
|
30
|
-
height
|
|
31
|
-
} = node.getBoundingClientRect();
|
|
32
|
-
return {
|
|
33
|
-
top,
|
|
34
|
-
right,
|
|
35
|
-
bottom,
|
|
36
|
-
left,
|
|
37
|
-
width,
|
|
38
|
-
height
|
|
39
|
-
};
|
|
40
|
-
} else {
|
|
41
|
-
return Object.assign({}, rectStub);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
function getPixelRatio() {
|
|
45
|
-
return 'devicePixelRatio' in window ? window.devicePixelRatio : 1;
|
|
46
|
-
}
|
|
47
|
-
function getWindowHeight() {
|
|
48
|
-
return window.innerHeight;
|
|
49
|
-
}
|
|
50
|
-
function getWindowWidth() {
|
|
51
|
-
return window.innerWidth;
|
|
52
|
-
}
|
|
53
|
-
function isNodeInVisiblePartOfPage(node) {
|
|
54
|
-
const {
|
|
55
|
-
top,
|
|
56
|
-
bottom,
|
|
57
|
-
left,
|
|
58
|
-
right
|
|
59
|
-
} = getRect(node);
|
|
60
|
-
return !(bottom < 0 || right < 0 || getWindowHeight() - top < 0 || getWindowWidth() - left < 0);
|
|
61
|
-
}
|
|
62
|
-
function getDocumentScrollTop() {
|
|
63
|
-
return document.documentElement && document.documentElement.scrollTop || document.body.scrollTop;
|
|
64
|
-
}
|
|
65
|
-
function getDocumentScrollLeft() {
|
|
66
|
-
return document.documentElement && document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
67
|
-
}
|
|
68
|
-
class Listeners {
|
|
69
|
-
constructor() {
|
|
70
|
-
_defineProperty(this, "_all", new Set());
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
add(el, event, handler, useCapture) {
|
|
74
|
-
el.addEventListener(event, handler, useCapture);
|
|
75
|
-
|
|
76
|
-
const dispatchFn = () => el.removeEventListener(event, handler, useCapture);
|
|
77
|
-
|
|
78
|
-
this._all.add(dispatchFn);
|
|
79
|
-
|
|
80
|
-
return dispatchFn;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
remove(fn) {
|
|
84
|
-
fn();
|
|
85
|
-
|
|
86
|
-
this._all.delete(fn);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
removeAll() {
|
|
90
|
-
this._all.forEach(fn => this.remove(fn));
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
} // Synthetic events from Combokeys#trigger are plain objects
|
|
94
|
-
|
|
95
|
-
function preventDefault(e) {
|
|
96
|
-
if (e.preventDefault) {
|
|
97
|
-
e.preventDefault();
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export { Listeners as L, getPixelRatio as a, isMounted as b, getDocumentScrollTop as c, getDocumentScrollLeft as d, getWindowHeight as e, getStyles as f, getRect as g, isNodeInVisiblePartOfPage as i, preventDefault as p };
|
package/dist/_helpers/get-uid.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const idCounters = {};
|
|
2
|
-
function getUID(name) {
|
|
3
|
-
if (!name) {
|
|
4
|
-
throw Error('Argument "name" is required in getUID()');
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
if (!idCounters[name]) {
|
|
8
|
-
idCounters[name] = 0;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const id = String(idCounters[name]++);
|
|
12
|
-
return name + id;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export { getUID as g };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
function linearFunction(x0, y0, a) {
|
|
2
|
-
return {
|
|
3
|
-
y(x) {
|
|
4
|
-
return +y0 + (x - x0) * a;
|
|
5
|
-
},
|
|
6
|
-
|
|
7
|
-
x(y) {
|
|
8
|
-
return +x0 + (y - y0) / a;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
function interpolateLinear(x0, x1, phase) {
|
|
14
|
-
return linearFunction(x0, x0, phase).y(x1);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export { interpolateLinear as i, linearFunction as l };
|