@jetbrains/ring-ui 6.0.40 → 6.0.42

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.
Files changed (34) hide show
  1. package/components/auth/down-notification.css +1 -1
  2. package/components/badge/badge.js +4 -0
  3. package/components/button/button.css +2 -2
  4. package/components/button/button.js +1 -1
  5. package/components/code/highlight.css +4 -4
  6. package/components/date-picker/date-input.d.ts +1 -1
  7. package/components/date-picker/date-input.js +10 -1
  8. package/components/date-picker/date-picker.css +2 -2
  9. package/components/editable-heading/editable-heading.css +1 -1
  10. package/components/error-bubble/error-bubble.css +5 -6
  11. package/components/form/form.css +2 -2
  12. package/components/global/variables.css +4 -3
  13. package/components/header/services.css +1 -1
  14. package/components/heading/heading.css +6 -0
  15. package/components/heading/heading.d.ts +7 -4
  16. package/components/heading/heading.js +18 -20
  17. package/components/island/island.css +1 -1
  18. package/components/island-legacy/island-legacy.css +1 -1
  19. package/components/query-assist/query-assist.css +1 -1
  20. package/components/sidebar/sidebar.css +1 -1
  21. package/components/tab-trap/tab-trap.js +5 -10
  22. package/components/table/table.css +2 -2
  23. package/components/table-legacy/table-legacy.css +2 -2
  24. package/components/tabs/tabs.css +6 -9
  25. package/components/tag/tag.css +6 -5
  26. package/components/tag/tag.js +5 -0
  27. package/components/text/text.css +7 -0
  28. package/components/text/text.d.ts +1 -0
  29. package/components/text/text.js +2 -1
  30. package/components/toggle/toggle.css +18 -21
  31. package/components/toggle/toggle.d.ts +1 -2
  32. package/components/toggle/toggle.js +10 -5
  33. package/components/user-card/user-card.css +1 -1
  34. package/package.json +19 -19
@@ -1,7 +1,7 @@
1
1
  @import "../global/variables.css";
2
2
 
3
3
  .title {
4
- font-weight: 600;
4
+ font-weight: var(--ring-font-weight-bold);
5
5
  }
6
6
 
7
7
  .error {
@@ -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,
@@ -365,9 +365,9 @@
365
365
  }
366
366
 
367
367
  .dropdownIcon {
368
- margin-right: -2px;
368
+ margin-right: -3px;
369
369
 
370
- margin-left: 2px;
370
+ margin-left: 3px;
371
371
 
372
372
  transition: color var(--ring-ease);
373
373
 
@@ -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-10px';
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
  }
@@ -43,6 +43,6 @@ export default class DateInput extends React.PureComponent<DateInputProps> {
43
43
  inputRef: (el: HTMLInputElement | null) => void;
44
44
  updateInput({ text, active }: UpdateInputConfig): void;
45
45
  handleChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
46
- handleKeyDown: (e: React.KeyboardEvent) => false | void;
46
+ handleKeyDown: (e: React.KeyboardEvent) => void;
47
47
  render(): React.JSX.Element;
48
48
  }
@@ -56,7 +56,16 @@ export default class DateInput extends React.PureComponent {
56
56
  }
57
57
  }
58
58
  handleChange = (e) => this.props.onInput(e.currentTarget.value, e.currentTarget.dataset.name);
