@megafon/ui-shared 4.20.6 → 4.21.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 +19 -0
- package/dist/es/components/AccordionBox/AccordionBox.d.ts +1 -1
- package/dist/es/components/AccordionBox/AccordionBox.js +15 -2
- package/dist/es/components/Card/Card.css +22 -22
- package/dist/es/components/Card/Card.js +1 -1
- package/dist/es/components/Instructions/img/android.png +0 -0
- package/dist/es/components/Instructions/img/blackIphone.png +0 -0
- package/dist/es/components/Instructions/img/laptop.png +0 -0
- package/dist/es/components/Instructions/img/newIphone.png +0 -0
- package/dist/es/components/Instructions/img/whiteIphone.png +0 -0
- package/dist/es/components/Property/Property.css +89 -60
- package/dist/es/components/Property/Property.d.ts +9 -1
- package/dist/es/components/Property/Property.js +94 -40
- package/dist/es/components/Property/PropertyDescription.css +1 -1
- package/dist/es/components/Property/PropertyDescription.d.ts +1 -0
- package/dist/es/components/Property/PropertyDescription.js +9 -7
- package/dist/es/components/Property/types.d.ts +3 -0
- package/dist/es/components/StoreBanner/doc/img/new-iphone-screen.png +0 -0
- package/dist/es/components/StoreBanner/doc/img/qr-code.png +0 -0
- package/dist/es/components/StoreBanner/doc/img/screen.png +0 -0
- package/dist/es/components/StoreBanner/img/android.png +0 -0
- package/dist/es/components/StoreBanner/img/black-iphone.png +0 -0
- package/dist/es/components/StoreBanner/img/new-iphone.png +0 -0
- package/dist/es/components/StoreBanner/img/white-iphone.png +0 -0
- package/dist/lib/components/AccordionBox/AccordionBox.d.ts +1 -1
- package/dist/lib/components/AccordionBox/AccordionBox.js +18 -2
- package/dist/lib/components/Card/Card.css +22 -22
- package/dist/lib/components/Card/Card.js +1 -1
- package/dist/lib/components/Instructions/img/android.png +0 -0
- package/dist/lib/components/Instructions/img/blackIphone.png +0 -0
- package/dist/lib/components/Instructions/img/laptop.png +0 -0
- package/dist/lib/components/Instructions/img/newIphone.png +0 -0
- package/dist/lib/components/Instructions/img/whiteIphone.png +0 -0
- package/dist/lib/components/Property/Property.css +89 -60
- package/dist/lib/components/Property/Property.d.ts +9 -1
- package/dist/lib/components/Property/Property.js +96 -39
- package/dist/lib/components/Property/PropertyDescription.css +1 -1
- package/dist/lib/components/Property/PropertyDescription.d.ts +1 -0
- package/dist/lib/components/Property/PropertyDescription.js +11 -8
- package/dist/lib/components/Property/types.d.ts +3 -0
- package/dist/lib/components/StoreBanner/doc/img/new-iphone-screen.png +0 -0
- package/dist/lib/components/StoreBanner/doc/img/qr-code.png +0 -0
- package/dist/lib/components/StoreBanner/doc/img/screen.png +0 -0
- package/dist/lib/components/StoreBanner/img/android.png +0 -0
- package/dist/lib/components/StoreBanner/img/black-iphone.png +0 -0
- package/dist/lib/components/StoreBanner/img/new-iphone.png +0 -0
- package/dist/lib/components/StoreBanner/img/white-iphone.png +0 -0
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
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.21.1](https://hq-gitlab.megafon.ru/site-portal/libraries/javascript/megafon-ui/compare/@megafon/ui-shared@4.21.0...@megafon/ui-shared@4.21.1) (2023-08-25)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @megafon/ui-shared
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [4.21.0](https://hq-gitlab.megafon.ru/site-portal/libraries/javascript/megafon-ui/compare/@megafon/ui-shared@4.20.5...@megafon/ui-shared@4.21.0) (2023-08-21)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **property:** redisign component, add new not required props ([f03a822](https://hq-gitlab.megafon.ru/site-portal/libraries/javascript/megafon-ui/commit/f03a822006afed0dd20ad9c9971621c48e50655f))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [4.20.6](https://hq-gitlab.megafon.ru/site-portal/libraries/javascript/megafon-ui/compare/@megafon/ui-shared@4.20.5...@megafon/ui-shared@4.20.6) (2023-07-18)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @megafon/ui-shared
|
|
@@ -27,7 +27,7 @@ export interface IAccordionBox {
|
|
|
27
27
|
isFullWidth?: boolean;
|
|
28
28
|
/** Центрирование по горизонтали для расширения 1280+ */
|
|
29
29
|
hCenterAlignWide?: boolean;
|
|
30
|
-
/** Дополнительный класс для
|
|
30
|
+
/** Дополнительный класс для корневого элемента */
|
|
31
31
|
className?: string;
|
|
32
32
|
/** Дополнительные классы для корневого и внутренних элементов */
|
|
33
33
|
classes?: {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
import "core-js/modules/es.array.index-of.js";
|
|
2
3
|
import "core-js/modules/es.symbol.js";
|
|
3
4
|
|
|
@@ -20,6 +21,7 @@ import { cnCreate } from '@megafon/ui-helpers';
|
|
|
20
21
|
import * as PropTypes from 'prop-types';
|
|
21
22
|
import "./AccordionBox.css";
|
|
22
23
|
import { getColumnConfig } from "../../helpers/getColumnConfig";
|
|
24
|
+
var testIdPrefix = 'AccordionBox';
|
|
23
25
|
var cn = cnCreate('mfui-accordion-box');
|
|
24
26
|
|
|
25
27
|
var AccordionBox = function AccordionBox(_a) {
|
|
@@ -32,8 +34,19 @@ var AccordionBox = function AccordionBox(_a) {
|
|
|
32
34
|
return /*#__PURE__*/React.createElement("div", {
|
|
33
35
|
className: cn()
|
|
34
36
|
}, /*#__PURE__*/React.createElement(Grid, {
|
|
35
|
-
hAlign: hCenterAlignWide ? 'center' : 'left'
|
|
36
|
-
|
|
37
|
+
hAlign: hCenterAlignWide ? 'center' : 'left',
|
|
38
|
+
dataAttrs: {
|
|
39
|
+
container: {
|
|
40
|
+
'data-testid': "".concat(testIdPrefix, "-container")
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}, /*#__PURE__*/React.createElement(GridColumn, _extends({}, getColumnConfig(isFullWidth), {
|
|
44
|
+
dataAttrs: {
|
|
45
|
+
root: {
|
|
46
|
+
'data-testid': "".concat(testIdPrefix, "-column")
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}), /*#__PURE__*/React.createElement(Accordion, restProps))));
|
|
37
50
|
};
|
|
38
51
|
|
|
39
52
|
AccordionBox.propTypes = {
|
|
@@ -5,7 +5,7 @@ h4,
|
|
|
5
5
|
h5 {
|
|
6
6
|
margin: 0;
|
|
7
7
|
}
|
|
8
|
-
.mfui-card {
|
|
8
|
+
.mfui-card-old {
|
|
9
9
|
display: -webkit-box;
|
|
10
10
|
display: -ms-flexbox;
|
|
11
11
|
display: flex;
|
|
@@ -15,7 +15,7 @@ h5 {
|
|
|
15
15
|
-webkit-box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
|
|
16
16
|
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
|
|
17
17
|
}
|
|
18
|
-
.mfui-
|
|
18
|
+
.mfui-card-old__inner {
|
|
19
19
|
display: -webkit-box;
|
|
20
20
|
display: -ms-flexbox;
|
|
21
21
|
display: flex;
|
|
@@ -34,18 +34,18 @@ h5 {
|
|
|
34
34
|
padding: 32px 20px;
|
|
35
35
|
}
|
|
36
36
|
@media screen and (max-width: 767px) {
|
|
37
|
-
.mfui-
|
|
37
|
+
.mfui-card-old__inner {
|
|
38
38
|
padding: 24px 16px;
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
.mfui-
|
|
41
|
+
.mfui-card-old__text {
|
|
42
42
|
font-size: 15px;
|
|
43
43
|
line-height: 24px;
|
|
44
44
|
font-weight: 400;
|
|
45
45
|
margin-top: 12px;
|
|
46
46
|
color: var(--content);
|
|
47
47
|
}
|
|
48
|
-
.mfui-
|
|
48
|
+
.mfui-card-old__btns-wrapper {
|
|
49
49
|
display: -webkit-box;
|
|
50
50
|
display: -ms-flexbox;
|
|
51
51
|
display: flex;
|
|
@@ -60,30 +60,30 @@ h5 {
|
|
|
60
60
|
margin-top: auto;
|
|
61
61
|
padding-top: 12px;
|
|
62
62
|
}
|
|
63
|
-
.mfui-
|
|
63
|
+
.mfui-card-old__btns-wrapper_left-align {
|
|
64
64
|
-webkit-box-pack: start;
|
|
65
65
|
-ms-flex-pack: start;
|
|
66
66
|
justify-content: flex-start;
|
|
67
67
|
}
|
|
68
|
-
.mfui-
|
|
68
|
+
.mfui-card-old__fake-link {
|
|
69
69
|
color: var(--systemBlue);
|
|
70
70
|
}
|
|
71
|
-
.mfui-
|
|
72
|
-
.mfui-
|
|
73
|
-
.mfui-
|
|
71
|
+
.mfui-card-old__button,
|
|
72
|
+
.mfui-card-old__link,
|
|
73
|
+
.mfui-card-old__fake-link {
|
|
74
74
|
margin: 12px 10px;
|
|
75
75
|
}
|
|
76
|
-
.mfui-
|
|
76
|
+
.mfui-card-old__svg-wrapper {
|
|
77
77
|
margin-bottom: 24px;
|
|
78
78
|
}
|
|
79
|
-
.mfui-
|
|
79
|
+
.mfui-card-old__svg-wrapper svg {
|
|
80
80
|
width: 40px;
|
|
81
81
|
height: 40px;
|
|
82
82
|
}
|
|
83
|
-
.mfui-
|
|
83
|
+
.mfui-card-old__pic-wrapper .mfui-card-old__img {
|
|
84
84
|
max-width: 100%;
|
|
85
85
|
}
|
|
86
|
-
.mfui-
|
|
86
|
+
.mfui-card-old__pic-wrapper {
|
|
87
87
|
display: -webkit-box;
|
|
88
88
|
display: -ms-flexbox;
|
|
89
89
|
display: flex;
|
|
@@ -99,32 +99,32 @@ h5 {
|
|
|
99
99
|
margin-left: -20px;
|
|
100
100
|
}
|
|
101
101
|
@media screen and (max-width: 767px) {
|
|
102
|
-
.mfui-
|
|
102
|
+
.mfui-card-old__pic-wrapper {
|
|
103
103
|
margin-top: -24px;
|
|
104
104
|
margin-right: -16px;
|
|
105
105
|
margin-bottom: 24px;
|
|
106
106
|
margin-left: -16px;
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
-
.mfui-
|
|
109
|
+
.mfui-card-old__pic-wrapper_object-fit_fill img {
|
|
110
110
|
width: 100%;
|
|
111
111
|
height: auto;
|
|
112
112
|
}
|
|
113
|
-
.mfui-
|
|
113
|
+
.mfui-card-old__pic-wrapper_object-fit_contain img {
|
|
114
114
|
width: auto;
|
|
115
115
|
height: 100%;
|
|
116
116
|
}
|
|
117
|
-
.mfui-
|
|
117
|
+
.mfui-card-old_href * {
|
|
118
118
|
text-decoration: none !important;
|
|
119
119
|
}
|
|
120
|
-
.mfui-
|
|
120
|
+
.mfui-card-old_href:hover {
|
|
121
121
|
-webkit-box-shadow: 0 8px 28px rgba(0, 0, 0, 0.1);
|
|
122
122
|
box-shadow: 0 8px 28px rgba(0, 0, 0, 0.1);
|
|
123
123
|
}
|
|
124
|
-
.mfui-
|
|
124
|
+
.mfui-card-old_full-height {
|
|
125
125
|
height: 100%;
|
|
126
126
|
}
|
|
127
|
-
.mfui-
|
|
128
|
-
.mfui-
|
|
127
|
+
.mfui-card-old_centered-text .mfui-card-old__text,
|
|
128
|
+
.mfui-card-old_centered-text .mfui-card-old__title {
|
|
129
129
|
text-align: center;
|
|
130
130
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -15,98 +15,124 @@ h5 {
|
|
|
15
15
|
flex-direction: column;
|
|
16
16
|
padding: 24px 0;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
.mfui-property_border-top.mfui-property_border-color_default .mfui-property__wrapper {
|
|
19
|
+
border-top: 1px solid var(--spbSky1);
|
|
20
|
+
}
|
|
21
|
+
.mfui-property_border-bottom.mfui-property_border-color_default .mfui-property__wrapper {
|
|
22
|
+
border-bottom: 1px solid var(--spbSky1);
|
|
22
23
|
}
|
|
23
|
-
.mfui-property_border-top .mfui-property__wrapper {
|
|
24
|
+
.mfui-property_border-top.mfui-property_border-color_darker .mfui-property__wrapper {
|
|
24
25
|
border-top: 1px solid var(--spbSky2);
|
|
25
26
|
}
|
|
26
|
-
.mfui-property_border-bottom .mfui-property__wrapper {
|
|
27
|
+
.mfui-property_border-bottom.mfui-property_border-color_darker .mfui-property__wrapper {
|
|
27
28
|
border-bottom: 1px solid var(--spbSky2);
|
|
28
29
|
}
|
|
29
|
-
.mfui-
|
|
30
|
+
.mfui-property__main {
|
|
30
31
|
display: -webkit-box;
|
|
31
32
|
display: -ms-flexbox;
|
|
32
33
|
display: flex;
|
|
34
|
+
gap: 20px;
|
|
35
|
+
-webkit-box-align: baseline;
|
|
36
|
+
-ms-flex-align: baseline;
|
|
37
|
+
align-items: baseline;
|
|
38
|
+
-webkit-box-pack: justify;
|
|
39
|
+
-ms-flex-pack: justify;
|
|
40
|
+
justify-content: space-between;
|
|
33
41
|
}
|
|
34
|
-
.mfui-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
42
|
+
.mfui-property__main:not(:first-child) {
|
|
43
|
+
margin-top: 24px;
|
|
44
|
+
}
|
|
45
|
+
.mfui-property__main_with-out-title {
|
|
46
|
+
margin-top: 16px !important;
|
|
47
|
+
}
|
|
48
|
+
.mfui-property__main_with-badge {
|
|
49
|
+
-webkit-box-align: center;
|
|
50
|
+
-ms-flex-align: center;
|
|
51
|
+
align-items: center;
|
|
52
|
+
}
|
|
53
|
+
.mfui-property__title-item_size_default {
|
|
54
|
+
font-size: 15px;
|
|
55
|
+
line-height: 24px;
|
|
56
|
+
font-weight: 500;
|
|
57
|
+
}
|
|
58
|
+
.mfui-property__title-item_size_big {
|
|
59
|
+
font-weight: 500;
|
|
60
|
+
font-size: 18px;
|
|
61
|
+
line-height: 24px;
|
|
62
|
+
letter-spacing: 0.5px;
|
|
63
|
+
}
|
|
64
|
+
@media screen and (min-width: 1280px) {
|
|
65
|
+
.mfui-property__title-item_size_big {
|
|
66
|
+
font-size: 20px;
|
|
67
|
+
line-height: 28px;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
@media screen and (max-width: 767px) {
|
|
71
|
+
.mfui-property__title-item {
|
|
72
|
+
font-size: 15px;
|
|
73
|
+
line-height: 24px;
|
|
74
|
+
font-weight: 500;
|
|
75
|
+
}
|
|
38
76
|
}
|
|
39
77
|
.mfui-property__icon {
|
|
40
78
|
display: inline-block;
|
|
41
79
|
width: 24px;
|
|
42
80
|
height: 24px;
|
|
43
|
-
margin-right:
|
|
81
|
+
margin-right: 8px;
|
|
44
82
|
margin-left: 1px;
|
|
45
83
|
overflow: hidden;
|
|
46
84
|
vertical-align: bottom;
|
|
47
85
|
}
|
|
48
86
|
.mfui-property__badge {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
.mfui-property__inner {
|
|
56
|
-
-webkit-box-flex: 1;
|
|
57
|
-
-ms-flex-positive: 1;
|
|
58
|
-
flex-grow: 1;
|
|
59
|
-
padding-right: 20px;
|
|
60
|
-
}
|
|
61
|
-
@media screen and (min-width: 768px) and (max-width: 1023px) {
|
|
62
|
-
.mfui-property__inner {
|
|
63
|
-
padding-right: 77px;
|
|
87
|
+
margin-bottom: 8px;
|
|
88
|
+
}
|
|
89
|
+
@media screen and (min-width: 768px) {
|
|
90
|
+
.mfui-property__title .mfui-property__desc {
|
|
91
|
+
width: 100%;
|
|
64
92
|
}
|
|
65
93
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
94
|
+
.mfui-property__tooltip {
|
|
95
|
+
display: inline-block;
|
|
96
|
+
width: 20px;
|
|
97
|
+
height: 20px;
|
|
98
|
+
margin-left: 8px;
|
|
99
|
+
vertical-align: text-bottom;
|
|
100
|
+
cursor: pointer;
|
|
101
|
+
fill: var(--spbSky2);
|
|
102
|
+
}
|
|
103
|
+
.mfui-property__tooltip-inner {
|
|
104
|
+
max-width: 350px;
|
|
105
|
+
}
|
|
106
|
+
.mfui-property__desc {
|
|
107
|
+
margin-top: 12px;
|
|
108
|
+
}
|
|
109
|
+
@media screen and (min-width: 768px) {
|
|
110
|
+
.mfui-property__desc {
|
|
111
|
+
width: 70%;
|
|
69
112
|
}
|
|
70
113
|
}
|
|
71
|
-
.mfui-
|
|
72
|
-
|
|
114
|
+
.mfui-property__desc_collapsible {
|
|
115
|
+
margin-top: 12px;
|
|
73
116
|
}
|
|
74
117
|
.mfui-property__value-wrapper {
|
|
75
118
|
display: -webkit-box;
|
|
76
119
|
display: -ms-flexbox;
|
|
77
120
|
display: flex;
|
|
78
|
-
-
|
|
79
|
-
flex-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
-
|
|
84
|
-
|
|
85
|
-
justify-content: flex-end;
|
|
86
|
-
width: 35%;
|
|
87
|
-
}
|
|
88
|
-
@media screen and (max-width: 479px) {
|
|
89
|
-
.mfui-property__value-wrapper {
|
|
90
|
-
width: auto;
|
|
91
|
-
padding-left: 10px;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
.mfui-property__value-wrapper_merged {
|
|
95
|
-
-webkit-box-align: center;
|
|
96
|
-
-ms-flex-align: center;
|
|
97
|
-
align-items: center;
|
|
98
|
-
border-left: 1px solid var(--spbSky2);
|
|
121
|
+
-webkit-box-align: baseline;
|
|
122
|
+
-ms-flex-align: baseline;
|
|
123
|
+
align-items: baseline;
|
|
124
|
+
padding: 4px 8px;
|
|
125
|
+
border-radius: 8px;
|
|
126
|
+
white-space: pre-line;
|
|
127
|
+
text-align: right;
|
|
99
128
|
}
|
|
100
|
-
.mfui-
|
|
101
|
-
|
|
129
|
+
.mfui-property__value-wrapper_frame_default {
|
|
130
|
+
background: var(--base);
|
|
102
131
|
}
|
|
103
|
-
.mfui-
|
|
104
|
-
|
|
132
|
+
.mfui-property__value-wrapper_frame_gray {
|
|
133
|
+
background: var(--spbSky0);
|
|
105
134
|
}
|
|
106
135
|
.mfui-property__value {
|
|
107
|
-
max-width: 234px;
|
|
108
|
-
white-space: pre-line;
|
|
109
|
-
text-align: right;
|
|
110
136
|
font-weight: 500;
|
|
111
137
|
font-size: 18px;
|
|
112
138
|
line-height: 24px;
|
|
@@ -125,3 +151,6 @@ h5 {
|
|
|
125
151
|
font-weight: 500;
|
|
126
152
|
}
|
|
127
153
|
}
|
|
154
|
+
.mfui-property__value-unit:before {
|
|
155
|
+
content: '\00a0';
|
|
156
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React, { Ref } from 'react';
|
|
1
|
+
import React, { Ref, ComponentProps } from 'react';
|
|
2
|
+
import { PromoBadge } from '@megafon/ui-core';
|
|
2
3
|
import './Property.less';
|
|
3
4
|
import { Item } from './types';
|
|
4
5
|
export interface IProperty {
|
|
@@ -10,10 +11,16 @@ export interface IProperty {
|
|
|
10
11
|
className?: string;
|
|
11
12
|
/** Текст для бейджа */
|
|
12
13
|
badge?: string;
|
|
14
|
+
/** Тип бейджа */
|
|
15
|
+
badgeType?: ComponentProps<typeof PromoBadge>['type'];
|
|
16
|
+
/** Текст тултипа */
|
|
17
|
+
tooltip?: string;
|
|
13
18
|
/** Отключить верхнюю границу */
|
|
14
19
|
disableBorderTop?: boolean;
|
|
15
20
|
/** Наличие нижней границы */
|
|
16
21
|
borderBottom?: boolean;
|
|
22
|
+
/** Цвет верхней и нижней границ */
|
|
23
|
+
borderColor?: 'default' | 'darker';
|
|
17
24
|
/** Единое значение для всей строки */
|
|
18
25
|
mergedValue?: string;
|
|
19
26
|
/** Иконка для строки */
|
|
@@ -32,5 +39,6 @@ export interface IProperty {
|
|
|
32
39
|
toggleDescription?: string;
|
|
33
40
|
};
|
|
34
41
|
}
|
|
42
|
+
export declare const testIdPrefix = "Property";
|
|
35
43
|
declare const Property: React.FC<IProperty>;
|
|
36
44
|
export default Property;
|
|
@@ -2,13 +2,23 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import "core-js/modules/es.array.map.js";
|
|
3
3
|
import "core-js/modules/es.symbol.js";
|
|
4
4
|
import "core-js/modules/es.symbol.description.js";
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import {
|
|
7
|
-
import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
|
|
5
|
+
import React, { Fragment, useRef } from 'react';
|
|
6
|
+
import { Grid, GridColumn, PromoBadge, Caption, Tooltip } from '@megafon/ui-core';
|
|
7
|
+
import { cnCreate, filterDataAttrs, convert } from '@megafon/ui-helpers';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import "./Property.css";
|
|
10
10
|
import { getColumnConfig } from "../../helpers/getColumnConfig";
|
|
11
11
|
import PropertyDescription from "./PropertyDescription";
|
|
12
|
+
|
|
13
|
+
var InfoIcon = function InfoIcon(props) {
|
|
14
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
15
|
+
viewBox: "0 0 20 20"
|
|
16
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
17
|
+
d: "M10 2c4.4 0 8 3.6 8 8s-3.6 8-8 8-8-3.6-8-8 3.6-8 8-8zm0 5c.6 0 1-.4 1-1s-.4-1-1-1-1 .4-1 1 .4 1 1 1zm1 8V9H9v6h2z"
|
|
18
|
+
}));
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export var testIdPrefix = 'Property';
|
|
12
22
|
var cn = cnCreate('mfui-property');
|
|
13
23
|
|
|
14
24
|
var Property = function Property(_ref) {
|
|
@@ -17,11 +27,16 @@ var Property = function Property(_ref) {
|
|
|
17
27
|
className = _ref.className,
|
|
18
28
|
_ref$badge = _ref.badge,
|
|
19
29
|
badge = _ref$badge === void 0 ? '' : _ref$badge,
|
|
30
|
+
_ref$badgeType = _ref.badgeType,
|
|
31
|
+
badgeType = _ref$badgeType === void 0 ? 'popular' : _ref$badgeType,
|
|
32
|
+
tooltip = _ref.tooltip,
|
|
20
33
|
icon = _ref.icon,
|
|
21
34
|
_ref$disableBorderTop = _ref.disableBorderTop,
|
|
22
35
|
disableBorderTop = _ref$disableBorderTop === void 0 ? false : _ref$disableBorderTop,
|
|
23
36
|
_ref$borderBottom = _ref.borderBottom,
|
|
24
37
|
borderBottom = _ref$borderBottom === void 0 ? false : _ref$borderBottom,
|
|
38
|
+
_ref$borderColor = _ref.borderColor,
|
|
39
|
+
borderColor = _ref$borderColor === void 0 ? 'default' : _ref$borderColor,
|
|
25
40
|
_ref$mergedValue = _ref.mergedValue,
|
|
26
41
|
mergedValue = _ref$mergedValue === void 0 ? '' : _ref$mergedValue,
|
|
27
42
|
_ref$fullWidth = _ref.fullWidth,
|
|
@@ -29,23 +44,37 @@ var Property = function Property(_ref) {
|
|
|
29
44
|
_ref$classes = _ref.classes,
|
|
30
45
|
classes = _ref$classes === void 0 ? {} : _ref$classes,
|
|
31
46
|
dataAttrs = _ref.dataAttrs;
|
|
32
|
-
var
|
|
47
|
+
var tooltipRef = useRef(null);
|
|
48
|
+
|
|
49
|
+
var renderTitle = function renderTitle(title, titleSize, isFirstItem) {
|
|
33
50
|
return title && title.map(function (titleItem, i) {
|
|
34
|
-
|
|
35
|
-
|
|
51
|
+
var isFirstTitle = i === 0;
|
|
52
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
36
53
|
key: i,
|
|
37
|
-
className:
|
|
38
|
-
|
|
54
|
+
className: cn('title-item', {
|
|
55
|
+
size: titleSize
|
|
56
|
+
}, [classes.title]),
|
|
57
|
+
"data-testid": "".concat(testIdPrefix, "-title-item")
|
|
58
|
+
}, icon && isFirstTitle && /*#__PURE__*/React.createElement("div", {
|
|
39
59
|
className: cn('icon')
|
|
40
|
-
}, icon), titleItem
|
|
60
|
+
}, icon), titleItem, tooltip && isFirstItem && isFirstTitle && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
61
|
+
className: cn('tooltip'),
|
|
62
|
+
ref: tooltipRef
|
|
63
|
+
}, /*#__PURE__*/React.createElement(InfoIcon, null)), /*#__PURE__*/React.createElement(Tooltip, {
|
|
64
|
+
className: cn('tooltip-inner'),
|
|
65
|
+
triggerElement: tooltipRef
|
|
66
|
+
}, tooltip)));
|
|
41
67
|
});
|
|
42
|
-
}
|
|
43
|
-
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
var renderDescription = function renderDescription(description) {
|
|
44
71
|
return description && description.map(function (_ref2, j) {
|
|
45
72
|
var value = _ref2.value,
|
|
46
73
|
isCollapsible = _ref2.isCollapsible;
|
|
47
74
|
return /*#__PURE__*/React.createElement("div", {
|
|
48
|
-
className: cn('desc'
|
|
75
|
+
className: cn('desc', {
|
|
76
|
+
collapsible: isCollapsible
|
|
77
|
+
}),
|
|
49
78
|
key: j
|
|
50
79
|
}, /*#__PURE__*/React.createElement(PropertyDescription, {
|
|
51
80
|
value: value,
|
|
@@ -59,44 +88,63 @@ var Property = function Property(_ref) {
|
|
|
59
88
|
}
|
|
60
89
|
}));
|
|
61
90
|
});
|
|
62
|
-
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
var renderValue = function renderValue(valueFrameColor, value, valueUnit) {
|
|
94
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
95
|
+
className: cn('value-wrapper', {
|
|
96
|
+
frame: valueFrameColor
|
|
97
|
+
}),
|
|
98
|
+
"data-testid": "".concat(testIdPrefix, "-value")
|
|
99
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
100
|
+
className: cn('value')
|
|
101
|
+
}, convert(value, {})), valueUnit && /*#__PURE__*/React.createElement(Caption, {
|
|
102
|
+
className: cn('value-unit'),
|
|
103
|
+
hasMargin: false
|
|
104
|
+
}, convert(valueUnit, {})));
|
|
105
|
+
};
|
|
106
|
+
|
|
63
107
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
64
108
|
className: cn({
|
|
65
109
|
'border-top': !disableBorderTop,
|
|
66
|
-
'border-bottom': borderBottom
|
|
110
|
+
'border-bottom': borderBottom,
|
|
111
|
+
'border-color': borderColor
|
|
67
112
|
}, [className]),
|
|
68
113
|
ref: rootRef
|
|
69
|
-
}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root)), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(GridColumn, getColumnConfig(fullWidth),
|
|
114
|
+
}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root)), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(GridColumn, _extends({}, getColumnConfig(fullWidth), {
|
|
115
|
+
dataAttrs: {
|
|
116
|
+
root: {
|
|
117
|
+
'data-testid': "".concat(testIdPrefix, "-gridColumn")
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
70
121
|
className: cn('wrapper')
|
|
71
|
-
}, badge && /*#__PURE__*/React.createElement("div", {
|
|
72
|
-
className: cn('badge-wrapper')
|
|
73
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
74
|
-
className: cn('badge')
|
|
75
|
-
}, badge)), /*#__PURE__*/React.createElement("div", {
|
|
76
|
-
className: cn('content')
|
|
77
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
78
|
-
className: cn('items-wrapper')
|
|
79
122
|
}, items.map(function (_ref3, i) {
|
|
80
123
|
var title = _ref3.title,
|
|
81
124
|
value = _ref3.value,
|
|
82
|
-
description = _ref3.description
|
|
83
|
-
|
|
84
|
-
|
|
125
|
+
description = _ref3.description,
|
|
126
|
+
_ref3$valueUnit = _ref3.valueUnit,
|
|
127
|
+
valueUnit = _ref3$valueUnit === void 0 ? '' : _ref3$valueUnit,
|
|
128
|
+
_ref3$titleSize = _ref3.titleSize,
|
|
129
|
+
titleSize = _ref3$titleSize === void 0 ? 'default' : _ref3$titleSize,
|
|
130
|
+
_ref3$valueFrameColor = _ref3.valueFrameColor,
|
|
131
|
+
valueFrameColor = _ref3$valueFrameColor === void 0 ? 'default' : _ref3$valueFrameColor;
|
|
132
|
+
var isFirstItem = i === 0;
|
|
133
|
+
var isRenderBadge = isFirstItem && !!badge;
|
|
134
|
+
return /*#__PURE__*/React.createElement(Fragment, {
|
|
85
135
|
key: i
|
|
86
136
|
}, /*#__PURE__*/React.createElement("div", {
|
|
87
|
-
className: cn('
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
})
|
|
97
|
-
}
|
|
98
|
-
as: "h3"
|
|
99
|
-
}, mergedValue)))))));
|
|
137
|
+
className: cn('main', {
|
|
138
|
+
'with-badge': isRenderBadge,
|
|
139
|
+
'with-out-title': !title
|
|
140
|
+
})
|
|
141
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
142
|
+
className: cn('title')
|
|
143
|
+
}, isRenderBadge && /*#__PURE__*/React.createElement(PromoBadge, {
|
|
144
|
+
className: cn('badge'),
|
|
145
|
+
type: badgeType
|
|
146
|
+
}, badge), title ? renderTitle(title, titleSize, isFirstItem) : renderDescription(description)), mergedValue && isFirstItem && renderValue(valueFrameColor, mergedValue, valueUnit), !mergedValue && value && renderValue(valueFrameColor, value, valueUnit)), title && renderDescription(description));
|
|
147
|
+
})))));
|
|
100
148
|
};
|
|
101
149
|
|
|
102
150
|
Property.propTypes = {
|
|
@@ -109,12 +157,18 @@ Property.propTypes = {
|
|
|
109
157
|
value: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.node)]).isRequired,
|
|
110
158
|
isCollapsible: PropTypes.bool
|
|
111
159
|
})),
|
|
112
|
-
value: PropTypes.string
|
|
160
|
+
value: PropTypes.string,
|
|
161
|
+
titleSize: PropTypes.oneOf(['default', 'big']),
|
|
162
|
+
valueUnit: PropTypes.string,
|
|
163
|
+
valueFrameColor: PropTypes.oneOf(['default', 'gray'])
|
|
113
164
|
}).isRequired).isRequired,
|
|
114
165
|
className: PropTypes.string,
|
|
115
166
|
badge: PropTypes.string,
|
|
167
|
+
badgeType: PropTypes.oneOf(['hit', 'new', 'vip', 'popular', 'user-choice', 'interests']),
|
|
168
|
+
tooltip: PropTypes.string,
|
|
116
169
|
disableBorderTop: PropTypes.bool,
|
|
117
170
|
borderBottom: PropTypes.bool,
|
|
171
|
+
borderColor: PropTypes.oneOf(['default', 'darker']),
|
|
118
172
|
mergedValue: PropTypes.string,
|
|
119
173
|
icon: PropTypes.node,
|
|
120
174
|
fullWidth: PropTypes.bool,
|