@jetbrains/ring-ui 6.0.39 → 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/checkbox/checkbox.d.ts +1 -0
- package/components/checkbox/checkbox.js +3 -2
- 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/composeRefs.d.ts +3 -1
- package/components/global/composeRefs.js +4 -1
- package/components/global/focus-sensor-hoc.js +3 -2
- package/components/global/rerender-hoc.js +3 -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/select/select.d.ts +1 -0
- package/components/select/select.js +3 -2
- package/components/select/select__popup.d.ts +1 -0
- package/components/select/select__popup.js +3 -2
- package/components/sidebar/sidebar.css +1 -1
- package/components/tab-trap/tab-trap.d.ts +9 -36
- package/components/tab-trap/tab-trap.js +92 -97
- package/components/table/row.d.ts +1 -0
- package/components/table/row.js +3 -2
- 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 +6 -6
|
@@ -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';
|
|
@@ -42,5 +42,6 @@ export default class Checkbox extends PureComponent<CheckboxProps> {
|
|
|
42
42
|
componentDidUpdate(prevProps: CheckboxProps): void;
|
|
43
43
|
input?: HTMLInputElement | null;
|
|
44
44
|
inputRef: (el: HTMLInputElement | null) => void;
|
|
45
|
+
composedInputRef: import("memoize-one").MemoizedFn<(...refs: (Ref<HTMLInputElement> | undefined)[]) => (value: HTMLInputElement | null) => void>;
|
|
45
46
|
render(): import("react").JSX.Element;
|
|
46
47
|
}
|
|
@@ -5,7 +5,7 @@ import checkmarkIcon from '@jetbrains/icons/checkmark-12px';
|
|
|
5
5
|
import minusIcon from '@jetbrains/icons/remove-12px';
|
|
6
6
|
import Icon from '../icon/icon';
|
|
7
7
|
import { refObject } from '../global/prop-types';
|
|
8
|
-
import
|
|
8
|
+
import { createComposedRef } from '../global/composeRefs';
|
|
9
9
|
import ControlHelp from '../control-help/control-help';
|
|
10
10
|
import styles from './checkbox.css';
|
|
11
11
|
/**
|
|
@@ -55,6 +55,7 @@ export default class Checkbox extends PureComponent {
|
|
|
55
55
|
}
|
|
56
56
|
this.input = el;
|
|
57
57
|
};
|
|
58
|
+
composedInputRef = createComposedRef();
|
|
58
59
|
render() {
|
|
59
60
|
const { children, label, className, containerClassName, containerStyle, cellClassName, labelClassName, indeterminate, inputRef, help, ...restProps } = this.props;
|
|
60
61
|
const classes = classNames(styles.input, className);
|
|
@@ -62,7 +63,7 @@ export default class Checkbox extends PureComponent {
|
|
|
62
63
|
const cellClasses = classNames(styles.cell, cellClassName);
|
|
63
64
|
const labelClasses = classNames(styles.label, labelClassName);
|
|
64
65
|
return (<label className={containerClasses} style={containerStyle} data-test="ring-checkbox">
|
|
65
|
-
<input {...restProps} data-checked={restProps.checked} ref={
|
|
66
|
+
<input {...restProps} data-checked={restProps.checked} ref={this.composedInputRef(this.inputRef, inputRef)} type="checkbox" className={classes}/>
|
|
66
67
|
<div className={styles.cellWrapper}>
|
|
67
68
|
<span className={cellClasses}>
|
|
68
69
|
<Icon glyph={checkmarkIcon} className={styles.check}/>
|
|
@@ -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) {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { Ref } from 'react';
|
|
2
|
-
|
|
2
|
+
declare function composeRefs<T>(...refs: (Ref<T> | undefined)[]): (value: T | null) => void;
|
|
3
|
+
declare const _default: typeof composeRefs;
|
|
4
|
+
export default _default;
|
|
3
5
|
export declare function createComposedRef<T>(): import("memoize-one").MemoizedFn<(...refs: (Ref<T> | undefined)[]) => (value: T | null) => void>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import memoizeOne from 'memoize-one';
|
|
2
|
-
|
|
2
|
+
import deprecate from 'util-deprecate';
|
|
3
|
+
function composeRefs(...refs) {
|
|
3
4
|
return (value) => refs.forEach(ref => {
|
|
4
5
|
if (typeof ref === 'function') {
|
|
5
6
|
ref(value);
|
|
@@ -9,6 +10,8 @@ export default function composeRefs(...refs) {
|
|
|
9
10
|
}
|
|
10
11
|
});
|
|
11
12
|
}
|
|
13
|
+
// TODO remove export in 7.0, composeRefs should be used only in createComposedRef and in useComposedRefs in the future
|
|
14
|
+
export default deprecate(composeRefs, 'composeRefs is deprecated and will be removed in 7.0. Use createComposedRef instead.');
|
|
12
15
|
export function createComposedRef() {
|
|
13
16
|
return memoizeOne((composeRefs));
|
|
14
17
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Component } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { refObject } from './prop-types';
|
|
4
|
-
import
|
|
4
|
+
import { createComposedRef } from './composeRefs';
|
|
5
5
|
function extractPropTypes({ propTypes }) {
|
|
6
6
|
if (propTypes == null) {
|
|
7
7
|
return propTypes;
|
|
@@ -46,6 +46,7 @@ export default function focusSensorHOC(ComposedComponent) {
|
|
|
46
46
|
this.node = node;
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
+
composedRef = createComposedRef();
|
|
49
50
|
onFocusCapture = ({ target }) => {
|
|
50
51
|
if (this._skipNextCapture) {
|
|
51
52
|
this._skipNextCapture = false;
|
|
@@ -79,7 +80,7 @@ export default function focusSensorHOC(ComposedComponent) {
|
|
|
79
80
|
};
|
|
80
81
|
render() {
|
|
81
82
|
const { autofocus, focused, onFocus, onBlur, innerRef, scrollOnTableFocus, ...rest } = this.props;
|
|
82
|
-
return (<ComposedComponent {...rest} innerRef={
|
|
83
|
+
return (<ComposedComponent {...rest} innerRef={this.composedRef(innerRef, this.onRefUpdate)} focused={this.state.focused} onFocusReset={this.onFocusReset} onFocusRestore={this.onFocusRestore}/>);
|
|
83
84
|
}
|
|
84
85
|
}
|
|
85
86
|
FocusSensor.propTypes = {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Component, forwardRef } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { createComposedRef } from './composeRefs';
|
|
3
3
|
export default function rerenderHOC(ComposedComponent) {
|
|
4
4
|
class Rerenderer extends Component {
|
|
5
5
|
state = this.props.props;
|
|
6
|
+
composedRef = createComposedRef();
|
|
6
7
|
render() {
|
|
7
|
-
const ref =
|
|
8
|
+
const ref = this.composedRef(this.props.forwardedRef);
|
|
8
9
|
return (<ComposedComponent {...this.state} ref={instance => ref(instance != null ? { ...instance, rerender: this.setState.bind(this) } : null)}/>);
|
|
9
10
|
}
|
|
10
11
|
}
|
|
@@ -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 };
|
|
@@ -259,6 +259,7 @@ export default class Select<T = unknown> extends Component<SelectProps<T>, Selec
|
|
|
259
259
|
private _getAvatar;
|
|
260
260
|
filter?: HTMLInputElement | null;
|
|
261
261
|
filterRef: (el: HTMLInputElement | null) => void;
|
|
262
|
+
composedFilterRef: import("memoize-one").MemoizedFn<(...refs: (Ref<HTMLInputElement> | undefined)[]) => (value: HTMLInputElement | null) => void>;
|
|
262
263
|
getShortcutsMap(): {
|
|
263
264
|
enter: () => true | undefined;
|
|
264
265
|
esc: (event: KeyboardEvent) => boolean | undefined;
|
|
@@ -19,7 +19,7 @@ import rerenderHOC from '../global/rerender-hoc';
|
|
|
19
19
|
import fuzzyHighlight from '../global/fuzzy-highlight';
|
|
20
20
|
import memoize from '../global/memoize';
|
|
21
21
|
import { I18nContext } from '../i18n/i18n-context';
|
|
22
|
-
import
|
|
22
|
+
import { createComposedRef } from '../global/composeRefs';
|
|
23
23
|
import { refObject } from '../global/prop-types';
|
|
24
24
|
import { isArray } from '../global/typescript-utils';
|
|
25
25
|
import { ControlsHeight, ControlsHeightContext } from '../global/controls-height';
|
|
@@ -777,6 +777,7 @@ export default class Select extends Component {
|
|
|
777
777
|
filterRef = (el) => {
|
|
778
778
|
this.filter = el;
|
|
779
779
|
};
|
|
780
|
+
composedFilterRef = createComposedRef();
|
|
780
781
|
getShortcutsMap() {
|
|
781
782
|
return {
|
|
782
783
|
enter: this._onEnter,
|
|
@@ -815,7 +816,7 @@ export default class Select extends Component {
|
|
|
815
816
|
case Type.INPUT: return (<>
|
|
816
817
|
<div ref={this.nodeRef} className={classNames(classes, styles.inputMode)} data-test={dataTests('ring-select', dataTest)}>
|
|
817
818
|
{shortcutsEnabled && (<Shortcuts map={this.getShortcutsMap()} scope={this.shortcutsScope}/>)}
|
|
818
|
-
<Input {...ariaProps} height={this.props.height} autoComplete="off" id={this.props.id} onClick={this._clickHandler} inputRef={
|
|
819
|
+
<Input {...ariaProps} height={this.props.height} autoComplete="off" id={this.props.id} onClick={this._clickHandler} inputRef={this.composedFilterRef(this.filterRef, this.props.filterRef)} disabled={this.props.disabled} value={this.state.filterValue} borderless={this.props.type === Type.INPUT_WITHOUT_CONTROLS} style={style} size={Size.FULL} onChange={this._filterChangeHandler} onFocus={this._focusHandler} onBlur={this._blurHandler}
|
|
819
820
|
// Input with error style without description
|
|
820
821
|
error={this.props.error != null ? '' : null} label={this.props.type === Type.INPUT ? this._getLabel() : null} placeholder={this.props.inputPlaceholder} onKeyDown={this.props.onKeyDown} data-test="ring-select__focus" enableShortcuts={shortcutsEnabled
|
|
821
822
|
? Object.keys({
|
|
@@ -126,6 +126,7 @@ export default class SelectPopup<T = unknown> extends PureComponent<SelectPopupP
|
|
|
126
126
|
list?: List<T> | null;
|
|
127
127
|
listRef: (el: List<T> | null) => void;
|
|
128
128
|
filterRef: (el: HTMLInputElement | null) => void;
|
|
129
|
+
composedFilterRef: import("memoize-one").MemoizedFn<(...refs: (Ref<HTMLInputElement> | undefined)[]) => (value: HTMLInputElement | null) => void>;
|
|
129
130
|
shortcutsScope: string;
|
|
130
131
|
shortcutsMap: {
|
|
131
132
|
tab: (event: Event) => void;
|
|
@@ -24,7 +24,7 @@ import Button from '../button/button';
|
|
|
24
24
|
import Text from '../text/text';
|
|
25
25
|
import { ControlsHeight } from '../global/controls-height';
|
|
26
26
|
import { refObject } from '../global/prop-types';
|
|
27
|
-
import
|
|
27
|
+
import { createComposedRef } from '../global/composeRefs';
|
|
28
28
|
import { DEFAULT_DIRECTIONS } from '../popup/popup.consts';
|
|
29
29
|
import SelectFilter from './select__filter';
|
|
30
30
|
import styles from './select-popup.css';
|
|
@@ -186,7 +186,7 @@ export default class SelectPopup extends PureComponent {
|
|
|
186
186
|
if (this.props.filter || this.props.tags) {
|
|
187
187
|
return (<div className={styles.filterWrapper} data-test="ring-select-popup-filter">
|
|
188
188
|
{!this.props.tags && (<Icon glyph={this.props.filterIcon ?? searchIcon} className={styles.filterIcon} data-test-custom="ring-select-popup-filter-icon"/>)}
|
|
189
|
-
<FilterWithShortcuts rgShortcutsOptions={this.state.popupFilterShortcutsOptions} rgShortcutsMap={this.popupFilterShortcutsMap} value={this.props.filterValue} inputRef={
|
|
189
|
+
<FilterWithShortcuts rgShortcutsOptions={this.state.popupFilterShortcutsOptions} rgShortcutsMap={this.popupFilterShortcutsMap} value={this.props.filterValue} inputRef={this.composedFilterRef(this.filterRef, this.props.filterRef)} onBlur={this.popupFilterOnBlur} onFocus={this.onFilterFocus} className="ring-js-shortcuts" inputClassName={classNames({ [styles.filterWithTagsInput]: this.props.tags })} placeholder={typeof this.props.filter === 'object'
|
|
190
190
|
? this.props.filter.placeholder
|
|
191
191
|
: undefined} height={this.props.tags ? ControlsHeight.S : ControlsHeight.L} onChange={this.props.onFilter} onClick={this.onClickHandler} onClear={this.props.tags ? undefined : this.props.onClear} data-test-custom="ring-select-popup-filter-input" listId={this.props.listId} enableShortcuts={Object.keys(this.popupFilterShortcutsMap)}/>
|
|
192
192
|
</div>);
|
|
@@ -309,6 +309,7 @@ export default class SelectPopup extends PureComponent {
|
|
|
309
309
|
this.filter = el;
|
|
310
310
|
this.caret = el && new Caret(el);
|
|
311
311
|
};
|
|
312
|
+
composedFilterRef = createComposedRef();
|
|
312
313
|
shortcutsScope = getUID('select-popup-');
|
|
313
314
|
shortcutsMap = {
|
|
314
315
|
tab: this.tabPress
|
|
@@ -1,45 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
3
|
export declare const FOCUSABLE_ELEMENTS = "input, button, select, textarea, a[href], *[tabindex]:not([data-trap-button]):not([data-scrollable-container])";
|
|
5
4
|
export interface TabTrapProps extends HTMLAttributes<HTMLElement> {
|
|
6
5
|
children: ReactNode;
|
|
7
|
-
trapDisabled
|
|
8
|
-
autoFocusFirst
|
|
9
|
-
focusBackOnClose
|
|
10
|
-
focusBackOnExit
|
|
6
|
+
trapDisabled?: boolean;
|
|
7
|
+
autoFocusFirst?: boolean;
|
|
8
|
+
focusBackOnClose?: boolean;
|
|
9
|
+
focusBackOnExit?: boolean;
|
|
11
10
|
}
|
|
12
11
|
/**
|
|
13
12
|
* @name TabTrap
|
|
14
13
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
|
|
18
|
-
trapDisabled: PropTypes.Requireable<boolean>;
|
|
19
|
-
autoFocusFirst: PropTypes.Requireable<boolean>;
|
|
20
|
-
focusBackOnClose: PropTypes.Requireable<boolean>;
|
|
21
|
-
focusBackOnExit: PropTypes.Requireable<boolean>;
|
|
22
|
-
};
|
|
23
|
-
static defaultProps: {
|
|
24
|
-
trapDisabled: boolean;
|
|
25
|
-
autoFocusFirst: boolean;
|
|
26
|
-
focusBackOnClose: boolean;
|
|
27
|
-
focusBackOnExit: boolean;
|
|
28
|
-
};
|
|
29
|
-
constructor(props: TabTrapProps);
|
|
30
|
-
componentDidMount(): void;
|
|
31
|
-
componentWillUnmount(): void;
|
|
32
|
-
previousFocusedNode?: Element | null;
|
|
33
|
-
trapWithoutFocus?: boolean;
|
|
34
|
-
restoreFocus: () => void;
|
|
35
|
-
node?: HTMLElement | null;
|
|
36
|
-
containerRef: (node: HTMLElement | null) => void;
|
|
37
|
-
focusElement: (first?: boolean) => void;
|
|
38
|
-
focusFirst: () => void;
|
|
39
|
-
focusLast: () => void;
|
|
40
|
-
focusLastIfEnabled: (event: React.FocusEvent) => void;
|
|
41
|
-
handleBlurIfWithoutFocus: (event: React.FocusEvent) => void;
|
|
42
|
-
trapButtonNode?: HTMLElement | null;
|
|
43
|
-
trapButtonRef: (node: HTMLElement | null) => void;
|
|
44
|
-
render(): React.JSX.Element;
|
|
14
|
+
interface TabTrap {
|
|
15
|
+
node: HTMLElement | null;
|
|
45
16
|
}
|
|
17
|
+
declare const TabTrap: React.ForwardRefExoticComponent<TabTrapProps & React.RefAttributes<TabTrap>>;
|
|
18
|
+
export default TabTrap;
|