@megafon/ui-core 4.15.0 → 4.15.2
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 +23 -0
- package/dist/es/components/Badges/components/PriceBadge/PriceBadge.css +16 -0
- package/dist/es/components/Badges/components/PriceBadge/PriceBadge.d.ts +9 -0
- package/dist/es/components/Badges/components/PriceBadge/PriceBadge.js +73 -11
- package/dist/es/components/Button/Button.css +22 -0
- package/dist/es/components/Button/Button.d.ts +1 -0
- package/dist/es/components/Button/Button.js +2 -1
- package/dist/es/components/Carousel/Carousel.css +1 -1
- package/dist/es/components/Carousel/Carousel.d.ts +10 -2
- package/dist/es/components/Carousel/Carousel.js +10 -2
- package/dist/es/components/Carousel/useGradient.d.ts +0 -8
- package/dist/es/components/Carousel/useGradient.js +0 -11
- package/dist/lib/components/Badges/components/PriceBadge/PriceBadge.css +16 -0
- package/dist/lib/components/Badges/components/PriceBadge/PriceBadge.d.ts +9 -0
- package/dist/lib/components/Badges/components/PriceBadge/PriceBadge.js +75 -12
- package/dist/lib/components/Button/Button.css +22 -0
- package/dist/lib/components/Button/Button.d.ts +1 -0
- package/dist/lib/components/Button/Button.js +2 -1
- package/dist/lib/components/Carousel/Carousel.css +1 -1
- package/dist/lib/components/Carousel/Carousel.d.ts +10 -2
- package/dist/lib/components/Carousel/Carousel.js +11 -3
- package/dist/lib/components/Carousel/useGradient.d.ts +0 -8
- package/dist/lib/components/Carousel/useGradient.js +1 -13
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,29 @@
|
|
|
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.15.2](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@4.15.1...@megafon/ui-core@4.15.2) (2023-04-11)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **carousel:** fix gradientColor type and gradient height ([2d7eea0](https://github.com/MegafonWebLab/megafon-ui/commit/2d7eea0f215433912542a5a6eb99f48c7331a6d2))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [4.15.1](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@4.15.0...@megafon/ui-core@4.15.1) (2023-04-04)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **color:** new danger color for text type button ([7f53fd8](https://github.com/MegafonWebLab/megafon-ui/commit/7f53fd8d369f664e678c8cb2a437ef4fa5c801fc))
|
|
23
|
+
* **pricebadge:** new props size and subtitle ([5f40360](https://github.com/MegafonWebLab/megafon-ui/commit/5f40360509e703a8fab2f4936aa109a9b63bafcd))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
6
29
|
# [4.15.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@4.14.2...@megafon/ui-core@4.15.0) (2023-03-27)
|
|
7
30
|
|
|
8
31
|
|
|
@@ -63,6 +63,11 @@
|
|
|
63
63
|
.mfui-price-badge_theme_red .mfui-price-badge__icon {
|
|
64
64
|
fill: var(--fury);
|
|
65
65
|
}
|
|
66
|
+
.mfui-price-badge_size_big {
|
|
67
|
+
font-size: 15px;
|
|
68
|
+
line-height: 18px;
|
|
69
|
+
padding: 12px 12px 12px 4px;
|
|
70
|
+
}
|
|
66
71
|
.mfui-price-badge__text {
|
|
67
72
|
font-family: inherit;
|
|
68
73
|
margin-left: 2px;
|
|
@@ -75,4 +80,15 @@
|
|
|
75
80
|
.mfui-price-badge__icon {
|
|
76
81
|
height: 20px;
|
|
77
82
|
width: 20px;
|
|
83
|
+
min-width: 20px;
|
|
84
|
+
}
|
|
85
|
+
.mfui-price-badge_size_big .mfui-price-badge__icon {
|
|
86
|
+
height: 32px;
|
|
87
|
+
width: 32px;
|
|
88
|
+
min-width: 32px;
|
|
89
|
+
}
|
|
90
|
+
.mfui-price-badge_size_big .mfui-price-badge__sub-title {
|
|
91
|
+
font-size: 12px;
|
|
92
|
+
line-height: 18px;
|
|
93
|
+
margin-top: 2px;
|
|
78
94
|
}
|
|
@@ -12,8 +12,13 @@ export declare const PriceBadgeIcon: {
|
|
|
12
12
|
readonly CHECK: "check";
|
|
13
13
|
readonly ATTENTION: "attention";
|
|
14
14
|
};
|
|
15
|
+
export declare const PriseBadgeSize: {
|
|
16
|
+
readonly SMALL: "small";
|
|
17
|
+
readonly BIG: "big";
|
|
18
|
+
};
|
|
15
19
|
declare type PriceBadgeThemeType = typeof PriceBadgeTheme[keyof typeof PriceBadgeTheme];
|
|
16
20
|
declare type PriceBadgeIconType = typeof PriceBadgeIcon[keyof typeof PriceBadgeIcon];
|
|
21
|
+
declare type PriseBadgeSizeType = typeof PriseBadgeSize[keyof typeof PriseBadgeSize];
|
|
17
22
|
export interface IPriceBadgeProps {
|
|
18
23
|
/** Адаптивный режим */
|
|
19
24
|
isAdaptive?: boolean;
|
|
@@ -23,6 +28,10 @@ export interface IPriceBadgeProps {
|
|
|
23
28
|
theme?: PriceBadgeThemeType;
|
|
24
29
|
/** Дополнительный класс корневого элемента */
|
|
25
30
|
className?: string;
|
|
31
|
+
/** Размер бейджа */
|
|
32
|
+
size?: PriseBadgeSizeType;
|
|
33
|
+
/** Дополнительный текст (только для size="big") */
|
|
34
|
+
subTitle?: string;
|
|
26
35
|
/** Дополнительные data-атрибуты к внутренним элементам */
|
|
27
36
|
dataAttrs?: {
|
|
28
37
|
root?: Record<string, string>;
|
|
@@ -43,6 +43,44 @@ var TimerIcon = function TimerIcon(props) {
|
|
|
43
43
|
}));
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
+
var AttentionIconBig = function AttentionIconBig(props) {
|
|
47
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
48
|
+
viewBox: "0 0 32 32"
|
|
49
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
50
|
+
d: "M16 4C9.4 4 4 9.4 4 16s5.4 12 12 12 12-5.4 12-12S22.6 4 16 4zm1 18h-2v-2h2v2zm0-4h-2v-8h2v8z"
|
|
51
|
+
}));
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
var CheckIconBig = function CheckIconBig(props) {
|
|
55
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
56
|
+
viewBox: "0 0 32 32"
|
|
57
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
58
|
+
fillRule: "evenodd",
|
|
59
|
+
clipRule: "evenodd",
|
|
60
|
+
d: "M16 28c6.627 0 12-5.373 12-12S22.627 4 16 4 4 9.373 4 16s5.373 12 12 12zm-1.306-10.016l6.32-7.672 1.486 1.37s-7.538 9.186-7.7 9.193c-.136 0-4.488-4.484-4.488-4.484l1.438-1.425 2.944 3.018z"
|
|
61
|
+
}));
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
var PriceIconBig = function PriceIconBig(props) {
|
|
65
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
66
|
+
viewBox: "0 0 32 32"
|
|
67
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
68
|
+
fillRule: "evenodd",
|
|
69
|
+
clipRule: "evenodd",
|
|
70
|
+
d: "M16 28c6.627 0 12-5.373 12-12S22.627 4 16 4 4 9.373 4 16s5.373 12 12 12zm-5-7v-2h2v-2h-2v-2h2V9h4a4 4 0 110 8h-2v2h4v2h-4v2h-2v-2h-2zm7.414-9.414A2 2 0 0017 11h-2v4h2a2 2 0 001.414-3.414z"
|
|
71
|
+
}));
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
var TimerIconBig = function TimerIconBig(props) {
|
|
75
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
76
|
+
viewBox: "0 0 32 32"
|
|
77
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
78
|
+
fillRule: "evenodd",
|
|
79
|
+
clipRule: "evenodd",
|
|
80
|
+
d: "M16 28c6.627 0 12-5.373 12-12S22.627 4 16 4 4 9.373 4 16s5.373 12 12 12zm1-12.414V9h-2v7.414l4 4L20.414 19 17 15.586z"
|
|
81
|
+
}));
|
|
82
|
+
};
|
|
83
|
+
|
|
46
84
|
export var PriceBadgeTheme = {
|
|
47
85
|
RED: 'red',
|
|
48
86
|
GREY: 'grey',
|
|
@@ -55,19 +93,34 @@ export var PriceBadgeIcon = {
|
|
|
55
93
|
CHECK: 'check',
|
|
56
94
|
ATTENTION: 'attention'
|
|
57
95
|
};
|
|
96
|
+
export var PriseBadgeSize = {
|
|
97
|
+
SMALL: 'small',
|
|
98
|
+
BIG: 'big'
|
|
99
|
+
};
|
|
58
100
|
|
|
59
|
-
var getPriceBadgeIcon = function getPriceBadgeIcon(iconType) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
101
|
+
var getPriceBadgeIcon = function getPriceBadgeIcon(iconType, size) {
|
|
102
|
+
var isBigIcon = size === PriseBadgeSize.BIG;
|
|
103
|
+
|
|
104
|
+
switch (true) {
|
|
105
|
+
case iconType === PriceBadgeIcon.TIMER && isBigIcon:
|
|
106
|
+
return TimerIconBig;
|
|
107
|
+
|
|
108
|
+
case iconType === PriceBadgeIcon.PRICE && isBigIcon:
|
|
109
|
+
return PriceIconBig;
|
|
110
|
+
|
|
111
|
+
case iconType === PriceBadgeIcon.CHECK && isBigIcon:
|
|
112
|
+
return CheckIconBig;
|
|
113
|
+
|
|
114
|
+
case iconType === PriceBadgeIcon.ATTENTION && isBigIcon:
|
|
115
|
+
return AttentionIconBig;
|
|
63
116
|
|
|
64
|
-
case PriceBadgeIcon.PRICE:
|
|
117
|
+
case iconType === PriceBadgeIcon.PRICE:
|
|
65
118
|
return PriceIcon;
|
|
66
119
|
|
|
67
|
-
case PriceBadgeIcon.CHECK:
|
|
120
|
+
case iconType === PriceBadgeIcon.CHECK:
|
|
68
121
|
return CheckIcon;
|
|
69
122
|
|
|
70
|
-
case PriceBadgeIcon.ATTENTION:
|
|
123
|
+
case iconType === PriceBadgeIcon.ATTENTION:
|
|
71
124
|
return AttentionIcon;
|
|
72
125
|
|
|
73
126
|
default:
|
|
@@ -84,28 +137,37 @@ var PriceBadge = function PriceBadge(_ref) {
|
|
|
84
137
|
isAdaptive = _ref$isAdaptive === void 0 ? false : _ref$isAdaptive,
|
|
85
138
|
_ref$theme = _ref.theme,
|
|
86
139
|
theme = _ref$theme === void 0 ? 'grey' : _ref$theme,
|
|
140
|
+
_ref$size = _ref.size,
|
|
141
|
+
size = _ref$size === void 0 ? 'small' : _ref$size,
|
|
142
|
+
subTitle = _ref.subTitle,
|
|
87
143
|
className = _ref.className,
|
|
88
144
|
dataAttrs = _ref.dataAttrs,
|
|
89
145
|
children = _ref.children;
|
|
90
|
-
var Icon = getPriceBadgeIcon(iconType);
|
|
146
|
+
var Icon = getPriceBadgeIcon(iconType, size);
|
|
147
|
+
var showSubTitle = size === 'big' && !!subTitle;
|
|
91
148
|
return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
92
149
|
className: cn({
|
|
93
150
|
theme: theme,
|
|
94
|
-
adaptive: isAdaptive
|
|
151
|
+
adaptive: isAdaptive,
|
|
152
|
+
size: size
|
|
95
153
|
}, className)
|
|
96
154
|
}), /*#__PURE__*/React.createElement("div", {
|
|
97
155
|
className: cn('icon-container')
|
|
98
156
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
99
157
|
className: cn('icon')
|
|
100
|
-
})), /*#__PURE__*/React.createElement("
|
|
158
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
101
159
|
className: cn('text')
|
|
102
|
-
}, children)
|
|
160
|
+
}, /*#__PURE__*/React.createElement("div", null, children), showSubTitle && /*#__PURE__*/React.createElement("div", {
|
|
161
|
+
className: cn('sub-title')
|
|
162
|
+
}, subTitle)));
|
|
103
163
|
};
|
|
104
164
|
|
|
105
165
|
PriceBadge.propTypes = {
|
|
106
166
|
isAdaptive: PropTypes.bool,
|
|
107
167
|
iconType: PropTypes.oneOf(Object.values(PriceBadgeIcon)),
|
|
108
168
|
theme: PropTypes.oneOf(Object.values(PriceBadgeTheme)),
|
|
169
|
+
size: PropTypes.oneOf(Object.values(PriseBadgeSize)),
|
|
170
|
+
subTitle: PropTypes.string,
|
|
109
171
|
className: PropTypes.string,
|
|
110
172
|
dataAttrs: PropTypes.shape({
|
|
111
173
|
root: PropTypes.objectOf(PropTypes.string.isRequired).isRequired
|
|
@@ -494,6 +494,28 @@
|
|
|
494
494
|
.mfui-button_no-touch.mfui-button_type_text.mfui-button_theme_black:not(.mfui-button_loading):active svg {
|
|
495
495
|
fill: var(--buttonDown);
|
|
496
496
|
}
|
|
497
|
+
.mfui-button_type_text.mfui-button_theme_danger {
|
|
498
|
+
width: -webkit-fit-content;
|
|
499
|
+
width: -moz-fit-content;
|
|
500
|
+
width: fit-content;
|
|
501
|
+
color: var(--fury);
|
|
502
|
+
background-color: transparent;
|
|
503
|
+
}
|
|
504
|
+
.mfui-button_type_text.mfui-button_theme_danger svg {
|
|
505
|
+
fill: var(--fury);
|
|
506
|
+
}
|
|
507
|
+
.mfui-button_no-touch.mfui-button_type_text.mfui-button_theme_danger:not(.mfui-button_loading):hover {
|
|
508
|
+
color: var(--warmRedC);
|
|
509
|
+
}
|
|
510
|
+
.mfui-button_no-touch.mfui-button_type_text.mfui-button_theme_danger:not(.mfui-button_loading):hover svg {
|
|
511
|
+
fill: var(--warmRedC);
|
|
512
|
+
}
|
|
513
|
+
.mfui-button_no-touch.mfui-button_type_text.mfui-button_theme_danger:not(.mfui-button_loading):active {
|
|
514
|
+
color: var(--buttonDown);
|
|
515
|
+
}
|
|
516
|
+
.mfui-button_no-touch.mfui-button_type_text.mfui-button_theme_danger:not(.mfui-button_loading):active svg {
|
|
517
|
+
fill: var(--buttonDown);
|
|
518
|
+
}
|
|
497
519
|
.mfui-button_type_primary.mfui-button_theme_green {
|
|
498
520
|
color: var(--stcWhite);
|
|
499
521
|
background-color: var(--brandGreen);
|
|
@@ -13,6 +13,7 @@ export declare const ButtonThemes: {
|
|
|
13
13
|
readonly PURPLE_SOFT: "purple-soft";
|
|
14
14
|
readonly WHITE: "white";
|
|
15
15
|
readonly BLACK: "black";
|
|
16
|
+
readonly DANGER: "danger";
|
|
16
17
|
};
|
|
17
18
|
declare type ButtonThemesType = typeof ButtonThemes[keyof typeof ButtonThemes];
|
|
18
19
|
export declare const ButtonSizes: {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import SwiperCore from 'swiper';
|
|
3
3
|
import { PaginationOptions } from 'swiper/types/components/pagination';
|
|
4
|
-
import { GradientTheme } from './useGradient';
|
|
5
4
|
import './Carousel.less';
|
|
6
5
|
export declare const NavTheme: {
|
|
7
6
|
readonly LIGHT: "light";
|
|
@@ -14,9 +13,18 @@ export declare const EffectTheme: {
|
|
|
14
13
|
declare const SlidesPerView: {
|
|
15
14
|
readonly AUTO: "auto";
|
|
16
15
|
};
|
|
16
|
+
declare const GradientTheme: {
|
|
17
|
+
readonly DEFAULT: "default";
|
|
18
|
+
readonly GREEN: "green";
|
|
19
|
+
readonly BLACK: "black";
|
|
20
|
+
readonly SPB_SKY_0: "spbSky0";
|
|
21
|
+
readonly SPB_SKY_1: "spbSky1";
|
|
22
|
+
readonly SPB_SKY_2: "spbSky2";
|
|
23
|
+
};
|
|
17
24
|
declare type SlidesPerViewType = typeof SlidesPerView[keyof typeof SlidesPerView];
|
|
18
25
|
declare type NavThemeType = typeof NavTheme[keyof typeof NavTheme];
|
|
19
26
|
declare type EffectThemeType = typeof EffectTheme[keyof typeof EffectTheme];
|
|
27
|
+
declare type GradientThemeType = typeof GradientTheme[keyof typeof GradientTheme];
|
|
20
28
|
export declare type SlidesSettingsType = {
|
|
21
29
|
[key: number]: {
|
|
22
30
|
slidesPerView: number | SlidesPerViewType;
|
|
@@ -86,7 +94,7 @@ export interface ICarouselProps {
|
|
|
86
94
|
/** Наличие градиента по краям контейнера */
|
|
87
95
|
gradient?: boolean;
|
|
88
96
|
/** Цвет градиента */
|
|
89
|
-
gradientColor?:
|
|
97
|
+
gradientColor?: GradientThemeType;
|
|
90
98
|
}
|
|
91
99
|
declare const Carousel: React.FC<ICarouselProps>;
|
|
92
100
|
export default Carousel;
|
|
@@ -19,7 +19,7 @@ import NavArrow, { Theme as ArrowTheme } from "../NavArrow/NavArrow";
|
|
|
19
19
|
import throttleTime from "../../constants/throttleTime";
|
|
20
20
|
import usePrevious from "../../hooks/usePrevious";
|
|
21
21
|
import checkBreakpointsPropTypes from "./checkBreakpointsPropTypes";
|
|
22
|
-
import useGradient
|
|
22
|
+
import useGradient from "./useGradient";
|
|
23
23
|
import "./Carousel.css";
|
|
24
24
|
SwiperCore.use([Autoplay, Pagination, EffectFade]);
|
|
25
25
|
export var NavTheme = {
|
|
@@ -33,6 +33,14 @@ export var EffectTheme = {
|
|
|
33
33
|
var SlidesPerView = {
|
|
34
34
|
AUTO: 'auto'
|
|
35
35
|
};
|
|
36
|
+
var GradientTheme = {
|
|
37
|
+
DEFAULT: 'default',
|
|
38
|
+
GREEN: 'green',
|
|
39
|
+
BLACK: 'black',
|
|
40
|
+
SPB_SKY_0: 'spbSky0',
|
|
41
|
+
SPB_SKY_1: 'spbSky1',
|
|
42
|
+
SPB_SKY_2: 'spbSky2'
|
|
43
|
+
};
|
|
36
44
|
|
|
37
45
|
var getAutoPlayConfig = function getAutoPlayConfig(delay) {
|
|
38
46
|
return {
|
|
@@ -101,7 +109,7 @@ var Carousel = function Carousel(_ref) {
|
|
|
101
109
|
_ref$gradient = _ref.gradient,
|
|
102
110
|
gradient = _ref$gradient === void 0 ? false : _ref$gradient,
|
|
103
111
|
_ref$gradientColor = _ref.gradientColor,
|
|
104
|
-
gradientColor = _ref$gradientColor === void 0 ?
|
|
112
|
+
gradientColor = _ref$gradientColor === void 0 ? 'default' : _ref$gradientColor;
|
|
105
113
|
|
|
106
114
|
var _React$useState = React.useState(),
|
|
107
115
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -6,13 +6,5 @@ declare type SwiperConfig = {
|
|
|
6
6
|
slidesSettings: SlidesSettingsType;
|
|
7
7
|
isLocked: boolean;
|
|
8
8
|
};
|
|
9
|
-
export declare enum GradientTheme {
|
|
10
|
-
DEFAULT = "default",
|
|
11
|
-
GREEN = "green",
|
|
12
|
-
BLACK = "black",
|
|
13
|
-
SPB_SKY_0 = "spbSky0",
|
|
14
|
-
SPB_SKY_1 = "spbSky1",
|
|
15
|
-
SPB_SKY_2 = "spbSky2"
|
|
16
|
-
}
|
|
17
9
|
declare const _default: (gradient: boolean, swiper: SwiperConfig) => CSSProperties;
|
|
18
10
|
export default _default;
|
|
@@ -3,17 +3,6 @@ import { useState, useEffect } from 'react';
|
|
|
3
3
|
import { breakpoints } from '@megafon/ui-helpers';
|
|
4
4
|
import throttle from 'lodash.throttle';
|
|
5
5
|
import throttleTime from "../../constants/throttleTime";
|
|
6
|
-
export var GradientTheme;
|
|
7
|
-
|
|
8
|
-
(function (GradientTheme) {
|
|
9
|
-
GradientTheme["DEFAULT"] = "default";
|
|
10
|
-
GradientTheme["GREEN"] = "green";
|
|
11
|
-
GradientTheme["BLACK"] = "black";
|
|
12
|
-
GradientTheme["SPB_SKY_0"] = "spbSky0";
|
|
13
|
-
GradientTheme["SPB_SKY_1"] = "spbSky1";
|
|
14
|
-
GradientTheme["SPB_SKY_2"] = "spbSky2";
|
|
15
|
-
})(GradientTheme || (GradientTheme = {}));
|
|
16
|
-
|
|
17
6
|
export default (function (gradient, swiper) {
|
|
18
7
|
var _useState = useState(0),
|
|
19
8
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -63,6 +63,11 @@
|
|
|
63
63
|
.mfui-price-badge_theme_red .mfui-price-badge__icon {
|
|
64
64
|
fill: var(--fury);
|
|
65
65
|
}
|
|
66
|
+
.mfui-price-badge_size_big {
|
|
67
|
+
font-size: 15px;
|
|
68
|
+
line-height: 18px;
|
|
69
|
+
padding: 12px 12px 12px 4px;
|
|
70
|
+
}
|
|
66
71
|
.mfui-price-badge__text {
|
|
67
72
|
font-family: inherit;
|
|
68
73
|
margin-left: 2px;
|
|
@@ -75,4 +80,15 @@
|
|
|
75
80
|
.mfui-price-badge__icon {
|
|
76
81
|
height: 20px;
|
|
77
82
|
width: 20px;
|
|
83
|
+
min-width: 20px;
|
|
84
|
+
}
|
|
85
|
+
.mfui-price-badge_size_big .mfui-price-badge__icon {
|
|
86
|
+
height: 32px;
|
|
87
|
+
width: 32px;
|
|
88
|
+
min-width: 32px;
|
|
89
|
+
}
|
|
90
|
+
.mfui-price-badge_size_big .mfui-price-badge__sub-title {
|
|
91
|
+
font-size: 12px;
|
|
92
|
+
line-height: 18px;
|
|
93
|
+
margin-top: 2px;
|
|
78
94
|
}
|
|
@@ -12,8 +12,13 @@ export declare const PriceBadgeIcon: {
|
|
|
12
12
|
readonly CHECK: "check";
|
|
13
13
|
readonly ATTENTION: "attention";
|
|
14
14
|
};
|
|
15
|
+
export declare const PriseBadgeSize: {
|
|
16
|
+
readonly SMALL: "small";
|
|
17
|
+
readonly BIG: "big";
|
|
18
|
+
};
|
|
15
19
|
declare type PriceBadgeThemeType = typeof PriceBadgeTheme[keyof typeof PriceBadgeTheme];
|
|
16
20
|
declare type PriceBadgeIconType = typeof PriceBadgeIcon[keyof typeof PriceBadgeIcon];
|
|
21
|
+
declare type PriseBadgeSizeType = typeof PriseBadgeSize[keyof typeof PriseBadgeSize];
|
|
17
22
|
export interface IPriceBadgeProps {
|
|
18
23
|
/** Адаптивный режим */
|
|
19
24
|
isAdaptive?: boolean;
|
|
@@ -23,6 +28,10 @@ export interface IPriceBadgeProps {
|
|
|
23
28
|
theme?: PriceBadgeThemeType;
|
|
24
29
|
/** Дополнительный класс корневого элемента */
|
|
25
30
|
className?: string;
|
|
31
|
+
/** Размер бейджа */
|
|
32
|
+
size?: PriseBadgeSizeType;
|
|
33
|
+
/** Дополнительный текст (только для size="big") */
|
|
34
|
+
subTitle?: string;
|
|
26
35
|
/** Дополнительные data-атрибуты к внутренним элементам */
|
|
27
36
|
dataAttrs?: {
|
|
28
37
|
root?: Record<string, string>;
|
|
@@ -5,7 +5,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports["default"] = exports.PriceBadgeIcon = exports.PriceBadgeTheme = void 0;
|
|
8
|
+
exports["default"] = exports.PriseBadgeSize = exports.PriceBadgeIcon = exports.PriceBadgeTheme = void 0;
|
|
9
9
|
|
|
10
10
|
require("core-js/modules/es.object.values");
|
|
11
11
|
|
|
@@ -61,6 +61,44 @@ var TimerIcon = function TimerIcon(props) {
|
|
|
61
61
|
}));
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
+
var AttentionIconBig = function AttentionIconBig(props) {
|
|
65
|
+
return /*#__PURE__*/React.createElement("svg", (0, _extends2["default"])({
|
|
66
|
+
viewBox: "0 0 32 32"
|
|
67
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
68
|
+
d: "M16 4C9.4 4 4 9.4 4 16s5.4 12 12 12 12-5.4 12-12S22.6 4 16 4zm1 18h-2v-2h2v2zm0-4h-2v-8h2v8z"
|
|
69
|
+
}));
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
var CheckIconBig = function CheckIconBig(props) {
|
|
73
|
+
return /*#__PURE__*/React.createElement("svg", (0, _extends2["default"])({
|
|
74
|
+
viewBox: "0 0 32 32"
|
|
75
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
76
|
+
fillRule: "evenodd",
|
|
77
|
+
clipRule: "evenodd",
|
|
78
|
+
d: "M16 28c6.627 0 12-5.373 12-12S22.627 4 16 4 4 9.373 4 16s5.373 12 12 12zm-1.306-10.016l6.32-7.672 1.486 1.37s-7.538 9.186-7.7 9.193c-.136 0-4.488-4.484-4.488-4.484l1.438-1.425 2.944 3.018z"
|
|
79
|
+
}));
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
var PriceIconBig = function PriceIconBig(props) {
|
|
83
|
+
return /*#__PURE__*/React.createElement("svg", (0, _extends2["default"])({
|
|
84
|
+
viewBox: "0 0 32 32"
|
|
85
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
86
|
+
fillRule: "evenodd",
|
|
87
|
+
clipRule: "evenodd",
|
|
88
|
+
d: "M16 28c6.627 0 12-5.373 12-12S22.627 4 16 4 4 9.373 4 16s5.373 12 12 12zm-5-7v-2h2v-2h-2v-2h2V9h4a4 4 0 110 8h-2v2h4v2h-4v2h-2v-2h-2zm7.414-9.414A2 2 0 0017 11h-2v4h2a2 2 0 001.414-3.414z"
|
|
89
|
+
}));
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
var TimerIconBig = function TimerIconBig(props) {
|
|
93
|
+
return /*#__PURE__*/React.createElement("svg", (0, _extends2["default"])({
|
|
94
|
+
viewBox: "0 0 32 32"
|
|
95
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
96
|
+
fillRule: "evenodd",
|
|
97
|
+
clipRule: "evenodd",
|
|
98
|
+
d: "M16 28c6.627 0 12-5.373 12-12S22.627 4 16 4 4 9.373 4 16s5.373 12 12 12zm1-12.414V9h-2v7.414l4 4L20.414 19 17 15.586z"
|
|
99
|
+
}));
|
|
100
|
+
};
|
|
101
|
+
|
|
64
102
|
var PriceBadgeTheme = {
|
|
65
103
|
RED: 'red',
|
|
66
104
|
GREY: 'grey',
|
|
@@ -75,19 +113,35 @@ var PriceBadgeIcon = {
|
|
|
75
113
|
ATTENTION: 'attention'
|
|
76
114
|
};
|
|
77
115
|
exports.PriceBadgeIcon = PriceBadgeIcon;
|
|
116
|
+
var PriseBadgeSize = {
|
|
117
|
+
SMALL: 'small',
|
|
118
|
+
BIG: 'big'
|
|
119
|
+
};
|
|
120
|
+
exports.PriseBadgeSize = PriseBadgeSize;
|
|
78
121
|
|
|
79
|
-
var getPriceBadgeIcon = function getPriceBadgeIcon(iconType) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
122
|
+
var getPriceBadgeIcon = function getPriceBadgeIcon(iconType, size) {
|
|
123
|
+
var isBigIcon = size === PriseBadgeSize.BIG;
|
|
124
|
+
|
|
125
|
+
switch (true) {
|
|
126
|
+
case iconType === PriceBadgeIcon.TIMER && isBigIcon:
|
|
127
|
+
return TimerIconBig;
|
|
128
|
+
|
|
129
|
+
case iconType === PriceBadgeIcon.PRICE && isBigIcon:
|
|
130
|
+
return PriceIconBig;
|
|
131
|
+
|
|
132
|
+
case iconType === PriceBadgeIcon.CHECK && isBigIcon:
|
|
133
|
+
return CheckIconBig;
|
|
134
|
+
|
|
135
|
+
case iconType === PriceBadgeIcon.ATTENTION && isBigIcon:
|
|
136
|
+
return AttentionIconBig;
|
|
83
137
|
|
|
84
|
-
case PriceBadgeIcon.PRICE:
|
|
138
|
+
case iconType === PriceBadgeIcon.PRICE:
|
|
85
139
|
return PriceIcon;
|
|
86
140
|
|
|
87
|
-
case PriceBadgeIcon.CHECK:
|
|
141
|
+
case iconType === PriceBadgeIcon.CHECK:
|
|
88
142
|
return CheckIcon;
|
|
89
143
|
|
|
90
|
-
case PriceBadgeIcon.ATTENTION:
|
|
144
|
+
case iconType === PriceBadgeIcon.ATTENTION:
|
|
91
145
|
return AttentionIcon;
|
|
92
146
|
|
|
93
147
|
default:
|
|
@@ -104,28 +158,37 @@ var PriceBadge = function PriceBadge(_ref) {
|
|
|
104
158
|
isAdaptive = _ref$isAdaptive === void 0 ? false : _ref$isAdaptive,
|
|
105
159
|
_ref$theme = _ref.theme,
|
|
106
160
|
theme = _ref$theme === void 0 ? 'grey' : _ref$theme,
|
|
161
|
+
_ref$size = _ref.size,
|
|
162
|
+
size = _ref$size === void 0 ? 'small' : _ref$size,
|
|
163
|
+
subTitle = _ref.subTitle,
|
|
107
164
|
className = _ref.className,
|
|
108
165
|
dataAttrs = _ref.dataAttrs,
|
|
109
166
|
children = _ref.children;
|
|
110
|
-
var Icon = getPriceBadgeIcon(iconType);
|
|
167
|
+
var Icon = getPriceBadgeIcon(iconType, size);
|
|
168
|
+
var showSubTitle = size === 'big' && !!subTitle;
|
|
111
169
|
return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
112
170
|
className: cn({
|
|
113
171
|
theme: theme,
|
|
114
|
-
adaptive: isAdaptive
|
|
172
|
+
adaptive: isAdaptive,
|
|
173
|
+
size: size
|
|
115
174
|
}, className)
|
|
116
175
|
}), /*#__PURE__*/React.createElement("div", {
|
|
117
176
|
className: cn('icon-container')
|
|
118
177
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
119
178
|
className: cn('icon')
|
|
120
|
-
})), /*#__PURE__*/React.createElement("
|
|
179
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
121
180
|
className: cn('text')
|
|
122
|
-
}, children)
|
|
181
|
+
}, /*#__PURE__*/React.createElement("div", null, children), showSubTitle && /*#__PURE__*/React.createElement("div", {
|
|
182
|
+
className: cn('sub-title')
|
|
183
|
+
}, subTitle)));
|
|
123
184
|
};
|
|
124
185
|
|
|
125
186
|
PriceBadge.propTypes = {
|
|
126
187
|
isAdaptive: PropTypes.bool,
|
|
127
188
|
iconType: PropTypes.oneOf(Object.values(PriceBadgeIcon)),
|
|
128
189
|
theme: PropTypes.oneOf(Object.values(PriceBadgeTheme)),
|
|
190
|
+
size: PropTypes.oneOf(Object.values(PriseBadgeSize)),
|
|
191
|
+
subTitle: PropTypes.string,
|
|
129
192
|
className: PropTypes.string,
|
|
130
193
|
dataAttrs: PropTypes.shape({
|
|
131
194
|
root: PropTypes.objectOf(PropTypes.string.isRequired).isRequired
|
|
@@ -494,6 +494,28 @@
|
|
|
494
494
|
.mfui-button_no-touch.mfui-button_type_text.mfui-button_theme_black:not(.mfui-button_loading):active svg {
|
|
495
495
|
fill: var(--buttonDown);
|
|
496
496
|
}
|
|
497
|
+
.mfui-button_type_text.mfui-button_theme_danger {
|
|
498
|
+
width: -webkit-fit-content;
|
|
499
|
+
width: -moz-fit-content;
|
|
500
|
+
width: fit-content;
|
|
501
|
+
color: var(--fury);
|
|
502
|
+
background-color: transparent;
|
|
503
|
+
}
|
|
504
|
+
.mfui-button_type_text.mfui-button_theme_danger svg {
|
|
505
|
+
fill: var(--fury);
|
|
506
|
+
}
|
|
507
|
+
.mfui-button_no-touch.mfui-button_type_text.mfui-button_theme_danger:not(.mfui-button_loading):hover {
|
|
508
|
+
color: var(--warmRedC);
|
|
509
|
+
}
|
|
510
|
+
.mfui-button_no-touch.mfui-button_type_text.mfui-button_theme_danger:not(.mfui-button_loading):hover svg {
|
|
511
|
+
fill: var(--warmRedC);
|
|
512
|
+
}
|
|
513
|
+
.mfui-button_no-touch.mfui-button_type_text.mfui-button_theme_danger:not(.mfui-button_loading):active {
|
|
514
|
+
color: var(--buttonDown);
|
|
515
|
+
}
|
|
516
|
+
.mfui-button_no-touch.mfui-button_type_text.mfui-button_theme_danger:not(.mfui-button_loading):active svg {
|
|
517
|
+
fill: var(--buttonDown);
|
|
518
|
+
}
|
|
497
519
|
.mfui-button_type_primary.mfui-button_theme_green {
|
|
498
520
|
color: var(--stcWhite);
|
|
499
521
|
background-color: var(--brandGreen);
|
|
@@ -13,6 +13,7 @@ export declare const ButtonThemes: {
|
|
|
13
13
|
readonly PURPLE_SOFT: "purple-soft";
|
|
14
14
|
readonly WHITE: "white";
|
|
15
15
|
readonly BLACK: "black";
|
|
16
|
+
readonly DANGER: "danger";
|
|
16
17
|
};
|
|
17
18
|
declare type ButtonThemesType = typeof ButtonThemes[keyof typeof ButtonThemes];
|
|
18
19
|
export declare const ButtonSizes: {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import SwiperCore from 'swiper';
|
|
3
3
|
import { PaginationOptions } from 'swiper/types/components/pagination';
|
|
4
|
-
import { GradientTheme } from './useGradient';
|
|
5
4
|
import './Carousel.less';
|
|
6
5
|
export declare const NavTheme: {
|
|
7
6
|
readonly LIGHT: "light";
|
|
@@ -14,9 +13,18 @@ export declare const EffectTheme: {
|
|
|
14
13
|
declare const SlidesPerView: {
|
|
15
14
|
readonly AUTO: "auto";
|
|
16
15
|
};
|
|
16
|
+
declare const GradientTheme: {
|
|
17
|
+
readonly DEFAULT: "default";
|
|
18
|
+
readonly GREEN: "green";
|
|
19
|
+
readonly BLACK: "black";
|
|
20
|
+
readonly SPB_SKY_0: "spbSky0";
|
|
21
|
+
readonly SPB_SKY_1: "spbSky1";
|
|
22
|
+
readonly SPB_SKY_2: "spbSky2";
|
|
23
|
+
};
|
|
17
24
|
declare type SlidesPerViewType = typeof SlidesPerView[keyof typeof SlidesPerView];
|
|
18
25
|
declare type NavThemeType = typeof NavTheme[keyof typeof NavTheme];
|
|
19
26
|
declare type EffectThemeType = typeof EffectTheme[keyof typeof EffectTheme];
|
|
27
|
+
declare type GradientThemeType = typeof GradientTheme[keyof typeof GradientTheme];
|
|
20
28
|
export declare type SlidesSettingsType = {
|
|
21
29
|
[key: number]: {
|
|
22
30
|
slidesPerView: number | SlidesPerViewType;
|
|
@@ -86,7 +94,7 @@ export interface ICarouselProps {
|
|
|
86
94
|
/** Наличие градиента по краям контейнера */
|
|
87
95
|
gradient?: boolean;
|
|
88
96
|
/** Цвет градиента */
|
|
89
|
-
gradientColor?:
|
|
97
|
+
gradientColor?: GradientThemeType;
|
|
90
98
|
}
|
|
91
99
|
declare const Carousel: React.FC<ICarouselProps>;
|
|
92
100
|
export default Carousel;
|
|
@@ -43,7 +43,7 @@ var _usePrevious = _interopRequireDefault(require("../../hooks/usePrevious"));
|
|
|
43
43
|
|
|
44
44
|
var _checkBreakpointsPropTypes = _interopRequireDefault(require("./checkBreakpointsPropTypes"));
|
|
45
45
|
|
|
46
|
-
var _useGradient =
|
|
46
|
+
var _useGradient = _interopRequireDefault(require("./useGradient"));
|
|
47
47
|
|
|
48
48
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
49
49
|
|
|
@@ -68,6 +68,14 @@ exports.EffectTheme = EffectTheme;
|
|
|
68
68
|
var SlidesPerView = {
|
|
69
69
|
AUTO: 'auto'
|
|
70
70
|
};
|
|
71
|
+
var GradientTheme = {
|
|
72
|
+
DEFAULT: 'default',
|
|
73
|
+
GREEN: 'green',
|
|
74
|
+
BLACK: 'black',
|
|
75
|
+
SPB_SKY_0: 'spbSky0',
|
|
76
|
+
SPB_SKY_1: 'spbSky1',
|
|
77
|
+
SPB_SKY_2: 'spbSky2'
|
|
78
|
+
};
|
|
71
79
|
|
|
72
80
|
var getAutoPlayConfig = function getAutoPlayConfig(delay) {
|
|
73
81
|
return {
|
|
@@ -136,7 +144,7 @@ var Carousel = function Carousel(_ref) {
|
|
|
136
144
|
_ref$gradient = _ref.gradient,
|
|
137
145
|
gradient = _ref$gradient === void 0 ? false : _ref$gradient,
|
|
138
146
|
_ref$gradientColor = _ref.gradientColor,
|
|
139
|
-
gradientColor = _ref$gradientColor === void 0 ?
|
|
147
|
+
gradientColor = _ref$gradientColor === void 0 ? 'default' : _ref$gradientColor;
|
|
140
148
|
|
|
141
149
|
var _React$useState = _react["default"].useState(),
|
|
142
150
|
_React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
|
|
@@ -429,7 +437,7 @@ Carousel.propTypes = {
|
|
|
429
437
|
onPrevClick: PropTypes.func,
|
|
430
438
|
onChange: PropTypes.func,
|
|
431
439
|
gradient: PropTypes.oneOfType([PropTypes.bool]),
|
|
432
|
-
gradientColor: PropTypes.oneOf(Object.values(
|
|
440
|
+
gradientColor: PropTypes.oneOf(Object.values(GradientTheme))
|
|
433
441
|
};
|
|
434
442
|
var _default = Carousel;
|
|
435
443
|
exports["default"] = _default;
|
|
@@ -6,13 +6,5 @@ declare type SwiperConfig = {
|
|
|
6
6
|
slidesSettings: SlidesSettingsType;
|
|
7
7
|
isLocked: boolean;
|
|
8
8
|
};
|
|
9
|
-
export declare enum GradientTheme {
|
|
10
|
-
DEFAULT = "default",
|
|
11
|
-
GREEN = "green",
|
|
12
|
-
BLACK = "black",
|
|
13
|
-
SPB_SKY_0 = "spbSky0",
|
|
14
|
-
SPB_SKY_1 = "spbSky1",
|
|
15
|
-
SPB_SKY_2 = "spbSky2"
|
|
16
|
-
}
|
|
17
9
|
declare const _default: (gradient: boolean, swiper: SwiperConfig) => CSSProperties;
|
|
18
10
|
export default _default;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports["default"] =
|
|
6
|
+
exports["default"] = void 0;
|
|
7
7
|
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
9
|
|
|
@@ -17,18 +17,6 @@ var _throttleTime = _interopRequireDefault(require("../../constants/throttleTime
|
|
|
17
17
|
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
19
|
|
|
20
|
-
var GradientTheme;
|
|
21
|
-
exports.GradientTheme = GradientTheme;
|
|
22
|
-
|
|
23
|
-
(function (GradientTheme) {
|
|
24
|
-
GradientTheme["DEFAULT"] = "default";
|
|
25
|
-
GradientTheme["GREEN"] = "green";
|
|
26
|
-
GradientTheme["BLACK"] = "black";
|
|
27
|
-
GradientTheme["SPB_SKY_0"] = "spbSky0";
|
|
28
|
-
GradientTheme["SPB_SKY_1"] = "spbSky1";
|
|
29
|
-
GradientTheme["SPB_SKY_2"] = "spbSky2";
|
|
30
|
-
})(GradientTheme || (exports.GradientTheme = GradientTheme = {}));
|
|
31
|
-
|
|
32
20
|
var _default = function _default(gradient, swiper) {
|
|
33
21
|
var _useState = (0, _react.useState)(0),
|
|
34
22
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@megafon/ui-core",
|
|
3
|
-
"version": "4.15.
|
|
3
|
+
"version": "4.15.2",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist",
|
|
6
6
|
"styles"
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@babel/preset-env": "^7.8.6",
|
|
55
55
|
"@babel/preset-react": "^7.8.3",
|
|
56
56
|
"@babel/preset-typescript": "^7.8.3",
|
|
57
|
-
"@megafon/ui-icons": "^2.
|
|
57
|
+
"@megafon/ui-icons": "^2.9.0",
|
|
58
58
|
"@svgr/core": "^2.4.1",
|
|
59
59
|
"@testing-library/jest-dom": "5.16.2",
|
|
60
60
|
"@testing-library/react": "12.1.2",
|
|
@@ -100,5 +100,5 @@
|
|
|
100
100
|
"react-popper": "^2.2.3",
|
|
101
101
|
"swiper": "^6.5.6"
|
|
102
102
|
},
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "c2d54353eccef1c32cac6aa03b91d48e98dcdb84"
|
|
104
104
|
}
|