@megafon/ui-core 4.0.0-beta.5 → 4.0.0-beta.8

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.
Files changed (36) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/dist/es/components/Accordion/Accordion.css +7 -4
  3. package/dist/es/components/Header/Header.css +3 -0
  4. package/dist/es/components/Header/Header.d.ts +2 -0
  5. package/dist/es/components/Header/Header.js +7 -1
  6. package/dist/es/components/Notification/Notification.css +6 -2
  7. package/dist/es/components/Notification/Notification.js +2 -7
  8. package/dist/es/components/Search/Search.css +124 -6
  9. package/dist/es/components/Search/Search.d.ts +2 -0
  10. package/dist/es/components/Search/Search.js +20 -7
  11. package/dist/es/components/Select/Select.css +159 -26
  12. package/dist/es/components/Select/Select.js +25 -18
  13. package/dist/es/components/Tabs/Tabs.css +9 -4
  14. package/dist/es/index.d.ts +0 -1
  15. package/dist/es/index.js +0 -1
  16. package/dist/lib/components/Accordion/Accordion.css +7 -4
  17. package/dist/lib/components/Header/Header.css +3 -0
  18. package/dist/lib/components/Header/Header.d.ts +2 -0
  19. package/dist/lib/components/Header/Header.js +7 -1
  20. package/dist/lib/components/Notification/Notification.css +6 -2
  21. package/dist/lib/components/Notification/Notification.js +2 -8
  22. package/dist/lib/components/Search/Search.css +124 -6
  23. package/dist/lib/components/Search/Search.d.ts +2 -0
  24. package/dist/lib/components/Search/Search.js +20 -8
  25. package/dist/lib/components/Select/Select.css +159 -26
  26. package/dist/lib/components/Select/Select.js +25 -19
  27. package/dist/lib/components/Tabs/Tabs.css +9 -4
  28. package/dist/lib/index.d.ts +0 -1
  29. package/dist/lib/index.js +0 -8
  30. package/package.json +2 -2
  31. package/dist/es/components/InputLabel/InputLabel.css +0 -5
  32. package/dist/es/components/InputLabel/InputLabel.d.ts +0 -10
  33. package/dist/es/components/InputLabel/InputLabel.js +0 -24
  34. package/dist/lib/components/InputLabel/InputLabel.css +0 -5
  35. package/dist/lib/components/InputLabel/InputLabel.d.ts +0 -10
  36. package/dist/lib/components/InputLabel/InputLabel.js +0 -43
