@megafon/ui-core 4.8.2 → 4.9.0
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/CHANGELOG.md +17 -0
- package/dist/es/components/ContentArea/ContentArea.d.ts +5 -0
- package/dist/es/components/ContentArea/ContentArea.js +11 -5
- package/dist/es/components/Grid/Grid.d.ts +5 -0
- package/dist/es/components/Grid/Grid.js +11 -5
- package/dist/es/components/Grid/GridColumn.d.ts +4 -0
- package/dist/es/components/Grid/GridColumn.js +8 -3
- package/dist/es/components/Header/Header.d.ts +1 -1
- package/dist/es/components/TextField/TextField.css +9 -0
- package/dist/es/components/TextField/TextField.d.ts +2 -0
- package/dist/es/components/TextField/TextField.js +48 -24
- package/dist/es/components/Tooltip/Tooltip.css +106 -53
- package/dist/es/components/Tooltip/Tooltip.js +22 -19
- package/dist/lib/components/ContentArea/ContentArea.d.ts +5 -0
- package/dist/lib/components/ContentArea/ContentArea.js +13 -4
- package/dist/lib/components/Grid/Grid.d.ts +5 -0
- package/dist/lib/components/Grid/Grid.js +13 -4
- package/dist/lib/components/Grid/GridColumn.d.ts +4 -0
- package/dist/lib/components/Grid/GridColumn.js +10 -2
- package/dist/lib/components/Header/Header.d.ts +1 -1
- package/dist/lib/components/TextField/TextField.css +9 -0
- package/dist/lib/components/TextField/TextField.d.ts +2 -0
- package/dist/lib/components/TextField/TextField.js +49 -23
- package/dist/lib/components/Tooltip/Tooltip.css +106 -53
- package/dist/lib/components/Tooltip/Tooltip.js +22 -19
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,23 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [4.9.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@4.8.2...@megafon/ui-core@4.9.0) (2022-11-29)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **textarea:** fix auto resize ([de31a72](https://github.com/MegafonWebLab/megafon-ui/commit/de31a723f68e24f12623ca872f8281ca60b599c4))
|
|
12
|
+
* **tooltip:** fix close button margin and arrow position ([db99274](https://github.com/MegafonWebLab/megafon-ui/commit/db99274ab17fe58621aaaf1ba7d85bba6afc5e05))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **textarea:** add disableEnterLineBreak prop ([3fba0a0](https://github.com/MegafonWebLab/megafon-ui/commit/3fba0a08a4bca66575388c9156103335d68b287b))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
6
23
|
## [4.8.2](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@4.8.1...@megafon/ui-core@4.8.2) (2022-11-21)
|
|
7
24
|
|
|
8
25
|
|
|
@@ -32,6 +32,11 @@ export interface IConrentAreaProps {
|
|
|
32
32
|
root?: string;
|
|
33
33
|
inner?: string;
|
|
34
34
|
};
|
|
35
|
+
/** Дополнительные data атрибуты к внутренним элементам */
|
|
36
|
+
dataAttrs?: {
|
|
37
|
+
root?: Record<string, string>;
|
|
38
|
+
inner?: Record<string, string>;
|
|
39
|
+
};
|
|
35
40
|
}
|
|
36
41
|
declare const ContentArea: React.FC<IConrentAreaProps>;
|
|
37
42
|
export default ContentArea;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "core-js/modules/es.object.values";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
3
|
import * as React from 'react';
|
|
3
|
-
import { cnCreate } from '@megafon/ui-helpers';
|
|
4
|
+
import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
|
|
4
5
|
import * as PropTypes from 'prop-types';
|
|
5
6
|
import "./ContentArea.css";
|
|
6
7
|
var BACKGROUND_COLORS = {
|
|
@@ -29,17 +30,18 @@ var ContentArea = function ContentArea(_ref) {
|
|
|
29
30
|
disableIndents = _ref.disableIndents,
|
|
30
31
|
children = _ref.children,
|
|
31
32
|
className = _ref.className,
|
|
32
|
-
classes = _ref.classes
|
|
33
|
-
|
|
33
|
+
classes = _ref.classes,
|
|
34
|
+
dataAttrs = _ref.dataAttrs;
|
|
35
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
34
36
|
className: cn({
|
|
35
37
|
'background-color': outerBackgroundColor
|
|
36
38
|
}, [className, classes === null || classes === void 0 ? void 0 : classes.root])
|
|
37
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
39
|
+
}), /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.inner), {
|
|
38
40
|
className: cn('inner', {
|
|
39
41
|
'disable-indents': disableIndents,
|
|
40
42
|
'background-color': innerBackgroundColor
|
|
41
43
|
}, classes === null || classes === void 0 ? void 0 : classes.inner)
|
|
42
|
-
}, children));
|
|
44
|
+
}), children));
|
|
43
45
|
};
|
|
44
46
|
|
|
45
47
|
ContentArea.propTypes = {
|
|
@@ -49,6 +51,10 @@ ContentArea.propTypes = {
|
|
|
49
51
|
root: PropTypes.string,
|
|
50
52
|
inner: PropTypes.string
|
|
51
53
|
}),
|
|
54
|
+
dataAttrs: PropTypes.shape({
|
|
55
|
+
root: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
56
|
+
inner: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
57
|
+
}),
|
|
52
58
|
outerBackgroundColor: PropTypes.oneOf(Object.values(BACKGROUND_COLORS)),
|
|
53
59
|
innerBackgroundColor: PropTypes.oneOf(Object.values(BACKGROUND_COLORS))
|
|
54
60
|
};
|
|
@@ -14,6 +14,11 @@ export interface IGridProps {
|
|
|
14
14
|
multiRow?: boolean;
|
|
15
15
|
/** Дополнительный класс корневого элемента */
|
|
16
16
|
className?: string;
|
|
17
|
+
/** Дополнительные data атрибуты к внутренним элементам */
|
|
18
|
+
dataAttrs?: {
|
|
19
|
+
root?: Record<string, string>;
|
|
20
|
+
container?: Record<string, string>;
|
|
21
|
+
};
|
|
17
22
|
children: Array<React.ReactElement<IGridColumn>> | React.ReactElement<IGridColumn>;
|
|
18
23
|
}
|
|
19
24
|
declare const Grid: React.FC<IGridProps>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "core-js/modules/es.array.map";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
3
|
import * as React from 'react';
|
|
3
|
-
import { cnCreate } from '@megafon/ui-helpers';
|
|
4
|
+
import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
|
|
4
5
|
import * as PropTypes from 'prop-types';
|
|
5
6
|
import "./Grid.css";
|
|
6
7
|
var cn = cnCreate('mfui-grid');
|
|
@@ -13,10 +14,11 @@ var Grid = function Grid(_ref) {
|
|
|
13
14
|
multiRow = _ref$multiRow === void 0 ? true : _ref$multiRow,
|
|
14
15
|
hAlign = _ref.hAlign,
|
|
15
16
|
vAlign = _ref.vAlign,
|
|
16
|
-
className = _ref.className
|
|
17
|
-
|
|
17
|
+
className = _ref.className,
|
|
18
|
+
dataAttrs = _ref.dataAttrs;
|
|
19
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
18
20
|
className: cn([className])
|
|
19
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
21
|
+
}), /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.container), {
|
|
20
22
|
className: cn('container', {
|
|
21
23
|
'multi-row': multiRow,
|
|
22
24
|
'h-align': hAlign,
|
|
@@ -24,7 +26,7 @@ var Grid = function Grid(_ref) {
|
|
|
24
26
|
'gutters-left': guttersLeft,
|
|
25
27
|
'gutters-bottom': guttersBottom
|
|
26
28
|
})
|
|
27
|
-
}, React.Children.map(children, function (child) {
|
|
29
|
+
}), React.Children.map(children, function (child) {
|
|
28
30
|
return React.cloneElement(child, {
|
|
29
31
|
className: cn('column', {
|
|
30
32
|
'gutter-left': guttersLeft,
|
|
@@ -41,6 +43,10 @@ Grid.propTypes = {
|
|
|
41
43
|
guttersBottom: PropTypes.oneOf(['large', 'medium']),
|
|
42
44
|
multiRow: PropTypes.bool,
|
|
43
45
|
className: PropTypes.string,
|
|
46
|
+
dataAttrs: PropTypes.shape({
|
|
47
|
+
root: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
48
|
+
container: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
49
|
+
}),
|
|
44
50
|
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element.isRequired), PropTypes.element.isRequired]).isRequired
|
|
45
51
|
};
|
|
46
52
|
export default Grid;
|
|
@@ -50,6 +50,10 @@ export interface IGridColumn {
|
|
|
50
50
|
flex?: boolean;
|
|
51
51
|
/** Дополнительный класс корневого элемента */
|
|
52
52
|
className?: string;
|
|
53
|
+
/** Дополнительные data атрибуты к внутренним элементам */
|
|
54
|
+
dataAttrs?: {
|
|
55
|
+
root?: Record<string, string>;
|
|
56
|
+
};
|
|
53
57
|
children: React.ReactNode;
|
|
54
58
|
}
|
|
55
59
|
declare const GridColumn: React.FC<IGridColumn>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
import * as React from 'react';
|
|
2
|
-
import { cnCreate } from '@megafon/ui-helpers';
|
|
3
|
+
import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
|
|
3
4
|
import * as PropTypes from 'prop-types';
|
|
4
5
|
import "./GridColumn.css";
|
|
5
6
|
var GridSizeValues = PropTypes.oneOf(['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12']);
|
|
@@ -38,8 +39,9 @@ var GridColumn = function GridColumn(_ref) {
|
|
|
38
39
|
_ref$grow = _ref.grow,
|
|
39
40
|
grow = _ref$grow === void 0 ? false : _ref$grow,
|
|
40
41
|
align = _ref.align,
|
|
42
|
+
dataAttrs = _ref.dataAttrs,
|
|
41
43
|
children = _ref.children;
|
|
42
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
44
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
43
45
|
className: cn({
|
|
44
46
|
flex: flex,
|
|
45
47
|
grow: grow,
|
|
@@ -65,7 +67,7 @@ var GridColumn = function GridColumn(_ref) {
|
|
|
65
67
|
'right-offset-tablet': rightOffsetTablet,
|
|
66
68
|
'right-offset-mobile': rightOffsetMobile
|
|
67
69
|
}, className)
|
|
68
|
-
}, children);
|
|
70
|
+
}), children);
|
|
69
71
|
};
|
|
70
72
|
|
|
71
73
|
GridColumn.propTypes = {
|
|
@@ -88,6 +90,9 @@ GridColumn.propTypes = {
|
|
|
88
90
|
grow: PropTypes.bool,
|
|
89
91
|
flex: PropTypes.bool,
|
|
90
92
|
className: PropTypes.string,
|
|
93
|
+
dataAttrs: PropTypes.shape({
|
|
94
|
+
root: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
95
|
+
}),
|
|
91
96
|
children: PropTypes.node.isRequired
|
|
92
97
|
};
|
|
93
98
|
export default GridColumn;
|
|
@@ -41,6 +41,15 @@
|
|
|
41
41
|
overflow-y: auto;
|
|
42
42
|
resize: none;
|
|
43
43
|
}
|
|
44
|
+
.mfui-text-field__hidden-textarea {
|
|
45
|
+
position: absolute;
|
|
46
|
+
height: -webkit-min-content;
|
|
47
|
+
height: -moz-min-content;
|
|
48
|
+
height: min-content;
|
|
49
|
+
padding: 0 56px 0 16px;
|
|
50
|
+
word-break: break-all;
|
|
51
|
+
visibility: hidden;
|
|
52
|
+
}
|
|
44
53
|
.mfui-text-field__field_resized {
|
|
45
54
|
-webkit-transition: height 0.1s;
|
|
46
55
|
transition: height 0.1s;
|
|
@@ -88,6 +88,8 @@ export declare type TextFieldProps = {
|
|
|
88
88
|
minTextareaHeight?: MinTextareaHeightType;
|
|
89
89
|
/** Скрывает кнопку ресайза для textarea="flexible" */
|
|
90
90
|
hideResizeButton?: boolean;
|
|
91
|
+
/** Отключает перевод строки по Enter */
|
|
92
|
+
disableEnterLineBreak?: boolean;
|
|
91
93
|
/** Обработчик изменения значения */
|
|
92
94
|
onChange?: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
93
95
|
/** Обработчик изменения значения маскированного инпута до обработки маской */
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import "core-js/modules/es.array.concat";
|
|
2
|
+
import "core-js/modules/es.date.to-string";
|
|
2
3
|
import "core-js/modules/es.function.name";
|
|
4
|
+
import "core-js/modules/es.object.to-string";
|
|
3
5
|
import "core-js/modules/es.object.values";
|
|
4
6
|
import "core-js/modules/es.parse-float";
|
|
5
7
|
import "core-js/modules/es.regexp.exec";
|
|
8
|
+
import "core-js/modules/es.regexp.to-string";
|
|
6
9
|
import "core-js/modules/es.string.replace";
|
|
7
10
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
8
11
|
import _extends from "@babel/runtime/helpers/extends";
|
|
12
|
+
|
|
13
|
+
/* eslint-disable react/no-multi-comp */
|
|
9
14
|
import * as React from 'react';
|
|
10
15
|
import { useCallback, useEffect, useState, useRef, useMemo } from 'react';
|
|
11
|
-
import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
|
|
16
|
+
import { checkEventIsClickOrEnterPress, cnCreate, filterDataAttrs, convert } from '@megafon/ui-helpers';
|
|
12
17
|
import throttle from 'lodash.throttle';
|
|
13
18
|
import * as PropTypes from 'prop-types';
|
|
14
19
|
import InputMask from 'react-input-mask';
|
|
@@ -69,6 +74,13 @@ var DEFAULT_PLACEHOLDERS = {
|
|
|
69
74
|
password: 'Пароль',
|
|
70
75
|
text: 'Текст'
|
|
71
76
|
};
|
|
77
|
+
var converConfig = {
|
|
78
|
+
br: {
|
|
79
|
+
component: function component() {
|
|
80
|
+
return React.createElement('br');
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
};
|
|
72
84
|
export var Verification = {
|
|
73
85
|
VALID: 'valid',
|
|
74
86
|
ERROR: 'error'
|
|
@@ -79,7 +91,7 @@ export var TextareaTypes = {
|
|
|
79
91
|
};
|
|
80
92
|
export var MinTextareaHeight = {
|
|
81
93
|
ONE_ROW: ROW_HEIGHT,
|
|
82
|
-
THREE_ROWS: ROW_HEIGHT *
|
|
94
|
+
THREE_ROWS: ROW_HEIGHT * DEFAULT_ROW_COUNT
|
|
83
95
|
};
|
|
84
96
|
var cn = cnCreate('mfui-text-field');
|
|
85
97
|
|
|
@@ -106,6 +118,8 @@ var TextField = function TextField(_ref) {
|
|
|
106
118
|
isControlled = _ref$isControlled === void 0 ? false : _ref$isControlled,
|
|
107
119
|
_ref$minTextareaHeigh = _ref.minTextareaHeight,
|
|
108
120
|
minTextareaHeight = _ref$minTextareaHeigh === void 0 ? MinTextareaHeight.THREE_ROWS : _ref$minTextareaHeigh,
|
|
121
|
+
_ref$disableEnterLine = _ref.disableEnterLineBreak,
|
|
122
|
+
disableEnterLineBreak = _ref$disableEnterLine === void 0 ? false : _ref$disableEnterLine,
|
|
109
123
|
_ref$hideResizeButton = _ref.hideResizeButton,
|
|
110
124
|
hideResizeButton = _ref$hideResizeButton === void 0 ? false : _ref$hideResizeButton,
|
|
111
125
|
onBlur = _ref.onBlur,
|
|
@@ -142,8 +156,8 @@ var TextField = function TextField(_ref) {
|
|
|
142
156
|
|
|
143
157
|
var _useState5 = useState(minTextareaHeight),
|
|
144
158
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
145
|
-
|
|
146
|
-
|
|
159
|
+
textareaHeight = _useState6[0],
|
|
160
|
+
setTextareaHeight = _useState6[1];
|
|
147
161
|
|
|
148
162
|
var _useState7 = useState(false),
|
|
149
163
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
@@ -166,6 +180,7 @@ var TextField = function TextField(_ref) {
|
|
|
166
180
|
setIsTextareaResized = _useState14[1];
|
|
167
181
|
|
|
168
182
|
var fieldNode = useRef();
|
|
183
|
+
var hiddenElement = useRef(null);
|
|
169
184
|
var labelRef = useRef(null);
|
|
170
185
|
var resizerRef = useRef(null);
|
|
171
186
|
var isPasswordType = useMemo(function () {
|
|
@@ -189,6 +204,15 @@ var TextField = function TextField(_ref) {
|
|
|
189
204
|
|
|
190
205
|
setIsMaxLimitExceeded(symbolCounter < String(textareaValue).length);
|
|
191
206
|
}, [symbolCounter]);
|
|
207
|
+
useEffect(function () {
|
|
208
|
+
if (!hiddenElement.current) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
var hiddenElementHeight = hiddenElement.current.scrollHeight;
|
|
213
|
+
var isHiddenHeightCorrect = hiddenElementHeight >= minTextareaHeight && hiddenElementHeight <= TEXTAREA_MAX_HEIGHT;
|
|
214
|
+
!isTextareaResized && setTextareaHeight(isHiddenHeightCorrect ? hiddenElementHeight : minTextareaHeight);
|
|
215
|
+
}, [hiddenElement, isTextareaResized, minTextareaHeight, inputValue]);
|
|
192
216
|
useEffect(function () {
|
|
193
217
|
!isControlled && setInputValue(value);
|
|
194
218
|
checkSymbolMaxLimit(value);
|
|
@@ -214,7 +238,7 @@ var TextField = function TextField(_ref) {
|
|
|
214
238
|
var currentCoordinateY = moveEvent.clientY || moveEvent.touches[0].clientY;
|
|
215
239
|
var resizeHeight = originalHeight + (currentCoordinateY - originalCoordinateY);
|
|
216
240
|
var updatedHeight = resizeHeight < minTextareaHeight ? minTextareaHeight : resizeHeight;
|
|
217
|
-
|
|
241
|
+
setTextareaHeight(updatedHeight);
|
|
218
242
|
setIsTextareaResized(true);
|
|
219
243
|
}, throttleTime.resizeTextarea);
|
|
220
244
|
|
|
@@ -241,22 +265,7 @@ var TextField = function TextField(_ref) {
|
|
|
241
265
|
});
|
|
242
266
|
}, []);
|
|
243
267
|
|
|
244
|
-
var setTextareaHeight = function setTextareaHeight() {
|
|
245
|
-
if (!(fieldNode === null || fieldNode === void 0 ? void 0 : fieldNode.current) || isTextareaResized) {
|
|
246
|
-
return;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
var scrollHeight = fieldNode.current.scrollHeight;
|
|
250
|
-
var extraRowCount = Math.round((scrollHeight - 28 - minTextareaHeight) / ROW_HEIGHT);
|
|
251
|
-
var newHeight = extraRowCount <= DEFAULT_ROW_COUNT ? minTextareaHeight + ROW_HEIGHT * extraRowCount : TEXTAREA_MAX_HEIGHT;
|
|
252
|
-
setInitialTextareaHeight(newHeight);
|
|
253
|
-
};
|
|
254
|
-
|
|
255
268
|
var handleInputChange = function handleInputChange(e) {
|
|
256
|
-
if (textarea === TextareaTypes.FLEXIBLE) {
|
|
257
|
-
setTextareaHeight();
|
|
258
|
-
}
|
|
259
|
-
|
|
260
269
|
!isControlled && setInputValue(e.target.value);
|
|
261
270
|
checkSymbolMaxLimit(e.target.value);
|
|
262
271
|
onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
@@ -281,6 +290,10 @@ var TextField = function TextField(_ref) {
|
|
|
281
290
|
labelRef.current.style.top = "".concat(DEFAULT_LABEL_TOP_POSITION - scrollTop, "px");
|
|
282
291
|
};
|
|
283
292
|
|
|
293
|
+
var handleTextareaKeyDown = function handleTextareaKeyDown(e) {
|
|
294
|
+
checkEventIsClickOrEnterPress(e) && !e.shiftKey && e.preventDefault();
|
|
295
|
+
};
|
|
296
|
+
|
|
284
297
|
var handleIconClick = useCallback(function (e) {
|
|
285
298
|
var isClearFuncAvailable = !customIcon && !onCustomIconClick && hasClearIcon;
|
|
286
299
|
var field = fieldNode.current;
|
|
@@ -393,13 +406,23 @@ var TextField = function TextField(_ref) {
|
|
|
393
406
|
};
|
|
394
407
|
|
|
395
408
|
var renderTextarea = function renderTextarea() {
|
|
409
|
+
var _a;
|
|
410
|
+
|
|
411
|
+
var hiddenValue = inputValue === null || inputValue === void 0 ? void 0 : inputValue.toString().replace(/[\r\n]/g, '<br/>');
|
|
396
412
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("textarea", _extends({}, textareaParams, {
|
|
397
|
-
onScroll: handleTextareaScroll,
|
|
398
413
|
style: {
|
|
399
|
-
height: "".concat(
|
|
414
|
+
height: "".concat(textareaHeight, "px")
|
|
400
415
|
},
|
|
401
|
-
ref: getFieldNode
|
|
402
|
-
|
|
416
|
+
ref: getFieldNode,
|
|
417
|
+
onKeyDown: disableEnterLineBreak ? handleTextareaKeyDown : undefined,
|
|
418
|
+
onScroll: handleTextareaScroll
|
|
419
|
+
})), !!hiddenValue && /*#__PURE__*/React.createElement("div", {
|
|
420
|
+
className: cn('hidden-textarea'),
|
|
421
|
+
ref: hiddenElement,
|
|
422
|
+
style: {
|
|
423
|
+
width: (_a = fieldNode.current) === null || _a === void 0 ? void 0 : _a.scrollWidth
|
|
424
|
+
}
|
|
425
|
+
}, convert(hiddenValue, converConfig), "."), renderLabel());
|
|
403
426
|
};
|
|
404
427
|
|
|
405
428
|
var renderIconBlock = function renderIconBlock() {
|
|
@@ -496,6 +519,7 @@ TextField.propTypes = {
|
|
|
496
519
|
className: PropTypes.string,
|
|
497
520
|
minTextareaHeight: PropTypes.oneOf([24, 72]),
|
|
498
521
|
hideResizeButton: PropTypes.bool,
|
|
522
|
+
disableEnterLineBreak: PropTypes.bool,
|
|
499
523
|
onChange: PropTypes.func,
|
|
500
524
|
onBeforeMaskChange: PropTypes.func,
|
|
501
525
|
onBlur: PropTypes.func,
|
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
transition-duration: 0.3s;
|
|
7
7
|
-webkit-transition-property: opacity, visibility;
|
|
8
8
|
transition-property: opacity, visibility;
|
|
9
|
-
font-size: 12px;
|
|
10
|
-
line-height: 18px;
|
|
11
9
|
pointer-events: none;
|
|
12
10
|
}
|
|
13
11
|
.mfui-tooltip_open {
|
|
@@ -24,6 +22,18 @@
|
|
|
24
22
|
.mfui-tooltip__content {
|
|
25
23
|
position: relative;
|
|
26
24
|
z-index: 1;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
}
|
|
27
|
+
.mfui-tooltip__content-shadow {
|
|
28
|
+
position: absolute;
|
|
29
|
+
top: 0;
|
|
30
|
+
right: 0;
|
|
31
|
+
bottom: 0;
|
|
32
|
+
left: 0;
|
|
33
|
+
z-index: -1;
|
|
34
|
+
}
|
|
35
|
+
.mfui-tooltip__top,
|
|
36
|
+
.mfui-tooltip__main-content {
|
|
27
37
|
display: -webkit-box;
|
|
28
38
|
display: -ms-flexbox;
|
|
29
39
|
display: flex;
|
|
@@ -33,24 +43,33 @@
|
|
|
33
43
|
flex-direction: column;
|
|
34
44
|
gap: 8px;
|
|
35
45
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
46
|
+
@media screen and (min-width: 768px) {
|
|
47
|
+
.mfui-tooltip__top {
|
|
48
|
+
gap: 12px;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
.mfui-tooltip__top_margin {
|
|
52
|
+
margin-bottom: 16px;
|
|
43
53
|
}
|
|
44
54
|
.mfui-tooltip__arrow-container {
|
|
45
55
|
position: absolute;
|
|
46
56
|
}
|
|
47
57
|
.mfui-tooltip__arrow-wrap {
|
|
48
|
-
width:
|
|
49
|
-
height:
|
|
58
|
+
width: 33px;
|
|
59
|
+
height: 13px;
|
|
50
60
|
}
|
|
51
61
|
.mfui-tooltip__arrow {
|
|
52
|
-
width:
|
|
53
|
-
height:
|
|
62
|
+
width: 33px;
|
|
63
|
+
height: 13px;
|
|
64
|
+
position: absolute;
|
|
65
|
+
display: -webkit-box;
|
|
66
|
+
display: -ms-flexbox;
|
|
67
|
+
display: flex;
|
|
68
|
+
-webkit-box-pack: center;
|
|
69
|
+
-ms-flex-pack: center;
|
|
70
|
+
justify-content: center;
|
|
71
|
+
}
|
|
72
|
+
.mfui-tooltip__arrow svg {
|
|
54
73
|
position: absolute;
|
|
55
74
|
}
|
|
56
75
|
.mfui-tooltip__arrow-inner {
|
|
@@ -59,8 +78,24 @@
|
|
|
59
78
|
fill: var(--base);
|
|
60
79
|
}
|
|
61
80
|
.mfui-tooltip__text {
|
|
62
|
-
font-size:
|
|
63
|
-
line-height:
|
|
81
|
+
font-size: 15px;
|
|
82
|
+
line-height: 24px;
|
|
83
|
+
}
|
|
84
|
+
@media screen and (max-width: 767px) {
|
|
85
|
+
.mfui-tooltip__text {
|
|
86
|
+
font-size: 12px;
|
|
87
|
+
line-height: 18px;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
.mfui-tooltip__bottom {
|
|
91
|
+
display: -webkit-box;
|
|
92
|
+
display: -ms-flexbox;
|
|
93
|
+
display: flex;
|
|
94
|
+
-webkit-box-orient: vertical;
|
|
95
|
+
-webkit-box-direction: normal;
|
|
96
|
+
-ms-flex-direction: column;
|
|
97
|
+
flex-direction: column;
|
|
98
|
+
gap: 16px;
|
|
64
99
|
}
|
|
65
100
|
.mfui-tooltip__button,
|
|
66
101
|
.mfui-tooltip__close-button {
|
|
@@ -80,12 +115,18 @@
|
|
|
80
115
|
font-family: inherit;
|
|
81
116
|
color: var(--brandGreen);
|
|
82
117
|
font-weight: 500;
|
|
83
|
-
font-size:
|
|
84
|
-
line-height:
|
|
118
|
+
font-size: 15px;
|
|
119
|
+
line-height: 18px;
|
|
85
120
|
background-color: transparent;
|
|
86
121
|
-webkit-transition: 300ms;
|
|
87
122
|
transition: 300ms;
|
|
88
123
|
}
|
|
124
|
+
@media screen and (max-width: 767px) {
|
|
125
|
+
.mfui-tooltip__button {
|
|
126
|
+
font-size: 12px;
|
|
127
|
+
line-height: 14px;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
89
130
|
.mfui-tooltip__button:hover {
|
|
90
131
|
color: var(--buttonHoverGreen);
|
|
91
132
|
}
|
|
@@ -99,15 +140,15 @@
|
|
|
99
140
|
fill: var(--buttonDown);
|
|
100
141
|
}
|
|
101
142
|
.mfui-tooltip__close-button {
|
|
102
|
-
position:
|
|
103
|
-
top:
|
|
104
|
-
right:
|
|
143
|
+
position: relative;
|
|
144
|
+
top: -6px;
|
|
145
|
+
right: -6px;
|
|
105
146
|
-webkit-box-pack: center;
|
|
106
147
|
-ms-flex-pack: center;
|
|
107
148
|
justify-content: center;
|
|
149
|
+
float: right;
|
|
108
150
|
width: 24px;
|
|
109
151
|
height: 24px;
|
|
110
|
-
margin-left: 24px;
|
|
111
152
|
border-radius: 12px;
|
|
112
153
|
background-color: var(--spbSky0);
|
|
113
154
|
-webkit-transition: 300ms;
|
|
@@ -140,9 +181,9 @@
|
|
|
140
181
|
display: -ms-flexbox;
|
|
141
182
|
display: flex;
|
|
142
183
|
-webkit-box-orient: horizontal;
|
|
143
|
-
-webkit-box-direction:
|
|
144
|
-
-ms-flex-direction: row;
|
|
145
|
-
flex-direction: row;
|
|
184
|
+
-webkit-box-direction: reverse;
|
|
185
|
+
-ms-flex-direction: row-reverse;
|
|
186
|
+
flex-direction: row-reverse;
|
|
146
187
|
gap: 18px;
|
|
147
188
|
-webkit-box-align: center;
|
|
148
189
|
-ms-flex-align: center;
|
|
@@ -152,8 +193,7 @@
|
|
|
152
193
|
font-weight: 500;
|
|
153
194
|
}
|
|
154
195
|
.mfui-tooltip_small .mfui-tooltip__close-button {
|
|
155
|
-
|
|
156
|
-
margin-left: 0;
|
|
196
|
+
top: auto;
|
|
157
197
|
}
|
|
158
198
|
.mfui-tooltip_theme_red .mfui-tooltip__content,
|
|
159
199
|
.mfui-tooltip_theme_blue .mfui-tooltip__content,
|
|
@@ -218,17 +258,19 @@
|
|
|
218
258
|
.mfui-tooltip_theme_blue .mfui-tooltip__arrow-inner {
|
|
219
259
|
fill: var(--reflexBlue80);
|
|
220
260
|
}
|
|
221
|
-
.mfui-tooltip[data-popper-placement='right'] .mfui-
|
|
222
|
-
.mfui-tooltip[data-popper-placement='right-start'] .mfui-
|
|
223
|
-
.mfui-tooltip[data-popper-placement='right-end'] .mfui-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
261
|
+
.mfui-tooltip[data-popper-placement='right'] .mfui-tooltip__content,
|
|
262
|
+
.mfui-tooltip[data-popper-placement='right-start'] .mfui-tooltip__content,
|
|
263
|
+
.mfui-tooltip[data-popper-placement='right-end'] .mfui-tooltip__content,
|
|
264
|
+
.mfui-tooltip[data-popper-placement='right'] .mfui-tooltip__content-shadow,
|
|
265
|
+
.mfui-tooltip[data-popper-placement='right-start'] .mfui-tooltip__content-shadow,
|
|
266
|
+
.mfui-tooltip[data-popper-placement='right-end'] .mfui-tooltip__content-shadow {
|
|
267
|
+
-webkit-transform: translateX(24px);
|
|
268
|
+
transform: translateX(24px);
|
|
227
269
|
}
|
|
228
270
|
.mfui-tooltip[data-popper-placement='right'] .mfui-tooltip__arrow-wrap,
|
|
229
271
|
.mfui-tooltip[data-popper-placement='right-start'] .mfui-tooltip__arrow-wrap,
|
|
230
272
|
.mfui-tooltip[data-popper-placement='right-end'] .mfui-tooltip__arrow-wrap {
|
|
231
|
-
left:
|
|
273
|
+
left: 3px;
|
|
232
274
|
}
|
|
233
275
|
.mfui-tooltip[data-popper-placement='right'] .mfui-tooltip__arrow,
|
|
234
276
|
.mfui-tooltip[data-popper-placement='right-start'] .mfui-tooltip__arrow,
|
|
@@ -239,17 +281,19 @@
|
|
|
239
281
|
-webkit-transform: rotate(-90deg);
|
|
240
282
|
transform: rotate(-90deg);
|
|
241
283
|
}
|
|
242
|
-
.mfui-tooltip[data-popper-placement='left'] .mfui-
|
|
243
|
-
.mfui-tooltip[data-popper-placement='left-start'] .mfui-
|
|
244
|
-
.mfui-tooltip[data-popper-placement='left-end'] .mfui-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
284
|
+
.mfui-tooltip[data-popper-placement='left'] .mfui-tooltip__content,
|
|
285
|
+
.mfui-tooltip[data-popper-placement='left-start'] .mfui-tooltip__content,
|
|
286
|
+
.mfui-tooltip[data-popper-placement='left-end'] .mfui-tooltip__content,
|
|
287
|
+
.mfui-tooltip[data-popper-placement='left'] .mfui-tooltip__content-shadow,
|
|
288
|
+
.mfui-tooltip[data-popper-placement='left-start'] .mfui-tooltip__content-shadow,
|
|
289
|
+
.mfui-tooltip[data-popper-placement='left-end'] .mfui-tooltip__content-shadow {
|
|
290
|
+
-webkit-transform: translateX(-24px);
|
|
291
|
+
transform: translateX(-24px);
|
|
248
292
|
}
|
|
249
293
|
.mfui-tooltip[data-popper-placement='left'] .mfui-tooltip__arrow-wrap,
|
|
250
294
|
.mfui-tooltip[data-popper-placement='left-start'] .mfui-tooltip__arrow-wrap,
|
|
251
295
|
.mfui-tooltip[data-popper-placement='left-end'] .mfui-tooltip__arrow-wrap {
|
|
252
|
-
right:
|
|
296
|
+
right: 3px;
|
|
253
297
|
}
|
|
254
298
|
.mfui-tooltip[data-popper-placement='left'] .mfui-tooltip__arrow,
|
|
255
299
|
.mfui-tooltip[data-popper-placement='left-start'] .mfui-tooltip__arrow,
|
|
@@ -260,17 +304,19 @@
|
|
|
260
304
|
-webkit-transform: rotate(90deg);
|
|
261
305
|
transform: rotate(90deg);
|
|
262
306
|
}
|
|
263
|
-
.mfui-tooltip[data-popper-placement='top'] .mfui-
|
|
264
|
-
.mfui-tooltip[data-popper-placement='top-start'] .mfui-
|
|
265
|
-
.mfui-tooltip[data-popper-placement='top-end'] .mfui-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
307
|
+
.mfui-tooltip[data-popper-placement='top'] .mfui-tooltip__content,
|
|
308
|
+
.mfui-tooltip[data-popper-placement='top-start'] .mfui-tooltip__content,
|
|
309
|
+
.mfui-tooltip[data-popper-placement='top-end'] .mfui-tooltip__content,
|
|
310
|
+
.mfui-tooltip[data-popper-placement='top'] .mfui-tooltip__content-shadow,
|
|
311
|
+
.mfui-tooltip[data-popper-placement='top-start'] .mfui-tooltip__content-shadow,
|
|
312
|
+
.mfui-tooltip[data-popper-placement='top-end'] .mfui-tooltip__content-shadow {
|
|
313
|
+
-webkit-transform: translateY(-24px);
|
|
314
|
+
transform: translateY(-24px);
|
|
269
315
|
}
|
|
270
316
|
.mfui-tooltip[data-popper-placement='top'] .mfui-tooltip__arrow-wrap,
|
|
271
317
|
.mfui-tooltip[data-popper-placement='top-start'] .mfui-tooltip__arrow-wrap,
|
|
272
318
|
.mfui-tooltip[data-popper-placement='top-end'] .mfui-tooltip__arrow-wrap {
|
|
273
|
-
|
|
319
|
+
bottom: 13px;
|
|
274
320
|
}
|
|
275
321
|
.mfui-tooltip[data-popper-placement='top'] .mfui-tooltip__arrow,
|
|
276
322
|
.mfui-tooltip[data-popper-placement='top-start'] .mfui-tooltip__arrow,
|
|
@@ -281,12 +327,19 @@
|
|
|
281
327
|
-webkit-transform: rotate(180deg);
|
|
282
328
|
transform: rotate(180deg);
|
|
283
329
|
}
|
|
284
|
-
.mfui-tooltip[data-popper-placement='bottom'] .mfui-
|
|
285
|
-
.mfui-tooltip[data-popper-placement='bottom-start'] .mfui-
|
|
286
|
-
.mfui-tooltip[data-popper-placement='bottom-end'] .mfui-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
330
|
+
.mfui-tooltip[data-popper-placement='bottom'] .mfui-tooltip__content,
|
|
331
|
+
.mfui-tooltip[data-popper-placement='bottom-start'] .mfui-tooltip__content,
|
|
332
|
+
.mfui-tooltip[data-popper-placement='bottom-end'] .mfui-tooltip__content,
|
|
333
|
+
.mfui-tooltip[data-popper-placement='bottom'] .mfui-tooltip__content-shadow,
|
|
334
|
+
.mfui-tooltip[data-popper-placement='bottom-start'] .mfui-tooltip__content-shadow,
|
|
335
|
+
.mfui-tooltip[data-popper-placement='bottom-end'] .mfui-tooltip__content-shadow {
|
|
336
|
+
-webkit-transform: translateY(24px);
|
|
337
|
+
transform: translateY(24px);
|
|
338
|
+
}
|
|
339
|
+
.mfui-tooltip[data-popper-placement='bottom'] .mfui-tooltip__arrow-wrap,
|
|
340
|
+
.mfui-tooltip[data-popper-placement='bottom-start'] .mfui-tooltip__arrow-wrap,
|
|
341
|
+
.mfui-tooltip[data-popper-placement='bottom-end'] .mfui-tooltip__arrow-wrap {
|
|
342
|
+
top: 13px;
|
|
290
343
|
}
|
|
291
344
|
.mfui-tooltip[data-popper-escaped='true'].mfui-tooltip_has-escape {
|
|
292
345
|
visibility: hidden;
|