@jetbrains/ring-ui 5.0.31 → 5.0.33
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/dialog/dialog.css +8 -0
- package/components/dialog/dialog.d.ts +1 -0
- package/components/dialog/dialog.js +2 -2
- package/components/input-size/input-size.examples.js +5 -4
- package/components/query-assist/query-assist.css +0 -2
- package/components/query-assist/query-assist.d.ts +4 -0
- package/components/query-assist/query-assist.js +11 -8
- package/components/tags-input/tags-input.css +39 -49
- package/components/tags-input/tags-input.d.ts +9 -4
- package/components/tags-input/tags-input.js +16 -11
- package/dist/_helpers/dialog__body-scroll-preventer.js +1 -1
- package/dist/dialog/dialog.d.ts +1 -0
- package/dist/dialog/dialog.js +4 -1
- package/dist/query-assist/query-assist.d.ts +4 -0
- package/dist/query-assist/query-assist.js +12 -6
- package/dist/query-assist-ng/query-assist-ng.js +3 -0
- package/dist/style.css +1 -1
- package/dist/tags-input/tags-input.d.ts +9 -4
- package/dist/tags-input/tags-input.js +27 -21
- package/package.json +12 -12
|
@@ -15,6 +15,7 @@ export interface DialogProps extends Partial<TabTrapProps> {
|
|
|
15
15
|
contentClassName?: string | null | undefined;
|
|
16
16
|
portalTarget?: Element | null | undefined;
|
|
17
17
|
'data-test'?: string | null | undefined;
|
|
18
|
+
dense?: boolean | null | undefined;
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
20
21
|
* @name Dialog
|
|
@@ -100,7 +100,7 @@ export default class Dialog extends PureComponent {
|
|
|
100
100
|
this.dialog = tabTrap && tabTrap.node;
|
|
101
101
|
};
|
|
102
102
|
render() {
|
|
103
|
-
const { show, showCloseButton, onOverlayClick, onCloseAttempt, onEscPress, onCloseClick, children, className, contentClassName, trapFocus, 'data-test': dataTest, closeButtonInside, portalTarget, label, closeButtonTitle, ...restProps } = this.props;
|
|
103
|
+
const { show, showCloseButton, onOverlayClick, onCloseAttempt, onEscPress, onCloseClick, children, className, contentClassName, trapFocus, 'data-test': dataTest, closeButtonInside, portalTarget, label, closeButtonTitle, dense, ...restProps } = this.props;
|
|
104
104
|
const classes = classNames(styles.container, className);
|
|
105
105
|
const shortcutsMap = this.getShortcutsMap();
|
|
106
106
|
return show && createPortal(<PopupTarget id={this.uid} className={styles.popupTarget}>
|
|
@@ -110,7 +110,7 @@ export default class Dialog extends PureComponent {
|
|
|
110
110
|
// click handler is duplicated in close button
|
|
111
111
|
role="presentation" className={styles.clickableOverlay} onClick={this.handleClick}/>)}
|
|
112
112
|
<div className={styles.innerContainer}>
|
|
113
|
-
<AdaptiveIsland className={classNames(styles.content, contentClassName)} data-test="ring-dialog" role="dialog" aria-label={label}>
|
|
113
|
+
<AdaptiveIsland className={classNames(styles.content, contentClassName, { [styles.dense]: dense })} data-test="ring-dialog" role="dialog" aria-label={label}>
|
|
114
114
|
{children}
|
|
115
115
|
{showCloseButton &&
|
|
116
116
|
(<Button icon={closeIcon} data-test="ring-dialog-close-button" className={classNames(styles.closeButton, {
|
|
@@ -28,7 +28,7 @@ export const basic = () => {
|
|
|
28
28
|
<div class="example-block">
|
|
29
29
|
<div class="ring-error-bubble-wrapper">
|
|
30
30
|
<rg-query-assist
|
|
31
|
-
|
|
31
|
+
size="'S'"
|
|
32
32
|
x-data-source="exampleCtrl.dataSource"
|
|
33
33
|
glass="true"
|
|
34
34
|
placeholder="'Extra-short'">
|
|
@@ -37,7 +37,7 @@ export const basic = () => {
|
|
|
37
37
|
</div>
|
|
38
38
|
<div class="ring-error-bubble-wrapper">
|
|
39
39
|
<rg-query-assist
|
|
40
|
-
|
|
40
|
+
size="'S'"
|
|
41
41
|
x-data-source="exampleCtrl.dataSource"
|
|
42
42
|
glass="true"
|
|
43
43
|
placeholder="'Short'">
|
|
@@ -46,7 +46,7 @@ export const basic = () => {
|
|
|
46
46
|
</div>
|
|
47
47
|
<div class="ring-error-bubble-wrapper">
|
|
48
48
|
<rg-query-assist
|
|
49
|
-
|
|
49
|
+
size="'M'"
|
|
50
50
|
x-data-source="exampleCtrl.dataSource"
|
|
51
51
|
glass="true"
|
|
52
52
|
placeholder="'Medium'">
|
|
@@ -55,7 +55,7 @@ export const basic = () => {
|
|
|
55
55
|
</div>
|
|
56
56
|
<div class="ring-error-bubble-wrapper">
|
|
57
57
|
<rg-query-assist
|
|
58
|
-
|
|
58
|
+
size="'L'"
|
|
59
59
|
x-data-source="exampleCtrl.dataSource"
|
|
60
60
|
glass="true"
|
|
61
61
|
placeholder="'Long'">
|
|
@@ -64,6 +64,7 @@ export const basic = () => {
|
|
|
64
64
|
</div>
|
|
65
65
|
<div class="ring-error-bubble-wrapper">
|
|
66
66
|
<rg-query-assist
|
|
67
|
+
size="'FULL'"
|
|
67
68
|
x-data-source="exampleCtrl.dataSource"
|
|
68
69
|
glass="true"
|
|
69
70
|
placeholder="'Full-width'">
|
|
@@ -4,6 +4,7 @@ import Caret, { Position } from '../caret/caret';
|
|
|
4
4
|
import PopupMenu from '../popup-menu/popup-menu';
|
|
5
5
|
import Button from '../button/button';
|
|
6
6
|
import Icon from '../icon/icon';
|
|
7
|
+
import { Size } from '../input/input';
|
|
7
8
|
import { ShortcutsMap } from '../shortcuts/core';
|
|
8
9
|
import { QueryAssistSuggestion, SuggestionItem } from './query-assist__suggestions';
|
|
9
10
|
declare function noop(): void;
|
|
@@ -59,6 +60,7 @@ export interface QueryAssistProps {
|
|
|
59
60
|
actions?: ReactNode[] | null | undefined;
|
|
60
61
|
'data-test'?: string | null | undefined;
|
|
61
62
|
huge?: boolean | null | undefined;
|
|
63
|
+
size: Size;
|
|
62
64
|
}
|
|
63
65
|
export interface StyleRange {
|
|
64
66
|
style: string;
|
|
@@ -210,6 +212,7 @@ export default class QueryAssist extends Component<QueryAssistProps> {
|
|
|
210
212
|
actions: PropTypes.Requireable<any[]>;
|
|
211
213
|
'data-test': PropTypes.Requireable<string>;
|
|
212
214
|
huge: PropTypes.Requireable<boolean>;
|
|
215
|
+
size: PropTypes.Requireable<string>;
|
|
213
216
|
};
|
|
214
217
|
static defaultProps: {
|
|
215
218
|
onApply: typeof noop;
|
|
@@ -217,6 +220,7 @@ export default class QueryAssist extends Component<QueryAssistProps> {
|
|
|
217
220
|
onApplySuggestion: typeof noop;
|
|
218
221
|
onClear: typeof noop;
|
|
219
222
|
onFocusChange: typeof noop;
|
|
223
|
+
size: Size;
|
|
220
224
|
translations: {
|
|
221
225
|
searchTitle: string;
|
|
222
226
|
clearTitle: string;
|
|
@@ -17,6 +17,8 @@ import rerenderHOC from '../global/rerender-hoc';
|
|
|
17
17
|
import Button from '../button/button';
|
|
18
18
|
import Icon from '../icon/icon';
|
|
19
19
|
import { ControlsHeight, ControlsHeightContext } from '../global/controls-height';
|
|
20
|
+
import { Size } from '../input/input';
|
|
21
|
+
import inputStyles from '../input/input.css';
|
|
20
22
|
import QueryAssistSuggestions from './query-assist__suggestions';
|
|
21
23
|
import styles from './query-assist.css';
|
|
22
24
|
const POPUP_COMPENSATION = PopupMenu.ListProps.Dimension.ITEM_PADDING +
|
|
@@ -151,7 +153,8 @@ export default class QueryAssist extends Component {
|
|
|
151
153
|
translations: PropTypes.object,
|
|
152
154
|
actions: PropTypes.array,
|
|
153
155
|
'data-test': PropTypes.string,
|
|
154
|
-
huge: PropTypes.bool
|
|
156
|
+
huge: PropTypes.bool,
|
|
157
|
+
size: PropTypes.string
|
|
155
158
|
};
|
|
156
159
|
static defaultProps = {
|
|
157
160
|
onApply: noop,
|
|
@@ -159,6 +162,7 @@ export default class QueryAssist extends Component {
|
|
|
159
162
|
onApplySuggestion: noop,
|
|
160
163
|
onClear: noop,
|
|
161
164
|
onFocusChange: noop,
|
|
165
|
+
size: Size.L,
|
|
162
166
|
translations: {
|
|
163
167
|
searchTitle: 'Search',
|
|
164
168
|
clearTitle: 'Clear search input'
|
|
@@ -238,7 +242,7 @@ export default class QueryAssist extends Component {
|
|
|
238
242
|
}
|
|
239
243
|
if (typeof query === 'string' && queryChanged && query !== this.immediateState.query) {
|
|
240
244
|
this.immediateState.query = query;
|
|
241
|
-
if (
|
|
245
|
+
if (prevProps.autoOpen && query?.length > 0) {
|
|
242
246
|
this.requestData?.();
|
|
243
247
|
}
|
|
244
248
|
else if (query) {
|
|
@@ -431,7 +435,7 @@ export default class QueryAssist extends Component {
|
|
|
431
435
|
this.requestData?.();
|
|
432
436
|
}
|
|
433
437
|
}
|
|
434
|
-
if (this.
|
|
438
|
+
if (this.immediateState.query.length < 1) {
|
|
435
439
|
this.setState({ showPopup: false });
|
|
436
440
|
}
|
|
437
441
|
};
|
|
@@ -450,7 +454,7 @@ export default class QueryAssist extends Component {
|
|
|
450
454
|
placeholderEnabled: !query,
|
|
451
455
|
query,
|
|
452
456
|
suggestions,
|
|
453
|
-
showPopup: !!suggestions.length &&
|
|
457
|
+
showPopup: !!suggestions.length && !afterCompletion
|
|
454
458
|
};
|
|
455
459
|
this.immediateState.suggestionsQuery = query;
|
|
456
460
|
// Do not update deep equal styleRanges to simplify shouldComponentUpdate check
|
|
@@ -755,12 +759,12 @@ export default class QueryAssist extends Component {
|
|
|
755
759
|
return actions;
|
|
756
760
|
}
|
|
757
761
|
render() {
|
|
758
|
-
const { glass, 'data-test': dataTest, className, useCustomItemRender, huge } = this.props;
|
|
762
|
+
const { glass, 'data-test': dataTest, className, useCustomItemRender, huge, size } = this.props;
|
|
759
763
|
const renderPlaceholder = !!this.props.placeholder && this.state.placeholderEnabled;
|
|
760
764
|
const renderLoader = this.props.loader !== false && this.state.loading;
|
|
761
765
|
const renderGlass = glass && !renderLoader;
|
|
762
766
|
const actions = this.renderActions();
|
|
763
|
-
const containerClasses = classNames(className, {
|
|
767
|
+
const containerClasses = classNames(className, inputStyles[`size${huge ? Size.FULL : size}`], {
|
|
764
768
|
[styles.queryAssist]: true,
|
|
765
769
|
[styles.withIcon]: (renderGlass && !huge) || renderLoader,
|
|
766
770
|
[styles.huge]: huge
|
|
@@ -774,8 +778,7 @@ export default class QueryAssist extends Component {
|
|
|
774
778
|
});
|
|
775
779
|
return (<ControlsHeightContext.Provider value={ControlsHeight.M}>
|
|
776
780
|
<div data-test={dataTests('ring-query-assist', dataTest)} className={containerClasses} role="presentation" ref={this.nodeRef}>
|
|
777
|
-
{this.state.shortcuts &&
|
|
778
|
-
(<Shortcuts map={this.shortcutsMap} scope={this.shortcutsScope}/>)}
|
|
781
|
+
{this.state.shortcuts && (<Shortcuts map={this.shortcutsMap} scope={this.shortcutsScope}/>)}
|
|
779
782
|
|
|
780
783
|
{renderGlass && !huge && (<Icon glyph={searchIcon} className={styles.icon} title={this.props.translations.searchTitle} ref={this.glassRef} data-test="query-assist-search-icon"/>)}
|
|
781
784
|
|
|
@@ -1,29 +1,19 @@
|
|
|
1
1
|
@import "../global/variables.css";
|
|
2
2
|
|
|
3
|
+
@value unit from "../global/global.css";
|
|
3
4
|
@value outerContainer, container, input from "../input/input.css";
|
|
4
5
|
|
|
5
6
|
.tagsInput {
|
|
6
|
-
|
|
7
|
-
padding-
|
|
7
|
+
--ring-input-icon-offset: calc(unit * 2.5);
|
|
8
|
+
--ring-input-padding-inline: 3px;
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.tagsInputLegacyMode {
|
|
13
|
-
padding-top: 0;
|
|
14
|
-
padding-bottom: 1px;
|
|
15
|
-
|
|
16
|
-
border: 1px solid var(--ring-borders-color);
|
|
17
|
-
background-color: var(--ring-content-background-color);
|
|
18
|
-
|
|
19
|
-
& .tagsList {
|
|
20
|
-
padding-top: 1px;
|
|
10
|
+
box-sizing: border-box;
|
|
21
11
|
|
|
22
|
-
|
|
23
|
-
|
|
12
|
+
font-size: var(--ring-font-size);
|
|
13
|
+
line-height: var(--ring-line-height);
|
|
24
14
|
|
|
25
|
-
&
|
|
26
|
-
|
|
15
|
+
& * {
|
|
16
|
+
box-sizing: border-box;
|
|
27
17
|
}
|
|
28
18
|
}
|
|
29
19
|
|
|
@@ -35,10 +25,6 @@
|
|
|
35
25
|
& .input {
|
|
36
26
|
background-color: transparent;
|
|
37
27
|
}
|
|
38
|
-
|
|
39
|
-
& .underline {
|
|
40
|
-
border-bottom-style: dashed;
|
|
41
|
-
}
|
|
42
28
|
}
|
|
43
29
|
|
|
44
30
|
.tagsInputFocused {
|
|
@@ -46,16 +32,41 @@
|
|
|
46
32
|
}
|
|
47
33
|
|
|
48
34
|
.tagsList {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
box-sizing: border-box;
|
|
35
|
+
--ring-input-padding-start: var(--ring-input-padding-inline);
|
|
36
|
+
--ring-input-padding-end: var(--ring-input-padding-inline);
|
|
52
37
|
|
|
53
38
|
width: 100%;
|
|
54
|
-
margin-bottom: -1px;
|
|
55
39
|
|
|
56
|
-
|
|
40
|
+
margin: 0;
|
|
41
|
+
padding-top: var(--ring-input-padding-block);
|
|
42
|
+
padding-right: var(--ring-input-padding-end);
|
|
43
|
+
padding-bottom: var(--ring-input-padding-block);
|
|
44
|
+
padding-left: var(--ring-input-padding-start);
|
|
45
|
+
|
|
46
|
+
cursor: text;
|
|
47
|
+
|
|
48
|
+
transition: border-color var(--ring-ease);
|
|
49
|
+
|
|
50
|
+
color: var(--ring-text-color);
|
|
51
|
+
border: 1px solid var(--ring-borders-color);
|
|
52
|
+
border-radius: var(--ring-border-radius);
|
|
53
|
+
outline: none;
|
|
54
|
+
background: transparent;
|
|
55
|
+
|
|
56
|
+
font: inherit;
|
|
57
|
+
|
|
58
|
+
caret-color: var(--ring-main-color);
|
|
59
|
+
|
|
60
|
+
@nest [dir=rtl] & {
|
|
61
|
+
padding-right: var(--ring-input-padding-start);
|
|
62
|
+
padding-left: var(--ring-input-padding-end);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&:hover {
|
|
66
|
+
transition: none;
|
|
57
67
|
|
|
58
|
-
|
|
68
|
+
border-color: var(--ring-border-hover-color);
|
|
69
|
+
}
|
|
59
70
|
}
|
|
60
71
|
|
|
61
72
|
.tagsSelect {
|
|
@@ -69,24 +80,3 @@
|
|
|
69
80
|
line-height: calc(var(--ring-line-height) - 2px);
|
|
70
81
|
}
|
|
71
82
|
}
|
|
72
|
-
|
|
73
|
-
.underline {
|
|
74
|
-
height: 1px;
|
|
75
|
-
|
|
76
|
-
border-bottom: var(--ring-borders-color) 1px solid;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.focusUnderline {
|
|
80
|
-
width: 0;
|
|
81
|
-
height: 2px;
|
|
82
|
-
|
|
83
|
-
margin-top: -1px;
|
|
84
|
-
|
|
85
|
-
transition: width 0.15s ease-out;
|
|
86
|
-
|
|
87
|
-
background: var(--ring-main-color);
|
|
88
|
-
|
|
89
|
-
@nest .tagsInputFocused & {
|
|
90
|
-
width: 100%;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import React, { Component, PureComponent, SyntheticEvent } from 'react';
|
|
1
|
+
import React, { Component, PureComponent, SyntheticEvent, ReactNode } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import Select, { SelectItem } from '../select/select';
|
|
4
4
|
import { TagType } from '../tags-list/tags-list';
|
|
5
5
|
import Caret from '../caret/caret';
|
|
6
|
+
import { Size } from '../input/input';
|
|
7
|
+
import { ControlsHeight } from '../global/controls-height';
|
|
6
8
|
import { Filter } from '../select/select__popup';
|
|
7
9
|
declare function noop(): void;
|
|
8
10
|
export interface ToggleTagParams {
|
|
@@ -22,7 +24,6 @@ export interface TagsInputProps {
|
|
|
22
24
|
disabled: boolean;
|
|
23
25
|
autoOpen: boolean;
|
|
24
26
|
renderOptimization: boolean;
|
|
25
|
-
legacyMode: boolean;
|
|
26
27
|
allowAddNewTags: boolean;
|
|
27
28
|
filter: boolean | Filter;
|
|
28
29
|
placeholder: string;
|
|
@@ -30,6 +31,9 @@ export interface TagsInputProps {
|
|
|
30
31
|
tags?: readonly TagType[] | null | undefined;
|
|
31
32
|
loadingMessage?: string | undefined;
|
|
32
33
|
notFoundMessage?: string | undefined;
|
|
34
|
+
size: Size;
|
|
35
|
+
height?: ControlsHeight | undefined;
|
|
36
|
+
label?: ReactNode;
|
|
33
37
|
}
|
|
34
38
|
interface TagsInputState {
|
|
35
39
|
tags: TagType[];
|
|
@@ -61,7 +65,6 @@ export default class TagsInput extends PureComponent<TagsInputProps, TagsInputSt
|
|
|
61
65
|
disabled: PropTypes.Requireable<boolean>;
|
|
62
66
|
autoOpen: PropTypes.Requireable<boolean>;
|
|
63
67
|
renderOptimization: PropTypes.Requireable<boolean>;
|
|
64
|
-
legacyMode: PropTypes.Requireable<boolean>;
|
|
65
68
|
filter: PropTypes.Requireable<NonNullable<boolean | PropTypes.InferProps<{
|
|
66
69
|
fn: PropTypes.Requireable<(...args: any[]) => any>;
|
|
67
70
|
}> | null | undefined>>;
|
|
@@ -80,12 +83,12 @@ export default class TagsInput extends PureComponent<TagsInputProps, TagsInputSt
|
|
|
80
83
|
disabled: boolean;
|
|
81
84
|
autoOpen: boolean;
|
|
82
85
|
renderOptimization: boolean;
|
|
83
|
-
legacyMode: boolean;
|
|
84
86
|
allowAddNewTags: boolean;
|
|
85
87
|
filter: {
|
|
86
88
|
fn: () => boolean;
|
|
87
89
|
};
|
|
88
90
|
placeholder: string;
|
|
91
|
+
size: Size;
|
|
89
92
|
};
|
|
90
93
|
constructor(props: TagsInputProps);
|
|
91
94
|
state: TagsInputState;
|
|
@@ -95,6 +98,8 @@ export default class TagsInput extends PureComponent<TagsInputProps, TagsInputSt
|
|
|
95
98
|
componentDidMount(): void;
|
|
96
99
|
static ngModelStateField: string;
|
|
97
100
|
ngModelStateField: string;
|
|
101
|
+
static contextType: React.Context<ControlsHeight>;
|
|
102
|
+
id: string;
|
|
98
103
|
node?: HTMLElement | null;
|
|
99
104
|
nodeRef: (node: HTMLElement | null) => void;
|
|
100
105
|
input?: HTMLInputElement | null;
|
|
@@ -7,6 +7,10 @@ import TagsList from '../tags-list/tags-list';
|
|
|
7
7
|
import Caret from '../caret/caret';
|
|
8
8
|
import memoize from '../global/memoize';
|
|
9
9
|
import rerenderHOC from '../global/rerender-hoc';
|
|
10
|
+
import { Size } from '../input/input';
|
|
11
|
+
import { ControlsHeightContext } from '../global/controls-height';
|
|
12
|
+
import getUID from '../global/get-uid';
|
|
13
|
+
import inputStyles from '../input/input.css';
|
|
10
14
|
import styles from './tags-input.css';
|
|
11
15
|
function noop() { }
|
|
12
16
|
/**
|
|
@@ -34,7 +38,6 @@ export default class TagsInput extends PureComponent {
|
|
|
34
38
|
disabled: PropTypes.bool,
|
|
35
39
|
autoOpen: PropTypes.bool,
|
|
36
40
|
renderOptimization: PropTypes.bool,
|
|
37
|
-
legacyMode: PropTypes.bool,
|
|
38
41
|
filter: PropTypes.oneOfType([PropTypes.bool, PropTypes.shape({ fn: PropTypes.func })]),
|
|
39
42
|
loadingMessage: PropTypes.string,
|
|
40
43
|
notFoundMessage: PropTypes.string,
|
|
@@ -51,10 +54,10 @@ export default class TagsInput extends PureComponent {
|
|
|
51
54
|
disabled: false,
|
|
52
55
|
autoOpen: false,
|
|
53
56
|
renderOptimization: true,
|
|
54
|
-
legacyMode: false,
|
|
55
57
|
allowAddNewTags: false,
|
|
56
58
|
filter: { fn: () => true },
|
|
57
|
-
placeholder: 'Select an option'
|
|
59
|
+
placeholder: 'Select an option',
|
|
60
|
+
size: Size.M
|
|
58
61
|
};
|
|
59
62
|
constructor(props) {
|
|
60
63
|
super(props);
|
|
@@ -85,6 +88,8 @@ export default class TagsInput extends PureComponent {
|
|
|
85
88
|
}
|
|
86
89
|
static ngModelStateField = 'tags';
|
|
87
90
|
ngModelStateField;
|
|
91
|
+
static contextType = ControlsHeightContext;
|
|
92
|
+
id = getUID('ring-tags-list-');
|
|
88
93
|
node;
|
|
89
94
|
nodeRef = (node) => {
|
|
90
95
|
this.node = node;
|
|
@@ -244,21 +249,21 @@ export default class TagsInput extends PureComponent {
|
|
|
244
249
|
};
|
|
245
250
|
render() {
|
|
246
251
|
const { focused, tags, activeIndex } = this.state;
|
|
247
|
-
const {
|
|
248
|
-
const classes = classNames(styles.tagsInput, {
|
|
252
|
+
const { disabled, canNotBeEmpty, allowAddNewTags, filter, size, height = this.context, label } = this.props;
|
|
253
|
+
const classes = classNames(styles.tagsInput, [inputStyles[`size${size}`]], [inputStyles[`height${height}`]], {
|
|
249
254
|
[styles.tagsInputDisabled]: disabled,
|
|
250
|
-
[styles.tagsInputFocused]: focused
|
|
251
|
-
[styles.tagsInputLegacyMode]: legacyMode
|
|
255
|
+
[styles.tagsInputFocused]: focused
|
|
252
256
|
}, this.props.className);
|
|
253
257
|
return (<div
|
|
254
258
|
// it transfers focus to input
|
|
255
259
|
role="presentation" className={classes} onKeyDown={this.handleKeyDown} onClick={this.clickHandler} ref={this.nodeRef}>
|
|
260
|
+
{label && (<label htmlFor={this.id} className={classNames(inputStyles.label, {
|
|
261
|
+
[inputStyles.disabledLabel]: disabled
|
|
262
|
+
})}>{label}</label>)}
|
|
263
|
+
|
|
256
264
|
<TagsList tags={tags} activeIndex={activeIndex} disabled={disabled} canNotBeEmpty={canNotBeEmpty} handleRemove={this.handleRemove} className={styles.tagsList} tagClassName={styles.tag} handleClick={this.handleClick}>
|
|
257
|
-
<Select ref={this.selectRef} size={Select.Size.AUTO} type={Select.Type.INPUT_WITHOUT_CONTROLS} inputPlaceholder={this.props.placeholder} data={this.state.suggestions} className={classNames(styles.tagsSelect)} onSelect={this.addTag} onFocus={this._focusHandler} onBlur={this._blurHandler} renderOptimization={this.props.renderOptimization} add={allowAddNewTags ? { prefix: 'Add new tag' } : undefined} onAdd={allowAddNewTags ? this.handleTagCreation : undefined} filter={filter} maxHeight={this.props.maxPopupHeight} minWidth={this.props.minPopupWidth} top={POPUP_VERTICAL_SHIFT} loading={this.state.loading} onFilter={this.loadSuggestions} onBeforeOpen={this.loadSuggestions} onKeyDown={this.handleKeyDown} disabled={this.props.disabled} loadingMessage={this.props.loadingMessage} notFoundMessage={this.props.notFoundMessage}/>
|
|
265
|
+
<Select id={this.id} ref={this.selectRef} size={Select.Size.AUTO} type={Select.Type.INPUT_WITHOUT_CONTROLS} inputPlaceholder={this.props.placeholder} data={this.state.suggestions} className={classNames(styles.tagsSelect)} onSelect={this.addTag} onFocus={this._focusHandler} onBlur={this._blurHandler} renderOptimization={this.props.renderOptimization} add={allowAddNewTags ? { prefix: 'Add new tag' } : undefined} onAdd={allowAddNewTags ? this.handleTagCreation : undefined} filter={filter} maxHeight={this.props.maxPopupHeight} minWidth={this.props.minPopupWidth} top={POPUP_VERTICAL_SHIFT} loading={this.state.loading} onFilter={this.loadSuggestions} onBeforeOpen={this.loadSuggestions} onKeyDown={this.handleKeyDown} disabled={this.props.disabled} loadingMessage={this.props.loadingMessage} notFoundMessage={this.props.notFoundMessage}/>
|
|
258
266
|
</TagsList>
|
|
259
|
-
|
|
260
|
-
{!legacyMode && <div className={styles.underline}/>}
|
|
261
|
-
{!legacyMode && <div className={styles.focusUnderline}/>}
|
|
262
267
|
</div>);
|
|
263
268
|
}
|
|
264
269
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import scrollbarWidth from 'scrollbar-width';
|
|
2
2
|
|
|
3
|
-
var modules_5e9b8c03 = {"unit":"8px","header":"header_rui_1d72","container":"container_rui_381e","innerContainer":"innerContainer_rui_381e","content":"content_rui_381e","panel":"panel_rui_381e","clickableOverlay":"clickableOverlay_rui_381e","closeIcon":"closeIcon_rui_381e","closeButton":"closeButton_rui_381e","closeButtonOutside":"closeButtonOutside_rui_381e","closeButtonInside":"closeButtonInside_rui_381e","documentWithoutScroll":"documentWithoutScroll_rui_381e","popupTarget":"popupTarget_rui_381e"};
|
|
3
|
+
var modules_5e9b8c03 = {"unit":"8px","header":"header_rui_1d72","container":"container_rui_381e","innerContainer":"innerContainer_rui_381e","content":"content_rui_381e","panel":"panel_rui_381e","clickableOverlay":"clickableOverlay_rui_381e","closeIcon":"closeIcon_rui_381e","closeButton":"closeButton_rui_381e","closeButtonOutside":"closeButtonOutside_rui_381e","closeButtonInside":"closeButtonInside_rui_381e","documentWithoutScroll":"documentWithoutScroll_rui_381e","popupTarget":"popupTarget_rui_381e","dense":"dense_rui_381e"};
|
|
4
4
|
|
|
5
5
|
const isPrevented = new Set();
|
|
6
6
|
let previousDocumentWidth = null;
|
package/dist/dialog/dialog.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export interface DialogProps extends Partial<TabTrapProps> {
|
|
|
15
15
|
contentClassName?: string | null | undefined;
|
|
16
16
|
portalTarget?: Element | null | undefined;
|
|
17
17
|
'data-test'?: string | null | undefined;
|
|
18
|
+
dense?: boolean | null | undefined;
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
20
21
|
* @name Dialog
|
package/dist/dialog/dialog.js
CHANGED
|
@@ -124,6 +124,7 @@ class Dialog extends PureComponent {
|
|
|
124
124
|
portalTarget,
|
|
125
125
|
label,
|
|
126
126
|
closeButtonTitle,
|
|
127
|
+
dense,
|
|
127
128
|
...restProps
|
|
128
129
|
} = this.props;
|
|
129
130
|
const classes = classNames(modules_5e9b8c03.container, className);
|
|
@@ -148,7 +149,9 @@ class Dialog extends PureComponent {
|
|
|
148
149
|
}), /*#__PURE__*/React.createElement("div", {
|
|
149
150
|
className: modules_5e9b8c03.innerContainer
|
|
150
151
|
}, /*#__PURE__*/React.createElement(AdaptiveIsland, {
|
|
151
|
-
className: classNames(modules_5e9b8c03.content, contentClassName
|
|
152
|
+
className: classNames(modules_5e9b8c03.content, contentClassName, {
|
|
153
|
+
[modules_5e9b8c03.dense]: dense
|
|
154
|
+
}),
|
|
152
155
|
"data-test": "ring-dialog",
|
|
153
156
|
role: "dialog",
|
|
154
157
|
"aria-label": label
|
|
@@ -4,6 +4,7 @@ import Caret, { Position } from '../caret/caret';
|
|
|
4
4
|
import PopupMenu from '../popup-menu/popup-menu';
|
|
5
5
|
import Button from '../button/button';
|
|
6
6
|
import Icon from '../icon/icon';
|
|
7
|
+
import { Size } from '../input/input';
|
|
7
8
|
import { ShortcutsMap } from '../shortcuts/core';
|
|
8
9
|
import { QueryAssistSuggestion, SuggestionItem } from './query-assist__suggestions';
|
|
9
10
|
declare function noop(): void;
|
|
@@ -59,6 +60,7 @@ export interface QueryAssistProps {
|
|
|
59
60
|
actions?: ReactNode[] | null | undefined;
|
|
60
61
|
'data-test'?: string | null | undefined;
|
|
61
62
|
huge?: boolean | null | undefined;
|
|
63
|
+
size: Size;
|
|
62
64
|
}
|
|
63
65
|
export interface StyleRange {
|
|
64
66
|
style: string;
|
|
@@ -210,6 +212,7 @@ export default class QueryAssist extends Component<QueryAssistProps> {
|
|
|
210
212
|
actions: PropTypes.Requireable<any[]>;
|
|
211
213
|
'data-test': PropTypes.Requireable<string>;
|
|
212
214
|
huge: PropTypes.Requireable<boolean>;
|
|
215
|
+
size: PropTypes.Requireable<string>;
|
|
213
216
|
};
|
|
214
217
|
static defaultProps: {
|
|
215
218
|
onApply: typeof noop;
|
|
@@ -217,6 +220,7 @@ export default class QueryAssist extends Component<QueryAssistProps> {
|
|
|
217
220
|
onApplySuggestion: typeof noop;
|
|
218
221
|
onClear: typeof noop;
|
|
219
222
|
onFocusChange: typeof noop;
|
|
223
|
+
size: Size;
|
|
220
224
|
translations: {
|
|
221
225
|
searchTitle: string;
|
|
222
226
|
clearTitle: string;
|
|
@@ -18,6 +18,8 @@ import rerenderHOC from '../global/rerender-hoc.js';
|
|
|
18
18
|
import { Button } from '../button/button.js';
|
|
19
19
|
import Icon from '../icon/icon.js';
|
|
20
20
|
import { ControlsHeightContext, ControlsHeight } from '../global/controls-height.js';
|
|
21
|
+
import { Size } from '../input/input.js';
|
|
22
|
+
import { m as modules_88cfaf40 } from '../_helpers/input.js';
|
|
21
23
|
import { Q as QueryAssistSuggestions, m as modules_da7ab055 } from '../_helpers/query-assist__suggestions.js';
|
|
22
24
|
import 'react-dom/server';
|
|
23
25
|
import '../popup/popup.js';
|
|
@@ -68,6 +70,7 @@ import '../global/react-render-adapter.js';
|
|
|
68
70
|
import '../global/composeRefs.js';
|
|
69
71
|
import '@jetbrains/icons/chevron-10px';
|
|
70
72
|
import '../_helpers/button__classes.js';
|
|
73
|
+
import '../global/prop-types.js';
|
|
71
74
|
|
|
72
75
|
const POPUP_COMPENSATION = PopupMenu.ListProps.Dimension.ITEM_PADDING + PopupMenu.PopupProps.Dimension.BORDER_WIDTH;
|
|
73
76
|
const ngModelStateField = 'query';
|
|
@@ -356,7 +359,7 @@ class QueryAssist extends Component {
|
|
|
356
359
|
}
|
|
357
360
|
}
|
|
358
361
|
|
|
359
|
-
if (this.
|
|
362
|
+
if (this.immediateState.query.length < 1) {
|
|
360
363
|
this.setState({
|
|
361
364
|
showPopup: false
|
|
362
365
|
});
|
|
@@ -394,7 +397,7 @@ class QueryAssist extends Component {
|
|
|
394
397
|
placeholderEnabled: !query,
|
|
395
398
|
query,
|
|
396
399
|
suggestions,
|
|
397
|
-
showPopup: !!suggestions.length &&
|
|
400
|
+
showPopup: !!suggestions.length && !afterCompletion
|
|
398
401
|
};
|
|
399
402
|
_this.immediateState.suggestionsQuery = query; // Do not update deep equal styleRanges to simplify shouldComponentUpdate check
|
|
400
403
|
|
|
@@ -666,7 +669,7 @@ class QueryAssist extends Component {
|
|
|
666
669
|
if (typeof query === 'string' && queryChanged && query !== this.immediateState.query) {
|
|
667
670
|
this.immediateState.query = query;
|
|
668
671
|
|
|
669
|
-
if (
|
|
672
|
+
if (prevProps.autoOpen && (query === null || query === void 0 ? void 0 : query.length) > 0) {
|
|
670
673
|
var _this$requestData5;
|
|
671
674
|
|
|
672
675
|
(_this$requestData5 = this.requestData) === null || _this$requestData5 === void 0 ? void 0 : _this$requestData5.call(this);
|
|
@@ -928,13 +931,14 @@ class QueryAssist extends Component {
|
|
|
928
931
|
'data-test': dataTest,
|
|
929
932
|
className,
|
|
930
933
|
useCustomItemRender,
|
|
931
|
-
huge
|
|
934
|
+
huge,
|
|
935
|
+
size
|
|
932
936
|
} = this.props;
|
|
933
937
|
const renderPlaceholder = !!this.props.placeholder && this.state.placeholderEnabled;
|
|
934
938
|
const renderLoader = this.props.loader !== false && this.state.loading;
|
|
935
939
|
const renderGlass = glass && !renderLoader;
|
|
936
940
|
const actions = this.renderActions();
|
|
937
|
-
const containerClasses = classNames(className, {
|
|
941
|
+
const containerClasses = classNames(className, modules_88cfaf40[`size${huge ? Size.FULL : size}`], {
|
|
938
942
|
[modules_da7ab055.queryAssist]: true,
|
|
939
943
|
[modules_da7ab055.withIcon]: renderGlass && !huge || renderLoader,
|
|
940
944
|
[modules_da7ab055.huge]: huge
|
|
@@ -1133,7 +1137,8 @@ _defineProperty(QueryAssist, "propTypes", {
|
|
|
1133
1137
|
translations: PropTypes.object,
|
|
1134
1138
|
actions: PropTypes.array,
|
|
1135
1139
|
'data-test': PropTypes.string,
|
|
1136
|
-
huge: PropTypes.bool
|
|
1140
|
+
huge: PropTypes.bool,
|
|
1141
|
+
size: PropTypes.string
|
|
1137
1142
|
});
|
|
1138
1143
|
|
|
1139
1144
|
_defineProperty(QueryAssist, "defaultProps", {
|
|
@@ -1142,6 +1147,7 @@ _defineProperty(QueryAssist, "defaultProps", {
|
|
|
1142
1147
|
onApplySuggestion: noop,
|
|
1143
1148
|
onClear: noop,
|
|
1144
1149
|
onFocusChange: noop,
|
|
1150
|
+
size: Size.L,
|
|
1145
1151
|
translations: {
|
|
1146
1152
|
searchTitle: 'Search',
|
|
1147
1153
|
clearTitle: 'Clear search input'
|
|
@@ -72,6 +72,9 @@ import '../button/button.js';
|
|
|
72
72
|
import '@jetbrains/icons/chevron-10px';
|
|
73
73
|
import '../global/controls-height.js';
|
|
74
74
|
import '../_helpers/button__classes.js';
|
|
75
|
+
import '../input/input.js';
|
|
76
|
+
import '../global/prop-types.js';
|
|
77
|
+
import '../_helpers/input.js';
|
|
75
78
|
import '../_helpers/query-assist__suggestions.js';
|
|
76
79
|
|
|
77
80
|
var queryAssistNg = angularComponentFactory(QueryAssist, 'QueryAssist').name;
|