@megafon/ui-core 4.0.0-beta.13 → 4.0.0-beta.16

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,41 @@
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.0.0-beta.16](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@4.0.0-beta.15...@megafon/ui-core@4.0.0-beta.16) (2022-08-17)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **textfield:** fixes permanently visible block after the field ([9cc5184](https://github.com/MegafonWebLab/megafon-ui/commit/9cc5184f7b60a7f7dcfe3f9f49cc3199787a77d7))
12
+
13
+
14
+
15
+
16
+
17
+ # [4.0.0-beta.15](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@4.0.0-beta.14...@megafon/ui-core@4.0.0-beta.15) (2022-08-15)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **textfield:** fix label styles ([080f8fa](https://github.com/MegafonWebLab/megafon-ui/commit/080f8faa3ef8ec954704466dc5b56d0313487787))
23
+
24
+
25
+ ### Features
26
+
27
+ * **textfield:** add prop hidePlaceholder ([1c0176e](https://github.com/MegafonWebLab/megafon-ui/commit/1c0176ebdae47d11ac972ada200303500618caf1))
28
+
29
+
30
+
31
+
32
+
33
+ # [4.0.0-beta.14](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@4.0.0-beta.13...@megafon/ui-core@4.0.0-beta.14) (2022-08-08)
34
+
35
+ **Note:** Version bump only for package @megafon/ui-core
36
+
37
+
38
+
39
+
40
+
6
41
  # [4.0.0-beta.13](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@4.0.0-beta.12...@megafon/ui-core@4.0.0-beta.13) (2022-08-08)
7
42
 
8
43
  **Note:** Version bump only for package @megafon/ui-core
@@ -46,6 +46,7 @@
46
46
  height: 60px;
47
47
  border: 1px solid var(--spbSky2);
48
48
  border-radius: 12px;
49
+ overflow: hidden;
49
50
  background-color: var(--base);
50
51
  outline: none;
51
52
  cursor: pointer;
@@ -109,7 +110,6 @@
109
110
  align-items: center;
110
111
  width: 100%;
111
112
  height: 100%;
112
- border-radius: 12px;
113
113
  outline: none;
114
114
  }
115
115
  .mfui-select__title-value {
@@ -138,7 +138,6 @@
138
138
  box-sizing: border-box;
139
139
  height: 100%;
140
140
  padding: 0 45px 0 16px;
141
- border-radius: 12px;
142
141
  overflow: hidden;
143
142
  white-space: nowrap;
144
143
  }
@@ -152,7 +152,8 @@
152
152
  top: 16px;
153
153
  }
154
154
  .mfui-text-field__field:focus ~ .mfui-text-field__label,
155
- .mfui-text-field__field:not(:placeholder-shown) ~ .mfui-text-field__label {
155
+ .mfui-text-field__field:not(:placeholder-shown) ~ .mfui-text-field__label,
156
+ .mfui-text-field__field:-webkit-autofill ~ .mfui-text-field__label {
156
157
  -webkit-transform: scale(0.8) translate(-11%, -75%);
157
158
  transform: scale(0.8) translate(-11%, -75%);
158
159
  -webkit-transition-duration: 0.2s, 0.01s;
@@ -230,7 +231,7 @@
230
231
  .mfui-text-field__require-mark {
231
232
  color: var(--fury);
232
233
  }
233
- .mfui-text-field__wrap {
234
+ .mfui-text-field__field-bottom-wrapper {
234
235
  display: -webkit-box;
235
236
  display: -ms-flexbox;
236
237
  display: flex;
@@ -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 элемента компонента */
@@ -61,7 +63,6 @@ export declare type TextFieldProps = {
61
63
  /** Дополнительные классы элементов */
62
64
  classes?: {
63
65
  input?: string;
64
- fieldWrapper?: string;
65
66
  };
66
67
  /** Дополнительные data атрибуты к внутренним элементам */
67
68
  dataAttrs?: {
@@ -95,6 +95,8 @@ var TextField = function TextField(_ref) {
95
95
  _ref$textarea = _ref.textarea,
96
96
  textarea = _ref$textarea === void 0 ? false : _ref$textarea,
97
97
  name = _ref.name,
98
+ _ref$hidePlaceholder = _ref.hidePlaceholder,
99
+ hidePlaceholder = _ref$hidePlaceholder === void 0 ? false : _ref$hidePlaceholder,
98
100
  placeholder = _ref.placeholder,
99
101
  required = _ref.required,
100
102
  _ref$isControlled = _ref.isControlled,
@@ -120,7 +122,6 @@ var TextField = function TextField(_ref) {
120
122
  _ref$classes = _ref.classes;
121
123
  _ref$classes = _ref$classes === void 0 ? {} : _ref$classes;
122
124
  var input = _ref$classes.input,
123
- fieldWrapper = _ref$classes.fieldWrapper,
124
125
  dataAttrs = _ref.dataAttrs;
125
126
 
126
127
  var _useState = useState(true),
@@ -306,7 +307,7 @@ var TextField = function TextField(_ref) {
306
307
  onFocus: handleFocus,
307
308
  onKeyUp: onKeyUp,
308
309
  maxLength: maxLength,
309
- placeholder: actualPlaceholder,
310
+ placeholder: hidePlaceholder ? ' ' : actualPlaceholder,
310
311
  required: required,
311
312
  inputMode: inputMode
312
313
  });
@@ -429,6 +430,7 @@ var TextField = function TextField(_ref) {
429
430
  var isPlaceholderShowed = isPasswordType && isPasswordHidden && !!inputValue;
430
431
  var valueHasSymbols = inputValue !== null && inputValue !== undefined;
431
432
  var currentSymbolCount = valueHasSymbols && String(inputValue).length || 0;
433
+ var showAdditionalBlock = displayedNoticeText || symbolCounter;
432
434
  return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
433
435
  className: cn({
434
436
  disabled: disabled,
@@ -441,13 +443,13 @@ var TextField = function TextField(_ref) {
441
443
  }), /*#__PURE__*/React.createElement("div", {
442
444
  className: cn('field-wrapper', {
443
445
  textarea: textarea && textareaType
444
- }, fieldWrapper)
446
+ })
445
447
  }, renderField(), textareaType === TextareaTypes.FLEXIBLE && /*#__PURE__*/React.createElement("div", {
446
448
  className: cn('resizer'),
447
449
  ref: resizerRef
448
- }, /*#__PURE__*/React.createElement(ResizeIcon, null))), /*#__PURE__*/React.createElement("div", {
449
- className: cn('wrap')
450
- }, /*#__PURE__*/React.createElement("div", _extends({
450
+ }, /*#__PURE__*/React.createElement(ResizeIcon, null))), showAdditionalBlock && /*#__PURE__*/React.createElement("div", {
451
+ className: cn('field-bottom-wrapper')
452
+ }, displayedNoticeText && /*#__PURE__*/React.createElement("div", _extends({
451
453
  className: cn('notice-text', {
452
454
  active: !!noticeText
453
455
  }),
@@ -471,6 +473,7 @@ TextField.propTypes = {
471
473
  inputMode: PropTypes.oneOf(['numeric', 'tel', 'decimal', 'email', 'url', 'search', 'none']),
472
474
  autoComplete: PropTypes.string,
473
475
  name: PropTypes.string,
476
+ hidePlaceholder: PropTypes.bool,
474
477
  placeholder: PropTypes.string,
475
478
  id: PropTypes.string,
476
479
  isControlled: PropTypes.bool,
@@ -490,8 +493,7 @@ TextField.propTypes = {
490
493
  onCustomIconClick: PropTypes.func,
491
494
  inputRef: PropTypes.func,
492
495
  classes: PropTypes.shape({
493
- input: PropTypes.string,
494
- fieldWrapper: PropTypes.string
496
+ input: PropTypes.string
495
497
  }),
496
498
  dataAttrs: PropTypes.shape({
497
499
  root: PropTypes.objectOf(PropTypes.string.isRequired),
@@ -46,6 +46,7 @@
46
46
  height: 60px;
47
47
  border: 1px solid var(--spbSky2);
48
48
  border-radius: 12px;
49
+ overflow: hidden;
49
50
  background-color: var(--base);
50
51
  outline: none;
51
52
  cursor: pointer;
@@ -109,7 +110,6 @@
109
110
  align-items: center;
110
111
  width: 100%;
111
112
  height: 100%;
112
- border-radius: 12px;
113
113
  outline: none;
114
114
  }
115
115
  .mfui-select__title-value {
@@ -138,7 +138,6 @@
138
138
  box-sizing: border-box;
139
139
  height: 100%;
140
140
  padding: 0 45px 0 16px;
141
- border-radius: 12px;
142
141
  overflow: hidden;
143
142
  white-space: nowrap;
144
143
  }
@@ -152,7 +152,8 @@
152
152
  top: 16px;
153
153
  }
154
154
  .mfui-text-field__field:focus ~ .mfui-text-field__label,
155
- .mfui-text-field__field:not(:placeholder-shown) ~ .mfui-text-field__label {
155
+ .mfui-text-field__field:not(:placeholder-shown) ~ .mfui-text-field__label,
156
+ .mfui-text-field__field:-webkit-autofill ~ .mfui-text-field__label {
156
157
  -webkit-transform: scale(0.8) translate(-11%, -75%);
157
158
  transform: scale(0.8) translate(-11%, -75%);
158
159
  -webkit-transition-duration: 0.2s, 0.01s;
@@ -230,7 +231,7 @@
230
231
  .mfui-text-field__require-mark {
231
232
  color: var(--fury);
232
233
  }
233
- .mfui-text-field__wrap {
234
+ .mfui-text-field__field-bottom-wrapper {
234
235
  display: -webkit-box;
235
236
  display: -ms-flexbox;
236
237
  display: flex;
@@ -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 элемента компонента */
@@ -61,7 +63,6 @@ export declare type TextFieldProps = {
61
63
  /** Дополнительные классы элементов */
62
64
  classes?: {
63
65
  input?: string;
64
- fieldWrapper?: string;
65
66
  };
66
67
  /** Дополнительные data атрибуты к внутренним элементам */
67
68
  dataAttrs?: {
@@ -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,
@@ -148,7 +150,6 @@ var TextField = function TextField(_ref) {
148
150
  _ref$classes = _ref.classes;
149
151
  _ref$classes = _ref$classes === void 0 ? {} : _ref$classes;
150
152
  var input = _ref$classes.input,
151
- fieldWrapper = _ref$classes.fieldWrapper,
152
153
  dataAttrs = _ref.dataAttrs;
153
154
 
154
155
  var _useState = (0, React.useState)(true),
@@ -333,7 +334,7 @@ var TextField = function TextField(_ref) {
333
334
  onFocus: handleFocus,
334
335
  onKeyUp: onKeyUp,
335
336
  maxLength: maxLength,
336
- placeholder: actualPlaceholder,
337
+ placeholder: hidePlaceholder ? ' ' : actualPlaceholder,
337
338
  required: required,
338
339
  inputMode: inputMode
339
340
  });
@@ -453,6 +454,7 @@ var TextField = function TextField(_ref) {
453
454
  var isPlaceholderShowed = isPasswordType && isPasswordHidden && !!inputValue;
454
455
  var valueHasSymbols = inputValue !== null && inputValue !== undefined;
455
456
  var currentSymbolCount = valueHasSymbols && String(inputValue).length || 0;
457
+ var showAdditionalBlock = displayedNoticeText || symbolCounter;
456
458
  return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
457
459
  className: cn({
458
460
  disabled: disabled,
@@ -465,13 +467,13 @@ var TextField = function TextField(_ref) {
465
467
  }), /*#__PURE__*/React.createElement("div", {
466
468
  className: cn('field-wrapper', {
467
469
  textarea: textarea && textareaType
468
- }, fieldWrapper)
470
+ })
469
471
  }, renderField(), textareaType === TextareaTypes.FLEXIBLE && /*#__PURE__*/React.createElement("div", {
470
472
  className: cn('resizer'),
471
473
  ref: resizerRef
472
- }, /*#__PURE__*/React.createElement(ResizeIcon, null))), /*#__PURE__*/React.createElement("div", {
473
- className: cn('wrap')
474
- }, /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({
474
+ }, /*#__PURE__*/React.createElement(ResizeIcon, null))), showAdditionalBlock && /*#__PURE__*/React.createElement("div", {
475
+ className: cn('field-bottom-wrapper')
476
+ }, displayedNoticeText && /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({
475
477
  className: cn('notice-text', {
476
478
  active: !!noticeText
477
479
  }),
@@ -495,6 +497,7 @@ TextField.propTypes = {
495
497
  inputMode: PropTypes.oneOf(['numeric', 'tel', 'decimal', 'email', 'url', 'search', 'none']),
496
498
  autoComplete: PropTypes.string,
497
499
  name: PropTypes.string,
500
+ hidePlaceholder: PropTypes.bool,
498
501
  placeholder: PropTypes.string,
499
502
  id: PropTypes.string,
500
503
  isControlled: PropTypes.bool,
@@ -514,8 +517,7 @@ TextField.propTypes = {
514
517
  onCustomIconClick: PropTypes.func,
515
518
  inputRef: PropTypes.func,
516
519
  classes: PropTypes.shape({
517
- input: PropTypes.string,
518
- fieldWrapper: PropTypes.string
520
+ input: PropTypes.string
519
521
  }),
520
522
  dataAttrs: PropTypes.shape({
521
523
  root: PropTypes.objectOf(PropTypes.string.isRequired),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megafon/ui-core",
3
- "version": "4.0.0-beta.13",
3
+ "version": "4.0.0-beta.16",
4
4
  "files": [
5
5
  "dist",
6
6
  "styles"
@@ -97,5 +97,5 @@
97
97
  "react-popper": "^2.2.3",
98
98
  "swiper": "^6.5.6"
99
99
  },
100
- "gitHead": "ccaf6b0e36d3c84a41ace9d777eeac7ff0f500a4"
100
+ "gitHead": "4e38e6bff3571a7411bd3e3d1be71a5a99848f59"
101
101
  }