@megafon/ui-core 3.3.1 → 3.4.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 +20 -0
- package/dist/es/components/Badges/components/PriceBadge/PriceBadge.css +13 -5
- package/dist/es/components/Badges/components/PriceBadge/PriceBadge.js +4 -2
- package/dist/es/components/Badges/components/PromoBadge/PromoBadge.css +3 -0
- package/dist/es/components/Badges/components/PromoBadge/PromoBadge.d.ts +1 -0
- package/dist/es/components/Badges/components/PromoBadge/PromoBadge.js +1 -0
- package/dist/es/components/Badges/components/TimerBadge/Timer/Timer.d.ts +13 -0
- package/dist/es/components/Badges/components/TimerBadge/Timer/Timer.js +96 -0
- package/dist/es/components/Badges/components/TimerBadge/TimerBadge.css +60 -0
- package/dist/es/components/Badges/components/TimerBadge/TimerBadge.d.ts +24 -0
- package/dist/es/components/Badges/components/TimerBadge/TimerBadge.js +110 -0
- package/dist/es/components/Button/Button.d.ts +1 -1
- package/dist/es/components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/es/components/Counter/Counter.d.ts +1 -1
- package/dist/es/components/Notification/Notification.css +15 -21
- package/dist/es/components/RadioButton/RadioButton.d.ts +1 -1
- package/dist/es/components/Search/Search.d.ts +3 -1
- package/dist/es/components/Search/Search.js +7 -4
- package/dist/es/components/Select/Select.d.ts +1 -1
- package/dist/es/components/Switcher/Switcher.d.ts +1 -1
- package/dist/es/components/TextField/TextField.d.ts +1 -1
- package/dist/es/index.d.ts +2 -0
- package/dist/es/index.js +2 -0
- package/dist/lib/components/Badges/components/PriceBadge/PriceBadge.css +13 -5
- package/dist/lib/components/Badges/components/PriceBadge/PriceBadge.js +4 -2
- package/dist/lib/components/Badges/components/PromoBadge/PromoBadge.css +3 -0
- package/dist/lib/components/Badges/components/PromoBadge/PromoBadge.d.ts +1 -0
- package/dist/lib/components/Badges/components/PromoBadge/PromoBadge.js +1 -0
- package/dist/lib/components/Badges/components/TimerBadge/Timer/Timer.d.ts +13 -0
- package/dist/lib/components/Badges/components/TimerBadge/Timer/Timer.js +123 -0
- package/dist/lib/components/Badges/components/TimerBadge/TimerBadge.css +60 -0
- package/dist/lib/components/Badges/components/TimerBadge/TimerBadge.d.ts +24 -0
- package/dist/lib/components/Badges/components/TimerBadge/TimerBadge.js +133 -0
- package/dist/lib/components/Button/Button.d.ts +1 -1
- package/dist/lib/components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/lib/components/Counter/Counter.d.ts +1 -1
- package/dist/lib/components/Notification/Notification.css +15 -21
- package/dist/lib/components/RadioButton/RadioButton.d.ts +1 -1
- package/dist/lib/components/Search/Search.d.ts +3 -1
- package/dist/lib/components/Search/Search.js +7 -4
- package/dist/lib/components/Select/Select.d.ts +1 -1
- package/dist/lib/components/Switcher/Switcher.d.ts +1 -1
- package/dist/lib/components/TextField/TextField.d.ts +1 -1
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/index.js +16 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,26 @@
|
|
|
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
|
+
# [3.4.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.3.1...@megafon/ui-core@3.4.0) (2022-03-21)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **notification:** fix link styles ([9d7e67e](https://github.com/MegafonWebLab/megafon-ui/commit/9d7e67e1f21c9ddb1dc911502a114924c8896a6a))
|
|
12
|
+
* **pricebadge:** fix icon styles ([f5502a0](https://github.com/MegafonWebLab/megafon-ui/commit/f5502a0e28d067694cee4165fe224a38ecf3a15f))
|
|
13
|
+
* **storebutton:** fixed test for Select and update type for StoreButton ([8996754](https://github.com/MegafonWebLab/megafon-ui/commit/8996754482e9cf899fdcb0f488c8a9fa1afddd11))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* **badges:** add new component TimerBadge ([82a900b](https://github.com/MegafonWebLab/megafon-ui/commit/82a900b362ca15db30dfdbffbfe299b637cae5b3))
|
|
19
|
+
* **promobadge:** add vip type (purple background color) ([51ea858](https://github.com/MegafonWebLab/megafon-ui/commit/51ea8582ff750199166c64681fecae636d30ca18))
|
|
20
|
+
* **search:** add onFocus callback ([b6dfdad](https://github.com/MegafonWebLab/megafon-ui/commit/b6dfdadd8dc695d7622bb95443ef6556b4e5d1c6))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
6
26
|
## [3.3.1](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.3.0...@megafon/ui-core@3.3.1) (2022-03-15)
|
|
7
27
|
|
|
8
28
|
|
|
@@ -7,20 +7,23 @@
|
|
|
7
7
|
-webkit-box-align: center;
|
|
8
8
|
-ms-flex-align: center;
|
|
9
9
|
align-items: center;
|
|
10
|
-
padding:
|
|
10
|
+
padding: 2px;
|
|
11
11
|
padding-right: 8px;
|
|
12
12
|
width: -webkit-fit-content;
|
|
13
13
|
width: -moz-fit-content;
|
|
14
14
|
width: fit-content;
|
|
15
|
-
height:
|
|
15
|
+
height: -webkit-fit-content;
|
|
16
|
+
height: -moz-fit-content;
|
|
17
|
+
height: fit-content;
|
|
16
18
|
border-radius: 8px;
|
|
17
19
|
}
|
|
18
20
|
@media screen and (min-width: 1024px) {
|
|
19
21
|
.mfui-price-badge_adaptive {
|
|
20
22
|
font-size: 15px;
|
|
21
23
|
line-height: 24px;
|
|
22
|
-
padding: 4px
|
|
23
|
-
|
|
24
|
+
padding: 4px;
|
|
25
|
+
padding-right: 8px;
|
|
26
|
+
min-height: 32px;
|
|
24
27
|
border-radius: 12px;
|
|
25
28
|
}
|
|
26
29
|
}
|
|
@@ -62,7 +65,12 @@
|
|
|
62
65
|
}
|
|
63
66
|
.mfui-price-badge__text {
|
|
64
67
|
font-family: inherit;
|
|
65
|
-
margin-left:
|
|
68
|
+
margin-left: 2px;
|
|
69
|
+
}
|
|
70
|
+
.mfui-price-badge__icon-container {
|
|
71
|
+
display: -webkit-box;
|
|
72
|
+
display: -ms-flexbox;
|
|
73
|
+
display: flex;
|
|
66
74
|
}
|
|
67
75
|
.mfui-price-badge__icon {
|
|
68
76
|
height: 20px;
|
|
@@ -93,9 +93,11 @@ var PriceBadge = function PriceBadge(_ref) {
|
|
|
93
93
|
theme: theme,
|
|
94
94
|
adaptive: isAdaptive
|
|
95
95
|
}, className)
|
|
96
|
-
}), /*#__PURE__*/React.createElement(
|
|
96
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
97
|
+
className: cn('icon-container')
|
|
98
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
97
99
|
className: cn('icon')
|
|
98
|
-
}), /*#__PURE__*/React.createElement("span", {
|
|
100
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
99
101
|
className: cn('text')
|
|
100
102
|
}, children));
|
|
101
103
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare const getCountdownText: (remainingTime?: number) => string;
|
|
3
|
+
interface ITimerProps {
|
|
4
|
+
actualRemainingTime: number;
|
|
5
|
+
expirationDate: Date;
|
|
6
|
+
showCountdown: boolean;
|
|
7
|
+
additionalText?: string;
|
|
8
|
+
dataAttrs?: {
|
|
9
|
+
root?: Record<string, string>;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
declare const Timer: React.FC<ITimerProps>;
|
|
13
|
+
export default Timer;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import "core-js/modules/es.array.concat";
|
|
2
|
+
import "core-js/modules/es.date.to-string";
|
|
3
|
+
import "core-js/modules/es.math.trunc";
|
|
4
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
|
|
7
|
+
import format from 'date-fns/format';
|
|
8
|
+
import ruLocale from 'date-fns/locale/ru';
|
|
9
|
+
import * as PropTypes from 'prop-types';
|
|
10
|
+
var SECONDS_IN_DAY = 86400;
|
|
11
|
+
var SECONDS_IN_HOUR = 3600;
|
|
12
|
+
var SECONDS_IN_MINUTE = 60;
|
|
13
|
+
|
|
14
|
+
var formatDate = function formatDate(date, pattern) {
|
|
15
|
+
return format(date, pattern, {
|
|
16
|
+
locale: ruLocale
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export var getCountdownText = function getCountdownText() {
|
|
21
|
+
var remainingTime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
22
|
+
var isMoreHourAndLessDay = remainingTime >= SECONDS_IN_HOUR && remainingTime < SECONDS_IN_DAY;
|
|
23
|
+
|
|
24
|
+
var truncTime = function truncTime() {
|
|
25
|
+
var divider = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
26
|
+
return Math.trunc(remainingTime / divider);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
switch (true) {
|
|
30
|
+
case remainingTime <= 0:
|
|
31
|
+
{
|
|
32
|
+
return '';
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
case remainingTime < SECONDS_IN_MINUTE:
|
|
36
|
+
{
|
|
37
|
+
var seconds = truncTime();
|
|
38
|
+
return "".concat(seconds, " \u0441\u0435\u043A");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
case remainingTime < SECONDS_IN_HOUR:
|
|
42
|
+
{
|
|
43
|
+
var minutes = truncTime(SECONDS_IN_MINUTE);
|
|
44
|
+
return "".concat(minutes, " \u043C\u0438\u043D");
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
case isMoreHourAndLessDay:
|
|
48
|
+
{
|
|
49
|
+
var hours = truncTime(SECONDS_IN_HOUR);
|
|
50
|
+
var secondsLeft = remainingTime - hours * SECONDS_IN_HOUR;
|
|
51
|
+
|
|
52
|
+
var _minutes = Math.trunc(secondsLeft / SECONDS_IN_MINUTE);
|
|
53
|
+
|
|
54
|
+
return _minutes ? "".concat(hours, " \u0447 ").concat(_minutes, " \u043C\u0438\u043D") : "".concat(hours, " \u0447");
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
case remainingTime >= SECONDS_IN_DAY:
|
|
58
|
+
{
|
|
59
|
+
var days = truncTime(SECONDS_IN_DAY);
|
|
60
|
+
|
|
61
|
+
var _secondsLeft = remainingTime - days * SECONDS_IN_DAY;
|
|
62
|
+
|
|
63
|
+
var _hours = Math.trunc(_secondsLeft / SECONDS_IN_HOUR);
|
|
64
|
+
|
|
65
|
+
return _hours ? "".concat(days, " \u0434\u043D ").concat(_hours, " \u0447") : "".concat(days, " \u0434\u043D");
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
default:
|
|
69
|
+
{
|
|
70
|
+
return '';
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
var cn = cnCreate('mfui-timer');
|
|
75
|
+
|
|
76
|
+
var Timer = function Timer(_ref) {
|
|
77
|
+
var actualRemainingTime = _ref.actualRemainingTime,
|
|
78
|
+
expirationDate = _ref.expirationDate,
|
|
79
|
+
showCountdown = _ref.showCountdown,
|
|
80
|
+
additionalText = _ref.additionalText,
|
|
81
|
+
dataAttrs = _ref.dataAttrs;
|
|
82
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
83
|
+
className: cn()
|
|
84
|
+
}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root)), additionalText && /*#__PURE__*/React.createElement("span", null, additionalText, " "), /*#__PURE__*/React.createElement("span", null, showCountdown ? getCountdownText(actualRemainingTime) : formatDate(expirationDate, 'dd MMMM yyyy')));
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
Timer.propTypes = {
|
|
88
|
+
expirationDate: PropTypes.instanceOf(Date).isRequired,
|
|
89
|
+
actualRemainingTime: PropTypes.number.isRequired,
|
|
90
|
+
showCountdown: PropTypes.bool.isRequired,
|
|
91
|
+
additionalText: PropTypes.string,
|
|
92
|
+
dataAttrs: PropTypes.shape({
|
|
93
|
+
root: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
94
|
+
})
|
|
95
|
+
};
|
|
96
|
+
export default Timer;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
.mfui-timer-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: 1px 2px;
|
|
9
|
+
padding-right: 8px;
|
|
10
|
+
width: -webkit-fit-content;
|
|
11
|
+
width: -moz-fit-content;
|
|
12
|
+
width: fit-content;
|
|
13
|
+
height: -webkit-fit-content;
|
|
14
|
+
height: -moz-fit-content;
|
|
15
|
+
height: fit-content;
|
|
16
|
+
border: 1px solid var(--spbSky1);
|
|
17
|
+
border-radius: 12px;
|
|
18
|
+
background: var(--base);
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
}
|
|
21
|
+
.mfui-timer-badge_theme_grey .mfui-timer-badge__text {
|
|
22
|
+
color: var(--spbSky3);
|
|
23
|
+
}
|
|
24
|
+
.mfui-timer-badge_theme_grey .mfui-timer-badge__icon {
|
|
25
|
+
fill: var(--spbSky3);
|
|
26
|
+
}
|
|
27
|
+
.mfui-timer-badge_theme_red .mfui-timer-badge__text {
|
|
28
|
+
color: var(--fury);
|
|
29
|
+
}
|
|
30
|
+
.mfui-timer-badge_theme_red .mfui-timer-badge__icon {
|
|
31
|
+
fill: var(--fury);
|
|
32
|
+
}
|
|
33
|
+
.mfui-timer-badge__text {
|
|
34
|
+
font-size: 12px;
|
|
35
|
+
line-height: 16px;
|
|
36
|
+
font-family: inherit;
|
|
37
|
+
margin-left: 2px;
|
|
38
|
+
font-weight: 500;
|
|
39
|
+
}
|
|
40
|
+
.mfui-timer-badge__icon {
|
|
41
|
+
height: 20px;
|
|
42
|
+
width: 20px;
|
|
43
|
+
}
|
|
44
|
+
.mfui-timer-badge__icon-container {
|
|
45
|
+
position: relative;
|
|
46
|
+
display: -webkit-box;
|
|
47
|
+
display: -ms-flexbox;
|
|
48
|
+
display: flex;
|
|
49
|
+
}
|
|
50
|
+
.mfui-timer-badge__icon-container_shadow:before {
|
|
51
|
+
content: '';
|
|
52
|
+
position: absolute;
|
|
53
|
+
top: 2px;
|
|
54
|
+
left: 2px;
|
|
55
|
+
height: 16px;
|
|
56
|
+
width: 16px;
|
|
57
|
+
border-radius: 50%;
|
|
58
|
+
-webkit-box-shadow: 0px 0px 6px var(--fury);
|
|
59
|
+
box-shadow: 0px 0px 6px var(--fury);
|
|
60
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './TimerBadge.less';
|
|
3
|
+
export interface ITimerBadgeProps {
|
|
4
|
+
/** Дата окончания таймера */
|
|
5
|
+
expirationDate: Date;
|
|
6
|
+
/** Граница переключения в режим обратного отсчёта, в секундах */
|
|
7
|
+
countdownStart?: number;
|
|
8
|
+
/** Отображение дополнительного текста */
|
|
9
|
+
hasPrefix?: boolean;
|
|
10
|
+
/** Текст перед таймером в режиме обратного отсчета. Появляется при hasPrefix=true. */
|
|
11
|
+
countdownText?: string;
|
|
12
|
+
/** Текст перед таймером в режиме даты. Появляется при hasPrefix=true. */
|
|
13
|
+
expirationDateText?: string;
|
|
14
|
+
/** Дополнительный класс корневого элемента */
|
|
15
|
+
className?: string;
|
|
16
|
+
/** Дополнительные data-атрибуты к внутренним элементам */
|
|
17
|
+
dataAttrs?: {
|
|
18
|
+
root?: Record<string, string>;
|
|
19
|
+
text?: Record<string, string>;
|
|
20
|
+
timer?: Record<string, string>;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
declare const TimerBadge: React.FC<ITimerBadgeProps>;
|
|
24
|
+
export default TimerBadge;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import "core-js/modules/es.date.now";
|
|
2
|
+
import "core-js/modules/es.date.to-string";
|
|
3
|
+
import "core-js/modules/web.timers";
|
|
4
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
5
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
6
|
+
import React, { useEffect, useState } from 'react';
|
|
7
|
+
import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
|
|
8
|
+
import * as PropTypes from 'prop-types';
|
|
9
|
+
import Timer from "./Timer/Timer";
|
|
10
|
+
import "./TimerBadge.css";
|
|
11
|
+
|
|
12
|
+
var TimerIcon = function TimerIcon(props) {
|
|
13
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
14
|
+
viewBox: "0 0 20 20"
|
|
15
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
16
|
+
fillRule: "evenodd",
|
|
17
|
+
clipRule: "evenodd",
|
|
18
|
+
d: "M10 18a8 8 0 100-16 8 8 0 000 16zm1-8.414V5H9v5.414l3 3L13.414 12 11 9.586z"
|
|
19
|
+
}));
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
var SECONDS_IN_HOUR = 3600;
|
|
23
|
+
var MS_IN_SECOND = 1000;
|
|
24
|
+
var TIMEOUT = 1000;
|
|
25
|
+
var TimerBadgeTheme = {
|
|
26
|
+
RED: 'red',
|
|
27
|
+
GREY: 'grey'
|
|
28
|
+
};
|
|
29
|
+
var cn = cnCreate('mfui-timer-badge');
|
|
30
|
+
|
|
31
|
+
var TimerBadge = function TimerBadge(_ref) {
|
|
32
|
+
var expirationDate = _ref.expirationDate,
|
|
33
|
+
_ref$countdownStart = _ref.countdownStart,
|
|
34
|
+
countdownStart = _ref$countdownStart === void 0 ? 86400 : _ref$countdownStart,
|
|
35
|
+
_ref$hasPrefix = _ref.hasPrefix,
|
|
36
|
+
hasPrefix = _ref$hasPrefix === void 0 ? false : _ref$hasPrefix,
|
|
37
|
+
_ref$countdownText = _ref.countdownText,
|
|
38
|
+
countdownText = _ref$countdownText === void 0 ? 'Закончится через' : _ref$countdownText,
|
|
39
|
+
_ref$expirationDateTe = _ref.expirationDateText,
|
|
40
|
+
expirationDateText = _ref$expirationDateTe === void 0 ? 'Воспользуйтесь до' : _ref$expirationDateTe,
|
|
41
|
+
className = _ref.className,
|
|
42
|
+
dataAttrs = _ref.dataAttrs;
|
|
43
|
+
var remainingTime = (expirationDate.getTime() - Date.now()) / MS_IN_SECOND;
|
|
44
|
+
|
|
45
|
+
var _useState = useState(remainingTime),
|
|
46
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
47
|
+
actualRemainingTime = _useState2[0],
|
|
48
|
+
setActualRemainingTime = _useState2[1];
|
|
49
|
+
|
|
50
|
+
var _useState3 = useState(false),
|
|
51
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
52
|
+
showCountdown = _useState4[0],
|
|
53
|
+
setShowCountdown = _useState4[1];
|
|
54
|
+
|
|
55
|
+
var isLastHour = actualRemainingTime < SECONDS_IN_HOUR;
|
|
56
|
+
var isTimeExpired = actualRemainingTime < 1;
|
|
57
|
+
var theme = showCountdown ? TimerBadgeTheme.RED : TimerBadgeTheme.GREY;
|
|
58
|
+
var additionalText = showCountdown ? countdownText : expirationDateText;
|
|
59
|
+
useEffect(function () {
|
|
60
|
+
setShowCountdown(actualRemainingTime < countdownStart);
|
|
61
|
+
}, [actualRemainingTime, countdownStart]);
|
|
62
|
+
useEffect(function () {
|
|
63
|
+
if (isTimeExpired) {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
var timeoutId = window.setTimeout(function () {
|
|
68
|
+
return setActualRemainingTime(actualRemainingTime - 1);
|
|
69
|
+
}, TIMEOUT);
|
|
70
|
+
return function () {
|
|
71
|
+
return clearTimeout(timeoutId);
|
|
72
|
+
};
|
|
73
|
+
}, [isTimeExpired, showCountdown, actualRemainingTime]);
|
|
74
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
75
|
+
className: cn({
|
|
76
|
+
theme: theme
|
|
77
|
+
}, className)
|
|
78
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
79
|
+
className: cn('icon-container', {
|
|
80
|
+
shadow: isLastHour && showCountdown
|
|
81
|
+
})
|
|
82
|
+
}, /*#__PURE__*/React.createElement(TimerIcon, {
|
|
83
|
+
className: cn('icon')
|
|
84
|
+
})), /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.text), {
|
|
85
|
+
className: cn('text')
|
|
86
|
+
}), isTimeExpired ? 'Время действия истекло' : /*#__PURE__*/React.createElement(Timer, {
|
|
87
|
+
additionalText: hasPrefix ? additionalText : undefined,
|
|
88
|
+
showCountdown: showCountdown,
|
|
89
|
+
expirationDate: expirationDate,
|
|
90
|
+
actualRemainingTime: actualRemainingTime,
|
|
91
|
+
dataAttrs: {
|
|
92
|
+
root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.timer
|
|
93
|
+
}
|
|
94
|
+
})));
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
TimerBadge.propTypes = {
|
|
98
|
+
expirationDate: PropTypes.instanceOf(Date).isRequired,
|
|
99
|
+
countdownStart: PropTypes.number,
|
|
100
|
+
hasPrefix: PropTypes.bool,
|
|
101
|
+
countdownText: PropTypes.string,
|
|
102
|
+
expirationDateText: PropTypes.string,
|
|
103
|
+
className: PropTypes.string,
|
|
104
|
+
dataAttrs: PropTypes.shape({
|
|
105
|
+
root: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
106
|
+
text: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
107
|
+
timer: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
108
|
+
})
|
|
109
|
+
};
|
|
110
|
+
export default TimerBadge;
|
|
@@ -69,7 +69,7 @@ export interface IButtonProps {
|
|
|
69
69
|
showArrow?: boolean;
|
|
70
70
|
/** Иконка */
|
|
71
71
|
icon?: JSX.Element;
|
|
72
|
-
/**
|
|
72
|
+
/** Отключение кнопки */
|
|
73
73
|
disabled?: boolean;
|
|
74
74
|
/** Ссылка на элемент */
|
|
75
75
|
buttonRef?: Ref<HTMLButtonElement | HTMLAnchorElement>;
|
|
@@ -25,7 +25,7 @@ export interface ICheckboxProps {
|
|
|
25
25
|
value?: string;
|
|
26
26
|
/** Управление состоянием вкл/выкл компонента */
|
|
27
27
|
checked?: boolean;
|
|
28
|
-
/**
|
|
28
|
+
/** Отключение чекбокса */
|
|
29
29
|
disabled?: boolean;
|
|
30
30
|
/** Отобразить компонент в состоянии ошибки */
|
|
31
31
|
error?: boolean;
|
|
@@ -18,7 +18,7 @@ export interface ICounterProps {
|
|
|
18
18
|
min?: number;
|
|
19
19
|
/** Максимальное доступное значение */
|
|
20
20
|
max?: number;
|
|
21
|
-
/**
|
|
21
|
+
/** Отключение счетчика */
|
|
22
22
|
disabled?: boolean;
|
|
23
23
|
/** Обработчик изменения значения 'value' */
|
|
24
24
|
onChange?: (value: number) => void;
|
|
@@ -189,19 +189,27 @@ h5 {
|
|
|
189
189
|
.mfui-notification_colored .mfui-notification__icon-container {
|
|
190
190
|
background-color: var(--stcWhite);
|
|
191
191
|
}
|
|
192
|
+
.mfui-notification_colored.mfui-notification_type_info {
|
|
193
|
+
background-color: var(--311C20);
|
|
194
|
+
}
|
|
195
|
+
.mfui-notification_colored.mfui-notification_type_warning {
|
|
196
|
+
background-color: var(--137C20);
|
|
197
|
+
}
|
|
192
198
|
.mfui-notification_colored.mfui-notification_type_success {
|
|
193
199
|
background-color: var(--brandGreen20);
|
|
194
200
|
}
|
|
201
|
+
.mfui-notification_colored.mfui-notification_type_info .mfui-notification__title,
|
|
202
|
+
.mfui-notification_colored.mfui-notification_type_warning .mfui-notification__title,
|
|
195
203
|
.mfui-notification_colored.mfui-notification_type_success .mfui-notification__title,
|
|
196
|
-
.mfui-notification_colored.mfui-
|
|
197
|
-
.mfui-notification_colored.mfui-
|
|
204
|
+
.mfui-notification_colored.mfui-notification_type_info .mfui-notification__text,
|
|
205
|
+
.mfui-notification_colored.mfui-notification_type_warning .mfui-notification__text,
|
|
206
|
+
.mfui-notification_colored.mfui-notification_type_success .mfui-notification__text {
|
|
198
207
|
color: var(--stcBlack);
|
|
199
208
|
}
|
|
200
|
-
.mfui-notification_colored.mfui-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
background-color: var(--stcWhite);
|
|
209
|
+
.mfui-notification_colored.mfui-notification_type_info .mfui-notification__link,
|
|
210
|
+
.mfui-notification_colored.mfui-notification_type_warning .mfui-notification__link,
|
|
211
|
+
.mfui-notification_colored.mfui-notification_type_success .mfui-notification__link {
|
|
212
|
+
color: var(--systemBlue);
|
|
205
213
|
}
|
|
206
214
|
.mfui-notification_colored.mfui-notification_type_error {
|
|
207
215
|
background-color: var(--fury80);
|
|
@@ -221,17 +229,3 @@ h5 {
|
|
|
221
229
|
/* stylelint-disable-line max-nesting-depth */
|
|
222
230
|
fill: var(--stcWhite);
|
|
223
231
|
}
|
|
224
|
-
.mfui-notification_colored.mfui-notification_type_info .mfui-notification__title,
|
|
225
|
-
.mfui-notification_colored.mfui-notification_type_warning .mfui-notification__title,
|
|
226
|
-
.mfui-notification_colored.mfui-notification_type_info .mfui-notification__text,
|
|
227
|
-
.mfui-notification_colored.mfui-notification_type_warning .mfui-notification__text,
|
|
228
|
-
.mfui-notification_colored.mfui-notification_type_info .mfui-notification__link,
|
|
229
|
-
.mfui-notification_colored.mfui-notification_type_warning .mfui-notification__link {
|
|
230
|
-
color: var(--stcBlack);
|
|
231
|
-
}
|
|
232
|
-
.mfui-notification_colored.mfui-notification_type_info {
|
|
233
|
-
background-color: var(--311C20);
|
|
234
|
-
}
|
|
235
|
-
.mfui-notification_colored.mfui-notification_type_warning {
|
|
236
|
-
background-color: var(--137C20);
|
|
237
|
-
}
|
|
@@ -7,7 +7,7 @@ export interface IRadioButtonProps {
|
|
|
7
7
|
name?: string;
|
|
8
8
|
/** Размер текста лейбла */
|
|
9
9
|
textSize?: 'small' | 'medium';
|
|
10
|
-
/**
|
|
10
|
+
/** Отключение радио-кнопки */
|
|
11
11
|
disabled?: boolean;
|
|
12
12
|
/** Управление состоянием вкл/выкл компонента */
|
|
13
13
|
isChecked?: boolean;
|
|
@@ -36,7 +36,7 @@ export interface ISearchProps {
|
|
|
36
36
|
verification?: VerificationType;
|
|
37
37
|
/** Дополнительный текст под полем. Свойство verification влияет на цвет текста. */
|
|
38
38
|
noticeText?: string;
|
|
39
|
-
/**
|
|
39
|
+
/** Отключение поля ввода */
|
|
40
40
|
disabled?: boolean;
|
|
41
41
|
/** Делает поле обязательным */
|
|
42
42
|
required?: boolean;
|
|
@@ -54,6 +54,8 @@ export interface ISearchProps {
|
|
|
54
54
|
onSubmit?: (value: string) => void;
|
|
55
55
|
/** Обработчик выхода из фокуса */
|
|
56
56
|
onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
57
|
+
/** Обработчик входа в фокус */
|
|
58
|
+
onFocus?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
57
59
|
}
|
|
58
60
|
declare const Search: React.FC<ISearchProps>;
|
|
59
61
|
export default Search;
|
|
@@ -46,7 +46,8 @@ var Search = function Search(_ref) {
|
|
|
46
46
|
classes = _ref.classes,
|
|
47
47
|
onChange = _ref.onChange,
|
|
48
48
|
onSubmit = _ref.onSubmit,
|
|
49
|
-
onBlur = _ref.onBlur
|
|
49
|
+
onBlur = _ref.onBlur,
|
|
50
|
+
onFocus = _ref.onFocus;
|
|
50
51
|
|
|
51
52
|
var _React$useState = React.useState(value),
|
|
52
53
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -101,9 +102,10 @@ var Search = function Search(_ref) {
|
|
|
101
102
|
handleItemSubmit(activeIndex);
|
|
102
103
|
};
|
|
103
104
|
}, [handleItemSubmit, activeIndex]);
|
|
104
|
-
var handleFocus = React.useCallback(function () {
|
|
105
|
+
var handleFocus = React.useCallback(function (e) {
|
|
105
106
|
setFocus(true);
|
|
106
|
-
|
|
107
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
|
|
108
|
+
}, [onFocus]);
|
|
107
109
|
var handleBlur = React.useCallback(function (e) {
|
|
108
110
|
setFocus(false);
|
|
109
111
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
@@ -242,6 +244,7 @@ Search.propTypes = {
|
|
|
242
244
|
}),
|
|
243
245
|
onChange: PropTypes.func,
|
|
244
246
|
onSubmit: PropTypes.func,
|
|
245
|
-
onBlur: PropTypes.func
|
|
247
|
+
onBlur: PropTypes.func,
|
|
248
|
+
onFocus: PropTypes.func
|
|
246
249
|
};
|
|
247
250
|
export default Search;
|
|
@@ -40,7 +40,7 @@ export interface ISelectProps<T extends SelectItemValueType> {
|
|
|
40
40
|
verification?: VerificationType;
|
|
41
41
|
/** Дополнительный текст под полем. Свойство verification влияет на цвет текста. */
|
|
42
42
|
noticeText?: string;
|
|
43
|
-
/**
|
|
43
|
+
/** Отключение селекта */
|
|
44
44
|
disabled?: boolean;
|
|
45
45
|
/** Делает поле обязательным */
|
|
46
46
|
required?: boolean;
|
|
@@ -9,7 +9,7 @@ export interface ISwitcherProps {
|
|
|
9
9
|
className?: string;
|
|
10
10
|
/** Управление состоянием вкл/выкл компонента */
|
|
11
11
|
checked?: boolean;
|
|
12
|
-
/**
|
|
12
|
+
/** Отключение переключателя */
|
|
13
13
|
disabled?: boolean;
|
|
14
14
|
/** Обработчик изменения элемента */
|
|
15
15
|
onChange?: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
@@ -31,7 +31,7 @@ export declare type TextFieldProps = {
|
|
|
31
31
|
verification?: 'valid' | 'error';
|
|
32
32
|
/** Подпись снизу, меняет цвет в зависимости от аргумента verification */
|
|
33
33
|
noticeText?: string;
|
|
34
|
-
/**
|
|
34
|
+
/** Отключение поля ввода */
|
|
35
35
|
disabled?: boolean;
|
|
36
36
|
/** Показывает обязательность поля */
|
|
37
37
|
required?: boolean;
|
package/dist/es/index.d.ts
CHANGED
|
@@ -40,5 +40,7 @@ export { default as Tabs } from './components/Tabs/Tabs';
|
|
|
40
40
|
export { default as TextField } from './components/TextField/TextField';
|
|
41
41
|
export { default as TextLink } from './components/TextLink/TextLink';
|
|
42
42
|
export { default as Tile } from './components/Tile/Tile';
|
|
43
|
+
export { default as Timer } from './components/Badges/components/TimerBadge/Timer/Timer';
|
|
44
|
+
export { default as TimerBadge } from './components/Badges/components/TimerBadge/TimerBadge';
|
|
43
45
|
export { default as Tooltip } from './components/Tooltip/Tooltip';
|
|
44
46
|
export { default as usePagination } from './components/Pagination/usePagination';
|
package/dist/es/index.js
CHANGED
|
@@ -40,5 +40,7 @@ export { default as Tabs } from "./components/Tabs/Tabs";
|
|
|
40
40
|
export { default as TextField } from "./components/TextField/TextField";
|
|
41
41
|
export { default as TextLink } from "./components/TextLink/TextLink";
|
|
42
42
|
export { default as Tile } from "./components/Tile/Tile";
|
|
43
|
+
export { default as Timer } from "./components/Badges/components/TimerBadge/Timer/Timer";
|
|
44
|
+
export { default as TimerBadge } from "./components/Badges/components/TimerBadge/TimerBadge";
|
|
43
45
|
export { default as Tooltip } from "./components/Tooltip/Tooltip";
|
|
44
46
|
export { default as usePagination } from "./components/Pagination/usePagination";
|
|
@@ -7,20 +7,23 @@
|
|
|
7
7
|
-webkit-box-align: center;
|
|
8
8
|
-ms-flex-align: center;
|
|
9
9
|
align-items: center;
|
|
10
|
-
padding:
|
|
10
|
+
padding: 2px;
|
|
11
11
|
padding-right: 8px;
|
|
12
12
|
width: -webkit-fit-content;
|
|
13
13
|
width: -moz-fit-content;
|
|
14
14
|
width: fit-content;
|
|
15
|
-
height:
|
|
15
|
+
height: -webkit-fit-content;
|
|
16
|
+
height: -moz-fit-content;
|
|
17
|
+
height: fit-content;
|
|
16
18
|
border-radius: 8px;
|
|
17
19
|
}
|
|
18
20
|
@media screen and (min-width: 1024px) {
|
|
19
21
|
.mfui-price-badge_adaptive {
|
|
20
22
|
font-size: 15px;
|
|
21
23
|
line-height: 24px;
|
|
22
|
-
padding: 4px
|
|
23
|
-
|
|
24
|
+
padding: 4px;
|
|
25
|
+
padding-right: 8px;
|
|
26
|
+
min-height: 32px;
|
|
24
27
|
border-radius: 12px;
|
|
25
28
|
}
|
|
26
29
|
}
|
|
@@ -62,7 +65,12 @@
|
|
|
62
65
|
}
|
|
63
66
|
.mfui-price-badge__text {
|
|
64
67
|
font-family: inherit;
|
|
65
|
-
margin-left:
|
|
68
|
+
margin-left: 2px;
|
|
69
|
+
}
|
|
70
|
+
.mfui-price-badge__icon-container {
|
|
71
|
+
display: -webkit-box;
|
|
72
|
+
display: -ms-flexbox;
|
|
73
|
+
display: flex;
|
|
66
74
|
}
|
|
67
75
|
.mfui-price-badge__icon {
|
|
68
76
|
height: 20px;
|