@megafon/ui-core 3.0.2 → 3.3.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 +57 -1
- package/dist/es/components/Accordion/Accordion.css +1 -0
- package/dist/es/components/Badges/components/PriceBadge/PriceBadge.css +70 -0
- package/dist/es/components/Badges/components/PriceBadge/PriceBadge.d.ts +33 -0
- package/dist/es/components/Badges/components/PriceBadge/PriceBadge.js +113 -0
- package/dist/es/components/Badges/components/PromoBadge/PromoBadge.css +32 -0
- package/dist/es/components/Badges/components/PromoBadge/PromoBadge.d.ts +22 -0
- package/dist/es/components/Badges/components/PromoBadge/PromoBadge.js +38 -0
- package/dist/es/components/Banner/Banner.css +16 -0
- package/dist/es/components/Banner/Banner.js +10 -3
- package/dist/es/components/Button/Button.css +8 -8
- package/dist/es/components/Calendar/Calendar.d.ts +8 -0
- package/dist/es/components/Calendar/Calendar.js +20 -4
- package/dist/es/components/Calendar/components/Day/Day.d.ts +3 -0
- package/dist/es/components/Calendar/components/Day/Day.js +9 -5
- package/dist/es/components/Calendar/components/Month/Month.d.ts +5 -0
- package/dist/es/components/Calendar/components/Month/Month.js +14 -8
- package/dist/es/components/Carousel/Carousel.js +31 -6
- package/dist/es/components/Checkbox/Checkbox.css +3 -0
- package/dist/es/components/Collapse/Collapse.js +55 -28
- package/dist/es/components/ContentArea/ContentArea.css +32 -22
- package/dist/es/components/ContentArea/ContentArea.d.ts +3 -2
- package/dist/es/components/ContentArea/ContentArea.js +11 -11
- package/dist/es/components/Counter/Counter.d.ts +7 -0
- package/dist/es/components/Counter/Counter.js +15 -8
- package/dist/es/components/Logo/Logo.js +8 -10
- package/dist/es/components/NavArrow/NavArrow.d.ts +3 -0
- package/dist/es/components/NavArrow/NavArrow.js +8 -4
- package/dist/es/components/Paragraph/Paragraph.js +1 -1
- package/dist/es/components/Search/Search.d.ts +7 -0
- package/dist/es/components/Search/Search.js +16 -9
- package/dist/es/components/Switcher/Switcher.d.ts +4 -0
- package/dist/es/components/Switcher/Switcher.js +22 -10
- package/dist/es/components/Tabs/Tabs.css +1 -1
- package/dist/es/components/TextLink/TextLink.js +6 -8
- package/dist/es/components/Tile/Tile.d.ts +2 -0
- package/dist/es/components/Tile/Tile.js +7 -3
- package/dist/es/index.d.ts +2 -0
- package/dist/es/index.js +2 -0
- package/dist/lib/components/Accordion/Accordion.css +1 -0
- package/dist/lib/components/Badges/components/PriceBadge/PriceBadge.css +70 -0
- package/dist/lib/components/Badges/components/PriceBadge/PriceBadge.d.ts +33 -0
- package/dist/lib/components/Badges/components/PriceBadge/PriceBadge.js +134 -0
- package/dist/lib/components/Badges/components/PromoBadge/PromoBadge.css +32 -0
- package/dist/lib/components/Badges/components/PromoBadge/PromoBadge.d.ts +22 -0
- package/dist/lib/components/Badges/components/PromoBadge/PromoBadge.js +59 -0
- package/dist/lib/components/Banner/Banner.css +16 -0
- package/dist/lib/components/Banner/Banner.js +10 -3
- package/dist/lib/components/Button/Button.css +8 -8
- package/dist/lib/components/Calendar/Calendar.d.ts +8 -0
- package/dist/lib/components/Calendar/Calendar.js +19 -3
- package/dist/lib/components/Calendar/components/Day/Day.d.ts +3 -0
- package/dist/lib/components/Calendar/components/Day/Day.js +8 -4
- package/dist/lib/components/Calendar/components/Month/Month.d.ts +5 -0
- package/dist/lib/components/Calendar/components/Month/Month.js +13 -7
- package/dist/lib/components/Carousel/Carousel.js +31 -6
- package/dist/lib/components/Checkbox/Checkbox.css +3 -0
- package/dist/lib/components/Collapse/Collapse.js +54 -30
- package/dist/lib/components/ContentArea/ContentArea.css +32 -22
- package/dist/lib/components/ContentArea/ContentArea.d.ts +3 -2
- package/dist/lib/components/ContentArea/ContentArea.js +11 -11
- package/dist/lib/components/Counter/Counter.d.ts +7 -0
- package/dist/lib/components/Counter/Counter.js +14 -7
- package/dist/lib/components/Logo/Logo.js +8 -10
- package/dist/lib/components/NavArrow/NavArrow.d.ts +3 -0
- package/dist/lib/components/NavArrow/NavArrow.js +7 -3
- package/dist/lib/components/Paragraph/Paragraph.js +1 -1
- package/dist/lib/components/Search/Search.d.ts +7 -0
- package/dist/lib/components/Search/Search.js +15 -8
- package/dist/lib/components/Switcher/Switcher.d.ts +4 -0
- package/dist/lib/components/Switcher/Switcher.js +25 -9
- package/dist/lib/components/Tabs/Tabs.css +1 -1
- package/dist/lib/components/TextLink/TextLink.js +6 -8
- package/dist/lib/components/Tile/Tile.d.ts +2 -0
- package/dist/lib/components/Tile/Tile.js +7 -3
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/index.js +16 -0
- package/package.json +4 -4
|
@@ -7,7 +7,7 @@ import "core-js/modules/es.string.split";
|
|
|
7
7
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
8
8
|
import _extends from "@babel/runtime/helpers/extends";
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import { cnCreate } from '@megafon/ui-helpers';
|
|
10
|
+
import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
|
|
11
11
|
import debounce from 'lodash.debounce';
|
|
12
12
|
import * as PropTypes from 'prop-types';
|
|
13
13
|
import InputLabel from "../InputLabel/InputLabel";
|
|
@@ -28,7 +28,8 @@ export var Verification = {
|
|
|
28
28
|
var cn = cnCreate('mfui-search');
|
|
29
29
|
|
|
30
30
|
var Search = function Search(_ref) {
|
|
31
|
-
var
|
|
31
|
+
var dataAttrs = _ref.dataAttrs,
|
|
32
|
+
_ref$value = _ref.value,
|
|
32
33
|
value = _ref$value === void 0 ? '' : _ref$value,
|
|
33
34
|
label = _ref.label,
|
|
34
35
|
placeholder = _ref.placeholder,
|
|
@@ -160,18 +161,18 @@ var Search = function Search(_ref) {
|
|
|
160
161
|
}));
|
|
161
162
|
};
|
|
162
163
|
|
|
163
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
164
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
164
165
|
className: cn({
|
|
165
166
|
open: isFocused,
|
|
166
167
|
disabled: disabled
|
|
167
168
|
}, [className])
|
|
168
|
-
}, label && /*#__PURE__*/React.createElement(InputLabel, null, label, required && /*#__PURE__*/React.createElement("span", {
|
|
169
|
+
}), label && /*#__PURE__*/React.createElement(InputLabel, null, label, required && /*#__PURE__*/React.createElement("span", {
|
|
169
170
|
className: cn('require-mark')
|
|
170
171
|
}, "*")), /*#__PURE__*/React.createElement("div", {
|
|
171
172
|
className: cn('control', {
|
|
172
173
|
error: verification === Verification.ERROR
|
|
173
174
|
}, [classes === null || classes === void 0 ? void 0 : classes.control])
|
|
174
|
-
}, /*#__PURE__*/React.createElement("input", {
|
|
175
|
+
}, /*#__PURE__*/React.createElement("input", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.searchField), {
|
|
175
176
|
className: cn('search-field'),
|
|
176
177
|
placeholder: placeholder,
|
|
177
178
|
value: searchQuery,
|
|
@@ -183,10 +184,10 @@ var Search = function Search(_ref) {
|
|
|
183
184
|
disabled: disabled,
|
|
184
185
|
type: "text",
|
|
185
186
|
autoComplete: "off"
|
|
186
|
-
}), !hideIcon && /*#__PURE__*/React.createElement("div", {
|
|
187
|
+
})), !hideIcon && /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.submit), {
|
|
187
188
|
className: cn('icon-box'),
|
|
188
189
|
onClick: handleSearchSubmit
|
|
189
|
-
}, /*#__PURE__*/React.createElement(SearchIcon, {
|
|
190
|
+
}), /*#__PURE__*/React.createElement(SearchIcon, {
|
|
190
191
|
className: cn('icon', [classes === null || classes === void 0 ? void 0 : classes.icon])
|
|
191
192
|
})), !!items.length && /*#__PURE__*/React.createElement("div", {
|
|
192
193
|
className: cn('list')
|
|
@@ -195,14 +196,14 @@ var Search = function Search(_ref) {
|
|
|
195
196
|
}, items.map(function (_ref2, i) {
|
|
196
197
|
var itemValue = _ref2.value,
|
|
197
198
|
searchView = _ref2.searchView;
|
|
198
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
199
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.item, i + 1), {
|
|
199
200
|
className: cn('list-item', {
|
|
200
201
|
active: activeIndex === i
|
|
201
202
|
}),
|
|
202
203
|
onMouseDown: handleSelectSubmit(i),
|
|
203
204
|
onMouseEnter: handleHoverItem(i),
|
|
204
205
|
key: i
|
|
205
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
206
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
206
207
|
className: cn('item-title', [classes === null || classes === void 0 ? void 0 : classes.listItemTitle])
|
|
207
208
|
}, searchView || highlightString(itemValue)));
|
|
208
209
|
})))), noticeText && /*#__PURE__*/React.createElement("div", {
|
|
@@ -214,6 +215,12 @@ var Search = function Search(_ref) {
|
|
|
214
215
|
};
|
|
215
216
|
|
|
216
217
|
Search.propTypes = {
|
|
218
|
+
dataAttrs: PropTypes.shape({
|
|
219
|
+
root: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
220
|
+
searchField: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
221
|
+
submit: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
222
|
+
item: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
223
|
+
}),
|
|
217
224
|
value: PropTypes.string,
|
|
218
225
|
label: PropTypes.string,
|
|
219
226
|
placeholder: PropTypes.string,
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import './Switcher.less';
|
|
3
3
|
export interface ISwitcherProps {
|
|
4
|
+
/** Дополнительные data атрибуты к внутренним элементам */
|
|
5
|
+
dataAttrs?: {
|
|
6
|
+
root?: Record<string, string>;
|
|
7
|
+
};
|
|
4
8
|
/** Дополнительный класс корневого элемента */
|
|
5
9
|
className?: string;
|
|
6
10
|
/** Управление состоянием вкл/выкл компонента */
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
import * as React from 'react';
|
|
2
|
-
import { cnCreate, detectTouch } from '@megafon/ui-helpers';
|
|
3
|
+
import { cnCreate, detectTouch, filterDataAttrs } from '@megafon/ui-helpers';
|
|
4
|
+
import * as PropTypes from 'prop-types';
|
|
3
5
|
import "./Switcher.css";
|
|
4
6
|
var cn = cnCreate('mfui-switcher');
|
|
5
7
|
|
|
6
|
-
var Switcher = function Switcher(
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
checked =
|
|
10
|
-
|
|
11
|
-
disabled =
|
|
12
|
-
|
|
8
|
+
var Switcher = function Switcher(_ref) {
|
|
9
|
+
var dataAttrs = _ref.dataAttrs,
|
|
10
|
+
className = _ref.className,
|
|
11
|
+
_ref$checked = _ref.checked,
|
|
12
|
+
checked = _ref$checked === void 0 ? false : _ref$checked,
|
|
13
|
+
_ref$disabled = _ref.disabled,
|
|
14
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
15
|
+
onChange = _ref.onChange;
|
|
13
16
|
var isTouch = detectTouch();
|
|
14
17
|
|
|
15
18
|
var handleChange = function handleChange(e) {
|
|
@@ -20,16 +23,25 @@ var Switcher = function Switcher(props) {
|
|
|
20
23
|
onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
21
24
|
};
|
|
22
25
|
|
|
23
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
26
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
24
27
|
className: cn({
|
|
25
28
|
checked: checked,
|
|
26
29
|
disabled: disabled,
|
|
27
30
|
'no-touch': !isTouch
|
|
28
31
|
}, className),
|
|
29
32
|
onClick: handleChange
|
|
30
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
33
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
31
34
|
className: cn('pointer')
|
|
32
35
|
}));
|
|
33
36
|
};
|
|
34
37
|
|
|
38
|
+
Switcher.propTypes = {
|
|
39
|
+
dataAttrs: PropTypes.shape({
|
|
40
|
+
root: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
41
|
+
}),
|
|
42
|
+
className: PropTypes.string,
|
|
43
|
+
checked: PropTypes.bool,
|
|
44
|
+
disabled: PropTypes.bool,
|
|
45
|
+
onChange: PropTypes.func
|
|
46
|
+
};
|
|
35
47
|
export default Switcher;
|
|
@@ -6,9 +6,12 @@ import Link from "../Link/Link";
|
|
|
6
6
|
var cn = cnCreate('mfui-text-link');
|
|
7
7
|
|
|
8
8
|
var TextLink = function TextLink(_ref) {
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
var _ref$underlineVisibil = _ref.underlineVisibility,
|
|
10
|
+
underlineVisibility = _ref$underlineVisibil === void 0 ? 'hover' : _ref$underlineVisibil,
|
|
11
|
+
_ref$underlineStyle = _ref.underlineStyle,
|
|
12
|
+
underlineStyle = _ref$underlineStyle === void 0 ? 'solid' : _ref$underlineStyle,
|
|
13
|
+
_ref$color = _ref.color,
|
|
14
|
+
color = _ref$color === void 0 ? 'blue' : _ref$color,
|
|
12
15
|
className = _ref.className,
|
|
13
16
|
target = _ref.target,
|
|
14
17
|
href = _ref.href,
|
|
@@ -41,9 +44,4 @@ TextLink.propTypes = {
|
|
|
41
44
|
}),
|
|
42
45
|
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element), PropTypes.element, PropTypes.string, PropTypes.node])
|
|
43
46
|
};
|
|
44
|
-
TextLink.defaultProps = {
|
|
45
|
-
underlineVisibility: 'hover',
|
|
46
|
-
underlineStyle: 'solid',
|
|
47
|
-
color: 'blue'
|
|
48
|
-
};
|
|
49
47
|
export default TextLink;
|
|
@@ -20,6 +20,8 @@ declare type ShadowType = typeof Shadow[keyof typeof Shadow];
|
|
|
20
20
|
export interface ITileProps {
|
|
21
21
|
/** Ссылка */
|
|
22
22
|
href?: string;
|
|
23
|
+
/** Атрибут для открытия ссылки */
|
|
24
|
+
target?: '_self' | '_blank';
|
|
23
25
|
/** Тема */
|
|
24
26
|
theme?: ThemeType;
|
|
25
27
|
/** Радиус границы */
|
|
@@ -33,7 +33,9 @@ var Tile = function Tile(_ref) {
|
|
|
33
33
|
_ref$isInteractive = _ref.isInteractive,
|
|
34
34
|
isInteractive = _ref$isInteractive === void 0 ? false : _ref$isInteractive,
|
|
35
35
|
onClick = _ref.onClick,
|
|
36
|
-
dataAttrs = _ref.dataAttrs
|
|
36
|
+
dataAttrs = _ref.dataAttrs,
|
|
37
|
+
_ref$target = _ref.target,
|
|
38
|
+
target = _ref$target === void 0 ? '_self' : _ref$target;
|
|
37
39
|
|
|
38
40
|
var handleClick = function handleClick(e) {
|
|
39
41
|
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
@@ -51,7 +53,8 @@ var Tile = function Tile(_ref) {
|
|
|
51
53
|
onClick: handleClick
|
|
52
54
|
}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root)), href && /*#__PURE__*/React.createElement("a", {
|
|
53
55
|
href: href,
|
|
54
|
-
className: cn('link')
|
|
56
|
+
className: cn('link'),
|
|
57
|
+
target: target
|
|
55
58
|
}, children), !href && children);
|
|
56
59
|
};
|
|
57
60
|
|
|
@@ -65,6 +68,7 @@ Tile.propTypes = {
|
|
|
65
68
|
onClick: PropTypes.func,
|
|
66
69
|
dataAttrs: PropTypes.shape({
|
|
67
70
|
root: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
68
|
-
})
|
|
71
|
+
}),
|
|
72
|
+
target: PropTypes.oneOf(['_self', '_blank'])
|
|
69
73
|
};
|
|
70
74
|
export default Tile;
|
package/dist/es/index.d.ts
CHANGED
|
@@ -28,6 +28,8 @@ export { default as PaginationButtons } from './components/Pagination/components
|
|
|
28
28
|
export { default as PaginationNavigation } from './components/Pagination/components/PaginationNavigation/PaginationNavigation';
|
|
29
29
|
export { default as Paragraph } from './components/Paragraph/Paragraph';
|
|
30
30
|
export { default as Preloader } from './components/Preloader/Preloader';
|
|
31
|
+
export { default as PriceBadge } from './components/Badges/components/PriceBadge/PriceBadge';
|
|
32
|
+
export { default as PromoBadge } from './components/Badges/components/PromoBadge/PromoBadge';
|
|
31
33
|
export { default as RadioButton } from './components/RadioButton/RadioButton';
|
|
32
34
|
export { default as Search } from './components/Search/Search';
|
|
33
35
|
export { default as Select } from './components/Select/Select';
|
package/dist/es/index.js
CHANGED
|
@@ -28,6 +28,8 @@ export { default as PaginationButtons } from "./components/Pagination/components
|
|
|
28
28
|
export { default as PaginationNavigation } from "./components/Pagination/components/PaginationNavigation/PaginationNavigation";
|
|
29
29
|
export { default as Paragraph } from "./components/Paragraph/Paragraph";
|
|
30
30
|
export { default as Preloader } from "./components/Preloader/Preloader";
|
|
31
|
+
export { default as PriceBadge } from "./components/Badges/components/PriceBadge/PriceBadge";
|
|
32
|
+
export { default as PromoBadge } from "./components/Badges/components/PromoBadge/PromoBadge";
|
|
31
33
|
export { default as RadioButton } from "./components/RadioButton/RadioButton";
|
|
32
34
|
export { default as Search } from "./components/Search/Search";
|
|
33
35
|
export { default as Select } from "./components/Select/Select";
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
.mfui-price-badge {
|
|
2
|
+
font-size: 12px;
|
|
3
|
+
line-height: 16px;
|
|
4
|
+
display: -webkit-box;
|
|
5
|
+
display: -ms-flexbox;
|
|
6
|
+
display: flex;
|
|
7
|
+
-webkit-box-align: center;
|
|
8
|
+
-ms-flex-align: center;
|
|
9
|
+
align-items: center;
|
|
10
|
+
padding: 4px;
|
|
11
|
+
padding-right: 8px;
|
|
12
|
+
width: -webkit-fit-content;
|
|
13
|
+
width: -moz-fit-content;
|
|
14
|
+
width: fit-content;
|
|
15
|
+
height: 24px;
|
|
16
|
+
border-radius: 8px;
|
|
17
|
+
}
|
|
18
|
+
@media screen and (min-width: 1024px) {
|
|
19
|
+
.mfui-price-badge_adaptive {
|
|
20
|
+
font-size: 15px;
|
|
21
|
+
line-height: 24px;
|
|
22
|
+
padding: 4px 8px;
|
|
23
|
+
height: 32px;
|
|
24
|
+
border-radius: 12px;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
.mfui-price-badge_theme_grey {
|
|
28
|
+
background-color: var(--spbSky0);
|
|
29
|
+
}
|
|
30
|
+
.mfui-price-badge_theme_grey .mfui-price-badge__text {
|
|
31
|
+
color: var(--spbSky3);
|
|
32
|
+
}
|
|
33
|
+
.mfui-price-badge_theme_grey .mfui-price-badge__icon {
|
|
34
|
+
fill: var(--spbSky3);
|
|
35
|
+
}
|
|
36
|
+
.mfui-price-badge_theme_orange {
|
|
37
|
+
background-color: var(--137C20);
|
|
38
|
+
}
|
|
39
|
+
.mfui-price-badge_theme_orange .mfui-price-badge__text {
|
|
40
|
+
color: var(--137C);
|
|
41
|
+
}
|
|
42
|
+
.mfui-price-badge_theme_orange .mfui-price-badge__icon {
|
|
43
|
+
fill: var(--137C);
|
|
44
|
+
}
|
|
45
|
+
.mfui-price-badge_theme_green {
|
|
46
|
+
background-color: var(--brandGreen20);
|
|
47
|
+
}
|
|
48
|
+
.mfui-price-badge_theme_green .mfui-price-badge__text {
|
|
49
|
+
color: var(--brandGreen);
|
|
50
|
+
}
|
|
51
|
+
.mfui-price-badge_theme_green .mfui-price-badge__icon {
|
|
52
|
+
fill: var(--brandGreen);
|
|
53
|
+
}
|
|
54
|
+
.mfui-price-badge_theme_red {
|
|
55
|
+
background-color: var(--fury20);
|
|
56
|
+
}
|
|
57
|
+
.mfui-price-badge_theme_red .mfui-price-badge__text {
|
|
58
|
+
color: var(--fury);
|
|
59
|
+
}
|
|
60
|
+
.mfui-price-badge_theme_red .mfui-price-badge__icon {
|
|
61
|
+
fill: var(--fury);
|
|
62
|
+
}
|
|
63
|
+
.mfui-price-badge__text {
|
|
64
|
+
font-family: inherit;
|
|
65
|
+
margin-left: 4px;
|
|
66
|
+
}
|
|
67
|
+
.mfui-price-badge__icon {
|
|
68
|
+
height: 20px;
|
|
69
|
+
width: 20px;
|
|
70
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import './PriceBadge.less';
|
|
3
|
+
export declare const PriceBadgeTheme: {
|
|
4
|
+
readonly RED: "red";
|
|
5
|
+
readonly GREY: "grey";
|
|
6
|
+
readonly GREEN: "green";
|
|
7
|
+
readonly ORANGE: "orange";
|
|
8
|
+
};
|
|
9
|
+
export declare const PriceBadgeIcon: {
|
|
10
|
+
readonly TIMER: "timer";
|
|
11
|
+
readonly PRICE: "price";
|
|
12
|
+
readonly CHECK: "check";
|
|
13
|
+
readonly ATTENTION: "attention";
|
|
14
|
+
};
|
|
15
|
+
declare type PriceBadgeThemeType = typeof PriceBadgeTheme[keyof typeof PriceBadgeTheme];
|
|
16
|
+
declare type PriceBadgeIconType = typeof PriceBadgeIcon[keyof typeof PriceBadgeIcon];
|
|
17
|
+
export interface IPriceBadgeProps {
|
|
18
|
+
/** Адаптивный режим */
|
|
19
|
+
isAdaptive?: boolean;
|
|
20
|
+
/** Тип иконки */
|
|
21
|
+
iconType?: PriceBadgeIconType;
|
|
22
|
+
/** Цветовая тема */
|
|
23
|
+
theme?: PriceBadgeThemeType;
|
|
24
|
+
/** Дополнительный класс корневого элемента */
|
|
25
|
+
className?: string;
|
|
26
|
+
/** Дополнительные data-атрибуты к внутренним элементам */
|
|
27
|
+
dataAttrs?: {
|
|
28
|
+
root?: Record<string, string>;
|
|
29
|
+
};
|
|
30
|
+
children: JSX.Element[] | Element[] | JSX.Element | Element | string;
|
|
31
|
+
}
|
|
32
|
+
declare const PriceBadge: React.FC<IPriceBadgeProps>;
|
|
33
|
+
export default PriceBadge;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = exports.PriceBadgeIcon = exports.PriceBadgeTheme = void 0;
|
|
9
|
+
|
|
10
|
+
require("core-js/modules/es.object.values");
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var React = _interopRequireWildcard(require("react"));
|
|
15
|
+
|
|
16
|
+
var _uiHelpers = require("@megafon/ui-helpers");
|
|
17
|
+
|
|
18
|
+
var PropTypes = _interopRequireWildcard(require("prop-types"));
|
|
19
|
+
|
|
20
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
21
|
+
|
|
22
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
+
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
|
+
|
|
26
|
+
var AttentionIcon = function AttentionIcon(props) {
|
|
27
|
+
return /*#__PURE__*/React.createElement("svg", (0, _extends2["default"])({
|
|
28
|
+
viewBox: "0 0 20 20"
|
|
29
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
30
|
+
d: "M10 2c4.4 0 8 3.6 8 8s-3.6 8-8 8-8-3.6-8-8 3.6-8 8-8zm0 13c.3 0 .5-.1.7-.3.2-.2.3-.4.3-.7s-.1-.5-.3-.7c-.2-.2-.5-.3-.7-.3s-.5.1-.7.3c-.2.2-.3.4-.3.7s.1.5.3.7.5.3.7.3zM9 5v6h2V5H9z"
|
|
31
|
+
}));
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
var CheckIcon = function CheckIcon(props) {
|
|
35
|
+
return /*#__PURE__*/React.createElement("svg", (0, _extends2["default"])({
|
|
36
|
+
viewBox: "0 0 20 20"
|
|
37
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
38
|
+
fillRule: "evenodd",
|
|
39
|
+
clipRule: "evenodd",
|
|
40
|
+
d: "M10 18a8 8 0 100-16 8 8 0 000 16zM7.295 9.467l1.77 1.77 3.66-5.22 1.31.918-4.745 6.79-3.126-3.127 1.131-1.13z"
|
|
41
|
+
}));
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
var PriceIcon = function PriceIcon(props) {
|
|
45
|
+
return /*#__PURE__*/React.createElement("svg", (0, _extends2["default"])({
|
|
46
|
+
viewBox: "0 0 20 20"
|
|
47
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
48
|
+
fillRule: "evenodd",
|
|
49
|
+
clipRule: "evenodd",
|
|
50
|
+
d: "M10 18a8 8 0 100-16 8 8 0 000 16zM7.75 5.75H11a2.75 2.75 0 010 5.5H9.25V12h3v1.5h-3v1.75h-1.5V13.5h-1V12h1v-.75h-1v-1.5h1v-4zM11 7.25H9.25v2.5H11a1.25 1.25 0 000-2.5z"
|
|
51
|
+
}));
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
var TimerIcon = function TimerIcon(props) {
|
|
55
|
+
return /*#__PURE__*/React.createElement("svg", (0, _extends2["default"])({
|
|
56
|
+
viewBox: "0 0 20 20"
|
|
57
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
58
|
+
fillRule: "evenodd",
|
|
59
|
+
clipRule: "evenodd",
|
|
60
|
+
d: "M10 18a8 8 0 100-16 8 8 0 000 16zm1-8.414V5H9v5.414l3 3L13.414 12 11 9.586z"
|
|
61
|
+
}));
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
var PriceBadgeTheme = {
|
|
65
|
+
RED: 'red',
|
|
66
|
+
GREY: 'grey',
|
|
67
|
+
GREEN: 'green',
|
|
68
|
+
ORANGE: 'orange'
|
|
69
|
+
};
|
|
70
|
+
exports.PriceBadgeTheme = PriceBadgeTheme;
|
|
71
|
+
var PriceBadgeIcon = {
|
|
72
|
+
TIMER: 'timer',
|
|
73
|
+
PRICE: 'price',
|
|
74
|
+
CHECK: 'check',
|
|
75
|
+
ATTENTION: 'attention'
|
|
76
|
+
};
|
|
77
|
+
exports.PriceBadgeIcon = PriceBadgeIcon;
|
|
78
|
+
|
|
79
|
+
var getPriceBadgeIcon = function getPriceBadgeIcon(iconType) {
|
|
80
|
+
switch (iconType) {
|
|
81
|
+
case PriceBadgeIcon.TIMER:
|
|
82
|
+
return TimerIcon;
|
|
83
|
+
|
|
84
|
+
case PriceBadgeIcon.PRICE:
|
|
85
|
+
return PriceIcon;
|
|
86
|
+
|
|
87
|
+
case PriceBadgeIcon.CHECK:
|
|
88
|
+
return CheckIcon;
|
|
89
|
+
|
|
90
|
+
case PriceBadgeIcon.ATTENTION:
|
|
91
|
+
return AttentionIcon;
|
|
92
|
+
|
|
93
|
+
default:
|
|
94
|
+
return TimerIcon;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
var cn = (0, _uiHelpers.cnCreate)('mfui-price-badge');
|
|
99
|
+
|
|
100
|
+
var PriceBadge = function PriceBadge(_ref) {
|
|
101
|
+
var _ref$iconType = _ref.iconType,
|
|
102
|
+
iconType = _ref$iconType === void 0 ? 'timer' : _ref$iconType,
|
|
103
|
+
_ref$isAdaptive = _ref.isAdaptive,
|
|
104
|
+
isAdaptive = _ref$isAdaptive === void 0 ? false : _ref$isAdaptive,
|
|
105
|
+
_ref$theme = _ref.theme,
|
|
106
|
+
theme = _ref$theme === void 0 ? 'grey' : _ref$theme,
|
|
107
|
+
className = _ref.className,
|
|
108
|
+
dataAttrs = _ref.dataAttrs,
|
|
109
|
+
children = _ref.children;
|
|
110
|
+
var Icon = getPriceBadgeIcon(iconType);
|
|
111
|
+
return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
112
|
+
className: cn({
|
|
113
|
+
theme: theme,
|
|
114
|
+
adaptive: isAdaptive
|
|
115
|
+
}, className)
|
|
116
|
+
}), /*#__PURE__*/React.createElement(Icon, {
|
|
117
|
+
className: cn('icon')
|
|
118
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
119
|
+
className: cn('text')
|
|
120
|
+
}, children));
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
PriceBadge.propTypes = {
|
|
124
|
+
isAdaptive: PropTypes.bool,
|
|
125
|
+
iconType: PropTypes.oneOf(Object.values(PriceBadgeIcon)),
|
|
126
|
+
theme: PropTypes.oneOf(Object.values(PriceBadgeTheme)),
|
|
127
|
+
className: PropTypes.string,
|
|
128
|
+
dataAttrs: PropTypes.shape({
|
|
129
|
+
root: PropTypes.objectOf(PropTypes.string.isRequired).isRequired
|
|
130
|
+
}),
|
|
131
|
+
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element.isRequired), PropTypes.element, PropTypes.string]).isRequired
|
|
132
|
+
};
|
|
133
|
+
var _default = PriceBadge;
|
|
134
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
.mfui-promo-badge {
|
|
2
|
+
display: -webkit-box;
|
|
3
|
+
display: -ms-flexbox;
|
|
4
|
+
display: flex;
|
|
5
|
+
-webkit-box-align: center;
|
|
6
|
+
-ms-flex-align: center;
|
|
7
|
+
align-items: center;
|
|
8
|
+
padding: 4px 12px;
|
|
9
|
+
width: -webkit-fit-content;
|
|
10
|
+
width: -moz-fit-content;
|
|
11
|
+
width: fit-content;
|
|
12
|
+
border-radius: 8px;
|
|
13
|
+
color: var(--base);
|
|
14
|
+
}
|
|
15
|
+
.mfui-promo-badge_type_hit {
|
|
16
|
+
background-color: var(--warmRedC);
|
|
17
|
+
}
|
|
18
|
+
.mfui-promo-badge_type_new {
|
|
19
|
+
background-color: var(--systemBlue);
|
|
20
|
+
}
|
|
21
|
+
.mfui-promo-badge_type_popular {
|
|
22
|
+
background-color: var(--137C);
|
|
23
|
+
}
|
|
24
|
+
.mfui-promo-badge_type_user-choice {
|
|
25
|
+
background-color: var(--reflexBlue);
|
|
26
|
+
}
|
|
27
|
+
.mfui-promo-badge__text {
|
|
28
|
+
font-family: inherit;
|
|
29
|
+
font-size: 12px;
|
|
30
|
+
line-height: 16px;
|
|
31
|
+
font-weight: 500;
|
|
32
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import './PromoBadge.less';
|
|
3
|
+
export declare const PromoBadgeTypes: {
|
|
4
|
+
readonly HIT: "hit";
|
|
5
|
+
readonly NEW: "new";
|
|
6
|
+
readonly POPULAR: "popular";
|
|
7
|
+
readonly USER_CHOICE: "user-choice";
|
|
8
|
+
};
|
|
9
|
+
declare type PromoBadgeTypesType = typeof PromoBadgeTypes[keyof typeof PromoBadgeTypes];
|
|
10
|
+
export interface IPromoBadgeProps {
|
|
11
|
+
/** Тип промо-бэйджа */
|
|
12
|
+
type?: PromoBadgeTypesType;
|
|
13
|
+
/** Дополнительный класс корневого элемента */
|
|
14
|
+
className?: string;
|
|
15
|
+
/** Дополнительные data-атрибуты к внутренним элементам */
|
|
16
|
+
dataAttrs?: {
|
|
17
|
+
root?: Record<string, string>;
|
|
18
|
+
};
|
|
19
|
+
children: JSX.Element[] | Element[] | JSX.Element | Element | string;
|
|
20
|
+
}
|
|
21
|
+
declare const PromoBadge: React.FC<IPromoBadgeProps>;
|
|
22
|
+
export default PromoBadge;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = exports.PromoBadgeTypes = void 0;
|
|
9
|
+
|
|
10
|
+
require("core-js/modules/es.object.values");
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var React = _interopRequireWildcard(require("react"));
|
|
15
|
+
|
|
16
|
+
var _uiHelpers = require("@megafon/ui-helpers");
|
|
17
|
+
|
|
18
|
+
var PropTypes = _interopRequireWildcard(require("prop-types"));
|
|
19
|
+
|
|
20
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
21
|
+
|
|
22
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
+
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
|
+
|
|
26
|
+
var PromoBadgeTypes = {
|
|
27
|
+
HIT: 'hit',
|
|
28
|
+
NEW: 'new',
|
|
29
|
+
POPULAR: 'popular',
|
|
30
|
+
USER_CHOICE: 'user-choice'
|
|
31
|
+
};
|
|
32
|
+
exports.PromoBadgeTypes = PromoBadgeTypes;
|
|
33
|
+
var cn = (0, _uiHelpers.cnCreate)('mfui-promo-badge');
|
|
34
|
+
|
|
35
|
+
var PromoBadge = function PromoBadge(_ref) {
|
|
36
|
+
var _ref$type = _ref.type,
|
|
37
|
+
type = _ref$type === void 0 ? 'hit' : _ref$type,
|
|
38
|
+
className = _ref.className,
|
|
39
|
+
children = _ref.children,
|
|
40
|
+
dataAttrs = _ref.dataAttrs;
|
|
41
|
+
return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
42
|
+
className: cn({
|
|
43
|
+
type: type
|
|
44
|
+
}, className)
|
|
45
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
46
|
+
className: cn('text')
|
|
47
|
+
}, children));
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
PromoBadge.propTypes = {
|
|
51
|
+
type: PropTypes.oneOf(Object.values(PromoBadgeTypes)),
|
|
52
|
+
className: PropTypes.string,
|
|
53
|
+
dataAttrs: PropTypes.shape({
|
|
54
|
+
root: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
55
|
+
}),
|
|
56
|
+
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element.isRequired), PropTypes.element, PropTypes.string]).isRequired
|
|
57
|
+
};
|
|
58
|
+
var _default = PromoBadge;
|
|
59
|
+
exports["default"] = _default;
|
|
@@ -17,6 +17,15 @@
|
|
|
17
17
|
height: 540px;
|
|
18
18
|
}
|
|
19
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
|
+
}
|
|
20
29
|
@media screen and (min-width: 1024px) and (max-width: 1279px) {
|
|
21
30
|
.mfui-banner__slide {
|
|
22
31
|
height: 420px;
|
|
@@ -27,6 +36,13 @@
|
|
|
27
36
|
height: 400px;
|
|
28
37
|
}
|
|
29
38
|
}
|
|
39
|
+
@media screen and (min-width: 1024px) {
|
|
40
|
+
.mfui-banner .swiper-slide-visible {
|
|
41
|
+
opacity: 1;
|
|
42
|
+
-webkit-transition: opacity 0.4s;
|
|
43
|
+
transition: opacity 0.4s;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
30
46
|
.mfui-banner__arrow {
|
|
31
47
|
position: absolute;
|
|
32
48
|
top: 50%;
|