@megafon/ui-core 3.10.0 → 4.0.0-beta.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 +22 -34
- package/dist/es/colors/Colors.css +4 -0
- package/dist/es/components/Accordion/Accordion.css +55 -23
- package/dist/es/components/Accordion/Accordion.js +12 -17
- package/dist/es/components/Badges/components/PriceBadge/PriceBadge.css +1 -1
- package/dist/es/components/Badges/components/PromoBadge/PromoBadge.css +1 -1
- package/dist/es/components/Badges/components/TimerBadge/TimerBadge.css +1 -1
- package/dist/es/components/Banner/Banner.d.ts +0 -2
- package/dist/es/components/Banner/Banner.js +17 -49
- package/dist/es/components/Button/Button.css +0 -40
- package/dist/es/components/Button/Button.d.ts +0 -1
- package/dist/es/components/Button/Button.js +1 -2
- package/dist/es/components/Calendar/Calendar.js +2 -18
- package/dist/es/components/Calendar/components/Day/Day.css +1 -1
- package/dist/es/components/Calendar/components/Month/Month.css +1 -1
- package/dist/es/components/Calendar/components/Month/Month.js +4 -4
- package/dist/es/components/Caption/Caption.css +48 -0
- package/dist/es/components/Caption/Caption.d.ts +31 -0
- package/dist/es/components/Caption/Caption.js +51 -0
- package/dist/es/components/Logo/Logo.js +6 -22
- package/dist/es/components/Notification/Notification.d.ts +0 -6
- package/dist/es/components/Notification/Notification.js +3 -13
- package/dist/es/components/Paragraph/Paragraph.css +8 -5
- package/dist/es/components/Paragraph/Paragraph.d.ts +4 -3
- package/dist/es/components/Paragraph/Paragraph.js +6 -5
- package/dist/es/components/RadioButton/RadioButton.css +1 -1
- package/dist/es/components/Select/Select.js +1 -1
- package/dist/es/components/Switcher/Switcher.css +1 -4
- package/dist/es/components/Switcher/Switcher.d.ts +0 -1
- package/dist/es/components/Switcher/Switcher.js +3 -4
- package/dist/es/components/TextField/TextField.css +128 -87
- package/dist/es/components/TextField/TextField.js +54 -37
- package/dist/es/components/Tooltip/Tooltip.d.ts +0 -4
- package/dist/es/components/Tooltip/Tooltip.js +1 -32
- package/dist/es/index.d.ts +1 -0
- package/dist/es/index.js +1 -0
- package/dist/lib/colors/Colors.css +4 -0
- package/dist/lib/components/Accordion/Accordion.css +55 -23
- package/dist/lib/components/Accordion/Accordion.js +12 -17
- package/dist/lib/components/Badges/components/PriceBadge/PriceBadge.css +1 -1
- package/dist/lib/components/Badges/components/PromoBadge/PromoBadge.css +1 -1
- package/dist/lib/components/Badges/components/TimerBadge/TimerBadge.css +1 -1
- package/dist/lib/components/Banner/Banner.d.ts +0 -2
- package/dist/lib/components/Banner/Banner.js +17 -49
- package/dist/lib/components/Button/Button.css +0 -40
- package/dist/lib/components/Button/Button.d.ts +0 -1
- package/dist/lib/components/Button/Button.js +1 -2
- package/dist/lib/components/Calendar/Calendar.js +1 -17
- package/dist/lib/components/Calendar/components/Day/Day.css +1 -1
- package/dist/lib/components/Calendar/components/Month/Month.css +1 -1
- package/dist/lib/components/Calendar/components/Month/Month.js +4 -4
- package/dist/lib/components/Caption/Caption.css +48 -0
- package/dist/lib/components/Caption/Caption.d.ts +31 -0
- package/dist/lib/components/Caption/Caption.js +71 -0
- package/dist/lib/components/Logo/Logo.js +6 -22
- package/dist/lib/components/Notification/Notification.d.ts +0 -6
- package/dist/lib/components/Notification/Notification.js +3 -13
- package/dist/lib/components/Paragraph/Paragraph.css +8 -5
- package/dist/lib/components/Paragraph/Paragraph.d.ts +4 -3
- package/dist/lib/components/Paragraph/Paragraph.js +6 -5
- package/dist/lib/components/RadioButton/RadioButton.css +1 -1
- package/dist/lib/components/Select/Select.js +1 -1
- package/dist/lib/components/Switcher/Switcher.css +1 -4
- package/dist/lib/components/Switcher/Switcher.d.ts +0 -1
- package/dist/lib/components/Switcher/Switcher.js +3 -4
- package/dist/lib/components/TextField/TextField.css +128 -87
- package/dist/lib/components/TextField/TextField.js +54 -39
- package/dist/lib/components/Tooltip/Tooltip.d.ts +0 -4
- package/dist/lib/components/Tooltip/Tooltip.js +1 -36
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +8 -0
- package/package.json +3 -3
- package/styles/base.less +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,83 +3,71 @@
|
|
|
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
|
-
# [
|
|
6
|
+
# [4.0.0-beta.2](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@4.0.0-beta.1...@megafon/ui-core@4.0.0-beta.2) (2022-06-01)
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
### Features
|
|
10
10
|
|
|
11
|
-
* **
|
|
11
|
+
* **textfield:** update by new design ([8d11972](https://github.com/MegafonWebLab/megafon-ui/commit/8d11972c73374df0d0a66d4607eb87bb4190e92e))
|
|
12
12
|
|
|
13
13
|
|
|
14
|
+
### BREAKING CHANGES
|
|
14
15
|
|
|
16
|
+
* **textfield:** add placeholders text by default
|
|
17
|
+
label element positon changed
|
|
18
|
+
if label prop not setted, label element has text from placeholder (default or in props)
|
|
15
19
|
|
|
16
20
|
|
|
17
|
-
# [3.9.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.8.0...@megafon/ui-core@3.9.0) (2022-05-27)
|
|
18
21
|
|
|
19
22
|
|
|
20
|
-
### Bug Fixes
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
# [4.0.0-beta.1](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@4.0.0-beta.0...@megafon/ui-core@4.0.0-beta.1) (2022-05-27)
|
|
23
25
|
|
|
24
26
|
|
|
25
27
|
### Features
|
|
26
28
|
|
|
27
|
-
* **
|
|
28
|
-
* **tooltip:** add portal selector props ([6188832](https://github.com/MegafonWebLab/megafon-ui/commit/6188832e9ba212e7a8182333aba06d77c3e979d6))
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
* **accordion:** update by new design ([331f8dc](https://github.com/MegafonWebLab/megafon-ui/commit/331f8dcb55d3577c086eb0e6beb00fd82f064943))
|
|
33
30
|
|
|
34
|
-
# [3.8.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.7.0...@megafon/ui-core@3.8.0) (2022-05-17)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
### Features
|
|
38
|
-
|
|
39
|
-
* **notification:** add props classes to notification component ([608a424](https://github.com/MegafonWebLab/megafon-ui/commit/608a4246eb99af354fb7cf8ab98c2ed513d87b66))
|
|
40
31
|
|
|
32
|
+
### BREAKING CHANGES
|
|
41
33
|
|
|
34
|
+
* **accordion:** change next-sibling accordion styles
|
|
42
35
|
|
|
43
36
|
|
|
44
37
|
|
|
45
|
-
# [3.7.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.6.0...@megafon/ui-core@3.7.0) (2022-05-05)
|
|
46
38
|
|
|
47
39
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
* **logo:** fix horizontal logo svg ([76655eb](https://github.com/MegafonWebLab/megafon-ui/commit/76655ebb82650cc2617750af0b2b2726d3ebcbf3))
|
|
40
|
+
# [4.0.0-beta.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.5.3-beta.1...@megafon/ui-core@4.0.0-beta.0) (2022-05-24)
|
|
51
41
|
|
|
52
42
|
|
|
53
43
|
### Features
|
|
54
44
|
|
|
55
|
-
* **
|
|
56
|
-
|
|
57
|
-
|
|
45
|
+
* **caption:** add new Caption component; update .smallFont() less mixin ([603bed3](https://github.com/MegafonWebLab/megafon-ui/commit/603bed3ce782676b22381e3d4df5dae141fb015c))
|
|
46
|
+
* **paragraph:** remove prop size; add new prop; add 'pale' option to colors ([ef15841](https://github.com/MegafonWebLab/megafon-ui/commit/ef15841474473739d3ac88da7a8737e183ff288a))
|
|
58
47
|
|
|
59
48
|
|
|
49
|
+
### BREAKING CHANGES
|
|
60
50
|
|
|
61
|
-
|
|
51
|
+
* **caption:** .smallFont() less mixin line-height rule now set to 18px instead of 16px
|
|
52
|
+
either accept new rules or manually add line-height: 16px in your components
|
|
53
|
+
* **paragraph:** prop 'size' is no longer exists.
|
|
54
|
+
use component Caption instead of Paragraph size="small"
|
|
62
55
|
|
|
63
56
|
|
|
64
|
-
### Bug Fixes
|
|
65
57
|
|
|
66
|
-
* **calendar:** fix go to start day after user choice ([8bbce10](https://github.com/MegafonWebLab/megafon-ui/commit/8bbce102d204f7ea7706158f3e6540c86ed3aada))
|
|
67
58
|
|
|
68
59
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
* **tooltip:** added prop isPortal for tooltip ([e6f6d17](https://github.com/MegafonWebLab/megafon-ui/commit/e6f6d1749cd99f065c50bac4eb6a9b3592653f8d))
|
|
60
|
+
## [3.5.3-beta.1](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.5.3-beta.0...@megafon/ui-core@3.5.3-beta.1) (2022-05-06)
|
|
72
61
|
|
|
62
|
+
**Note:** Version bump only for package @megafon/ui-core
|
|
73
63
|
|
|
74
64
|
|
|
75
65
|
|
|
76
66
|
|
|
77
|
-
## [3.5.3](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.5.2...@megafon/ui-core@3.5.3) (2022-04-18)
|
|
78
67
|
|
|
68
|
+
## [3.5.3-beta.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.5.2...@megafon/ui-core@3.5.3-beta.0) (2022-04-13)
|
|
79
69
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
* **switcher:** fix safari bugs ([65274bc](https://github.com/MegafonWebLab/megafon-ui/commit/65274bc3c5e7385109afff94a8ff3f712c9af097))
|
|
70
|
+
**Note:** Version bump only for package @megafon/ui-core
|
|
83
71
|
|
|
84
72
|
|
|
85
73
|
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
margin: 0 -80px;
|
|
3
3
|
padding: 56px 80px 40px;
|
|
4
4
|
background-color: var(--spbSky0);
|
|
5
|
+
-webkit-transition: background-color 0.3s;
|
|
6
|
+
transition: background-color 0.3s;
|
|
5
7
|
}
|
|
6
8
|
@media screen and (max-width: 1120px) {
|
|
7
9
|
.colors__inner {
|
|
@@ -90,6 +92,8 @@
|
|
|
90
92
|
font-size: 12px;
|
|
91
93
|
line-height: 18px;
|
|
92
94
|
text-align: center;
|
|
95
|
+
-webkit-transition: color 0.3s;
|
|
96
|
+
transition: color 0.3s;
|
|
93
97
|
}
|
|
94
98
|
@media screen and (max-width: 1023px) {
|
|
95
99
|
.colors__description {
|
|
@@ -1,51 +1,83 @@
|
|
|
1
1
|
.mfui-accordion {
|
|
2
|
-
border-
|
|
3
|
-
|
|
2
|
+
border-radius: 12px;
|
|
3
|
+
background: var(--spbSky0);
|
|
4
4
|
}
|
|
5
5
|
.mfui-accordion + .mfui-accordion {
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
.mfui-accordion:not(.mfui-accordion_open) .mfui-accordion__title-wrap:hover {
|
|
9
|
-
background: var(--spbSky0);
|
|
6
|
+
margin-top: 8px;
|
|
10
7
|
}
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
@media screen and (min-width: 768px) {
|
|
9
|
+
.mfui-accordion + .mfui-accordion {
|
|
10
|
+
margin-top: 12px;
|
|
11
|
+
}
|
|
13
12
|
}
|
|
14
13
|
.mfui-accordion__title-wrap {
|
|
15
14
|
position: relative;
|
|
16
|
-
padding:
|
|
15
|
+
padding: 20px 20px 20px 16px;
|
|
16
|
+
border-radius: 12px;
|
|
17
17
|
cursor: pointer;
|
|
18
|
+
-webkit-transition: background-color 0.3s;
|
|
19
|
+
transition: background-color 0.3s;
|
|
18
20
|
}
|
|
19
21
|
@media screen and (min-width: 768px) {
|
|
20
22
|
.mfui-accordion__title-wrap {
|
|
21
|
-
padding:
|
|
23
|
+
padding: 20px 24px;
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
padding: 24px 72px 24px 24px;
|
|
27
|
-
}
|
|
26
|
+
.mfui-accordion__title-wrap:hover {
|
|
27
|
+
background: var(--spbSky1);
|
|
28
28
|
}
|
|
29
29
|
.mfui-accordion__icon-box {
|
|
30
30
|
position: absolute;
|
|
31
31
|
top: 50%;
|
|
32
32
|
right: 20px;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
display: -webkit-box;
|
|
34
|
+
display: -ms-flexbox;
|
|
35
|
+
display: flex;
|
|
36
|
+
-webkit-box-align: center;
|
|
37
|
+
-ms-flex-align: center;
|
|
38
|
+
align-items: center;
|
|
39
|
+
-webkit-box-pack: center;
|
|
40
|
+
-ms-flex-pack: center;
|
|
41
|
+
justify-content: center;
|
|
42
|
+
width: 24px;
|
|
43
|
+
height: 24px;
|
|
44
|
+
border-radius: 50%;
|
|
45
|
+
background-color: var(--base);
|
|
46
|
+
-webkit-box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
|
|
47
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
|
|
36
48
|
-webkit-transform: translateY(-50%);
|
|
37
49
|
transform: translateY(-50%);
|
|
38
|
-
|
|
39
|
-
|
|
50
|
+
}
|
|
51
|
+
@media screen and (min-width: 768px) {
|
|
52
|
+
.mfui-accordion__icon-box {
|
|
53
|
+
right: 24px;
|
|
54
|
+
width: 32px;
|
|
55
|
+
height: 32px;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
.mfui-accordion__icon {
|
|
59
|
+
width: 20px;
|
|
60
|
+
height: 20px;
|
|
61
|
+
-webkit-transition: -webkit-transform 0.6s;
|
|
62
|
+
transition: -webkit-transform 0.6s;
|
|
63
|
+
transition: transform 0.6s;
|
|
64
|
+
transition: transform 0.6s, -webkit-transform 0.6s;
|
|
65
|
+
}
|
|
66
|
+
@media screen and (min-width: 768px) {
|
|
67
|
+
.mfui-accordion__icon {
|
|
68
|
+
width: 32px;
|
|
69
|
+
height: 32px;
|
|
70
|
+
}
|
|
40
71
|
}
|
|
41
72
|
.mfui-accordion__content-inner {
|
|
42
|
-
padding:
|
|
73
|
+
padding: 4px 20px 20px 16px;
|
|
43
74
|
}
|
|
44
75
|
@media screen and (min-width: 768px) {
|
|
45
76
|
.mfui-accordion__content-inner {
|
|
46
|
-
padding: 24px;
|
|
77
|
+
padding: 4px 24px 20px;
|
|
47
78
|
}
|
|
48
79
|
}
|
|
49
|
-
.mfui-accordion__icon {
|
|
50
|
-
|
|
80
|
+
.mfui-accordion_opened .mfui-accordion__icon {
|
|
81
|
+
-webkit-transform: rotate(180deg);
|
|
82
|
+
transform: rotate(180deg);
|
|
51
83
|
}
|
|
@@ -11,15 +11,9 @@ var ArrowDown = function ArrowDown(props) {
|
|
|
11
11
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
12
12
|
viewBox: "0 0 32 32"
|
|
13
13
|
}, props), /*#__PURE__*/React.createElement("path", {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var ArrowUp = function ArrowUp(props) {
|
|
19
|
-
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
20
|
-
viewBox: "0 0 32 32"
|
|
21
|
-
}, props), /*#__PURE__*/React.createElement("path", {
|
|
22
|
-
d: "M20.8 20L16 15.2 11.2 20l-1.7-1.6L16 12l6.5 6.4z"
|
|
14
|
+
fillRule: "evenodd",
|
|
15
|
+
clipRule: "evenodd",
|
|
16
|
+
d: "M11 14h10l-5 6z"
|
|
23
17
|
}));
|
|
24
18
|
};
|
|
25
19
|
|
|
@@ -58,24 +52,25 @@ var Accordion = function Accordion(_ref) {
|
|
|
58
52
|
};
|
|
59
53
|
|
|
60
54
|
var openedClassName = isOpenedState ? openedClass : undefined;
|
|
55
|
+
var arrowDataAttrs = isOpenedState ? dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowUp : dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowDown;
|
|
61
56
|
return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
62
57
|
ref: rootRef,
|
|
63
58
|
className: cn({
|
|
64
|
-
|
|
59
|
+
opened: isOpenedState
|
|
65
60
|
}, [className, rootPropsClasses, openedClassName])
|
|
66
61
|
}), /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.titleWrap), {
|
|
67
62
|
className: cn('title-wrap', [titleWrapPropsClasses]),
|
|
68
63
|
onClick: handleClickTitle,
|
|
69
|
-
onKeyDown: handleClickTitle
|
|
64
|
+
onKeyDown: handleClickTitle,
|
|
65
|
+
tabIndex: 0,
|
|
66
|
+
role: "button"
|
|
70
67
|
}), /*#__PURE__*/React.createElement(Header, _extends({
|
|
71
68
|
as: "h5"
|
|
72
69
|
}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.header)), title), /*#__PURE__*/React.createElement("div", {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
className: cn('icon
|
|
76
|
-
|
|
77
|
-
})
|
|
78
|
-
}, isOpenedState ? /*#__PURE__*/React.createElement(ArrowUp, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowUp)) : /*#__PURE__*/React.createElement(ArrowDown, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowDown)))), /*#__PURE__*/React.createElement(Collapse, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.collapse), {
|
|
70
|
+
className: cn('icon-box')
|
|
71
|
+
}, /*#__PURE__*/React.createElement(ArrowDown, _extends({
|
|
72
|
+
className: cn('icon')
|
|
73
|
+
}, filterDataAttrs(arrowDataAttrs))))), /*#__PURE__*/React.createElement(Collapse, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.collapse), {
|
|
79
74
|
className: cn('content', collapsePropsClasses),
|
|
80
75
|
classNameContainer: cn('content-inner'),
|
|
81
76
|
isOpened: isOpenedState
|
|
@@ -32,8 +32,6 @@ export interface IBannerProps {
|
|
|
32
32
|
autoPlay?: boolean;
|
|
33
33
|
/** Задержка автоматической прокрутки */
|
|
34
34
|
autoPlayDelay?: number;
|
|
35
|
-
/** Пауза автоматической прокрутки при наведении курсора на компонент */
|
|
36
|
-
pauseOnHover?: boolean;
|
|
37
35
|
/** Цветовая тема навигации */
|
|
38
36
|
navTheme?: NavThemeType;
|
|
39
37
|
/** Обработчик клика по стрелке "вперед" (должен быть обернут в useCallback) */
|
|
@@ -49,9 +49,7 @@ var Banner = function Banner(_ref) {
|
|
|
49
49
|
onPrevClick = _ref.onPrevClick,
|
|
50
50
|
onDotClick = _ref.onDotClick,
|
|
51
51
|
onChange = _ref.onChange,
|
|
52
|
-
dataAttrs = _ref.dataAttrs
|
|
53
|
-
_ref$pauseOnHover = _ref.pauseOnHover,
|
|
54
|
-
pauseOnHover = _ref$pauseOnHover === void 0 ? false : _ref$pauseOnHover;
|
|
52
|
+
dataAttrs = _ref.dataAttrs;
|
|
55
53
|
|
|
56
54
|
var _React$useState = React.useState(),
|
|
57
55
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -71,42 +69,29 @@ var Banner = function Banner(_ref) {
|
|
|
71
69
|
var _React$useState7 = React.useState(autoPlay),
|
|
72
70
|
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
73
71
|
isAutoPlaying = _React$useState8[0],
|
|
74
|
-
|
|
72
|
+
setAutoPlayning = _React$useState8[1];
|
|
75
73
|
|
|
76
74
|
var _React$useState9 = React.useState(0),
|
|
77
75
|
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
78
76
|
activeIndex = _React$useState10[0],
|
|
79
77
|
setActiveIndex = _React$useState10[1];
|
|
80
78
|
|
|
81
|
-
var _React$useState11 = React.useState(autoPlayDelay),
|
|
82
|
-
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
|
83
|
-
delay = _React$useState12[0],
|
|
84
|
-
setDelay = _React$useState12[1];
|
|
85
|
-
|
|
86
|
-
var _React$useState13 = React.useState(false),
|
|
87
|
-
_React$useState14 = _slicedToArray(_React$useState13, 2),
|
|
88
|
-
isIncreasedDelay = _React$useState14[0],
|
|
89
|
-
setIsIncreasedDelay = _React$useState14[1];
|
|
90
|
-
|
|
91
79
|
var showDotTimer = loop ? isAutoPlaying : isAutoPlaying && !isEnd;
|
|
92
|
-
var dotTimerDelay =
|
|
80
|
+
var dotTimerDelay = autoPlayDelay / 1000;
|
|
93
81
|
var navArrowTheme = navTheme === NavTheme.DARK ? ArrowTheme.DARK : ArrowTheme.PURPLE;
|
|
94
|
-
var rootRef = React.useRef(null);
|
|
95
82
|
var increaseAutoplayDelay = React.useCallback(function (_ref2) {
|
|
96
83
|
var params = _ref2.params,
|
|
97
84
|
autoplay = _ref2.autoplay;
|
|
98
85
|
|
|
99
|
-
if (_typeof(params.autoplay) !== 'object' || !
|
|
86
|
+
if (_typeof(params.autoplay) !== 'object' || !autoplay.running) {
|
|
100
87
|
return;
|
|
101
88
|
}
|
|
102
89
|
|
|
103
90
|
autoplay.stop(); // eslint-disable-next-line no-param-reassign
|
|
104
91
|
|
|
105
92
|
params.autoplay.delay = autoPlayDelay * 3;
|
|
106
|
-
setDelay(autoPlayDelay * 3);
|
|
107
|
-
setIsIncreasedDelay(true);
|
|
108
93
|
autoplay.start();
|
|
109
|
-
}, [
|
|
94
|
+
}, [autoPlayDelay]);
|
|
110
95
|
var handlePrevClick = React.useCallback(function () {
|
|
111
96
|
if (!swiperInstance) {
|
|
112
97
|
return;
|
|
@@ -114,8 +99,8 @@ var Banner = function Banner(_ref) {
|
|
|
114
99
|
|
|
115
100
|
swiperInstance.slidePrev();
|
|
116
101
|
onPrevClick === null || onPrevClick === void 0 ? void 0 : onPrevClick(swiperInstance.realIndex);
|
|
117
|
-
|
|
118
|
-
}, [swiperInstance, onPrevClick,
|
|
102
|
+
increaseAutoplayDelay(swiperInstance);
|
|
103
|
+
}, [swiperInstance, onPrevClick, increaseAutoplayDelay]);
|
|
119
104
|
var handleNextClick = React.useCallback(function () {
|
|
120
105
|
if (!swiperInstance) {
|
|
121
106
|
return;
|
|
@@ -123,8 +108,8 @@ var Banner = function Banner(_ref) {
|
|
|
123
108
|
|
|
124
109
|
swiperInstance.slideNext();
|
|
125
110
|
onNextClick === null || onNextClick === void 0 ? void 0 : onNextClick(swiperInstance.realIndex);
|
|
126
|
-
|
|
127
|
-
}, [swiperInstance, onNextClick,
|
|
111
|
+
increaseAutoplayDelay(swiperInstance);
|
|
112
|
+
}, [swiperInstance, onNextClick, increaseAutoplayDelay]);
|
|
128
113
|
var handleDotClick = React.useCallback(function (index) {
|
|
129
114
|
if (!swiperInstance) {
|
|
130
115
|
return;
|
|
@@ -137,8 +122,11 @@ var Banner = function Banner(_ref) {
|
|
|
137
122
|
}
|
|
138
123
|
|
|
139
124
|
onDotClick === null || onDotClick === void 0 ? void 0 : onDotClick(swiperInstance.realIndex);
|
|
140
|
-
|
|
141
|
-
}, [swiperInstance, loop, onDotClick,
|
|
125
|
+
increaseAutoplayDelay(swiperInstance);
|
|
126
|
+
}, [swiperInstance, loop, onDotClick, increaseAutoplayDelay]);
|
|
127
|
+
var handleSwiper = React.useCallback(function (swiper) {
|
|
128
|
+
setSwiperInstance(swiper);
|
|
129
|
+
}, []);
|
|
142
130
|
var handleReachBeginning = React.useCallback(function () {
|
|
143
131
|
setBeginning(true);
|
|
144
132
|
}, []);
|
|
@@ -161,42 +149,23 @@ var Banner = function Banner(_ref) {
|
|
|
161
149
|
onChange === null || onChange === void 0 ? void 0 : onChange(realIndex);
|
|
162
150
|
}, [onChange]);
|
|
163
151
|
var handleAutoplayStop = React.useCallback(function () {
|
|
164
|
-
|
|
152
|
+
setAutoPlayning(false);
|
|
165
153
|
}, []);
|
|
166
|
-
var handleAutoPlayStart = React.useCallback(function () {
|
|
167
|
-
setAutoPlaying(true);
|
|
168
|
-
}, []);
|
|
169
|
-
React.useEffect(function () {
|
|
170
|
-
var rootElement = rootRef.current;
|
|
171
|
-
|
|
172
|
-
if (!pauseOnHover || !autoPlay) {
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
rootElement === null || rootElement === void 0 ? void 0 : rootElement.addEventListener('mouseenter', function () {
|
|
177
|
-
swiperInstance === null || swiperInstance === void 0 ? void 0 : swiperInstance.autoplay.stop();
|
|
178
|
-
});
|
|
179
|
-
rootElement === null || rootElement === void 0 ? void 0 : rootElement.addEventListener('mouseleave', function () {
|
|
180
|
-
swiperInstance === null || swiperInstance === void 0 ? void 0 : swiperInstance.autoplay.start();
|
|
181
|
-
});
|
|
182
|
-
}, [autoPlay, pauseOnHover, swiperInstance === null || swiperInstance === void 0 ? void 0 : swiperInstance.autoplay]);
|
|
183
154
|
return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
184
155
|
className: cn({
|
|
185
156
|
'nav-theme': navTheme
|
|
186
|
-
}, className)
|
|
187
|
-
ref: rootRef
|
|
157
|
+
}, className)
|
|
188
158
|
}), /*#__PURE__*/React.createElement(Swiper, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.swiper), {
|
|
189
159
|
className: cn('swiper'),
|
|
190
160
|
loop: loop,
|
|
191
161
|
autoplay: autoPlay ? getAutoPlayConfig(autoPlayDelay) : false,
|
|
192
162
|
watchSlidesVisibility: true,
|
|
193
|
-
onSwiper:
|
|
163
|
+
onSwiper: handleSwiper,
|
|
194
164
|
onReachBeginning: handleReachBeginning,
|
|
195
165
|
onReachEnd: handleReachEnd,
|
|
196
166
|
onFromEdge: handleFromEdge,
|
|
197
167
|
onSlideChange: handleSlideChange,
|
|
198
168
|
onAutoplayStop: handleAutoplayStop,
|
|
199
|
-
onAutoplayStart: handleAutoPlayStart,
|
|
200
169
|
onTouchEnd: increaseAutoplayDelay
|
|
201
170
|
}), React.Children.map(children, function (child, i) {
|
|
202
171
|
return /*#__PURE__*/React.createElement(SwiperSlide, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.slide, i + 1), {
|
|
@@ -263,7 +232,6 @@ Banner.propTypes = {
|
|
|
263
232
|
}),
|
|
264
233
|
autoPlay: PropTypes.bool,
|
|
265
234
|
autoPlayDelay: PropTypes.number,
|
|
266
|
-
pauseOnHover: PropTypes.bool,
|
|
267
235
|
navTheme: PropTypes.oneOf(Object.values(NavTheme)),
|
|
268
236
|
onNextClick: PropTypes.func,
|
|
269
237
|
onPrevClick: PropTypes.func,
|
|
@@ -21,10 +21,6 @@
|
|
|
21
21
|
appearance: none;
|
|
22
22
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
23
23
|
}
|
|
24
|
-
.mfui-button_size-all_extra-small .mfui-button__inner {
|
|
25
|
-
min-width: 26px;
|
|
26
|
-
height: 26px;
|
|
27
|
-
}
|
|
28
24
|
.mfui-button_size-all_small .mfui-button__inner {
|
|
29
25
|
min-width: 32px;
|
|
30
26
|
height: 32px;
|
|
@@ -37,10 +33,6 @@
|
|
|
37
33
|
min-width: 60px;
|
|
38
34
|
height: 60px;
|
|
39
35
|
}
|
|
40
|
-
.mfui-button_size-all_extra-small .mfui-button__icon {
|
|
41
|
-
width: 18px;
|
|
42
|
-
height: 18px;
|
|
43
|
-
}
|
|
44
36
|
.mfui-button_size-all_small .mfui-button__icon {
|
|
45
37
|
width: 24px;
|
|
46
38
|
height: 24px;
|
|
@@ -54,10 +46,6 @@
|
|
|
54
46
|
height: 40px;
|
|
55
47
|
}
|
|
56
48
|
@media screen and (min-width: 1280px) {
|
|
57
|
-
.mfui-button_size-wide_extra-small .mfui-button__inner {
|
|
58
|
-
min-width: 26px;
|
|
59
|
-
height: 26px;
|
|
60
|
-
}
|
|
61
49
|
.mfui-button_size-wide_small .mfui-button__inner {
|
|
62
50
|
min-width: 32px;
|
|
63
51
|
height: 32px;
|
|
@@ -70,10 +58,6 @@
|
|
|
70
58
|
min-width: 60px;
|
|
71
59
|
height: 60px;
|
|
72
60
|
}
|
|
73
|
-
.mfui-button_size-wide_extra-small .mfui-button__icon {
|
|
74
|
-
width: 18px;
|
|
75
|
-
height: 18px;
|
|
76
|
-
}
|
|
77
61
|
.mfui-button_size-wide_small .mfui-button__icon {
|
|
78
62
|
width: 24px;
|
|
79
63
|
height: 24px;
|
|
@@ -88,10 +72,6 @@
|
|
|
88
72
|
}
|
|
89
73
|
}
|
|
90
74
|
@media screen and (min-width: 1024px) {
|
|
91
|
-
.mfui-button_size-desktop_extra-small .mfui-button__inner {
|
|
92
|
-
min-width: 26px;
|
|
93
|
-
height: 26px;
|
|
94
|
-
}
|
|
95
75
|
.mfui-button_size-desktop_small .mfui-button__inner {
|
|
96
76
|
min-width: 32px;
|
|
97
77
|
height: 32px;
|
|
@@ -104,10 +84,6 @@
|
|
|
104
84
|
min-width: 60px;
|
|
105
85
|
height: 60px;
|
|
106
86
|
}
|
|
107
|
-
.mfui-button_size-desktop_extra-small .mfui-button__icon {
|
|
108
|
-
width: 18px;
|
|
109
|
-
height: 18px;
|
|
110
|
-
}
|
|
111
87
|
.mfui-button_size-desktop_small .mfui-button__icon {
|
|
112
88
|
width: 24px;
|
|
113
89
|
height: 24px;
|
|
@@ -122,10 +98,6 @@
|
|
|
122
98
|
}
|
|
123
99
|
}
|
|
124
100
|
@media screen and (min-width: 768px) and (max-width: 1023px) {
|
|
125
|
-
.mfui-button_size-tablet_extra-small .mfui-button__inner {
|
|
126
|
-
min-width: 26px;
|
|
127
|
-
height: 26px;
|
|
128
|
-
}
|
|
129
101
|
.mfui-button_size-tablet_small .mfui-button__inner {
|
|
130
102
|
min-width: 32px;
|
|
131
103
|
height: 32px;
|
|
@@ -138,10 +110,6 @@
|
|
|
138
110
|
min-width: 60px;
|
|
139
111
|
height: 60px;
|
|
140
112
|
}
|
|
141
|
-
.mfui-button_size-tablet_extra-small .mfui-button__icon {
|
|
142
|
-
width: 18px;
|
|
143
|
-
height: 18px;
|
|
144
|
-
}
|
|
145
113
|
.mfui-button_size-tablet_small .mfui-button__icon {
|
|
146
114
|
width: 24px;
|
|
147
115
|
height: 24px;
|
|
@@ -156,10 +124,6 @@
|
|
|
156
124
|
}
|
|
157
125
|
}
|
|
158
126
|
@media screen and (max-width: 767px) {
|
|
159
|
-
.mfui-button_size-mobile_extra-small .mfui-button__inner {
|
|
160
|
-
min-width: 26px;
|
|
161
|
-
height: 26px;
|
|
162
|
-
}
|
|
163
127
|
.mfui-button_size-mobile_small .mfui-button__inner {
|
|
164
128
|
min-width: 32px;
|
|
165
129
|
height: 32px;
|
|
@@ -172,10 +136,6 @@
|
|
|
172
136
|
min-width: 60px;
|
|
173
137
|
height: 60px;
|
|
174
138
|
}
|
|
175
|
-
.mfui-button_size-mobile_extra-small .mfui-button__icon {
|
|
176
|
-
width: 18px;
|
|
177
|
-
height: 18px;
|
|
178
|
-
}
|
|
179
139
|
.mfui-button_size-mobile_small .mfui-button__icon {
|
|
180
140
|
width: 24px;
|
|
181
141
|
height: 24px;
|
|
@@ -13,7 +13,6 @@ export declare const ButtonThemes: {
|
|
|
13
13
|
};
|
|
14
14
|
declare type ButtonThemesType = typeof ButtonThemes[keyof typeof ButtonThemes];
|
|
15
15
|
export declare const ButtonSizes: {
|
|
16
|
-
readonly EXTRA_SMALL: "extra-small";
|
|
17
16
|
readonly SMALL: "small";
|
|
18
17
|
readonly MEDIUM: "medium";
|
|
19
18
|
readonly LARGE: "large";
|
|
@@ -29,7 +29,6 @@ export var ButtonThemes = {
|
|
|
29
29
|
BLACK: 'black'
|
|
30
30
|
};
|
|
31
31
|
export var ButtonSizes = {
|
|
32
|
-
EXTRA_SMALL: 'extra-small',
|
|
33
32
|
SMALL: 'small',
|
|
34
33
|
MEDIUM: 'medium',
|
|
35
34
|
LARGE: 'large'
|
|
@@ -43,7 +42,7 @@ var Content;
|
|
|
43
42
|
})(Content || (Content = {}));
|
|
44
43
|
|
|
45
44
|
var getLoaderSize = function getLoaderSize(size) {
|
|
46
|
-
return size === ButtonSizes.SMALL
|
|
45
|
+
return size === ButtonSizes.SMALL ? ButtonSizes.SMALL : ButtonSizes.MEDIUM;
|
|
47
46
|
};
|
|
48
47
|
|
|
49
48
|
var cn = cnCreate('mfui-button');
|
|
@@ -20,7 +20,7 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
20
20
|
return t;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
import React, { useState, useEffect, useMemo
|
|
23
|
+
import React, { useState, useEffect, useMemo } from 'react';
|
|
24
24
|
import { START_DATE, END_DATE, useDatepicker, useMonth } from '@datepicker-react/hooks';
|
|
25
25
|
import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
|
|
26
26
|
import differenceInDays from 'date-fns/differenceInDays';
|
|
@@ -53,17 +53,6 @@ var dayLabelFormat = function dayLabelFormat(date) {
|
|
|
53
53
|
var monthLabelFormat = function monthLabelFormat(date) {
|
|
54
54
|
return formatDate(date, 'LLLL');
|
|
55
55
|
};
|
|
56
|
-
/* List of cases to check on component change:
|
|
57
|
-
|
|
58
|
-
- Should correctly choose value and trigger callbacks with correct arguments on dates choose.
|
|
59
|
-
- Should set 1 day period if start and end date is equal
|
|
60
|
-
- Should correctly increase period if choose earlier start date
|
|
61
|
-
- Should correctly change start date of selected period if chosen date in period closer to current start date
|
|
62
|
-
- Should correctly change end date of selected period if chosen date in period closer to current end date
|
|
63
|
-
- Should correctly highlights period if start date chosen and hover on possible end date
|
|
64
|
-
|
|
65
|
-
*/
|
|
66
|
-
|
|
67
56
|
|
|
68
57
|
var cn = cnCreate('mfui-calendar');
|
|
69
58
|
|
|
@@ -102,7 +91,6 @@ var Calendar = function Calendar(_ref) {
|
|
|
102
91
|
hoveredDate = _useState4[0],
|
|
103
92
|
setHoveredDate = _useState4[1];
|
|
104
93
|
|
|
105
|
-
var isUserChoice = useRef(false);
|
|
106
94
|
var stateStartDate = calendarState.startDate,
|
|
107
95
|
stateEndDate = calendarState.endDate,
|
|
108
96
|
stateFocusedInput = calendarState.focusedInput;
|
|
@@ -123,13 +111,10 @@ var Calendar = function Calendar(_ref) {
|
|
|
123
111
|
goToDate = _a.goToDate,
|
|
124
112
|
pickerProps = __rest(_a, ["firstDayOfWeek", "activeMonths", "goToPreviousMonths", "goToNextMonths", "goToDate"]);
|
|
125
113
|
|
|
126
|
-
useEffect(function () {
|
|
127
|
-
isUserChoice.current = false;
|
|
128
|
-
}, [startDate]);
|
|
129
114
|
useEffect(function () {
|
|
130
115
|
var propsStartDate = calendarStateFromProps.startDate;
|
|
131
116
|
setCalendarState(calendarStateFromProps);
|
|
132
|
-
|
|
117
|
+
propsStartDate && goToDate(propsStartDate); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
133
118
|
}, [calendarStateFromProps]);
|
|
134
119
|
|
|
135
120
|
var getCalendarState = function getCalendarState(date) {
|
|
@@ -194,7 +179,6 @@ var Calendar = function Calendar(_ref) {
|
|
|
194
179
|
var nextStartDate = nextState.startDate,
|
|
195
180
|
nextEndDate = nextState.endDate;
|
|
196
181
|
setCalendarState(nextState);
|
|
197
|
-
isUserChoice.current = true;
|
|
198
182
|
onChange === null || onChange === void 0 ? void 0 : onChange(nextStartDate, nextEndDate);
|
|
199
183
|
};
|
|
200
184
|
|