@jetbrains/ring-ui 6.0.3-beta.0 → 6.0.4-beta.0
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/alert-service/alert-service.d.ts +4 -2
- package/components/alert-service/alert-service.js +3 -2
- package/components/analytics/analytics.d.ts +0 -20
- package/components/analytics/analytics.js +0 -64
- package/components/analytics/analytics__custom-plugin.d.ts +0 -1
- package/components/analytics/analytics__custom-plugin.js +0 -3
- package/components/auth-dialog-service/auth-dialog-service.d.ts +1 -0
- package/components/auth-dialog-service/auth-dialog-service.js +4 -3
- package/components/button-group/button-group.css +16 -0
- package/components/confirm-service/confirm-service.d.ts +1 -1
- package/components/confirm-service/confirm-service.js +5 -4
- package/components/date-picker/consts.d.ts +0 -1
- package/components/date-picker/date-input.d.ts +0 -1
- package/components/date-picker/date-input.js +2 -3
- package/components/date-picker/date-picker.js +2 -2
- package/components/date-picker/date-popup.d.ts +0 -1
- package/components/date-picker/date-popup.js +3 -4
- package/components/dialog/dialog.css +4 -0
- package/components/dropdown-menu/dropdown-menu.d.ts +11 -1
- package/components/editable-heading/editable-heading.css +22 -0
- package/components/editable-heading/editable-heading.d.ts +2 -1
- package/components/editable-heading/editable-heading.js +29 -5
- package/components/form/form.stories.js +109 -89
- package/components/global/react-render-adapter.d.ts +1 -29
- package/components/global/react-render-adapter.js +3 -24
- package/components/global/rerender-hoc.d.ts +4 -35
- package/components/global/rerender-hoc.js +10 -24
- package/components/global/variables.css +1 -3
- package/components/global/variables.d.ts +0 -1
- package/components/global/variables_dark.css +0 -2
- package/components/header/services-link.js +3 -5
- package/components/header/smart-services.d.ts +2 -1
- package/components/heading/heading.css +24 -6
- package/components/http/http.d.ts +6 -6
- package/components/http/http.js +0 -12
- package/components/hub-source/hub-source.d.ts +8 -6
- package/components/input-size/input-size.stories.js +50 -49
- package/components/link/link.css +15 -39
- package/components/link/link.d.ts +4 -14
- package/components/link/link.js +5 -34
- package/components/list/consts.d.ts +13 -12
- package/components/list/consts.js +11 -15
- package/components/list/list.d.ts +15 -3
- package/components/list/list.js +4 -1
- package/components/list/list__item.js +3 -2
- package/components/login-dialog/service.js +5 -4
- package/components/markdown/markdown.css +51 -0
- package/components/markdown/markdown.d.ts +4 -7
- package/components/markdown/markdown.js +8 -27
- package/components/pager/pager.js +2 -8
- package/components/popup/position.js +4 -1
- package/components/popup-menu/popup-menu.d.ts +22 -2
- package/components/query-assist/query-assist.d.ts +3 -28
- package/components/query-assist/query-assist.js +11 -4
- package/components/select/select-popup.css +10 -0
- package/components/select/select.d.ts +1 -28
- package/components/select/select.js +1 -1
- package/components/select/select__popup.js +5 -2
- package/components/table/table.js +1 -1
- package/components/tabs/collapsible-more.js +1 -1
- package/components/tabs/collapsible-tab.js +1 -1
- package/components/tabs/collapsible-tabs.js +2 -2
- package/components/tabs/dumb-tabs.js +1 -1
- package/components/tabs/tab-link.js +7 -7
- package/components/tags-input/tags-input.d.ts +1 -28
- package/components/user-agreement/service.d.ts +3 -1
- package/components/user-agreement/service.js +8 -7
- package/components/user-agreement/user-agreement.d.ts +2 -3
- package/components/user-agreement/user-agreement.js +2 -4
- package/components/user-card/card.d.ts +2 -3
- package/components/user-card/card.js +8 -8
- package/dist/_helpers/_rollupPluginBabelHelpers.js +1 -10
- package/dist/_helpers/button__classes.js +13 -3
- package/dist/_helpers/card.js +9 -9
- package/dist/_helpers/dialog__body-scroll-preventer.js +0 -1
- package/dist/_helpers/heading.js +3 -0
- package/dist/_helpers/icon__svg.js +4 -2
- package/dist/_helpers/input.js +13 -7
- package/dist/_helpers/link.js +3 -0
- package/dist/_helpers/select__filter.js +1 -1
- package/dist/_helpers/services-link.js +9 -11
- package/dist/_helpers/sidebar.js +9 -3
- package/dist/_helpers/tab-link.js +12 -14
- package/dist/_helpers/theme.js +5 -3
- package/dist/_helpers/title.js +5 -2
- package/dist/alert/alert.js +22 -11
- package/dist/alert-service/alert-service.d.ts +4 -2
- package/dist/alert-service/alert-service.js +11 -14
- package/dist/analytics/analytics.d.ts +0 -20
- package/dist/analytics/analytics.js +1 -78
- package/dist/analytics/analytics__custom-plugin.d.ts +0 -1
- package/dist/analytics/analytics__custom-plugin.js +6 -11
- package/dist/auth/auth.js +6 -11
- package/dist/auth/auth__core.js +22 -28
- package/dist/auth/background-flow.js +0 -2
- package/dist/auth/down-notification.js +6 -9
- package/dist/auth/iframe-flow.js +7 -12
- package/dist/auth/landing.js +6 -11
- package/dist/auth/request-builder.js +1 -3
- package/dist/auth/response-parser.js +0 -2
- package/dist/auth/storage.js +5 -10
- package/dist/auth/token-validator.js +0 -2
- package/dist/auth/window-flow.js +0 -2
- package/dist/auth-dialog/auth-dialog.js +1 -4
- package/dist/auth-dialog-service/auth-dialog-service.d.ts +1 -0
- package/dist/auth-dialog-service/auth-dialog-service.js +11 -13
- package/dist/avatar/avatar.js +7 -11
- package/dist/avatar/fallback-avatar.js +1 -5
- package/dist/badge/badge.js +6 -2
- package/dist/button/button.js +11 -12
- package/dist/button/button__classes.js +0 -1
- package/dist/caret/caret.js +7 -10
- package/dist/checkbox/checkbox.js +0 -1
- package/dist/clipboard/clipboard.js +11 -13
- package/dist/code/code.js +4 -3
- package/dist/confirm/confirm.js +0 -4
- package/dist/confirm-service/confirm-service.d.ts +1 -1
- package/dist/confirm-service/confirm-service.js +15 -18
- package/dist/content-layout/content-layout.js +6 -4
- package/dist/contenteditable/contenteditable.js +1 -1
- package/dist/control-label/control-label.js +8 -4
- package/dist/data-list/data-list.js +11 -14
- package/dist/data-list/data-list.mock.js +2 -7
- package/dist/data-list/item.js +7 -9
- package/dist/data-list/selection.js +3 -6
- package/dist/data-list/title.js +0 -1
- package/dist/date-picker/consts.d.ts +0 -1
- package/dist/date-picker/consts.js +1 -1
- package/dist/date-picker/date-input.d.ts +0 -1
- package/dist/date-picker/date-input.js +3 -6
- package/dist/date-picker/date-picker.js +16 -20
- package/dist/date-picker/date-popup.d.ts +0 -1
- package/dist/date-picker/date-popup.js +22 -22
- package/dist/date-picker/day.js +17 -3
- package/dist/date-picker/month-names.js +4 -3
- package/dist/date-picker/month-slider.js +3 -2
- package/dist/date-picker/month.js +1 -1
- package/dist/date-picker/months.js +0 -1
- package/dist/date-picker/weekdays.js +4 -3
- package/dist/date-picker/years.js +4 -3
- package/dist/dialog/dialog.js +7 -7
- package/dist/dialog/dialog__body-scroll-preventer.js +0 -1
- package/dist/dropdown/anchor.js +0 -1
- package/dist/dropdown/dropdown.js +9 -8
- package/dist/dropdown-menu/dropdown-menu.d.ts +11 -1
- package/dist/dropdown-menu/dropdown-menu.js +5 -13
- package/dist/editable-heading/editable-heading.d.ts +2 -1
- package/dist/editable-heading/editable-heading.js +55 -13
- package/dist/error-bubble/error-bubble.js +0 -4
- package/dist/error-message/error-message.js +0 -1
- package/dist/footer/footer.js +12 -12
- package/dist/global/create-stateful-context.js +4 -4
- package/dist/global/data-tests.js +2 -2
- package/dist/global/dom.js +6 -9
- package/dist/global/fuzzy-highlight.js +6 -6
- package/dist/global/linear-function.js +2 -2
- package/dist/global/listeners.js +1 -2
- package/dist/global/memoize.js +0 -1
- package/dist/global/normalize-indent.js +1 -1
- package/dist/global/react-dom-renderer.js +0 -2
- package/dist/global/react-render-adapter.d.ts +1 -29
- package/dist/global/react-render-adapter.js +4 -34
- package/dist/global/rerender-hoc.d.ts +4 -35
- package/dist/global/rerender-hoc.js +22 -34
- package/dist/global/theme.js +0 -4
- package/dist/global/trivial-template-tag.js +1 -1
- package/dist/global/url.js +0 -1
- package/dist/global/variables.d.ts +0 -1
- package/dist/grid/col.js +3 -3
- package/dist/grid/grid.js +0 -2
- package/dist/grid/row.js +3 -1
- package/dist/header/header.js +5 -12
- package/dist/header/logo.js +0 -1
- package/dist/header/profile.js +10 -16
- package/dist/header/services-link.js +2 -7
- package/dist/header/services.js +5 -6
- package/dist/header/smart-profile.js +3 -12
- package/dist/header/smart-services.d.ts +2 -1
- package/dist/header/smart-services.js +7 -12
- package/dist/header/tray-icon.js +4 -3
- package/dist/heading/heading.js +5 -4
- package/dist/http/http.d.ts +6 -6
- package/dist/http/http.js +7 -21
- package/dist/http/http.mock.js +2 -5
- package/dist/hub-source/hub-source.d.ts +8 -6
- package/dist/hub-source/hub-source.js +0 -2
- package/dist/hub-source/hub-source__user.js +0 -2
- package/dist/hub-source/hub-source__users-groups.js +0 -3
- package/dist/i18n/i18n-context.js +3 -4
- package/dist/i18n/i18n.js +0 -1
- package/dist/icon/icon.js +6 -5
- package/dist/icon/icon__svg.js +0 -1
- package/dist/icon/index.js +0 -1
- package/dist/input/input.js +0 -1
- package/dist/island/adaptive-island-hoc.js +1 -1
- package/dist/island/content.js +9 -5
- package/dist/island/header.js +4 -2
- package/dist/island/island.js +4 -2
- package/dist/link/link.d.ts +4 -14
- package/dist/link/link.js +25 -61
- package/dist/list/consts.d.ts +13 -12
- package/dist/list/consts.js +11 -15
- package/dist/list/list.d.ts +15 -3
- package/dist/list/list.js +13 -19
- package/dist/list/list__custom.js +5 -2
- package/dist/list/list__item.js +19 -15
- package/dist/list/list__link.js +8 -10
- package/dist/list/list__separator.js +4 -2
- package/dist/list/list__title.js +4 -2
- package/dist/list/list__users-groups-source.js +1 -8
- package/dist/loader/loader.js +0 -4
- package/dist/loader/loader__core.js +0 -4
- package/dist/loader-screen/loader-screen.js +3 -5
- package/dist/login-dialog/login-dialog.js +2 -8
- package/dist/login-dialog/service.js +10 -15
- package/dist/markdown/markdown.d.ts +4 -7
- package/dist/markdown/markdown.js +13 -71
- package/dist/message/message.js +68 -58
- package/dist/old-browsers-message/old-browsers-message.js +0 -1
- package/dist/old-browsers-message/old-browsers-message__stop.js +0 -1
- package/dist/old-browsers-message/white-list.js +6 -5
- package/dist/pager/pager.js +15 -24
- package/dist/permissions/permissions.js +1 -2
- package/dist/popup/popup.js +22 -23
- package/dist/popup/position.js +72 -62
- package/dist/popup-menu/popup-menu.d.ts +22 -2
- package/dist/popup-menu/popup-menu.js +1 -9
- package/dist/progress-bar/progress-bar.js +4 -2
- package/dist/query-assist/query-assist.d.ts +3 -28
- package/dist/query-assist/query-assist.js +51 -39
- package/dist/query-assist/query-assist__suggestions.js +1 -8
- package/dist/select/select.d.ts +1 -28
- package/dist/select/select.js +35 -33
- package/dist/select/select__filter.js +1 -8
- package/dist/select/select__popup.js +16 -15
- package/dist/shortcuts/core.js +5 -7
- package/dist/shortcuts/shortcuts-hoc.js +0 -2
- package/dist/shortcuts/shortcuts.js +0 -2
- package/dist/storage/storage.js +3 -8
- package/dist/storage/storage__fallback.js +0 -3
- package/dist/storage/storage__local.js +3 -7
- package/dist/style.css +1 -1
- package/dist/tab-trap/tab-trap.js +1 -4
- package/dist/table/header-cell.js +8 -4
- package/dist/table/header.js +8 -7
- package/dist/table/multitable.js +0 -1
- package/dist/table/row-with-focus-sensor.js +0 -4
- package/dist/table/row.js +11 -8
- package/dist/table/selection-adapter.js +1 -1
- package/dist/table/selection-shortcuts-hoc.js +0 -2
- package/dist/table/selection.js +3 -5
- package/dist/table/smart-table.js +4 -10
- package/dist/table/table.js +27 -25
- package/dist/tabs/collapsible-more.js +5 -14
- package/dist/tabs/collapsible-tab.js +11 -12
- package/dist/tabs/collapsible-tabs.js +23 -29
- package/dist/tabs/dumb-tabs.js +7 -14
- package/dist/tabs/smart-tabs.js +2 -10
- package/dist/tabs/tab-link.js +2 -7
- package/dist/tabs/tabs.js +1 -9
- package/dist/tag/tag.js +11 -6
- package/dist/tags-input/tags-input.d.ts +1 -28
- package/dist/tags-input/tags-input.js +13 -19
- package/dist/tags-list/tags-list.js +0 -1
- package/dist/text/text.js +6 -3
- package/dist/tooltip/tooltip.js +5 -7
- package/dist/user-agreement/service.d.ts +3 -1
- package/dist/user-agreement/service.js +21 -38
- package/dist/user-agreement/user-agreement.d.ts +2 -3
- package/dist/user-agreement/user-agreement.js +2 -23
- package/dist/user-card/card.d.ts +2 -3
- package/dist/user-card/card.js +6 -12
- package/dist/user-card/smart-user-card-tooltip.js +7 -13
- package/dist/user-card/tooltip.js +3 -9
- package/dist/user-card/user-card.js +6 -12
- package/package.json +71 -75
- package/components/analytics/analytics__fus-plugin.d.ts +0 -52
- package/components/analytics/analytics__fus-plugin.js +0 -22
- package/components/analytics/analytics__ga-plugin.d.ts +0 -27
- package/components/analytics/analytics__ga-plugin.js +0 -89
- package/components/analytics/analytics__plugin-utils.d.ts +0 -31
- package/components/analytics/analytics__plugin-utils.js +0 -92
- package/components/link/link__legacy.css +0 -29
- package/components/markdown/code.d.ts +0 -7
- package/components/markdown/code.js +0 -17
- package/components/markdown/heading.d.ts +0 -11
- package/components/markdown/heading.js +0 -9
- package/components/markdown/link.d.ts +0 -12
- package/components/markdown/link.js +0 -10
- package/dist/analytics/analytics__fus-plugin.d.ts +0 -52
- package/dist/analytics/analytics__fus-plugin.js +0 -38
- package/dist/analytics/analytics__ga-plugin.d.ts +0 -27
- package/dist/analytics/analytics__ga-plugin.js +0 -118
- package/dist/analytics/analytics__plugin-utils.d.ts +0 -31
- package/dist/analytics/analytics__plugin-utils.js +0 -101
- package/dist/markdown/code.d.ts +0 -7
- package/dist/markdown/code.js +0 -54
- package/dist/markdown/heading.d.ts +0 -11
- package/dist/markdown/heading.js +0 -20
- package/dist/markdown/link.d.ts +0 -12
- package/dist/markdown/link.js +0 -34
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
import { AlertProps, AlertType } from '../alert/alert';
|
|
1
|
+
import React, { ReactNode, Ref } from 'react';
|
|
2
|
+
import Alert, { AlertProps, AlertType } from '../alert/alert';
|
|
3
3
|
export interface AlertItem extends Partial<Omit<AlertProps, 'children'>> {
|
|
4
4
|
key: string | number;
|
|
5
5
|
message: ReactNode;
|
|
6
|
+
ref?: Ref<Alert>;
|
|
6
7
|
}
|
|
7
8
|
/**
|
|
8
9
|
* @name Alert Service
|
|
@@ -11,6 +12,7 @@ declare class AlertService {
|
|
|
11
12
|
defaultTimeout: number;
|
|
12
13
|
showingAlerts: AlertItem[];
|
|
13
14
|
containerElement: HTMLDivElement;
|
|
15
|
+
reactRoot: import("react-dom/client").Root;
|
|
14
16
|
_getShowingAlerts(): AlertItem[];
|
|
15
17
|
renderAlertContainer(alerts: readonly AlertItem[]): React.JSX.Element;
|
|
16
18
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { createRoot } from 'react-dom/client';
|
|
3
3
|
import getUID from '../global/get-uid';
|
|
4
4
|
import Alert, { ANIMATION_TIME, Container as AlertContainer } from '../alert/alert';
|
|
5
5
|
/**
|
|
@@ -10,6 +10,7 @@ class AlertService {
|
|
|
10
10
|
// This alerts are stored in inverse order (last shown is first in array)
|
|
11
11
|
showingAlerts = [];
|
|
12
12
|
containerElement = document.createElement('div');
|
|
13
|
+
reactRoot = createRoot(this.containerElement);
|
|
13
14
|
_getShowingAlerts() {
|
|
14
15
|
return [...this.showingAlerts];
|
|
15
16
|
}
|
|
@@ -28,7 +29,7 @@ class AlertService {
|
|
|
28
29
|
* Renders alert container into virtual node to skip maintaining container
|
|
29
30
|
*/
|
|
30
31
|
renderAlerts() {
|
|
31
|
-
render(this.renderAlertContainer(this.showingAlerts)
|
|
32
|
+
this.reactRoot.render(this.renderAlertContainer(this.showingAlerts));
|
|
32
33
|
}
|
|
33
34
|
findSameAlert(message, type) {
|
|
34
35
|
return this.showingAlerts.filter(it => it.type === type && it.message === message)[0];
|
|
@@ -2,10 +2,6 @@ export type Serializable = string | number | boolean | null | undefined | {
|
|
|
2
2
|
[K in string | number]?: Serializable;
|
|
3
3
|
};
|
|
4
4
|
export interface AnalyticsPlugin {
|
|
5
|
-
/**
|
|
6
|
-
* @deprecated
|
|
7
|
-
*/
|
|
8
|
-
serializeAdditionalInfo: boolean;
|
|
9
5
|
trackEvent(category: string, action: string, additionalData?: Record<string, Serializable>): void;
|
|
10
6
|
trackPageView(path: string): void;
|
|
11
7
|
}
|
|
@@ -16,23 +12,7 @@ export declare class Analytics {
|
|
|
16
12
|
private _plugins;
|
|
17
13
|
constructor();
|
|
18
14
|
config(plugins: readonly AnalyticsPlugin[]): void;
|
|
19
|
-
/**
|
|
20
|
-
* @deprecated
|
|
21
|
-
*/
|
|
22
|
-
track(rawTrackingData: string, additionalData: Record<string, Serializable>): void;
|
|
23
|
-
/**
|
|
24
|
-
* @deprecated
|
|
25
|
-
*/
|
|
26
|
-
trackPageView(path: string): void;
|
|
27
15
|
trackEvent(category: string, action: string, additionalData?: Record<string, Serializable>): void;
|
|
28
|
-
/**
|
|
29
|
-
* @deprecated
|
|
30
|
-
*/
|
|
31
|
-
trackShortcutEvent(category: string, action: string, additionalData: Record<string, Serializable>): void;
|
|
32
|
-
/**
|
|
33
|
-
* @deprecated
|
|
34
|
-
*/
|
|
35
|
-
trackEntityProperties(entityName: string, entity: Serializable, propertiesNames: readonly string[], additionalData?: Record<string, Serializable>): void;
|
|
36
16
|
}
|
|
37
17
|
declare const _default: Analytics;
|
|
38
18
|
export default _default;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import deprecate from 'util-deprecate';
|
|
2
|
-
const warnOnDeprecationOfAnalyticsMethod = (methodName) => deprecate(() => { }, `Method analytics::${methodName} is deprecated, use analytics::trackEvent instead`)();
|
|
3
1
|
/**
|
|
4
2
|
* @name Analytics
|
|
5
3
|
*/
|
|
@@ -11,72 +9,10 @@ export class Analytics {
|
|
|
11
9
|
config(plugins) {
|
|
12
10
|
this._plugins = plugins;
|
|
13
11
|
}
|
|
14
|
-
/**
|
|
15
|
-
* @deprecated
|
|
16
|
-
*/
|
|
17
|
-
track(rawTrackingData, additionalData) {
|
|
18
|
-
if (!rawTrackingData) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
warnOnDeprecationOfAnalyticsMethod('track');
|
|
22
|
-
let splitIdx = rawTrackingData.indexOf(':');
|
|
23
|
-
if (splitIdx < 0) {
|
|
24
|
-
splitIdx = rawTrackingData.indexOf('_');
|
|
25
|
-
}
|
|
26
|
-
if (splitIdx < 0) {
|
|
27
|
-
splitIdx = rawTrackingData.length;
|
|
28
|
-
}
|
|
29
|
-
const category = rawTrackingData.substr(0, splitIdx);
|
|
30
|
-
const subcategory = rawTrackingData.substr(splitIdx + 1);
|
|
31
|
-
this.trackEvent(category, subcategory, additionalData);
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* @deprecated
|
|
35
|
-
*/
|
|
36
|
-
trackPageView(path) {
|
|
37
|
-
warnOnDeprecationOfAnalyticsMethod('trackPageView');
|
|
38
|
-
this._plugins.forEach(plugin => {
|
|
39
|
-
plugin.trackPageView(path);
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
12
|
trackEvent(category, action, additionalData) {
|
|
43
13
|
this._plugins.forEach(plugin => {
|
|
44
14
|
plugin.trackEvent(category, action, additionalData);
|
|
45
15
|
});
|
|
46
16
|
}
|
|
47
|
-
/**
|
|
48
|
-
* @deprecated
|
|
49
|
-
*/
|
|
50
|
-
trackShortcutEvent(category, action, additionalData) {
|
|
51
|
-
warnOnDeprecationOfAnalyticsMethod('trackShortcutEvent');
|
|
52
|
-
this.trackEvent(category, action, additionalData);
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* @deprecated
|
|
56
|
-
*/
|
|
57
|
-
trackEntityProperties(entityName, entity, propertiesNames, additionalData) {
|
|
58
|
-
warnOnDeprecationOfAnalyticsMethod('trackEntityProperties');
|
|
59
|
-
for (let i = 0; i < propertiesNames.length; ++i) {
|
|
60
|
-
const keys = propertiesNames[i].split('.');
|
|
61
|
-
let value = entity;
|
|
62
|
-
if (!keys.length) {
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
for (let j = 0; j < keys.length; ++j) {
|
|
66
|
-
if (typeof value === 'object' && value != null && value.hasOwnProperty(keys[j])) {
|
|
67
|
-
value = value[keys[j]];
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
value = 'no-value';
|
|
71
|
-
break;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
if (typeof value === 'string') {
|
|
75
|
-
value = value.toLowerCase().replace(/[._]+/g, '-');
|
|
76
|
-
}
|
|
77
|
-
const resultAction = `${keys.join('-')}__${value}`;
|
|
78
|
-
this.trackEvent(entityName, resultAction, additionalData);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
17
|
}
|
|
82
18
|
export default new Analytics();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import AuthDialog, { AuthDialogProps } from '../auth-dialog/auth-dialog';
|
|
3
|
+
export declare const reactRoot: import("react-dom/client").Root;
|
|
3
4
|
type AuthDialogAttributes = JSX.LibraryManagedAttributes<typeof AuthDialog, AuthDialogProps>;
|
|
4
5
|
export default function showAuthDialog(props?: AuthDialogAttributes): () => void;
|
|
5
6
|
export {};
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { createRoot } from 'react-dom/client';
|
|
2
3
|
import { ControlsHeightContext, getGlobalControlsHeight } from '../global/controls-height';
|
|
3
|
-
import { render } from '../global/react-render-adapter';
|
|
4
4
|
import AuthDialog from '../auth-dialog/auth-dialog';
|
|
5
5
|
/**
|
|
6
6
|
* @name Auth Dialog Service
|
|
7
7
|
*/
|
|
8
8
|
const containerElement = document.createElement('div');
|
|
9
|
+
export const reactRoot = createRoot(containerElement);
|
|
9
10
|
/**
|
|
10
11
|
* Renders AuthDialog into virtual node to skip maintaining container
|
|
11
12
|
*/
|
|
12
13
|
function renderAuthDialog(props) {
|
|
13
|
-
render((<ControlsHeightContext.Provider value={getGlobalControlsHeight()}>
|
|
14
|
+
reactRoot.render((<ControlsHeightContext.Provider value={getGlobalControlsHeight()}>
|
|
14
15
|
<AuthDialog {...props}/>
|
|
15
|
-
</ControlsHeightContext.Provider>)
|
|
16
|
+
</ControlsHeightContext.Provider>));
|
|
16
17
|
}
|
|
17
18
|
export default function showAuthDialog(props = {}) {
|
|
18
19
|
renderAuthDialog({
|
|
@@ -172,6 +172,14 @@
|
|
|
172
172
|
border-bottom-left-radius: var(--ring-border-radius);
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
+
/* stylelint-disable-next-line selector-max-specificity */
|
|
176
|
+
.common > button:first-child > div:first-child,
|
|
177
|
+
.common > .button:first-child > div:first-child,
|
|
178
|
+
.common > :first-child .button > div:first-child {
|
|
179
|
+
border-top-right-radius: 0;
|
|
180
|
+
border-bottom-right-radius: 0;
|
|
181
|
+
}
|
|
182
|
+
|
|
175
183
|
.common > .button:last-child,
|
|
176
184
|
.common > button:last-child,
|
|
177
185
|
.common > :last-child .button {
|
|
@@ -179,6 +187,14 @@
|
|
|
179
187
|
border-bottom-right-radius: var(--ring-border-radius);
|
|
180
188
|
}
|
|
181
189
|
|
|
190
|
+
/* stylelint-disable-next-line selector-max-specificity */
|
|
191
|
+
.common > .button:last-child > div:first-child,
|
|
192
|
+
.common > button:last-child > div:first-child,
|
|
193
|
+
.common > :last-child .button > div:first-child {
|
|
194
|
+
border-top-left-radius: 0;
|
|
195
|
+
border-bottom-left-radius: 0;
|
|
196
|
+
}
|
|
197
|
+
|
|
182
198
|
.split .primary:not(:last-child) {
|
|
183
199
|
margin-right: 1px;
|
|
184
200
|
}
|
|
@@ -7,7 +7,7 @@ import { ControlsHeight } from '../global/controls-height';
|
|
|
7
7
|
export type Props = ConfirmAttributes & {
|
|
8
8
|
buttonsHeight?: ControlsHeight;
|
|
9
9
|
};
|
|
10
|
-
export declare const
|
|
10
|
+
export declare const reactRoot: import("react-dom/client").Root;
|
|
11
11
|
export interface ConfirmServiceParams {
|
|
12
12
|
text?: string | undefined;
|
|
13
13
|
description?: ReactNode;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { createRoot } from 'react-dom/client';
|
|
3
3
|
import Confirm from '../confirm/confirm';
|
|
4
4
|
import { ControlsHeightContext, getGlobalControlsHeight } from '../global/controls-height';
|
|
5
|
-
|
|
5
|
+
const containerElement = document.createElement('div');
|
|
6
|
+
export const reactRoot = createRoot(containerElement);
|
|
6
7
|
/**
|
|
7
8
|
* Renders Confirm into virtual node to skip maintaining container
|
|
8
9
|
*/
|
|
9
10
|
function renderConfirm(props) {
|
|
10
11
|
const { buttonsHeight = getGlobalControlsHeight(), ...restProps } = props;
|
|
11
|
-
render(
|
|
12
|
+
reactRoot.render(<ControlsHeightContext.Provider value={buttonsHeight}>
|
|
12
13
|
<Confirm {...restProps}/>
|
|
13
|
-
</ControlsHeightContext.Provider>)
|
|
14
|
+
</ControlsHeightContext.Provider>);
|
|
14
15
|
}
|
|
15
16
|
export default function confirm({ text, description, confirmLabel = 'OK', rejectLabel = 'Cancel', cancelIsDefault, onBeforeConfirm, buttonsHeight }) {
|
|
16
17
|
return new Promise((resolve, reject) => {
|
|
@@ -70,7 +70,6 @@ export interface DatePopupBaseProps {
|
|
|
70
70
|
fromPlaceholder?: string | null | undefined;
|
|
71
71
|
toPlaceholder?: string | null | undefined;
|
|
72
72
|
timePlaceholder?: string | null | undefined;
|
|
73
|
-
hidden: boolean;
|
|
74
73
|
locale?: Locale | undefined;
|
|
75
74
|
parseDateInput: (text: Date | number | string | null | undefined) => Date | null;
|
|
76
75
|
displayFormat: (date: Date, locale: Locale | undefined) => string;
|
|
@@ -25,7 +25,6 @@ export default class DateInput extends React.PureComponent<DateInputProps> {
|
|
|
25
25
|
date: PropTypes.Requireable<NonNullable<string | number | Date | null | undefined>>;
|
|
26
26
|
time: PropTypes.Requireable<string>;
|
|
27
27
|
displayFormat: PropTypes.Requireable<(...args: any[]) => any>;
|
|
28
|
-
hidden: PropTypes.Requireable<boolean>;
|
|
29
28
|
translations: PropTypes.Requireable<object>;
|
|
30
29
|
fromPlaceholder: PropTypes.Requireable<string>;
|
|
31
30
|
toPlaceholder: PropTypes.Requireable<string>;
|
|
@@ -16,7 +16,6 @@ export default class DateInput extends React.PureComponent {
|
|
|
16
16
|
date: dateType,
|
|
17
17
|
time: PropTypes.string,
|
|
18
18
|
displayFormat: PropTypes.func,
|
|
19
|
-
hidden: PropTypes.bool,
|
|
20
19
|
translations: PropTypes.object,
|
|
21
20
|
fromPlaceholder: PropTypes.string,
|
|
22
21
|
toPlaceholder: PropTypes.string,
|
|
@@ -28,8 +27,8 @@ export default class DateInput extends React.PureComponent {
|
|
|
28
27
|
locale: PropTypes.object
|
|
29
28
|
};
|
|
30
29
|
componentDidUpdate(prevProps) {
|
|
31
|
-
const {
|
|
32
|
-
if (
|
|
30
|
+
const { text, active } = this.props;
|
|
31
|
+
if (text !== prevProps.text || active !== prevProps.active) {
|
|
33
32
|
this.updateInput({ text, active });
|
|
34
33
|
}
|
|
35
34
|
}
|
|
@@ -22,13 +22,13 @@ import DatePopup from './date-popup';
|
|
|
22
22
|
import { dateType } from './consts';
|
|
23
23
|
import styles from './date-picker.css';
|
|
24
24
|
import formats from './formats';
|
|
25
|
-
const PopupComponent = ({ hidden = false, className, popupRef, onClear, datePopupProps, onComplete, ...restProps }) => (<Popup hidden={hidden}
|
|
25
|
+
const PopupComponent = ({ hidden = false, className, popupRef, onClear, datePopupProps, onComplete, ...restProps }) => (<Popup hidden={hidden} className={className} ref={popupRef} directions={[
|
|
26
26
|
Popup.PopupProps.Directions.BOTTOM_RIGHT,
|
|
27
27
|
Popup.PopupProps.Directions.BOTTOM_LEFT,
|
|
28
28
|
Popup.PopupProps.Directions.TOP_LEFT,
|
|
29
29
|
Popup.PopupProps.Directions.TOP_RIGHT
|
|
30
30
|
]} {...restProps}>
|
|
31
|
-
<DatePopup onClear={onClear} {...datePopupProps} onComplete={onComplete}
|
|
31
|
+
<DatePopup onClear={onClear} {...datePopupProps} onComplete={onComplete}/>
|
|
32
32
|
</Popup>);
|
|
33
33
|
PopupComponent.propTypes = {
|
|
34
34
|
hidden: PropTypes.bool,
|
|
@@ -20,7 +20,6 @@ export default class DatePopup extends Component<DatePopupProps, DatePopupState>
|
|
|
20
20
|
onClear: PropTypes.Requireable<(...args: any[]) => any>;
|
|
21
21
|
minDate: PropTypes.Requireable<NonNullable<string | number | Date | null | undefined>>;
|
|
22
22
|
maxDate: PropTypes.Requireable<NonNullable<string | number | Date | null | undefined>>;
|
|
23
|
-
hidden: PropTypes.Requireable<boolean>;
|
|
24
23
|
fromPlaceholder: PropTypes.Requireable<string>;
|
|
25
24
|
toPlaceholder: PropTypes.Requireable<string>;
|
|
26
25
|
timePlaceholder: PropTypes.Requireable<string>;
|
|
@@ -36,7 +36,6 @@ export default class DatePopup extends Component {
|
|
|
36
36
|
onClear: PropTypes.func,
|
|
37
37
|
minDate: dateType,
|
|
38
38
|
maxDate: dateType,
|
|
39
|
-
hidden: PropTypes.bool,
|
|
40
39
|
fromPlaceholder: PropTypes.string,
|
|
41
40
|
toPlaceholder: PropTypes.string,
|
|
42
41
|
timePlaceholder: PropTypes.string,
|
|
@@ -268,7 +267,7 @@ export default class DatePopup extends Component {
|
|
|
268
267
|
this.componentRef.current?.querySelector('input')?.focus();
|
|
269
268
|
};
|
|
270
269
|
render() {
|
|
271
|
-
const { range,
|
|
270
|
+
const { range, withTime, locale } = this.props;
|
|
272
271
|
const { from, to, date, time, ...restProps } = this.props;
|
|
273
272
|
const parsedDate = this.parse(this.props.date, 'date');
|
|
274
273
|
const parsedTo = this.parse(this.props.to, 'to');
|
|
@@ -329,11 +328,11 @@ export default class DatePopup extends Component {
|
|
|
329
328
|
if (clearable && name !== 'from' && !this.isInTimeMode()) {
|
|
330
329
|
onClear = this.onClear.bind(this);
|
|
331
330
|
}
|
|
332
|
-
return (<DateInput {...this.props} {...this.state} divider={name === 'from' && (dates[name] != null || parsedTo != null)} name={name} key={name} date={dates[name]} active={this.state.active === name}
|
|
331
|
+
return (<DateInput {...this.props} {...this.state} divider={name === 'from' && (dates[name] != null || parsedTo != null)} name={name} key={name} date={dates[name]} active={this.state.active === name} onActivate={this.handleActivate(name)} onInput={this.handleInput} onConfirm={this.handleConfirm(name)} onClear={onClear} locale={locale}/>);
|
|
333
332
|
})}
|
|
334
333
|
|
|
335
334
|
{this.isInTimeMode()
|
|
336
|
-
? (<DateInput {...this.props} text={this.state.text} divider={!!parsedDate} hoverDate={null} name={'time'} key={'time'} date={null} time={time} active={this.state.active === 'time'}
|
|
335
|
+
? (<DateInput {...this.props} text={this.state.text} divider={!!parsedDate} hoverDate={null} name={'time'} key={'time'} date={null} time={time} active={this.state.active === 'time'} onActivate={this.handleActivate('time')} onInput={this.handleInput} onConfirm={this.handleConfirm('time')} onClear={clearable && this.onClear || undefined} locale={locale}/>)
|
|
337
336
|
: ('')}
|
|
338
337
|
</div>
|
|
339
338
|
<Weekdays locale={locale}/>
|
|
@@ -20,7 +20,17 @@ declare const _default: (<T = unknown>(props: DropdownMenuProps<T> & {
|
|
|
20
20
|
}) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null) & {
|
|
21
21
|
ListProps: {
|
|
22
22
|
Type: typeof import("../list/consts").Type;
|
|
23
|
-
Dimension:
|
|
23
|
+
Dimension: {
|
|
24
|
+
ITEM_PADDING: number;
|
|
25
|
+
ITEM_HEIGHT: number;
|
|
26
|
+
COMPACT_ITEM_HEIGHT: number;
|
|
27
|
+
SEPARATOR_HEIGHT: number;
|
|
28
|
+
SEPARATOR_FIRST_HEIGHT: number;
|
|
29
|
+
SEPARATOR_TEXT_HEIGHT: number;
|
|
30
|
+
TITLE_HEIGHT: number;
|
|
31
|
+
INNER_PADDING: number;
|
|
32
|
+
MARGIN: number;
|
|
33
|
+
};
|
|
24
34
|
};
|
|
25
35
|
};
|
|
26
36
|
export default _default;
|
|
@@ -127,6 +127,28 @@
|
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
+
.textarea {
|
|
131
|
+
resize: none;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.textareaWrapper {
|
|
135
|
+
position: relative;
|
|
136
|
+
|
|
137
|
+
&::after {
|
|
138
|
+
position: absolute;
|
|
139
|
+
bottom: 6px;
|
|
140
|
+
left: 0;
|
|
141
|
+
|
|
142
|
+
width: 100%;
|
|
143
|
+
height: 30px;
|
|
144
|
+
|
|
145
|
+
content: "";
|
|
146
|
+
pointer-events: none;
|
|
147
|
+
|
|
148
|
+
background: linear-gradient(to bottom, rgba(var(--ring-content-background-components), 0), rgba(var(--ring-content-background-components), 1));
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
130
152
|
.button {
|
|
131
153
|
margin: 6px 0;
|
|
132
154
|
}
|
|
@@ -7,7 +7,7 @@ export interface EditableHeadingTranslations {
|
|
|
7
7
|
save: string;
|
|
8
8
|
cancel: string;
|
|
9
9
|
}
|
|
10
|
-
export type EditableHeadingProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'size'> & {
|
|
10
|
+
export type EditableHeadingProps = Omit<InputHTMLAttributes<HTMLInputElement | HTMLTextAreaElement>, 'value' | 'size'> & {
|
|
11
11
|
level?: Levels;
|
|
12
12
|
headingClassName?: string | null;
|
|
13
13
|
inputClassName?: string | null;
|
|
@@ -23,6 +23,7 @@ export type EditableHeadingProps = Omit<InputHTMLAttributes<HTMLInputElement>, '
|
|
|
23
23
|
'data-test'?: string | null;
|
|
24
24
|
error?: string;
|
|
25
25
|
multiline?: boolean;
|
|
26
|
+
multilineInputRows?: number;
|
|
26
27
|
renderMenu?: () => React.ReactNode;
|
|
27
28
|
translations?: EditableHeadingTranslations;
|
|
28
29
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect } from 'react';
|
|
1
|
+
import React, { useCallback, useEffect } from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import Heading, { Levels } from '../heading/heading';
|
|
4
4
|
import Button from '../button/button';
|
|
@@ -9,16 +9,19 @@ import Shortcuts from '../shortcuts/shortcuts';
|
|
|
9
9
|
import styles from './editable-heading.css';
|
|
10
10
|
export { Levels };
|
|
11
11
|
export { Size };
|
|
12
|
+
const DEFAULT_MULTILINE_INPUT_ROWS = 3;
|
|
12
13
|
function noop() { }
|
|
13
14
|
export const EditableHeading = (props) => {
|
|
14
15
|
const { level = Levels.H1, className, headingClassName, inputClassName, children, isEditing = false, isSavingPossible = false, isSaving = false, embedded = false, size = Size.L, onEdit = noop, onSave = noop, onCancel = noop, autoFocus = true, 'data-test': dataTest, error, disabled, multiline = false, renderMenu = () => null, onFocus, onBlur, translations = {
|
|
15
16
|
save: 'Save',
|
|
16
17
|
cancel: 'Cancel'
|
|
17
|
-
}, ...restProps } = props;
|
|
18
|
+
}, multilineInputRows = DEFAULT_MULTILINE_INPUT_ROWS, ...restProps } = props;
|
|
18
19
|
const [shortcutsScope] = React.useState(getUID('ring-editable-heading-'));
|
|
19
20
|
const [isInFocus, setIsInFocus] = React.useState(false);
|
|
20
21
|
const [isMouseDown, setIsMouseDown] = React.useState(false);
|
|
21
22
|
const [isInSelectionMode, setIsInSelectionMode] = React.useState(false);
|
|
23
|
+
const textAreaRef = React.useRef(null);
|
|
24
|
+
const textAreaWrapperRef = React.useRef(null);
|
|
22
25
|
const hasError = error !== undefined;
|
|
23
26
|
const isSaveDisabled = !isSavingPossible || !children || children.trim() === '' || hasError || isSaving;
|
|
24
27
|
const isCancelDisabled = isSaving;
|
|
@@ -42,7 +45,7 @@ export const EditableHeading = (props) => {
|
|
|
42
45
|
[styles.selectionMode]: isInSelectionMode
|
|
43
46
|
});
|
|
44
47
|
const headingClasses = classNames(styles.heading, headingClassName, styles[`size${size}`]);
|
|
45
|
-
const inputClasses = classNames('ring-js-shortcuts', styles.input, inputStyles[`size${size}`], styles[`level${level}`], inputClassName);
|
|
48
|
+
const inputClasses = classNames('ring-js-shortcuts', styles.input, styles.textarea, inputStyles[`size${size}`], styles[`level${level}`], inputClassName);
|
|
46
49
|
const onHeadingMouseDown = React.useCallback(() => {
|
|
47
50
|
setIsMouseDown(true);
|
|
48
51
|
}, []);
|
|
@@ -67,21 +70,42 @@ export const EditableHeading = (props) => {
|
|
|
67
70
|
setIsInFocus(false);
|
|
68
71
|
onBlur?.(e);
|
|
69
72
|
}, [onBlur]);
|
|
73
|
+
const onScroll = useCallback(() => {
|
|
74
|
+
const scrollHeight = textAreaRef?.current?.scrollHeight || 0;
|
|
75
|
+
const clientHeight = textAreaRef?.current?.clientHeight || 0;
|
|
76
|
+
const scrollTop = textAreaRef?.current?.scrollTop || 0;
|
|
77
|
+
const isScrolledToBottom = scrollHeight - clientHeight <= scrollTop;
|
|
78
|
+
if (isScrolledToBottom) {
|
|
79
|
+
textAreaWrapperRef?.current?.classList.remove(styles.textareaWrapper);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
textAreaWrapperRef?.current?.classList.add(styles.textareaWrapper);
|
|
83
|
+
}
|
|
84
|
+
}, []);
|
|
70
85
|
useEffect(() => {
|
|
86
|
+
const textAreaRefCurrent = textAreaRef?.current;
|
|
87
|
+
textAreaRefCurrent?.addEventListener('scroll', onScroll);
|
|
71
88
|
window.addEventListener('mousemove', onMouseMove);
|
|
72
89
|
window.addEventListener('mouseup', onMouseUp);
|
|
73
90
|
return () => {
|
|
74
91
|
window.removeEventListener('mousemove', onMouseMove);
|
|
75
92
|
window.removeEventListener('mouseup', onMouseUp);
|
|
93
|
+
if (textAreaRefCurrent) {
|
|
94
|
+
textAreaRefCurrent.removeEventListener('scroll', onScroll);
|
|
95
|
+
}
|
|
76
96
|
};
|
|
77
|
-
});
|
|
97
|
+
}, [onMouseMove, onMouseUp, onScroll]);
|
|
78
98
|
return (<>
|
|
79
99
|
<div className={classes}>
|
|
80
100
|
{!disabled && isEditing
|
|
81
101
|
? (<>
|
|
82
102
|
<Shortcuts map={shortcutsMap} scope={shortcutsScope} disabled={isShortcutsDisabled}/>
|
|
83
103
|
|
|
84
|
-
|
|
104
|
+
{!multiline
|
|
105
|
+
? (<input className={inputClasses} value={children} autoFocus={autoFocus} data-test={dataTest} disabled={isSaving} {...restProps} onFocus={onInputFocus} onBlur={onInputBlur}/>)
|
|
106
|
+
: (<div ref={textAreaWrapperRef} className={styles.textareaWrapper}>
|
|
107
|
+
<textarea ref={textAreaRef} className={inputClasses} value={children} autoFocus={autoFocus} rows={multilineInputRows} data-test={dataTest} disabled={isSaving} {...restProps} onFocus={onInputFocus} onBlur={onInputBlur}/>
|
|
108
|
+
</div>)}
|
|
85
109
|
</>)
|
|
86
110
|
: (<button type="button" className={styles.headingWrapperButton} onMouseDown={onHeadingMouseDown}>
|
|
87
111
|
<Heading className={headingClasses} level={level} data-test={dataTest}>{children}</Heading>
|