package/CHANGELOG.md CHANGED
@@ -3,6 +3,53 @@
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.8](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@4.0.0-beta.7...@megafon/ui-core@4.0.0-beta.8) (2022-07-14)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **accordion:** change focus and dark theme styles ([d3e07ea](https://github.com/MegafonWebLab/megafon-ui/commit/d3e07ea6fee0c131e25db1bb558d8b205d201e0c))
12
+ * **notification:** change title typography ([f91a60e](https://github.com/MegafonWebLab/megafon-ui/commit/f91a60ee1562626494358ef529321f072ba70890))
13
+ * **tabs:** change dark theme and indents styles ([272dfcb](https://github.com/MegafonWebLab/megafon-ui/commit/272dfcbeef750f2f7ae097b46f7d98405cf53a88))
14
+
15
+
16
+ ### Features
17
+
18
+ * **header:** add new prop space ([e5bef7c](https://github.com/MegafonWebLab/megafon-ui/commit/e5bef7c8e13c57e477a4c25f07a4a4a6dbb8b6bd))
19
+
20
+
21
+
22
+
23
+
24
+ # [4.0.0-beta.7](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@4.0.0-beta.6...@megafon/ui-core@4.0.0-beta.7) (2022-07-13)
25
+
26
+
27
+ ### Bug Fixes
28
+
29
+ * **select:** fix styles ([3e79c68](https://github.com/MegafonWebLab/megafon-ui/commit/3e79c68fecde72e515b7ef52d38d9188e51680f6))
30
+
31
+
32
+
33
+
34
+
35
+ # [4.0.0-beta.6](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@4.0.0-beta.5...@megafon/ui-core@4.0.0-beta.6) (2022-07-05)
36
+
37
+
38
+ ### Features
39
+
40
+ * **inputlabel:** component removed ([1f236ac](https://github.com/MegafonWebLab/megafon-ui/commit/1f236ace90acfd7ea1917422677fa24c1c5abdf4))
41
+ * **search:** component redesign ([d6f11eb](https://github.com/MegafonWebLab/megafon-ui/commit/d6f11eb7ee810b835879c7a31e5e01c426060ea1))
42
+ * **select:** component redesign ([aeeda00](https://github.com/MegafonWebLab/megafon-ui/commit/aeeda00dfc1db70421a495a686954e19eecf815d))
43
+
44
+
45
+ ### BREAKING CHANGES
46
+
47
+ * **inputlabel:** inputLabel component removed due to non-use
48
+
49
+
50
+
51
+
52
+
6
53
  # [4.0.0-beta.5](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.12.0...@megafon/ui-core@4.0.0-beta.5) (2022-06-29)
7
54
 
8
55
 
@@ -12,7 +12,7 @@
12
12
  }
13
13
  .mfui-accordion__title-wrap {
14
14
  position: relative;
15
- padding: 20px 20px 20px 16px;
15
+ padding: 20px 20px 44px 16px;
16
16
  border-radius: 12px;
17
17
  cursor: pointer;
18
18
  -webkit-transition: background-color 0.3s;
@@ -20,11 +20,14 @@
20
20
  }
21
21
  @media screen and (min-width: 768px) {
22
22
  .mfui-accordion__title-wrap {
23
- padding: 20px 24px;
23
+ padding: 20px 56px 20px 24px;
24
24
  }
25
25
  }
26
26
  .mfui-accordion__title-wrap:hover {
27
- background: var(--spbSky1);
27
+ background-color: var(--spbSky1);
28
+ }
29
+ .mfui-accordion__title-wrap:focus {
30
+ background-color: inherit;
28
31
  }
29
32
  .mfui-accordion__icon-box {
30
33
  position: absolute;
@@ -42,7 +45,7 @@
42
45
  width: 24px;
43
46
  height: 24px;
44
47
  border-radius: 50%;
45
- background-color: var(--base);
48
+ background-color: var(--stcWhite);
46
49
  -webkit-box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
47
50
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
48
51
  -webkit-transform: translateY(-50%);
@@ -84,6 +84,9 @@
84
84
  line-height: 24px;
85
85
  font-weight: 500;
86
86
  }
87
+ .mfui-header_space_tight.mfui-header_level_h5 {
88
+ line-height: 18px;
89
+ }
87
90
  .mfui-header_margin.mfui-header_level_h5 {
88
91
  margin: 24px 0 16px 0;
89
92
  }
@@ -3,6 +3,8 @@ import './Header.less';
3
3
  interface IHeaderProps {
4
4
  /** Тег */
5
5
  as?: 'h1' | 'h2' | 'h3' | 'h5';
6
+ /** Поведение текста при встраивании в широкий или узкий контейнер (только для h5) */
7
+ space?: 'wide' | 'tight';
6
8
  /** Цвет */
7
9
  color?: 'default' | 'black' | 'white' | 'green' | 'purple' | 'blue' | 'inherit';
8
10
  /** Включить отступ */
@@ -9,6 +9,8 @@ var Header = function Header(_ref) {
9
9
  var addition = _ref.addition,
10
10
  _ref$as = _ref.as,
11
11
  level = _ref$as === void 0 ? 'h1' : _ref$as,
12
+ _ref$space = _ref.space,
13
+ space = _ref$space === void 0 ? 'wide' : _ref$space,
12
14
  children = _ref.children,
13
15
  className = _ref.className,
14
16
  _ref$color = _ref.color,
@@ -19,12 +21,15 @@ var Header = function Header(_ref) {
19
21
  margin = _ref.margin,
20
22
  onClick = _ref.onClick;
21
23
  var ElementType = level;
24
+ var hasVariousSpaces = level === 'h5';
25
+ var spaceLevel = hasVariousSpaces && space;
22
26
  return /*#__PURE__*/React.createElement(ElementType, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
23
27
  className: cn({
24
28
  color: color,
25
29
  margin: margin,
26
30
  level: level,
27
- 'h-align': hAlign
31
+ 'h-align': hAlign,
32
+ space: spaceLevel
28
33
  }, className),
29
34
  onClick: onClick
30
35
  }), children, addition && /*#__PURE__*/React.createElement("div", {
@@ -35,6 +40,7 @@ var Header = function Header(_ref) {
35
40
  Header.propTypes = {
36
41
  as: PropTypes.oneOf(['h1', 'h2', 'h3', 'h5']),
37
42
  color: PropTypes.oneOf(['default', 'black', 'white', 'green', 'purple', 'blue', 'inherit']),
43
+ space: PropTypes.oneOf(['wide', 'tight']),
38
44
  margin: PropTypes.bool,
39
45
  addition: PropTypes.element,
40
46
  hAlign: PropTypes.oneOf(['inherit', 'left', 'center', 'right']),
@@ -22,12 +22,16 @@ h5 {
22
22
  display: flex;
23
23
  }
24
24
  .mfui-notification__title {
25
- margin-bottom: 8px;
25
+ display: block;
26
+ margin-bottom: 4px;
26
27
  color: var(--content);
28
+ font-weight: 500;
29
+ font-size: 15px;
30
+ line-height: 18px;
27
31
  }
28
32
  @media screen and (min-width: 1280px) {
29
33
  .mfui-notification__title {
30
- margin-bottom: 4px;
34
+ line-height: 24px;
31
35
  }
32
36
  }
33
37
  .mfui-notification__title_close-padding {
@@ -7,7 +7,6 @@ import React, { useEffect, useRef, useState } from 'react';
7
7
  import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
8
8
  import * as PropTypes from 'prop-types';
9
9
  import Button from "../Button/Button";
10
- import Header from "../Header/Header";
11
10
  import TextLink from "../TextLink/TextLink";
12
11
  import Tile from "../Tile/Tile";
13
12
  import "./Notification.css";
@@ -298,13 +297,9 @@ var Notification = function Notification(_ref) {
298
297
  className: cn('content', [contentClass])
299
298
  }, /*#__PURE__*/React.createElement("div", {
300
299
  className: cn('text-container')
301
- }, title && /*#__PURE__*/React.createElement(Header, {
302
- dataAttrs: {
303
- root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.title
304
- },
305
- as: "h5",
300
+ }, title && /*#__PURE__*/React.createElement("span", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.title), {
306
301
  className: cn('title')
307
- }, title), /*#__PURE__*/React.createElement("div", _extends({
302
+ }), title), /*#__PURE__*/React.createElement("div", _extends({
308
303
  ref: wrapTextRef
309
304
  }, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.text), {
310
305
  className: cn('text', {
@@ -1,3 +1,27 @@
1
+ @-webkit-keyframes listAppear {
2
+ from {
3
+ -webkit-transform: translateY(-25px);
4
+ transform: translateY(-25px);
5
+ opacity: 0;
6
+ }
7
+ to {
8
+ -webkit-transform: translateY(0);
9
+ transform: translateY(0);
10
+ opacity: 1;
11
+ }
12
+ }
13
+ @keyframes listAppear {
14
+ from {
15
+ -webkit-transform: translateY(-25px);
16
+ transform: translateY(-25px);
17
+ opacity: 0;
18
+ }
19
+ to {
20
+ -webkit-transform: translateY(0);
21
+ transform: translateY(0);
22
+ opacity: 1;
23
+ }
24
+ }
1
25
  .mfui-search {
2
26
  font-family: inherit;
3
27
  font-size: 15px;
@@ -22,20 +46,106 @@
22
46
  -webkit-box-sizing: border-box;
23
47
  box-sizing: border-box;
24
48
  width: 100%;
25
- height: 48px;
26
- padding: 0 16px 0 20px;
49
+ height: 60px;
50
+ padding: 0 16px 0 16px;
27
51
  border: 1px solid var(--spbSky2);
52
+ border-radius: 12px;
28
53
  background-color: var(--base);
29
54
  outline: none;
30
55
  cursor: pointer;
56
+ -webkit-transition: border-color 0.3s;
57
+ transition: border-color 0.3s;
31
58
  -webkit-user-select: none;
32
59
  -moz-user-select: none;
33
60
  -ms-user-select: none;
34
61
  user-select: none;
35
62
  }
63
+ .mfui-search__control:not(.mfui-search__control_success):not(.mfui-search__control_error):hover {
64
+ border-color: var(--content);
65
+ }
66
+ .mfui-search__control_success {
67
+ border-color: var(--brandGreen);
68
+ }
36
69
  .mfui-search__control_error {
37
70
  border-color: var(--fury);
38
71
  }
72
+ .mfui-search__search-wrapper {
73
+ position: relative;
74
+ display: block;
75
+ width: 100%;
76
+ cursor: text;
77
+ }
78
+ .mfui-search__search-wrapper_labeled {
79
+ padding-top: 22px;
80
+ }
81
+ .mfui-search__label {
82
+ position: absolute;
83
+ top: 17px;
84
+ z-index: 1;
85
+ display: block;
86
+ overflow: auto;
87
+ color: var(--spbSky3);
88
+ -webkit-transition: top 0.5s, -webkit-transform 0.5s;
89
+ transition: top 0.5s, -webkit-transform 0.5s;
90
+ transition: transform 0.5s, top 0.5s;
91
+ transition: transform 0.5s, top 0.5s, -webkit-transform 0.5s;
92
+ pointer-events: none;
93
+ font-family: inherit;
94
+ font-size: 15px;
95
+ line-height: 24px;
96
+ }
97
+ .mfui-search__search-field::-webkit-input-placeholder {
98
+ color: var(--spbSky3);
99
+ opacity: 0;
100
+ -webkit-transition: opacity 0.2s;
101
+ transition: opacity 0.2s;
102
+ }
103
+ .mfui-search__search-field:-moz-placeholder {
104
+ color: var(--spbSky3);
105
+ opacity: 0;
106
+ -webkit-transition: opacity 0.2s;
107
+ transition: opacity 0.2s;
108
+ }
109
+ .mfui-search__search-field:-ms-input-placeholder {
110
+ color: var(--spbSky3);
111
+ opacity: 0;
112
+ -webkit-transition: opacity 0.2s;
113
+ transition: opacity 0.2s;
114
+ }
115
+ .mfui-search__search-field::-moz-placeholder {
116
+ color: var(--spbSky3);
117
+ opacity: 0;
118
+ -webkit-transition: opacity 0.2s;
119
+ transition: opacity 0.2s;
120
+ }
121
+ .mfui-search__search-field::-ms-input-placeholder {
122
+ color: var(--spbSky3);
123
+ opacity: 0;
124
+ -webkit-transition: opacity 0.2s;
125
+ transition: opacity 0.2s;
126
+ }
127
+ .mfui-search__search-field::placeholder {
128
+ color: var(--spbSky3);
129
+ opacity: 0;
130
+ -webkit-transition: opacity 0.2s;
131
+ transition: opacity 0.2s;
132
+ }
133
+ .mfui-search__search-wrapper_labeled .mfui-search__search-field:focus::-webkit-input-placeholder {
134
+ opacity: 1;
135
+ }
136
+ .mfui-search__search-wrapper_labeled .mfui-search__search-field:focus:-moz-placeholder {
137
+ opacity: 1;
138
+ }
139
+ .mfui-search__search-wrapper_labeled .mfui-search__search-field:focus:-ms-input-placeholder {
140
+ opacity: 1;
141
+ }
142
+ .mfui-search__search-field_filled + .mfui-search__label,
143
+ .mfui-search__search-field:focus + .mfui-search__label {
144
+ -webkit-transform: scale(0.8) translate(-12.5%, -75%);
145
+ transform: scale(0.8) translate(-12.5%, -75%);
146
+ -webkit-transition-duration: 0.2s, 0.01s;
147
+ transition-duration: 0.2s, 0.01s;
148
+ }
39
149
  .mfui-search__search-field {
40
150
  position: relative;
41
151
  z-index: 1;
@@ -44,6 +154,7 @@
44
154
  flex-grow: 1;
45
155
  -webkit-box-sizing: border-box;
46
156
  box-sizing: border-box;
157
+ width: 100%;
47
158
  height: 100%;
48
159
  padding: 0;
49
160
  border: none;
@@ -73,9 +184,10 @@
73
184
  left: -1px;
74
185
  z-index: 0;
75
186
  display: none;
187
+ border-radius: 12px;
76
188
  background-color: var(--base);
77
- -webkit-box-shadow: 0 1px 16px rgba(0, 0, 0, 0.2);
78
- box-shadow: 0 1px 16px rgba(0, 0, 0, 0.2);
189
+ -webkit-box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
190
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
79
191
  }
80
192
  .mfui-search__icon {
81
193
  display: block;
@@ -105,12 +217,13 @@
105
217
  -webkit-box-sizing: border-box;
106
218
  box-sizing: border-box;
107
219
  max-height: 368px;
108
- padding: 12px 0;
220
+ padding: 16px;
109
221
  overflow-y: auto;
110
222
  }
111
223
  .mfui-search__list-item {
112
224
  font-family: inherit;
113
225
  padding: 8px 32px;
226
+ border-radius: 16px;
114
227
  background-color: var(--base);
115
228
  cursor: pointer;
116
229
  }
@@ -141,7 +254,12 @@
141
254
  }
142
255
  .mfui-search_open .mfui-search__list {
143
256
  display: block;
144
- border-color: var(--content);
257
+ -webkit-animation-name: listAppear;
258
+ animation-name: listAppear;
259
+ -webkit-animation-duration: 0.3s;
260
+ animation-duration: 0.3s;
261
+ -webkit-animation-timing-function: ease-in-out;
262
+ animation-timing-function: ease-in-out;
145
263
  }
146
264
  .mfui-search_open {
147
265
  z-index: 12;
@@ -24,6 +24,8 @@ export interface ISearchProps {
24
24
  value?: string;
25
25
  /** Заголовок поля */
26
26
  label?: string;
27
+ /** HTML идентификатор поля поиска */
28
+ searchId?: string;
27
29
  /** Текст внутри поля по умолчанию */
28
30
  placeholder?: string;
29
31
  /** Запрещает отрисовку иконки */
@@ -10,7 +10,6 @@ import React from 'react';
10
10
  import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
11
11
  import debounce from 'lodash.debounce';
12
12
  import * as PropTypes from 'prop-types';
13
- import InputLabel from "../InputLabel/InputLabel";
14
13
  import "./Search.css";
15
14
 
16
15
  var SearchIcon = function SearchIcon(props) {
@@ -32,6 +31,8 @@ var Search = function Search(_ref) {
32
31
  _ref$value = _ref.value,
33
32
  value = _ref$value === void 0 ? '' : _ref$value,
34
33
  label = _ref.label,
34
+ _ref$searchId = _ref.searchId,
35
+ searchId = _ref$searchId === void 0 ? 'mfuiSearchId' : _ref$searchId,
35
36
  placeholder = _ref.placeholder,
36
37
  hideIcon = _ref.hideIcon,
37
38
  _ref$items = _ref.items,
@@ -179,14 +180,21 @@ var Search = function Search(_ref) {
179
180
  open: isFocused,
180
181
  disabled: disabled
181
182
  }, [className])
182
- }), label && /*#__PURE__*/React.createElement(InputLabel, null, label, required && /*#__PURE__*/React.createElement("span", {
183
- className: cn('require-mark')
184
- }, "*")), /*#__PURE__*/React.createElement("div", {
183
+ }), /*#__PURE__*/React.createElement("div", {
185
184
  className: cn('control', {
186
- error: verification === Verification.ERROR
185
+ error: verification === Verification.ERROR,
186
+ success: verification === Verification.VALID
187
187
  }, [classes === null || classes === void 0 ? void 0 : classes.control])
188
+ }, /*#__PURE__*/React.createElement("label", {
189
+ className: cn('search-wrapper', {
190
+ labeled: !!label
191
+ }),
192
+ htmlFor: searchId
188
193
  }, /*#__PURE__*/React.createElement("input", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.searchField), {
189
- className: cn('search-field'),
194
+ id: searchId,
195
+ className: cn('search-field', {
196
+ filled: !!searchQuery
197
+ }),
190
198
  placeholder: placeholder,
191
199
  value: searchQuery,
192
200
  onChange: handleChange,
@@ -197,7 +205,11 @@ var Search = function Search(_ref) {
197
205
  disabled: disabled,
198
206
  type: "text",
199
207
  autoComplete: "off"
200
- })), !hideIcon && /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.submit), {
208
+ })), label && /*#__PURE__*/React.createElement("div", {
209
+ className: cn('label')
210
+ }, label, required && /*#__PURE__*/React.createElement("span", {
211
+ className: cn('require-mark')
212
+ }, "*"))), !hideIcon && /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.submit), {
201
213
  className: cn('icon-box'),
202
214
  onClick: handleSearchSubmit
203
215
  }), /*#__PURE__*/React.createElement(SearchIcon, {
@@ -237,6 +249,7 @@ Search.propTypes = {
237
249
  }),
238
250
  value: PropTypes.string,
239
251
  label: PropTypes.string,
252
+ searchId: PropTypes.string,
240
253
  placeholder: PropTypes.string,
241
254
  hideIcon: PropTypes.bool,
242
255
  items: PropTypes.arrayOf(PropTypes.shape({