@megafon/ui-core 4.0.0-beta.2 → 4.0.0-beta.5
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 +106 -18
- package/dist/es/components/Accordion/Accordion.js +2 -2
- package/dist/es/components/Banner/Banner.d.ts +2 -0
- package/dist/es/components/Banner/Banner.js +46 -20
- package/dist/es/components/Button/Button.css +77 -0
- package/dist/es/components/Button/Button.d.ts +3 -0
- package/dist/es/components/Button/Button.js +12 -4
- package/dist/es/components/Calendar/Calendar.js +18 -2
- package/dist/es/components/Calendar/components/Month/Month.js +4 -4
- package/dist/es/components/Logo/Logo.js +22 -6
- package/dist/es/components/Notification/Notification.css +131 -33
- package/dist/es/components/Notification/Notification.d.ts +26 -0
- package/dist/es/components/Notification/Notification.js +189 -13
- package/dist/es/components/Select/Select.js +1 -1
- package/dist/es/components/Switcher/Switcher.css +3 -0
- package/dist/es/components/Switcher/Switcher.d.ts +1 -0
- package/dist/es/components/Switcher/Switcher.js +4 -3
- package/dist/es/components/Tabs/Tab.d.ts +1 -0
- package/dist/es/components/Tabs/Tab.js +2 -1
- package/dist/es/components/Tabs/Tabs.css +133 -141
- package/dist/es/components/Tabs/Tabs.d.ts +9 -8
- package/dist/es/components/Tabs/Tabs.js +18 -22
- package/dist/es/components/TextField/TextField.css +107 -19
- package/dist/es/components/TextField/TextField.js +113 -40
- package/dist/es/components/Tooltip/Tooltip.d.ts +4 -0
- package/dist/es/components/Tooltip/Tooltip.js +32 -1
- package/dist/es/constants/throttleTime.d.ts +1 -0
- package/dist/es/constants/throttleTime.js +2 -1
- package/dist/lib/components/Accordion/Accordion.js +2 -2
- package/dist/lib/components/Banner/Banner.d.ts +2 -0
- package/dist/lib/components/Banner/Banner.js +46 -20
- package/dist/lib/components/Button/Button.css +77 -0
- package/dist/lib/components/Button/Button.d.ts +3 -0
- package/dist/lib/components/Button/Button.js +12 -4
- package/dist/lib/components/Calendar/Calendar.js +17 -1
- package/dist/lib/components/Calendar/components/Month/Month.js +4 -4
- package/dist/lib/components/Logo/Logo.js +22 -6
- package/dist/lib/components/Notification/Notification.css +131 -33
- package/dist/lib/components/Notification/Notification.d.ts +26 -0
- package/dist/lib/components/Notification/Notification.js +192 -13
- package/dist/lib/components/Select/Select.js +1 -1
- package/dist/lib/components/Switcher/Switcher.css +3 -0
- package/dist/lib/components/Switcher/Switcher.d.ts +1 -0
- package/dist/lib/components/Switcher/Switcher.js +4 -3
- package/dist/lib/components/Tabs/Tab.d.ts +1 -0
- package/dist/lib/components/Tabs/Tab.js +2 -1
- package/dist/lib/components/Tabs/Tabs.css +133 -141
- package/dist/lib/components/Tabs/Tabs.d.ts +9 -8
- package/dist/lib/components/Tabs/Tabs.js +20 -24
- package/dist/lib/components/TextField/TextField.css +107 -19
- package/dist/lib/components/TextField/TextField.js +117 -39
- package/dist/lib/components/Tooltip/Tooltip.d.ts +4 -0
- package/dist/lib/components/Tooltip/Tooltip.js +36 -1
- package/dist/lib/constants/throttleTime.d.ts +1 -0
- package/dist/lib/constants/throttleTime.js +2 -1
- package/package.json +3 -3
- package/styles/base.less +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,71 +3,159 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
# [4.0.0-beta.
|
|
6
|
+
# [4.0.0-beta.5](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.12.0...@megafon/ui-core@4.0.0-beta.5) (2022-06-29)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **textfield:** fix textarea design bugs ([287d426](https://github.com/MegafonWebLab/megafon-ui/commit/287d42644b24ca0e1a3824d5907d8af78293d0e3))
|
|
12
|
+
* **textfield:** update textarea scroll and resize ([9dbce52](https://github.com/MegafonWebLab/megafon-ui/commit/9dbce52d6bc3a71076ffdf2365715204231da774))
|
|
7
13
|
|
|
8
14
|
|
|
9
15
|
### Features
|
|
10
16
|
|
|
11
|
-
* **
|
|
17
|
+
* **accordion:** update by new design ([92dab3a](https://github.com/MegafonWebLab/megafon-ui/commit/92dab3a367544d8507526e7a57a0a9a4015e3acf))
|
|
18
|
+
* **caption:** add new Caption component; update .smallFont() less mixin ([b02a3f7](https://github.com/MegafonWebLab/megafon-ui/commit/b02a3f73ed8d5390d8427ab0a6bc62210710ba40))
|
|
19
|
+
* **paragraph:** remove prop size; add new prop; add 'pale' option to colors ([ffb6bc7](https://github.com/MegafonWebLab/megafon-ui/commit/ffb6bc709a4ef91536e359d5f9edc5501caf0c2c))
|
|
20
|
+
* **tabs:** update by new design ([20ae2cc](https://github.com/MegafonWebLab/megafon-ui/commit/20ae2cc695e1245b9cd06fe37a9e4e3bb0c7eaae))
|
|
21
|
+
* **textfield:** update by new design ([24ec769](https://github.com/MegafonWebLab/megafon-ui/commit/24ec769aeddac9a198941727aaca02ad0fb816f1))
|
|
12
22
|
|
|
13
23
|
|
|
14
24
|
### BREAKING CHANGES
|
|
15
25
|
|
|
26
|
+
* **textfield:** add defaultTransitionTiming in less global variables
|
|
27
|
+
* **tabs:** new prop autoWidth added
|
|
28
|
+
size prop small vallue removed
|
|
29
|
+
new sizes
|
|
16
30
|
* **textfield:** add placeholders text by default
|
|
17
31
|
label element positon changed
|
|
18
32
|
if label prop not setted, label element has text from placeholder (default or in props)
|
|
33
|
+
* **accordion:** change next-sibling accordion styles
|
|
34
|
+
* **caption:** .smallFont() less mixin line-height rule now set to 18px instead of 16px
|
|
35
|
+
either accept new rules or manually add line-height: 16px in your components
|
|
36
|
+
* **paragraph:** prop 'size' is no longer exists.
|
|
37
|
+
use component Caption instead of Paragraph size="small"
|
|
19
38
|
|
|
20
39
|
|
|
21
40
|
|
|
22
41
|
|
|
23
42
|
|
|
24
|
-
# [
|
|
43
|
+
# [3.12.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.11.0...@megafon/ui-core@3.12.0) (2022-06-28)
|
|
25
44
|
|
|
26
45
|
|
|
27
46
|
### Features
|
|
28
47
|
|
|
29
|
-
* **
|
|
48
|
+
* **tab:** add data-attribute for inner element ([43e58e1](https://github.com/MegafonWebLab/megafon-ui/commit/43e58e12b8da661020f4b48f55245492c21ad376))
|
|
30
49
|
|
|
31
50
|
|
|
32
|
-
### BREAKING CHANGES
|
|
33
51
|
|
|
34
|
-
* **accordion:** change next-sibling accordion styles
|
|
35
52
|
|
|
36
53
|
|
|
54
|
+
# [3.11.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.10.1...@megafon/ui-core@3.11.0) (2022-06-21)
|
|
37
55
|
|
|
38
56
|
|
|
57
|
+
### Bug Fixes
|
|
39
58
|
|
|
40
|
-
|
|
59
|
+
* **button:** fix font styles for extra small size ([f475b05](https://github.com/MegafonWebLab/megafon-ui/commit/f475b05ab9d62aa56645fb90ccdef88996e72a70))
|
|
41
60
|
|
|
42
61
|
|
|
43
62
|
### Features
|
|
44
63
|
|
|
45
|
-
* **
|
|
46
|
-
* **
|
|
64
|
+
* **button:** add prop ellipsis ([1978277](https://github.com/MegafonWebLab/megafon-ui/commit/1978277a918cb680e32259042c1a7e3c58056b1b))
|
|
65
|
+
* **notification:** add ability to display button and collapse ([a5fe2f0](https://github.com/MegafonWebLab/megafon-ui/commit/a5fe2f0730b71469c2fb06a148b0e4574adb2d7b))
|
|
47
66
|
|
|
48
67
|
|
|
49
|
-
### BREAKING CHANGES
|
|
50
68
|
|
|
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"
|
|
55
69
|
|
|
56
70
|
|
|
71
|
+
## [3.10.1](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.10.0...@megafon/ui-core@3.10.1) (2022-06-07)
|
|
57
72
|
|
|
58
73
|
|
|
74
|
+
### Bug Fixes
|
|
59
75
|
|
|
60
|
-
|
|
76
|
+
* **banner:** fix bug with hover on autoplay ([93271d8](https://github.com/MegafonWebLab/megafon-ui/commit/93271d8c8f9dd900c031d41f89207f61c41db063))
|
|
61
77
|
|
|
62
|
-
**Note:** Version bump only for package @megafon/ui-core
|
|
63
78
|
|
|
64
79
|
|
|
65
80
|
|
|
66
81
|
|
|
82
|
+
# [3.10.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.9.0...@megafon/ui-core@3.10.0) (2022-05-30)
|
|
67
83
|
|
|
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)
|
|
69
84
|
|
|
70
|
-
|
|
85
|
+
### Features
|
|
86
|
+
|
|
87
|
+
* **banner:** add new prop 'pauseOnHover' ([ac654c3](https://github.com/MegafonWebLab/megafon-ui/commit/ac654c3c23821a5d29ffd5cd91ff7337b3d087c1))
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
# [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)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
### Bug Fixes
|
|
97
|
+
|
|
98
|
+
* **select:** fix selected item color when value is zero ([9847095](https://github.com/MegafonWebLab/megafon-ui/commit/98470955ef813504d4bfa4cd4d3aba77b5458446))
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
### Features
|
|
102
|
+
|
|
103
|
+
* **switcher:** add data-attribute for inner element ([793a022](https://github.com/MegafonWebLab/megafon-ui/commit/793a0224ab957b938e67dd1b4d16c2389a9fb6f8))
|
|
104
|
+
* **tooltip:** add portal selector props ([6188832](https://github.com/MegafonWebLab/megafon-ui/commit/6188832e9ba212e7a8182333aba06d77c3e979d6))
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
# [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)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
### Features
|
|
114
|
+
|
|
115
|
+
* **notification:** add props classes to notification component ([608a424](https://github.com/MegafonWebLab/megafon-ui/commit/608a4246eb99af354fb7cf8ab98c2ed513d87b66))
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
# [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)
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
### Bug Fixes
|
|
125
|
+
|
|
126
|
+
* **logo:** fix horizontal logo svg ([76655eb](https://github.com/MegafonWebLab/megafon-ui/commit/76655ebb82650cc2617750af0b2b2726d3ebcbf3))
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
### Features
|
|
130
|
+
|
|
131
|
+
* **button:** added extra small size ([a26da46](https://github.com/MegafonWebLab/megafon-ui/commit/a26da4601de7e7c81c40eabf9a87ccdbf18cb790))
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
# [3.6.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.5.3...@megafon/ui-core@3.6.0) (2022-04-25)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
### Bug Fixes
|
|
141
|
+
|
|
142
|
+
* **calendar:** fix go to start day after user choice ([8bbce10](https://github.com/MegafonWebLab/megafon-ui/commit/8bbce102d204f7ea7706158f3e6540c86ed3aada))
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
### Features
|
|
146
|
+
|
|
147
|
+
* **tooltip:** added prop isPortal for tooltip ([e6f6d17](https://github.com/MegafonWebLab/megafon-ui/commit/e6f6d1749cd99f065c50bac4eb6a9b3592653f8d))
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
## [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)
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
### Bug Fixes
|
|
157
|
+
|
|
158
|
+
* **switcher:** fix safari bugs ([65274bc](https://github.com/MegafonWebLab/megafon-ui/commit/65274bc3c5e7385109afff94a8ff3f712c9af097))
|
|
71
159
|
|
|
72
160
|
|
|
73
161
|
|
|
@@ -11,9 +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
|
+
d: "M11 14h10l-5 6z",
|
|
14
15
|
fillRule: "evenodd",
|
|
15
|
-
clipRule: "evenodd"
|
|
16
|
-
d: "M11 14h10l-5 6z"
|
|
16
|
+
clipRule: "evenodd"
|
|
17
17
|
}));
|
|
18
18
|
};
|
|
19
19
|
|
|
@@ -32,6 +32,8 @@ export interface IBannerProps {
|
|
|
32
32
|
autoPlay?: boolean;
|
|
33
33
|
/** Задержка автоматической прокрутки */
|
|
34
34
|
autoPlayDelay?: number;
|
|
35
|
+
/** Пауза автоматической прокрутки при наведении курсора на компонент */
|
|
36
|
+
pauseOnHover?: boolean;
|
|
35
37
|
/** Цветовая тема навигации */
|
|
36
38
|
navTheme?: NavThemeType;
|
|
37
39
|
/** Обработчик клика по стрелке "вперед" (должен быть обернут в useCallback) */
|
|
@@ -49,7 +49,9 @@ var Banner = function Banner(_ref) {
|
|
|
49
49
|
onPrevClick = _ref.onPrevClick,
|
|
50
50
|
onDotClick = _ref.onDotClick,
|
|
51
51
|
onChange = _ref.onChange,
|
|
52
|
-
dataAttrs = _ref.dataAttrs
|
|
52
|
+
dataAttrs = _ref.dataAttrs,
|
|
53
|
+
_ref$pauseOnHover = _ref.pauseOnHover,
|
|
54
|
+
pauseOnHover = _ref$pauseOnHover === void 0 ? false : _ref$pauseOnHover;
|
|
53
55
|
|
|
54
56
|
var _React$useState = React.useState(),
|
|
55
57
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -69,29 +71,42 @@ var Banner = function Banner(_ref) {
|
|
|
69
71
|
var _React$useState7 = React.useState(autoPlay),
|
|
70
72
|
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
71
73
|
isAutoPlaying = _React$useState8[0],
|
|
72
|
-
|
|
74
|
+
setAutoPlaying = _React$useState8[1];
|
|
73
75
|
|
|
74
76
|
var _React$useState9 = React.useState(0),
|
|
75
77
|
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
76
78
|
activeIndex = _React$useState10[0],
|
|
77
79
|
setActiveIndex = _React$useState10[1];
|
|
78
80
|
|
|
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
|
+
|
|
79
91
|
var showDotTimer = loop ? isAutoPlaying : isAutoPlaying && !isEnd;
|
|
80
|
-
var dotTimerDelay =
|
|
92
|
+
var dotTimerDelay = delay / 1000;
|
|
81
93
|
var navArrowTheme = navTheme === NavTheme.DARK ? ArrowTheme.DARK : ArrowTheme.PURPLE;
|
|
94
|
+
var rootRef = React.useRef(null);
|
|
82
95
|
var increaseAutoplayDelay = React.useCallback(function (_ref2) {
|
|
83
96
|
var params = _ref2.params,
|
|
84
97
|
autoplay = _ref2.autoplay;
|
|
85
98
|
|
|
86
|
-
if (_typeof(params.autoplay) !== 'object' || !
|
|
99
|
+
if (_typeof(params.autoplay) !== 'object' || !autoPlay) {
|
|
87
100
|
return;
|
|
88
101
|
}
|
|
89
102
|
|
|
90
103
|
autoplay.stop(); // eslint-disable-next-line no-param-reassign
|
|
91
104
|
|
|
92
105
|
params.autoplay.delay = autoPlayDelay * 3;
|
|
106
|
+
setDelay(autoPlayDelay * 3);
|
|
107
|
+
setIsIncreasedDelay(true);
|
|
93
108
|
autoplay.start();
|
|
94
|
-
}, [autoPlayDelay]);
|
|
109
|
+
}, [autoPlay, autoPlayDelay]);
|
|
95
110
|
var handlePrevClick = React.useCallback(function () {
|
|
96
111
|
if (!swiperInstance) {
|
|
97
112
|
return;
|
|
@@ -99,8 +114,8 @@ var Banner = function Banner(_ref) {
|
|
|
99
114
|
|
|
100
115
|
swiperInstance.slidePrev();
|
|
101
116
|
onPrevClick === null || onPrevClick === void 0 ? void 0 : onPrevClick(swiperInstance.realIndex);
|
|
102
|
-
increaseAutoplayDelay(swiperInstance);
|
|
103
|
-
}, [swiperInstance, onPrevClick, increaseAutoplayDelay]);
|
|
117
|
+
!isIncreasedDelay && increaseAutoplayDelay(swiperInstance);
|
|
118
|
+
}, [swiperInstance, onPrevClick, isIncreasedDelay, increaseAutoplayDelay]);
|
|
104
119
|
var handleNextClick = React.useCallback(function () {
|
|
105
120
|
if (!swiperInstance) {
|
|
106
121
|
return;
|
|
@@ -108,8 +123,8 @@ var Banner = function Banner(_ref) {
|
|
|
108
123
|
|
|
109
124
|
swiperInstance.slideNext();
|
|
110
125
|
onNextClick === null || onNextClick === void 0 ? void 0 : onNextClick(swiperInstance.realIndex);
|
|
111
|
-
increaseAutoplayDelay(swiperInstance);
|
|
112
|
-
}, [swiperInstance, onNextClick, increaseAutoplayDelay]);
|
|
126
|
+
!isIncreasedDelay && increaseAutoplayDelay(swiperInstance);
|
|
127
|
+
}, [swiperInstance, onNextClick, isIncreasedDelay, increaseAutoplayDelay]);
|
|
113
128
|
var handleDotClick = React.useCallback(function (index) {
|
|
114
129
|
if (!swiperInstance) {
|
|
115
130
|
return;
|
|
@@ -122,11 +137,8 @@ var Banner = function Banner(_ref) {
|
|
|
122
137
|
}
|
|
123
138
|
|
|
124
139
|
onDotClick === null || onDotClick === void 0 ? void 0 : onDotClick(swiperInstance.realIndex);
|
|
125
|
-
increaseAutoplayDelay(swiperInstance);
|
|
126
|
-
}, [swiperInstance, loop, onDotClick, increaseAutoplayDelay]);
|
|
127
|
-
var handleSwiper = React.useCallback(function (swiper) {
|
|
128
|
-
setSwiperInstance(swiper);
|
|
129
|
-
}, []);
|
|
140
|
+
!isIncreasedDelay && increaseAutoplayDelay(swiperInstance);
|
|
141
|
+
}, [swiperInstance, loop, onDotClick, isIncreasedDelay, increaseAutoplayDelay]);
|
|
130
142
|
var handleReachBeginning = React.useCallback(function () {
|
|
131
143
|
setBeginning(true);
|
|
132
144
|
}, []);
|
|
@@ -148,24 +160,37 @@ var Banner = function Banner(_ref) {
|
|
|
148
160
|
setActiveIndex(realIndex);
|
|
149
161
|
onChange === null || onChange === void 0 ? void 0 : onChange(realIndex);
|
|
150
162
|
}, [onChange]);
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
163
|
+
React.useEffect(function () {
|
|
164
|
+
var rootElement = rootRef.current;
|
|
165
|
+
|
|
166
|
+
if (!pauseOnHover || !autoPlay) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
rootElement === null || rootElement === void 0 ? void 0 : rootElement.addEventListener('mouseenter', function () {
|
|
171
|
+
swiperInstance === null || swiperInstance === void 0 ? void 0 : swiperInstance.autoplay.stop();
|
|
172
|
+
setAutoPlaying(false);
|
|
173
|
+
});
|
|
174
|
+
rootElement === null || rootElement === void 0 ? void 0 : rootElement.addEventListener('mouseleave', function () {
|
|
175
|
+
swiperInstance === null || swiperInstance === void 0 ? void 0 : swiperInstance.autoplay.start();
|
|
176
|
+
setAutoPlaying(true);
|
|
177
|
+
});
|
|
178
|
+
}, [autoPlay, pauseOnHover, swiperInstance === null || swiperInstance === void 0 ? void 0 : swiperInstance.autoplay]);
|
|
154
179
|
return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
155
180
|
className: cn({
|
|
156
181
|
'nav-theme': navTheme
|
|
157
|
-
}, className)
|
|
182
|
+
}, className),
|
|
183
|
+
ref: rootRef
|
|
158
184
|
}), /*#__PURE__*/React.createElement(Swiper, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.swiper), {
|
|
159
185
|
className: cn('swiper'),
|
|
160
186
|
loop: loop,
|
|
161
187
|
autoplay: autoPlay ? getAutoPlayConfig(autoPlayDelay) : false,
|
|
162
188
|
watchSlidesVisibility: true,
|
|
163
|
-
onSwiper:
|
|
189
|
+
onSwiper: setSwiperInstance,
|
|
164
190
|
onReachBeginning: handleReachBeginning,
|
|
165
191
|
onReachEnd: handleReachEnd,
|
|
166
192
|
onFromEdge: handleFromEdge,
|
|
167
193
|
onSlideChange: handleSlideChange,
|
|
168
|
-
onAutoplayStop: handleAutoplayStop,
|
|
169
194
|
onTouchEnd: increaseAutoplayDelay
|
|
170
195
|
}), React.Children.map(children, function (child, i) {
|
|
171
196
|
return /*#__PURE__*/React.createElement(SwiperSlide, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.slide, i + 1), {
|
|
@@ -232,6 +257,7 @@ Banner.propTypes = {
|
|
|
232
257
|
}),
|
|
233
258
|
autoPlay: PropTypes.bool,
|
|
234
259
|
autoPlayDelay: PropTypes.number,
|
|
260
|
+
pauseOnHover: PropTypes.bool,
|
|
235
261
|
navTheme: PropTypes.oneOf(Object.values(NavTheme)),
|
|
236
262
|
onNextClick: PropTypes.func,
|
|
237
263
|
onPrevClick: PropTypes.func,
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
padding: 0 32px;
|
|
9
9
|
border: none;
|
|
10
10
|
border-radius: 30px;
|
|
11
|
+
overflow: hidden;
|
|
11
12
|
color: var(--stcWhite);
|
|
12
13
|
font-weight: 500;
|
|
13
14
|
text-align: center;
|
|
@@ -21,6 +22,15 @@
|
|
|
21
22
|
appearance: none;
|
|
22
23
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
23
24
|
}
|
|
25
|
+
.mfui-button_size-all_extra-small {
|
|
26
|
+
padding: 0 16px;
|
|
27
|
+
}
|
|
28
|
+
.mfui-button_size-all_extra-small .mfui-button__inner {
|
|
29
|
+
font-size: 12px;
|
|
30
|
+
line-height: 18px;
|
|
31
|
+
min-width: 26px;
|
|
32
|
+
height: 26px;
|
|
33
|
+
}
|
|
24
34
|
.mfui-button_size-all_small .mfui-button__inner {
|
|
25
35
|
min-width: 32px;
|
|
26
36
|
height: 32px;
|
|
@@ -33,6 +43,10 @@
|
|
|
33
43
|
min-width: 60px;
|
|
34
44
|
height: 60px;
|
|
35
45
|
}
|
|
46
|
+
.mfui-button_size-all_extra-small .mfui-button__icon {
|
|
47
|
+
width: 18px;
|
|
48
|
+
height: 18px;
|
|
49
|
+
}
|
|
36
50
|
.mfui-button_size-all_small .mfui-button__icon {
|
|
37
51
|
width: 24px;
|
|
38
52
|
height: 24px;
|
|
@@ -46,6 +60,15 @@
|
|
|
46
60
|
height: 40px;
|
|
47
61
|
}
|
|
48
62
|
@media screen and (min-width: 1280px) {
|
|
63
|
+
.mfui-button_size-wide_extra-small {
|
|
64
|
+
padding: 0 16px;
|
|
65
|
+
}
|
|
66
|
+
.mfui-button_size-wide_extra-small .mfui-button__inner {
|
|
67
|
+
font-size: 12px;
|
|
68
|
+
line-height: 18px;
|
|
69
|
+
min-width: 26px;
|
|
70
|
+
height: 26px;
|
|
71
|
+
}
|
|
49
72
|
.mfui-button_size-wide_small .mfui-button__inner {
|
|
50
73
|
min-width: 32px;
|
|
51
74
|
height: 32px;
|
|
@@ -58,6 +81,10 @@
|
|
|
58
81
|
min-width: 60px;
|
|
59
82
|
height: 60px;
|
|
60
83
|
}
|
|
84
|
+
.mfui-button_size-wide_extra-small .mfui-button__icon {
|
|
85
|
+
width: 18px;
|
|
86
|
+
height: 18px;
|
|
87
|
+
}
|
|
61
88
|
.mfui-button_size-wide_small .mfui-button__icon {
|
|
62
89
|
width: 24px;
|
|
63
90
|
height: 24px;
|
|
@@ -72,6 +99,15 @@
|
|
|
72
99
|
}
|
|
73
100
|
}
|
|
74
101
|
@media screen and (min-width: 1024px) {
|
|
102
|
+
.mfui-button_size-desktop_extra-small {
|
|
103
|
+
padding: 0 16px;
|
|
104
|
+
}
|
|
105
|
+
.mfui-button_size-desktop_extra-small .mfui-button__inner {
|
|
106
|
+
font-size: 12px;
|
|
107
|
+
line-height: 18px;
|
|
108
|
+
min-width: 26px;
|
|
109
|
+
height: 26px;
|
|
110
|
+
}
|
|
75
111
|
.mfui-button_size-desktop_small .mfui-button__inner {
|
|
76
112
|
min-width: 32px;
|
|
77
113
|
height: 32px;
|
|
@@ -84,6 +120,10 @@
|
|
|
84
120
|
min-width: 60px;
|
|
85
121
|
height: 60px;
|
|
86
122
|
}
|
|
123
|
+
.mfui-button_size-desktop_extra-small .mfui-button__icon {
|
|
124
|
+
width: 18px;
|
|
125
|
+
height: 18px;
|
|
126
|
+
}
|
|
87
127
|
.mfui-button_size-desktop_small .mfui-button__icon {
|
|
88
128
|
width: 24px;
|
|
89
129
|
height: 24px;
|
|
@@ -98,6 +138,15 @@
|
|
|
98
138
|
}
|
|
99
139
|
}
|
|
100
140
|
@media screen and (min-width: 768px) and (max-width: 1023px) {
|
|
141
|
+
.mfui-button_size-tablet_extra-small {
|
|
142
|
+
padding: 0 16px;
|
|
143
|
+
}
|
|
144
|
+
.mfui-button_size-tablet_extra-small .mfui-button__inner {
|
|
145
|
+
font-size: 12px;
|
|
146
|
+
line-height: 18px;
|
|
147
|
+
min-width: 26px;
|
|
148
|
+
height: 26px;
|
|
149
|
+
}
|
|
101
150
|
.mfui-button_size-tablet_small .mfui-button__inner {
|
|
102
151
|
min-width: 32px;
|
|
103
152
|
height: 32px;
|
|
@@ -110,6 +159,10 @@
|
|
|
110
159
|
min-width: 60px;
|
|
111
160
|
height: 60px;
|
|
112
161
|
}
|
|
162
|
+
.mfui-button_size-tablet_extra-small .mfui-button__icon {
|
|
163
|
+
width: 18px;
|
|
164
|
+
height: 18px;
|
|
165
|
+
}
|
|
113
166
|
.mfui-button_size-tablet_small .mfui-button__icon {
|
|
114
167
|
width: 24px;
|
|
115
168
|
height: 24px;
|
|
@@ -124,6 +177,15 @@
|
|
|
124
177
|
}
|
|
125
178
|
}
|
|
126
179
|
@media screen and (max-width: 767px) {
|
|
180
|
+
.mfui-button_size-mobile_extra-small {
|
|
181
|
+
padding: 0 16px;
|
|
182
|
+
}
|
|
183
|
+
.mfui-button_size-mobile_extra-small .mfui-button__inner {
|
|
184
|
+
font-size: 12px;
|
|
185
|
+
line-height: 18px;
|
|
186
|
+
min-width: 26px;
|
|
187
|
+
height: 26px;
|
|
188
|
+
}
|
|
127
189
|
.mfui-button_size-mobile_small .mfui-button__inner {
|
|
128
190
|
min-width: 32px;
|
|
129
191
|
height: 32px;
|
|
@@ -136,6 +198,10 @@
|
|
|
136
198
|
min-width: 60px;
|
|
137
199
|
height: 60px;
|
|
138
200
|
}
|
|
201
|
+
.mfui-button_size-mobile_extra-small .mfui-button__icon {
|
|
202
|
+
width: 18px;
|
|
203
|
+
height: 18px;
|
|
204
|
+
}
|
|
139
205
|
.mfui-button_size-mobile_small .mfui-button__icon {
|
|
140
206
|
width: 24px;
|
|
141
207
|
height: 24px;
|
|
@@ -173,6 +239,11 @@
|
|
|
173
239
|
.mfui-button__text {
|
|
174
240
|
margin-bottom: 2px;
|
|
175
241
|
}
|
|
242
|
+
.mfui-button__text_ellipsis {
|
|
243
|
+
overflow: hidden;
|
|
244
|
+
white-space: nowrap;
|
|
245
|
+
text-overflow: ellipsis;
|
|
246
|
+
}
|
|
176
247
|
.mfui-button__content {
|
|
177
248
|
display: -webkit-box;
|
|
178
249
|
display: -ms-flexbox;
|
|
@@ -181,6 +252,12 @@
|
|
|
181
252
|
-ms-flex-align: center;
|
|
182
253
|
align-items: center;
|
|
183
254
|
}
|
|
255
|
+
.mfui-button__content_ellipsis {
|
|
256
|
+
width: inherit;
|
|
257
|
+
max-width: -webkit-fit-content;
|
|
258
|
+
max-width: -moz-fit-content;
|
|
259
|
+
max-width: fit-content;
|
|
260
|
+
}
|
|
184
261
|
.mfui-button__icon-arrow {
|
|
185
262
|
width: 32px;
|
|
186
263
|
height: 32px;
|
|
@@ -13,6 +13,7 @@ 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";
|
|
16
17
|
readonly SMALL: "small";
|
|
17
18
|
readonly MEDIUM: "medium";
|
|
18
19
|
readonly LARGE: "large";
|
|
@@ -73,6 +74,8 @@ export interface IButtonProps {
|
|
|
73
74
|
disabled?: boolean;
|
|
74
75
|
/** Ссылка на элемент */
|
|
75
76
|
buttonRef?: Ref<HTMLButtonElement | HTMLAnchorElement>;
|
|
77
|
+
/** Обрезать текст при недостаточной ширине и добавлять многоточие */
|
|
78
|
+
ellipsis?: boolean;
|
|
76
79
|
/** Обработчик клика по кнопке */
|
|
77
80
|
onClick?: (e: React.SyntheticEvent<EventTarget>) => void;
|
|
78
81
|
}
|
|
@@ -29,6 +29,7 @@ export var ButtonThemes = {
|
|
|
29
29
|
BLACK: 'black'
|
|
30
30
|
};
|
|
31
31
|
export var ButtonSizes = {
|
|
32
|
+
EXTRA_SMALL: 'extra-small',
|
|
32
33
|
SMALL: 'small',
|
|
33
34
|
MEDIUM: 'medium',
|
|
34
35
|
LARGE: 'large'
|
|
@@ -42,7 +43,7 @@ var Content;
|
|
|
42
43
|
})(Content || (Content = {}));
|
|
43
44
|
|
|
44
45
|
var getLoaderSize = function getLoaderSize(size) {
|
|
45
|
-
return size === ButtonSizes.SMALL ? ButtonSizes.SMALL : ButtonSizes.MEDIUM;
|
|
46
|
+
return size === ButtonSizes.SMALL || size === ButtonSizes.EXTRA_SMALL ? ButtonSizes.SMALL : ButtonSizes.MEDIUM;
|
|
46
47
|
};
|
|
47
48
|
|
|
48
49
|
var cn = cnCreate('mfui-button');
|
|
@@ -80,6 +81,8 @@ var Button = function Button(_ref) {
|
|
|
80
81
|
icon = _ref.icon,
|
|
81
82
|
disabled = _ref.disabled,
|
|
82
83
|
children = _ref.children,
|
|
84
|
+
_ref$ellipsis = _ref.ellipsis,
|
|
85
|
+
ellipsis = _ref$ellipsis === void 0 ? false : _ref$ellipsis,
|
|
83
86
|
onClick = _ref.onClick,
|
|
84
87
|
dataAttrs = _ref.dataAttrs,
|
|
85
88
|
buttonRef = _ref.buttonRef;
|
|
@@ -122,15 +125,19 @@ var Button = function Button(_ref) {
|
|
|
122
125
|
}
|
|
123
126
|
|
|
124
127
|
return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.content), {
|
|
125
|
-
className: cn('content',
|
|
128
|
+
className: cn('content', {
|
|
129
|
+
ellipsis: ellipsis
|
|
130
|
+
}, contentClassName)
|
|
126
131
|
}), icon && /*#__PURE__*/React.createElement("div", {
|
|
127
132
|
className: cn('icon')
|
|
128
133
|
}, icon), children && /*#__PURE__*/React.createElement("span", {
|
|
129
|
-
className: cn('text'
|
|
134
|
+
className: cn('text', {
|
|
135
|
+
ellipsis: ellipsis
|
|
136
|
+
})
|
|
130
137
|
}, children), !icon && showArrow && /*#__PURE__*/React.createElement(Arrow, {
|
|
131
138
|
className: cn('icon-arrow')
|
|
132
139
|
}));
|
|
133
|
-
}, [children, icon, dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.content, contentClassName, showArrow]);
|
|
140
|
+
}, [children, icon, dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.content, contentClassName, showArrow, ellipsis]);
|
|
134
141
|
var contentType = React.useMemo(function () {
|
|
135
142
|
switch (true) {
|
|
136
143
|
case icon && !children:
|
|
@@ -237,6 +244,7 @@ Button.propTypes = {
|
|
|
237
244
|
buttonRef: PropTypes.oneOfType([PropTypes.func, PropTypes.oneOfType([PropTypes.shape({
|
|
238
245
|
current: PropTypes.elementType
|
|
239
246
|
}), PropTypes.any])]),
|
|
247
|
+
ellipsis: PropTypes.bool,
|
|
240
248
|
onClick: PropTypes.func
|
|
241
249
|
};
|
|
242
250
|
export default 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 } from 'react';
|
|
23
|
+
import React, { useState, useEffect, useMemo, useRef } 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,6 +53,17 @@ 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
|
+
|
|
56
67
|
|
|
57
68
|
var cn = cnCreate('mfui-calendar');
|
|
58
69
|
|
|
@@ -91,6 +102,7 @@ var Calendar = function Calendar(_ref) {
|
|
|
91
102
|
hoveredDate = _useState4[0],
|
|
92
103
|
setHoveredDate = _useState4[1];
|
|
93
104
|
|
|
105
|
+
var isUserChoice = useRef(false);
|
|
94
106
|
var stateStartDate = calendarState.startDate,
|
|
95
107
|
stateEndDate = calendarState.endDate,
|
|
96
108
|
stateFocusedInput = calendarState.focusedInput;
|
|
@@ -111,10 +123,13 @@ var Calendar = function Calendar(_ref) {
|
|
|
111
123
|
goToDate = _a.goToDate,
|
|
112
124
|
pickerProps = __rest(_a, ["firstDayOfWeek", "activeMonths", "goToPreviousMonths", "goToNextMonths", "goToDate"]);
|
|
113
125
|
|
|
126
|
+
useEffect(function () {
|
|
127
|
+
isUserChoice.current = false;
|
|
128
|
+
}, [startDate]);
|
|
114
129
|
useEffect(function () {
|
|
115
130
|
var propsStartDate = calendarStateFromProps.startDate;
|
|
116
131
|
setCalendarState(calendarStateFromProps);
|
|
117
|
-
propsStartDate && goToDate(propsStartDate); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
132
|
+
!isUserChoice.current && propsStartDate && goToDate(propsStartDate); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
118
133
|
}, [calendarStateFromProps]);
|
|
119
134
|
|
|
120
135
|
var getCalendarState = function getCalendarState(date) {
|
|
@@ -179,6 +194,7 @@ var Calendar = function Calendar(_ref) {
|
|
|
179
194
|
var nextStartDate = nextState.startDate,
|
|
180
195
|
nextEndDate = nextState.endDate;
|
|
181
196
|
setCalendarState(nextState);
|
|
197
|
+
isUserChoice.current = true;
|
|
182
198
|
onChange === null || onChange === void 0 ? void 0 : onChange(nextStartDate, nextEndDate);
|
|
183
199
|
};
|
|
184
200
|
|
|
@@ -10,9 +10,9 @@ var ArrowLeft = function ArrowLeft(props) {
|
|
|
10
10
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
11
11
|
viewBox: "0 0 20 20"
|
|
12
12
|
}, props), /*#__PURE__*/React.createElement("path", {
|
|
13
|
+
d: "M12 6v8l-5-4z",
|
|
13
14
|
fillRule: "evenodd",
|
|
14
|
-
clipRule: "evenodd"
|
|
15
|
-
d: "M12 6v8l-5-4z"
|
|
15
|
+
clipRule: "evenodd"
|
|
16
16
|
}));
|
|
17
17
|
};
|
|
18
18
|
|
|
@@ -20,9 +20,9 @@ var ArrowRight = function ArrowRight(props) {
|
|
|
20
20
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
21
21
|
viewBox: "0 0 20 20"
|
|
22
22
|
}, props), /*#__PURE__*/React.createElement("path", {
|
|
23
|
+
d: "M8 14V6l5 4z",
|
|
23
24
|
fillRule: "evenodd",
|
|
24
|
-
clipRule: "evenodd"
|
|
25
|
-
d: "M8 14V6l5 4z"
|
|
25
|
+
clipRule: "evenodd"
|
|
26
26
|
}));
|
|
27
27
|
};
|
|
28
28
|
|