@jetbrains/ring-ui 5.0.35 → 5.0.37
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/date-picker/date-popup.js +3 -1
- package/components/editable-heading/editable-heading.css +69 -0
- package/components/editable-heading/editable-heading.d.ts +21 -0
- package/components/editable-heading/editable-heading.js +34 -0
- package/components/input/input.css +2 -0
- package/components/query-assist/query-assist.js +1 -1
- package/dist/_helpers/_rollupPluginBabelHelpers.js +0 -4
- package/dist/_helpers/anchor.js +0 -1
- package/dist/_helpers/card.js +0 -3
- package/dist/_helpers/dialog__body-scroll-preventer.js +0 -11
- package/dist/_helpers/footer.js +2 -13
- package/dist/_helpers/query-assist__suggestions.js +0 -10
- package/dist/_helpers/select__filter.js +0 -11
- package/dist/_helpers/services-link.js +0 -2
- package/dist/_helpers/sidebar.js +0 -12
- package/dist/_helpers/theme.js +0 -3
- package/dist/_helpers/title.js +0 -9
- package/dist/alert/alert.js +2 -32
- package/dist/alert/container.js +0 -5
- package/dist/alert-service/alert-service.js +0 -26
- package/dist/analytics/analytics.js +0 -22
- package/dist/analytics/analytics__custom-plugin.js +0 -38
- package/dist/analytics/analytics__fus-plugin.js +0 -20
- package/dist/analytics/analytics__ga-plugin.js +0 -13
- package/dist/analytics/analytics__plugin-utils.js +0 -8
- package/dist/analytics-ng/analytics-ng.js +3 -9
- package/dist/auth/auth.js +2 -3
- package/dist/auth/auth__core.js +30 -243
- package/dist/auth/background-flow.js +2 -25
- package/dist/auth/down-notification.js +0 -7
- package/dist/auth/iframe-flow.js +2 -26
- package/dist/auth/landing.js +2 -6
- package/dist/auth/request-builder.js +0 -11
- package/dist/auth/response-parser.js +4 -26
- package/dist/auth/storage.js +4 -60
- package/dist/auth/token-validator.js +6 -42
- package/dist/auth/window-flow.js +2 -34
- package/dist/auth-dialog/auth-dialog.js +2 -12
- package/dist/auth-dialog-service/auth-dialog-service.js +2 -4
- package/dist/auth-ng/auth-ng.js +6 -22
- package/dist/auth-ng/auth-ng.mock.js +0 -4
- package/dist/autofocus-ng/autofocus-ng.js +0 -5
- package/dist/avatar/avatar.js +4 -17
- package/dist/avatar/fallback-avatar.js +2 -9
- package/dist/avatar-editor-ng/avatar-editor-ng.js +1 -17
- package/dist/badge/badge.js +0 -3
- package/dist/button/button.js +0 -8
- package/dist/button-group/button-group.js +0 -3
- package/dist/button-group/caption.js +0 -2
- package/dist/button-group-ng/button-group-ng.js +0 -4
- package/dist/button-ng/button-ng.js +3 -21
- package/dist/button-set/button-set.js +0 -3
- package/dist/button-set-ng/button-set-ng.js +0 -2
- package/dist/button-toolbar/button-toolbar.js +0 -3
- package/dist/button-toolbar-ng/button-toolbar-ng.js +0 -2
- package/dist/caret/caret.js +2 -53
- package/dist/checkbox/checkbox.js +0 -12
- package/dist/code/code.js +3 -25
- package/dist/compiler-ng/compiler-ng.js +0 -5
- package/dist/confirm/confirm.js +0 -6
- package/dist/confirm-service/confirm-service.js +10 -8
- package/dist/content-layout/content-layout.js +0 -7
- package/dist/contenteditable/contenteditable.js +6 -13
- package/dist/data-list/data-list.js +4 -28
- package/dist/data-list/item.js +0 -15
- package/dist/data-list/selection.js +0 -27
- package/dist/date-picker/consts.js +0 -7
- package/dist/date-picker/date-input.js +0 -20
- package/dist/date-picker/date-picker.js +2 -36
- package/dist/date-picker/date-popup.js +21 -72
- package/dist/date-picker/day.js +0 -14
- package/dist/date-picker/month-names.js +0 -9
- package/dist/date-picker/month-slider.js +0 -10
- package/dist/date-picker/month.js +2 -4
- package/dist/date-picker/months.js +6 -13
- package/dist/date-picker/years.js +0 -14
- package/dist/dialog/dialog.js +0 -19
- package/dist/dialog-ng/dialog-ng.js +17 -105
- package/dist/docked-panel-ng/docked-panel-ng.js +6 -29
- package/dist/dropdown/dropdown.js +2 -33
- package/dist/dropdown-menu/dropdown-menu.js +4 -8
- package/dist/editable-heading/editable-heading.d.ts +21 -0
- package/dist/editable-heading/editable-heading.js +85 -0
- package/dist/error-bubble/error-bubble.js +2 -4
- package/dist/error-message/error-message.js +0 -3
- package/dist/footer-ng/footer-ng.js +0 -13
- package/dist/form-ng/form-ng.js +1 -21
- package/dist/global/angular-component-factory.js +0 -10
- package/dist/global/compose.js +0 -1
- package/dist/global/composeRefs.js +0 -1
- package/dist/global/controls-height.js +0 -2
- package/dist/global/create-stateful-context.js +0 -5
- package/dist/global/data-tests.js +0 -4
- package/dist/global/dom.js +2 -11
- package/dist/global/focus-sensor-hoc.js +4 -33
- package/dist/global/fuzzy-highlight.js +2 -16
- package/dist/global/get-event-key.js +8 -17
- package/dist/global/get-uid.js +0 -2
- package/dist/global/linear-function.js +0 -2
- package/dist/global/listeners.js +0 -13
- package/dist/global/memoize.js +0 -2
- package/dist/global/normalize-indent.js +2 -5
- package/dist/global/react-dom-renderer.js +0 -8
- package/dist/global/react-render-adapter.js +0 -7
- package/dist/global/rerender-hoc.js +0 -7
- package/dist/global/ring-angular-component.js +0 -5
- package/dist/global/schedule-raf.js +0 -5
- package/dist/global/trivial-template-tag.js +2 -3
- package/dist/global/url.js +0 -27
- package/dist/grid/col.js +0 -4
- package/dist/grid/grid.js +0 -3
- package/dist/grid/row.js +0 -5
- package/dist/group/group.js +0 -3
- package/dist/header/header.js +0 -5
- package/dist/header/logo.js +0 -4
- package/dist/header/profile.js +0 -7
- package/dist/header/services.js +0 -11
- package/dist/header/smart-profile.js +4 -18
- package/dist/header/smart-services.js +0 -17
- package/dist/header/tray-icon.js +2 -3
- package/dist/header/tray.js +0 -3
- package/dist/heading/heading.js +0 -5
- package/dist/http/http.js +20 -65
- package/dist/http/http.mock.js +2 -14
- package/dist/hub-source/hub-source.js +0 -32
- package/dist/hub-source/hub-source__user.js +0 -1
- package/dist/hub-source/hub-source__users-groups.js +0 -12
- package/dist/icon/icon.js +0 -13
- package/dist/icon/icon__constants.js +0 -4
- package/dist/icon/icon__svg.js +0 -10
- package/dist/icon-ng/icon-ng.js +2 -7
- package/dist/input/input.js +0 -30
- package/dist/input-ng/input-ng.js +0 -17
- package/dist/island/adaptive-island-hoc.js +0 -7
- package/dist/island/content.js +0 -25
- package/dist/island/header.js +0 -7
- package/dist/island/island.js +0 -4
- package/dist/island-legacy/content-legacy.js +0 -2
- package/dist/island-legacy/header-legacy.js +0 -2
- package/dist/island-legacy/island-legacy.js +0 -2
- package/dist/island-ng/island-content-ng.js +0 -3
- package/dist/link/clickableLink.js +2 -10
- package/dist/link/link.js +2 -9
- package/dist/link-ng/link-ng.js +0 -2
- package/dist/list/consts.js +0 -4
- package/dist/list/list.js +6 -128
- package/dist/list/list__custom.js +0 -4
- package/dist/list/list__hint.js +0 -3
- package/dist/list/list__item.js +0 -8
- package/dist/list/list__link.js +2 -3
- package/dist/list/list__separator.js +0 -1
- package/dist/list/list__title.js +0 -1
- package/dist/list/list__users-groups-source.js +4 -17
- package/dist/loader/loader.js +0 -10
- package/dist/loader/loader__core.js +6 -70
- package/dist/loader-inline/loader-inline.js +0 -3
- package/dist/loader-ng/loader-ng.js +0 -7
- package/dist/loader-screen/loader-screen.js +0 -3
- package/dist/loader-screen-ng/loader-screen-ng.js +2 -14
- package/dist/login-dialog/login-dialog.js +0 -15
- package/dist/login-dialog/service.js +2 -4
- package/dist/markdown/code.js +0 -2
- package/dist/markdown/heading.js +0 -1
- package/dist/markdown/link.js +0 -1
- package/dist/markdown/markdown.js +0 -2
- package/dist/message/message.js +0 -24
- package/dist/message-bundle-ng/message-bundle-ng.js +2 -45
- package/dist/old-browsers-message/old-browsers-message.js +2 -21
- package/dist/old-browsers-message/white-list.js +2 -6
- package/dist/pager/pager.js +2 -39
- package/dist/panel/panel.js +0 -3
- package/dist/permissions/permissions.js +1 -43
- package/dist/permissions/permissions__cache.js +12 -63
- package/dist/permissions-ng/permissions-ng.js +11 -19
- package/dist/place-under-ng/place-under-ng.js +0 -19
- package/dist/popup/popup.consts.js +0 -11
- package/dist/popup/popup.js +6 -68
- package/dist/popup/position.js +8 -30
- package/dist/popup-menu/popup-menu.js +4 -13
- package/dist/progress-bar/progress-bar.js +0 -14
- package/dist/promised-click-ng/promised-click-ng.js +3 -22
- package/dist/query-assist/query-assist.js +17 -201
- package/dist/radio/radio.js +0 -6
- package/dist/radio/radio__item.js +0 -9
- package/dist/radio-ng/radio-ng.js +0 -4
- package/dist/save-field-ng/save-field-ng.js +1 -37
- package/dist/select/select.js +18 -208
- package/dist/select/select__popup.js +4 -76
- package/dist/select-ng/select-ng.js +18 -74
- package/dist/select-ng/select-ng__lazy.js +2 -17
- package/dist/select-ng/select-ng__options.js +3 -29
- package/dist/shortcuts/core.js +4 -56
- package/dist/shortcuts/shortcuts-hoc.js +0 -4
- package/dist/shortcuts/shortcuts.js +0 -10
- package/dist/shortcuts-hint-ng/shortcuts-hint-ng.js +0 -13
- package/dist/shortcuts-ng/shortcuts-ng.js +16 -46
- package/dist/sidebar-ng/sidebar-ng.js +2 -12
- package/dist/storage/storage.js +2 -5
- package/dist/storage/storage__fallback.js +2 -48
- package/dist/storage/storage__local.js +0 -23
- package/dist/style.css +1 -1
- package/dist/tab-trap/tab-trap.js +0 -37
- package/dist/table/cell.js +0 -2
- package/dist/table/disable-hover-hoc.js +0 -9
- package/dist/table/header-cell.js +0 -8
- package/dist/table/header.js +0 -16
- package/dist/table/multitable.js +0 -23
- package/dist/table/row-with-focus-sensor.js +0 -12
- package/dist/table/row.js +0 -18
- package/dist/table/selection-adapter.js +0 -2
- package/dist/table/selection-shortcuts-hoc.js +8 -42
- package/dist/table/selection.js +0 -50
- package/dist/table/smart-table.js +0 -9
- package/dist/table/table.js +6 -37
- package/dist/table-legacy-ng/table-legacy-ng.js +12 -42
- package/dist/table-legacy-ng/table-legacy-ng__selection-navigate-actions.js +0 -31
- package/dist/table-legacy-ng/table-legacy-ng__selection.js +0 -32
- package/dist/table-legacy-ng/table-legacy-ng__toolbar.js +2 -5
- package/dist/tabs/collapsible-more.js +0 -5
- package/dist/tabs/collapsible-tab.js +0 -4
- package/dist/tabs/collapsible-tabs.js +8 -28
- package/dist/tabs/dumb-tabs.js +0 -8
- package/dist/tabs/smart-tabs.js +0 -6
- package/dist/tabs/tab-link.js +0 -1
- package/dist/tabs/tab.js +0 -2
- package/dist/tabs-ng/tabs-ng.js +13 -29
- package/dist/tag/tag.js +0 -24
- package/dist/tags-input/tags-input.js +0 -76
- package/dist/tags-list/tags-list.js +0 -6
- package/dist/template-ng/template-ng.js +0 -12
- package/dist/text/text.js +0 -3
- package/dist/theme-ng/theme-ng.js +0 -8
- package/dist/title-ng/title-ng.js +6 -17
- package/dist/toggle/toggle.js +0 -4
- package/dist/tooltip/tooltip.js +4 -35
- package/dist/tooltip-ng/tooltip-ng.js +2 -8
- package/dist/user-agreement/service.js +0 -62
- package/dist/user-agreement/user-agreement.js +0 -8
- package/dist/user-card/smart-user-card-tooltip.js +2 -8
- package/dist/user-card/tooltip.js +0 -3
- package/package.json +22 -22
package/dist/form-ng/form-ng.js
CHANGED
|
@@ -9,41 +9,34 @@ const angularModule = angular.module('Ring.form', [MessageBundle]);
|
|
|
9
9
|
angularModule.factory('getFormErrorMessages', ["RingMessageBundle", function getFormErrorMessagesDirective(RingMessageBundle) {
|
|
10
10
|
function msg(id, formError) {
|
|
11
11
|
const messageBundleId = `form_${id}`;
|
|
12
|
-
|
|
13
12
|
if (RingMessageBundle.hasOwnProperty(messageBundleId)) {
|
|
14
13
|
return RingMessageBundle[messageBundleId]();
|
|
15
14
|
}
|
|
16
|
-
|
|
17
15
|
const formErrors = formError && formError[id] || [];
|
|
18
|
-
|
|
19
16
|
for (let j = 0; j < formErrors.length; ++j) {
|
|
20
17
|
if (formErrors[j] && formErrors[j].message) {
|
|
21
18
|
return formErrors[j].message;
|
|
22
19
|
}
|
|
23
20
|
}
|
|
24
|
-
|
|
25
21
|
return undefined;
|
|
26
22
|
}
|
|
27
|
-
|
|
28
23
|
return formErrors => {
|
|
29
24
|
const errorMessages = [];
|
|
30
|
-
|
|
31
25
|
for (const key in formErrors) {
|
|
32
26
|
if (formErrors.hasOwnProperty(key) && formErrors[key]) {
|
|
33
27
|
errorMessages.push(msg(key, formErrors));
|
|
34
28
|
}
|
|
35
29
|
}
|
|
36
|
-
|
|
37
30
|
return errorMessages;
|
|
38
31
|
};
|
|
39
32
|
}]);
|
|
33
|
+
|
|
40
34
|
/**
|
|
41
35
|
* <div rg-error-bubble="form.name"></div>
|
|
42
36
|
* @param {object} error-bubble Ng-model for this control
|
|
43
37
|
*
|
|
44
38
|
* Where form.name is a reference to angularJS form input
|
|
45
39
|
*/
|
|
46
|
-
|
|
47
40
|
angularModule.directive('rgErrorBubble', ["getFormErrorMessages", function rgErrorBubbleDirective(getFormErrorMessages) {
|
|
48
41
|
return {
|
|
49
42
|
scope: {
|
|
@@ -58,23 +51,19 @@ angularModule.directive('rgErrorBubble', ["getFormErrorMessages", function rgErr
|
|
|
58
51
|
const siblings = Array.from(iElement[0].parentNode.children);
|
|
59
52
|
let element;
|
|
60
53
|
let tagName;
|
|
61
|
-
|
|
62
54
|
for (let i = 0; i < siblings.length; i++) {
|
|
63
55
|
tagName = siblings[i].tagName.toLowerCase();
|
|
64
|
-
|
|
65
56
|
if (tagName === 'input' || tagName === 'textarea') {
|
|
66
57
|
element = siblings[i];
|
|
67
58
|
break;
|
|
68
59
|
}
|
|
69
60
|
}
|
|
70
|
-
|
|
71
61
|
scope.material = iAttrs.material !== undefined;
|
|
72
62
|
scope.$watch(() => {
|
|
73
63
|
const result = scope.errorBubble();
|
|
74
64
|
return result.$invalid && result.$dirty;
|
|
75
65
|
}, active => {
|
|
76
66
|
scope.active = active;
|
|
77
|
-
|
|
78
67
|
if (active && element) {
|
|
79
68
|
scope.style.left = element.offsetWidth + 2;
|
|
80
69
|
}
|
|
@@ -87,17 +76,14 @@ angularModule.directive('rgErrorBubble', ["getFormErrorMessages", function rgErr
|
|
|
87
76
|
* <input name="confirm" type="password" rg-equal-value="data.password" ng-model="data.confirm">
|
|
88
77
|
* Constraint to be user for confirm password fields.
|
|
89
78
|
*/
|
|
90
|
-
|
|
91
79
|
angularModule.directive('rgEqualValue', function rgEqualValueDirective() {
|
|
92
80
|
return {
|
|
93
81
|
require: 'ngModel',
|
|
94
82
|
link: function link(scope, iElement, iAttrs, ngModelCtrl) {
|
|
95
83
|
const element = iElement[0];
|
|
96
|
-
|
|
97
84
|
function assertEqual(thisValue, thatValue) {
|
|
98
85
|
ngModelCtrl.$setValidity('equalvalue', thisValue === thatValue);
|
|
99
86
|
}
|
|
100
|
-
|
|
101
87
|
scope.$watch(iAttrs.rgEqualValue, value => {
|
|
102
88
|
assertEqual(element.value, value);
|
|
103
89
|
});
|
|
@@ -115,7 +101,6 @@ angularModule.directive('rgEqualValue', function rgEqualValueDirective() {
|
|
|
115
101
|
*
|
|
116
102
|
* Is intended to be used for the value of ng-class. Accepts a reference to an angularJS form input
|
|
117
103
|
*/
|
|
118
|
-
|
|
119
104
|
angularModule.filter('rgInputClass', () => (input, submitted) => ({
|
|
120
105
|
'ring-input': true,
|
|
121
106
|
'ring-input_error': input.$invalid && (input.$dirty || submitted),
|
|
@@ -126,7 +111,6 @@ angularModule.filter('rgInputClass', () => (input, submitted) => ({
|
|
|
126
111
|
*
|
|
127
112
|
* Fixes Chrome bug: https://github.com/angular/angular.js/issues/1460
|
|
128
113
|
*/
|
|
129
|
-
|
|
130
114
|
angularModule.directive('rgFormAutofillFix', ["$timeout", $timeout => ({
|
|
131
115
|
require: '?form',
|
|
132
116
|
priority: 10,
|
|
@@ -136,7 +120,6 @@ angularModule.directive('rgFormAutofillFix', ["$timeout", $timeout => ({
|
|
|
136
120
|
const MAX_COUNT = 5;
|
|
137
121
|
let promise;
|
|
138
122
|
let count = 0;
|
|
139
|
-
|
|
140
123
|
(function poll() {
|
|
141
124
|
let filled;
|
|
142
125
|
angular.forEach(element.find('input'), elem => {
|
|
@@ -144,19 +127,16 @@ angularModule.directive('rgFormAutofillFix', ["$timeout", $timeout => ({
|
|
|
144
127
|
const controller = $elem.controller('ngModel');
|
|
145
128
|
const val = $elem.val();
|
|
146
129
|
const type = $elem.attr('type');
|
|
147
|
-
|
|
148
130
|
if (controller && val && type !== 'checkbox' && type !== 'radio') {
|
|
149
131
|
controller.$setViewValue(val);
|
|
150
132
|
filled = true;
|
|
151
133
|
}
|
|
152
134
|
});
|
|
153
|
-
|
|
154
135
|
if (!filled || count < MAX_COUNT) {
|
|
155
136
|
promise = $timeout(poll, POLL_INTERVAL);
|
|
156
137
|
count++;
|
|
157
138
|
}
|
|
158
139
|
})();
|
|
159
|
-
|
|
160
140
|
element.on('$destroy', () => {
|
|
161
141
|
$timeout.cancel(promise);
|
|
162
142
|
});
|
|
@@ -10,10 +10,8 @@ import 'prop-types';
|
|
|
10
10
|
function getAngularComponentName(name) {
|
|
11
11
|
return `rg${name}`;
|
|
12
12
|
}
|
|
13
|
-
|
|
14
13
|
function createAngularComponent(Component) {
|
|
15
14
|
var _class;
|
|
16
|
-
|
|
17
15
|
const propKeys = Object.keys(Component.propTypes);
|
|
18
16
|
const bindings = {};
|
|
19
17
|
propKeys.forEach(key => {
|
|
@@ -29,22 +27,17 @@ function createAngularComponent(Component) {
|
|
|
29
27
|
this.render();
|
|
30
28
|
});
|
|
31
29
|
}
|
|
32
|
-
|
|
33
30
|
$onChanges() {
|
|
34
31
|
if (!this.innerNodes) {
|
|
35
32
|
return;
|
|
36
33
|
}
|
|
37
|
-
|
|
38
34
|
this.render();
|
|
39
35
|
}
|
|
40
|
-
|
|
41
36
|
$onDestroy() {
|
|
42
37
|
unmountComponentAtNode(this.$inject.$element[0]);
|
|
43
38
|
}
|
|
44
|
-
|
|
45
39
|
render() {
|
|
46
40
|
var _this = this;
|
|
47
|
-
|
|
48
41
|
const {
|
|
49
42
|
$scope,
|
|
50
43
|
$element: {
|
|
@@ -57,7 +50,6 @@ function createAngularComponent(Component) {
|
|
|
57
50
|
if (typeof this[key] === 'function') {
|
|
58
51
|
props[key] = function () {
|
|
59
52
|
const ret = _this[key](...arguments);
|
|
60
|
-
|
|
61
53
|
$scope.$applyAsync();
|
|
62
54
|
return ret;
|
|
63
55
|
};
|
|
@@ -71,10 +63,8 @@ function createAngularComponent(Component) {
|
|
|
71
63
|
nodes: this.innerNodes
|
|
72
64
|
}) : null), container);
|
|
73
65
|
}
|
|
74
|
-
|
|
75
66
|
}, _defineProperty(_class, "$inject", ['$scope', '$element', '$transclude']), _defineProperty(_class, "bindings", bindings), _defineProperty(_class, "transclude", true), _class;
|
|
76
67
|
}
|
|
77
|
-
|
|
78
68
|
function angularComponentFactory(Component, name) {
|
|
79
69
|
const angularModuleName = `Ring.${name[0].toLowerCase() + name.slice(1)}`;
|
|
80
70
|
return angular.module(angularModuleName, []).component(getAngularComponentName(name), createAngularComponent(Component));
|
package/dist/global/compose.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { createContext } from 'react';
|
|
2
2
|
|
|
3
3
|
var ControlsHeight;
|
|
4
|
-
|
|
5
4
|
(function (ControlsHeight) {
|
|
6
5
|
ControlsHeight["S"] = "S";
|
|
7
6
|
ControlsHeight["M"] = "M";
|
|
8
7
|
ControlsHeight["L"] = "L";
|
|
9
8
|
})(ControlsHeight || (ControlsHeight = {}));
|
|
10
|
-
|
|
11
9
|
const ControlsHeightContext = /*#__PURE__*/createContext(ControlsHeight.M);
|
|
12
10
|
|
|
13
11
|
export { ControlsHeight, ControlsHeightContext };
|
|
@@ -5,7 +5,6 @@ function createStatefulContext(initialValue) {
|
|
|
5
5
|
let name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
6
6
|
const ValueContext = /*#__PURE__*/createContext(initialValue);
|
|
7
7
|
const UpdateContext = /*#__PURE__*/createContext(() => {});
|
|
8
|
-
|
|
9
8
|
function Provider(_ref) {
|
|
10
9
|
let {
|
|
11
10
|
children
|
|
@@ -17,12 +16,10 @@ function createStatefulContext(initialValue) {
|
|
|
17
16
|
value: update
|
|
18
17
|
}, children));
|
|
19
18
|
}
|
|
20
|
-
|
|
21
19
|
Provider.propTypes = {
|
|
22
20
|
children: PropTypes.node
|
|
23
21
|
};
|
|
24
22
|
Provider.displayName = `${name}Provider`;
|
|
25
|
-
|
|
26
23
|
function useUpdate(value, skipUpdate) {
|
|
27
24
|
const update = useContext(UpdateContext);
|
|
28
25
|
useEffect(() => {
|
|
@@ -31,7 +28,6 @@ function createStatefulContext(initialValue) {
|
|
|
31
28
|
}
|
|
32
29
|
}, [update, value, skipUpdate]);
|
|
33
30
|
}
|
|
34
|
-
|
|
35
31
|
function Updater(_ref2) {
|
|
36
32
|
let {
|
|
37
33
|
value,
|
|
@@ -40,7 +36,6 @@ function createStatefulContext(initialValue) {
|
|
|
40
36
|
useUpdate(value, skipUpdate);
|
|
41
37
|
return null;
|
|
42
38
|
}
|
|
43
|
-
|
|
44
39
|
Updater.displayName = `${name}Updater`;
|
|
45
40
|
return {
|
|
46
41
|
ValueContext,
|
|
@@ -4,21 +4,17 @@ function expandMap(attrsMap) {
|
|
|
4
4
|
return value ? [...result, key] : result;
|
|
5
5
|
}, []);
|
|
6
6
|
}
|
|
7
|
-
|
|
8
7
|
function joinDataTestAttributes() {
|
|
9
8
|
for (var _len = arguments.length, attrs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
10
9
|
attrs[_key] = arguments[_key];
|
|
11
10
|
}
|
|
12
|
-
|
|
13
11
|
return attrs.reduce((result, attr) => {
|
|
14
12
|
if (!attr) {
|
|
15
13
|
return result;
|
|
16
14
|
}
|
|
17
|
-
|
|
18
15
|
if (typeof attr === 'object') {
|
|
19
16
|
return [...result, ...expandMap(attr)];
|
|
20
17
|
}
|
|
21
|
-
|
|
22
18
|
return [...result, attr];
|
|
23
19
|
}, []).join(' ');
|
|
24
20
|
}
|
package/dist/global/dom.js
CHANGED
|
@@ -8,7 +8,6 @@ function isMounted(node) {
|
|
|
8
8
|
if (node === document) {
|
|
9
9
|
return true;
|
|
10
10
|
}
|
|
11
|
-
|
|
12
11
|
return node instanceof Node && document.documentElement.contains(node.parentNode);
|
|
13
12
|
}
|
|
14
13
|
const rectStub = {
|
|
@@ -92,29 +91,21 @@ class Listeners {
|
|
|
92
91
|
constructor() {
|
|
93
92
|
_defineProperty(this, "_all", new Set());
|
|
94
93
|
}
|
|
95
|
-
|
|
96
94
|
add(el, event, handler, options) {
|
|
97
95
|
el.addEventListener(event, handler, options);
|
|
98
|
-
|
|
99
96
|
const dispatchFn = () => el.removeEventListener(event, handler, options);
|
|
100
|
-
|
|
101
97
|
this._all.add(dispatchFn);
|
|
102
|
-
|
|
103
98
|
return dispatchFn;
|
|
104
99
|
}
|
|
105
|
-
|
|
106
100
|
remove(fn) {
|
|
107
101
|
fn();
|
|
108
|
-
|
|
109
102
|
this._all.delete(fn);
|
|
110
103
|
}
|
|
111
|
-
|
|
112
104
|
removeAll() {
|
|
113
105
|
this._all.forEach(fn => this.remove(fn));
|
|
114
106
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
107
|
+
}
|
|
108
|
+
// Synthetic events from Combokeys#trigger are plain objects
|
|
118
109
|
function preventDefault(e) {
|
|
119
110
|
if (e.preventDefault) {
|
|
120
111
|
e.preventDefault();
|
|
@@ -8,11 +8,9 @@ function extractPropTypes(_ref) {
|
|
|
8
8
|
let {
|
|
9
9
|
propTypes
|
|
10
10
|
} = _ref;
|
|
11
|
-
|
|
12
11
|
if (propTypes == null) {
|
|
13
12
|
return propTypes;
|
|
14
13
|
}
|
|
15
|
-
|
|
16
14
|
const {
|
|
17
15
|
innerRef,
|
|
18
16
|
focused,
|
|
@@ -22,50 +20,38 @@ function extractPropTypes(_ref) {
|
|
|
22
20
|
} = propTypes;
|
|
23
21
|
return restPropTypes;
|
|
24
22
|
}
|
|
25
|
-
|
|
26
23
|
function focusSensorHOC(ComposedComponent) {
|
|
27
24
|
class FocusSensor extends Component {
|
|
28
25
|
constructor() {
|
|
29
26
|
super(...arguments);
|
|
30
|
-
|
|
31
27
|
_defineProperty(this, "state", {
|
|
32
28
|
focused: this.props.focused
|
|
33
29
|
});
|
|
34
|
-
|
|
35
30
|
_defineProperty(this, "node", void 0);
|
|
36
|
-
|
|
37
31
|
_defineProperty(this, "_skipNextCapture", false);
|
|
38
|
-
|
|
39
32
|
_defineProperty(this, "onRefUpdate", node => {
|
|
40
33
|
if (node) {
|
|
41
34
|
this.node = node;
|
|
42
35
|
}
|
|
43
36
|
});
|
|
44
|
-
|
|
45
37
|
_defineProperty(this, "onFocusCapture", _ref2 => {
|
|
46
38
|
var _this$node;
|
|
47
|
-
|
|
48
39
|
let {
|
|
49
40
|
target
|
|
50
41
|
} = _ref2;
|
|
51
|
-
|
|
52
42
|
if (this._skipNextCapture) {
|
|
53
43
|
this._skipNextCapture = false;
|
|
54
44
|
return;
|
|
55
45
|
}
|
|
56
|
-
|
|
57
46
|
const focused = target instanceof Node && ((_this$node = this.node) === null || _this$node === void 0 ? void 0 : _this$node.contains(target));
|
|
58
|
-
|
|
59
47
|
if (focused && !this.state.focused) {
|
|
60
48
|
var _this$props$onFocus, _this$props;
|
|
61
|
-
|
|
62
49
|
this.setState({
|
|
63
50
|
focused: true
|
|
64
51
|
});
|
|
65
52
|
(_this$props$onFocus = (_this$props = this.props).onFocus) === null || _this$props$onFocus === void 0 ? void 0 : _this$props$onFocus.call(_this$props);
|
|
66
53
|
}
|
|
67
54
|
});
|
|
68
|
-
|
|
69
55
|
_defineProperty(this, "onBlurCapture", _ref3 => {
|
|
70
56
|
let {
|
|
71
57
|
target
|
|
@@ -76,14 +62,11 @@ function focusSensorHOC(ComposedComponent) {
|
|
|
76
62
|
},
|
|
77
63
|
node
|
|
78
64
|
} = this;
|
|
79
|
-
|
|
80
65
|
if (focused) {
|
|
81
66
|
setTimeout(() => {
|
|
82
67
|
const blurred = target instanceof Node && (node === null || node === void 0 ? void 0 : node.contains(target)) && !node.contains(document.activeElement);
|
|
83
|
-
|
|
84
68
|
if (blurred) {
|
|
85
69
|
var _this$props$onBlur, _this$props2;
|
|
86
|
-
|
|
87
70
|
this.setState({
|
|
88
71
|
focused: false
|
|
89
72
|
});
|
|
@@ -92,21 +75,16 @@ function focusSensorHOC(ComposedComponent) {
|
|
|
92
75
|
}, 1);
|
|
93
76
|
}
|
|
94
77
|
});
|
|
95
|
-
|
|
96
78
|
_defineProperty(this, "onFocusRestore", () => {
|
|
97
79
|
var _this$node2;
|
|
98
|
-
|
|
99
80
|
this._skipNextCapture = true;
|
|
100
81
|
(_this$node2 = this.node) === null || _this$node2 === void 0 ? void 0 : _this$node2.focus();
|
|
101
82
|
});
|
|
102
|
-
|
|
103
83
|
_defineProperty(this, "onFocusReset", () => {
|
|
104
84
|
var _this$node3;
|
|
105
|
-
|
|
106
85
|
(_this$node3 = this.node) === null || _this$node3 === void 0 ? void 0 : _this$node3.blur();
|
|
107
86
|
});
|
|
108
87
|
}
|
|
109
|
-
|
|
110
88
|
componentDidMount() {
|
|
111
89
|
const {
|
|
112
90
|
props: {
|
|
@@ -115,36 +93,29 @@ function focusSensorHOC(ComposedComponent) {
|
|
|
115
93
|
node
|
|
116
94
|
} = this;
|
|
117
95
|
node === null || node === void 0 ? void 0 : node.setAttribute('tabindex', '0');
|
|
118
|
-
|
|
119
96
|
if (node != null) {
|
|
120
97
|
node.style.outline = 'none';
|
|
121
98
|
}
|
|
122
|
-
|
|
123
99
|
document.addEventListener('focus', this.onFocusCapture, true);
|
|
124
100
|
document.addEventListener('blur', this.onBlurCapture, true);
|
|
125
|
-
|
|
126
101
|
if (autofocus) {
|
|
127
102
|
node === null || node === void 0 ? void 0 : node.focus();
|
|
128
103
|
}
|
|
129
104
|
}
|
|
130
|
-
|
|
131
105
|
componentDidUpdate(prevProps) {
|
|
132
106
|
const {
|
|
133
107
|
focused
|
|
134
108
|
} = this.props;
|
|
135
|
-
|
|
136
109
|
if (focused && !prevProps.focused) {
|
|
137
110
|
this.onFocusRestore();
|
|
138
111
|
} else if (!focused && prevProps.focused) {
|
|
139
112
|
this.onFocusReset();
|
|
140
113
|
}
|
|
141
114
|
}
|
|
142
|
-
|
|
143
115
|
componentWillUnmount() {
|
|
144
116
|
document.removeEventListener('focus', this.onFocusCapture, true);
|
|
145
117
|
document.removeEventListener('blur', this.onBlurCapture, true);
|
|
146
118
|
}
|
|
147
|
-
|
|
148
119
|
render() {
|
|
149
120
|
const {
|
|
150
121
|
autofocus,
|
|
@@ -161,17 +132,17 @@ function focusSensorHOC(ComposedComponent) {
|
|
|
161
132
|
onFocusRestore: this.onFocusRestore
|
|
162
133
|
}));
|
|
163
134
|
}
|
|
164
|
-
|
|
165
135
|
}
|
|
166
|
-
|
|
167
|
-
|
|
136
|
+
FocusSensor.propTypes = {
|
|
137
|
+
...extractPropTypes(ComposedComponent),
|
|
168
138
|
focused: PropTypes.bool,
|
|
169
139
|
autofocus: PropTypes.bool,
|
|
170
140
|
onFocus: PropTypes.func,
|
|
171
141
|
onBlur: PropTypes.func,
|
|
172
142
|
innerRef: PropTypes.oneOfType([PropTypes.func, refObject(PropTypes.instanceOf(HTMLElement))])
|
|
173
143
|
};
|
|
174
|
-
FocusSensor.defaultProps = {
|
|
144
|
+
FocusSensor.defaultProps = {
|
|
145
|
+
...ComposedComponent.defaultProps,
|
|
175
146
|
focused: false,
|
|
176
147
|
autofocus: false,
|
|
177
148
|
onFocus: () => {},
|
|
@@ -4,7 +4,6 @@ function fuzzyHighlight(needle, haystack) {
|
|
|
4
4
|
let caseSensitive = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
5
5
|
const ndl = caseSensitive ? needle : needle.toLowerCase();
|
|
6
6
|
const hstck = caseSensitive ? haystack : haystack.toLowerCase();
|
|
7
|
-
|
|
8
7
|
const result = function (matched) {
|
|
9
8
|
let highlight = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : haystack;
|
|
10
9
|
return {
|
|
@@ -12,54 +11,41 @@ function fuzzyHighlight(needle, haystack) {
|
|
|
12
11
|
highlight
|
|
13
12
|
};
|
|
14
13
|
};
|
|
15
|
-
|
|
16
14
|
const hlen = hstck.length;
|
|
17
15
|
const nlen = ndl.length;
|
|
18
|
-
|
|
19
16
|
if (nlen > hlen) {
|
|
20
17
|
return result(false);
|
|
21
18
|
}
|
|
22
|
-
|
|
23
19
|
if (nlen === hlen) {
|
|
24
20
|
const matched = ndl === hstck;
|
|
25
21
|
return result(matched, matched ? `${marker}${haystack}${marker}` : haystack);
|
|
26
22
|
}
|
|
27
|
-
|
|
28
23
|
let highlight = '';
|
|
29
24
|
let on = false;
|
|
30
25
|
let j = 0;
|
|
31
26
|
/* eslint-disable no-labels */
|
|
32
|
-
|
|
33
27
|
outer: for (let i = 0; i < nlen; i++) {
|
|
34
28
|
const nch = ndl[i];
|
|
35
|
-
|
|
36
29
|
while (j < hlen) {
|
|
37
30
|
const hch = hstck[j];
|
|
38
|
-
const match = hch === nch;
|
|
39
|
-
|
|
31
|
+
const match = hch === nch;
|
|
32
|
+
// Don't turn highlight on for space characters
|
|
40
33
|
const nextOn = match && /\S/.test(hch);
|
|
41
|
-
|
|
42
34
|
if (nextOn !== on) {
|
|
43
35
|
highlight += marker;
|
|
44
36
|
}
|
|
45
|
-
|
|
46
37
|
highlight += haystack[j++];
|
|
47
38
|
on = nextOn;
|
|
48
|
-
|
|
49
39
|
if (match) {
|
|
50
40
|
continue outer;
|
|
51
41
|
}
|
|
52
42
|
}
|
|
53
|
-
|
|
54
43
|
return result(false);
|
|
55
44
|
}
|
|
56
45
|
/* eslint-enable */
|
|
57
|
-
|
|
58
|
-
|
|
59
46
|
if (on) {
|
|
60
47
|
highlight += marker;
|
|
61
48
|
}
|
|
62
|
-
|
|
63
49
|
highlight += haystack.slice(j);
|
|
64
50
|
return result(true, highlight);
|
|
65
51
|
}
|
|
@@ -52,31 +52,26 @@ const translateToKey = {
|
|
|
52
52
|
};
|
|
53
53
|
const ENTER = 13;
|
|
54
54
|
const SPACE = 32;
|
|
55
|
-
|
|
56
55
|
function getEventCharCode(nativeEvent) {
|
|
57
56
|
let charCode;
|
|
58
57
|
const keyCode = nativeEvent.keyCode;
|
|
59
|
-
|
|
60
58
|
if ('charCode' in nativeEvent) {
|
|
61
|
-
charCode = nativeEvent.charCode;
|
|
62
|
-
|
|
59
|
+
charCode = nativeEvent.charCode;
|
|
60
|
+
// FF does not set `charCode` for the Enter-key, check against `keyCode`.
|
|
63
61
|
if (charCode === 0 && keyCode === ENTER) {
|
|
64
62
|
charCode = ENTER;
|
|
65
63
|
}
|
|
66
64
|
} else {
|
|
67
65
|
// IE8 does not implement `charCode`, but `keyCode` has the correct value.
|
|
68
66
|
charCode = keyCode;
|
|
69
|
-
}
|
|
67
|
+
}
|
|
68
|
+
// Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
|
|
70
69
|
// Must not discard the (non-)printable Enter-key.
|
|
71
|
-
|
|
72
|
-
|
|
73
70
|
if (charCode >= SPACE || charCode === ENTER) {
|
|
74
71
|
return charCode;
|
|
75
72
|
}
|
|
76
|
-
|
|
77
73
|
return 0;
|
|
78
74
|
}
|
|
79
|
-
|
|
80
75
|
function getEventKey(nativeEvent) {
|
|
81
76
|
if (nativeEvent.key) {
|
|
82
77
|
// Normalize inconsistent values reported by browsers due to
|
|
@@ -84,26 +79,22 @@ function getEventKey(nativeEvent) {
|
|
|
84
79
|
// FireFox implements `key` but returns `MozPrintableKey` for all
|
|
85
80
|
// printable characters (normalized to `Unidentified`), ignore it.
|
|
86
81
|
const key = normalizeKey[nativeEvent.key] || nativeEvent.key;
|
|
87
|
-
|
|
88
82
|
if (key !== 'Unidentified') {
|
|
89
83
|
return key;
|
|
90
84
|
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
85
|
+
}
|
|
86
|
+
// Browser does not implement `key`, polyfill as much of it as we can.
|
|
94
87
|
if (nativeEvent.type === 'keypress') {
|
|
95
|
-
const charCode = getEventCharCode(nativeEvent);
|
|
88
|
+
const charCode = getEventCharCode(nativeEvent);
|
|
89
|
+
// The enter-key is technically both printable and non-printable and can
|
|
96
90
|
// thus be captured by `keypress`, no other non-printable key should.
|
|
97
|
-
|
|
98
91
|
return charCode === SPACE ? 'Enter' : String.fromCharCode(charCode);
|
|
99
92
|
}
|
|
100
|
-
|
|
101
93
|
if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
|
|
102
94
|
// While user keyboard layout determines the actual meaning of each
|
|
103
95
|
// `keyCode` value, almost all function keys have a universal value.
|
|
104
96
|
return translateToKey[nativeEvent.keyCode] || 'Unidentified';
|
|
105
97
|
}
|
|
106
|
-
|
|
107
98
|
return '';
|
|
108
99
|
}
|
|
109
100
|
|
package/dist/global/get-uid.js
CHANGED
package/dist/global/listeners.js
CHANGED
|
@@ -4,47 +4,34 @@ class Listeners {
|
|
|
4
4
|
constructor() {
|
|
5
5
|
_defineProperty(this, "_all", new Map());
|
|
6
6
|
}
|
|
7
|
-
|
|
8
7
|
trigger() {
|
|
9
8
|
for (var _len = arguments.length, _ref = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
10
9
|
_ref[_key] = arguments[_key];
|
|
11
10
|
}
|
|
12
|
-
|
|
13
11
|
let [event, data] = _ref;
|
|
14
|
-
|
|
15
12
|
const handlers = this._all.get(event);
|
|
16
|
-
|
|
17
13
|
if (handlers) {
|
|
18
14
|
return Promise.all([...handlers].map(fn => fn(data)));
|
|
19
15
|
}
|
|
20
|
-
|
|
21
16
|
return Promise.resolve([]);
|
|
22
17
|
}
|
|
23
|
-
|
|
24
18
|
add(event, handler) {
|
|
25
19
|
let handlers = this._all.get(event);
|
|
26
|
-
|
|
27
20
|
if (!handlers) {
|
|
28
21
|
handlers = new Set();
|
|
29
|
-
|
|
30
22
|
this._all.set(event, handlers);
|
|
31
23
|
}
|
|
32
|
-
|
|
33
24
|
handlers.add(handler);
|
|
34
25
|
}
|
|
35
|
-
|
|
36
26
|
remove(event, handler) {
|
|
37
27
|
const handlers = this._all.get(event);
|
|
38
|
-
|
|
39
28
|
if (handlers) {
|
|
40
29
|
handlers.delete(handler);
|
|
41
30
|
}
|
|
42
31
|
}
|
|
43
|
-
|
|
44
32
|
removeAll() {
|
|
45
33
|
this._all = new Map();
|
|
46
34
|
}
|
|
47
|
-
|
|
48
35
|
}
|
|
49
36
|
|
|
50
37
|
export { Listeners as default };
|
package/dist/global/memoize.js
CHANGED
|
@@ -5,11 +5,9 @@ function memoize(fn) {
|
|
|
5
5
|
const key = arg !== null && arg !== void 0 ? arg : '__singleValue__';
|
|
6
6
|
const cache = key instanceof Object ? objectCache : primitiveCache;
|
|
7
7
|
const cached = cache.get(key);
|
|
8
|
-
|
|
9
8
|
if (cached != null) {
|
|
10
9
|
return cached;
|
|
11
10
|
}
|
|
12
|
-
|
|
13
11
|
const value = fn(arg);
|
|
14
12
|
cache.set(key, value);
|
|
15
13
|
return value;
|