@jetbrains/ring-ui 7.0.0-beta.9 → 7.0.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/babel.config.js +20 -14
- package/components/alert/alert.css +7 -7
- package/components/alert/alert.d.ts +2 -2
- package/components/alert/alert.js +10 -12
- package/components/alert/container.js +1 -1
- package/components/alert-service/alert-service.js +4 -2
- package/components/analytics/analytics__custom-plugin.js +1 -1
- package/components/auth/auth.js +1 -1
- package/components/auth/auth__core.js +36 -36
- package/components/auth/background-flow.js +2 -2
- package/components/auth/down-notification.js +3 -1
- package/components/auth/iframe-flow.js +4 -2
- package/components/auth/request-builder.js +5 -5
- package/components/auth/storage.js +10 -9
- package/components/auth/token-validator.js +8 -15
- package/components/auth-dialog/auth-dialog.js +8 -8
- package/components/auth-dialog-service/auth-dialog-service.js +4 -4
- package/components/avatar/avatar.js +9 -7
- package/components/avatar/fallback-avatar.js +15 -12
- package/components/button/button.css +31 -24
- package/components/button/button.js +9 -9
- package/components/button/button__classes.d.ts +1 -1
- package/components/button/button__classes.js +3 -4
- package/components/button-group/button-group.css +25 -13
- package/components/button-group/caption.js +1 -1
- package/components/button-toolbar/button-toolbar.d.ts +1 -1
- package/components/button-toolbar/button-toolbar.js +2 -2
- package/components/caret/caret.js +8 -8
- package/components/checkbox/checkbox.css +8 -5
- package/components/checkbox/checkbox.js +1 -1
- package/components/clipboard/clipboard-fallback.js +2 -6
- package/components/clipboard/clipboard.js +5 -5
- package/components/code/code.d.ts +1 -1
- package/components/code/code.js +2 -2
- package/components/code/highlight.css +3 -1
- package/components/collapse/collapse-content.d.ts +1 -2
- package/components/collapse/collapse-content.js +25 -14
- package/components/collapse/collapse-context.js +1 -1
- package/components/collapse/collapse-control.js +5 -3
- package/components/collapse/collapse.css +21 -20
- package/components/collapse/collapse.js +2 -2
- package/components/confirm/confirm.d.ts +2 -2
- package/components/confirm/confirm.js +2 -2
- package/components/confirm-service/confirm-service.d.ts +1 -1
- package/components/confirm-service/confirm-service.js +6 -6
- package/components/content-layout/content-layout.css +6 -5
- package/components/content-layout/content-layout.js +7 -6
- package/components/content-layout/sidebar.js +5 -5
- package/components/contenteditable/contenteditable.d.ts +1 -1
- package/components/contenteditable/contenteditable.js +3 -4
- package/components/control-label/control-label.js +5 -3
- package/components/data-list/data-list.css +3 -3
- package/components/data-list/data-list.d.ts +2 -2
- package/components/data-list/data-list.js +6 -7
- package/components/data-list/data-list.mock.js +57 -47
- package/components/data-list/item.js +14 -16
- package/components/data-list/selection.js +5 -7
- package/components/data-list/title.js +5 -6
- package/components/date-picker/consts.js +2 -2
- package/components/date-picker/date-input.js +4 -4
- package/components/date-picker/date-picker.css +23 -18
- package/components/date-picker/date-picker.d.ts +2 -1
- package/components/date-picker/date-picker.js +13 -19
- package/components/date-picker/date-popup.js +30 -36
- package/components/date-picker/day.js +6 -9
- package/components/date-picker/formats.js +647 -1
- package/components/date-picker/month-names.js +6 -8
- package/components/date-picker/month-slider.js +2 -2
- package/components/date-picker/month.js +1 -3
- package/components/date-picker/months.js +2 -6
- package/components/date-picker/weekdays.js +2 -3
- package/components/date-picker/years.js +3 -3
- package/components/dialog/dialog.d.ts +1 -0
- package/components/dialog/dialog.js +20 -13
- package/components/dialog/dialog__body-scroll-preventer.js +1 -1
- package/components/dropdown/dropdown.css +2 -4
- package/components/dropdown/dropdown.d.ts +2 -2
- package/components/dropdown/dropdown.js +5 -5
- package/components/dropdown-menu/dropdown-menu.js +5 -5
- package/components/editable-heading/editable-heading.css +5 -2
- package/components/editable-heading/editable-heading.js +21 -19
- package/components/error-bubble/error-bubble.js +1 -1
- package/components/error-message/error-message.js +2 -4
- package/components/footer/footer.js +11 -15
- package/components/form/form.stories.js +45 -63
- package/components/global/create-stateful-context.js +2 -4
- package/components/global/data-tests.js +5 -6
- package/components/global/dom.js +8 -11
- package/components/global/focus-sensor-hoc.js +5 -6
- package/components/global/fuzzy-highlight.js +1 -1
- package/components/global/get-event-key.js +2 -2
- package/components/global/global.css +0 -3
- package/components/global/linear-function.js +1 -1
- package/components/global/normalize-indent.js +2 -6
- package/components/global/react-dom-renderer.js +2 -3
- package/components/global/theme.js +9 -10
- package/components/global/url.js +8 -8
- package/components/global/variables.css +1 -8
- package/components/global/variables_dark.css +0 -1
- package/components/grid/col.js +6 -6
- package/components/grid/grid.css +174 -173
- package/components/grid/grid.js +1 -1
- package/components/grid/row.js +13 -6
- package/components/group/group.js +1 -1
- package/components/header/header-icon.js +2 -2
- package/components/header/header.css +19 -15
- package/components/header/header.js +3 -5
- package/components/header/links.js +1 -1
- package/components/header/logo.js +1 -1
- package/components/header/profile.d.ts +2 -2
- package/components/header/profile.js +9 -9
- package/components/header/services-link.js +1 -1
- package/components/header/services.js +4 -5
- package/components/header/smart-profile.js +4 -3
- package/components/header/smart-services.js +9 -5
- package/components/header/tray.js +1 -1
- package/components/heading/heading.css +0 -1
- package/components/heading/heading.js +2 -2
- package/components/http/http.d.ts +3 -3
- package/components/http/http.js +25 -29
- package/components/http/http.mock.js +9 -6
- package/components/hub-source/hub-source.js +5 -7
- package/components/hub-source/hub-source__user.js +1 -1
- package/components/hub-source/hub-source__users-groups.js +6 -7
- package/components/i18n/README.md +3 -4
- package/components/i18n/i18n-context.js +2 -4
- package/components/icon/icon.js +7 -9
- package/components/icon/icon__svg.js +6 -6
- package/components/input/input.js +11 -14
- package/components/input-size/input-size.stories.js +42 -22
- package/components/island/adaptive-island-hoc.js +1 -1
- package/components/island/content.js +4 -6
- package/components/island/header.js +8 -10
- package/components/island/island.css +5 -5
- package/components/island/island.js +1 -1
- package/components/link/clickableLink.js +3 -1
- package/components/link/link.js +5 -3
- package/components/list/consts.js +1 -1
- package/components/list/list.d.ts +1 -1
- package/components/list/list.js +35 -57
- package/components/list/list__custom.js +3 -5
- package/components/list/list__hint.js +3 -1
- package/components/list/list__item.js +11 -9
- package/components/list/list__link.js +1 -1
- package/components/list/list__separator.js +2 -2
- package/components/list/list__title.js +7 -3
- package/components/list/list__users-groups-source.js +6 -8
- package/components/loader/loader.js +1 -1
- package/components/loader/loader__core.js +5 -5
- package/components/loader-inline/loader-inline.css +0 -3
- package/components/loader-inline/loader-inline.js +5 -7
- package/components/loader-screen/loader-screen.js +1 -1
- package/components/login-dialog/login-dialog.js +4 -4
- package/components/login-dialog/service.js +5 -5
- package/components/markdown/markdown.css +6 -6
- package/components/markdown/markdown.d.ts +2 -2
- package/components/markdown/markdown.js +4 -6
- package/components/message/message.css +2 -1
- package/components/message/message.js +30 -21
- package/components/old-browsers-message/old-browsers-message.js +2 -2
- package/components/old-browsers-message/white-list.js +2 -3
- package/components/pager/pager.js +28 -29
- package/components/permissions/permissions.js +8 -13
- package/components/permissions/permissions__cache.js +6 -7
- package/components/popup/popup.consts.js +8 -2
- package/components/popup/popup.js +27 -33
- package/components/popup/popup.target.js +4 -4
- package/components/popup/position.js +21 -28
- package/components/popup-menu/popup-menu.js +1 -1
- package/components/progress-bar/progress-bar.css +10 -8
- package/components/progress-bar/progress-bar.d.ts +2 -2
- package/components/progress-bar/progress-bar.js +2 -2
- package/components/query-assist/query-assist.css +0 -3
- package/components/query-assist/query-assist.js +73 -84
- package/components/query-assist/query-assist__suggestions.js +10 -9
- package/components/radio/radio.css +6 -2
- package/components/radio/radio.js +1 -3
- package/components/scrollable-section/scrollable-section.css +5 -6
- package/components/scrollable-section/scrollable-section.js +1 -1
- package/components/select/select.css +5 -5
- package/components/select/select.d.ts +1 -1
- package/components/select/select.js +96 -110
- package/components/select/select__filter.js +1 -1
- package/components/select/select__popup.js +40 -51
- package/components/shortcuts/core.js +8 -6
- package/components/shortcuts/shortcut-title.js +6 -6
- package/components/shortcuts/shortcuts.js +1 -1
- package/components/sidebar/sidebar.css +3 -1
- package/components/slider/slider.css +14 -14
- package/components/slider/slider.js +7 -7
- package/components/tab-trap/tab-trap.js +7 -9
- package/components/table/cell.js +3 -1
- package/components/table/disable-hover-hoc.js +2 -2
- package/components/table/header-cell.js +5 -3
- package/components/table/header.d.ts +1 -2
- package/components/table/header.js +10 -12
- package/components/table/multitable.js +5 -3
- package/components/table/row.d.ts +0 -1
- package/components/table/row.js +20 -27
- package/components/table/selection-adapter.js +1 -1
- package/components/table/selection-shortcuts-hoc.js +2 -2
- package/components/table/selection.d.ts +2 -3
- package/components/table/selection.js +4 -5
- package/components/table/simple-table.js +4 -4
- package/components/table/smart-table.js +5 -5
- package/components/table/table.css +8 -9
- package/components/table/table.d.ts +0 -1
- package/components/table/table.js +22 -23
- package/components/table/table.stories.json +45 -16
- package/components/tabs/collapsible-more.d.ts +1 -1
- package/components/tabs/collapsible-more.js +13 -16
- package/components/tabs/collapsible-tab.js +2 -2
- package/components/tabs/collapsible-tabs.d.ts +2 -2
- package/components/tabs/collapsible-tabs.js +13 -22
- package/components/tabs/dumb-tabs.js +6 -9
- package/components/tabs/smart-tabs.js +4 -4
- package/components/tabs/tab-link.js +1 -3
- package/components/tabs/tabs.css +7 -9
- package/components/tag/tag.css +6 -6
- package/components/tag/tag.d.ts +1 -1
- package/components/tag/tag.js +9 -12
- package/components/tags-input/tags-input.js +15 -19
- package/components/tags-list/tags-list.d.ts +2 -2
- package/components/tags-list/tags-list.js +6 -5
- package/components/text/text.js +5 -3
- package/components/toggle/toggle.css +12 -10
- package/components/toggle/toggle.d.ts +2 -2
- package/components/toggle/toggle.js +4 -3
- package/components/tooltip/tooltip.js +13 -8
- package/components/user-agreement/service.js +15 -13
- package/components/user-agreement/user-agreement.js +3 -5
- package/components/user-card/card.js +10 -9
- package/components/user-card/smart-user-card-tooltip.js +5 -7
- package/components/user-card/tooltip.js +4 -4
- package/components/user-card/user-card.css +4 -0
- package/jslint-xml.js +20 -19
- package/package.json +59 -50
- package/postcss.config.js +3 -4
- package/typings.d.ts +2 -4
- package/webpack.config.js +20 -25
- package/components/badge/badge.css +0 -42
- package/components/badge/badge.d.ts +0 -14
- package/components/badge/badge.js +0 -29
- package/components/island-legacy/content-legacy.d.ts +0 -5
- package/components/island-legacy/content-legacy.js +0 -12
- package/components/island-legacy/header-legacy.d.ts +0 -5
- package/components/island-legacy/header-legacy.js +0 -14
- package/components/island-legacy/island-legacy.css +0 -98
- package/components/island-legacy/island-legacy.d.ts +0 -7
- package/components/island-legacy/island-legacy.js +0 -14
- package/components/table-legacy/table-legacy.css +0 -346
- package/components/table-legacy/table-legacy__toolbar.css +0 -25
package/components/code/code.js
CHANGED
|
@@ -20,7 +20,7 @@ export default class Code extends PureComponent {
|
|
|
20
20
|
static defaultProps = {
|
|
21
21
|
inline: false,
|
|
22
22
|
softWrap: false,
|
|
23
|
-
replacer: noop
|
|
23
|
+
replacer: noop,
|
|
24
24
|
};
|
|
25
25
|
componentDidMount() {
|
|
26
26
|
this.highlight();
|
|
@@ -66,7 +66,7 @@ export default class Code extends PureComponent {
|
|
|
66
66
|
const Tag = inline ? 'span' : 'pre';
|
|
67
67
|
const classes = classNames(styles.code, className, language, {
|
|
68
68
|
[styles.inline]: inline,
|
|
69
|
-
[styles.softWrap]: softWrap
|
|
69
|
+
[styles.softWrap]: softWrap,
|
|
70
70
|
});
|
|
71
71
|
return (<Tag className={classes} data-test="ring-code">
|
|
72
72
|
<code
|
|
@@ -31,7 +31,9 @@
|
|
|
31
31
|
|
|
32
32
|
& :global(.hljs-tag) {
|
|
33
33
|
background: var(--ring-code-tag-background-color);
|
|
34
|
-
box-shadow:
|
|
34
|
+
box-shadow:
|
|
35
|
+
0 1px var(--ring-code-tag-background-color),
|
|
36
|
+
0 -1px var(--ring-code-tag-background-color);
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
& :global(.hljs-section),
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { useState, useEffect, useRef, useContext, useMemo } from 'react';
|
|
2
|
-
import * as React from 'react';
|
|
1
|
+
import React, { useState, useEffect, useRef, useContext, useMemo } from 'react';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
import dataTests from '../global/data-tests';
|
|
5
4
|
import { getRect } from '../global/dom';
|
|
@@ -14,25 +13,36 @@ const HIDDEN = 0;
|
|
|
14
13
|
/**
|
|
15
14
|
* @name CollapseContent
|
|
16
15
|
*/
|
|
17
|
-
export const CollapseContent = ({ children, minHeight = DEFAULT_HEIGHT, 'data-test': dataTest }) => {
|
|
16
|
+
export const CollapseContent = ({ children, minHeight = DEFAULT_HEIGHT, 'data-test': dataTest, }) => {
|
|
18
17
|
const { collapsed, duration, id, disableAnimation } = useContext(CollapseContext);
|
|
19
18
|
const containerRef = useRef(null);
|
|
20
19
|
const contentRef = useRef(null);
|
|
21
20
|
const initialContentHeight = useRef(minHeight);
|
|
22
21
|
const contentHeight = useRef(DEFAULT_HEIGHT);
|
|
23
|
-
const [dimensions, setDimensions] = useState({
|
|
24
|
-
width: 0,
|
|
25
|
-
height: 0
|
|
26
|
-
});
|
|
22
|
+
const [dimensions, setDimensions] = useState({ width: 0, height: 0 });
|
|
27
23
|
const [height, setHeight] = useState(toPx(minHeight));
|
|
28
|
-
const [showFade, setShowFade] = useState(
|
|
24
|
+
const [showFade, setShowFade] = useState(collapsed);
|
|
25
|
+
const [shouldHideContent, setShouldHideContent] = useState(collapsed && minHeight <= DEFAULT_HEIGHT);
|
|
29
26
|
useEffect(() => {
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
function onTransitionEnd() {
|
|
28
|
+
if (initialContentHeight.current <= DEFAULT_HEIGHT) {
|
|
29
|
+
setShouldHideContent(collapsed);
|
|
30
|
+
}
|
|
32
31
|
}
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
const container = containerRef.current;
|
|
33
|
+
if (container) {
|
|
34
|
+
container.addEventListener('transitionend', onTransitionEnd);
|
|
35
35
|
}
|
|
36
|
+
return () => {
|
|
37
|
+
if (container) {
|
|
38
|
+
container.removeEventListener('transitionend', onTransitionEnd);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}, [collapsed]);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
setShowFade(collapsed);
|
|
44
|
+
if (!collapsed)
|
|
45
|
+
setShouldHideContent(false);
|
|
36
46
|
}, [collapsed]);
|
|
37
47
|
useEffect(() => {
|
|
38
48
|
if (contentRef.current) {
|
|
@@ -59,13 +69,14 @@ export const CollapseContent = ({ children, minHeight = DEFAULT_HEIGHT, 'data-te
|
|
|
59
69
|
return {
|
|
60
70
|
'--duration': `${calculatedDuration}ms`,
|
|
61
71
|
height,
|
|
62
|
-
opacity: collapsed && !minHeight ? HIDDEN : VISIBLE
|
|
72
|
+
opacity: collapsed && !minHeight ? HIDDEN : VISIBLE,
|
|
63
73
|
};
|
|
64
74
|
}, [duration, height, collapsed, minHeight]);
|
|
65
75
|
const fadeShouldBeVisible = useMemo(() => Boolean(minHeight && showFade), [minHeight, showFade]);
|
|
76
|
+
const shouldRenderContent = disableAnimation ? !collapsed : !shouldHideContent;
|
|
66
77
|
return (<div ref={containerRef} id={`collapse-content-${id}`} data-test={dataTests(COLLAPSE_CONTENT_CONTAINER_TEST_ID)} className={classNames(styles.container, { [styles.transition]: !disableAnimation })} style={style}>
|
|
67
78
|
<div ref={contentRef} data-test={dataTests(COLLAPSE_CONTENT_TEST_ID, dataTest)}>
|
|
68
|
-
{children}
|
|
79
|
+
{shouldRenderContent ? children : null}
|
|
69
80
|
</div>
|
|
70
81
|
{fadeShouldBeVisible && <div className={styles.fade}/>}
|
|
71
82
|
</div>);
|
|
@@ -14,10 +14,12 @@ export const CollapseControl = ({ children, 'data-test': dataTest }) => {
|
|
|
14
14
|
}
|
|
15
15
|
return children;
|
|
16
16
|
}, [children, collapsed]);
|
|
17
|
-
return (<p data-test={dataTests(COLLAPSE_CONTROL_TEST_ID, dataTest)}>
|
|
17
|
+
return (<p data-test={dataTests(COLLAPSE_CONTROL_TEST_ID, dataTest)}>
|
|
18
|
+
{cloneElement(child, {
|
|
18
19
|
onClick: setCollapsed,
|
|
19
20
|
'aria-controls': `collapse-content-${id}`,
|
|
20
|
-
'aria-expanded': String(!collapsed)
|
|
21
|
-
})}
|
|
21
|
+
'aria-expanded': String(!collapsed),
|
|
22
|
+
})}
|
|
23
|
+
</p>);
|
|
22
24
|
};
|
|
23
25
|
export default CollapseControl;
|
|
@@ -1,40 +1,41 @@
|
|
|
1
1
|
.container {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
overflow: hidden;
|
|
2
|
+
position: relative;
|
|
3
|
+
will-change: height, opacity;
|
|
6
4
|
|
|
5
|
+
overflow: hidden;
|
|
7
6
|
}
|
|
8
7
|
|
|
9
8
|
.transition {
|
|
10
|
-
|
|
9
|
+
transition:
|
|
10
|
+
height var(--duration) ease-in-out 0s,
|
|
11
|
+
opacity var(--duration) ease-in-out 0s;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
.summary {
|
|
14
|
-
|
|
15
|
+
list-style: none;
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
cursor: pointer;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
.trigger {
|
|
20
|
-
|
|
21
|
+
cursor: pointer;
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
border: none;
|
|
24
|
+
outline: none;
|
|
25
|
+
background: transparent;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
.fade {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
position: absolute;
|
|
30
|
+
z-index: 10;
|
|
31
|
+
right: 0;
|
|
32
|
+
bottom: 0;
|
|
33
|
+
left: 0;
|
|
33
34
|
|
|
34
|
-
|
|
35
|
+
height: calc(var(--ring-unit) * 3);
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
pointer-events: none;
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
color: var(--ring-content-background-color);
|
|
40
|
+
background-image: linear-gradient(to bottom, transparent 0%, currentColor 50%);
|
|
40
41
|
}
|
|
@@ -5,7 +5,7 @@ import { BASE_ANIMATION_DURATION } from './consts';
|
|
|
5
5
|
/**
|
|
6
6
|
* @name Collapse
|
|
7
7
|
*/
|
|
8
|
-
export const Collapse = ({ children, duration = BASE_ANIMATION_DURATION, disableAnimation = false, className = '', onChange = () => { } }) => {
|
|
8
|
+
export const Collapse = ({ children, duration = BASE_ANIMATION_DURATION, disableAnimation = false, className = '', onChange = () => { }, }) => {
|
|
9
9
|
const [collapsed, toggle] = useState(true);
|
|
10
10
|
const id = useId();
|
|
11
11
|
const setCollapsed = useCallback(() => {
|
|
@@ -18,7 +18,7 @@ export const Collapse = ({ children, duration = BASE_ANIMATION_DURATION, disable
|
|
|
18
18
|
setCollapsed,
|
|
19
19
|
duration,
|
|
20
20
|
disableAnimation,
|
|
21
|
-
id
|
|
21
|
+
id,
|
|
22
22
|
}}>
|
|
23
23
|
{children}
|
|
24
24
|
</CollapseContext.Provider>
|
|
@@ -9,8 +9,8 @@ export interface ConfirmProps {
|
|
|
9
9
|
cancelIsDefault: boolean;
|
|
10
10
|
confirmLabel: string;
|
|
11
11
|
rejectLabel: string;
|
|
12
|
-
onConfirm: (
|
|
13
|
-
onReject: (
|
|
12
|
+
onConfirm: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
13
|
+
onReject: (event?: React.MouseEvent<HTMLButtonElement>) => void;
|
|
14
14
|
className?: string | undefined;
|
|
15
15
|
native?: boolean;
|
|
16
16
|
}
|
|
@@ -19,7 +19,7 @@ export default class Confirm extends PureComponent {
|
|
|
19
19
|
confirmLabel: 'OK',
|
|
20
20
|
rejectLabel: 'Cancel',
|
|
21
21
|
onConfirm: () => { },
|
|
22
|
-
onReject: () => { }
|
|
22
|
+
onReject: () => { },
|
|
23
23
|
};
|
|
24
24
|
onEscPress = () => {
|
|
25
25
|
if (this.props.rejectOnEsc) {
|
|
@@ -27,7 +27,7 @@ export default class Confirm extends PureComponent {
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
render() {
|
|
30
|
-
const { show, className, inProgress, cancelIsDefault, text, description, confirmLabel, rejectLabel, onConfirm, onReject, native } = this.props;
|
|
30
|
+
const { show, className, inProgress, cancelIsDefault, text, description, confirmLabel, rejectLabel, onConfirm, onReject, native, } = this.props;
|
|
31
31
|
return (<Dialog label={text || (typeof description === 'string' ? description : undefined)} className={className} onEscPress={this.onEscPress} show={show} trapFocus data-test="ring-confirm" native={native}>
|
|
32
32
|
{text && <Header>{text}</Header>}
|
|
33
33
|
{description && (<Content>
|
|
@@ -17,5 +17,5 @@ export interface ConfirmServiceParams {
|
|
|
17
17
|
onBeforeConfirm?: (() => void) | undefined;
|
|
18
18
|
buttonsHeight?: ControlsHeight | undefined;
|
|
19
19
|
}
|
|
20
|
-
export default function confirm({ text, description, confirmLabel, rejectLabel, cancelIsDefault, onBeforeConfirm, buttonsHeight }: ConfirmServiceParams): Promise<void>;
|
|
20
|
+
export default function confirm({ text, description, confirmLabel, rejectLabel, cancelIsDefault, onBeforeConfirm, buttonsHeight, }: ConfirmServiceParams): Promise<void>;
|
|
21
21
|
export declare function hideConfirm(): void;
|
|
@@ -12,7 +12,7 @@ function renderConfirm(props) {
|
|
|
12
12
|
<Confirm {...restProps}/>
|
|
13
13
|
</ControlsHeightContext.Provider>);
|
|
14
14
|
}
|
|
15
|
-
export default function confirm({ text, description, confirmLabel = 'OK', rejectLabel = 'Cancel', cancelIsDefault, onBeforeConfirm, buttonsHeight }) {
|
|
15
|
+
export default function confirm({ text, description, confirmLabel = 'OK', rejectLabel = 'Cancel', cancelIsDefault, onBeforeConfirm, buttonsHeight, }) {
|
|
16
16
|
return new Promise((resolve, reject) => {
|
|
17
17
|
const props = {
|
|
18
18
|
text,
|
|
@@ -25,12 +25,12 @@ export default function confirm({ text, description, confirmLabel = 'OK', reject
|
|
|
25
25
|
onConfirm: () => {
|
|
26
26
|
if (onBeforeConfirm) {
|
|
27
27
|
renderConfirm({ ...props, inProgress: true });
|
|
28
|
-
return Promise.resolve(onBeforeConfirm())
|
|
29
|
-
then(() => {
|
|
28
|
+
return Promise.resolve(onBeforeConfirm())
|
|
29
|
+
.then(() => {
|
|
30
30
|
renderConfirm({ ...props, show: false });
|
|
31
31
|
resolve();
|
|
32
|
-
})
|
|
33
|
-
catch(err => {
|
|
32
|
+
})
|
|
33
|
+
.catch(err => {
|
|
34
34
|
renderConfirm({ ...props, show: false });
|
|
35
35
|
reject(err);
|
|
36
36
|
});
|
|
@@ -41,7 +41,7 @@ export default function confirm({ text, description, confirmLabel = 'OK', reject
|
|
|
41
41
|
onReject: () => {
|
|
42
42
|
renderConfirm({ ...props, show: false });
|
|
43
43
|
reject(new Error('Confirm(@jetbrains/ring-ui): null exception'));
|
|
44
|
-
}
|
|
44
|
+
},
|
|
45
45
|
};
|
|
46
46
|
renderConfirm(props);
|
|
47
47
|
});
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
@import "../global/variables.css";
|
|
2
2
|
|
|
3
3
|
@value extra-small-screen-media, small-screen-media from "../global/global.css";
|
|
4
|
-
@value sidebarWidth: calc(var(--ring-unit) * 30);
|
|
5
4
|
|
|
6
5
|
.contentLayout {
|
|
6
|
+
--ring-content-layout-sidebar-width: calc(var(--ring-unit) * 30);
|
|
7
|
+
|
|
7
8
|
position: relative;
|
|
8
9
|
|
|
9
10
|
display: flex;
|
|
@@ -19,8 +20,8 @@
|
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
.sidebarContainer {
|
|
22
|
-
min-width:
|
|
23
|
-
max-width:
|
|
23
|
+
min-width: var(--ring-content-layout-sidebar-width);
|
|
24
|
+
max-width: var(--ring-content-layout-sidebar-width);
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
.sidebarContainerRight {
|
|
@@ -31,8 +32,8 @@
|
|
|
31
32
|
overflow: auto;
|
|
32
33
|
|
|
33
34
|
box-sizing: border-box;
|
|
34
|
-
min-width:
|
|
35
|
-
max-width:
|
|
35
|
+
min-width: var(--ring-content-layout-sidebar-width);
|
|
36
|
+
max-width: var(--ring-content-layout-sidebar-width);
|
|
36
37
|
height: 100%;
|
|
37
38
|
padding-right: calc(var(--ring-unit) * 2);
|
|
38
39
|
padding-left: calc(var(--ring-unit) * 4);
|
|
@@ -7,10 +7,10 @@ import styles from './content-layout.css';
|
|
|
7
7
|
*/
|
|
8
8
|
export default class ContentLayout extends Component {
|
|
9
9
|
static defaultProps = {
|
|
10
|
-
responsive: true
|
|
10
|
+
responsive: true,
|
|
11
11
|
};
|
|
12
12
|
state = {
|
|
13
|
-
contentNode: null
|
|
13
|
+
contentNode: null,
|
|
14
14
|
};
|
|
15
15
|
saveContentNode = (contentNode) => {
|
|
16
16
|
this.setState({ contentNode });
|
|
@@ -18,14 +18,15 @@ export default class ContentLayout extends Component {
|
|
|
18
18
|
render() {
|
|
19
19
|
const { children, className, contentClassName, responsive, ...restProps } = this.props;
|
|
20
20
|
const classes = classNames(styles.contentLayout, className, {
|
|
21
|
-
[styles.contentLayoutResponsive]: responsive
|
|
21
|
+
[styles.contentLayoutResponsive]: responsive,
|
|
22
22
|
});
|
|
23
23
|
const contentClasses = classNames(styles.contentLayoutContent, contentClassName);
|
|
24
24
|
const childrenArray = Children.toArray(children);
|
|
25
25
|
const sidebarChild = childrenArray.filter((child) => child != null && typeof child === 'object' && 'type' in child && child.type === Sidebar)[0];
|
|
26
|
-
const sidebar = sidebarChild &&
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
const sidebar = sidebarChild &&
|
|
27
|
+
cloneElement(sidebarChild, {
|
|
28
|
+
contentNode: this.state.contentNode,
|
|
29
|
+
});
|
|
29
30
|
const contentChildren = childrenArray.filter(child => child !== sidebarChild);
|
|
30
31
|
return (<div data-test="content-layout" {...restProps} className={classes}>
|
|
31
32
|
{sidebar}
|
|
@@ -8,7 +8,7 @@ export default class Sidebar extends Component {
|
|
|
8
8
|
state = {
|
|
9
9
|
topIsOutside: true,
|
|
10
10
|
bottomIsOutside: true,
|
|
11
|
-
sidebarVisibleHeight: undefined
|
|
11
|
+
sidebarVisibleHeight: undefined,
|
|
12
12
|
};
|
|
13
13
|
sidebarNode;
|
|
14
14
|
handleTopWaypoint = ({ currentPosition }) => {
|
|
@@ -17,7 +17,7 @@ export default class Sidebar extends Component {
|
|
|
17
17
|
handleBottomWaypoint = ({ currentPosition, waypointTop }) => {
|
|
18
18
|
this.setState({
|
|
19
19
|
sidebarVisibleHeight: waypointTop,
|
|
20
|
-
bottomIsOutside: currentPosition !== INSIDE
|
|
20
|
+
bottomIsOutside: currentPosition !== INSIDE,
|
|
21
21
|
});
|
|
22
22
|
};
|
|
23
23
|
shouldUseFixation() {
|
|
@@ -41,16 +41,16 @@ export default class Sidebar extends Component {
|
|
|
41
41
|
const shouldFixateTop = bottomIsOutside && topIsOutside && this.shouldUseFixation();
|
|
42
42
|
const shouldFixateBottom = this.shouldFixateBottom();
|
|
43
43
|
const containerClasses = classNames(styles.sidebarContainer, containerClassName, {
|
|
44
|
-
[styles.sidebarContainerRight]: right
|
|
44
|
+
[styles.sidebarContainerRight]: right,
|
|
45
45
|
});
|
|
46
46
|
const classes = classNames(styles.sidebar, className, {
|
|
47
47
|
[styles.sidebarRight]: right,
|
|
48
48
|
[styles.sidebarFixedTop]: shouldFixateTop,
|
|
49
49
|
[styles.sidebarFixedBottom]: shouldFixateBottom,
|
|
50
|
-
[fixedClassName ?? '']: shouldFixateTop || shouldFixateBottom
|
|
50
|
+
[fixedClassName ?? '']: shouldFixateTop || shouldFixateBottom,
|
|
51
51
|
});
|
|
52
52
|
const style = {
|
|
53
|
-
maxHeight: shouldFixateBottom && sidebarVisibleHeight ? `${sidebarVisibleHeight}px` : undefined
|
|
53
|
+
maxHeight: shouldFixateBottom && sidebarVisibleHeight ? `${sidebarVisibleHeight}px` : undefined,
|
|
54
54
|
};
|
|
55
55
|
return (<aside className={containerClasses} ref={this.sidebarRef}>
|
|
56
56
|
<Waypoint onEnter={this.handleTopWaypoint} onLeave={this.handleTopWaypoint}/>
|
|
@@ -5,7 +5,7 @@ import { Component, HTMLAttributes, Ref } from 'react';
|
|
|
5
5
|
declare function noop(): void;
|
|
6
6
|
export interface ContentEditableBaseProps extends HTMLAttributes<HTMLElement> {
|
|
7
7
|
disabled: boolean;
|
|
8
|
-
onComponentUpdate: (
|
|
8
|
+
onComponentUpdate: (prevProps: ContentEditableBaseProps) => void;
|
|
9
9
|
inputRef?: Ref<HTMLDivElement> | null | undefined;
|
|
10
10
|
__html: string;
|
|
11
11
|
}
|
|
@@ -9,11 +9,10 @@ class ContentEditableBase extends Component {
|
|
|
9
9
|
disabled: false,
|
|
10
10
|
tabIndex: 0,
|
|
11
11
|
onInput: noop,
|
|
12
|
-
onComponentUpdate: noop
|
|
12
|
+
onComponentUpdate: noop,
|
|
13
13
|
};
|
|
14
14
|
shouldComponentUpdate(nextProps) {
|
|
15
|
-
return nextProps.disabled !== this.props.disabled ||
|
|
16
|
-
nextProps.__html !== this.props.__html;
|
|
15
|
+
return nextProps.disabled !== this.props.disabled || nextProps.__html !== this.props.__html;
|
|
17
16
|
}
|
|
18
17
|
componentDidUpdate(prevProps) {
|
|
19
18
|
this.props.onComponentUpdate(prevProps);
|
|
@@ -26,5 +25,5 @@ class ContentEditableBase extends Component {
|
|
|
26
25
|
disabled={disabled} role="textbox" tabIndex={disabled ? undefined : tabIndex} contentEditable={!this.props.disabled} dangerouslySetInnerHTML={{ __html }}/>);
|
|
27
26
|
}
|
|
28
27
|
}
|
|
29
|
-
const ContentEditable = ({ children, ...props }) => <ContentEditableBase {...props} __html={renderToStaticMarkup(children)}
|
|
28
|
+
const ContentEditable = ({ children, ...props }) => (<ContentEditableBase {...props} __html={renderToStaticMarkup(children)}/>);
|
|
30
29
|
export default ContentEditable;
|
|
@@ -8,9 +8,11 @@ export var LabelType;
|
|
|
8
8
|
})(LabelType || (LabelType = {}));
|
|
9
9
|
const classNameByType = {
|
|
10
10
|
[LabelType.SECONDARY]: styles.secondaryLabel,
|
|
11
|
-
[LabelType.FORM]: styles.formLabel
|
|
11
|
+
[LabelType.FORM]: styles.formLabel,
|
|
12
12
|
};
|
|
13
13
|
export const ControlLabel = ({ children, type = LabelType.SECONDARY, disabled, ...rest }) => (<label className={classNames(styles.label, classNameByType[type], {
|
|
14
|
-
[styles.disabledLabel]: disabled
|
|
15
|
-
})} {...rest}>
|
|
14
|
+
[styles.disabledLabel]: disabled,
|
|
15
|
+
})} {...rest}>
|
|
16
|
+
{children}
|
|
17
|
+
</label>);
|
|
16
18
|
export default ControlLabel;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
@import "../global/variables.css";
|
|
2
2
|
|
|
3
|
-
@value height, compensate from "../table/table.css";
|
|
4
|
-
|
|
5
3
|
.dataListWrapper {
|
|
4
|
+
--ring-table-compensate: 2px;
|
|
5
|
+
|
|
6
6
|
position: relative;
|
|
7
7
|
}
|
|
8
8
|
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
box-sizing: content-box;
|
|
27
27
|
height: calc(4 * var(--ring-unit));
|
|
28
|
-
padding: 0 calc(var(--ring-unit) * 5) compensate 0;
|
|
28
|
+
padding: 0 calc(var(--ring-unit) * 5) var(--ring-table-compensate) 0;
|
|
29
29
|
|
|
30
30
|
outline: none;
|
|
31
31
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
* @name Data List
|
|
3
|
+
*/
|
|
4
4
|
import { Component } from 'react';
|
|
5
5
|
import { FocusSensorOuterProps } from '../global/focus-sensor-hoc';
|
|
6
6
|
import { SelectionShortcutsAddProps, SelectionShortcutsOuterProps } from '../table/selection-shortcuts-hoc';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
* @name Data List
|
|
3
|
+
*/
|
|
4
4
|
import { PureComponent, Component } from 'react';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
6
|
import focusSensorHOC from '../global/focus-sensor-hoc';
|
|
@@ -16,7 +16,7 @@ class DataList extends PureComponent {
|
|
|
16
16
|
loading: false,
|
|
17
17
|
onItemMoreLess: () => { },
|
|
18
18
|
itemMoreLessState: () => moreLessButtonStates.UNUSED,
|
|
19
|
-
remoteSelection: false
|
|
19
|
+
remoteSelection: false,
|
|
20
20
|
};
|
|
21
21
|
componentDidUpdate(prevProps) {
|
|
22
22
|
const { data, selection, onSelect, selectable } = this.props;
|
|
@@ -56,7 +56,7 @@ class DataList extends PureComponent {
|
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
58
|
shortcutsMap = {
|
|
59
|
-
'=': this.onEqualPress
|
|
59
|
+
'=': this.onEqualPress,
|
|
60
60
|
};
|
|
61
61
|
render() {
|
|
62
62
|
const { data, className, loading, selection, disabledHover, itemFormatter, focused, innerRef } = this.props;
|
|
@@ -64,11 +64,10 @@ class DataList extends PureComponent {
|
|
|
64
64
|
const classes = classNames(className, {
|
|
65
65
|
[styles.dataList]: true,
|
|
66
66
|
[styles.disabledHover]: disabledHover,
|
|
67
|
-
[styles.multiSelection]: selection.getSelected().size > 0
|
|
67
|
+
[styles.multiSelection]: selection.getSelected().size > 0,
|
|
68
68
|
});
|
|
69
69
|
return (<div className={styles.dataListWrapper} data-test="ring-data-list" ref={innerRef}>
|
|
70
|
-
{focused &&
|
|
71
|
-
(<Shortcuts map={shortcutsMap} scope={this.shortcutsScope}/>)}
|
|
70
|
+
{focused && <Shortcuts map={shortcutsMap} scope={this.shortcutsScope}/>}
|
|
72
71
|
|
|
73
72
|
<ul className={classes}>
|
|
74
73
|
{data.map(model => {
|