59
- handleKeyDown = (e) => e.key === 'Enter' && this.props.onConfirm();
59
+ handleKeyDown = (e) => {
60
+ if (e.key === 'Enter') {
61
+ // We have to prevent the default behavior, because restoring focus by TabTrap caused by
62
+ // pressing Enter will trigger the onClick event on the DatePicker Dropdown anchor,
63
+ // so DatePicker will be open again.
64
+ // https://youtrack.jetbrains.com/issue/RG-2450/Anchor-should-be-focused-after-closing-datepicker#focus=Comments-27-10044234.0-0.
65
+ e.preventDefault();
66
+ this.props.onConfirm();
67
+ }
68
+ };
60
69
  render() {
61
70
  const { active, divider, text, time, name, hoverDate, date, displayFormat, translations, onActivate, onClear, fromPlaceholder, toPlaceholder, timePlaceholder, locale } = this.props;
62
71
  const { translate } = this.context;
@@ -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 {
@@ -101,7 +101,7 @@
101
101
  background-color: transparent;
102
102
 
103
103
  font-family: var(--ring-font-family);
104
- font-weight: bold;
104
+ font-weight: var(--ring-font-weight-bold);
105
105
  line-height: 28px;
106
106
 
107
107
  &::placeholder {
@@ -16,9 +16,8 @@
16
16
 
17
17
  .errorBubble {
18
18
  box-sizing: border-box;
19
- min-height: calc(var(--ring-unit) * 3);
20
- padding-right: calc(var(--ring-unit) * 2);
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: 12px;
34
- line-height: 22px;
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;
@@ -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: 15px;
147
+ --ring-font-size-larger: 16px;
148
148
  --ring-font-size: 14px;
149
149
  --ring-font-size-smaller: 12px;
150
- --ring-line-height-taller: 21px;
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
 
@@ -10,7 +10,7 @@
10
10
  }
11
11
 
12
12
  .active {
13
- font-weight: bold;
13
+ font-weight: var(--ring-font-weight-bold);
14
14
  }
15
15
 
16
16
  .item {
@@ -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: ComponentType<H1Props>;
22
- declare const H2: ComponentType<HTMLAttributes<HTMLHeadingElement>>;
23
- declare const H3: ComponentType<HTMLAttributes<HTMLHeadingElement>>;
24
- declare const H4: ComponentType<HTMLAttributes<HTMLHeadingElement>>;
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
- function makeHeading(level, useCaps) {
33
- const H = memo(({ className, caps, ...restProps }) => {
34
- const classes = classNames(className, {
35
- [styles.caps]: useCaps && caps
36
- });
37
- return (<Heading {...restProps} level={level} className={classes}/>);
38
- });
39
- H.displayName = `H${level}`;
40
- H.propTypes = {
41
- children: PropTypes.node,
42
- className: PropTypes.string,
43
- // use only for short h1 headers, no longer than three words
44
- caps: PropTypes.bool
45
- };
46
- return H;
47
- }
48
- const H1 = makeHeading(Levels.H1, true);
49
- const H2 = makeHeading(Levels.H2);
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 };
@@ -51,7 +51,7 @@
51
51
 
52
52
  font-size: inherit;
53
53
 
54
- font-weight: bold;
54
+ font-weight: var(--ring-font-weight-bold);
55
55
  }
56
56
 
57
57
  .narrowIsland .header {
@@ -90,7 +90,7 @@
90
90
 
91
91
  padding: 0 calc(var(--ring-unit) * 4);
92
92
 
93
- font-weight: bold;
93
+ font-weight: var(--ring-font-weight-bold);
94
94
  }
95
95
 
96
96
  :global(.ring-island__content) {
@@ -131,7 +131,7 @@
131
131
  }
132
132
 
133
133
  .highlight {
134
- font-weight: 600;
134
+ font-weight: var(--ring-font-weight-bold);
135
135
  }
136
136
 
137
137
  .service {
@@ -98,7 +98,7 @@
98
98
  color: var(--ring-text-color);
99
99
 
100
100
  font-size: var(--ring-font-size);
101
- font-weight: bold;
101
+ font-weight: var(--ring-font-weight-bold);
102
102
  }
103
103
 
104
104
  :global(.ring-sidebar__section-text) {
@@ -55,16 +55,11 @@ const TabTrap = forwardRef(function TabTrap({ children, trapDisabled = false, au
55
55
  if (previousFocusedNode instanceof HTMLElement &&
56
56
  previousFocusedNode.focus &&
57
57
  isNodeInVisiblePartOfPage(previousFocusedNode)) {
58
- // If no delay is added, restoring focus caused by pressing Enter will trigger
59
- // the onClick event on the previousFocusedNode, e.g.
60
- // https://youtrack.jetbrains.com/issue/RG-2450/Anchor-should-be-focused-after-closing-datepicker#focus=Comments-27-10044234.0-0.
61
- setTimeout(() => {
62
- // This is to prevent the focus from being restored the first time
63
- // componentWillUnmount is called in StrictMode.
64
- if (!mountedRef.current) {
65
- previousFocusedNode.focus({ preventScroll: true });
66
- }
67
- });
58
+ // This is to prevent the focus from being restored the first time
59
+ // componentWillUnmount is called in StrictMode.
60
+ if (!mountedRef.current) {
61
+ previousFocusedNode.focus({ preventScroll: true });
62
+ }
68
63
  }
69
64
  }
70
65
  function focusElement(first = true) {
@@ -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) {
@@ -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 {
@@ -37,7 +37,7 @@
37
37
  }
38
38
 
39
39
  .withRemove {
40
- padding-right: 22px;
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: 0;
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: 6px;
143
+ margin-right: 5px;
144
+ margin-left: -3px;
144
145
 
145
146
  color: var(--ring-icon-secondary-color);
146
147
 
147
- & svg {
148
- vertical-align: -3px;
148
+ && svg {
149
+ vertical-align: -3.5px;
149
150
  }
150
151
  }
151
152
 
@@ -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,
@@ -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
+ }
@@ -5,6 +5,7 @@ export interface TextProps extends HTMLAttributes<HTMLElement> {
5
5
  info?: boolean | null | undefined;
6
6
  size?: TextSize;
7
7
  'data-test'?: string | null | undefined;
8
+ bold?: boolean | null | undefined;
8
9
  }
9
10
  declare const TextSize: Record<string, TextSize>;
10
11
  /**
@@ -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
- transition: none;
14
+ --ring-toggle-background-color: var(--ring-border-hover-color);
12
15
 
13
- background-color: var(--ring-border-hover-color);
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-icon-color);
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, pale, title, leftLabel, size = Size.Size16, 'data-test': dataTest, onTransitionEnd, ...restProps } = this.props;
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}</span>}
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={classNames(styles.switch, pale && styles.paleSwitch)} onTransitionEnd={onTransitionEnd}/>
41
+ <span className={styles.switch} onTransitionEnd={onTransitionEnd}/>
40
42
  </span>
41
43
 
42
- {children && <span className={styles.label}>{children}</span>}
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
  }
@@ -49,7 +49,7 @@
49
49
  margin-right: 4px;
50
50
 
51
51
  font-size: 16px;
52
- font-weight: 600;
52
+ font-weight: var(--ring-font-weight-bold);
53
53
  }
54
54
 
55
55
  .userLogin {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetbrains/ring-ui",
3
- "version": "6.0.40",
3
+ "version": "6.0.42",
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 install",
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",
@@ -88,17 +88,17 @@
88
88
  "@rollup/plugin-json": "^6.1.0",
89
89
  "@rollup/plugin-node-resolve": "^15.2.3",
90
90
  "@rollup/plugin-replace": "^5.0.7",
91
- "@storybook/addon-a11y": "8.1.10",
92
- "@storybook/addon-docs": "8.1.10",
93
- "@storybook/addon-essentials": "8.1.10",
94
- "@storybook/components": "8.1.10",
95
- "@storybook/manager-api": "8.1.10",
96
- "@storybook/preview-api": "8.1.10",
97
- "@storybook/react": "8.1.10",
98
- "@storybook/react-webpack5": "8.1.10",
99
- "@storybook/test-runner": "^0.18.2",
100
- "@storybook/theming": "8.1.10",
101
- "@testing-library/dom": "^10.2.0",
91
+ "@storybook/addon-a11y": "8.1.11",
92
+ "@storybook/addon-docs": "8.1.11",
93
+ "@storybook/addon-essentials": "8.1.11",
94
+ "@storybook/components": "8.1.11",
95
+ "@storybook/manager-api": "8.1.11",
96
+ "@storybook/preview-api": "8.1.11",
97
+ "@storybook/react": "8.1.11",
98
+ "@storybook/react-webpack5": "8.1.11",
99
+ "@storybook/test-runner": "^0.19.0",
100
+ "@storybook/theming": "8.1.11",
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.0",
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.30001639",
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",
@@ -137,7 +137,7 @@
137
137
  "eslint-plugin-react-hooks": "^4.6.2",
138
138
  "eslint-plugin-storybook": "^0.8.0",
139
139
  "events": "^3.3.0",
140
- "glob": "^10.4.2",
140
+ "glob": "^10.4.3",
141
141
  "html-webpack-plugin": "^5.6.0",
142
142
  "http-server": "^14.1.1",
143
143
  "husky": "^9.0.11",
@@ -155,14 +155,14 @@
155
155
  "react-dom": "^18.3.1",
156
156
  "react-test-renderer": "^18.3.1",
157
157
  "regenerator-runtime": "^0.14.1",
158
- "rimraf": "^5.0.7",
158
+ "rimraf": "^5.0.8",
159
159
  "rollup": "^4.18.0",
160
160
  "rollup-plugin-clear": "^2.0.7",
161
161
  "rollup-plugin-styles": "^4.0.0",
162
162
  "sinon": "^18.0.0",
163
163
  "sinon-chai": "^3.7.0",
164
164
  "storage-mock": "^2.1.0",
165
- "storybook": "8.1.10",
165
+ "storybook": "8.1.11",
166
166
  "storybook-addon-themes": "^6.1.0",
167
167
  "stylelint": "^16.6.1",
168
168
  "svg-inline-loader": "^0.8.2",
@@ -232,7 +232,7 @@
232
232
  "postcss-font-family-system-ui": "^5.0.0",
233
233
  "postcss-loader": "^8.1.1",
234
234
  "postcss-modules-values-replace": "^4.2.0",
235
- "postcss-preset-env": "^9.5.15",
235
+ "postcss-preset-env": "^9.6.0",
236
236
  "prop-types": "^15.8.1",
237
237
  "react-movable": "^3.2.0",
238
238
  "react-virtualized": "^9.22.5",