@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
|
@@ -15,10 +15,10 @@ export default class AuthDialog extends Component {
|
|
|
15
15
|
confirmLabel: 'Log in',
|
|
16
16
|
cancelLabel: 'Remain a guest',
|
|
17
17
|
onConfirm: () => { },
|
|
18
|
-
onCancel: () => { }
|
|
18
|
+
onCancel: () => { },
|
|
19
19
|
};
|
|
20
20
|
state = {
|
|
21
|
-
retrying: false
|
|
21
|
+
retrying: false,
|
|
22
22
|
};
|
|
23
23
|
componentDidMount() {
|
|
24
24
|
window.addEventListener('online', this.onRetryPress);
|
|
@@ -47,18 +47,18 @@ export default class AuthDialog extends Component {
|
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
render() {
|
|
50
|
-
const { show, className, errorMessage, serviceImage, serviceName, loginCaption, loginToCaption, confirmLabel, cancelLabel, tryAgainLabel, onConfirm, onCancel, onTryAgain } = this.props;
|
|
50
|
+
const { show, className, errorMessage, serviceImage, serviceName, loginCaption, loginToCaption, confirmLabel, cancelLabel, tryAgainLabel, onConfirm, onCancel, onTryAgain, } = this.props;
|
|
51
51
|
const { retrying } = this.state;
|
|
52
52
|
const defaultTitle = serviceName ? loginToCaption : loginCaption;
|
|
53
|
-
const title = (this.props.title || defaultTitle)
|
|
54
|
-
replace('%serviceName%', serviceName ?? '')
|
|
55
|
-
replace('{{serviceName}}', serviceName ?? '');
|
|
53
|
+
const title = (this.props.title || defaultTitle)
|
|
54
|
+
.replace('%serviceName%', serviceName ?? '')
|
|
55
|
+
.replace('{{serviceName}}', serviceName ?? '');
|
|
56
56
|
return (<Dialog label={title} data-test="ring-auth-dialog" className={className} contentClassName={classNames(className, styles.dialog)} onEscPress={this.onEscPress} show={show} trapFocus>
|
|
57
57
|
<Content>
|
|
58
58
|
<div className={styles.content}>
|
|
59
|
-
{serviceImage &&
|
|
59
|
+
{serviceImage && <img alt={`${serviceName} logo`} className={styles.logo} src={serviceImage}/>}
|
|
60
60
|
<H2 className={styles.title}>{title}</H2>
|
|
61
|
-
{errorMessage &&
|
|
61
|
+
{errorMessage && <div className={styles.error}>{errorMessage}</div>}
|
|
62
62
|
<Button primary className={styles.firstButton} data-test="auth-dialog-confirm-button" onClick={onConfirm}>
|
|
63
63
|
{confirmLabel}
|
|
64
64
|
</Button>
|
|
@@ -10,14 +10,14 @@ export const reactRoot = createRoot(containerElement);
|
|
|
10
10
|
* Renders AuthDialog into virtual node to skip maintaining container
|
|
11
11
|
*/
|
|
12
12
|
function renderAuthDialog(props) {
|
|
13
|
-
reactRoot.render(
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
reactRoot.render(<ControlsHeightContext.Provider value={getGlobalControlsHeight()}>
|
|
14
|
+
<AuthDialog {...props}/>
|
|
15
|
+
</ControlsHeightContext.Provider>);
|
|
16
16
|
}
|
|
17
17
|
export default function showAuthDialog(props = {}) {
|
|
18
18
|
renderAuthDialog({
|
|
19
19
|
...props,
|
|
20
|
-
show: true
|
|
20
|
+
show: true,
|
|
21
21
|
});
|
|
22
22
|
return () => {
|
|
23
23
|
renderAuthDialog({ show: false });
|
|
@@ -23,10 +23,10 @@ export default class Avatar extends PureComponent {
|
|
|
23
23
|
dpr: getPixelRatio(),
|
|
24
24
|
size: Size.Size20,
|
|
25
25
|
subavatarSize: Size.Size20 / 2,
|
|
26
|
-
style: {}
|
|
26
|
+
style: {},
|
|
27
27
|
};
|
|
28
28
|
state = {
|
|
29
|
-
errorUrl: ''
|
|
29
|
+
errorUrl: '',
|
|
30
30
|
};
|
|
31
31
|
handleError = () => {
|
|
32
32
|
this.setState({ errorUrl: this.props.url });
|
|
@@ -43,16 +43,18 @@ export default class Avatar extends PureComponent {
|
|
|
43
43
|
borderRadius: round ? '50%' : borderRadius,
|
|
44
44
|
height: sizeString,
|
|
45
45
|
width: sizeString,
|
|
46
|
-
...style
|
|
46
|
+
...style,
|
|
47
47
|
};
|
|
48
48
|
const styleObjGroup = {
|
|
49
49
|
borderRadius: '2px',
|
|
50
50
|
height: subavatarSizeString,
|
|
51
51
|
width: subavatarSizeString,
|
|
52
|
-
...style
|
|
52
|
+
...style,
|
|
53
53
|
};
|
|
54
54
|
if (!url || this.state.errorUrl === url) {
|
|
55
|
-
return (<span {...restProps} data-test="avatar" className={classNames(styles.avatar, this.props.className, { [styles.empty]: username == null })} style={styleObj}>
|
|
55
|
+
return (<span {...restProps} data-test="avatar" className={classNames(styles.avatar, this.props.className, { [styles.empty]: username == null })} style={styleObj}>
|
|
56
|
+
{username != null && <FallbackAvatar size={size} round={round} username={username}/>}
|
|
57
|
+
</span>);
|
|
56
58
|
}
|
|
57
59
|
let src = url;
|
|
58
60
|
if (!skipParams && !isDataURI(url)) {
|
|
@@ -60,7 +62,7 @@ export default class Avatar extends PureComponent {
|
|
|
60
62
|
const queryParams = {
|
|
61
63
|
...parseQueryString(query),
|
|
62
64
|
dpr,
|
|
63
|
-
size
|
|
65
|
+
size,
|
|
64
66
|
};
|
|
65
67
|
src = encodeURL(urlStart, queryParams);
|
|
66
68
|
}
|
|
@@ -70,7 +72,7 @@ export default class Avatar extends PureComponent {
|
|
|
70
72
|
const queryParams = {
|
|
71
73
|
...parseQueryString(query),
|
|
72
74
|
dpr,
|
|
73
|
-
subavatarSizeString
|
|
75
|
+
subavatarSizeString,
|
|
74
76
|
};
|
|
75
77
|
subavatarSrc = skipParams ? subavatar : encodeURL(urlStart, queryParams);
|
|
76
78
|
return (<div>
|
|
@@ -21,39 +21,42 @@ const colorPairs = [
|
|
|
21
21
|
['#ED5502', '#E73AE8'],
|
|
22
22
|
['#ED358C', '#DBED18'],
|
|
23
23
|
['#ED358C', '#F9902E'],
|
|
24
|
-
['#FF7500', '#FFCA00']
|
|
24
|
+
['#FF7500', '#FFCA00'],
|
|
25
25
|
];
|
|
26
26
|
const Sizes = {
|
|
27
27
|
18: {
|
|
28
28
|
radius: 2,
|
|
29
29
|
text: { x: 9, y: 13 },
|
|
30
30
|
fontSize: '11px',
|
|
31
|
-
textAnchor: 'middle'
|
|
31
|
+
textAnchor: 'middle',
|
|
32
32
|
},
|
|
33
33
|
24: {
|
|
34
34
|
radius: 3,
|
|
35
35
|
text: { x: 2, y: 13 },
|
|
36
36
|
fontSize: '11px',
|
|
37
|
-
underscore: { x: 3, y: 17 }
|
|
37
|
+
underscore: { x: 3, y: 17 },
|
|
38
38
|
},
|
|
39
39
|
32: {
|
|
40
40
|
radius: 3,
|
|
41
41
|
text: { x: 3, y: 17 },
|
|
42
42
|
fontSize: '13px',
|
|
43
43
|
letterSpacing: 1,
|
|
44
|
-
underscore: { x: 4, y: 22 }
|
|
44
|
+
underscore: { x: 4, y: 22 },
|
|
45
45
|
},
|
|
46
46
|
40: {
|
|
47
47
|
radius: 3,
|
|
48
48
|
text: { x: 5, y: 19 },
|
|
49
49
|
fontSize: '15px',
|
|
50
50
|
letterSpacing: 1,
|
|
51
|
-
underscore: { x: 6, y: 28 }
|
|
52
|
-
}
|
|
51
|
+
underscore: { x: 6, y: 28 },
|
|
52
|
+
},
|
|
53
53
|
};
|
|
54
54
|
const sizeKeys = Object.keys(Sizes).map(Number);
|
|
55
55
|
function extractLetters(name) {
|
|
56
|
-
const names = name
|
|
56
|
+
const names = name
|
|
57
|
+
.split(/[\s._]+/)
|
|
58
|
+
.filter(Boolean)
|
|
59
|
+
.map(word => Array.from(word));
|
|
57
60
|
if (names.length >= 2) {
|
|
58
61
|
return names[0][0].toUpperCase() + names[1][0].toUpperCase();
|
|
59
62
|
}
|
|
@@ -74,7 +77,7 @@ const BASE = 32;
|
|
|
74
77
|
function hashCode(s) {
|
|
75
78
|
let h = 0;
|
|
76
79
|
for (let i = 0; i < s.length; i++) {
|
|
77
|
-
h = Math.imul(BASE - 1, h) + s.charCodeAt(i) | 0;
|
|
80
|
+
h = (Math.imul(BASE - 1, h) + s.charCodeAt(i)) | 0;
|
|
78
81
|
}
|
|
79
82
|
return h;
|
|
80
83
|
}
|
|
@@ -82,9 +85,7 @@ export default function FallbackAvatar({ username, size, round }) {
|
|
|
82
85
|
const hash = Math.abs(hashCode(username.toLowerCase()));
|
|
83
86
|
const [fromColor, toColor] = colorPairs[hash % colorPairs.length];
|
|
84
87
|
const possibleSizeKeys = sizeKeys.filter(key => key >= size);
|
|
85
|
-
const sizeKey = possibleSizeKeys.length > 0
|
|
86
|
-
? Math.min(...possibleSizeKeys)
|
|
87
|
-
: Math.max(...sizeKeys);
|
|
88
|
+
const sizeKey = possibleSizeKeys.length > 0 ? Math.min(...possibleSizeKeys) : Math.max(...sizeKeys);
|
|
88
89
|
const sizes = Sizes[sizeKey];
|
|
89
90
|
const radius = round ? '50%' : sizes.radius;
|
|
90
91
|
const gradientId = useMemo(() => getUID('gradient-'), []);
|
|
@@ -99,7 +100,9 @@ export default function FallbackAvatar({ username, size, round }) {
|
|
|
99
100
|
<rect fill={`url(#${gradientId})`} x="0" y="0" width={sizeKey} height={sizeKey} rx={radius} ry={radius}/>
|
|
100
101
|
<text x={sizes.text.x} y={sizes.text.y} fontFamily="Arial, Helvetica, sans-serif" fontSize={sizes.fontSize} letterSpacing={sizes.letterSpacing} fill="#FFFFFF" textAnchor={sizes.textAnchor} cursor="default">
|
|
101
102
|
<tspan>{extractLetters(username)}</tspan>
|
|
102
|
-
{sizes.underscore && <tspan x={sizes.underscore.x} y={sizes.underscore.y}>
|
|
103
|
+
{sizes.underscore && (<tspan x={sizes.underscore.x} y={sizes.underscore.y}>
|
|
104
|
+
{'_'}
|
|
105
|
+
</tspan>)}
|
|
103
106
|
</text>
|
|
104
107
|
<title>{username}</title>
|
|
105
108
|
</g>
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
@import "../global/variables.css";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
:root {
|
|
4
|
+
--ring-button-focus-border-color: var(--ring-border-hover-color);
|
|
5
|
+
--ring-button-shadow: inset 0 0 0 1px;
|
|
6
|
+
--ring-button-loader-width: calc(var(--ring-unit) * 8);
|
|
7
|
+
}
|
|
5
8
|
|
|
6
9
|
.heightS {
|
|
7
10
|
--ring-button-height: calc(var(--ring-unit) * 3);
|
|
@@ -28,13 +31,14 @@
|
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
.button {
|
|
31
|
-
--ring-button-focus-border-color: var(--ring-border-hover-color);
|
|
32
|
-
|
|
33
34
|
box-sizing: border-box;
|
|
34
35
|
margin: 0;
|
|
35
36
|
|
|
36
37
|
cursor: pointer;
|
|
37
|
-
transition:
|
|
38
|
+
transition:
|
|
39
|
+
color var(--ring-ease),
|
|
40
|
+
background-color var(--ring-ease),
|
|
41
|
+
box-shadow var(--ring-ease);
|
|
38
42
|
white-space: nowrap;
|
|
39
43
|
text-decoration: none;
|
|
40
44
|
|
|
@@ -71,7 +75,7 @@
|
|
|
71
75
|
color: var(--ring-text-color);
|
|
72
76
|
|
|
73
77
|
background-color: var(--ring-button-background-color);
|
|
74
|
-
box-shadow: button-shadow var(--ring-button-border-color);
|
|
78
|
+
box-shadow: var(--ring-button-shadow) var(--ring-button-border-color);
|
|
75
79
|
|
|
76
80
|
font-size: var(--ring-button-font-size);
|
|
77
81
|
line-height: var(--ring-button-line-height);
|
|
@@ -86,7 +90,9 @@
|
|
|
86
90
|
}
|
|
87
91
|
|
|
88
92
|
&:focus-visible {
|
|
89
|
-
box-shadow:
|
|
93
|
+
box-shadow:
|
|
94
|
+
var(--ring-button-shadow) var(--ring-button-focus-border-color),
|
|
95
|
+
0 0 0 1px var(--ring-button-focus-border-color);
|
|
90
96
|
}
|
|
91
97
|
}
|
|
92
98
|
|
|
@@ -181,13 +187,12 @@
|
|
|
181
187
|
border-radius: var(--ring-border-radius);
|
|
182
188
|
|
|
183
189
|
&::before {
|
|
184
|
-
background-image:
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
);
|
|
190
|
+
background-image: linear-gradient(
|
|
191
|
+
to right,
|
|
192
|
+
var(--ring-main-color),
|
|
193
|
+
var(--ring-button-loader-background) 40%,
|
|
194
|
+
var(--ring-main-color) 80%
|
|
195
|
+
);
|
|
191
196
|
}
|
|
192
197
|
}
|
|
193
198
|
}
|
|
@@ -212,7 +217,9 @@
|
|
|
212
217
|
.disabled {
|
|
213
218
|
cursor: auto;
|
|
214
219
|
|
|
215
|
-
&,
|
|
220
|
+
&,
|
|
221
|
+
&:hover,
|
|
222
|
+
&:active {
|
|
216
223
|
--ring-button-background-color: var(--ring-disabled-background-color);
|
|
217
224
|
--ring-button-border-color: var(--ring-border-disabled-color);
|
|
218
225
|
|
|
@@ -305,22 +312,21 @@
|
|
|
305
312
|
&::before {
|
|
306
313
|
display: block;
|
|
307
314
|
|
|
308
|
-
width: calc(100% +
|
|
315
|
+
width: calc(100% + var(--ring-button-loader-width));
|
|
309
316
|
height: 100%;
|
|
310
317
|
|
|
311
318
|
content: "";
|
|
312
319
|
animation: progress 1s linear infinite;
|
|
313
320
|
|
|
314
|
-
background-image:
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
);
|
|
321
|
+
background-image: linear-gradient(
|
|
322
|
+
to right,
|
|
323
|
+
var(--ring-content-background-color),
|
|
324
|
+
var(--ring-selected-background-color) 40%,
|
|
325
|
+
var(--ring-content-background-color) 80%
|
|
326
|
+
);
|
|
321
327
|
|
|
322
328
|
background-repeat: repeat;
|
|
323
|
-
background-size:
|
|
329
|
+
background-size: var(--ring-button-loader-width);
|
|
324
330
|
}
|
|
325
331
|
}
|
|
326
332
|
|
|
@@ -340,6 +346,7 @@
|
|
|
340
346
|
transition: color var(--ring-ease);
|
|
341
347
|
|
|
342
348
|
.block & {
|
|
349
|
+
margin-top: -1px;
|
|
343
350
|
margin-right: calc(var(--ring-unit) * -0.5);
|
|
344
351
|
|
|
345
352
|
color: var(--ring-icon-secondary-color);
|
|
@@ -30,25 +30,25 @@ export class Button extends PureComponent {
|
|
|
30
30
|
warnText();
|
|
31
31
|
}
|
|
32
32
|
const classes = getButtonClasses({
|
|
33
|
-
...this.props,
|
|
33
|
+
...this.props,
|
|
34
|
+
inline: isInline,
|
|
35
|
+
height: height ?? this.context,
|
|
34
36
|
});
|
|
35
37
|
const content = (<>
|
|
36
38
|
{icon && (<Icon className={classNames(styles.icon, iconClassName)} glyph={icon} size={iconSize} loading={loader && isInline} suppressSizeWarning={iconSuppressSizeWarning}/>)}
|
|
37
39
|
{children}
|
|
38
|
-
{dropdown &&
|
|
40
|
+
{dropdown && <Icon glyph={chevronDown} className={styles.dropdownIcon}/>}
|
|
39
41
|
</>);
|
|
40
42
|
const commonProps = {
|
|
41
43
|
tabIndex: loader ? -1 : 0,
|
|
42
44
|
...props,
|
|
43
45
|
className: classes,
|
|
44
|
-
children: <>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
children: (<>
|
|
47
|
+
{loader && !isInline && <div className={styles.loaderBackground}/>}
|
|
48
|
+
{content}
|
|
49
|
+
</>),
|
|
48
50
|
};
|
|
49
|
-
return commonProps.href != null
|
|
50
|
-
? (<ClickableLink {...commonProps}/>)
|
|
51
|
-
: (<button ref={this.buttonRef} type="button" {...commonProps}/>);
|
|
51
|
+
return commonProps.href != null ? (<ClickableLink {...commonProps}/>) : (<button ref={this.buttonRef} type="button" {...commonProps}/>);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
export { Size as IconSize };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ButtonProps } from './button';
|
|
2
|
-
export declare function getButtonClasses({ className, active, disabled, loader, primary, short, inline, danger, delayed, icon, height, children }: ButtonProps): string;
|
|
2
|
+
export declare function getButtonClasses({ className, active, disabled, loader, primary, short, inline, danger, delayed, icon, height, children, }: ButtonProps): string;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import styles from './button.css';
|
|
3
|
-
export function getButtonClasses({ className, active, disabled, loader, primary, short, inline, danger, delayed, icon, height, children }) {
|
|
3
|
+
export function getButtonClasses({ className, active, disabled, loader, primary, short, inline, danger, delayed, icon, height, children, }) {
|
|
4
4
|
const iconOnly = icon && !children;
|
|
5
5
|
const primaryBlock = primary && !inline;
|
|
6
|
-
const withNormalIcon = icon && !active && !danger && !primary && !disabled &&
|
|
7
|
-
(!inline || iconOnly);
|
|
6
|
+
const withNormalIcon = icon && !active && !danger && !primary && !disabled && (!inline || iconOnly);
|
|
8
7
|
return classNames(styles.button, className, styles[`height${height}`], inline ? styles.inline : styles.block, {
|
|
9
8
|
[styles.active]: active,
|
|
10
9
|
[styles.danger]: danger,
|
|
@@ -15,6 +14,6 @@ export function getButtonClasses({ className, active, disabled, loader, primary,
|
|
|
15
14
|
[styles.primaryBlock]: primaryBlock,
|
|
16
15
|
[styles.short]: short,
|
|
17
16
|
[styles.disabled]: disabled,
|
|
18
|
-
[styles.iconOnly]: iconOnly
|
|
17
|
+
[styles.iconOnly]: iconOnly,
|
|
19
18
|
});
|
|
20
19
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
@import "../global/variables.css";
|
|
2
2
|
|
|
3
|
-
@value button, active, primary
|
|
3
|
+
@value button, active, primary from "../button/button.css";
|
|
4
4
|
|
|
5
5
|
:root {
|
|
6
6
|
--ring-button-group-default-z-index: 1;
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
border-radius: var(--ring-border-radius);
|
|
24
24
|
|
|
25
|
-
box-shadow: button-shadow var(--ring-borders-color);
|
|
25
|
+
box-shadow: var(--ring-button-shadow) var(--ring-borders-color);
|
|
26
26
|
|
|
27
27
|
line-height: normal;
|
|
28
28
|
}
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
|
|
35
35
|
transition: none;
|
|
36
36
|
|
|
37
|
-
box-shadow:
|
|
37
|
+
box-shadow:
|
|
38
|
+
0 1px var(--ring-button-group-button-border-color) inset,
|
|
39
|
+
0 -1px var(--ring-button-group-button-border-color) inset;
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
.buttonGroup .button[disabled] {
|
|
41
|
-
--ring-button-group-button-border-color: var(--ring-border-disabled-color);
|
|
42
|
-
|
|
43
43
|
/* stylelint-disable selector-max-specificity */
|
|
44
44
|
&::before,
|
|
45
45
|
&::after {
|
|
@@ -54,7 +54,9 @@
|
|
|
54
54
|
|
|
55
55
|
background-color: var(--ring-disabled-background-color);
|
|
56
56
|
|
|
57
|
-
box-shadow:
|
|
57
|
+
box-shadow:
|
|
58
|
+
0 1px var(--ring-button-group-button-border-color) inset,
|
|
59
|
+
0 -1px var(--ring-button-group-button-border-color) inset;
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
&::before {
|
|
@@ -69,7 +71,10 @@
|
|
|
69
71
|
|
|
70
72
|
.buttonGroup > .button:first-child,
|
|
71
73
|
.buttonGroup > :first-child .button {
|
|
72
|
-
box-shadow:
|
|
74
|
+
box-shadow:
|
|
75
|
+
0 1px var(--ring-button-group-button-border-color) inset,
|
|
76
|
+
0 -1px var(--ring-button-group-button-border-color) inset,
|
|
77
|
+
1px 0 var(--ring-button-group-button-border-color) inset;
|
|
73
78
|
|
|
74
79
|
/* stylelint-disable-next-line selector-max-specificity */
|
|
75
80
|
&::before {
|
|
@@ -79,7 +84,10 @@
|
|
|
79
84
|
|
|
80
85
|
.buttonGroup > .button:last-child,
|
|
81
86
|
.buttonGroup > :last-child .button {
|
|
82
|
-
box-shadow:
|
|
87
|
+
box-shadow:
|
|
88
|
+
0 1px var(--ring-button-group-button-border-color) inset,
|
|
89
|
+
0 -1px var(--ring-button-group-button-border-color) inset,
|
|
90
|
+
-1px 0 var(--ring-button-group-button-border-color) inset;
|
|
83
91
|
|
|
84
92
|
/* stylelint-disable-next-line selector-max-specificity */
|
|
85
93
|
&::after {
|
|
@@ -105,26 +113,30 @@
|
|
|
105
113
|
.buttonGroup .button.button:hover:not(:disabled),
|
|
106
114
|
.buttonGroup .button.button:active:not(:disabled) {
|
|
107
115
|
border-radius: var(--ring-border-radius);
|
|
108
|
-
box-shadow: button-shadow var(--ring-border-hover-color);
|
|
116
|
+
box-shadow: var(--ring-button-shadow) var(--ring-border-hover-color);
|
|
109
117
|
}
|
|
110
118
|
|
|
111
119
|
.buttonGroup .button.button:focus-visible {
|
|
112
120
|
border-radius: var(--ring-border-radius);
|
|
113
|
-
box-shadow:
|
|
121
|
+
box-shadow:
|
|
122
|
+
var(--ring-button-shadow) var(--ring-border-hover-color),
|
|
123
|
+
0 0 0 1px var(--ring-border-hover-color);
|
|
114
124
|
}
|
|
115
125
|
|
|
116
126
|
.buttonGroup .button.button.active {
|
|
117
127
|
border-radius: var(--ring-border-radius);
|
|
118
|
-
box-shadow: button-shadow var(--ring-main-color);
|
|
128
|
+
box-shadow: var(--ring-button-shadow) var(--ring-main-color);
|
|
119
129
|
}
|
|
120
130
|
|
|
121
131
|
.buttonGroup .button:focus-visible.active {
|
|
122
132
|
border-radius: var(--ring-border-radius);
|
|
123
|
-
box-shadow:
|
|
133
|
+
box-shadow:
|
|
134
|
+
var(--ring-button-shadow) var(--ring-main-color),
|
|
135
|
+
0 0 0 1px var(--ring-border-hover-color);
|
|
124
136
|
}
|
|
125
137
|
|
|
126
138
|
.buttonGroup .button.active[disabled] {
|
|
127
|
-
box-shadow: button-shadow var(--ring-border-selected-disabled-color);
|
|
139
|
+
box-shadow: var(--ring-button-shadow) var(--ring-border-selected-disabled-color);
|
|
128
140
|
}
|
|
129
141
|
/* stylelint-enable */
|
|
130
142
|
|
|
@@ -5,6 +5,6 @@ export default class Caption extends PureComponent {
|
|
|
5
5
|
render() {
|
|
6
6
|
const { className } = this.props;
|
|
7
7
|
const classes = classNames(styles.caption, className);
|
|
8
|
-
return
|
|
8
|
+
return <span {...this.props} className={classes}/>;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
@@ -4,11 +4,11 @@ import dataTests from '../global/data-tests';
|
|
|
4
4
|
import styles from './button-toolbar.css';
|
|
5
5
|
/**
|
|
6
6
|
* @name Button Toolbar
|
|
7
|
-
*/
|
|
7
|
+
*/
|
|
8
8
|
export default class ButtonToolbar extends PureComponent {
|
|
9
9
|
render() {
|
|
10
10
|
const { className, 'data-test': dataTest, ...restProps } = this.props;
|
|
11
11
|
const classes = classNames(styles.buttonToolbar, className);
|
|
12
|
-
return
|
|
12
|
+
return <div {...restProps} data-test={dataTests('ring-button-toolbar', dataTest)} className={classes}/>;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -70,15 +70,13 @@ export default class Caret {
|
|
|
70
70
|
range2.setEnd(range1.endContainer, range1.endOffset);
|
|
71
71
|
const _curNode = range1.startContainer;
|
|
72
72
|
if (this.target === _curNode) {
|
|
73
|
-
return range1.startOffset === 0 || _curNode.textContent == null
|
|
74
|
-
? 0
|
|
75
|
-
: _curNode.textContent.length;
|
|
73
|
+
return range1.startOffset === 0 || _curNode.textContent == null ? 0 : _curNode.textContent.length;
|
|
76
74
|
}
|
|
77
75
|
else if (!this.target.contains(_curNode)) {
|
|
78
76
|
return -1;
|
|
79
77
|
}
|
|
80
78
|
else if (!_curNode) {
|
|
81
|
-
return 'selectionStart' in this.target && this.target.selectionStart || -1;
|
|
79
|
+
return ('selectionStart' in this.target && this.target.selectionStart) || -1;
|
|
82
80
|
}
|
|
83
81
|
const curPos = this.getAbsolutePosition(_curNode);
|
|
84
82
|
if (range1.startContainer === range1.endContainer) {
|
|
@@ -86,9 +84,11 @@ export default class Caret {
|
|
|
86
84
|
return curPos + range1.startOffset;
|
|
87
85
|
}
|
|
88
86
|
else {
|
|
89
|
-
return {
|
|
87
|
+
return {
|
|
88
|
+
startOffset: curPos + range1.startOffset,
|
|
90
89
|
endOffset: curPos + range1.endOffset,
|
|
91
|
-
position: range2.toString().length
|
|
90
|
+
position: range2.toString().length,
|
|
91
|
+
};
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
else {
|
|
@@ -98,7 +98,7 @@ export default class Caret {
|
|
|
98
98
|
return { startOffset, endOffset, position: range2.toString().length };
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
-
return 'selectionStart' in this.target && this.target.selectionStart || -1;
|
|
101
|
+
return ('selectionStart' in this.target && this.target.selectionStart) || -1;
|
|
102
102
|
}
|
|
103
103
|
/**
|
|
104
104
|
* Get relative position of query
|
|
@@ -209,7 +209,7 @@ export default class Caret {
|
|
|
209
209
|
offset =
|
|
210
210
|
getRect(range).right -
|
|
211
211
|
getRect(this.target).left -
|
|
212
|
-
(range.startContainer instanceof HTMLElement && range.startContainer.offsetLeft || 0);
|
|
212
|
+
((range.startContainer instanceof HTMLElement && range.startContainer.offsetLeft) || 0);
|
|
213
213
|
}
|
|
214
214
|
return offset;
|
|
215
215
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
@import "../global/variables.css";
|
|
2
2
|
|
|
3
|
-
@value checkboxSize: 14px;
|
|
4
|
-
|
|
5
3
|
.checkbox {
|
|
4
|
+
--ring-checkbox-size: 14px;
|
|
5
|
+
|
|
6
6
|
position: relative;
|
|
7
7
|
|
|
8
8
|
display: inline-flex;
|
|
@@ -27,11 +27,14 @@
|
|
|
27
27
|
display: inline-block;
|
|
28
28
|
|
|
29
29
|
box-sizing: border-box;
|
|
30
|
-
width:
|
|
31
|
-
height:
|
|
30
|
+
width: var(--ring-checkbox-size);
|
|
31
|
+
height: var(--ring-checkbox-size);
|
|
32
32
|
|
|
33
33
|
user-select: none;
|
|
34
|
-
transition:
|
|
34
|
+
transition:
|
|
35
|
+
border-color var(--ring-ease),
|
|
36
|
+
background-color var(--ring-ease),
|
|
37
|
+
box-shadow var(--ring-ease);
|
|
35
38
|
vertical-align: middle;
|
|
36
39
|
pointer-events: none;
|
|
37
40
|
|
|
@@ -7,9 +7,7 @@ export function copyTextToClipboard(str) {
|
|
|
7
7
|
document.body.appendChild(el);
|
|
8
8
|
const selection = document.getSelection();
|
|
9
9
|
// Should restore previous selection
|
|
10
|
-
const selected =
|
|
11
|
-
? selection.getRangeAt(0)
|
|
12
|
-
: false;
|
|
10
|
+
const selected = selection && selection.rangeCount > 0 ? selection.getRangeAt(0) : false;
|
|
13
11
|
el.select();
|
|
14
12
|
document.execCommand('copy');
|
|
15
13
|
document.body.removeChild(el);
|
|
@@ -27,9 +25,7 @@ export function copyHTMLToClipboard(str) {
|
|
|
27
25
|
document.body.appendChild(el);
|
|
28
26
|
const selection = document.getSelection();
|
|
29
27
|
// Should restore previous selection
|
|
30
|
-
const selected =
|
|
31
|
-
? selection.getRangeAt(0)
|
|
32
|
-
: false;
|
|
28
|
+
const selected = selection && selection.rangeCount > 0 ? selection.getRangeAt(0) : false;
|
|
33
29
|
selection?.removeAllRanges();
|
|
34
30
|
const range = document.createRange();
|
|
35
31
|
range.selectNode(el);
|
|
@@ -7,14 +7,14 @@ function getClipboardImplementation() {
|
|
|
7
7
|
copy: (text) => navigator.clipboard.writeText(text),
|
|
8
8
|
copyHTML: (html) => navigator.clipboard.write([
|
|
9
9
|
new ClipboardItem({
|
|
10
|
-
['text/html']: new Blob([html], { type: 'text/html' })
|
|
11
|
-
})
|
|
12
|
-
])
|
|
10
|
+
['text/html']: new Blob([html], { type: 'text/html' }),
|
|
11
|
+
}),
|
|
12
|
+
]),
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
return {
|
|
16
16
|
copy: (str) => Promise.resolve(copyTextToClipboard(str)),
|
|
17
|
-
copyHTML: (html) => Promise.resolve(copyHTMLToClipboard(html))
|
|
17
|
+
copyHTML: (html) => Promise.resolve(copyHTMLToClipboard(html)),
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
async function copy(text, successMessage, errorMessage, delay = ALERT_DELAY, isHtml = false) {
|
|
@@ -36,6 +36,6 @@ async function copy(text, successMessage, errorMessage, delay = ALERT_DELAY, isH
|
|
|
36
36
|
}
|
|
37
37
|
const clipboard = {
|
|
38
38
|
copyText: async (text, successMessage, errorMessage, delay = ALERT_DELAY) => await copy(text, successMessage, errorMessage, delay),
|
|
39
|
-
copyHTML: async (html, successMessage, errorMessage, delay = ALERT_DELAY) => await copy(html, successMessage, errorMessage, delay, true)
|
|
39
|
+
copyHTML: async (html, successMessage, errorMessage, delay = ALERT_DELAY) => await copy(html, successMessage, errorMessage, delay, true),
|
|
40
40
|
};
|
|
41
41
|
export default clipboard;
|
|
@@ -5,7 +5,7 @@ export interface CodeProps {
|
|
|
5
5
|
code: string;
|
|
6
6
|
inline: boolean;
|
|
7
7
|
softWrap: boolean;
|
|
8
|
-
replacer: (
|
|
8
|
+
replacer: (element: HTMLElement | null) => void;
|
|
9
9
|
className?: string | null | undefined;
|
|
10
10
|
language?: string | null | undefined;
|
|
11
11
|
codeRef?: Ref<HTMLElement> | null | undefined;
|