@megafon/ui-core 4.10.0 → 4.10.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 CHANGED
@@ -3,6 +3,21 @@
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.10.1](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@4.10.0...@megafon/ui-core@4.10.1) (2022-12-19)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **checkbox:** light checked bg-color ([5190a07](https://github.com/MegafonWebLab/megafon-ui/commit/5190a07b532b7b306a5c9de9f3586a3afaa230df))
12
+ * **notification:** fix link color ([7302230](https://github.com/MegafonWebLab/megafon-ui/commit/73022303201d94a814097a59d9facca5576dfa5e))
13
+ * **notification:** fix link font ([96b6134](https://github.com/MegafonWebLab/megafon-ui/commit/96b61340bb7a404affc045ac4081d093016038fa))
14
+ * **radiobutton:** update design ([2072f43](https://github.com/MegafonWebLab/megafon-ui/commit/2072f431efedfbacb679d7b39b378181cb038b83))
15
+ * **textfield:** fix dynamic height of textarea ([730b594](https://github.com/MegafonWebLab/megafon-ui/commit/730b5947358ada3c7d99e4849dc1563d2b752b32))
16
+
17
+
18
+
19
+
20
+
6
21
  # [4.10.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@4.9.1...@megafon/ui-core@4.10.0) (2022-12-12)
7
22
 
8
23
 
@@ -118,7 +118,7 @@
118
118
  .mfui-checkbox_color_light.mfui-checkbox_checked .mfui-checkbox__custom-input {
119
119
  border-color: var(--brandGreen);
120
120
  color: var(--stcWhite);
121
- background-color: var(--brandGreen);
121
+ background-color: var(--stcWhite);
122
122
  }
123
123
  .mfui-checkbox_disabled .mfui-checkbox__label {
124
124
  color: var(--spbSky3);
@@ -151,66 +151,73 @@ h5 {
151
151
  margin-top: 12px;
152
152
  }
153
153
  .mfui-notification__link {
154
- font-size: 15px;
155
- line-height: 24px;
156
- font-weight: 500;
157
154
  display: -webkit-inline-box;
158
155
  display: -ms-inline-flexbox;
159
156
  display: inline-flex;
160
157
  -webkit-box-align: center;
161
158
  -ms-flex-align: center;
162
159
  align-items: center;
160
+ color: var(--brandGreen);
163
161
  cursor: pointer;
164
162
  }
165
- @media screen and (max-width: 767px) {
166
- .mfui-notification__link {
167
- font-size: 12px;
168
- line-height: 18px;
169
- }
170
- }
171
163
  .mfui-notification__button + .mfui-notification__link {
172
164
  margin-left: 16px;
173
165
  }
174
- .mfui-notification__link-arrow,
175
- .mfui-notification__collapse-arrow {
176
- width: 20px;
177
- min-width: 20px;
178
- height: 20px;
179
- fill: var(--systemBlue);
180
- }
181
- .mfui-notification__link-arrow {
182
- margin-bottom: -2px;
166
+ .mfui-notification__link,
167
+ .mfui-notification__collapse-button {
168
+ font-weight: 500;
169
+ font-size: 15px;
170
+ font-family: inherit;
171
+ line-height: 18px;
183
172
  }
184
- @media screen and (min-width: 768px) {
185
- .mfui-notification__link-arrow {
186
- margin-bottom: -4px;
173
+ @media screen and (max-width: 767px) {
174
+ .mfui-notification__link,
175
+ .mfui-notification__collapse-button {
176
+ font-size: 12px;
177
+ line-height: 14px;
187
178
  }
188
179
  }
189
180
  .mfui-notification__collapse-button {
190
- font-size: 15px;
191
- line-height: 24px;
192
- font-weight: 500;
193
181
  display: -webkit-box;
194
182
  display: -ms-flexbox;
195
183
  display: flex;
196
- -webkit-box-align: center;
197
- -ms-flex-align: center;
198
- align-items: center;
184
+ -webkit-box-align: start;
185
+ -ms-flex-align: start;
186
+ align-items: flex-start;
199
187
  height: -webkit-fit-content;
200
188
  height: -moz-fit-content;
201
189
  height: fit-content;
202
190
  padding: 0;
203
191
  border: none;
204
- color: var(--systemBlue);
192
+ color: var(--brandGreen);
205
193
  text-align: right;
206
194
  background-color: transparent;
207
195
  cursor: pointer;
208
196
  }
209
197
  @media screen and (max-width: 767px) {
210
198
  .mfui-notification__collapse-button {
211
- font-size: 12px;
212
- line-height: 18px;
213
- margin-left: 16px;
199
+ -webkit-box-align: center;
200
+ -ms-flex-align: center;
201
+ align-items: center;
202
+ }
203
+ }
204
+ .mfui-notification__link-arrow,
205
+ .mfui-notification__collapse-arrow {
206
+ width: 20px;
207
+ min-width: 20px;
208
+ height: 20px;
209
+ fill: var(--brandGreen);
210
+ }
211
+ .mfui-notification__collapse-arrow_close {
212
+ -webkit-transform: rotate(180deg);
213
+ transform: rotate(180deg);
214
+ }
215
+ .mfui-notification__link-arrow {
216
+ margin-bottom: -2px;
217
+ }
218
+ @media screen and (min-width: 768px) {
219
+ .mfui-notification__link-arrow {
220
+ margin-bottom: -4px;
214
221
  }
215
222
  }
216
223
  .mfui-notification__bottom-block + .mfui-notification__collapse-button {
@@ -313,20 +320,17 @@ h5 {
313
320
  .mfui-notification_colored.mfui-notification_type_success .mfui-notification__text {
314
321
  color: var(--content);
315
322
  }
316
- .mfui-notification_colored.mfui-notification_type_info .mfui-notification__link,
317
- .mfui-notification_colored.mfui-notification_type_warning .mfui-notification__link,
318
- .mfui-notification_colored.mfui-notification_type_success .mfui-notification__link {
319
- color: var(--systemBlue);
320
- }
321
323
  .mfui-notification_colored.mfui-notification_type_error {
322
324
  background-color: var(--fury80);
323
325
  }
324
326
  .mfui-notification_colored.mfui-notification_type_error .mfui-notification__title,
325
327
  .mfui-notification_colored.mfui-notification_type_error .mfui-notification__text,
326
- .mfui-notification_colored.mfui-notification_type_error .mfui-notification__link {
328
+ .mfui-notification_colored.mfui-notification_type_error .mfui-notification__link,
329
+ .mfui-notification_colored.mfui-notification_type_error .mfui-notification__collapse-button {
327
330
  color: var(--stcWhite);
328
331
  }
329
- .mfui-notification_colored.mfui-notification_type_error .mfui-notification__link-arrow {
332
+ .mfui-notification_colored.mfui-notification_type_error .mfui-notification__link-arrow,
333
+ .mfui-notification_colored.mfui-notification_type_error .mfui-notification__collapse-arrow {
330
334
  fill: var(--stcWhite);
331
335
  }
332
336
  .mfui-notification_colored.mfui-notification_type_error .mfui-notification__icon-container {
@@ -31,16 +31,6 @@ var ArrowDown = function ArrowDown(props) {
31
31
  }));
32
32
  };
33
33
 
34
- var ArrowUp = function ArrowUp(props) {
35
- return /*#__PURE__*/React.createElement("svg", _extends({
36
- viewBox: "0 0 20 20"
37
- }, props), /*#__PURE__*/React.createElement("path", {
38
- d: "M14 12H6l4-5z",
39
- fillRule: "evenodd",
40
- clipRule: "evenodd"
41
- }));
42
- };
43
-
44
34
  var RightArrow = function RightArrow(props) {
45
35
  return /*#__PURE__*/React.createElement("svg", _extends({
46
36
  viewBox: "0 0 20 20"
@@ -254,11 +244,11 @@ var Notification = function Notification(_ref) {
254
244
  type: "button",
255
245
  className: cn('collapse-button'),
256
246
  onClick: handleCollapseButtonClick
257
- }), showFullText ? openCollapseTitle : closeCollapseTitle, /*#__PURE__*/React.createElement("div", {
247
+ }), showFullText ? openCollapseTitle : closeCollapseTitle, /*#__PURE__*/React.createElement(ArrowDown, {
258
248
  className: cn('collapse-arrow', {
259
249
  close: showFullText
260
250
  })
261
- }, showFullText ? /*#__PURE__*/React.createElement(ArrowUp, null) : /*#__PURE__*/React.createElement(ArrowDown, null)));
251
+ }));
262
252
  };
263
253
 
264
254
  var renderIcon = function renderIcon() {
@@ -15,9 +15,6 @@
15
15
  outline: none;
16
16
  cursor: pointer;
17
17
  }
18
- .mfui-radio-button__label_disabled {
19
- cursor: default;
20
- }
21
18
  .mfui-radio-button__custom-input {
22
19
  display: -webkit-box;
23
20
  display: -ms-flexbox;
@@ -32,31 +29,40 @@
32
29
  justify-content: center;
33
30
  width: 32px;
34
31
  height: 32px;
35
- margin-right: 8px;
32
+ margin-right: 6px;
36
33
  }
37
34
  .mfui-radio-button__custom-input:before {
38
35
  content: '';
39
36
  display: block;
40
37
  -webkit-box-sizing: border-box;
41
38
  box-sizing: border-box;
42
- width: 20px;
43
- height: 20px;
39
+ width: 22px;
40
+ height: 22px;
44
41
  border: 2px solid var(--spbSky2);
45
42
  border-radius: 50%;
46
43
  background-color: var(--base);
44
+ -webkit-transition: background-color, border-color;
45
+ transition: background-color, border-color;
46
+ -webkit-transition-duration: 0.3s;
47
+ transition-duration: 0.3s;
47
48
  }
48
49
  .mfui-radio-button__input:checked + .mfui-radio-button__custom-input:before {
49
- border: 6px solid var(--brandGreen);
50
+ border: 7px solid var(--brandGreen);
50
51
  }
51
- .mfui-radio-button__label:hover .mfui-radio-button__custom-input:before {
52
+ .mfui-radio-button__label:not(.mfui-radio-button__label_disabled):hover .mfui-radio-button__custom-input:before {
52
53
  border-color: var(--buttonHoverGreen);
53
54
  }
54
- .mfui-radio-button__label:active .mfui-radio-button__custom-input:before {
55
+ .mfui-radio-button__label:not(.mfui-radio-button__label_disabled):active .mfui-radio-button__custom-input:before {
55
56
  border-color: var(--buttonDown);
56
57
  }
57
- .mfui-radio-button__label_disabled .mfui-radio-button__custom-input:before {
58
- border-color: var(--spbSky2) !important;
59
- background-color: var(--spbSky1) !important;
58
+ .mfui-radio-button__label_disabled {
59
+ color: var(--spbSky3);
60
+ cursor: default;
61
+ }
62
+ .mfui-radio-button__label_disabled .mfui-radio-button__custom-input:before,
63
+ .mfui-radio-button__label_disabled .mfui-radio-button__input:checked + .mfui-radio-button__custom-input:before {
64
+ border-color: var(--spbSky2);
65
+ background-color: var(--spbSky1);
60
66
  }
61
67
  .mfui-radio-button__text_size_small {
62
68
  font-size: 12px;
@@ -41,15 +41,6 @@
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
- }
53
44
  .mfui-text-field__field_resized {
54
45
  -webkit-transition: height 0.1s;
55
46
  transition: height 0.1s;
@@ -1,11 +1,8 @@
1
1
  import "core-js/modules/es.array.concat";
2
- import "core-js/modules/es.date.to-string";
3
2
  import "core-js/modules/es.function.name";
4
- import "core-js/modules/es.object.to-string";
5
3
  import "core-js/modules/es.object.values";
6
4
  import "core-js/modules/es.parse-float";
7
5
  import "core-js/modules/es.regexp.exec";
8
- import "core-js/modules/es.regexp.to-string";
9
6
  import "core-js/modules/es.string.replace";
10
7
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
11
8
  import _extends from "@babel/runtime/helpers/extends";
@@ -13,7 +10,7 @@ import _extends from "@babel/runtime/helpers/extends";
13
10
  /* eslint-disable react/no-multi-comp */
14
11
  import * as React from 'react';
15
12
  import { useCallback, useEffect, useState, useRef, useMemo } from 'react';
16
- import { checkEventIsClickOrEnterPress, cnCreate, filterDataAttrs, convert } from '@megafon/ui-helpers';
13
+ import { checkEventIsClickOrEnterPress, cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
17
14
  import throttle from 'lodash.throttle';
18
15
  import * as PropTypes from 'prop-types';
19
16
  import InputMask from 'react-input-mask';
@@ -74,13 +71,6 @@ var DEFAULT_PLACEHOLDERS = {
74
71
  password: 'Пароль',
75
72
  text: 'Текст'
76
73
  };
77
- var converConfig = {
78
- br: {
79
- component: function component() {
80
- return React.createElement('br');
81
- }
82
- }
83
- };
84
74
  export var Verification = {
85
75
  VALID: 'valid',
86
76
  ERROR: 'error'
@@ -180,7 +170,6 @@ var TextField = function TextField(_ref) {
180
170
  setIsTextareaResized = _useState14[1];
181
171
 
182
172
  var fieldNode = useRef();
183
- var hiddenElement = useRef(null);
184
173
  var labelRef = useRef(null);
185
174
  var resizerRef = useRef(null);
186
175
  var isPasswordType = useMemo(function () {
@@ -205,14 +194,25 @@ var TextField = function TextField(_ref) {
205
194
  setIsMaxLimitExceeded(symbolCounter < String(textareaValue).length);
206
195
  }, [symbolCounter]);
207
196
  useEffect(function () {
208
- if (!hiddenElement.current) {
197
+ if (!textarea || !fieldNode.current || isTextareaResized) {
209
198
  return;
210
199
  }
211
200
 
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]);
201
+ fieldNode.current.style.height = "".concat(minTextareaHeight, "px");
202
+ var scrollHeight = fieldNode.current.scrollHeight;
203
+
204
+ var _window$getComputedSt = window.getComputedStyle(fieldNode.current),
205
+ paddingTop = _window$getComputedSt.paddingTop,
206
+ paddingBottom = _window$getComputedSt.paddingBottom;
207
+
208
+ var innerHeight = scrollHeight - parseFloat(paddingTop) - parseFloat(paddingBottom);
209
+
210
+ if (innerHeight >= TEXTAREA_MAX_HEIGHT) {
211
+ fieldNode.current.style.height = "".concat(TEXTAREA_MAX_HEIGHT, "px");
212
+ } else {
213
+ fieldNode.current.style.height = "".concat(innerHeight, "px");
214
+ }
215
+ }, [isTextareaResized, minTextareaHeight, inputValue, textarea]);
216
216
  useEffect(function () {
217
217
  !isControlled && setInputValue(value);
218
218
  checkSymbolMaxLimit(value);
@@ -406,9 +406,6 @@ var TextField = function TextField(_ref) {
406
406
  };
407
407
 
408
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/>');
412
409
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("textarea", _extends({}, textareaParams, {
413
410
  style: {
414
411
  height: "".concat(textareaHeight, "px")
@@ -416,13 +413,7 @@ var TextField = function TextField(_ref) {
416
413
  ref: getFieldNode,
417
414
  onKeyDown: disableEnterLineBreak ? handleTextareaKeyDown : undefined,
418
415
  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());
416
+ })), renderLabel());
426
417
  };
427
418
 
428
419
  var renderIconBlock = function renderIconBlock() {
@@ -118,7 +118,7 @@
118
118
  .mfui-checkbox_color_light.mfui-checkbox_checked .mfui-checkbox__custom-input {
119
119
  border-color: var(--brandGreen);
120
120
  color: var(--stcWhite);
121
- background-color: var(--brandGreen);
121
+ background-color: var(--stcWhite);
122
122
  }
123
123
  .mfui-checkbox_disabled .mfui-checkbox__label {
124
124
  color: var(--spbSky3);
@@ -151,66 +151,73 @@ h5 {
151
151
  margin-top: 12px;
152
152
  }
153
153
  .mfui-notification__link {
154
- font-size: 15px;
155
- line-height: 24px;
156
- font-weight: 500;
157
154
  display: -webkit-inline-box;
158
155
  display: -ms-inline-flexbox;
159
156
  display: inline-flex;
160
157
  -webkit-box-align: center;
161
158
  -ms-flex-align: center;
162
159
  align-items: center;
160
+ color: var(--brandGreen);
163
161
  cursor: pointer;
164
162
  }
165
- @media screen and (max-width: 767px) {
166
- .mfui-notification__link {
167
- font-size: 12px;
168
- line-height: 18px;
169
- }
170
- }
171
163
  .mfui-notification__button + .mfui-notification__link {
172
164
  margin-left: 16px;
173
165
  }
174
- .mfui-notification__link-arrow,
175
- .mfui-notification__collapse-arrow {
176
- width: 20px;
177
- min-width: 20px;
178
- height: 20px;
179
- fill: var(--systemBlue);
180
- }
181
- .mfui-notification__link-arrow {
182
- margin-bottom: -2px;
166
+ .mfui-notification__link,
167
+ .mfui-notification__collapse-button {
168
+ font-weight: 500;
169
+ font-size: 15px;
170
+ font-family: inherit;
171
+ line-height: 18px;
183
172
  }
184
- @media screen and (min-width: 768px) {
185
- .mfui-notification__link-arrow {
186
- margin-bottom: -4px;
173
+ @media screen and (max-width: 767px) {
174
+ .mfui-notification__link,
175
+ .mfui-notification__collapse-button {
176
+ font-size: 12px;
177
+ line-height: 14px;
187
178
  }
188
179
  }
189
180
  .mfui-notification__collapse-button {
190
- font-size: 15px;
191
- line-height: 24px;
192
- font-weight: 500;
193
181
  display: -webkit-box;
194
182
  display: -ms-flexbox;
195
183
  display: flex;
196
- -webkit-box-align: center;
197
- -ms-flex-align: center;
198
- align-items: center;
184
+ -webkit-box-align: start;
185
+ -ms-flex-align: start;
186
+ align-items: flex-start;
199
187
  height: -webkit-fit-content;
200
188
  height: -moz-fit-content;
201
189
  height: fit-content;
202
190
  padding: 0;
203
191
  border: none;
204
- color: var(--systemBlue);
192
+ color: var(--brandGreen);
205
193
  text-align: right;
206
194
  background-color: transparent;
207
195
  cursor: pointer;
208
196
  }
209
197
  @media screen and (max-width: 767px) {
210
198
  .mfui-notification__collapse-button {
211
- font-size: 12px;
212
- line-height: 18px;
213
- margin-left: 16px;
199
+ -webkit-box-align: center;
200
+ -ms-flex-align: center;
201
+ align-items: center;
202
+ }
203
+ }
204
+ .mfui-notification__link-arrow,
205
+ .mfui-notification__collapse-arrow {
206
+ width: 20px;
207
+ min-width: 20px;
208
+ height: 20px;
209
+ fill: var(--brandGreen);
210
+ }
211
+ .mfui-notification__collapse-arrow_close {
212
+ -webkit-transform: rotate(180deg);
213
+ transform: rotate(180deg);
214
+ }
215
+ .mfui-notification__link-arrow {
216
+ margin-bottom: -2px;
217
+ }
218
+ @media screen and (min-width: 768px) {
219
+ .mfui-notification__link-arrow {
220
+ margin-bottom: -4px;
214
221
  }
215
222
  }
216
223
  .mfui-notification__bottom-block + .mfui-notification__collapse-button {
@@ -313,20 +320,17 @@ h5 {
313
320
  .mfui-notification_colored.mfui-notification_type_success .mfui-notification__text {
314
321
  color: var(--content);
315
322
  }
316
- .mfui-notification_colored.mfui-notification_type_info .mfui-notification__link,
317
- .mfui-notification_colored.mfui-notification_type_warning .mfui-notification__link,
318
- .mfui-notification_colored.mfui-notification_type_success .mfui-notification__link {
319
- color: var(--systemBlue);
320
- }
321
323
  .mfui-notification_colored.mfui-notification_type_error {
322
324
  background-color: var(--fury80);
323
325
  }
324
326
  .mfui-notification_colored.mfui-notification_type_error .mfui-notification__title,
325
327
  .mfui-notification_colored.mfui-notification_type_error .mfui-notification__text,
326
- .mfui-notification_colored.mfui-notification_type_error .mfui-notification__link {
328
+ .mfui-notification_colored.mfui-notification_type_error .mfui-notification__link,
329
+ .mfui-notification_colored.mfui-notification_type_error .mfui-notification__collapse-button {
327
330
  color: var(--stcWhite);
328
331
  }
329
- .mfui-notification_colored.mfui-notification_type_error .mfui-notification__link-arrow {
332
+ .mfui-notification_colored.mfui-notification_type_error .mfui-notification__link-arrow,
333
+ .mfui-notification_colored.mfui-notification_type_error .mfui-notification__collapse-arrow {
330
334
  fill: var(--stcWhite);
331
335
  }
332
336
  .mfui-notification_colored.mfui-notification_type_error .mfui-notification__icon-container {
@@ -55,16 +55,6 @@ var ArrowDown = function ArrowDown(props) {
55
55
  }));
56
56
  };
57
57
 
58
- var ArrowUp = function ArrowUp(props) {
59
- return /*#__PURE__*/_react["default"].createElement("svg", (0, _extends2["default"])({
60
- viewBox: "0 0 20 20"
61
- }, props), /*#__PURE__*/_react["default"].createElement("path", {
62
- d: "M14 12H6l4-5z",
63
- fillRule: "evenodd",
64
- clipRule: "evenodd"
65
- }));
66
- };
67
-
68
58
  var RightArrow = function RightArrow(props) {
69
59
  return /*#__PURE__*/_react["default"].createElement("svg", (0, _extends2["default"])({
70
60
  viewBox: "0 0 20 20"
@@ -280,11 +270,11 @@ var Notification = function Notification(_ref) {
280
270
  type: "button",
281
271
  className: cn('collapse-button'),
282
272
  onClick: handleCollapseButtonClick
283
- }), showFullText ? openCollapseTitle : closeCollapseTitle, /*#__PURE__*/_react["default"].createElement("div", {
273
+ }), showFullText ? openCollapseTitle : closeCollapseTitle, /*#__PURE__*/_react["default"].createElement(ArrowDown, {
284
274
  className: cn('collapse-arrow', {
285
275
  close: showFullText
286
276
  })
287
- }, showFullText ? /*#__PURE__*/_react["default"].createElement(ArrowUp, null) : /*#__PURE__*/_react["default"].createElement(ArrowDown, null)));
277
+ }));
288
278
  };
289
279
 
290
280
  var renderIcon = function renderIcon() {
@@ -15,9 +15,6 @@
15
15
  outline: none;
16
16
  cursor: pointer;
17
17
  }
18
- .mfui-radio-button__label_disabled {
19
- cursor: default;
20
- }
21
18
  .mfui-radio-button__custom-input {
22
19
  display: -webkit-box;
23
20
  display: -ms-flexbox;
@@ -32,31 +29,40 @@
32
29
  justify-content: center;
33
30
  width: 32px;
34
31
  height: 32px;
35
- margin-right: 8px;
32
+ margin-right: 6px;
36
33
  }
37
34
  .mfui-radio-button__custom-input:before {
38
35
  content: '';
39
36
  display: block;
40
37
  -webkit-box-sizing: border-box;
41
38
  box-sizing: border-box;
42
- width: 20px;
43
- height: 20px;
39
+ width: 22px;
40
+ height: 22px;
44
41
  border: 2px solid var(--spbSky2);
45
42
  border-radius: 50%;
46
43
  background-color: var(--base);
44
+ -webkit-transition: background-color, border-color;
45
+ transition: background-color, border-color;
46
+ -webkit-transition-duration: 0.3s;
47
+ transition-duration: 0.3s;
47
48
  }
48
49
  .mfui-radio-button__input:checked + .mfui-radio-button__custom-input:before {
49
- border: 6px solid var(--brandGreen);
50
+ border: 7px solid var(--brandGreen);
50
51
  }
51
- .mfui-radio-button__label:hover .mfui-radio-button__custom-input:before {
52
+ .mfui-radio-button__label:not(.mfui-radio-button__label_disabled):hover .mfui-radio-button__custom-input:before {
52
53
  border-color: var(--buttonHoverGreen);
53
54
  }
54
- .mfui-radio-button__label:active .mfui-radio-button__custom-input:before {
55
+ .mfui-radio-button__label:not(.mfui-radio-button__label_disabled):active .mfui-radio-button__custom-input:before {
55
56
  border-color: var(--buttonDown);
56
57
  }
57
- .mfui-radio-button__label_disabled .mfui-radio-button__custom-input:before {
58
- border-color: var(--spbSky2) !important;
59
- background-color: var(--spbSky1) !important;
58
+ .mfui-radio-button__label_disabled {
59
+ color: var(--spbSky3);
60
+ cursor: default;
61
+ }
62
+ .mfui-radio-button__label_disabled .mfui-radio-button__custom-input:before,
63
+ .mfui-radio-button__label_disabled .mfui-radio-button__input:checked + .mfui-radio-button__custom-input:before {
64
+ border-color: var(--spbSky2);
65
+ background-color: var(--spbSky1);
60
66
  }
61
67
  .mfui-radio-button__text_size_small {
62
68
  font-size: 12px;
@@ -41,15 +41,6 @@
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
- }
53
44
  .mfui-text-field__field_resized {
54
45
  -webkit-transition: height 0.1s;
55
46
  transition: height 0.1s;
@@ -9,20 +9,14 @@ exports["default"] = exports.MinTextareaHeight = exports.TextareaTypes = exports
9
9
 
10
10
  require("core-js/modules/es.array.concat");
11
11
 
12
- require("core-js/modules/es.date.to-string");
13
-
14
12
  require("core-js/modules/es.function.name");
15
13
 
16
- require("core-js/modules/es.object.to-string");
17
-
18
14
  require("core-js/modules/es.object.values");
19
15
 
20
16
  require("core-js/modules/es.parse-float");
21
17
 
22
18
  require("core-js/modules/es.regexp.exec");
23
19
 
24
- require("core-js/modules/es.regexp.to-string");
25
-
26
20
  require("core-js/modules/es.string.replace");
27
21
 
28
22
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
@@ -102,13 +96,6 @@ var DEFAULT_PLACEHOLDERS = {
102
96
  password: 'Пароль',
103
97
  text: 'Текст'
104
98
  };
105
- var converConfig = {
106
- br: {
107
- component: function component() {
108
- return React.createElement('br');
109
- }
110
- }
111
- };
112
99
  var Verification = {
113
100
  VALID: 'valid',
114
101
  ERROR: 'error'
@@ -211,7 +198,6 @@ var TextField = function TextField(_ref) {
211
198
  setIsTextareaResized = _useState14[1];
212
199
 
213
200
  var fieldNode = (0, React.useRef)();
214
- var hiddenElement = (0, React.useRef)(null);
215
201
  var labelRef = (0, React.useRef)(null);
216
202
  var resizerRef = (0, React.useRef)(null);
217
203
  var isPasswordType = (0, React.useMemo)(function () {
@@ -236,14 +222,25 @@ var TextField = function TextField(_ref) {
236
222
  setIsMaxLimitExceeded(symbolCounter < String(textareaValue).length);
237
223
  }, [symbolCounter]);
238
224
  (0, React.useEffect)(function () {
239
- if (!hiddenElement.current) {
225
+ if (!textarea || !fieldNode.current || isTextareaResized) {
240
226
  return;
241
227
  }
242
228
 
243
- var hiddenElementHeight = hiddenElement.current.scrollHeight;
244
- var isHiddenHeightCorrect = hiddenElementHeight >= minTextareaHeight && hiddenElementHeight <= TEXTAREA_MAX_HEIGHT;
245
- !isTextareaResized && setTextareaHeight(isHiddenHeightCorrect ? hiddenElementHeight : minTextareaHeight);
246
- }, [hiddenElement, isTextareaResized, minTextareaHeight, inputValue]);
229
+ fieldNode.current.style.height = "".concat(minTextareaHeight, "px");
230
+ var scrollHeight = fieldNode.current.scrollHeight;
231
+
232
+ var _window$getComputedSt = window.getComputedStyle(fieldNode.current),
233
+ paddingTop = _window$getComputedSt.paddingTop,
234
+ paddingBottom = _window$getComputedSt.paddingBottom;
235
+
236
+ var innerHeight = scrollHeight - parseFloat(paddingTop) - parseFloat(paddingBottom);
237
+
238
+ if (innerHeight >= TEXTAREA_MAX_HEIGHT) {
239
+ fieldNode.current.style.height = "".concat(TEXTAREA_MAX_HEIGHT, "px");
240
+ } else {
241
+ fieldNode.current.style.height = "".concat(innerHeight, "px");
242
+ }
243
+ }, [isTextareaResized, minTextareaHeight, inputValue, textarea]);
247
244
  (0, React.useEffect)(function () {
248
245
  !isControlled && setInputValue(value);
249
246
  checkSymbolMaxLimit(value);
@@ -433,9 +430,6 @@ var TextField = function TextField(_ref) {
433
430
  };
434
431
 
435
432
  var renderTextarea = function renderTextarea() {
436
- var _a;
437
-
438
- var hiddenValue = inputValue === null || inputValue === void 0 ? void 0 : inputValue.toString().replace(/[\r\n]/g, '<br/>');
439
433
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("textarea", (0, _extends2["default"])({}, textareaParams, {
440
434
  style: {
441
435
  height: "".concat(textareaHeight, "px")
@@ -443,13 +437,7 @@ var TextField = function TextField(_ref) {
443
437
  ref: getFieldNode,
444
438
  onKeyDown: disableEnterLineBreak ? handleTextareaKeyDown : undefined,
445
439
  onScroll: handleTextareaScroll
446
- })), !!hiddenValue && /*#__PURE__*/React.createElement("div", {
447
- className: cn('hidden-textarea'),
448
- ref: hiddenElement,
449
- style: {
450
- width: (_a = fieldNode.current) === null || _a === void 0 ? void 0 : _a.scrollWidth
451
- }
452
- }, (0, _uiHelpers.convert)(hiddenValue, converConfig), "."), renderLabel());
440
+ })), renderLabel());
453
441
  };
454
442
 
455
443
  var renderIconBlock = function renderIconBlock() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megafon/ui-core",
3
- "version": "4.10.0",
3
+ "version": "4.10.1",
4
4
  "files": [
5
5
  "dist",
6
6
  "styles"
@@ -100,5 +100,5 @@
100
100
  "react-popper": "^2.2.3",
101
101
  "swiper": "^6.5.6"
102
102
  },
103
- "gitHead": "ac8874d2fae1f64db72d87a5c0352360a70b9a4d"
103
+ "gitHead": "5ac03e3777f38f19028fd0a8bb71e1901e9f0df9"
104
104
  }