@megafon/ui-shared 4.21.2 → 5.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.
Files changed (32) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/es/components/Card/Card.css +226 -83
  3. package/dist/es/components/Card/Card.d.ts +30 -62
  4. package/dist/es/components/Card/Card.js +237 -157
  5. package/dist/es/components/Card/types.d.ts +71 -0
  6. package/dist/es/components/Card/types.js +0 -0
  7. package/dist/es/components/CardsBox/CardsBox.d.ts +4 -7
  8. package/dist/es/components/CardsBox/CardsBox.js +21 -67
  9. package/dist/es/components/CardsBox/helpers.d.ts +10 -0
  10. package/dist/es/components/CardsBox/helpers.js +25 -0
  11. package/dist/es/components/CarouselBox/CarouselBox.d.ts +6 -1
  12. package/dist/es/components/CarouselBox/CarouselBox.js +27 -3
  13. package/dist/es/components/Property/Property.js +2 -2
  14. package/dist/es/components/Property/types.d.ts +1 -1
  15. package/dist/es/index.d.ts +1 -0
  16. package/dist/es/index.js +1 -0
  17. package/dist/lib/components/Card/Card.css +226 -83
  18. package/dist/lib/components/Card/Card.d.ts +30 -62
  19. package/dist/lib/components/Card/Card.js +233 -160
  20. package/dist/lib/components/Card/types.d.ts +71 -0
  21. package/dist/lib/components/Card/types.js +1 -0
  22. package/dist/lib/components/CardsBox/CardsBox.d.ts +4 -7
  23. package/dist/lib/components/CardsBox/CardsBox.js +19 -67
  24. package/dist/lib/components/CardsBox/helpers.d.ts +10 -0
  25. package/dist/lib/components/CardsBox/helpers.js +35 -0
  26. package/dist/lib/components/CarouselBox/CarouselBox.d.ts +6 -1
  27. package/dist/lib/components/CarouselBox/CarouselBox.js +29 -2
  28. package/dist/lib/components/Property/Property.js +2 -2
  29. package/dist/lib/components/Property/types.d.ts +1 -1
  30. package/dist/lib/index.d.ts +1 -0
  31. package/dist/lib/index.js +8 -0
  32. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -3,6 +3,30 @@
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
+ # [5.0.0](https://hq-gitlab.megafon.ru/site-portal/libraries/javascript/megafon-ui/compare/@megafon/ui-shared@4.21.2...@megafon/ui-shared@5.0.0) (2023-08-30)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **property:** fix default value frame color ([340cd88](https://hq-gitlab.megafon.ru/site-portal/libraries/javascript/megafon-ui/commit/340cd88eba9746540b4a7398ca42d3af4e1647f4))
12
+
13
+
14
+ ### Features
15
+
16
+ * **card:** full redesign ([7368f0d](https://hq-gitlab.megafon.ru/site-portal/libraries/javascript/megafon-ui/commit/7368f0dfaab8964489c427f9a3b649f87a1ba10b))
17
+ * **cardsbox:** redesign ([1952bd8](https://hq-gitlab.megafon.ru/site-portal/libraries/javascript/megafon-ui/commit/1952bd8b50eef8ff7e6e42bf2eaa3825f85e54c6))
18
+ * **carouselbox:** add minor features ([068a27d](https://hq-gitlab.megafon.ru/site-portal/libraries/javascript/megafon-ui/commit/068a27d1f3e48a6b161aa50cfa73e288acdfae75))
19
+
20
+
21
+ ### BREAKING CHANGES
22
+
23
+ * **cardsbox:** remove onChange, gridHAlign and rootRef props; change dataAttrs prop;
24
+ * **card:** removed all props, added new props
25
+
26
+
27
+
28
+
29
+
6
30
  ## [4.21.2](https://hq-gitlab.megafon.ru/site-portal/libraries/javascript/megafon-ui/compare/@megafon/ui-shared@4.21.1...@megafon/ui-shared@4.21.2) (2023-08-28)
7
31
 
8
32
  **Note:** Version bump only for package @megafon/ui-shared
@@ -5,17 +5,99 @@ h4,
5
5
  h5 {
6
6
  margin: 0;
7
7
  }
8
- .mfui-card-old {
8
+ .mfui-card {
9
+ font-family: inherit;
10
+ font-size: 15px;
11
+ line-height: 24px;
12
+ font-weight: 400;
9
13
  display: -webkit-box;
10
14
  display: -ms-flexbox;
11
15
  display: flex;
16
+ -webkit-box-orient: vertical;
17
+ -webkit-box-direction: normal;
18
+ -ms-flex-direction: column;
19
+ flex-direction: column;
20
+ padding: 16px 16px 24px;
12
21
  border-radius: 12px;
13
- overflow: hidden;
22
+ color: var(--content);
23
+ text-decoration: none;
14
24
  background-color: var(--base);
15
- -webkit-box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
16
- box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
17
25
  }
18
- .mfui-card-old__inner {
26
+ @media screen and (min-width: 1280px) {
27
+ .mfui-card {
28
+ padding: 24px 24px 32px;
29
+ }
30
+ }
31
+ .mfui-card_full-height {
32
+ height: 100%;
33
+ }
34
+ .mfui-card_link {
35
+ cursor: pointer;
36
+ }
37
+ .mfui-card_view_shadow {
38
+ -webkit-box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
39
+ box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
40
+ }
41
+ .mfui-card_link.mfui-card_view_shadow:hover {
42
+ -webkit-box-shadow: 0 8px 28px 0 rgba(0, 0, 0, 0.1);
43
+ box-shadow: 0 8px 28px 0 rgba(0, 0, 0, 0.1);
44
+ }
45
+ .mfui-card_view_background {
46
+ background-color: var(--spbSky0);
47
+ }
48
+ .mfui-card_link.mfui-card_view_background:hover {
49
+ background-color: var(--spbSky1);
50
+ }
51
+ .mfui-card_only-title {
52
+ padding: 24px;
53
+ }
54
+ @media screen and (min-width: 1280px) {
55
+ .mfui-card_only-title {
56
+ padding: 32px;
57
+ }
58
+ }
59
+ .mfui-card__icon {
60
+ width: 40px;
61
+ height: 40px;
62
+ margin-bottom: 32px;
63
+ }
64
+ .mfui-card__img-box {
65
+ position: relative;
66
+ margin-bottom: 24px;
67
+ padding-bottom: 56.25%;
68
+ border-radius: 12px;
69
+ overflow: hidden;
70
+ }
71
+ @media screen and (min-width: 1280px) {
72
+ .mfui-card__img-box {
73
+ margin-bottom: 32px;
74
+ }
75
+ }
76
+ .mfui-card__img-box_position_bottom {
77
+ margin-top: 24px;
78
+ margin-bottom: 0;
79
+ }
80
+ @media screen and (min-width: 1280px) {
81
+ .mfui-card__img-box_position_bottom {
82
+ margin-top: 32px;
83
+ }
84
+ }
85
+ .mfui-card__img {
86
+ position: absolute;
87
+ width: 100%;
88
+ height: 100%;
89
+ -o-object-fit: cover;
90
+ object-fit: cover;
91
+ -webkit-transition: -webkit-transform 0.3s;
92
+ transition: -webkit-transform 0.3s;
93
+ transition: transform 0.3s;
94
+ transition: transform 0.3s, -webkit-transform 0.3s;
95
+ }
96
+ .mfui-card_link:hover .mfui-card__img {
97
+ -webkit-transform: scale(1.2);
98
+ transform: scale(1.2);
99
+ }
100
+ .mfui-card__texts {
19
101
  display: -webkit-box;
20
102
  display: -ms-flexbox;
21
103
  display: flex;
@@ -23,108 +105,169 @@ h5 {
23
105
  -webkit-box-direction: normal;
24
106
  -ms-flex-direction: column;
25
107
  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%;
34
- padding: 32px 20px;
108
+ gap: 12px;
109
+ margin-top: 16px;
35
110
  }
36
- @media screen and (max-width: 767px) {
37
- .mfui-card-old__inner {
38
- padding: 24px 16px;
39
- }
111
+ .mfui-card__texts ol,
112
+ .mfui-card__texts ul {
113
+ margin: 0;
114
+ padding-left: 24px;
40
115
  }
41
- .mfui-card-old__text {
42
- font-size: 15px;
43
- line-height: 24px;
44
- font-weight: 400;
45
- margin-top: 12px;
46
- color: var(--content);
116
+ .mfui-card__texts-title {
117
+ font-weight: 500;
47
118
  }
48
- .mfui-card-old__btns-wrapper {
119
+ .mfui-card__features {
49
120
  display: -webkit-box;
50
121
  display: -ms-flexbox;
51
122
  display: flex;
52
- -ms-flex-wrap: wrap;
53
- flex-wrap: wrap;
54
- -webkit-box-align: center;
55
- -ms-flex-align: center;
56
- align-items: center;
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;
123
+ -webkit-box-orient: vertical;
124
+ -webkit-box-direction: normal;
125
+ -ms-flex-direction: column;
126
+ flex-direction: column;
127
+ gap: 12px;
128
+ margin-top: 16px;
62
129
  }
63
- .mfui-card-old__btns-wrapper_left-align {
64
- -webkit-box-pack: start;
65
- -ms-flex-pack: start;
66
- justify-content: flex-start;
130
+ .mfui-card__features-item {
131
+ display: -webkit-box;
132
+ display: -ms-flexbox;
133
+ display: flex;
134
+ gap: 4px;
135
+ -webkit-box-align: baseline;
136
+ -ms-flex-align: baseline;
137
+ align-items: baseline;
138
+ -webkit-box-pack: justify;
139
+ -ms-flex-pack: justify;
140
+ justify-content: space-between;
67
141
  }
68
- .mfui-card-old__fake-link {
69
- color: var(--systemBlue);
142
+ .mfui-card__features-item-separator {
143
+ -webkit-box-flex: 1;
144
+ -ms-flex-positive: 1;
145
+ flex-grow: 1;
146
+ height: 2px;
147
+ background-image: radial-gradient(circle, var(--spbSky3) 1px, transparent 1px);
148
+ background-size: 6px 2px;
70
149
  }
71
- .mfui-card-old__button,
72
- .mfui-card-old__link,
73
- .mfui-card-old__fake-link {
74
- margin: 12px 10px;
150
+ .mfui-card__icons {
151
+ margin-top: 16px;
75
152
  }
76
- .mfui-card-old__svg-wrapper {
77
- margin-bottom: 24px;
153
+ .mfui-card__icons-desc {
154
+ margin-bottom: 12px;
78
155
  }
79
- .mfui-card-old__svg-wrapper svg {
80
- width: 40px;
81
- height: 40px;
156
+ .mfui-card__icons-list {
157
+ display: -webkit-box;
158
+ display: -ms-flexbox;
159
+ display: flex;
160
+ -webkit-box-orient: vertical;
161
+ -webkit-box-direction: normal;
162
+ -ms-flex-direction: column;
163
+ flex-direction: column;
164
+ gap: 12px;
165
+ }
166
+ .mfui-card__icons-item {
167
+ display: -webkit-box;
168
+ display: -ms-flexbox;
169
+ display: flex;
170
+ }
171
+ .mfui-card__icons-item-icon {
172
+ -ms-flex-negative: 0;
173
+ flex-shrink: 0;
174
+ width: 32px;
175
+ height: 32px;
176
+ margin-right: 8px;
82
177
  }
83
- .mfui-card-old__pic-wrapper .mfui-card-old__img {
84
- max-width: 100%;
178
+ .mfui-card__icons-item-text {
179
+ margin-top: 4px;
85
180
  }
86
- .mfui-card-old__pic-wrapper {
181
+ .mfui-card__price {
87
182
  display: -webkit-box;
88
183
  display: -ms-flexbox;
89
184
  display: flex;
90
- -webkit-box-align: center;
91
- -ms-flex-align: center;
92
- align-items: center;
185
+ -ms-flex-wrap: wrap;
186
+ flex-wrap: wrap;
187
+ gap: 8px;
188
+ -webkit-box-align: baseline;
189
+ -ms-flex-align: baseline;
190
+ align-items: baseline;
93
191
  -webkit-box-pack: center;
94
192
  -ms-flex-pack: center;
95
193
  justify-content: center;
96
- margin-top: -32px;
97
- margin-right: -20px;
98
- margin-bottom: 32px;
99
- margin-left: -20px;
100
- }
101
- @media screen and (max-width: 767px) {
102
- .mfui-card-old__pic-wrapper {
103
- margin-top: -24px;
104
- margin-right: -16px;
105
- margin-bottom: 24px;
106
- margin-left: -16px;
194
+ margin-top: 24px;
195
+ padding-top: 24px;
196
+ border-top: 1px solid var(--spbSky1);
197
+ }
198
+ @media screen and (min-width: 1280px) {
199
+ .mfui-card__price {
200
+ margin-top: 32px;
107
201
  }
108
202
  }
109
- .mfui-card-old__pic-wrapper_object-fit_fill img {
110
- width: 100%;
111
- height: auto;
203
+ .mfui-card__img-box + .mfui-card__price {
204
+ padding-top: 0;
205
+ border: none;
112
206
  }
113
- .mfui-card-old__pic-wrapper_object-fit_contain img {
114
- width: auto;
115
- height: 100%;
207
+ .mfui-card__price-old-value {
208
+ position: relative;
209
+ color: var(--spbSky3);
116
210
  }
117
- .mfui-card-old_href * {
118
- text-decoration: none !important;
211
+ .mfui-card__price-old-value:before {
212
+ content: '';
213
+ position: absolute;
214
+ top: 50%;
215
+ right: -1px;
216
+ left: -1px;
217
+ height: 1px;
218
+ background-color: var(--warmRedC);
119
219
  }
120
- .mfui-card-old_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);
220
+ .mfui-card__price-value {
221
+ font-weight: 600;
222
+ font-size: 22px;
223
+ line-height: 28px;
224
+ letter-spacing: 0.5px;
123
225
  }
124
- .mfui-card-old_full-height {
125
- height: 100%;
226
+ @media screen and (min-width: 768px) and (max-width: 1023px) {
227
+ .mfui-card__price-value {
228
+ font-size: 26px;
229
+ line-height: 32px;
230
+ }
231
+ }
232
+ @media screen and (min-width: 1024px) {
233
+ .mfui-card__price-value {
234
+ font-size: 28px;
235
+ line-height: 36px;
236
+ }
237
+ }
238
+ @media screen and (min-width: 1280px) {
239
+ .mfui-card__price-value {
240
+ font-size: 32px;
241
+ line-height: 40px;
242
+ }
243
+ }
244
+ .mfui-card__buttons {
245
+ display: -webkit-box;
246
+ display: -ms-flexbox;
247
+ display: flex;
248
+ -ms-flex-wrap: wrap;
249
+ flex-wrap: wrap;
250
+ gap: 16px;
251
+ margin-top: 32px;
252
+ }
253
+ .mfui-card__price + .mfui-card__buttons {
254
+ margin-top: 24px;
255
+ }
256
+ .mfui-card__buttons_centered {
257
+ -webkit-box-pack: center;
258
+ -ms-flex-pack: center;
259
+ justify-content: center;
260
+ }
261
+ .mfui-card__button {
262
+ -ms-flex-preferred-size: 190px;
263
+ flex-basis: 190px;
264
+ -webkit-box-flex: 1;
265
+ -ms-flex-positive: 1;
266
+ flex-grow: 1;
267
+ -ms-flex-negative: 1;
268
+ flex-shrink: 1;
269
+ max-width: 320px;
126
270
  }
127
- .mfui-card-old_centered-text .mfui-card-old__text,
128
- .mfui-card-old_centered-text .mfui-card-old__title {
129
- text-align: center;
271
+ .mfui-card__footer {
272
+ margin-top: auto;
130
273
  }
@@ -1,74 +1,42 @@
1
- import React, { Ref } from 'react';
1
+ import React 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];
8
- interface IButton {
9
- title: string;
10
- href?: string;
11
- target?: TargetType;
12
- download?: boolean;
13
- rel?: string;
14
- onClick?: () => void;
15
- }
16
- interface ILink {
17
- title: string;
18
- href?: string;
19
- target?: TargetType;
20
- download?: boolean;
21
- rel?: string;
22
- }
23
- export declare const ObjectFit: {
24
- readonly FILL: "fill";
25
- readonly CONTAIN: "contain";
26
- };
27
- declare type ObjectFitType = typeof ObjectFit[keyof typeof ObjectFit];
3
+ import { ButtonType, FeaturesList, IconsList, Image, Link, Price, TextsList, Title } from './types';
28
4
  export interface ICard {
29
5
  /** Дополнительные data атрибуты к внутренним элементам */
30
6
  dataAttrs?: {
31
7
  root?: Record<string, string>;
32
- link?: Record<string, string>;
8
+ icon?: Record<string, string>;
9
+ imgBox?: Record<string, string>;
33
10
  button?: Record<string, string>;
11
+ extraButton?: Record<string, string>;
34
12
  };
35
- /** Дополнительный класс корневого элемента */
13
+ /** Дополнительный класс для компонента */
36
14
  className?: string;
37
- /** Дополнительные классы для корневого и внутренних элементов */
38
- classes?: {
39
- root?: string;
40
- button?: string;
41
- link?: string;
42
- inner?: string;
43
- };
44
- /** Ссылка на корневой элемент */
45
- rootRef?: Ref<HTMLDivElement>;
46
- /** Изображение в карточке */
47
- imageSrc?: string;
48
- /** Значение тега alt для изображения */
49
- imageAlt?: string;
50
- /** Иконка в карточке */
51
- svgSrc?: React.ReactNode;
52
- /** Заголовок карточки */
53
- title: string | React.ReactNode[] | React.ReactNode;
54
- /** Текст карточки */
55
- text?: string | React.ReactNode[] | React.ReactNode;
56
- /** Данные для кнопки */
57
- button?: IButton;
58
- /** Данные для ссылки */
59
- link?: ILink;
60
- /** Выравнивание текста по центру */
61
- isCenteredText?: boolean;
62
- /** Расположение кнопки/ссылки по левой стороне */
63
- isLeftHAlign?: boolean;
64
- /** Высота корневого элемента 100% */
65
15
  isFullHeight?: boolean;
66
- /** Ссылка для всей карточки */
67
- href?: string;
68
- /** Target свойство, аналогично свойству 'target' тега 'a' */
69
- target?: TargetType;
70
- /** Режим позиционирования изображения */
71
- objectFit?: ObjectFitType;
16
+ /** Вид */
17
+ view?: 'shadow' | 'background';
18
+ /** Ссылка для карточки */
19
+ link?: Link;
20
+ /** Изображение */
21
+ image?: Image;
22
+ /** Иконка */
23
+ icon?: React.ReactNode;
24
+ /** Заголовок */
25
+ title: Title;
26
+ /** Список текстов */
27
+ textsList?: TextsList;
28
+ /** Список характеристик */
29
+ featuresList?: FeaturesList;
30
+ /** Список иконок */
31
+ iconsList?: IconsList;
32
+ /** Цена */
33
+ price?: Price;
34
+ /** Кнопка */
35
+ button?: ButtonType;
36
+ /** Дополнительная кнопка */
37
+ extraButton?: ButtonType;
38
+ /** Обработчик клика по карточке */
39
+ onClick?: () => void;
72
40
  }
73
41
  declare const Card: React.FC<ICard>;
74
42
  export default Card;