@jetbrains/ring-ui 5.0.32 → 5.0.34
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/tag/tag.css +0 -1
- package/components/tags-input/tags-input.css +39 -51
- package/components/tags-input/tags-input.d.ts +12 -4
- package/components/tags-input/tags-input.js +19 -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/style.css +1 -1
- package/dist/tags-input/tags-input.d.ts +12 -4
- package/dist/tags-input/tags-input.js +30 -21
- package/package.json +6 -6
|
@@ -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, {
|
package/components/tag/tag.css
CHANGED
|
@@ -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,47 +32,49 @@
|
|
|
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
|
-
|
|
56
|
-
padding-left: 2px;
|
|
57
39
|
|
|
58
|
-
|
|
59
|
-
|
|
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);
|
|
60
45
|
|
|
61
|
-
|
|
62
|
-
margin-bottom: -1px;
|
|
46
|
+
cursor: text;
|
|
63
47
|
|
|
64
|
-
|
|
65
|
-
--ring-input-padding-block: 0;
|
|
66
|
-
}
|
|
48
|
+
transition: border-color var(--ring-ease);
|
|
67
49
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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;
|
|
72
55
|
|
|
73
|
-
|
|
74
|
-
height: 1px;
|
|
56
|
+
font: inherit;
|
|
75
57
|
|
|
76
|
-
|
|
77
|
-
}
|
|
58
|
+
caret-color: var(--ring-main-color);
|
|
78
59
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
60
|
+
@nest [dir=rtl] & {
|
|
61
|
+
padding-right: var(--ring-input-padding-start);
|
|
62
|
+
padding-left: var(--ring-input-padding-end);
|
|
63
|
+
}
|
|
82
64
|
|
|
83
|
-
|
|
65
|
+
&:hover {
|
|
66
|
+
transition: none;
|
|
84
67
|
|
|
85
|
-
|
|
68
|
+
border-color: var(--ring-border-hover-color);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
86
71
|
|
|
87
|
-
|
|
72
|
+
.tagsSelect {
|
|
73
|
+
& .outerContainer {
|
|
74
|
+
--ring-input-padding-block: 0;
|
|
75
|
+
}
|
|
88
76
|
|
|
89
|
-
|
|
90
|
-
|
|
77
|
+
& .container {
|
|
78
|
+
line-height: calc(var(--ring-line-height) - 2px);
|
|
91
79
|
}
|
|
92
80
|
}
|
|
@@ -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,10 +65,12 @@ 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>>;
|
|
71
|
+
size: PropTypes.Requireable<string>;
|
|
72
|
+
height: PropTypes.Requireable<string>;
|
|
73
|
+
label: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
68
74
|
loadingMessage: PropTypes.Requireable<string>;
|
|
69
75
|
notFoundMessage: PropTypes.Requireable<string>;
|
|
70
76
|
allowAddNewTags: PropTypes.Requireable<boolean>;
|
|
@@ -80,12 +86,12 @@ export default class TagsInput extends PureComponent<TagsInputProps, TagsInputSt
|
|
|
80
86
|
disabled: boolean;
|
|
81
87
|
autoOpen: boolean;
|
|
82
88
|
renderOptimization: boolean;
|
|
83
|
-
legacyMode: boolean;
|
|
84
89
|
allowAddNewTags: boolean;
|
|
85
90
|
filter: {
|
|
86
91
|
fn: () => boolean;
|
|
87
92
|
};
|
|
88
93
|
placeholder: string;
|
|
94
|
+
size: Size;
|
|
89
95
|
};
|
|
90
96
|
constructor(props: TagsInputProps);
|
|
91
97
|
state: TagsInputState;
|
|
@@ -95,6 +101,8 @@ export default class TagsInput extends PureComponent<TagsInputProps, TagsInputSt
|
|
|
95
101
|
componentDidMount(): void;
|
|
96
102
|
static ngModelStateField: string;
|
|
97
103
|
ngModelStateField: string;
|
|
104
|
+
static contextType: React.Context<ControlsHeight>;
|
|
105
|
+
id: string;
|
|
98
106
|
node?: HTMLElement | null;
|
|
99
107
|
nodeRef: (node: HTMLElement | null) => void;
|
|
100
108
|
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,8 +38,10 @@ 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 })]),
|
|
42
|
+
size: PropTypes.string,
|
|
43
|
+
height: PropTypes.string,
|
|
44
|
+
label: PropTypes.node,
|
|
39
45
|
loadingMessage: PropTypes.string,
|
|
40
46
|
notFoundMessage: PropTypes.string,
|
|
41
47
|
allowAddNewTags: PropTypes.bool
|
|
@@ -51,10 +57,10 @@ export default class TagsInput extends PureComponent {
|
|
|
51
57
|
disabled: false,
|
|
52
58
|
autoOpen: false,
|
|
53
59
|
renderOptimization: true,
|
|
54
|
-
legacyMode: false,
|
|
55
60
|
allowAddNewTags: false,
|
|
56
61
|
filter: { fn: () => true },
|
|
57
|
-
placeholder: 'Select an option'
|
|
62
|
+
placeholder: 'Select an option',
|
|
63
|
+
size: Size.M
|
|
58
64
|
};
|
|
59
65
|
constructor(props) {
|
|
60
66
|
super(props);
|
|
@@ -85,6 +91,8 @@ export default class TagsInput extends PureComponent {
|
|
|
85
91
|
}
|
|
86
92
|
static ngModelStateField = 'tags';
|
|
87
93
|
ngModelStateField;
|
|
94
|
+
static contextType = ControlsHeightContext;
|
|
95
|
+
id = getUID('ring-tags-list-');
|
|
88
96
|
node;
|
|
89
97
|
nodeRef = (node) => {
|
|
90
98
|
this.node = node;
|
|
@@ -244,21 +252,21 @@ export default class TagsInput extends PureComponent {
|
|
|
244
252
|
};
|
|
245
253
|
render() {
|
|
246
254
|
const { focused, tags, activeIndex } = this.state;
|
|
247
|
-
const {
|
|
248
|
-
const classes = classNames(styles.tagsInput, {
|
|
255
|
+
const { disabled, canNotBeEmpty, allowAddNewTags, filter, size, height = this.context, label } = this.props;
|
|
256
|
+
const classes = classNames(styles.tagsInput, [inputStyles[`size${size}`]], [inputStyles[`height${height}`]], {
|
|
249
257
|
[styles.tagsInputDisabled]: disabled,
|
|
250
|
-
[styles.tagsInputFocused]: focused
|
|
251
|
-
[styles.tagsInputLegacyMode]: legacyMode
|
|
258
|
+
[styles.tagsInputFocused]: focused
|
|
252
259
|
}, this.props.className);
|
|
253
260
|
return (<div
|
|
254
261
|
// it transfers focus to input
|
|
255
262
|
role="presentation" className={classes} onKeyDown={this.handleKeyDown} onClick={this.clickHandler} ref={this.nodeRef}>
|
|
263
|
+
{label && (<label htmlFor={this.id} className={classNames(inputStyles.label, {
|
|
264
|
+
[inputStyles.disabledLabel]: disabled
|
|
265
|
+
})}>{label}</label>)}
|
|
266
|
+
|
|
256
267
|
<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}/>
|
|
268
|
+
<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
269
|
</TagsList>
|
|
259
|
-
|
|
260
|
-
{!legacyMode && <div className={styles.underline}/>}
|
|
261
|
-
{!legacyMode && <div className={styles.focusUnderline}/>}
|
|
262
270
|
</div>);
|
|
263
271
|
}
|
|
264
272
|
}
|
|
@@ -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
|