@megafon/ui-core 5.9.1 → 5.10.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 +34 -0
- package/dist/es/components/Badges/components/PriceBadge/PriceBadge.css +15 -0
- package/dist/es/components/Badges/components/PriceBadge/PriceBadge.d.ts +2 -0
- package/dist/es/components/Badges/components/PriceBadge/PriceBadge.js +3 -1
- package/dist/es/components/Banner/Banner.css +62 -32
- package/dist/es/components/Banner/Banner.d.ts +29 -1
- package/dist/es/components/Banner/Banner.js +95 -46
- package/dist/es/components/Banner/BannerDot.css +27 -21
- package/dist/es/components/Banner/BannerDot.d.ts +8 -1
- package/dist/es/components/Banner/BannerDot.js +20 -8
- package/dist/es/components/Button/Button.css +6 -0
- package/dist/es/components/Button/Button.d.ts +2 -0
- package/dist/es/components/Button/Button.js +4 -0
- package/dist/es/components/Chips/Chips.js +1 -1
- package/dist/es/components/ContentView/ContentView.css +46 -4
- package/dist/es/components/ContentView/ContentView.d.ts +8 -12
- package/dist/es/components/ContentView/ContentView.js +11 -24
- package/dist/es/components/NavArrow/NavArrow.css +16 -0
- package/dist/es/components/NavArrow/NavArrow.d.ts +2 -1
- package/dist/es/components/NavArrow/NavArrow.js +3 -2
- package/dist/es/components/Select/Select.js +1 -1
- package/dist/es/components/Sliders/Slider/Slider.css +4 -0
- package/dist/es/components/Sliders/Slider/Slider.js +3 -3
- package/dist/es/components/Sliders/SliderRange/SliderRange.css +4 -0
- package/dist/es/components/Sliders/SliderRatio/SliderRatio.css +4 -0
- package/dist/es/components/Sliders/SliderRatio/SliderRatio.js +19 -7
- package/dist/es/components/Sliders/components/SliderDisplayValue/SliderDisplayValue.css +1 -1
- package/dist/es/components/Snackbar/SnackbarTimer/SnackbarTimer.css +3 -0
- package/dist/es/components/Snackbar/SnackbarTimer/SnackbarTimer.js +1 -1
- package/dist/es/components/Tooltip/Tooltip.css +3 -0
- package/dist/lib/components/Badges/components/PriceBadge/PriceBadge.css +15 -0
- package/dist/lib/components/Badges/components/PriceBadge/PriceBadge.d.ts +2 -0
- package/dist/lib/components/Badges/components/PriceBadge/PriceBadge.js +3 -1
- package/dist/lib/components/Banner/Banner.css +62 -32
- package/dist/lib/components/Banner/Banner.d.ts +29 -1
- package/dist/lib/components/Banner/Banner.js +96 -45
- package/dist/lib/components/Banner/BannerDot.css +27 -21
- package/dist/lib/components/Banner/BannerDot.d.ts +8 -1
- package/dist/lib/components/Banner/BannerDot.js +23 -9
- package/dist/lib/components/Button/Button.css +6 -0
- package/dist/lib/components/Button/Button.d.ts +2 -0
- package/dist/lib/components/Button/Button.js +4 -0
- package/dist/lib/components/Chips/Chips.js +2 -2
- package/dist/lib/components/ContentView/ContentView.css +46 -4
- package/dist/lib/components/ContentView/ContentView.d.ts +8 -12
- package/dist/lib/components/ContentView/ContentView.js +11 -33
- package/dist/lib/components/NavArrow/NavArrow.css +16 -0
- package/dist/lib/components/NavArrow/NavArrow.d.ts +2 -1
- package/dist/lib/components/NavArrow/NavArrow.js +2 -1
- package/dist/lib/components/Select/Select.js +1 -1
- package/dist/lib/components/Sliders/Slider/Slider.css +4 -0
- package/dist/lib/components/Sliders/Slider/Slider.js +3 -3
- package/dist/lib/components/Sliders/SliderRange/SliderRange.css +4 -0
- package/dist/lib/components/Sliders/SliderRatio/SliderRatio.css +4 -0
- package/dist/lib/components/Sliders/SliderRatio/SliderRatio.js +19 -7
- package/dist/lib/components/Sliders/components/SliderDisplayValue/SliderDisplayValue.css +1 -1
- package/dist/lib/components/Snackbar/SnackbarTimer/SnackbarTimer.css +3 -0
- package/dist/lib/components/Snackbar/SnackbarTimer/SnackbarTimer.js +1 -1
- package/dist/lib/components/Tooltip/Tooltip.css +3 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,40 @@
|
|
|
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.10.0](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/compare/@megafon/ui-core@5.9.2...@megafon/ui-core@5.10.0) (2024-04-22)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **sliders:** fix bugs ([2992a34](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/2992a348fab99cc65a190a2892262e7e4b65b693))
|
|
12
|
+
* **snackbartimer:** update color timer value ([911fb68](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/911fb681d36db1e89c43d10f7899fb6038336a36))
|
|
13
|
+
* **tooltip:** add border ([ba4461f](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/ba4461ff86b98a021dca47b7836e2cd2c05cbfcd))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* **banner:** update Banner component ([a2fde9e](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/a2fde9ebda0993ac9cefe80e61d40780d2b20452))
|
|
19
|
+
* **bannerdot:** update BannerDot component ([22b03d6](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/22b03d61f19304d242229f8c8d925bcd1adb7da4))
|
|
20
|
+
* **button:** add new prop for Button component ([98fb1bd](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/98fb1bd8964ddd76866074d2b8f5890b99253b97))
|
|
21
|
+
* **contentview:** add classes props ([2871dd6](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/2871dd6dd836762da0e9c8c21c07ba445361e6b2))
|
|
22
|
+
* **navarrow:** add new theme for NavArrow component ([aff36c6](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/aff36c6e055bbe708fc45d0cbe22e3a4a3669850))
|
|
23
|
+
* **pricebadge:** add new themes for PriceBadge component ([e521f40](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/e521f405f8b2bc78bd15da5555c397b098f5c81d))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## [5.9.2](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/compare/@megafon/ui-core@5.9.1...@megafon/ui-core@5.9.2) (2024-04-11)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Bug Fixes
|
|
33
|
+
|
|
34
|
+
* **select:** fix focus ([a6fcc29](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/a6fcc295cc53a926c43003c4e1133723e495205e))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
6
40
|
## [5.9.1](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/compare/@megafon/ui-core@5.9.0...@megafon/ui-core@5.9.1) (2024-04-09)
|
|
7
41
|
|
|
8
42
|
|
|
@@ -64,6 +64,21 @@
|
|
|
64
64
|
.mfui-price-badge_theme_red .mfui-price-badge__icon {
|
|
65
65
|
fill: var(--fury);
|
|
66
66
|
}
|
|
67
|
+
.mfui-price-badge_theme_light {
|
|
68
|
+
background-color: var(--stcWhite20);
|
|
69
|
+
}
|
|
70
|
+
.mfui-price-badge_theme_dark {
|
|
71
|
+
background-color: var(--stcBlack20);
|
|
72
|
+
}
|
|
73
|
+
.mfui-price-badge_theme_light .mfui-price-badge__text,
|
|
74
|
+
.mfui-price-badge_theme_dark .mfui-price-badge__text {
|
|
75
|
+
font-weight: 400;
|
|
76
|
+
color: var(--stcWhite);
|
|
77
|
+
}
|
|
78
|
+
.mfui-price-badge_theme_light .mfui-price-badge__icon,
|
|
79
|
+
.mfui-price-badge_theme_dark .mfui-price-badge__icon {
|
|
80
|
+
fill: var(--stcWhite);
|
|
81
|
+
}
|
|
67
82
|
.mfui-price-badge_size_big {
|
|
68
83
|
padding: 12px 12px 12px 4px;
|
|
69
84
|
font-size: 15px;
|
|
@@ -1,31 +1,19 @@
|
|
|
1
1
|
.mfui-banner {
|
|
2
2
|
position: relative;
|
|
3
|
-
overflow: hidden;
|
|
4
3
|
}
|
|
5
4
|
.mfui-banner .swiper-wrapper {
|
|
6
5
|
display: -webkit-box;
|
|
7
6
|
display: -ms-flexbox;
|
|
8
7
|
display: flex;
|
|
9
8
|
}
|
|
9
|
+
.mfui-banner__swiper {
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
}
|
|
10
12
|
.mfui-banner__slide {
|
|
11
13
|
-ms-flex-negative: 0;
|
|
12
14
|
flex-shrink: 0;
|
|
13
15
|
height: 500px;
|
|
14
16
|
}
|
|
15
|
-
@media screen and (min-width: 768px) and (max-width: 1023px) {
|
|
16
|
-
.mfui-banner__slide {
|
|
17
|
-
height: 540px;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
@media screen and (min-width: 1024px) {
|
|
21
|
-
.mfui-banner__slide {
|
|
22
|
-
-webkit-backface-visibility: hidden;
|
|
23
|
-
backface-visibility: hidden;
|
|
24
|
-
opacity: 0;
|
|
25
|
-
-webkit-transition: opacity 0.2s;
|
|
26
|
-
transition: opacity 0.2s;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
17
|
@media screen and (min-width: 1024px) and (max-width: 1279px) {
|
|
30
18
|
.mfui-banner__slide {
|
|
31
19
|
height: 420px;
|
|
@@ -50,14 +38,24 @@
|
|
|
50
38
|
position: absolute;
|
|
51
39
|
top: 50%;
|
|
52
40
|
z-index: 10;
|
|
53
|
-
|
|
54
|
-
|
|
41
|
+
translate: 0 -50%;
|
|
42
|
+
-webkit-transition: scale 0.2s linear;
|
|
43
|
+
transition: scale 0.2s linear;
|
|
55
44
|
}
|
|
56
45
|
@media screen and (max-width: 767px) {
|
|
57
46
|
.mfui-banner__arrow {
|
|
58
47
|
display: none;
|
|
59
48
|
}
|
|
60
49
|
}
|
|
50
|
+
.mfui-banner__arrow_theme_white {
|
|
51
|
+
width: 64px;
|
|
52
|
+
height: 64px;
|
|
53
|
+
}
|
|
54
|
+
@media screen and (max-width: 1023px) {
|
|
55
|
+
.mfui-banner__arrow_theme_white {
|
|
56
|
+
display: none;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
61
59
|
.mfui-banner__arrow_prev {
|
|
62
60
|
left: 12px;
|
|
63
61
|
}
|
|
@@ -94,33 +92,44 @@
|
|
|
94
92
|
right: 20px;
|
|
95
93
|
}
|
|
96
94
|
}
|
|
95
|
+
.mfui-banner__arrow_prev.mfui-banner__arrow_theme_white {
|
|
96
|
+
left: 0;
|
|
97
|
+
translate: -50% -50%;
|
|
98
|
+
}
|
|
99
|
+
.mfui-banner__arrow_next.mfui-banner__arrow_theme_white {
|
|
100
|
+
right: 0;
|
|
101
|
+
translate: 50% -50%;
|
|
102
|
+
}
|
|
103
|
+
.mfui-banner_no-touch .mfui-banner__arrow_theme_white:hover {
|
|
104
|
+
scale: 1.25;
|
|
105
|
+
}
|
|
106
|
+
.mfui-banner_no-touch .mfui-banner__arrow_theme_white:active {
|
|
107
|
+
scale: 1.125;
|
|
108
|
+
}
|
|
97
109
|
.mfui-banner__pagination {
|
|
98
110
|
position: absolute;
|
|
99
|
-
bottom:
|
|
111
|
+
bottom: 24px;
|
|
100
112
|
left: 50%;
|
|
101
113
|
z-index: 10;
|
|
102
114
|
display: -webkit-box;
|
|
103
115
|
display: -ms-flexbox;
|
|
104
116
|
display: flex;
|
|
117
|
+
gap: 8px;
|
|
105
118
|
-webkit-box-align: center;
|
|
106
119
|
-ms-flex-align: center;
|
|
107
120
|
align-items: center;
|
|
108
121
|
-webkit-box-pack: center;
|
|
109
122
|
-ms-flex-pack: center;
|
|
110
123
|
justify-content: center;
|
|
111
|
-
padding: 6px;
|
|
124
|
+
padding: 6px 10px;
|
|
112
125
|
border-radius: 12px;
|
|
113
126
|
-webkit-transform: translateX(-50%);
|
|
114
127
|
transform: translateX(-50%);
|
|
115
128
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
background-color: var(--brandGreen);
|
|
121
|
-
}
|
|
122
|
-
.mfui-banner__pagination_theme_dark {
|
|
123
|
-
background-color: var(--stcBlack20);
|
|
129
|
+
@media screen and (min-width: 1024px) {
|
|
130
|
+
.mfui-banner__pagination {
|
|
131
|
+
bottom: 16px;
|
|
132
|
+
}
|
|
124
133
|
}
|
|
125
134
|
.mfui-banner__pagination_bottom-offset {
|
|
126
135
|
bottom: 60px;
|
|
@@ -145,10 +154,31 @@
|
|
|
145
154
|
bottom: 72px;
|
|
146
155
|
}
|
|
147
156
|
}
|
|
148
|
-
.mfui-
|
|
149
|
-
|
|
150
|
-
|
|
157
|
+
.mfui-banner__pagination_theme_light {
|
|
158
|
+
background-color: var(--stcWhite20);
|
|
159
|
+
}
|
|
160
|
+
.mfui-banner__pagination_theme_dark {
|
|
161
|
+
background-color: var(--stcBlack20);
|
|
162
|
+
}
|
|
163
|
+
.mfui-banner_radius_rounded {
|
|
164
|
+
border-radius: 24px;
|
|
165
|
+
}
|
|
166
|
+
.mfui-banner_radius_rounded .mfui-banner__swiper {
|
|
167
|
+
border-radius: 24px;
|
|
168
|
+
}
|
|
169
|
+
.mfui-banner_background-color_green {
|
|
170
|
+
background-color: var(--brandGreen);
|
|
171
|
+
}
|
|
172
|
+
.mfui-banner_background-color_purple {
|
|
173
|
+
background-color: var(--brandPurple);
|
|
174
|
+
}
|
|
175
|
+
.mfui-banner_background-color_gradient {
|
|
176
|
+
background: -webkit-gradient(linear, right top, left top, from(#ADA6BA), to(#F6F2F9));
|
|
177
|
+
background: linear-gradient(270deg, #ADA6BA 0%, #F6F2F9 100%);
|
|
178
|
+
}
|
|
179
|
+
.mfui-banner_background-color_light {
|
|
180
|
+
background-color: #F6F2F9;
|
|
151
181
|
}
|
|
152
|
-
.mfui-
|
|
153
|
-
|
|
182
|
+
.mfui-banner_background-color_spbSky0 {
|
|
183
|
+
background-color: var(--spbSky0);
|
|
154
184
|
}
|
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import SwiperCore from 'swiper';
|
|
3
|
+
import { ThemeType as ArrowThemeType } from '../NavArrow/NavArrow';
|
|
2
4
|
import './Banner.less';
|
|
5
|
+
export declare const BackgroundColor: {
|
|
6
|
+
readonly TRANSPARENT: "transparent";
|
|
7
|
+
readonly GREEN: "green";
|
|
8
|
+
readonly PURPLE: "purple";
|
|
9
|
+
readonly SPB_SKY_0: "spbSky0";
|
|
10
|
+
readonly GRADIENT: "gradient";
|
|
11
|
+
readonly LIGHT: "light";
|
|
12
|
+
};
|
|
13
|
+
declare type BackgroundColorType = typeof BackgroundColor[keyof typeof BackgroundColor];
|
|
14
|
+
export declare const Radius: {
|
|
15
|
+
readonly CORNERS: "corners";
|
|
16
|
+
readonly ROUNDED: "rounded";
|
|
17
|
+
};
|
|
18
|
+
export declare type RadiusType = typeof Radius[keyof typeof Radius];
|
|
3
19
|
export declare const NavTheme: {
|
|
4
20
|
readonly LIGHT: "light";
|
|
5
|
-
readonly GREEN: "green";
|
|
6
21
|
readonly DARK: "dark";
|
|
7
22
|
};
|
|
8
23
|
declare type NavThemeType = typeof NavTheme[keyof typeof NavTheme];
|
|
@@ -13,8 +28,13 @@ export interface IBannerProps {
|
|
|
13
28
|
loop?: boolean;
|
|
14
29
|
/** Дополнительные классы для корневого и внутренних элементов */
|
|
15
30
|
classes?: {
|
|
31
|
+
swiper?: string;
|
|
16
32
|
slide?: string;
|
|
17
33
|
arrow?: string;
|
|
34
|
+
arrowPrev?: string;
|
|
35
|
+
arrowNext?: string;
|
|
36
|
+
pagination?: string;
|
|
37
|
+
dot?: string;
|
|
18
38
|
};
|
|
19
39
|
/** Дополнительные data атрибуты к внутренним элементам */
|
|
20
40
|
dataAttrs?: {
|
|
@@ -34,10 +54,18 @@ export interface IBannerProps {
|
|
|
34
54
|
autoPlayDelay?: number;
|
|
35
55
|
/** Пауза автоматической прокрутки при наведении курсора на компонент */
|
|
36
56
|
pauseOnHover?: boolean;
|
|
57
|
+
/** Фоновый цвет */
|
|
58
|
+
backgroundColor?: BackgroundColorType;
|
|
59
|
+
/** Радиус границы */
|
|
60
|
+
radius?: RadiusType;
|
|
37
61
|
/** Цветовая тема навигации */
|
|
38
62
|
navTheme?: NavThemeType;
|
|
63
|
+
/** Цветовая тема стрелок */
|
|
64
|
+
arrowTheme?: ArrowThemeType;
|
|
39
65
|
/** Автоматическая высота слайдов */
|
|
40
66
|
autoHeight?: boolean;
|
|
67
|
+
/** Ref на swiper */
|
|
68
|
+
getSwiper?: (instance: SwiperCore) => void;
|
|
41
69
|
/** Обработчик клика по стрелке "вперед" (должен быть обернут в useCallback) */
|
|
42
70
|
onNextClick?: (index: number) => void;
|
|
43
71
|
/** Обработчик клика по стрелке "назад" (должен быть обернут в useCallback) */
|
|
@@ -4,17 +4,28 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
4
4
|
import "core-js/modules/es.array.map.js";
|
|
5
5
|
import "core-js/modules/es.object.values.js";
|
|
6
6
|
import * as React from 'react';
|
|
7
|
-
import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
|
|
7
|
+
import { cnCreate, detectTouch, filterDataAttrs } from '@megafon/ui-helpers';
|
|
8
8
|
import * as PropTypes from 'prop-types';
|
|
9
9
|
import SwiperCore, { Autoplay } from 'swiper';
|
|
10
10
|
import { Swiper, SwiperSlide } from 'swiper/react';
|
|
11
11
|
import NavArrow, { Theme as ArrowTheme } from "../NavArrow/NavArrow";
|
|
12
|
-
import "./Banner.css";
|
|
13
12
|
import BannerDot from "./BannerDot";
|
|
13
|
+
import "./Banner.css";
|
|
14
14
|
SwiperCore.use([Autoplay]);
|
|
15
|
+
export var BackgroundColor = {
|
|
16
|
+
TRANSPARENT: 'transparent',
|
|
17
|
+
GREEN: 'green',
|
|
18
|
+
PURPLE: 'purple',
|
|
19
|
+
SPB_SKY_0: 'spbSky0',
|
|
20
|
+
GRADIENT: 'gradient',
|
|
21
|
+
LIGHT: 'light'
|
|
22
|
+
};
|
|
23
|
+
export var Radius = {
|
|
24
|
+
CORNERS: 'corners',
|
|
25
|
+
ROUNDED: 'rounded'
|
|
26
|
+
};
|
|
15
27
|
export var NavTheme = {
|
|
16
28
|
LIGHT: 'light',
|
|
17
|
-
GREEN: 'green',
|
|
18
29
|
DARK: 'dark'
|
|
19
30
|
};
|
|
20
31
|
|
|
@@ -42,11 +53,18 @@ var Banner = function Banner(_ref) {
|
|
|
42
53
|
_ref$loop = _ref.loop,
|
|
43
54
|
loop = _ref$loop === void 0 ? false : _ref$loop,
|
|
44
55
|
_ref$navTheme = _ref.navTheme,
|
|
45
|
-
navTheme = _ref$navTheme === void 0 ?
|
|
56
|
+
navTheme = _ref$navTheme === void 0 ? NavTheme.LIGHT : _ref$navTheme,
|
|
57
|
+
_ref$arrowTheme = _ref.arrowTheme,
|
|
58
|
+
arrowTheme = _ref$arrowTheme === void 0 ? ArrowTheme.DARK : _ref$arrowTheme,
|
|
59
|
+
_ref$backgroundColor = _ref.backgroundColor,
|
|
60
|
+
backgroundColor = _ref$backgroundColor === void 0 ? BackgroundColor.TRANSPARENT : _ref$backgroundColor,
|
|
61
|
+
_ref$radius = _ref.radius,
|
|
62
|
+
radius = _ref$radius === void 0 ? Radius.ROUNDED : _ref$radius,
|
|
46
63
|
_ref$autoHeight = _ref.autoHeight,
|
|
47
64
|
autoHeight = _ref$autoHeight === void 0 ? false : _ref$autoHeight,
|
|
48
65
|
_ref$children = _ref.children,
|
|
49
66
|
children = _ref$children === void 0 ? [] : _ref$children,
|
|
67
|
+
getSwiper = _ref.getSwiper,
|
|
50
68
|
onNextClick = _ref.onNextClick,
|
|
51
69
|
onPrevClick = _ref.onPrevClick,
|
|
52
70
|
onDotClick = _ref.onDotClick,
|
|
@@ -55,44 +73,49 @@ var Banner = function Banner(_ref) {
|
|
|
55
73
|
_ref$pauseOnHover = _ref.pauseOnHover,
|
|
56
74
|
pauseOnHover = _ref$pauseOnHover === void 0 ? false : _ref$pauseOnHover;
|
|
57
75
|
|
|
58
|
-
var _React$useState = React.useState(),
|
|
76
|
+
var _React$useState = React.useState(false),
|
|
59
77
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
60
|
-
|
|
61
|
-
|
|
78
|
+
isTouch = _React$useState2[0],
|
|
79
|
+
setTouch = _React$useState2[1];
|
|
62
80
|
|
|
63
|
-
var _React$useState3 = React.useState(
|
|
81
|
+
var _React$useState3 = React.useState(),
|
|
64
82
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
65
|
-
|
|
66
|
-
|
|
83
|
+
swiperInstance = _React$useState4[0],
|
|
84
|
+
setSwiperInstance = _React$useState4[1];
|
|
67
85
|
|
|
68
|
-
var _React$useState5 = React.useState(
|
|
86
|
+
var _React$useState5 = React.useState(true),
|
|
69
87
|
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
70
|
-
|
|
71
|
-
|
|
88
|
+
isBeginning = _React$useState6[0],
|
|
89
|
+
setBeginning = _React$useState6[1];
|
|
72
90
|
|
|
73
|
-
var _React$useState7 = React.useState(
|
|
91
|
+
var _React$useState7 = React.useState(false),
|
|
74
92
|
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
75
|
-
|
|
76
|
-
|
|
93
|
+
isEnd = _React$useState8[0],
|
|
94
|
+
setEnd = _React$useState8[1];
|
|
77
95
|
|
|
78
|
-
var _React$useState9 = React.useState(
|
|
96
|
+
var _React$useState9 = React.useState(autoPlay),
|
|
79
97
|
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
80
|
-
|
|
81
|
-
|
|
98
|
+
isAutoPlaying = _React$useState10[0],
|
|
99
|
+
setAutoPlaying = _React$useState10[1];
|
|
82
100
|
|
|
83
|
-
var _React$useState11 = React.useState(
|
|
101
|
+
var _React$useState11 = React.useState(0),
|
|
84
102
|
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
|
85
|
-
|
|
86
|
-
|
|
103
|
+
activeIndex = _React$useState12[0],
|
|
104
|
+
setActiveIndex = _React$useState12[1];
|
|
87
105
|
|
|
88
|
-
var _React$useState13 = React.useState(
|
|
106
|
+
var _React$useState13 = React.useState(autoPlayDelay),
|
|
89
107
|
_React$useState14 = _slicedToArray(_React$useState13, 2),
|
|
90
|
-
|
|
91
|
-
|
|
108
|
+
delay = _React$useState14[0],
|
|
109
|
+
setDelay = _React$useState14[1];
|
|
110
|
+
|
|
111
|
+
var _React$useState15 = React.useState(false),
|
|
112
|
+
_React$useState16 = _slicedToArray(_React$useState15, 2),
|
|
113
|
+
isIncreasedDelay = _React$useState16[0],
|
|
114
|
+
setIsIncreasedDelay = _React$useState16[1];
|
|
92
115
|
|
|
116
|
+
var isSingleSlide = React.Children.count(children) === 1;
|
|
93
117
|
var showDotTimer = loop ? isAutoPlaying : isAutoPlaying && !isEnd;
|
|
94
118
|
var dotTimerDelay = delay / 1000;
|
|
95
|
-
var navArrowTheme = navTheme === NavTheme.DARK ? ArrowTheme.DARK : ArrowTheme.PURPLE;
|
|
96
119
|
var rootRef = React.useRef(null);
|
|
97
120
|
var increaseAutoplayDelay = React.useCallback(function (_ref2) {
|
|
98
121
|
var params = _ref2.params,
|
|
@@ -162,6 +185,13 @@ var Banner = function Banner(_ref) {
|
|
|
162
185
|
setActiveIndex(realIndex);
|
|
163
186
|
onChange === null || onChange === void 0 ? void 0 : onChange(realIndex);
|
|
164
187
|
}, [onChange]);
|
|
188
|
+
var handleSwiper = React.useCallback(function (swiper) {
|
|
189
|
+
setSwiperInstance(swiper);
|
|
190
|
+
getSwiper === null || getSwiper === void 0 ? void 0 : getSwiper(swiper);
|
|
191
|
+
}, [getSwiper]);
|
|
192
|
+
React.useEffect(function () {
|
|
193
|
+
setTouch(detectTouch());
|
|
194
|
+
}, []);
|
|
165
195
|
React.useEffect(function () {
|
|
166
196
|
var rootElement = rootRef.current;
|
|
167
197
|
|
|
@@ -181,15 +211,18 @@ var Banner = function Banner(_ref) {
|
|
|
181
211
|
return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
182
212
|
className: cn({
|
|
183
213
|
'nav-theme': navTheme,
|
|
184
|
-
'auto-height': autoHeight
|
|
214
|
+
'auto-height': autoHeight,
|
|
215
|
+
'background-color': backgroundColor,
|
|
216
|
+
'no-touch': !isTouch,
|
|
217
|
+
radius: radius
|
|
185
218
|
}, className),
|
|
186
219
|
ref: rootRef
|
|
187
220
|
}), /*#__PURE__*/React.createElement(Swiper, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.swiper), {
|
|
188
|
-
className: cn('swiper'),
|
|
221
|
+
className: cn('swiper', [classes.swiper]),
|
|
189
222
|
loop: loop,
|
|
190
223
|
autoplay: autoPlay ? getAutoPlayConfig(autoPlayDelay) : false,
|
|
191
224
|
watchSlidesVisibility: true,
|
|
192
|
-
onSwiper:
|
|
225
|
+
onSwiper: handleSwiper,
|
|
193
226
|
onReachBeginning: handleReachBeginning,
|
|
194
227
|
onReachEnd: handleReachEnd,
|
|
195
228
|
onFromEdge: handleFromEdge,
|
|
@@ -197,58 +230,69 @@ var Banner = function Banner(_ref) {
|
|
|
197
230
|
onTouchEnd: increaseAutoplayDelay
|
|
198
231
|
}), React.Children.map(children, function (child, i) {
|
|
199
232
|
return /*#__PURE__*/React.createElement(SwiperSlide, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.slide, i + 1), {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}), child)
|
|
203
|
-
|
|
233
|
+
className: cn('slide', [classes.slide]),
|
|
234
|
+
key: i
|
|
235
|
+
}), /*#__PURE__*/React.isValidElement(child) && /*#__PURE__*/React.cloneElement(child, {
|
|
236
|
+
backgroundColor: backgroundColor,
|
|
237
|
+
hasBottomOffset: !isSingleSlide
|
|
238
|
+
}));
|
|
239
|
+
})), !isSingleSlide && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(NavArrow, {
|
|
240
|
+
className: cn('arrow', {
|
|
241
|
+
prev: true,
|
|
242
|
+
theme: arrowTheme
|
|
243
|
+
}, [classes.arrow, classes.arrowPrev]),
|
|
204
244
|
dataAttrs: {
|
|
205
245
|
root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowPrev
|
|
206
246
|
},
|
|
207
|
-
className: cn('arrow', {
|
|
208
|
-
prev: true
|
|
209
|
-
}, [classes.arrow]),
|
|
210
247
|
onClick: handlePrevClick,
|
|
211
248
|
disabled: !loop && isBeginning,
|
|
212
|
-
theme:
|
|
249
|
+
theme: arrowTheme
|
|
213
250
|
}), /*#__PURE__*/React.createElement(NavArrow, {
|
|
251
|
+
className: cn('arrow', {
|
|
252
|
+
next: true,
|
|
253
|
+
theme: arrowTheme
|
|
254
|
+
}, [classes.arrow, classes.arrowNext]),
|
|
214
255
|
dataAttrs: {
|
|
215
256
|
root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowNext
|
|
216
257
|
},
|
|
217
|
-
className: cn('arrow', {
|
|
218
|
-
next: true
|
|
219
|
-
}, [classes.arrow]),
|
|
220
258
|
view: "next",
|
|
221
259
|
onClick: handleNextClick,
|
|
222
260
|
disabled: !loop && isEnd,
|
|
223
|
-
theme:
|
|
261
|
+
theme: arrowTheme
|
|
224
262
|
}), /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.pagination), {
|
|
225
263
|
className: cn('pagination', {
|
|
226
264
|
theme: navTheme,
|
|
227
265
|
'bottom-offset': withPaginationBottomOffset
|
|
228
|
-
})
|
|
266
|
+
}, [classes.pagination])
|
|
229
267
|
}), React.Children.map(children, function (_, i) {
|
|
230
268
|
return /*#__PURE__*/React.createElement(BannerDot, {
|
|
269
|
+
className: cn('dot', [classes.dot]),
|
|
231
270
|
dataAttrs: {
|
|
232
271
|
root: _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.dot, i + 1))
|
|
233
272
|
},
|
|
234
273
|
key: i,
|
|
235
|
-
className: cn('dot'),
|
|
236
274
|
index: i,
|
|
237
275
|
isActive: i === activeIndex,
|
|
238
276
|
showTimer: showDotTimer,
|
|
239
277
|
timerDelay: dotTimerDelay,
|
|
278
|
+
theme: navTheme,
|
|
240
279
|
onClick: handleDotClick
|
|
241
280
|
});
|
|
242
|
-
})));
|
|
281
|
+
}))));
|
|
243
282
|
};
|
|
244
283
|
|
|
245
284
|
Banner.propTypes = {
|
|
246
285
|
className: PropTypes.string,
|
|
247
286
|
loop: PropTypes.bool,
|
|
248
287
|
classes: PropTypes.shape({
|
|
249
|
-
|
|
288
|
+
swiper: PropTypes.string,
|
|
289
|
+
slide: PropTypes.string,
|
|
290
|
+
arrow: PropTypes.string,
|
|
291
|
+
arrowPrev: PropTypes.string,
|
|
292
|
+
arrowNext: PropTypes.string,
|
|
293
|
+
pagination: PropTypes.string,
|
|
294
|
+
dot: PropTypes.string
|
|
250
295
|
}),
|
|
251
|
-
withPaginationBottomOffset: PropTypes.bool,
|
|
252
296
|
dataAttrs: PropTypes.shape({
|
|
253
297
|
root: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
254
298
|
swiper: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
@@ -258,11 +302,16 @@ Banner.propTypes = {
|
|
|
258
302
|
pagination: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
259
303
|
dot: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
260
304
|
}),
|
|
305
|
+
withPaginationBottomOffset: PropTypes.bool,
|
|
261
306
|
autoPlay: PropTypes.bool,
|
|
262
307
|
autoPlayDelay: PropTypes.number,
|
|
263
308
|
pauseOnHover: PropTypes.bool,
|
|
309
|
+
backgroundColor: PropTypes.oneOf(Object.values(BackgroundColor)),
|
|
310
|
+
radius: PropTypes.oneOf(Object.values(Radius)),
|
|
264
311
|
navTheme: PropTypes.oneOf(Object.values(NavTheme)),
|
|
312
|
+
arrowTheme: PropTypes.oneOf(Object.values(ArrowTheme)),
|
|
265
313
|
autoHeight: PropTypes.bool,
|
|
314
|
+
getSwiper: PropTypes.func,
|
|
266
315
|
onNextClick: PropTypes.func,
|
|
267
316
|
onPrevClick: PropTypes.func,
|
|
268
317
|
onDotClick: PropTypes.func,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
.mfui-banner-dot {
|
|
2
|
+
position: relative;
|
|
2
3
|
display: -webkit-box;
|
|
3
4
|
display: -ms-flexbox;
|
|
4
5
|
display: flex;
|
|
@@ -11,60 +12,65 @@
|
|
|
11
12
|
-webkit-box-sizing: border-box;
|
|
12
13
|
box-sizing: border-box;
|
|
13
14
|
padding: 2px;
|
|
14
|
-
border-radius: 50%;
|
|
15
15
|
cursor: pointer;
|
|
16
16
|
}
|
|
17
17
|
.mfui-banner-dot:before {
|
|
18
18
|
content: '';
|
|
19
19
|
display: block;
|
|
20
|
-
width:
|
|
21
|
-
height:
|
|
22
|
-
border-radius:
|
|
20
|
+
width: 8px;
|
|
21
|
+
height: 8px;
|
|
22
|
+
border-radius: 4px;
|
|
23
23
|
background-color: var(--stcWhite50);
|
|
24
24
|
}
|
|
25
|
+
.mfui-banner-dot_theme_light.mfui-banner-dot_active:before {
|
|
26
|
+
background-color: var(--stcWhite);
|
|
27
|
+
}
|
|
28
|
+
.mfui-banner-dot_theme_light.mfui-banner-dot_active .mfui-banner-dot__timer-inner {
|
|
29
|
+
fill: var(--stcWhite);
|
|
30
|
+
}
|
|
31
|
+
.mfui-banner-dot_theme_dark.mfui-banner-dot_active:before {
|
|
32
|
+
background-color: var(--brandGreen);
|
|
33
|
+
}
|
|
34
|
+
.mfui-banner-dot_theme_dark.mfui-banner-dot_active .mfui-banner-dot__timer-inner {
|
|
35
|
+
fill: var(--brandGreen);
|
|
36
|
+
}
|
|
25
37
|
.mfui-banner-dot_active {
|
|
26
|
-
padding: 0;
|
|
27
38
|
cursor: default;
|
|
28
39
|
}
|
|
29
40
|
.mfui-banner-dot_active:before {
|
|
30
|
-
|
|
41
|
+
width: 24px;
|
|
31
42
|
}
|
|
32
43
|
.mfui-banner-dot_active.mfui-banner-dot_timer:before {
|
|
33
|
-
|
|
44
|
+
background-color: var(--stcWhite50);
|
|
34
45
|
}
|
|
35
46
|
.mfui-banner-dot__timer {
|
|
47
|
+
position: absolute;
|
|
36
48
|
display: block;
|
|
37
|
-
width:
|
|
38
|
-
height:
|
|
39
|
-
border-radius:
|
|
40
|
-
-webkit-transform: rotate(90deg);
|
|
41
|
-
transform: rotate(90deg);
|
|
49
|
+
width: 24px;
|
|
50
|
+
height: 8px;
|
|
51
|
+
border-radius: 4px;
|
|
42
52
|
}
|
|
43
|
-
.mfui-banner-dot__timer-
|
|
53
|
+
.mfui-banner-dot__timer-inner {
|
|
44
54
|
-webkit-transform: scale(-1, 1);
|
|
45
55
|
transform: scale(-1, 1);
|
|
46
56
|
-webkit-transform-origin: center;
|
|
47
57
|
transform-origin: center;
|
|
48
58
|
-webkit-animation: timer linear;
|
|
49
59
|
animation: timer linear;
|
|
50
|
-
fill: var(--stcWhite50);
|
|
51
|
-
stroke: var(--base);
|
|
52
|
-
stroke-width: 100;
|
|
53
|
-
stroke-dasharray: 1000;
|
|
54
60
|
}
|
|
55
61
|
@-webkit-keyframes timer {
|
|
56
62
|
0% {
|
|
57
|
-
|
|
63
|
+
width: 100%;
|
|
58
64
|
}
|
|
59
65
|
100% {
|
|
60
|
-
|
|
66
|
+
width: 0;
|
|
61
67
|
}
|
|
62
68
|
}
|
|
63
69
|
@keyframes timer {
|
|
64
70
|
0% {
|
|
65
|
-
|
|
71
|
+
width: 100%;
|
|
66
72
|
}
|
|
67
73
|
100% {
|
|
68
|
-
|
|
74
|
+
width: 0;
|
|
69
75
|
}
|
|
70
76
|
}
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import './BannerDot.less';
|
|
3
|
+
export declare const BannerDotTheme: {
|
|
4
|
+
readonly LIGHT: "light";
|
|
5
|
+
readonly DARK: "dark";
|
|
6
|
+
};
|
|
7
|
+
declare type BannerDotThemeType = typeof BannerDotTheme[keyof typeof BannerDotTheme];
|
|
3
8
|
export interface IBannerDotProps {
|
|
4
9
|
className?: string;
|
|
5
10
|
index: number;
|
|
6
11
|
isActive: boolean;
|
|
7
12
|
showTimer: boolean;
|
|
8
13
|
timerDelay: number;
|
|
14
|
+
/** Цветовая тема */
|
|
15
|
+
theme?: BannerDotThemeType;
|
|
9
16
|
dataAttrs?: {
|
|
10
17
|
root?: Record<string, string>;
|
|
11
18
|
svg?: Record<string, string>;
|
|
12
|
-
|
|
19
|
+
inner?: Record<string, string>;
|
|
13
20
|
};
|
|
14
21
|
onClick: (index: number) => void;
|
|
15
22
|
}
|