@megafon/ui-core 2.1.3 → 2.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 +56 -0
- package/dist/es/colors/Colors.css +3 -3
- package/dist/es/colors/Colors.d.ts +2 -2
- package/dist/es/colors/Colors.js +2 -2
- package/dist/es/colors/colorsData.js +9 -0
- package/dist/es/components/Accordion/Accordion.d.ts +1 -0
- package/dist/es/components/Accordion/Accordion.js +4 -2
- package/dist/es/components/Banner/Banner.css +28 -0
- package/dist/es/components/Banner/Banner.d.ts +2 -0
- package/dist/es/components/Banner/Banner.js +15 -10
- package/dist/es/components/Button/Button.js +2 -2
- package/dist/es/components/Calendar/Calendar.js +3 -2
- package/dist/es/components/Calendar/components/Day/Day.js +1 -1
- package/dist/es/components/Carousel/Carousel.js +17 -14
- package/dist/es/components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/es/components/Checkbox/Checkbox.js +1 -1
- package/dist/es/components/Counter/Counter.js +3 -3
- package/dist/es/components/Header/Header.d.ts +1 -1
- package/dist/es/components/Link/Link.d.ts +7 -3
- package/dist/es/components/Link/Link.js +21 -8
- package/dist/es/components/Pagination/components/PaginationButton/PaginationButton.js +1 -1
- package/dist/es/components/Pagination/helpers.d.ts +1 -1
- package/dist/es/components/RadioButton/RadioButton.d.ts +5 -1
- package/dist/es/components/RadioButton/RadioButton.js +8 -6
- package/dist/es/components/Search/Search.js +4 -3
- package/dist/es/components/Select/Select.d.ts +3 -3
- package/dist/es/components/Select/Select.js +5 -5
- package/dist/es/components/Switcher/Switcher.js +1 -1
- package/dist/es/components/Tabs/Tabs.js +52 -42
- package/dist/es/components/TextField/TextField.d.ts +3 -1
- package/dist/es/components/TextField/TextField.js +14 -10
- package/dist/es/components/Tile/Tile.js +1 -1
- package/dist/es/components/Tooltip/Tooltip.js +17 -17
- package/dist/lib/colors/Colors.css +3 -3
- package/dist/lib/colors/Colors.d.ts +2 -2
- package/dist/lib/colors/Colors.js +2 -2
- package/dist/lib/colors/colorsData.js +9 -0
- package/dist/lib/components/Accordion/Accordion.d.ts +1 -0
- package/dist/lib/components/Accordion/Accordion.js +4 -2
- package/dist/lib/components/Banner/Banner.css +28 -0
- package/dist/lib/components/Banner/Banner.d.ts +2 -0
- package/dist/lib/components/Banner/Banner.js +15 -10
- package/dist/lib/components/Button/Button.js +2 -2
- package/dist/lib/components/Calendar/Calendar.js +3 -3
- package/dist/lib/components/Calendar/components/Day/Day.js +1 -1
- package/dist/lib/components/Carousel/Carousel.js +15 -12
- package/dist/lib/components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/lib/components/Checkbox/Checkbox.js +1 -1
- package/dist/lib/components/Counter/Counter.js +3 -3
- package/dist/lib/components/Header/Header.d.ts +1 -1
- package/dist/lib/components/Link/Link.d.ts +7 -3
- package/dist/lib/components/Link/Link.js +34 -23
- package/dist/lib/components/Pagination/components/PaginationButton/PaginationButton.js +1 -1
- package/dist/lib/components/Pagination/helpers.d.ts +1 -1
- package/dist/lib/components/RadioButton/RadioButton.d.ts +5 -1
- package/dist/lib/components/RadioButton/RadioButton.js +7 -5
- package/dist/lib/components/Search/Search.js +4 -3
- package/dist/lib/components/Select/Select.d.ts +3 -3
- package/dist/lib/components/Select/Select.js +5 -5
- package/dist/lib/components/Switcher/Switcher.js +1 -1
- package/dist/lib/components/Tabs/Tabs.js +52 -42
- package/dist/lib/components/TextField/TextField.d.ts +3 -1
- package/dist/lib/components/TextField/TextField.js +14 -10
- package/dist/lib/components/Tile/Tile.js +1 -1
- package/dist/lib/components/Tooltip/Tooltip.js +17 -17
- package/package.json +2 -2
- package/styles/base.less +3 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,62 @@
|
|
|
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
|
+
# [2.4.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@2.3.0...@megafon/ui-core@2.4.0) (2022-01-31)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **link:** new prop dataAttrs ([bde2253](https://github.com/MegafonWebLab/megafon-ui/commit/bde22539ff0db11777be9193adceb6de0f984234))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **banner:** add props withPaginationBottomOffset ([c1485a0](https://github.com/MegafonWebLab/megafon-ui/commit/c1485a083d63b886419109b03bb31230c5fed890))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# [2.3.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@2.2.0...@megafon/ui-core@2.3.0) (2022-01-24)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* **search:** prevents default action when a menu item is selected and the enter button is pressed ([054cbcf](https://github.com/MegafonWebLab/megafon-ui/commit/054cbcf3457ff779443a82b5ae6383fda57f9cc7))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Features
|
|
31
|
+
|
|
32
|
+
* **accordion:** props hasVerticalPaddings marked as deprecated ([4d6d4cc](https://github.com/MegafonWebLab/megafon-ui/commit/4d6d4cca2cf45a86441827f0bef625a88a2c44f8))
|
|
33
|
+
* **textfield:** add autocomplete prop ([f2cff94](https://github.com/MegafonWebLab/megafon-ui/commit/f2cff9403503de174b785ea02365ce470811369e))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
# [2.2.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@2.1.4...@megafon/ui-core@2.2.0) (2021-12-29)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### Features
|
|
43
|
+
|
|
44
|
+
* **radiobutton:** add dataAttrs prop ([3f8d0b4](https://github.com/MegafonWebLab/megafon-ui/commit/3f8d0b4c4ec4a6ca301ab44feed2842ec8e54f3a))
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## [2.1.4](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@2.1.3...@megafon/ui-core@2.1.4) (2021-12-20)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
### Bug Fixes
|
|
54
|
+
|
|
55
|
+
* **colors:** add hover colors to system group ([634ac03](https://github.com/MegafonWebLab/megafon-ui/commit/634ac034445fdcd08b60ff056f75683025cb6d49))
|
|
56
|
+
* **tabs:** fix active tab underline width ([4499399](https://github.com/MegafonWebLab/megafon-ui/commit/449939942730143712a92930a279a8b6fc17a012))
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
6
62
|
## [2.1.3](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@2.1.2...@megafon/ui-core@2.1.3) (2021-12-14)
|
|
7
63
|
|
|
8
64
|
|
|
@@ -70,13 +70,13 @@ h5 {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
.colors__list {
|
|
73
|
+
-webkit-box-pack: space-evenly;
|
|
74
|
+
-ms-flex-pack: space-evenly;
|
|
75
|
+
justify-content: space-evenly;
|
|
73
76
|
padding-bottom: 12px;
|
|
74
77
|
}
|
|
75
78
|
@media screen and (max-width: 1023px) {
|
|
76
79
|
.colors__list {
|
|
77
|
-
-webkit-box-pack: space-evenly;
|
|
78
|
-
-ms-flex-pack: space-evenly;
|
|
79
|
-
justify-content: space-evenly;
|
|
80
80
|
-webkit-box-ordinal-group: 3;
|
|
81
81
|
-ms-flex-order: 2;
|
|
82
82
|
order: 2;
|
package/dist/es/colors/Colors.js
CHANGED
|
@@ -229,7 +229,7 @@ var Colors = function Colors() {
|
|
|
229
229
|
mobile: "12",
|
|
230
230
|
tablet: "12"
|
|
231
231
|
}, renderColorBlock(secondary)), /*#__PURE__*/React.createElement(GridColumn, {
|
|
232
|
-
all: "
|
|
232
|
+
all: "10",
|
|
233
233
|
mobile: "12",
|
|
234
234
|
tablet: "12"
|
|
235
235
|
}, renderColorBlock(system))), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(GridColumn, {
|
|
@@ -238,7 +238,7 @@ var Colors = function Colors() {
|
|
|
238
238
|
tablet: "12"
|
|
239
239
|
}, renderColorBlock(gradientColors)), /*#__PURE__*/React.createElement(GridColumn, {
|
|
240
240
|
all: "3",
|
|
241
|
-
leftOffsetWide: "
|
|
241
|
+
leftOffsetWide: "2",
|
|
242
242
|
leftOffsetTablet: "1",
|
|
243
243
|
leftOffsetDesktop: "1",
|
|
244
244
|
mobile: "12",
|
|
@@ -9,6 +9,7 @@ export interface IAccordionProps extends IFilterDataAttrs {
|
|
|
9
9
|
/** Состояние открытости */
|
|
10
10
|
isOpened?: boolean;
|
|
11
11
|
/** Вертикальные отступы */
|
|
12
|
+
/** @deprecated */
|
|
12
13
|
hasVerticalPaddings?: boolean;
|
|
13
14
|
/** Дополнительный класс для корневого элемента */
|
|
14
15
|
className?: string;
|
|
@@ -53,7 +53,7 @@ var Accordion = function Accordion(_ref) {
|
|
|
53
53
|
}, [isOpened]);
|
|
54
54
|
|
|
55
55
|
var handleClickTitle = function handleClickTitle() {
|
|
56
|
-
onClickAccordion
|
|
56
|
+
onClickAccordion === null || onClickAccordion === void 0 ? void 0 : onClickAccordion(!isOpenedState, title);
|
|
57
57
|
setIsOpenedState(!isOpenedState);
|
|
58
58
|
};
|
|
59
59
|
|
|
@@ -87,7 +87,9 @@ Accordion.propTypes = {
|
|
|
87
87
|
}), PropTypes.any])]),
|
|
88
88
|
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node, PropTypes.arrayOf(PropTypes.node)]).isRequired,
|
|
89
89
|
isOpened: PropTypes.bool,
|
|
90
|
-
hasVerticalPaddings:
|
|
90
|
+
hasVerticalPaddings: function hasVerticalPaddings(props, propName) {
|
|
91
|
+
return props[propName] && new Error('Failed prop type: Prop "hasVerticalPaddings" is deprecated');
|
|
92
|
+
},
|
|
91
93
|
className: PropTypes.string,
|
|
92
94
|
classes: PropTypes.shape({
|
|
93
95
|
openedClass: PropTypes.string,
|
|
@@ -41,6 +41,11 @@ h5 {
|
|
|
41
41
|
-webkit-transform: translateY(-50%);
|
|
42
42
|
transform: translateY(-50%);
|
|
43
43
|
}
|
|
44
|
+
@media screen and (max-width: 767px) {
|
|
45
|
+
.mfui-banner__arrow {
|
|
46
|
+
display: none;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
44
49
|
.mfui-banner__arrow_prev {
|
|
45
50
|
left: 12px;
|
|
46
51
|
}
|
|
@@ -105,6 +110,29 @@ h5 {
|
|
|
105
110
|
.mfui-banner__pagination_theme_dark {
|
|
106
111
|
background-color: rgba(0, 0, 0, 0.25);
|
|
107
112
|
}
|
|
113
|
+
.mfui-banner__pagination_bottom-offset {
|
|
114
|
+
bottom: 60px;
|
|
115
|
+
}
|
|
116
|
+
@media screen and (min-width: 768px) and (max-width: 1023px) {
|
|
117
|
+
.mfui-banner__pagination_bottom-offset {
|
|
118
|
+
bottom: 89px;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
@media screen and (min-width: 1024px) and (max-width: 1279px) {
|
|
122
|
+
.mfui-banner__pagination_bottom-offset {
|
|
123
|
+
bottom: 90px;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
@media screen and (min-width: 1280px) and (max-width: 1439px) {
|
|
127
|
+
.mfui-banner__pagination_bottom-offset {
|
|
128
|
+
bottom: 65px;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
@media screen and (min-width: 1440px) {
|
|
132
|
+
.mfui-banner__pagination_bottom-offset {
|
|
133
|
+
bottom: 72px;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
108
136
|
.mfui-banner__dot {
|
|
109
137
|
width: 12px;
|
|
110
138
|
height: 12px;
|
|
@@ -16,6 +16,8 @@ export interface IBannerProps {
|
|
|
16
16
|
slide?: string;
|
|
17
17
|
arrow?: string;
|
|
18
18
|
};
|
|
19
|
+
/** Предполагается использование с наезжанием на баннер следующего за баннером элемента */
|
|
20
|
+
withPaginationBottomOffset?: boolean;
|
|
19
21
|
/** Автоматическая прокрутка */
|
|
20
22
|
autoPlay?: boolean;
|
|
21
23
|
/** Задержка автоматической прокрутки */
|
|
@@ -32,6 +32,8 @@ var Banner = function Banner(_ref) {
|
|
|
32
32
|
var className = _ref.className,
|
|
33
33
|
_ref$classes = _ref.classes,
|
|
34
34
|
classes = _ref$classes === void 0 ? {} : _ref$classes,
|
|
35
|
+
_ref$withPaginationBo = _ref.withPaginationBottomOffset,
|
|
36
|
+
withPaginationBottomOffset = _ref$withPaginationBo === void 0 ? false : _ref$withPaginationBo,
|
|
35
37
|
_ref$autoPlay = _ref.autoPlay,
|
|
36
38
|
autoPlay = _ref$autoPlay === void 0 ? false : _ref$autoPlay,
|
|
37
39
|
_ref$autoPlayDelay = _ref.autoPlayDelay,
|
|
@@ -83,7 +85,8 @@ var Banner = function Banner(_ref) {
|
|
|
83
85
|
return;
|
|
84
86
|
}
|
|
85
87
|
|
|
86
|
-
autoplay.stop();
|
|
88
|
+
autoplay.stop(); // eslint-disable-next-line no-param-reassign
|
|
89
|
+
|
|
87
90
|
params.autoplay.delay = autoPlayDelay * 3;
|
|
88
91
|
autoplay.start();
|
|
89
92
|
}, [autoPlayDelay]);
|
|
@@ -93,18 +96,18 @@ var Banner = function Banner(_ref) {
|
|
|
93
96
|
}
|
|
94
97
|
|
|
95
98
|
swiperInstance.slidePrev();
|
|
96
|
-
onPrevClick
|
|
99
|
+
onPrevClick === null || onPrevClick === void 0 ? void 0 : onPrevClick(swiperInstance.realIndex);
|
|
97
100
|
increaseAutoplayDelay(swiperInstance);
|
|
98
|
-
}, [swiperInstance, onPrevClick]);
|
|
101
|
+
}, [swiperInstance, onPrevClick, increaseAutoplayDelay]);
|
|
99
102
|
var handleNextClick = React.useCallback(function () {
|
|
100
103
|
if (!swiperInstance) {
|
|
101
104
|
return;
|
|
102
105
|
}
|
|
103
106
|
|
|
104
107
|
swiperInstance.slideNext();
|
|
105
|
-
onNextClick
|
|
108
|
+
onNextClick === null || onNextClick === void 0 ? void 0 : onNextClick(swiperInstance.realIndex);
|
|
106
109
|
increaseAutoplayDelay(swiperInstance);
|
|
107
|
-
}, [swiperInstance, onNextClick]);
|
|
110
|
+
}, [swiperInstance, onNextClick, increaseAutoplayDelay]);
|
|
108
111
|
var handleDotClick = React.useCallback(function (index) {
|
|
109
112
|
if (!swiperInstance) {
|
|
110
113
|
return;
|
|
@@ -116,9 +119,9 @@ var Banner = function Banner(_ref) {
|
|
|
116
119
|
swiperInstance.slideTo(index);
|
|
117
120
|
}
|
|
118
121
|
|
|
119
|
-
onDotClick
|
|
122
|
+
onDotClick === null || onDotClick === void 0 ? void 0 : onDotClick(swiperInstance.realIndex);
|
|
120
123
|
increaseAutoplayDelay(swiperInstance);
|
|
121
|
-
}, [swiperInstance, loop, onDotClick]);
|
|
124
|
+
}, [swiperInstance, loop, onDotClick, increaseAutoplayDelay]);
|
|
122
125
|
var handleSwiper = React.useCallback(function (swiper) {
|
|
123
126
|
setSwiperInstance(swiper);
|
|
124
127
|
}, []);
|
|
@@ -141,8 +144,8 @@ var Banner = function Banner(_ref) {
|
|
|
141
144
|
var handleSlideChange = React.useCallback(function (_ref4) {
|
|
142
145
|
var realIndex = _ref4.realIndex;
|
|
143
146
|
setActiveIndex(realIndex);
|
|
144
|
-
onChange
|
|
145
|
-
}, []);
|
|
147
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(realIndex);
|
|
148
|
+
}, [onChange]);
|
|
146
149
|
var handleAutoplayStop = React.useCallback(function () {
|
|
147
150
|
setAutoPlayning(false);
|
|
148
151
|
}, []);
|
|
@@ -183,7 +186,8 @@ var Banner = function Banner(_ref) {
|
|
|
183
186
|
theme: navArrowTheme
|
|
184
187
|
}), /*#__PURE__*/React.createElement("div", {
|
|
185
188
|
className: cn('pagination', {
|
|
186
|
-
theme: navTheme
|
|
189
|
+
theme: navTheme,
|
|
190
|
+
'bottom-offset': withPaginationBottomOffset
|
|
187
191
|
})
|
|
188
192
|
}, React.Children.map(children, function (_, i) {
|
|
189
193
|
return /*#__PURE__*/React.createElement(BannerDot, {
|
|
@@ -204,6 +208,7 @@ Banner.propTypes = {
|
|
|
204
208
|
classes: PropTypes.shape({
|
|
205
209
|
slide: PropTypes.string
|
|
206
210
|
}),
|
|
211
|
+
withPaginationBottomOffset: PropTypes.bool,
|
|
207
212
|
autoPlay: PropTypes.bool,
|
|
208
213
|
autoPlayDelay: PropTypes.number,
|
|
209
214
|
navTheme: PropTypes.oneOf(Object.values(NavTheme)),
|
|
@@ -96,7 +96,7 @@ var Button = function Button(_ref) {
|
|
|
96
96
|
return;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
onClick
|
|
99
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
100
100
|
}, [disabled, onClick]);
|
|
101
101
|
var currentTheme = React.useMemo(function () {
|
|
102
102
|
return type === ButtonTypes.PRIMARY && theme === ButtonThemes.BLACK ? ButtonThemes.GREEN : theme;
|
|
@@ -152,7 +152,7 @@ var Button = function Button(_ref) {
|
|
|
152
152
|
sizeTablet: sizeTablet && getLoaderSize(sizeTablet),
|
|
153
153
|
sizeMobile: sizeMobile && getLoaderSize(sizeMobile)
|
|
154
154
|
});
|
|
155
|
-
}, [sizeAll, sizeWide, sizeDesktop, sizeTablet, sizeMobile]);
|
|
155
|
+
}, [sizeAll, sizeWide, sizeDesktop, sizeTablet, sizeMobile, loaderColor]);
|
|
156
156
|
|
|
157
157
|
var setRelAttribute = function setRelAttribute() {
|
|
158
158
|
if (ElementType !== 'a') {
|
|
@@ -113,7 +113,7 @@ var Calendar = function Calendar(_ref) {
|
|
|
113
113
|
useEffect(function () {
|
|
114
114
|
var propsStartDate = calendarStateFromProps.startDate;
|
|
115
115
|
setCalendarState(calendarStateFromProps);
|
|
116
|
-
propsStartDate && goToDate(propsStartDate);
|
|
116
|
+
propsStartDate && goToDate(propsStartDate); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
117
117
|
}, [calendarStateFromProps]);
|
|
118
118
|
|
|
119
119
|
var getCalendarState = function getCalendarState(date) {
|
|
@@ -178,7 +178,7 @@ var Calendar = function Calendar(_ref) {
|
|
|
178
178
|
var nextStartDate = nextState.startDate,
|
|
179
179
|
nextEndDate = nextState.endDate;
|
|
180
180
|
setCalendarState(nextState);
|
|
181
|
-
onChange
|
|
181
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(nextStartDate, nextEndDate);
|
|
182
182
|
};
|
|
183
183
|
|
|
184
184
|
var handleDateHover = function handleDateHover(date) {
|
|
@@ -224,6 +224,7 @@ var Calendar = function Calendar(_ref) {
|
|
|
224
224
|
var month = _ref2.month,
|
|
225
225
|
year = _ref2.year;
|
|
226
226
|
|
|
227
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
227
228
|
var _useMonth = useMonth({
|
|
228
229
|
year: year,
|
|
229
230
|
month: month,
|
|
@@ -60,7 +60,7 @@ var Day = function Day(_a) {
|
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
var handleMouseLeave = function handleMouseLeave() {
|
|
63
|
-
onMouseLeave
|
|
63
|
+
onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave();
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
return /*#__PURE__*/React.createElement("button", {
|
|
@@ -122,7 +122,8 @@ var Carousel = function Carousel(_ref) {
|
|
|
122
122
|
return;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
autoplay.stop();
|
|
125
|
+
autoplay.stop(); // eslint-disable-next-line no-param-reassign
|
|
126
|
+
|
|
126
127
|
params.autoplay.delay = autoPlayDelay * 3;
|
|
127
128
|
autoplay.start();
|
|
128
129
|
}, [autoPlayDelay]);
|
|
@@ -132,7 +133,7 @@ var Carousel = function Carousel(_ref) {
|
|
|
132
133
|
}
|
|
133
134
|
|
|
134
135
|
swiperInstance.slidePrev();
|
|
135
|
-
onPrevClick
|
|
136
|
+
onPrevClick === null || onPrevClick === void 0 ? void 0 : onPrevClick(swiperInstance.realIndex);
|
|
136
137
|
increaseAutoplayDelay(swiperInstance);
|
|
137
138
|
}, [swiperInstance, onPrevClick, increaseAutoplayDelay]);
|
|
138
139
|
var handleNextClick = React.useCallback(function () {
|
|
@@ -141,14 +142,14 @@ var Carousel = function Carousel(_ref) {
|
|
|
141
142
|
}
|
|
142
143
|
|
|
143
144
|
swiperInstance.slideNext();
|
|
144
|
-
onNextClick
|
|
145
|
+
onNextClick === null || onNextClick === void 0 ? void 0 : onNextClick(swiperInstance.realIndex);
|
|
145
146
|
increaseAutoplayDelay(swiperInstance);
|
|
146
147
|
}, [swiperInstance, onNextClick, increaseAutoplayDelay]);
|
|
147
148
|
var handleSwiper = React.useCallback(function (swiper) {
|
|
148
149
|
setSwiperInstance(swiper);
|
|
149
150
|
setLocked(swiper.isBeginning && swiper.isEnd);
|
|
150
|
-
getSwiper
|
|
151
|
-
}, []);
|
|
151
|
+
getSwiper === null || getSwiper === void 0 ? void 0 : getSwiper(swiper);
|
|
152
|
+
}, [getSwiper]);
|
|
152
153
|
var handleReachBeginnig = React.useCallback(function () {
|
|
153
154
|
setBeginning(true);
|
|
154
155
|
}, []);
|
|
@@ -169,7 +170,7 @@ var Carousel = function Carousel(_ref) {
|
|
|
169
170
|
var realIndex = _ref4.realIndex,
|
|
170
171
|
previousIndex = _ref4.previousIndex,
|
|
171
172
|
params = _ref4.params;
|
|
172
|
-
onChange
|
|
173
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(realIndex, previousIndex, params.slidesPerView);
|
|
173
174
|
}, [onChange]);
|
|
174
175
|
|
|
175
176
|
var handleRootClick = function handleRootClick(e) {
|
|
@@ -182,15 +183,17 @@ var Carousel = function Carousel(_ref) {
|
|
|
182
183
|
}; // https://github.com/nolimits4web/Swiper/issues/2346
|
|
183
184
|
|
|
184
185
|
|
|
185
|
-
var handleSwiperResize = React.useCallback(
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
186
|
+
var handleSwiperResize = React.useCallback(function () {
|
|
187
|
+
throttle(function (swiper) {
|
|
188
|
+
setBeginning(swiper.isBeginning);
|
|
189
|
+
setEnd(swiper.isEnd);
|
|
190
|
+
setLocked(swiper.isBeginning && swiper.isEnd);
|
|
189
191
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
192
|
+
if (swiper.params.slidesPerView === SlidesPerView.AUTO) {
|
|
193
|
+
swiper.slides.css('width', '');
|
|
194
|
+
}
|
|
195
|
+
}, throttleTime.resize);
|
|
196
|
+
}, []);
|
|
194
197
|
|
|
195
198
|
var handleSlideFocus = function handleSlideFocus(index) {
|
|
196
199
|
return function (e) {
|
|
@@ -30,7 +30,7 @@ export interface ICheckboxProps extends IFilterDataAttrs {
|
|
|
30
30
|
/** Обработчик изменения значения */
|
|
31
31
|
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
32
32
|
}
|
|
33
|
-
declare class Checkbox extends React.Component<ICheckboxProps
|
|
33
|
+
declare class Checkbox extends React.Component<ICheckboxProps> {
|
|
34
34
|
static propTypes: {
|
|
35
35
|
className: PropTypes.Requireable<string>;
|
|
36
36
|
fontSize: PropTypes.Requireable<string>;
|
|
@@ -44,7 +44,7 @@ var Checkbox = /*#__PURE__*/function (_React$Component) {
|
|
|
44
44
|
|
|
45
45
|
_this.handleChange = function (e) {
|
|
46
46
|
var onChange = _this.props.onChange;
|
|
47
|
-
onChange
|
|
47
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
return _this;
|
|
@@ -56,15 +56,15 @@ var Counter = function Counter(_ref) {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
if (inputValue < min) {
|
|
59
|
-
onChange
|
|
59
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(min);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
if (inputValue > max) {
|
|
63
|
-
onChange
|
|
63
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(max);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
if (inputValue >= min && inputValue <= max) {
|
|
67
|
-
onChange
|
|
67
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(inputValue);
|
|
68
68
|
}
|
|
69
69
|
}, [min, max, onChange, isControlled]);
|
|
70
70
|
var handleMinusClick = React.useCallback(function () {
|
|
@@ -18,7 +18,7 @@ interface IHeaderProps extends IFilterDataAttrs {
|
|
|
18
18
|
/** Обработчик клика */
|
|
19
19
|
onClick?: (e: React.SyntheticEvent<EventTarget>) => void;
|
|
20
20
|
}
|
|
21
|
-
declare class Header extends React.Component<IHeaderProps
|
|
21
|
+
declare class Header extends React.Component<IHeaderProps> {
|
|
22
22
|
static propTypes: {
|
|
23
23
|
as: PropTypes.Requireable<string>;
|
|
24
24
|
color: PropTypes.Requireable<string>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
export interface ILinkProps {
|
|
3
3
|
/** Дополнительный класс корневого элемента */
|
|
4
4
|
className?: string;
|
|
@@ -8,10 +8,14 @@ export interface ILinkProps {
|
|
|
8
8
|
target?: '_self' | '_blank' | '_parent' | '_top';
|
|
9
9
|
/** rel - аргумент тега <a> */
|
|
10
10
|
rel?: string;
|
|
11
|
-
/** Обработчик клика */
|
|
12
|
-
onClick?: (e: React.MouseEvent<EventTarget>) => void;
|
|
13
11
|
/** Добавление атрибута download */
|
|
14
12
|
download?: boolean;
|
|
13
|
+
/** Дата атрибуты для элемента */
|
|
14
|
+
dataAttrs?: {
|
|
15
|
+
root?: Record<string, string>;
|
|
16
|
+
};
|
|
17
|
+
/** Обработчик клика */
|
|
18
|
+
onClick?: (e: React.MouseEvent<EventTarget>) => void;
|
|
15
19
|
children?: JSX.Element[] | Element[] | JSX.Element | string | Element | React.ReactNode;
|
|
16
20
|
}
|
|
17
21
|
declare const Link: React.FC<ILinkProps>;
|
|
@@ -1,12 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { filterDataAttrs } from '@megafon/ui-helpers';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
3
5
|
|
|
4
|
-
var Link = function Link(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
var Link = function Link(_ref) {
|
|
7
|
+
var target = _ref.target,
|
|
8
|
+
href = _ref.href,
|
|
9
|
+
rel = _ref.rel,
|
|
10
|
+
onClick = _ref.onClick,
|
|
11
|
+
className = _ref.className,
|
|
12
|
+
download = _ref.download,
|
|
13
|
+
children = _ref.children,
|
|
14
|
+
dataAttrs = _ref.dataAttrs;
|
|
15
|
+
return /*#__PURE__*/React.createElement("a", _extends({
|
|
16
|
+
className: className,
|
|
17
|
+
href: href,
|
|
18
|
+
target: target,
|
|
19
|
+
rel: rel,
|
|
20
|
+
download: download,
|
|
21
|
+
onClick: onClick
|
|
22
|
+
}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root)), children);
|
|
10
23
|
};
|
|
11
24
|
|
|
12
25
|
Link.propTypes = {
|
|
@@ -17,7 +17,7 @@ var PaginationButton = function PaginationButton(_ref) {
|
|
|
17
17
|
value = _ref.value;
|
|
18
18
|
|
|
19
19
|
var handleClick = function handleClick() {
|
|
20
|
-
onClick
|
|
20
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(value);
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
return /*#__PURE__*/React.createElement("button", {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const getRange: (from:
|
|
1
|
+
declare const getRange: (from: number, to: number, step?: number) => number[];
|
|
2
2
|
export default getRange;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { IFilterDataAttrs } from '@megafon/ui-helpers';
|
|
2
3
|
import * as PropTypes from 'prop-types';
|
|
3
4
|
import './RadioButton.less';
|
|
4
|
-
export interface IRadioButtonProps {
|
|
5
|
+
export interface IRadioButtonProps extends IFilterDataAttrs {
|
|
5
6
|
/** Значение */
|
|
6
7
|
value: string;
|
|
7
8
|
/** Имя для тега form */
|
|
@@ -44,6 +45,9 @@ declare class RadioButton extends React.Component<IRadioButtonProps> {
|
|
|
44
45
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
45
46
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
46
47
|
inputRef: PropTypes.Requireable<any>;
|
|
48
|
+
dataAttrs: PropTypes.Requireable<{
|
|
49
|
+
[x: string]: string;
|
|
50
|
+
}>;
|
|
47
51
|
};
|
|
48
52
|
static defaultProps: Partial<IRadioButtonProps>;
|
|
49
53
|
handleChange: () => void;
|
|
@@ -18,7 +18,7 @@ function _createSuper(Derived) { return function () { var Super = _getPrototypeO
|
|
|
18
18
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
19
19
|
|
|
20
20
|
import * as React from 'react';
|
|
21
|
-
import { cnCreate } from '@megafon/ui-helpers';
|
|
21
|
+
import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
|
|
22
22
|
import * as PropTypes from 'prop-types';
|
|
23
23
|
import "./RadioButton.css";
|
|
24
24
|
var cn = cnCreate('mfui-radio-button');
|
|
@@ -39,7 +39,7 @@ var RadioButton = /*#__PURE__*/function (_React$Component) {
|
|
|
39
39
|
var _this$props = _this.props,
|
|
40
40
|
onChange = _this$props.onChange,
|
|
41
41
|
value = _this$props.value;
|
|
42
|
-
onChange
|
|
42
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
return _this;
|
|
@@ -58,14 +58,15 @@ var RadioButton = /*#__PURE__*/function (_React$Component) {
|
|
|
58
58
|
inputRef = _this$props2.inputRef,
|
|
59
59
|
className = _this$props2.className,
|
|
60
60
|
_this$props2$classes = _this$props2.classes,
|
|
61
|
-
classes = _this$props2$classes === void 0 ? {} : _this$props2$classes
|
|
61
|
+
classes = _this$props2$classes === void 0 ? {} : _this$props2$classes,
|
|
62
|
+
dataAttrs = _this$props2.dataAttrs;
|
|
62
63
|
var checkedProp = isChecked !== undefined ? {
|
|
63
64
|
checked: isChecked
|
|
64
65
|
} : {};
|
|
65
66
|
var rootClassNames = Array.isArray(className) ? [].concat(_toConsumableArray(className), [classes.root]) : [className, classes.root];
|
|
66
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
67
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
67
68
|
className: cn(rootClassNames)
|
|
68
|
-
}, /*#__PURE__*/React.createElement("label", {
|
|
69
|
+
}, filterDataAttrs(dataAttrs)), /*#__PURE__*/React.createElement("label", {
|
|
69
70
|
className: cn('label', {
|
|
70
71
|
disabled: disabled
|
|
71
72
|
}, classes.label)
|
|
@@ -107,7 +108,8 @@ RadioButton.propTypes = {
|
|
|
107
108
|
onChange: PropTypes.func,
|
|
108
109
|
inputRef: PropTypes.oneOfType([PropTypes.func, PropTypes.oneOfType([PropTypes.shape({
|
|
109
110
|
current: PropTypes.elementType
|
|
110
|
-
}), PropTypes.any])])
|
|
111
|
+
}), PropTypes.any])]),
|
|
112
|
+
dataAttrs: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
111
113
|
};
|
|
112
114
|
RadioButton.defaultProps = {
|
|
113
115
|
textSize: 'medium',
|
|
@@ -72,7 +72,7 @@ var Search = function Search(_ref) {
|
|
|
72
72
|
setActiveIndex(-1);
|
|
73
73
|
|
|
74
74
|
if (changeDelay === 0) {
|
|
75
|
-
onChange
|
|
75
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(inputValue);
|
|
76
76
|
} else {
|
|
77
77
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
78
78
|
// @ts-ignore
|
|
@@ -93,7 +93,7 @@ var Search = function Search(_ref) {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
var chosenValue = items[index].value;
|
|
96
|
-
onSubmit
|
|
96
|
+
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(chosenValue);
|
|
97
97
|
}, [disabled, items, onSubmit]);
|
|
98
98
|
var handleSelectSubmit = React.useCallback(function () {
|
|
99
99
|
return function () {
|
|
@@ -105,7 +105,7 @@ var Search = function Search(_ref) {
|
|
|
105
105
|
}, []);
|
|
106
106
|
var handleBlur = React.useCallback(function (e) {
|
|
107
107
|
setFocus(false);
|
|
108
|
-
onBlur
|
|
108
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
109
109
|
}, [onBlur]);
|
|
110
110
|
var handleClick = React.useCallback(function () {
|
|
111
111
|
if (activeIndex >= 0) {
|
|
@@ -125,6 +125,7 @@ var Search = function Search(_ref) {
|
|
|
125
125
|
e.preventDefault();
|
|
126
126
|
} else if (e.key === 'Enter' && activeIndex > -1) {
|
|
127
127
|
handleItemSubmit(activeIndex);
|
|
128
|
+
e.preventDefault();
|
|
128
129
|
} else if (e.key === 'Enter' && activeIndex === -1) {
|
|
129
130
|
handleSearchSubmit();
|
|
130
131
|
}
|
|
@@ -138,9 +138,9 @@ declare class Select<T extends SelectItemValueType> extends React.Component<ISel
|
|
|
138
138
|
handleChangeCombobox: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
139
139
|
handleKeyDown: (e: React.KeyboardEvent<HTMLDivElement>) => boolean;
|
|
140
140
|
highlightString: (title: string, view?: string | Element | JSX.Element | JSX.Element[] | Element[] | ((data: ViewCallbackArguments) => ElementOrString) | undefined) => ElementOrString;
|
|
141
|
-
getItemWrapper: (node:
|
|
142
|
-
getSelectNode: (node:
|
|
143
|
-
getNodeList: (node:
|
|
141
|
+
getItemWrapper: (node: HTMLDivElement) => void;
|
|
142
|
+
getSelectNode: (node: HTMLDivElement) => void;
|
|
143
|
+
getNodeList: (node: HTMLDivElement) => void;
|
|
144
144
|
scrollList(activeIndex: number): void;
|
|
145
145
|
renderTitle(): JSX.Element;
|
|
146
146
|
renderCombobox(): JSX.Element;
|