@megafon/ui-core 4.0.0-beta.8 → 4.0.1
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 +72 -14
- package/dist/es/components/Accordion/Accordion.css +6 -4
- package/dist/es/components/Badges/components/PromoBadge/PromoBadge.css +4 -0
- package/dist/es/components/Badges/components/PromoBadge/PromoBadge.d.ts +1 -0
- package/dist/es/components/Badges/components/PromoBadge/PromoBadge.js +2 -1
- package/dist/es/components/Banner/Banner.css +3 -0
- package/dist/es/components/Banner/Banner.d.ts +2 -0
- package/dist/es/components/Banner/Banner.js +5 -1
- package/dist/es/components/Carousel/Carousel.d.ts +2 -0
- package/dist/es/components/Carousel/Carousel.js +7 -2
- package/dist/es/components/ContentArea/ContentArea.css +0 -10
- package/dist/es/components/ContentArea/ContentArea.d.ts +0 -1
- package/dist/es/components/ContentArea/ContentArea.js +1 -3
- package/dist/es/components/Header/Header.d.ts +1 -1
- package/dist/es/components/Header/Header.js +4 -4
- package/dist/es/components/List/List.d.ts +1 -1
- package/dist/es/components/List/List.js +3 -3
- package/dist/es/components/Notification/Notification.css +20 -7
- package/dist/es/components/Search/Search.css +24 -4
- package/dist/es/components/Search/Search.d.ts +6 -0
- package/dist/es/components/Search/Search.js +12 -3
- package/dist/es/components/Select/Select.css +50 -33
- package/dist/es/components/Select/Select.d.ts +7 -0
- package/dist/es/components/Select/Select.js +14 -5
- package/dist/es/components/Tabs/Tabs.css +12 -1
- package/dist/es/components/Tabs/Tabs.d.ts +3 -3
- package/dist/es/components/Tabs/Tabs.js +8 -6
- package/dist/es/components/TextField/TextField.css +33 -20
- package/dist/es/components/TextField/TextField.d.ts +2 -0
- package/dist/es/components/TextField/TextField.js +14 -9
- package/dist/lib/components/Accordion/Accordion.css +6 -4
- package/dist/lib/components/Badges/components/PromoBadge/PromoBadge.css +4 -0
- package/dist/lib/components/Badges/components/PromoBadge/PromoBadge.d.ts +1 -0
- package/dist/lib/components/Badges/components/PromoBadge/PromoBadge.js +2 -1
- package/dist/lib/components/Banner/Banner.css +3 -0
- package/dist/lib/components/Banner/Banner.d.ts +2 -0
- package/dist/lib/components/Banner/Banner.js +5 -1
- package/dist/lib/components/Carousel/Carousel.d.ts +2 -0
- package/dist/lib/components/Carousel/Carousel.js +7 -2
- package/dist/lib/components/ContentArea/ContentArea.css +0 -10
- package/dist/lib/components/ContentArea/ContentArea.d.ts +0 -1
- package/dist/lib/components/ContentArea/ContentArea.js +1 -3
- package/dist/lib/components/Header/Header.d.ts +1 -1
- package/dist/lib/components/Header/Header.js +4 -4
- package/dist/lib/components/List/List.d.ts +1 -1
- package/dist/lib/components/List/List.js +3 -3
- package/dist/lib/components/Notification/Notification.css +20 -7
- package/dist/lib/components/Search/Search.css +24 -4
- package/dist/lib/components/Search/Search.d.ts +6 -0
- package/dist/lib/components/Search/Search.js +15 -4
- package/dist/lib/components/Select/Select.css +50 -33
- package/dist/lib/components/Select/Select.d.ts +7 -0
- package/dist/lib/components/Select/Select.js +16 -6
- package/dist/lib/components/Tabs/Tabs.css +12 -1
- package/dist/lib/components/Tabs/Tabs.d.ts +3 -3
- package/dist/lib/components/Tabs/Tabs.js +10 -8
- package/dist/lib/components/TextField/TextField.css +33 -20
- package/dist/lib/components/TextField/TextField.d.ts +2 -0
- package/dist/lib/components/TextField/TextField.js +14 -9
- package/package.json +3 -3
|
@@ -5,7 +5,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports["default"] = exports.SelectTypes = exports.Verification = void 0;
|
|
8
|
+
exports["default"] = exports.SelectTypes = exports.Verification = exports.SelectItemsPaddings = void 0;
|
|
9
9
|
|
|
10
10
|
require("core-js/modules/es.array.concat");
|
|
11
11
|
|
|
@@ -58,6 +58,11 @@ var UPDATE_ITEMS_LIST = _selectReducer.SelectActions.UPDATE_ITEMS_LIST,
|
|
|
58
58
|
TOGGLE_DROPDOWN = _selectReducer.SelectActions.TOGGLE_DROPDOWN,
|
|
59
59
|
UPDATE_SELECT_VALUE = _selectReducer.SelectActions.UPDATE_SELECT_VALUE,
|
|
60
60
|
SET_HOVERED_ITEM_INDEX = _selectReducer.SelectActions.SET_HOVERED_ITEM_INDEX;
|
|
61
|
+
var SelectItemsPaddings = {
|
|
62
|
+
SMALL: 'small',
|
|
63
|
+
LARGE: 'large'
|
|
64
|
+
};
|
|
65
|
+
exports.SelectItemsPaddings = SelectItemsPaddings;
|
|
61
66
|
var Verification = {
|
|
62
67
|
VALID: 'valid',
|
|
63
68
|
ERROR: 'error'
|
|
@@ -77,6 +82,7 @@ var SelectTypes = {
|
|
|
77
82
|
// - Opened dropdown could be closed only via value choose, click outside of select and on TAB press.
|
|
78
83
|
// - Should add event listener for outside of dropdown click on list open and remove it on list close.
|
|
79
84
|
// - onClose callback shouldn't fire multiple times on outside click if dropdown was opened multiple times.
|
|
85
|
+
// - If item with currentValue is not found in items, input value will not be displayed
|
|
80
86
|
|
|
81
87
|
exports.SelectTypes = SelectTypes;
|
|
82
88
|
var cn = (0, _uiHelpers.cnCreate)('mfui-select');
|
|
@@ -384,7 +390,7 @@ var Select = function Select(_ref) {
|
|
|
384
390
|
onClick: handleSelectClick
|
|
385
391
|
}), /*#__PURE__*/React.createElement("div", {
|
|
386
392
|
className: cn('title-inner', {
|
|
387
|
-
|
|
393
|
+
'hide-value': !item
|
|
388
394
|
}, [classes === null || classes === void 0 ? void 0 : classes.titleInner])
|
|
389
395
|
}, /*#__PURE__*/React.createElement("div", {
|
|
390
396
|
className: cn('title-value')
|
|
@@ -394,7 +400,7 @@ var Select = function Select(_ref) {
|
|
|
394
400
|
var renderCombobox = function renderCombobox() {
|
|
395
401
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("input", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.input), {
|
|
396
402
|
className: cn('combobox', {
|
|
397
|
-
|
|
403
|
+
'hide-value': !inputValue
|
|
398
404
|
}),
|
|
399
405
|
onFocus: handleComboboxFocus,
|
|
400
406
|
onChange: handleChangeCombobox,
|
|
@@ -414,11 +420,14 @@ var Select = function Select(_ref) {
|
|
|
414
420
|
}, currentItems.map(function (_ref3, i) {
|
|
415
421
|
var title = _ref3.title,
|
|
416
422
|
value = _ref3.value,
|
|
417
|
-
view = _ref3.view
|
|
423
|
+
view = _ref3.view,
|
|
424
|
+
_ref3$paddings = _ref3.paddings,
|
|
425
|
+
paddings = _ref3$paddings === void 0 ? SelectItemsPaddings.LARGE : _ref3$paddings;
|
|
418
426
|
var isItemActive = currentValue === value;
|
|
419
427
|
return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.listItem, i + 1), {
|
|
420
428
|
className: cn('list-item', {
|
|
421
|
-
hovered: hoveredItemIndex === i
|
|
429
|
+
hovered: hoveredItemIndex === i,
|
|
430
|
+
paddings: paddings
|
|
422
431
|
}, [classes.listItem]),
|
|
423
432
|
key: "".concat(i, "_").concat(value),
|
|
424
433
|
onClick: handleSelectItem,
|
|
@@ -493,7 +502,8 @@ Select.propTypes = {
|
|
|
493
502
|
view: PropTypes.oneOfType([PropTypes.string, PropTypes.element, PropTypes.func]),
|
|
494
503
|
selectedView: PropTypes.oneOfType([PropTypes.string, PropTypes.element, PropTypes.func]),
|
|
495
504
|
title: PropTypes.string.isRequired,
|
|
496
|
-
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired
|
|
505
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
|
506
|
+
paddings: PropTypes.oneOf(Object.values(SelectItemsPaddings))
|
|
497
507
|
})).isRequired,
|
|
498
508
|
onSelect: PropTypes.func,
|
|
499
509
|
onOpened: PropTypes.func,
|
|
@@ -6,10 +6,19 @@
|
|
|
6
6
|
display: flex;
|
|
7
7
|
width: 100%;
|
|
8
8
|
}
|
|
9
|
+
.mfui-tabs__wrapper {
|
|
10
|
+
display: -webkit-box;
|
|
11
|
+
display: -ms-flexbox;
|
|
12
|
+
display: flex;
|
|
13
|
+
-webkit-box-pack: center;
|
|
14
|
+
-ms-flex-pack: center;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
}
|
|
9
17
|
.mfui-tabs__swiper-wrapper {
|
|
10
18
|
display: -webkit-box;
|
|
11
19
|
display: -ms-flexbox;
|
|
12
20
|
display: flex;
|
|
21
|
+
width: 100%;
|
|
13
22
|
}
|
|
14
23
|
.mfui-tabs__swiper {
|
|
15
24
|
font-family: inherit;
|
|
@@ -83,7 +92,7 @@
|
|
|
83
92
|
width: 16px;
|
|
84
93
|
height: 16px;
|
|
85
94
|
border-radius: 50%;
|
|
86
|
-
background-color: var(--
|
|
95
|
+
background-color: var(--content);
|
|
87
96
|
-webkit-transform: translateY(-50%);
|
|
88
97
|
transform: translateY(-50%);
|
|
89
98
|
cursor: pointer;
|
|
@@ -131,6 +140,8 @@
|
|
|
131
140
|
-webkit-box-pack: center;
|
|
132
141
|
-ms-flex-pack: center;
|
|
133
142
|
justify-content: center;
|
|
143
|
+
-webkit-box-sizing: border-box;
|
|
144
|
+
box-sizing: border-box;
|
|
134
145
|
height: 36px;
|
|
135
146
|
padding: 2px 12px;
|
|
136
147
|
color: var(--spbSky3);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import './Tabs.less';
|
|
3
3
|
import { ITabProps } from './Tab';
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const TabAlign: {
|
|
5
5
|
readonly LEFT: "left";
|
|
6
6
|
readonly CENTER: "center";
|
|
7
7
|
};
|
|
@@ -15,7 +15,7 @@ export declare const TabColorTheme: {
|
|
|
15
15
|
};
|
|
16
16
|
declare type TabSizeType = typeof TabSize[keyof typeof TabSize];
|
|
17
17
|
declare type TabColorThemeType = typeof TabColorTheme[keyof typeof TabColorTheme];
|
|
18
|
-
declare type
|
|
18
|
+
declare type TabAlignType = typeof TabAlign[keyof typeof TabAlign];
|
|
19
19
|
export interface ITabsProps {
|
|
20
20
|
/** Дополнительный класс для корневого элемента */
|
|
21
21
|
className?: string;
|
|
@@ -41,7 +41,7 @@ export interface ITabsProps {
|
|
|
41
41
|
/** Ширина табов по размеру содержимого */
|
|
42
42
|
autoWidth?: boolean;
|
|
43
43
|
/** Горизонтальное выравнивание (только для autoWidth = true) */
|
|
44
|
-
|
|
44
|
+
align?: TabAlignType;
|
|
45
45
|
/** Фиксация табов у верхней границы окна */
|
|
46
46
|
sticky?: boolean;
|
|
47
47
|
/** Индекс активного таба (включает режим управления табами снаружи) */
|
|
@@ -5,7 +5,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports["default"] = exports.TabColorTheme = exports.TabSize = exports.
|
|
8
|
+
exports["default"] = exports.TabColorTheme = exports.TabSize = exports.TabAlign = void 0;
|
|
9
9
|
|
|
10
10
|
require("core-js/modules/es.array.for-each");
|
|
11
11
|
|
|
@@ -49,11 +49,11 @@ var ArrowLeft = function ArrowLeft(props) {
|
|
|
49
49
|
}));
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
var
|
|
52
|
+
var TabAlign = {
|
|
53
53
|
LEFT: 'left',
|
|
54
54
|
CENTER: 'center'
|
|
55
55
|
};
|
|
56
|
-
exports.
|
|
56
|
+
exports.TabAlign = TabAlign;
|
|
57
57
|
var TabSize = {
|
|
58
58
|
MEDIUM: 'medium',
|
|
59
59
|
LARGE: 'large'
|
|
@@ -80,8 +80,8 @@ var Tabs = function Tabs(_ref) {
|
|
|
80
80
|
tabColorTheme = _ref$tabColorTheme === void 0 ? 'white' : _ref$tabColorTheme,
|
|
81
81
|
_ref$sticky = _ref.sticky,
|
|
82
82
|
sticky = _ref$sticky === void 0 ? false : _ref$sticky,
|
|
83
|
-
_ref$
|
|
84
|
-
|
|
83
|
+
_ref$align = _ref.align,
|
|
84
|
+
align = _ref$align === void 0 ? 'left' : _ref$align,
|
|
85
85
|
_ref$defaultIndex = _ref.defaultIndex,
|
|
86
86
|
defaultIndex = _ref$defaultIndex === void 0 ? 0 : _ref$defaultIndex,
|
|
87
87
|
outerIndex = _ref.currentIndex,
|
|
@@ -108,7 +108,7 @@ var Tabs = function Tabs(_ref) {
|
|
|
108
108
|
isBeginning = _React$useState4[0],
|
|
109
109
|
setBeginning = _React$useState4[1];
|
|
110
110
|
|
|
111
|
-
var _React$useState5 = React.useState(
|
|
111
|
+
var _React$useState5 = React.useState(true),
|
|
112
112
|
_React$useState6 = (0, _slicedToArray2["default"])(_React$useState5, 2),
|
|
113
113
|
isEnd = _React$useState6[0],
|
|
114
114
|
setEnd = _React$useState6[1];
|
|
@@ -392,13 +392,14 @@ var Tabs = function Tabs(_ref) {
|
|
|
392
392
|
className: cn({
|
|
393
393
|
size: size,
|
|
394
394
|
'tab-color': tabColorTheme,
|
|
395
|
-
'h-align':
|
|
395
|
+
'h-align': align,
|
|
396
396
|
indents: !innerIndentsClass,
|
|
397
397
|
sticky: isSticky,
|
|
398
398
|
'auto-width': autoWidth
|
|
399
399
|
}, [className, rootClass]),
|
|
400
400
|
ref: rootRef
|
|
401
401
|
}), /*#__PURE__*/React.createElement("div", {
|
|
402
|
+
className: cn('wrapper'),
|
|
402
403
|
ref: tabListRef,
|
|
403
404
|
style: {
|
|
404
405
|
height: tabListHeight
|
|
@@ -415,6 +416,7 @@ var Tabs = function Tabs(_ref) {
|
|
|
415
416
|
beginning: isBeginning,
|
|
416
417
|
end: isEnd
|
|
417
418
|
}, [innerIndentsClass]),
|
|
419
|
+
watchOverflow: true,
|
|
418
420
|
slidesPerView: "auto",
|
|
419
421
|
initialSlide: currentIndex,
|
|
420
422
|
onSwiper: handleSwiper,
|
|
@@ -460,7 +462,7 @@ Tabs.propTypes = {
|
|
|
460
462
|
next: _propTypes["default"].objectOf(_propTypes["default"].string.isRequired)
|
|
461
463
|
}),
|
|
462
464
|
size: _propTypes["default"].oneOf(Object.values(TabSize)),
|
|
463
|
-
|
|
465
|
+
align: _propTypes["default"].oneOf(Object.values(TabAlign)),
|
|
464
466
|
autoWidth: _propTypes["default"].bool,
|
|
465
467
|
tabColorTheme: _propTypes["default"].oneOf(Object.values(TabColorTheme)),
|
|
466
468
|
sticky: _propTypes["default"].bool,
|
|
@@ -113,6 +113,21 @@
|
|
|
113
113
|
.mfui-text-field__field:focus::-webkit-input-placeholder {
|
|
114
114
|
opacity: 1;
|
|
115
115
|
}
|
|
116
|
+
.mfui-text-field__field:focus:-moz-placeholder {
|
|
117
|
+
opacity: 1;
|
|
118
|
+
}
|
|
119
|
+
.mfui-text-field__field:focus:-ms-input-placeholder {
|
|
120
|
+
opacity: 1;
|
|
121
|
+
}
|
|
122
|
+
.mfui-text-field__field:focus::-moz-placeholder {
|
|
123
|
+
opacity: 1;
|
|
124
|
+
}
|
|
125
|
+
.mfui-text-field__field:focus::-ms-input-placeholder {
|
|
126
|
+
opacity: 1;
|
|
127
|
+
}
|
|
128
|
+
.mfui-text-field__field:focus::placeholder {
|
|
129
|
+
opacity: 1;
|
|
130
|
+
}
|
|
116
131
|
.mfui-text-field__field::-webkit-scrollbar {
|
|
117
132
|
width: 16px;
|
|
118
133
|
}
|
|
@@ -125,12 +140,6 @@
|
|
|
125
140
|
.mfui-text-field__field::-webkit-scrollbar-thumb:hover {
|
|
126
141
|
background-color: #999999;
|
|
127
142
|
}
|
|
128
|
-
.mfui-text-field__field:focus:-moz-placeholder {
|
|
129
|
-
opacity: 1;
|
|
130
|
-
}
|
|
131
|
-
.mfui-text-field__field:focus:-ms-input-placeholder {
|
|
132
|
-
opacity: 1;
|
|
133
|
-
}
|
|
134
143
|
.mfui-text-field__label {
|
|
135
144
|
position: absolute;
|
|
136
145
|
top: 18px;
|
|
@@ -152,7 +161,8 @@
|
|
|
152
161
|
top: 16px;
|
|
153
162
|
}
|
|
154
163
|
.mfui-text-field__field:focus ~ .mfui-text-field__label,
|
|
155
|
-
.mfui-text-field__field:not(:placeholder-shown) ~ .mfui-text-field__label
|
|
164
|
+
.mfui-text-field__field:not(:placeholder-shown) ~ .mfui-text-field__label,
|
|
165
|
+
.mfui-text-field__field:-webkit-autofill ~ .mfui-text-field__label {
|
|
156
166
|
-webkit-transform: scale(0.8) translate(-11%, -75%);
|
|
157
167
|
transform: scale(0.8) translate(-11%, -75%);
|
|
158
168
|
-webkit-transition-duration: 0.2s, 0.01s;
|
|
@@ -170,6 +180,19 @@
|
|
|
170
180
|
display: flex;
|
|
171
181
|
overflow: hidden;
|
|
172
182
|
}
|
|
183
|
+
.mfui-text-field__field-bottom-wrapper {
|
|
184
|
+
display: -webkit-box;
|
|
185
|
+
display: -ms-flexbox;
|
|
186
|
+
display: flex;
|
|
187
|
+
margin-top: 0;
|
|
188
|
+
overflow: hidden;
|
|
189
|
+
color: var(--spbSky3);
|
|
190
|
+
font-size: 12px;
|
|
191
|
+
line-height: 18px;
|
|
192
|
+
}
|
|
193
|
+
.mfui-text-field__field-bottom-wrapper_filled {
|
|
194
|
+
margin-top: 8px;
|
|
195
|
+
}
|
|
173
196
|
.mfui-text-field__notice-text {
|
|
174
197
|
height: 0;
|
|
175
198
|
opacity: 0;
|
|
@@ -179,7 +202,7 @@
|
|
|
179
202
|
transition-duration: 0.3s;
|
|
180
203
|
}
|
|
181
204
|
.mfui-text-field__notice-text_active {
|
|
182
|
-
height:
|
|
205
|
+
height: 100%;
|
|
183
206
|
opacity: 1;
|
|
184
207
|
}
|
|
185
208
|
.mfui-text-field__icon-box {
|
|
@@ -230,16 +253,6 @@
|
|
|
230
253
|
.mfui-text-field__require-mark {
|
|
231
254
|
color: var(--fury);
|
|
232
255
|
}
|
|
233
|
-
.mfui-text-field__wrap {
|
|
234
|
-
display: -webkit-box;
|
|
235
|
-
display: -ms-flexbox;
|
|
236
|
-
display: flex;
|
|
237
|
-
margin-top: 8px;
|
|
238
|
-
overflow: hidden;
|
|
239
|
-
color: var(--spbSky3);
|
|
240
|
-
font-size: 12px;
|
|
241
|
-
line-height: 18px;
|
|
242
|
-
}
|
|
243
256
|
.mfui-text-field__counter {
|
|
244
257
|
margin-left: auto;
|
|
245
258
|
}
|
|
@@ -268,13 +281,13 @@
|
|
|
268
281
|
cursor: default !important;
|
|
269
282
|
}
|
|
270
283
|
.mfui-text-field_theme_default.mfui-text-field_error .mfui-text-field__counter_error,
|
|
271
|
-
.mfui-text-field_theme_default.mfui-text-field_error .mfui-text-
|
|
284
|
+
.mfui-text-field_theme_default.mfui-text-field_error .mfui-text-field__field-bottom-wrapper {
|
|
272
285
|
color: var(--fury);
|
|
273
286
|
}
|
|
274
287
|
.mfui-text-field_theme_white .mfui-text-field__icon {
|
|
275
288
|
fill: var(--stcWhite);
|
|
276
289
|
}
|
|
277
|
-
.mfui-text-field_theme_white .mfui-text-
|
|
290
|
+
.mfui-text-field_theme_white .mfui-text-field__field-bottom-wrapper,
|
|
278
291
|
.mfui-text-field_theme_white .mfui-text-field__counter {
|
|
279
292
|
color: var(--stcWhite);
|
|
280
293
|
}
|
|
@@ -39,6 +39,8 @@ export declare type TextFieldProps = {
|
|
|
39
39
|
inputRef?: (node: HTMLInputElement | HTMLTextAreaElement) => void;
|
|
40
40
|
/** Имя поля */
|
|
41
41
|
name?: string;
|
|
42
|
+
/** Запрещает отображение плейсхолдера */
|
|
43
|
+
hidePlaceholder?: boolean;
|
|
42
44
|
/** Отображаемый текст при отсутствии значения */
|
|
43
45
|
placeholder?: string;
|
|
44
46
|
/** Атрибут корневого DOM элемента компонента */
|
|
@@ -123,6 +123,8 @@ var TextField = function TextField(_ref) {
|
|
|
123
123
|
_ref$textarea = _ref.textarea,
|
|
124
124
|
textarea = _ref$textarea === void 0 ? false : _ref$textarea,
|
|
125
125
|
name = _ref.name,
|
|
126
|
+
_ref$hidePlaceholder = _ref.hidePlaceholder,
|
|
127
|
+
hidePlaceholder = _ref$hidePlaceholder === void 0 ? false : _ref$hidePlaceholder,
|
|
126
128
|
placeholder = _ref.placeholder,
|
|
127
129
|
required = _ref.required,
|
|
128
130
|
_ref$isControlled = _ref.isControlled,
|
|
@@ -172,8 +174,8 @@ var TextField = function TextField(_ref) {
|
|
|
172
174
|
|
|
173
175
|
var _useState9 = (0, React.useState)(noticeText),
|
|
174
176
|
_useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
|
|
175
|
-
|
|
176
|
-
|
|
177
|
+
currentNoticeText = _useState10[0],
|
|
178
|
+
setCurrentNoticeText = _useState10[1];
|
|
177
179
|
|
|
178
180
|
var _useState11 = (0, React.useState)(false),
|
|
179
181
|
_useState12 = (0, _slicedToArray2["default"])(_useState11, 2),
|
|
@@ -195,8 +197,8 @@ var TextField = function TextField(_ref) {
|
|
|
195
197
|
return isPasswordType && !isPasswordHidden;
|
|
196
198
|
}, [isPasswordHidden, isPasswordType]);
|
|
197
199
|
var hasValue = isControlled ? !!value : !!inputValue;
|
|
198
|
-
var isValidVerification = verification === Verification.VALID;
|
|
199
|
-
var isErrorVerification = verification === Verification.ERROR;
|
|
200
|
+
var isValidVerification = verification === Verification.VALID && !disabled;
|
|
201
|
+
var isErrorVerification = verification === Verification.ERROR && !disabled;
|
|
200
202
|
var hasValueForClear = hasValue && !isPasswordType && !customIcon && !isValidVerification;
|
|
201
203
|
var hasClearIcon = !disabled && (hasValueForClear || isErrorVerification);
|
|
202
204
|
var actualPlaceholder = placeholder || DEFAULT_PLACEHOLDERS[type];
|
|
@@ -214,7 +216,7 @@ var TextField = function TextField(_ref) {
|
|
|
214
216
|
checkSymbolMaxLimit(value);
|
|
215
217
|
}, [value, checkSymbolMaxLimit, isControlled]);
|
|
216
218
|
(0, React.useEffect)(function () {
|
|
217
|
-
noticeText &&
|
|
219
|
+
noticeText && setCurrentNoticeText(noticeText);
|
|
218
220
|
}, [noticeText]);
|
|
219
221
|
(0, React.useEffect)(function () {
|
|
220
222
|
if (!resizerRef.current || textarea !== TextareaTypes.FLEXIBLE) {
|
|
@@ -283,7 +285,7 @@ var TextField = function TextField(_ref) {
|
|
|
283
285
|
};
|
|
284
286
|
|
|
285
287
|
var handleNoticeTransitionEnd = (0, React.useCallback)(function () {
|
|
286
|
-
!noticeText &&
|
|
288
|
+
!noticeText && setCurrentNoticeText(noticeText);
|
|
287
289
|
}, [noticeText]);
|
|
288
290
|
|
|
289
291
|
var handleTextareaScroll = function handleTextareaScroll() {
|
|
@@ -332,7 +334,7 @@ var TextField = function TextField(_ref) {
|
|
|
332
334
|
onFocus: handleFocus,
|
|
333
335
|
onKeyUp: onKeyUp,
|
|
334
336
|
maxLength: maxLength,
|
|
335
|
-
placeholder: actualPlaceholder,
|
|
337
|
+
placeholder: hidePlaceholder ? ' ' : actualPlaceholder,
|
|
336
338
|
required: required,
|
|
337
339
|
inputMode: inputMode
|
|
338
340
|
});
|
|
@@ -469,13 +471,15 @@ var TextField = function TextField(_ref) {
|
|
|
469
471
|
className: cn('resizer'),
|
|
470
472
|
ref: resizerRef
|
|
471
473
|
}, /*#__PURE__*/React.createElement(ResizeIcon, null))), /*#__PURE__*/React.createElement("div", {
|
|
472
|
-
className: cn('
|
|
474
|
+
className: cn('field-bottom-wrapper', {
|
|
475
|
+
filled: !!currentNoticeText || !!symbolCounter
|
|
476
|
+
})
|
|
473
477
|
}, /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({
|
|
474
478
|
className: cn('notice-text', {
|
|
475
479
|
active: !!noticeText
|
|
476
480
|
}),
|
|
477
481
|
onTransitionEnd: handleNoticeTransitionEnd
|
|
478
|
-
}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.notice)),
|
|
482
|
+
}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.notice)), currentNoticeText), symbolCounter && /*#__PURE__*/React.createElement("span", {
|
|
479
483
|
className: cn('counter', {
|
|
480
484
|
error: isMaxLimitExceeded
|
|
481
485
|
})
|
|
@@ -494,6 +498,7 @@ TextField.propTypes = {
|
|
|
494
498
|
inputMode: PropTypes.oneOf(['numeric', 'tel', 'decimal', 'email', 'url', 'search', 'none']),
|
|
495
499
|
autoComplete: PropTypes.string,
|
|
496
500
|
name: PropTypes.string,
|
|
501
|
+
hidePlaceholder: PropTypes.bool,
|
|
497
502
|
placeholder: PropTypes.string,
|
|
498
503
|
id: PropTypes.string,
|
|
499
504
|
isControlled: PropTypes.bool,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@megafon/ui-core",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist",
|
|
6
6
|
"styles"
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@babel/preset-env": "^7.8.6",
|
|
55
55
|
"@babel/preset-react": "^7.8.3",
|
|
56
56
|
"@babel/preset-typescript": "^7.8.3",
|
|
57
|
-
"@megafon/ui-icons": "^2.0.0
|
|
57
|
+
"@megafon/ui-icons": "^2.0.0",
|
|
58
58
|
"@svgr/core": "^2.4.1",
|
|
59
59
|
"@testing-library/react-hooks": "^7.0.1",
|
|
60
60
|
"@types/enzyme": "^3.10.5",
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"react-popper": "^2.2.3",
|
|
98
98
|
"swiper": "^6.5.6"
|
|
99
99
|
},
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "0633ca221fdcbf7374dbb325997c58d72afe80d4"
|
|
101
101
|
}
|