@jetbrains/ring-ui 6.0.40 → 6.0.41
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/auth/down-notification.css +1 -1
- package/components/badge/badge.js +4 -0
- package/components/button/button.css +2 -2
- package/components/button/button.js +1 -1
- package/components/code/highlight.css +4 -4
- package/components/date-picker/date-picker.css +2 -2
- package/components/editable-heading/editable-heading.css +1 -1
- package/components/error-bubble/error-bubble.css +5 -6
- package/components/form/form.css +2 -2
- package/components/global/variables.css +4 -3
- package/components/header/services.css +1 -1
- package/components/heading/heading.css +6 -0
- package/components/heading/heading.d.ts +7 -4
- package/components/heading/heading.js +18 -20
- package/components/island/island.css +1 -1
- package/components/island-legacy/island-legacy.css +1 -1
- package/components/query-assist/query-assist.css +1 -1
- package/components/sidebar/sidebar.css +1 -1
- package/components/table/table.css +2 -2
- package/components/table-legacy/table-legacy.css +2 -2
- package/components/tabs/tabs.css +6 -9
- package/components/tag/tag.css +6 -5
- package/components/tag/tag.js +5 -0
- package/components/text/text.css +7 -0
- package/components/text/text.d.ts +1 -0
- package/components/text/text.js +2 -1
- package/components/toggle/toggle.css +18 -21
- package/components/toggle/toggle.d.ts +1 -2
- package/components/toggle/toggle.js +10 -5
- package/components/user-card/user-card.css +1 -1
- package/package.json +5 -5
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { PureComponent } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
+
import deprecate from 'util-deprecate';
|
|
4
5
|
import dataTests from '../global/data-tests';
|
|
5
6
|
import style from './badge.css';
|
|
7
|
+
const warn = deprecate(() => { }, 'Badge is deprecated and will be removed in RingUI 7.0. Use Tag instead.');
|
|
6
8
|
/**
|
|
7
9
|
* @name Badge
|
|
8
10
|
*/
|
|
11
|
+
// TODO remove in 7.0
|
|
9
12
|
export default class Badge extends PureComponent {
|
|
10
13
|
static propTypes = {
|
|
11
14
|
gray: PropTypes.bool,
|
|
@@ -17,6 +20,7 @@ export default class Badge extends PureComponent {
|
|
|
17
20
|
'data-test': PropTypes.string
|
|
18
21
|
};
|
|
19
22
|
render() {
|
|
23
|
+
warn();
|
|
20
24
|
const {
|
|
21
25
|
// Modifiers
|
|
22
26
|
gray, valid, invalid, disabled,
|
|
@@ -2,7 +2,7 @@ import { createRef, PureComponent } from 'react';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
|
-
import chevronDown from '@jetbrains/icons/chevron-
|
|
5
|
+
import chevronDown from '@jetbrains/icons/chevron-down';
|
|
6
6
|
import Icon, { Size } from '../icon/icon';
|
|
7
7
|
import ClickableLink from '../link/clickableLink';
|
|
8
8
|
import { ControlsHeightContext } from '../global/controls-height';
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
& :global(.hljs-type) {
|
|
41
41
|
color: var(--ring-code-keyword-color);
|
|
42
42
|
|
|
43
|
-
font-weight: bold;
|
|
43
|
+
font-weight: var(--ring-font-weight-bold);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
& :global(.hljs-name),
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
& :global(.hljs-attr) {
|
|
62
62
|
color: var(--ring-code-field-color);
|
|
63
63
|
|
|
64
|
-
font-weight: bold;
|
|
64
|
+
font-weight: var(--ring-font-weight-bold);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
& :global(.hljs-tag) > :global(.hljs-attr),
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
& :global(.hljs-string) {
|
|
83
83
|
color: var(--ring-code-string-color);
|
|
84
84
|
|
|
85
|
-
font-weight: bold;
|
|
85
|
+
font-weight: var(--ring-font-weight-bold);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
& :global(.hljs-doctag) {
|
|
@@ -107,6 +107,6 @@
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
& :global(.hljs-strong) {
|
|
110
|
-
font-weight: bold;
|
|
110
|
+
font-weight: var(--ring-font-weight-bold);
|
|
111
111
|
}
|
|
112
112
|
}
|
|
@@ -259,7 +259,7 @@
|
|
|
259
259
|
|
|
260
260
|
text-transform: capitalize;
|
|
261
261
|
|
|
262
|
-
font-weight: bold;
|
|
262
|
+
font-weight: var(--ring-font-weight-bold);
|
|
263
263
|
|
|
264
264
|
@supports (flex-basis: 1px) {
|
|
265
265
|
flex-basis: calc(var(--ring-unit) * 12);
|
|
@@ -462,7 +462,7 @@
|
|
|
462
462
|
.today.today {
|
|
463
463
|
position: relative;
|
|
464
464
|
|
|
465
|
-
font-weight: bold;
|
|
465
|
+
font-weight: var(--ring-font-weight-bold);
|
|
466
466
|
}
|
|
467
467
|
|
|
468
468
|
.today::before {
|
|
@@ -16,9 +16,8 @@
|
|
|
16
16
|
|
|
17
17
|
.errorBubble {
|
|
18
18
|
box-sizing: border-box;
|
|
19
|
-
min-height: calc(var(--ring-unit) *
|
|
20
|
-
padding
|
|
21
|
-
padding-left: calc(var(--ring-unit) * 2);
|
|
19
|
+
min-height: calc(var(--ring-unit) * 4);
|
|
20
|
+
padding: calc(var(--ring-unit) - 1px) calc(var(--ring-unit) * 1.5 - 1px);
|
|
22
21
|
|
|
23
22
|
white-space: nowrap;
|
|
24
23
|
|
|
@@ -30,13 +29,13 @@
|
|
|
30
29
|
background: var(--ring-popup-background-color);
|
|
31
30
|
box-shadow: var(--ring-popup-shadow);
|
|
32
31
|
|
|
33
|
-
font-size:
|
|
34
|
-
line-height:
|
|
32
|
+
font-size: var(--ring-font-size-smaller);
|
|
33
|
+
line-height: var(--ring-line-height-lowest);
|
|
35
34
|
}
|
|
36
35
|
|
|
37
36
|
.errorBubble::before {
|
|
38
37
|
position: absolute;
|
|
39
|
-
top: var(--ring-unit);
|
|
38
|
+
top: calc(var(--ring-unit) * 1.5);
|
|
40
39
|
left: -4px;
|
|
41
40
|
|
|
42
41
|
display: block;
|
package/components/form/form.css
CHANGED
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
|
|
67
67
|
margin-bottom: calc(var(--ring-unit));
|
|
68
68
|
|
|
69
|
-
font-weight: bold;
|
|
69
|
+
font-weight: var(--ring-font-weight-bold);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
:global(.ring-form__main-title) {
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
/* End of special fix */
|
|
146
146
|
|
|
147
147
|
:global(.ring-form__label_title) {
|
|
148
|
-
font-weight: bold;
|
|
148
|
+
font-weight: var(--ring-font-weight-bold);
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
:global(.ring-form__control) {
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
--ring-code-tag-background-components: 239, 239, 239;
|
|
129
129
|
--ring-code-tag-background-color: rgb(var(--ring-code-tag-background-components)); /* #efefef */
|
|
130
130
|
--ring-code-tag-color: var(--ring-code-keyword-color);
|
|
131
|
-
--ring-code-tag-font-weight: bold;
|
|
131
|
+
--ring-code-tag-font-weight: var(--ring-font-weight-bold);
|
|
132
132
|
--ring-code-field-components: 102, 14, 122;
|
|
133
133
|
--ring-code-field-color: rgb(var(--ring-code-field-components)); /* #660e7a */
|
|
134
134
|
--ring-code-attribute-components: 0, 0, 255;
|
|
@@ -144,10 +144,10 @@
|
|
|
144
144
|
/* Metrics */
|
|
145
145
|
--ring-border-radius: 4px;
|
|
146
146
|
--ring-border-radius-small: 2px;
|
|
147
|
-
--ring-font-size-larger:
|
|
147
|
+
--ring-font-size-larger: 16px;
|
|
148
148
|
--ring-font-size: 14px;
|
|
149
149
|
--ring-font-size-smaller: 12px;
|
|
150
|
-
--ring-line-height-taller:
|
|
150
|
+
--ring-line-height-taller: 24px;
|
|
151
151
|
--ring-line-height: 20px;
|
|
152
152
|
--ring-line-height-lower: 18px;
|
|
153
153
|
--ring-line-height-lowest: 16px;
|
|
@@ -162,6 +162,7 @@
|
|
|
162
162
|
"Courier New",
|
|
163
163
|
Courier,
|
|
164
164
|
monospace;
|
|
165
|
+
--ring-font-weight-bold: 600;
|
|
165
166
|
|
|
166
167
|
/* Common z-index-values */
|
|
167
168
|
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
&:is(h4) {
|
|
12
12
|
margin-top: var(--ring-line-height);
|
|
13
13
|
|
|
14
|
+
font-weight: var(--ring-font-weight-bold);
|
|
15
|
+
|
|
14
16
|
&:first-child {
|
|
15
17
|
margin-top: 0;
|
|
16
18
|
}
|
|
@@ -66,3 +68,7 @@
|
|
|
66
68
|
letter-spacing: 2px;
|
|
67
69
|
text-transform: uppercase;
|
|
68
70
|
}
|
|
71
|
+
|
|
72
|
+
.heading.bold {
|
|
73
|
+
font-weight: var(--ring-font-weight-bold);
|
|
74
|
+
}
|
|
@@ -18,8 +18,11 @@ export default Heading;
|
|
|
18
18
|
export interface H1Props extends HTMLAttributes<HTMLHeadingElement> {
|
|
19
19
|
caps?: boolean | null | undefined;
|
|
20
20
|
}
|
|
21
|
-
declare const H1:
|
|
22
|
-
declare const H2:
|
|
23
|
-
declare const H3:
|
|
24
|
-
|
|
21
|
+
declare const H1: import("react").NamedExoticComponent<H1Props>;
|
|
22
|
+
declare const H2: import("react").NamedExoticComponent<HTMLAttributes<HTMLHeadingElement>>;
|
|
23
|
+
declare const H3: import("react").NamedExoticComponent<HTMLAttributes<HTMLHeadingElement>>;
|
|
24
|
+
export interface H4Props extends HTMLAttributes<HTMLHeadingElement> {
|
|
25
|
+
bold?: boolean | null | undefined;
|
|
26
|
+
}
|
|
27
|
+
declare const H4: import("react").NamedExoticComponent<H4Props>;
|
|
25
28
|
export { H1, H2, H3, H4 };
|
|
@@ -29,24 +29,22 @@ Heading.propTypes = {
|
|
|
29
29
|
};
|
|
30
30
|
Heading.Levels = Levels;
|
|
31
31
|
export default Heading;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const H3 = makeHeading(Levels.H3);
|
|
51
|
-
const H4 = makeHeading(Levels.H4);
|
|
32
|
+
const warnCaps = deprecate(() => { }, 'H1 caps prop is deprecated and will be removed in Ring UI 7.0');
|
|
33
|
+
const H1 = memo(function H1({ className, caps, ...restProps }) {
|
|
34
|
+
if (caps) {
|
|
35
|
+
warnCaps();
|
|
36
|
+
}
|
|
37
|
+
const classes = classNames(className, { [styles.caps]: caps });
|
|
38
|
+
return <Heading {...restProps} level={Levels.H1} className={classes}/>;
|
|
39
|
+
});
|
|
40
|
+
const H2 = memo(function H2(props) {
|
|
41
|
+
return <Heading {...props} level={Levels.H2}/>;
|
|
42
|
+
});
|
|
43
|
+
const H3 = memo(function H3(props) {
|
|
44
|
+
return <Heading {...props} level={Levels.H3}/>;
|
|
45
|
+
});
|
|
46
|
+
const H4 = memo(function H4({ className, bold, ...restProps }) {
|
|
47
|
+
const classes = classNames(className, { [styles.bold]: bold });
|
|
48
|
+
return <Heading {...restProps} className={classes} level={Levels.H4}/>;
|
|
49
|
+
});
|
|
52
50
|
export { H1, H2, H3, H4 };
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
.headerCell.headerCellSorted {
|
|
50
|
-
font-weight: bold;
|
|
50
|
+
font-weight: var(--ring-font-weight-bold);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
.headerCell.headerCellSortable {
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
border-bottom: none;
|
|
82
82
|
|
|
83
83
|
font-size: var(--ring-font-size);
|
|
84
|
-
font-weight: bold;
|
|
84
|
+
font-weight: var(--ring-font-weight-bold);
|
|
85
85
|
line-height: var(--ring-line-height-lower);
|
|
86
86
|
}
|
|
87
87
|
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
:global(.ring-table__title.ring-table__title_active) {
|
|
48
|
-
font-weight: bold;
|
|
48
|
+
font-weight: var(--ring-font-weight-bold);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
:global(.ring-table__title:first-child) {
|
|
@@ -203,7 +203,7 @@
|
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
:global(.ring-table__column-title) {
|
|
206
|
-
font-weight: bold;
|
|
206
|
+
font-weight: var(--ring-font-weight-bold);
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
:global(.ring-table__column_wide) {
|
package/components/tabs/tabs.css
CHANGED
|
@@ -51,18 +51,15 @@
|
|
|
51
51
|
|
|
52
52
|
&:hover,
|
|
53
53
|
&:active {
|
|
54
|
+
color: var(--ring-link-hover-color);
|
|
55
|
+
outline-style: none;
|
|
56
|
+
box-shadow: inset 0 -1px 0 0 var(--ring-link-hover-color);
|
|
57
|
+
|
|
54
58
|
&.selected,
|
|
55
59
|
&.collapsed {
|
|
56
60
|
color: inherit;
|
|
57
61
|
box-shadow: selected-line-shadow var(--ring-text-color);
|
|
58
62
|
}
|
|
59
|
-
|
|
60
|
-
&:not(.selected),
|
|
61
|
-
&:not(.collapsed) {
|
|
62
|
-
color: var(--ring-link-hover-color);
|
|
63
|
-
outline-style: none;
|
|
64
|
-
box-shadow: inset 0 -1px 0 0 var(--ring-link-hover-color);
|
|
65
|
-
}
|
|
66
63
|
}
|
|
67
64
|
|
|
68
65
|
&:focus-visible {
|
|
@@ -96,7 +93,7 @@
|
|
|
96
93
|
outline: none;
|
|
97
94
|
box-shadow: selected-line-shadow var(--ring-selected-tab-color);
|
|
98
95
|
|
|
99
|
-
font-weight: bold;
|
|
96
|
+
font-weight: var(--ring-font-weight-bold);
|
|
100
97
|
}
|
|
101
98
|
|
|
102
99
|
.visible {
|
|
@@ -125,7 +122,7 @@
|
|
|
125
122
|
|
|
126
123
|
height: 0;
|
|
127
124
|
|
|
128
|
-
font-weight: bold;
|
|
125
|
+
font-weight: var(--ring-font-weight-bold);
|
|
129
126
|
}
|
|
130
127
|
|
|
131
128
|
.hiddenRegular {
|
package/components/tag/tag.css
CHANGED
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
.withRemove {
|
|
40
|
-
padding-right:
|
|
40
|
+
padding-right: 20px;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
.container {
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
position: absolute;
|
|
128
128
|
z-index: 1;
|
|
129
129
|
top: 2px;
|
|
130
|
-
right:
|
|
130
|
+
right: 1px;
|
|
131
131
|
|
|
132
132
|
height: auto;
|
|
133
133
|
padding: 0 calc(var(--ring-unit) / 2);
|
|
@@ -140,12 +140,13 @@
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
.icon {
|
|
143
|
-
margin-right:
|
|
143
|
+
margin-right: 5px;
|
|
144
|
+
margin-left: -3px;
|
|
144
145
|
|
|
145
146
|
color: var(--ring-icon-secondary-color);
|
|
146
147
|
|
|
147
|
-
|
|
148
|
-
vertical-align: -
|
|
148
|
+
&& svg {
|
|
149
|
+
vertical-align: -3.5px;
|
|
149
150
|
}
|
|
150
151
|
}
|
|
151
152
|
|
package/components/tag/tag.js
CHANGED
|
@@ -3,10 +3,12 @@ import * as React from 'react';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import closeIcon from '@jetbrains/icons/close-12px';
|
|
6
|
+
import deprecate from 'util-deprecate';
|
|
6
7
|
import Icon from '../icon/icon';
|
|
7
8
|
import Button from '../button/button';
|
|
8
9
|
import { ControlsHeight } from '../global/controls-height';
|
|
9
10
|
import styles from './tag.css';
|
|
11
|
+
const warnAngled = deprecate(() => { }, 'Tag angled prop is deprecated and will be removed in Ring UI 7.0');
|
|
10
12
|
/**
|
|
11
13
|
* @name Tag
|
|
12
14
|
*/
|
|
@@ -103,6 +105,9 @@ export default class Tag extends PureComponent {
|
|
|
103
105
|
return null;
|
|
104
106
|
}
|
|
105
107
|
render() {
|
|
108
|
+
if (this.props.angled) {
|
|
109
|
+
warnAngled();
|
|
110
|
+
}
|
|
106
111
|
const classes = classNames('ring-js-shortcuts', styles.tag, {
|
|
107
112
|
[styles.focused]: this.state.focused,
|
|
108
113
|
[styles.disabled]: this.props.disabled,
|
package/components/text/text.css
CHANGED
|
@@ -6,16 +6,23 @@
|
|
|
6
6
|
|
|
7
7
|
.sizeS {
|
|
8
8
|
font-size: var(--ring-font-size-smaller);
|
|
9
|
+
line-height: var(--ring-line-height-lowest);
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
.sizeM {
|
|
12
13
|
font-size: var(--ring-font-size);
|
|
14
|
+
line-height: var(--ring-line-height);
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
.sizeL {
|
|
16
18
|
font-size: var(--ring-font-size-larger);
|
|
19
|
+
line-height: var(--ring-line-height-taller);
|
|
17
20
|
}
|
|
18
21
|
|
|
19
22
|
.info {
|
|
20
23
|
color: var(--ring-secondary-color);
|
|
21
24
|
}
|
|
25
|
+
|
|
26
|
+
.bold {
|
|
27
|
+
font-weight: var(--ring-font-weight-bold);
|
|
28
|
+
}
|
package/components/text/text.js
CHANGED
|
@@ -19,9 +19,10 @@ export default class Text extends Component {
|
|
|
19
19
|
};
|
|
20
20
|
static Size = TextSize;
|
|
21
21
|
render() {
|
|
22
|
-
const { children, className, info, size, ...restProps } = this.props;
|
|
22
|
+
const { children, className, info, size, bold, ...restProps } = this.props;
|
|
23
23
|
const classes = classNames(styles.text, className, {
|
|
24
24
|
[styles.info]: info,
|
|
25
|
+
[styles.bold]: bold,
|
|
25
26
|
[styles.sizeS]: size === Text.Size.S,
|
|
26
27
|
[styles.sizeM]: size === Text.Size.M,
|
|
27
28
|
[styles.sizeL]: size === Text.Size.L
|
|
@@ -5,12 +5,15 @@
|
|
|
5
5
|
@value timing-function: cubic-bezier(0.23, 1, 0.32, 1);
|
|
6
6
|
|
|
7
7
|
.toggle {
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: baseline;
|
|
10
|
+
|
|
8
11
|
cursor: pointer;
|
|
9
12
|
|
|
10
13
|
&:hover .switch {
|
|
11
|
-
|
|
14
|
+
--ring-toggle-background-color: var(--ring-border-hover-color);
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
transition: none;
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
&.disabled {
|
|
@@ -22,14 +25,16 @@
|
|
|
22
25
|
margin-left: var(--ring-unit);
|
|
23
26
|
}
|
|
24
27
|
|
|
28
|
+
.disabled .label {
|
|
29
|
+
color: var(--ring-disabled-color);
|
|
30
|
+
}
|
|
31
|
+
|
|
25
32
|
.leftLabel {
|
|
26
33
|
margin-right: var(--ring-unit);
|
|
27
34
|
}
|
|
28
35
|
|
|
29
36
|
.switchWrapper {
|
|
30
37
|
position: relative;
|
|
31
|
-
|
|
32
|
-
display: inline-block;
|
|
33
38
|
}
|
|
34
39
|
|
|
35
40
|
.input {
|
|
@@ -47,13 +52,13 @@
|
|
|
47
52
|
|
|
48
53
|
.switch {
|
|
49
54
|
--ring-toggle-item-color: var(--ring-white-text-color);
|
|
50
|
-
--ring-toggle-background-color: var(--ring-
|
|
55
|
+
--ring-toggle-background-color: var(--ring-borders-color);
|
|
51
56
|
--ring-toggle-border-color: var(--ring-toggle-background-color);
|
|
52
57
|
--ring-switch-border-color: var(--ring-toggle-item-color);
|
|
53
58
|
|
|
54
59
|
position: relative;
|
|
55
60
|
|
|
56
|
-
display: block;
|
|
61
|
+
display: inline-block;
|
|
57
62
|
|
|
58
63
|
box-sizing: border-box;
|
|
59
64
|
|
|
@@ -98,18 +103,18 @@
|
|
|
98
103
|
}
|
|
99
104
|
|
|
100
105
|
:checked:hover + .switch {
|
|
101
|
-
background-color: var(--ring-main-hover-color);
|
|
106
|
+
--ring-toggle-background-color: var(--ring-main-hover-color);
|
|
102
107
|
}
|
|
103
108
|
|
|
104
109
|
.size16 {
|
|
105
110
|
& .switchWrapper {
|
|
106
111
|
width: calc(var(--ring-unit) * 3);
|
|
107
112
|
height: calc(var(--ring-unit) * 2);
|
|
108
|
-
|
|
109
|
-
vertical-align: -3px;
|
|
110
113
|
}
|
|
111
114
|
|
|
112
115
|
& .switch {
|
|
116
|
+
vertical-align: -3px;
|
|
117
|
+
|
|
113
118
|
border-radius: var(--ring-unit);
|
|
114
119
|
|
|
115
120
|
&::before {
|
|
@@ -130,11 +135,11 @@
|
|
|
130
135
|
& .switchWrapper {
|
|
131
136
|
width: calc(var(--ring-unit) * 3);
|
|
132
137
|
height: 14px;
|
|
133
|
-
|
|
134
|
-
vertical-align: -2px;
|
|
135
138
|
}
|
|
136
139
|
|
|
137
140
|
& .switch {
|
|
141
|
+
vertical-align: -2px;
|
|
142
|
+
|
|
138
143
|
border-radius: 7px;
|
|
139
144
|
|
|
140
145
|
&::before {
|
|
@@ -155,11 +160,11 @@
|
|
|
155
160
|
& .switchWrapper {
|
|
156
161
|
width: calc(var(--ring-unit) * 4);
|
|
157
162
|
height: calc(var(--ring-unit) * 2.5);
|
|
158
|
-
|
|
159
|
-
vertical-align: -5px;
|
|
160
163
|
}
|
|
161
164
|
|
|
162
165
|
& .switch {
|
|
166
|
+
vertical-align: -5px;
|
|
167
|
+
|
|
163
168
|
border-radius: calc(var(--ring-unit) * 1.25);
|
|
164
169
|
|
|
165
170
|
&::before {
|
|
@@ -188,11 +193,3 @@
|
|
|
188
193
|
--ring-toggle-border-color: var(--ring-border-disabled-color);
|
|
189
194
|
--ring-switch-border-color: var(--ring-border-disabled-color);
|
|
190
195
|
}
|
|
191
|
-
|
|
192
|
-
.paleSwitch.paleSwitch {
|
|
193
|
-
--ring-toggle-background-color: var(--ring-pale-control-color);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
.input:checked + .paleSwitch {
|
|
197
|
-
--ring-toggle-background-color: var(--ring-border-disabled-color);
|
|
198
|
-
}
|
|
@@ -10,9 +10,9 @@ export declare const Size: {
|
|
|
10
10
|
*/
|
|
11
11
|
export interface ToggleProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
|
|
12
12
|
size: string;
|
|
13
|
-
pale?: boolean | null | undefined;
|
|
14
13
|
leftLabel?: ReactNode;
|
|
15
14
|
'data-test'?: string | null | undefined;
|
|
15
|
+
help?: ReactNode;
|
|
16
16
|
}
|
|
17
17
|
declare class Toggle extends PureComponent<ToggleProps> {
|
|
18
18
|
static propTypes: {
|
|
@@ -24,7 +24,6 @@ declare class Toggle extends PureComponent<ToggleProps> {
|
|
|
24
24
|
defaultChecked: PropTypes.Requireable<boolean>;
|
|
25
25
|
checked: PropTypes.Requireable<boolean>;
|
|
26
26
|
disabled: PropTypes.Requireable<boolean>;
|
|
27
|
-
pale: PropTypes.Requireable<boolean>;
|
|
28
27
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
29
28
|
onTransitionEnd: PropTypes.Requireable<(...args: any[]) => any>;
|
|
30
29
|
size: PropTypes.Requireable<string>;
|
|
@@ -2,6 +2,7 @@ import { PureComponent } from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import dataTests from '../global/data-tests';
|
|
5
|
+
import ControlHelp from '../control-help/control-help';
|
|
5
6
|
import styles from './toggle.css';
|
|
6
7
|
export const Size = {
|
|
7
8
|
Size14: styles.size14,
|
|
@@ -18,7 +19,6 @@ class Toggle extends PureComponent {
|
|
|
18
19
|
defaultChecked: PropTypes.bool,
|
|
19
20
|
checked: PropTypes.bool,
|
|
20
21
|
disabled: PropTypes.bool,
|
|
21
|
-
pale: PropTypes.bool,
|
|
22
22
|
onChange: PropTypes.func,
|
|
23
23
|
onTransitionEnd: PropTypes.func,
|
|
24
24
|
size: PropTypes.oneOf(Object.values(Size)),
|
|
@@ -28,18 +28,23 @@ class Toggle extends PureComponent {
|
|
|
28
28
|
size: Size.Size14
|
|
29
29
|
};
|
|
30
30
|
render() {
|
|
31
|
-
const { className, children, disabled,
|
|
31
|
+
const { className, children, disabled, title, leftLabel, size = Size.Size16, 'data-test': dataTest, help, onTransitionEnd, ...restProps } = this.props;
|
|
32
32
|
const classes = classNames(className, size, styles.toggle, disabled && styles.disabled);
|
|
33
33
|
return (<label className={classes} title={title} data-test={dataTests('ring-toggle', dataTest)}>
|
|
34
|
-
{leftLabel && <span className={styles.leftLabel}>{leftLabel}
|
|
34
|
+
{leftLabel && (<span className={styles.leftLabel}>{leftLabel}
|
|
35
|
+
{help && <ControlHelp className={styles.help}>{help}</ControlHelp>}
|
|
36
|
+
</span>)}
|
|
35
37
|
|
|
36
38
|
<span className={styles.switchWrapper}>
|
|
37
39
|
<input data-test="ring-toggle-input" {...restProps} type="checkbox" disabled={disabled} className={styles.input}/>
|
|
38
40
|
|
|
39
|
-
<span className={
|
|
41
|
+
<span className={styles.switch} onTransitionEnd={onTransitionEnd}/>
|
|
40
42
|
</span>
|
|
41
43
|
|
|
42
|
-
{children && <
|
|
44
|
+
{children && (<div className={styles.label}>
|
|
45
|
+
{children}
|
|
46
|
+
{help && <ControlHelp className={styles.help}>{help}</ControlHelp>}
|
|
47
|
+
</div>)}
|
|
43
48
|
</label>);
|
|
44
49
|
}
|
|
45
50
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jetbrains/ring-ui",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.41",
|
|
4
4
|
"description": "JetBrains UI library",
|
|
5
5
|
"author": "JetBrains",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"apply-resolutions": "npx npm-force-resolutions@0.0.10",
|
|
35
|
-
"_postinstall": "husky
|
|
35
|
+
"_postinstall": "husky",
|
|
36
36
|
"prepare": "webpack -c .storybook/custom-header/webpack.config.js",
|
|
37
37
|
"prea11y-audit": "playwright install",
|
|
38
38
|
"a11y-audit": "test-storybook --url http://localhost:9999",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"@storybook/react-webpack5": "8.1.10",
|
|
99
99
|
"@storybook/test-runner": "^0.18.2",
|
|
100
100
|
"@storybook/theming": "8.1.10",
|
|
101
|
-
"@testing-library/dom": "^10.
|
|
101
|
+
"@testing-library/dom": "^10.3.1",
|
|
102
102
|
"@testing-library/react": "^16.0.0",
|
|
103
103
|
"@testing-library/user-event": "^14.5.2",
|
|
104
104
|
"@types/chai": "^4.3.16",
|
|
@@ -116,10 +116,10 @@
|
|
|
116
116
|
"@typescript-eslint/parser": "^7.15.0",
|
|
117
117
|
"@vitejs/plugin-react": "^4.3.1",
|
|
118
118
|
"@wojtekmaj/enzyme-adapter-react-17": "^0.8.0",
|
|
119
|
-
"acorn": "^8.12.
|
|
119
|
+
"acorn": "^8.12.1",
|
|
120
120
|
"axe-playwright": "^2.0.1",
|
|
121
121
|
"babel-plugin-require-context-hook": "^1.0.0",
|
|
122
|
-
"caniuse-lite": "^1.0.
|
|
122
|
+
"caniuse-lite": "^1.0.30001640",
|
|
123
123
|
"chai": "^5.1.1",
|
|
124
124
|
"chai-as-promised": "^8.0.0",
|
|
125
125
|
"chai-dom": "^1.10.0",
|