@megafon/ui-shared 2.0.0-beta.99 → 2.0.0
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 +1610 -0
- package/README.md +0 -5
- package/dist/es/components/AccordionBox/AccordionBox.css +13 -0
- package/dist/es/components/AccordionBox/AccordionBox.d.ts +16 -1
- package/dist/es/components/AccordionBox/AccordionBox.js +29 -13
- package/dist/es/components/BannerBox/BannerBox.js +3 -2
- package/dist/es/components/BenefitsIcons/BenefitsIcons.d.ts +13 -2
- package/dist/es/components/BenefitsIcons/BenefitsIcons.js +82 -17
- package/dist/es/components/BenefitsIcons/BenefitsIconsTile.d.ts +2 -1
- package/dist/es/components/BenefitsIcons/BenefitsIconsTile.js +15 -14
- package/dist/es/components/BenefitsIcons/style/BenefitsIcons.css +3 -3
- package/dist/es/components/BenefitsIcons/style/BenefitsIconsTile.css +19 -12
- package/dist/es/components/BenefitsIcons/types.d.ts +7 -2
- package/dist/es/components/BenefitsIcons/types.js +4 -0
- package/dist/es/components/BenefitsPictures/BenefitsPictures.d.ts +10 -1
- package/dist/es/components/BenefitsPictures/BenefitsPictures.js +28 -12
- package/dist/es/components/BenefitsPictures/BenfitsPictures.css +4 -4
- package/dist/es/components/Breadcrumbs/Breadcrumbs.css +46 -0
- package/dist/es/components/Breadcrumbs/Breadcrumbs.d.ts +21 -0
- package/dist/es/components/Breadcrumbs/Breadcrumbs.js +49 -0
- package/dist/es/components/ButtonBanner/ButtonBanner.css +122 -0
- package/dist/es/components/ButtonBanner/ButtonBanner.d.ts +54 -0
- package/dist/es/components/ButtonBanner/ButtonBanner.js +107 -0
- package/dist/es/components/ButtonLinkBox/ButtonLinkBox.css +3 -3
- package/dist/es/components/ButtonLinkBox/ButtonLinkBox.d.ts +22 -2
- package/dist/es/components/ButtonLinkBox/ButtonLinkBox.js +37 -8
- package/dist/es/components/Card/Card.css +71 -44
- package/dist/es/components/Card/Card.d.ts +33 -3
- package/dist/es/components/Card/Card.js +103 -42
- package/dist/es/components/CardsBox/CardsBox.d.ts +10 -2
- package/dist/es/components/CardsBox/CardsBox.js +26 -13
- package/dist/es/components/CarouselBox/CarouselBox.js +3 -2
- package/dist/es/components/Container/Container.css +1815 -547
- package/dist/es/components/Container/Container.d.ts +11 -1
- package/dist/es/components/Container/Container.js +28 -6
- package/dist/es/components/DownloadLinks/DownloadLink.css +5 -5
- package/dist/es/components/DownloadLinks/DownloadLink.d.ts +7 -0
- package/dist/es/components/DownloadLinks/DownloadLink.js +28 -6
- package/dist/es/components/DownloadLinks/DownloadLinks.css +9 -6
- package/dist/es/components/DownloadLinks/DownloadLinks.d.ts +2 -0
- package/dist/es/components/DownloadLinks/DownloadLinks.js +18 -3
- package/dist/es/components/Instructions/Instructions.css +189 -130
- package/dist/es/components/Instructions/Instructions.d.ts +21 -2
- package/dist/es/components/Instructions/Instructions.js +115 -74
- package/dist/es/components/Instructions/img/iphone12.png +0 -0
- package/dist/es/components/PageTitle/PageTitle.css +80 -0
- package/dist/es/components/PageTitle/PageTitle.d.ts +23 -0
- package/dist/es/components/PageTitle/PageTitle.js +65 -0
- package/dist/es/components/Partners/Partners.css +22 -31
- package/dist/es/components/Partners/Partners.d.ts +13 -1
- package/dist/es/components/Partners/Partners.js +40 -18
- package/dist/es/components/PictureWithDescription/PictureWithDescription.css +25 -10
- package/dist/es/components/PictureWithDescription/PictureWithDescription.d.ts +13 -0
- package/dist/es/components/PictureWithDescription/PictureWithDescription.js +31 -7
- package/dist/es/components/Property/Property.css +79 -71
- package/dist/es/components/Property/Property.d.ts +21 -2
- package/dist/es/components/Property/Property.js +80 -34
- package/dist/es/components/Property/PropertyDescription.css +3 -3
- package/dist/es/components/Property/PropertyDescription.js +19 -21
- package/dist/es/components/Property/types.d.ts +7 -2
- package/dist/es/components/Steps/Steps.css +41 -0
- package/dist/es/components/Steps/Steps.d.ts +10 -0
- package/dist/es/components/Steps/Steps.js +35 -0
- package/dist/es/components/Steps/StepsItem.css +37 -0
- package/dist/es/components/Steps/StepsItem.d.ts +10 -0
- package/dist/es/components/Steps/StepsItem.js +26 -0
- package/dist/es/components/StoreBanner/StoreBanner.css +289 -0
- package/dist/es/components/StoreBanner/StoreBanner.d.ts +65 -0
- package/dist/es/components/StoreBanner/StoreBanner.js +145 -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/es/components/StoreButton/StoreButton.css +15 -0
- package/dist/es/components/StoreButton/StoreButton.d.ts +17 -0
- package/dist/es/components/StoreButton/StoreButton.js +37 -0
- package/dist/es/components/StoreButton/img/app-store.png +0 -0
- package/dist/es/components/StoreButton/img/google-play.png +0 -0
- package/dist/es/components/StoreButton/img/huawei-store.png +0 -0
- package/dist/es/components/Table/Table.css +67 -67
- package/dist/es/components/Table/Table.js +4 -4
- package/dist/es/components/Table/TableRow.js +1 -0
- package/dist/es/components/TabsBox/TabsBox.d.ts +4 -1
- package/dist/es/components/TabsBox/TabsBox.js +24 -3
- package/dist/es/components/TextBox/TextBox.css +7 -1
- package/dist/es/components/TextBox/TextBox.d.ts +8 -0
- package/dist/es/components/TextBox/TextBox.js +37 -5
- package/dist/es/components/TextBox/TextBoxPicture.css +24 -0
- package/dist/es/components/TextBox/TextBoxPicture.d.ts +17 -0
- package/dist/es/components/TextBox/TextBoxPicture.js +32 -0
- package/dist/es/components/TitleDescriptionBox/TitleDescriptionBox.css +15 -4
- package/dist/es/components/TitleDescriptionBox/TitleDescriptionBox.d.ts +8 -2
- package/dist/es/components/TitleDescriptionBox/TitleDescriptionBox.js +34 -14
- package/dist/es/components/VideoBanner/VideoBanner.css +155 -76
- package/dist/es/components/VideoBanner/VideoBanner.d.ts +64 -13
- package/dist/es/components/VideoBanner/VideoBanner.js +202 -70
- package/dist/es/components/VideoBlock/VideoBlock.css +32 -28
- package/dist/es/components/VideoBlock/VideoBlock.d.ts +20 -6
- package/dist/es/components/VideoBlock/VideoBlock.js +63 -44
- package/dist/es/constants/throttleTime.d.ts +4 -0
- package/dist/es/constants/throttleTime.js +3 -0
- package/dist/es/index.d.ts +8 -0
- package/dist/es/index.js +8 -0
- package/dist/lib/components/AccordionBox/AccordionBox.css +13 -0
- package/dist/lib/components/AccordionBox/AccordionBox.d.ts +16 -1
- package/dist/lib/components/AccordionBox/AccordionBox.js +31 -19
- package/dist/lib/components/BannerBox/BannerBox.js +3 -5
- package/dist/lib/components/BenefitsIcons/BenefitsIcons.d.ts +13 -2
- package/dist/lib/components/BenefitsIcons/BenefitsIcons.js +84 -20
- package/dist/lib/components/BenefitsIcons/BenefitsIconsTile.d.ts +2 -1
- package/dist/lib/components/BenefitsIcons/BenefitsIconsTile.js +15 -16
- package/dist/lib/components/BenefitsIcons/style/BenefitsIcons.css +3 -3
- package/dist/lib/components/BenefitsIcons/style/BenefitsIconsTile.css +19 -12
- package/dist/lib/components/BenefitsIcons/types.d.ts +7 -2
- package/dist/lib/components/BenefitsIcons/types.js +7 -2
- package/dist/lib/components/BenefitsPictures/BenefitsPictures.d.ts +10 -1
- package/dist/lib/components/BenefitsPictures/BenefitsPictures.js +32 -15
- package/dist/lib/components/BenefitsPictures/BenfitsPictures.css +4 -4
- package/dist/lib/components/Breadcrumbs/Breadcrumbs.css +46 -0
- package/dist/lib/components/Breadcrumbs/Breadcrumbs.d.ts +21 -0
- package/dist/lib/components/Breadcrumbs/Breadcrumbs.js +65 -0
- package/dist/lib/components/ButtonBanner/ButtonBanner.css +122 -0
- package/dist/lib/components/ButtonBanner/ButtonBanner.d.ts +54 -0
- package/dist/lib/components/ButtonBanner/ButtonBanner.js +133 -0
- package/dist/lib/components/ButtonLinkBox/ButtonLinkBox.css +3 -3
- package/dist/lib/components/ButtonLinkBox/ButtonLinkBox.d.ts +22 -2
- package/dist/lib/components/ButtonLinkBox/ButtonLinkBox.js +45 -11
- package/dist/lib/components/Card/Card.css +71 -44
- package/dist/lib/components/Card/Card.d.ts +33 -3
- package/dist/lib/components/Card/Card.js +118 -59
- package/dist/lib/components/CardsBox/CardsBox.d.ts +10 -2
- package/dist/lib/components/CardsBox/CardsBox.js +30 -16
- package/dist/lib/components/CarouselBox/CarouselBox.js +3 -5
- package/dist/lib/components/Container/Container.css +1815 -547
- package/dist/lib/components/Container/Container.d.ts +11 -1
- package/dist/lib/components/Container/Container.js +32 -11
- package/dist/lib/components/DownloadLinks/DownloadLink.css +5 -5
- package/dist/lib/components/DownloadLinks/DownloadLink.d.ts +7 -0
- package/dist/lib/components/DownloadLinks/DownloadLink.js +32 -11
- package/dist/lib/components/DownloadLinks/DownloadLinks.css +9 -6
- package/dist/lib/components/DownloadLinks/DownloadLinks.d.ts +2 -0
- package/dist/lib/components/DownloadLinks/DownloadLinks.js +20 -6
- package/dist/lib/components/Instructions/Instructions.css +189 -130
- package/dist/lib/components/Instructions/Instructions.d.ts +21 -2
- package/dist/lib/components/Instructions/Instructions.js +148 -104
- package/dist/lib/components/Instructions/img/iphone12.png +0 -0
- package/dist/lib/components/PageTitle/PageTitle.css +80 -0
- package/dist/lib/components/PageTitle/PageTitle.d.ts +23 -0
- package/dist/lib/components/PageTitle/PageTitle.js +85 -0
- package/dist/lib/components/Partners/Partners.css +22 -31
- package/dist/lib/components/Partners/Partners.d.ts +13 -1
- package/dist/lib/components/Partners/Partners.js +43 -23
- package/dist/lib/components/PictureWithDescription/PictureWithDescription.css +25 -10
- package/dist/lib/components/PictureWithDescription/PictureWithDescription.d.ts +13 -0
- package/dist/lib/components/PictureWithDescription/PictureWithDescription.js +33 -8
- package/dist/lib/components/Property/Property.css +79 -71
- package/dist/lib/components/Property/Property.d.ts +21 -2
- package/dist/lib/components/Property/Property.js +93 -53
- package/dist/lib/components/Property/PropertyDescription.css +3 -3
- package/dist/lib/components/Property/PropertyDescription.js +21 -25
- package/dist/lib/components/Property/types.d.ts +7 -2
- package/dist/lib/components/Steps/Steps.css +41 -0
- package/dist/lib/components/Steps/Steps.d.ts +10 -0
- package/dist/lib/components/Steps/Steps.js +55 -0
- package/dist/lib/components/Steps/StepsItem.css +37 -0
- package/dist/lib/components/Steps/StepsItem.d.ts +10 -0
- package/dist/lib/components/Steps/StepsItem.js +39 -0
- package/dist/lib/components/StoreBanner/StoreBanner.css +289 -0
- package/dist/lib/components/StoreBanner/StoreBanner.d.ts +65 -0
- package/dist/lib/components/StoreBanner/StoreBanner.js +169 -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/dist/lib/components/StoreButton/StoreButton.css +15 -0
- package/dist/lib/components/StoreButton/StoreButton.d.ts +17 -0
- package/dist/lib/components/StoreButton/StoreButton.js +58 -0
- package/dist/lib/components/StoreButton/img/app-store.png +0 -0
- package/dist/lib/components/StoreButton/img/google-play.png +0 -0
- package/dist/lib/components/StoreButton/img/huawei-store.png +0 -0
- package/dist/lib/components/Table/Table.css +67 -67
- package/dist/lib/components/Table/Table.js +6 -8
- package/dist/lib/components/Table/TableRow.js +1 -0
- package/dist/lib/components/TabsBox/TabsBox.d.ts +4 -1
- package/dist/lib/components/TabsBox/TabsBox.js +25 -2
- package/dist/lib/components/TextBox/TextBox.css +7 -1
- package/dist/lib/components/TextBox/TextBox.d.ts +8 -0
- package/dist/lib/components/TextBox/TextBox.js +39 -6
- package/dist/lib/components/TextBox/TextBoxPicture.css +24 -0
- package/dist/lib/components/TextBox/TextBoxPicture.d.ts +17 -0
- package/dist/lib/components/TextBox/TextBoxPicture.js +49 -0
- package/dist/lib/components/TitleDescriptionBox/TitleDescriptionBox.css +15 -4
- package/dist/lib/components/TitleDescriptionBox/TitleDescriptionBox.d.ts +8 -2
- package/dist/lib/components/TitleDescriptionBox/TitleDescriptionBox.js +39 -19
- package/dist/lib/components/VideoBanner/VideoBanner.css +155 -76
- package/dist/lib/components/VideoBanner/VideoBanner.d.ts +64 -13
- package/dist/lib/components/VideoBanner/VideoBanner.js +225 -89
- package/dist/lib/components/VideoBlock/VideoBlock.css +32 -28
- package/dist/lib/components/VideoBlock/VideoBlock.d.ts +20 -6
- package/dist/lib/components/VideoBlock/VideoBlock.js +76 -68
- package/dist/lib/constants/throttleTime.d.ts +4 -0
- package/dist/lib/constants/throttleTime.js +10 -0
- package/dist/lib/index.d.ts +8 -0
- package/dist/lib/index.js +64 -0
- package/package.json +19 -75
@@ -5,99 +5,126 @@ h4,
|
|
5
5
|
h5 {
|
6
6
|
margin: 0;
|
7
7
|
}
|
8
|
-
.mfui-
|
8
|
+
.mfui-card {
|
9
|
+
display: -webkit-box;
|
10
|
+
display: -ms-flexbox;
|
11
|
+
display: flex;
|
9
12
|
border-radius: 8px;
|
13
|
+
overflow: hidden;
|
14
|
+
background-color: #FFFFFF;
|
10
15
|
-webkit-box-shadow: 0 0.25px 3px rgba(0, 0, 0, 0.25);
|
11
16
|
box-shadow: 0 0.25px 3px rgba(0, 0, 0, 0.25);
|
12
|
-
background-color: #FFFFFF;
|
13
|
-
overflow: hidden;
|
14
17
|
}
|
15
|
-
.mfui-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
-webkit-box-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
.mfui-card__inner {
|
19
|
+
display: -webkit-box;
|
20
|
+
display: -ms-flexbox;
|
21
|
+
display: flex;
|
22
|
+
-webkit-box-orient: vertical;
|
23
|
+
-webkit-box-direction: normal;
|
24
|
+
-ms-flex-direction: column;
|
25
|
+
flex-direction: column;
|
26
|
+
-webkit-box-flex: 0;
|
27
|
+
-ms-flex-positive: 0;
|
28
|
+
flex-grow: 0;
|
29
|
+
-ms-flex-negative: 1;
|
30
|
+
flex-shrink: 1;
|
31
|
+
-webkit-box-sizing: border-box;
|
32
|
+
box-sizing: border-box;
|
33
|
+
width: 100%;
|
23
34
|
padding: 32px 20px;
|
24
35
|
}
|
25
36
|
@media screen and (max-width: 767px) {
|
26
|
-
.mfui-
|
37
|
+
.mfui-card__inner {
|
27
38
|
padding: 24px 16px;
|
28
39
|
}
|
29
40
|
}
|
30
|
-
.mfui-
|
31
|
-
|
41
|
+
.mfui-card__text {
|
42
|
+
font-size: 15px;
|
43
|
+
line-height: 24px;
|
44
|
+
font-weight: 400;
|
45
|
+
margin-top: 12px;
|
46
|
+
color: #333333;
|
32
47
|
}
|
33
|
-
.mfui-
|
48
|
+
.mfui-card__btns-wrapper {
|
34
49
|
display: -webkit-box;
|
35
50
|
display: -ms-flexbox;
|
36
51
|
display: flex;
|
37
52
|
-ms-flex-wrap: wrap;
|
38
53
|
flex-wrap: wrap;
|
39
|
-
-webkit-box-pack: space-evenly;
|
40
|
-
-ms-flex-pack: space-evenly;
|
41
|
-
justify-content: space-evenly;
|
42
54
|
-webkit-box-align: center;
|
43
55
|
-ms-flex-align: center;
|
44
56
|
align-items: center;
|
45
|
-
|
57
|
+
-webkit-box-pack: space-evenly;
|
58
|
+
-ms-flex-pack: space-evenly;
|
59
|
+
justify-content: space-evenly;
|
60
|
+
margin-top: auto;
|
61
|
+
padding-top: 12px;
|
46
62
|
}
|
47
|
-
.mfui-
|
63
|
+
.mfui-card__btns-wrapper_left-align {
|
48
64
|
-webkit-box-pack: start;
|
49
65
|
-ms-flex-pack: start;
|
50
66
|
justify-content: flex-start;
|
51
67
|
}
|
52
|
-
.mfui-
|
68
|
+
.mfui-card__fake-link {
|
53
69
|
color: #34AAF2;
|
54
70
|
}
|
55
|
-
.mfui-
|
56
|
-
.mfui-
|
57
|
-
.mfui-
|
71
|
+
.mfui-card__button,
|
72
|
+
.mfui-card__link,
|
73
|
+
.mfui-card__fake-link {
|
58
74
|
margin: 12px 10px;
|
59
75
|
}
|
60
|
-
.mfui-
|
61
|
-
margin-bottom:
|
76
|
+
.mfui-card__svg-wrapper {
|
77
|
+
margin-bottom: 24px;
|
62
78
|
}
|
63
|
-
|
64
|
-
.mfui-beta-card__pic-wrapper {
|
65
|
-
margin-bottom: 24px;
|
66
|
-
}
|
67
|
-
}
|
68
|
-
.mfui-beta-card__pic-wrapper .mfui-beta-card__img {
|
69
|
-
max-width: 100%;
|
70
|
-
}
|
71
|
-
.mfui-beta-card__pic-wrapper svg {
|
79
|
+
.mfui-card__svg-wrapper svg {
|
72
80
|
width: 40px;
|
73
81
|
height: 40px;
|
74
82
|
}
|
75
|
-
.mfui-
|
83
|
+
.mfui-card__pic-wrapper .mfui-card__img {
|
84
|
+
max-width: 100%;
|
85
|
+
}
|
86
|
+
.mfui-card__pic-wrapper {
|
76
87
|
display: -webkit-box;
|
77
88
|
display: -ms-flexbox;
|
78
89
|
display: flex;
|
79
|
-
-webkit-box-pack: center;
|
80
|
-
-ms-flex-pack: center;
|
81
|
-
justify-content: center;
|
82
90
|
-webkit-box-align: center;
|
83
91
|
-ms-flex-align: center;
|
84
92
|
align-items: center;
|
93
|
+
-webkit-box-pack: center;
|
94
|
+
-ms-flex-pack: center;
|
95
|
+
justify-content: center;
|
85
96
|
margin-top: -32px;
|
86
|
-
margin-left: -20px;
|
87
97
|
margin-right: -20px;
|
98
|
+
margin-bottom: 32px;
|
99
|
+
margin-left: -20px;
|
88
100
|
}
|
89
101
|
@media screen and (max-width: 767px) {
|
90
|
-
.mfui-
|
102
|
+
.mfui-card__pic-wrapper {
|
91
103
|
margin-top: -24px;
|
92
|
-
margin-left: -16px;
|
93
104
|
margin-right: -16px;
|
105
|
+
margin-bottom: 24px;
|
106
|
+
margin-left: -16px;
|
94
107
|
}
|
95
108
|
}
|
96
|
-
.mfui-
|
109
|
+
.mfui-card__pic-wrapper_object-fit_fill img {
|
97
110
|
width: 100%;
|
98
111
|
height: auto;
|
99
112
|
}
|
100
|
-
.mfui-
|
113
|
+
.mfui-card__pic-wrapper_object-fit_contain img {
|
101
114
|
width: auto;
|
102
115
|
height: 100%;
|
103
116
|
}
|
117
|
+
.mfui-card_href * {
|
118
|
+
text-decoration: none !important;
|
119
|
+
}
|
120
|
+
.mfui-card_href:hover {
|
121
|
+
-webkit-box-shadow: 0 8px 28px rgba(0, 0, 0, 0.1);
|
122
|
+
box-shadow: 0 8px 28px rgba(0, 0, 0, 0.1);
|
123
|
+
}
|
124
|
+
.mfui-card_full-height {
|
125
|
+
height: 100%;
|
126
|
+
}
|
127
|
+
.mfui-card_centered-text .mfui-card__text,
|
128
|
+
.mfui-card_centered-text .mfui-card__title {
|
129
|
+
text-align: center;
|
130
|
+
}
|
@@ -1,12 +1,21 @@
|
|
1
|
-
import
|
1
|
+
import React, { Ref } from 'react';
|
2
2
|
import './Card.less';
|
3
|
+
export declare const Target: {
|
4
|
+
readonly SELF: "_self";
|
5
|
+
readonly BLANK: "_blank";
|
6
|
+
};
|
7
|
+
declare type TargetType = typeof Target[keyof typeof Target];
|
3
8
|
interface IButton {
|
4
9
|
title: string;
|
5
10
|
href: string;
|
11
|
+
target?: TargetType;
|
12
|
+
download?: boolean;
|
6
13
|
}
|
7
14
|
interface ILink {
|
8
15
|
title: string;
|
9
16
|
href?: string;
|
17
|
+
target?: TargetType;
|
18
|
+
download?: boolean;
|
10
19
|
}
|
11
20
|
export declare const ObjectFit: {
|
12
21
|
readonly FILL: "fill";
|
@@ -14,22 +23,43 @@ export declare const ObjectFit: {
|
|
14
23
|
};
|
15
24
|
declare type ObjectFitType = typeof ObjectFit[keyof typeof ObjectFit];
|
16
25
|
export interface ICard {
|
26
|
+
/** Дата атрибуты для корневого элемента */
|
27
|
+
dataAttrs?: {
|
28
|
+
[key: string]: string;
|
29
|
+
};
|
30
|
+
/** Дополнительный класс корневого элемента */
|
31
|
+
className?: string;
|
32
|
+
/** Дополнительные классы для корневого и внутренних элементов */
|
33
|
+
classes?: {
|
34
|
+
root?: string;
|
35
|
+
button?: string;
|
36
|
+
link?: string;
|
37
|
+
inner?: string;
|
38
|
+
};
|
39
|
+
/** Ссылка на корневой элемент */
|
40
|
+
rootRef?: Ref<HTMLDivElement>;
|
17
41
|
/** Изображение в карточке */
|
18
42
|
imageSrc?: string;
|
19
43
|
/** Иконка в карточке */
|
20
44
|
svgSrc?: React.ReactNode;
|
21
45
|
/** Заголовок карточки */
|
22
|
-
title: string;
|
46
|
+
title: string | React.ReactNode[] | React.ReactNode;
|
23
47
|
/** Текст карточки */
|
24
|
-
text
|
48
|
+
text?: string | React.ReactNode[] | React.ReactNode;
|
25
49
|
/** Данные для кнопки */
|
26
50
|
button?: IButton;
|
27
51
|
/** Данные для ссылки */
|
28
52
|
link?: ILink;
|
53
|
+
/** Выравнивание текста по центру */
|
54
|
+
isCenteredText?: boolean;
|
29
55
|
/** Расположение кнопки/ссылки по левой стороне */
|
30
56
|
isLeftHAlign?: boolean;
|
57
|
+
/** Высота корневого элемента 100% */
|
58
|
+
isFullHeight?: boolean;
|
31
59
|
/** Ссылка для всей карточки */
|
32
60
|
href?: string;
|
61
|
+
/** Target свойство, аналогично свойству 'target' тега 'a' */
|
62
|
+
target?: TargetType;
|
33
63
|
/** Режим позиционирования изображения */
|
34
64
|
objectFit?: ObjectFitType;
|
35
65
|
}
|
@@ -1,30 +1,45 @@
|
|
1
1
|
import "core-js/modules/es.object.values";
|
2
2
|
import "core-js/modules/es.string.link";
|
3
|
-
import
|
3
|
+
import _extends from "@babel/runtime/helpers/extends";
|
4
|
+
import React from 'react';
|
4
5
|
import "./Card.css";
|
5
|
-
import {
|
6
|
+
import { Header, Button, TextLink, Link } from '@megafon/ui-core';
|
7
|
+
import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
|
6
8
|
import PropTypes from 'prop-types';
|
9
|
+
export var Target = {
|
10
|
+
SELF: '_self',
|
11
|
+
BLANK: '_blank'
|
12
|
+
};
|
7
13
|
export var ObjectFit = {
|
8
14
|
FILL: 'fill',
|
9
15
|
CONTAIN: 'contain'
|
10
16
|
};
|
11
|
-
var cn = cnCreate('mfui-
|
17
|
+
var cn = cnCreate('mfui-card');
|
12
18
|
|
13
19
|
var Card = function Card(_ref) {
|
14
|
-
var
|
20
|
+
var dataAttrs = _ref.dataAttrs,
|
21
|
+
className = _ref.className,
|
22
|
+
_ref$classes = _ref.classes,
|
23
|
+
classes = _ref$classes === void 0 ? {} : _ref$classes,
|
24
|
+
rootRef = _ref.rootRef,
|
25
|
+
imageSrc = _ref.imageSrc,
|
15
26
|
svgSrc = _ref.svgSrc,
|
16
27
|
title = _ref.title,
|
17
28
|
text = _ref.text,
|
18
29
|
button = _ref.button,
|
19
30
|
link = _ref.link,
|
31
|
+
_ref$isCenteredText = _ref.isCenteredText,
|
32
|
+
isCenteredText = _ref$isCenteredText === void 0 ? false : _ref$isCenteredText,
|
20
33
|
_ref$isLeftHAlign = _ref.isLeftHAlign,
|
21
34
|
isLeftHAlign = _ref$isLeftHAlign === void 0 ? false : _ref$isLeftHAlign,
|
35
|
+
_ref$isFullHeight = _ref.isFullHeight,
|
36
|
+
isFullHeight = _ref$isFullHeight === void 0 ? false : _ref$isFullHeight,
|
22
37
|
href = _ref.href,
|
38
|
+
target = _ref.target,
|
23
39
|
_ref$objectFit = _ref.objectFit,
|
24
40
|
objectFit = _ref$objectFit === void 0 ? 'fill' : _ref$objectFit;
|
25
41
|
var isAlignAvailable = !button || !link;
|
26
42
|
var isCardLink = !!href;
|
27
|
-
var isRenderBtn = !!button && !isCardLink;
|
28
43
|
var Element = href ? Link : 'div';
|
29
44
|
var renderImage = React.useCallback(function () {
|
30
45
|
switch (true) {
|
@@ -32,19 +47,19 @@ var Card = function Card(_ref) {
|
|
32
47
|
{
|
33
48
|
return /*#__PURE__*/React.createElement("div", {
|
34
49
|
className: cn('pic-wrapper', {
|
35
|
-
'object-fit': objectFit
|
36
|
-
'img': true
|
50
|
+
'object-fit': objectFit
|
37
51
|
})
|
38
52
|
}, /*#__PURE__*/React.createElement("img", {
|
39
53
|
className: cn('img'),
|
40
|
-
src: imageSrc
|
54
|
+
src: imageSrc,
|
55
|
+
alt: ""
|
41
56
|
}));
|
42
57
|
}
|
43
58
|
|
44
59
|
case !!svgSrc:
|
45
60
|
{
|
46
61
|
return /*#__PURE__*/React.createElement("div", {
|
47
|
-
className: cn('
|
62
|
+
className: cn('svg-wrapper')
|
48
63
|
}, svgSrc);
|
49
64
|
}
|
50
65
|
|
@@ -52,65 +67,111 @@ var Card = function Card(_ref) {
|
|
52
67
|
return null;
|
53
68
|
}
|
54
69
|
}, [imageSrc, svgSrc, objectFit]);
|
55
|
-
var renderLink = React.useCallback(function (
|
56
|
-
|
57
|
-
|
58
|
-
|
70
|
+
var renderLink = React.useCallback(function () {
|
71
|
+
if (!link) {
|
72
|
+
return null;
|
73
|
+
}
|
74
|
+
|
75
|
+
var linkHref = link.href,
|
76
|
+
linkTitle = link.title,
|
77
|
+
linkTarget = link.target,
|
78
|
+
download = link.download;
|
59
79
|
|
60
|
-
if (
|
80
|
+
if (!linkHref || isCardLink) {
|
61
81
|
return /*#__PURE__*/React.createElement("span", {
|
62
82
|
className: cn('fake-link')
|
63
83
|
}, linkTitle);
|
64
84
|
}
|
65
85
|
|
66
86
|
return /*#__PURE__*/React.createElement(TextLink, {
|
67
|
-
className: cn('link'),
|
68
|
-
href: linkHref
|
87
|
+
className: cn('link', [classes.link]),
|
88
|
+
href: linkHref,
|
89
|
+
target: linkTarget,
|
90
|
+
download: download
|
69
91
|
}, linkTitle);
|
70
|
-
}, [isCardLink]);
|
71
|
-
var renderBtn = React.useCallback(function (
|
72
|
-
|
73
|
-
|
92
|
+
}, [link, isCardLink, classes]);
|
93
|
+
var renderBtn = React.useCallback(function () {
|
94
|
+
if (!button || isCardLink) {
|
95
|
+
return null;
|
96
|
+
}
|
97
|
+
|
98
|
+
var btnHref = button.href,
|
99
|
+
btnTitle = button.title,
|
100
|
+
btnTarget = button.target,
|
101
|
+
buttonDownload = button.download;
|
74
102
|
return /*#__PURE__*/React.createElement(Button, {
|
75
|
-
className: cn('button'),
|
76
|
-
href: btnHref
|
103
|
+
className: cn('button', [classes.button]),
|
104
|
+
href: btnHref,
|
105
|
+
target: btnTarget,
|
106
|
+
download: buttonDownload
|
77
107
|
}, btnTitle);
|
78
|
-
}, []);
|
79
|
-
|
108
|
+
}, [button, isCardLink, classes]);
|
109
|
+
var renderBtnsWrapper = React.useCallback(function () {
|
110
|
+
var btnElem = renderBtn();
|
111
|
+
var linkElem = renderLink();
|
112
|
+
|
113
|
+
if (!btnElem && !linkElem) {
|
114
|
+
return null;
|
115
|
+
}
|
116
|
+
|
117
|
+
return /*#__PURE__*/React.createElement("div", {
|
118
|
+
className: cn('btns-wrapper', {
|
119
|
+
'left-align': isAlignAvailable && isLeftHAlign
|
120
|
+
})
|
121
|
+
}, btnElem, linkElem);
|
122
|
+
}, [renderBtn, renderLink, isAlignAvailable, isLeftHAlign]);
|
123
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs), {
|
80
124
|
className: cn('', {
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
125
|
+
href: !!href,
|
126
|
+
'full-height': isFullHeight,
|
127
|
+
'centered-text': isCenteredText
|
128
|
+
}, [className, classes.root]),
|
129
|
+
ref: rootRef
|
130
|
+
}), /*#__PURE__*/React.createElement(Element, {
|
131
|
+
href: href,
|
132
|
+
target: target,
|
133
|
+
className: cn('inner', [classes.inner])
|
134
|
+
}, /*#__PURE__*/React.createElement(React.Fragment, null, renderImage(), /*#__PURE__*/React.createElement(Header, {
|
88
135
|
as: "h3",
|
89
136
|
className: cn('title')
|
90
|
-
}, title), /*#__PURE__*/React.createElement(
|
91
|
-
|
92
|
-
}, text),
|
93
|
-
className: cn('btns-wrapper', {
|
94
|
-
'left-align': isAlignAvailable && isLeftHAlign
|
95
|
-
})
|
96
|
-
}, isRenderBtn && renderBtn(button), link && renderLink(link)))));
|
137
|
+
}, title), !!text && /*#__PURE__*/React.createElement("div", {
|
138
|
+
className: cn('text')
|
139
|
+
}, text), renderBtnsWrapper())));
|
97
140
|
};
|
98
141
|
|
99
142
|
Card.propTypes = {
|
143
|
+
dataAttrs: PropTypes.objectOf(PropTypes.string.isRequired),
|
144
|
+
className: PropTypes.string,
|
145
|
+
classes: PropTypes.shape({
|
146
|
+
root: PropTypes.string,
|
147
|
+
button: PropTypes.string,
|
148
|
+
link: PropTypes.string,
|
149
|
+
inner: PropTypes.string
|
150
|
+
}),
|
151
|
+
rootRef: PropTypes.oneOfType([PropTypes.func, PropTypes.oneOfType([PropTypes.shape({
|
152
|
+
current: PropTypes.elementType
|
153
|
+
}), PropTypes.any])]),
|
100
154
|
imageSrc: PropTypes.string,
|
101
155
|
svgSrc: PropTypes.node,
|
102
|
-
title: PropTypes.string.isRequired,
|
103
|
-
text: PropTypes.string.
|
156
|
+
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node, PropTypes.arrayOf(PropTypes.node)]).isRequired,
|
157
|
+
text: PropTypes.oneOfType([PropTypes.string, PropTypes.node, PropTypes.arrayOf(PropTypes.node)]),
|
104
158
|
button: PropTypes.shape({
|
105
159
|
title: PropTypes.string.isRequired,
|
106
|
-
href: PropTypes.string.isRequired
|
160
|
+
href: PropTypes.string.isRequired,
|
161
|
+
target: PropTypes.oneOf(Object.values(Target)),
|
162
|
+
download: PropTypes.bool
|
107
163
|
}),
|
108
164
|
link: PropTypes.shape({
|
109
165
|
title: PropTypes.string.isRequired,
|
110
|
-
href: PropTypes.string
|
166
|
+
href: PropTypes.string,
|
167
|
+
target: PropTypes.oneOf(Object.values(Target)),
|
168
|
+
download: PropTypes.bool
|
111
169
|
}),
|
170
|
+
isCenteredText: PropTypes.bool,
|
112
171
|
isLeftHAlign: PropTypes.bool,
|
172
|
+
isFullHeight: PropTypes.bool,
|
113
173
|
href: PropTypes.string,
|
174
|
+
target: PropTypes.oneOf(Object.values(Target)),
|
114
175
|
objectFit: PropTypes.oneOf(Object.values(ObjectFit))
|
115
176
|
};
|
116
177
|
export default Card;
|
@@ -1,7 +1,15 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import { ICard } from '../Card/Card';
|
3
|
-
interface
|
3
|
+
interface ICardsBoxProps {
|
4
|
+
/** Ссылка на корневой элемент */
|
5
|
+
rootRef?: React.Ref<HTMLDivElement>;
|
6
|
+
/** Дата атрибуты для корневого элемента */
|
7
|
+
dataAttrs?: {
|
8
|
+
[key: string]: string;
|
9
|
+
};
|
10
|
+
/** Обработчик смены слайда (должен быть обернут в useCallback) */
|
11
|
+
onChange?: (currentIndex: number, previousIndex: number, slidesPerView?: number | 'auto') => void;
|
4
12
|
children: Array<React.ReactElement<ICard>> | React.ReactElement<ICard>;
|
5
13
|
}
|
6
|
-
declare const CardsBox: React.FC<
|
14
|
+
declare const CardsBox: React.FC<ICardsBoxProps>;
|
7
15
|
export default CardsBox;
|
@@ -1,25 +1,31 @@
|
|
1
1
|
import "core-js/modules/es.array.map";
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
3
4
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
4
5
|
|
5
6
|
var _SlidesSettings;
|
6
7
|
|
7
8
|
import * as React from 'react';
|
8
|
-
import
|
9
|
+
import { Grid, GridColumn, Carousel } from '@megafon/ui-core';
|
10
|
+
import { breakpoints, cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
|
9
11
|
import throttle from 'lodash.throttle';
|
10
|
-
import
|
12
|
+
import * as PropTypes from 'prop-types';
|
13
|
+
import throttleTime from "../../constants/throttleTime";
|
11
14
|
var MAX_CARDS_COUNT_IN_GRID_ON_MOBILE = 2;
|
12
|
-
var SlidesSettings = (_SlidesSettings = {}, _defineProperty(_SlidesSettings, breakpoints.
|
15
|
+
var SlidesSettings = (_SlidesSettings = {}, _defineProperty(_SlidesSettings, breakpoints.MOBILE_SMALL_START, {
|
13
16
|
slidesPerView: 1,
|
14
17
|
spaceBetween: 16
|
15
|
-
}), _defineProperty(_SlidesSettings, breakpoints.
|
18
|
+
}), _defineProperty(_SlidesSettings, breakpoints.MOBILE_BIG_START, {
|
16
19
|
slidesPerView: 2,
|
17
20
|
spaceBetween: 20
|
18
21
|
}), _SlidesSettings);
|
19
|
-
var cn = cnCreate('mfui-
|
22
|
+
var cn = cnCreate('mfui-cards-box');
|
20
23
|
|
21
24
|
var CardsBox = function CardsBox(_ref) {
|
22
|
-
var
|
25
|
+
var rootRef = _ref.rootRef,
|
26
|
+
dataAttrs = _ref.dataAttrs,
|
27
|
+
onChange = _ref.onChange,
|
28
|
+
children = _ref.children;
|
23
29
|
|
24
30
|
var _React$useState = React.useState(false),
|
25
31
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
@@ -41,12 +47,13 @@ var CardsBox = function CardsBox(_ref) {
|
|
41
47
|
}, [children]);
|
42
48
|
var renderCarousel = React.useCallback(function () {
|
43
49
|
return /*#__PURE__*/React.createElement(Carousel, {
|
44
|
-
slidesSettings: SlidesSettings
|
50
|
+
slidesSettings: SlidesSettings,
|
51
|
+
onChange: onChange
|
45
52
|
}, children);
|
46
|
-
}, [children]);
|
53
|
+
}, [children, onChange]);
|
47
54
|
React.useEffect(function () {
|
48
55
|
var resizeHandler = function resizeHandler() {
|
49
|
-
return window.innerWidth <= breakpoints.
|
56
|
+
return window.innerWidth <= breakpoints.MOBILE_BIG_END ? setIsMobile(true) : setIsMobile(false);
|
50
57
|
};
|
51
58
|
|
52
59
|
var resizeHandlerThrottled = throttle(resizeHandler, throttleTime.resize);
|
@@ -56,12 +63,18 @@ var CardsBox = function CardsBox(_ref) {
|
|
56
63
|
window.removeEventListener('resize', resizeHandlerThrottled);
|
57
64
|
};
|
58
65
|
}, []);
|
59
|
-
return /*#__PURE__*/React.createElement("div", {
|
60
|
-
className: cn()
|
61
|
-
|
66
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
67
|
+
className: cn(),
|
68
|
+
ref: rootRef
|
69
|
+
}, filterDataAttrs(dataAttrs)), isRenderCarousel ? renderCarousel() : renderGrid());
|
62
70
|
};
|
63
71
|
|
64
72
|
CardsBox.propTypes = {
|
65
|
-
|
73
|
+
rootRef: PropTypes.oneOfType([PropTypes.func, PropTypes.oneOfType([PropTypes.shape({
|
74
|
+
current: PropTypes.elementType
|
75
|
+
}), PropTypes.any])]),
|
76
|
+
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element.isRequired), PropTypes.element]).isRequired,
|
77
|
+
dataAttrs: PropTypes.objectOf(PropTypes.string.isRequired),
|
78
|
+
onChange: PropTypes.func
|
66
79
|
};
|
67
80
|
export default CardsBox;
|
@@ -15,8 +15,9 @@ var __rest = this && this.__rest || function (s, e) {
|
|
15
15
|
};
|
16
16
|
|
17
17
|
import * as React from 'react';
|
18
|
-
import {
|
19
|
-
|
18
|
+
import { Carousel } from '@megafon/ui-core';
|
19
|
+
import { cnCreate } from '@megafon/ui-helpers';
|
20
|
+
var cn = cnCreate('mfui-carousel-box');
|
20
21
|
|
21
22
|
var CarouselBox = function CarouselBox(_a) {
|
22
23
|
var children = _a.children,
|