@megafon/ui-core 2.3.0 → 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 +16 -0
- package/dist/es/colors/Colors.d.ts +2 -2
- package/dist/es/components/Accordion/Accordion.js +1 -1
- 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.js +1 -1
- package/dist/es/components/Search/Search.js +3 -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 +10 -9
- package/dist/es/components/TextField/TextField.js +9 -9
- package/dist/es/components/Tile/Tile.js +1 -1
- package/dist/es/components/Tooltip/Tooltip.js +17 -17
- package/dist/lib/colors/Colors.d.ts +2 -2
- package/dist/lib/components/Accordion/Accordion.js +1 -1
- 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.js +1 -1
- package/dist/lib/components/Search/Search.js +3 -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 +10 -9
- package/dist/lib/components/TextField/TextField.js +9 -9
- package/dist/lib/components/Tile/Tile.js +1 -1
- package/dist/lib/components/Tooltip/Tooltip.js +17 -17
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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
|
+
|
|
6
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)
|
|
7
23
|
|
|
8
24
|
|
|
@@ -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
|
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -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) {
|
|
@@ -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;
|
|
@@ -89,12 +89,12 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
89
89
|
|
|
90
90
|
_this.handleOpened = function () {
|
|
91
91
|
var onOpened = _this.props.onOpened;
|
|
92
|
-
onOpened
|
|
92
|
+
onOpened === null || onOpened === void 0 ? void 0 : onOpened();
|
|
93
93
|
};
|
|
94
94
|
|
|
95
95
|
_this.handleClosed = function () {
|
|
96
96
|
var onClosed = _this.props.onClosed;
|
|
97
|
-
onClosed
|
|
97
|
+
onClosed === null || onClosed === void 0 ? void 0 : onClosed();
|
|
98
98
|
};
|
|
99
99
|
|
|
100
100
|
_this.handleClickOutside = function (e) {
|
|
@@ -153,7 +153,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
153
153
|
isChoosenItem: true
|
|
154
154
|
});
|
|
155
155
|
|
|
156
|
-
onSelect
|
|
156
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(e, item);
|
|
157
157
|
|
|
158
158
|
_this.handleClosed();
|
|
159
159
|
};
|
|
@@ -193,7 +193,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
193
193
|
var filterValue = e.target.value;
|
|
194
194
|
|
|
195
195
|
if (isChoosenItem) {
|
|
196
|
-
onSelect
|
|
196
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(null);
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
_this.setState({
|
|
@@ -311,7 +311,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
311
311
|
};
|
|
312
312
|
|
|
313
313
|
_this.getNodeList = function (node) {
|
|
314
|
-
|
|
314
|
+
_this.itemsNodeList.push(node);
|
|
315
315
|
};
|
|
316
316
|
|
|
317
317
|
_this.state = {
|
|
@@ -164,11 +164,11 @@ var Tabs = function Tabs(_ref) {
|
|
|
164
164
|
left: left,
|
|
165
165
|
right: documentWidth - right
|
|
166
166
|
});
|
|
167
|
-
}, [
|
|
167
|
+
}, [sticky]);
|
|
168
168
|
var handleTabInnerClick = React.useCallback(function (index) {
|
|
169
169
|
return function () {
|
|
170
170
|
setUnderlineTransition('all');
|
|
171
|
-
onTabClick
|
|
171
|
+
onTabClick === null || onTabClick === void 0 ? void 0 : onTabClick(index);
|
|
172
172
|
|
|
173
173
|
if (outerIndex === undefined) {
|
|
174
174
|
setInnerIndex(index);
|
|
@@ -217,7 +217,7 @@ var Tabs = function Tabs(_ref) {
|
|
|
217
217
|
ref: setTabRef
|
|
218
218
|
}, filterDataAttrs(dataAttrs)), renderTabWrapper ? renderTabWrapper(tab) : tab));
|
|
219
219
|
});
|
|
220
|
-
}, [renderTab, children]);
|
|
220
|
+
}, [renderTab, children, activeTabClass, currentIndex, setTabRef, tabClass]);
|
|
221
221
|
var renderPanels = React.useCallback(function () {
|
|
222
222
|
return React.Children.map(children, function (child, i) {
|
|
223
223
|
var panel = child.props.children;
|
|
@@ -233,7 +233,7 @@ var Tabs = function Tabs(_ref) {
|
|
|
233
233
|
})
|
|
234
234
|
}, panel);
|
|
235
235
|
});
|
|
236
|
-
}, [children, currentIndex]);
|
|
236
|
+
}, [children, currentIndex, renderOnlyCurrentPanel]);
|
|
237
237
|
var handleReachBeginning = React.useCallback(function (swiper) {
|
|
238
238
|
setBeginning(swiper.isBeginning);
|
|
239
239
|
}, []);
|
|
@@ -245,6 +245,7 @@ var Tabs = function Tabs(_ref) {
|
|
|
245
245
|
setEnd(swiper.isEnd);
|
|
246
246
|
}, []);
|
|
247
247
|
React.useEffect(function () {
|
|
248
|
+
var rootRefNode = rootRef.current;
|
|
248
249
|
var observer = new IntersectionObserver(function (entries) {
|
|
249
250
|
entries.forEach(function (_ref2) {
|
|
250
251
|
var isIntersecting = _ref2.isIntersecting,
|
|
@@ -253,7 +254,7 @@ var Tabs = function Tabs(_ref) {
|
|
|
253
254
|
left = _ref2$boundingClientR.left,
|
|
254
255
|
right = _ref2$boundingClientR.right;
|
|
255
256
|
|
|
256
|
-
if (!sticky || !
|
|
257
|
+
if (!sticky || !rootRefNode || !tabListRef.current) {
|
|
257
258
|
return;
|
|
258
259
|
}
|
|
259
260
|
|
|
@@ -286,11 +287,11 @@ var Tabs = function Tabs(_ref) {
|
|
|
286
287
|
}, {
|
|
287
288
|
threshold: [0, 1]
|
|
288
289
|
});
|
|
289
|
-
|
|
290
|
+
rootRefNode && observer.observe(rootRefNode);
|
|
290
291
|
return function () {
|
|
291
|
-
|
|
292
|
+
rootRefNode && observer.unobserve(rootRefNode);
|
|
292
293
|
};
|
|
293
|
-
}, [calculateSticky]);
|
|
294
|
+
}, [calculateSticky, sticky]);
|
|
294
295
|
React.useEffect(function () {
|
|
295
296
|
var handleResize = throttle(function () {
|
|
296
297
|
calculateSticky();
|
|
@@ -311,7 +312,7 @@ var Tabs = function Tabs(_ref) {
|
|
|
311
312
|
return function () {
|
|
312
313
|
window.removeEventListener('resize', handleResize);
|
|
313
314
|
};
|
|
314
|
-
}, [calculateUnderline, calculateSticky]);
|
|
315
|
+
}, [calculateUnderline, calculateSticky, currentIndex]);
|
|
315
316
|
React.useEffect(function () {
|
|
316
317
|
if (!swiperInstance) {
|
|
317
318
|
return;
|
|
@@ -150,7 +150,7 @@ var TextField = function TextField(_ref) {
|
|
|
150
150
|
useEffect(function () {
|
|
151
151
|
!isControlled && setInputValue(value);
|
|
152
152
|
checkSymbolMaxLimit(value);
|
|
153
|
-
}, [value, checkSymbolMaxLimit]);
|
|
153
|
+
}, [value, checkSymbolMaxLimit, isControlled]);
|
|
154
154
|
useEffect(function () {
|
|
155
155
|
setTouch(detectTouch());
|
|
156
156
|
}, []);
|
|
@@ -158,7 +158,7 @@ var TextField = function TextField(_ref) {
|
|
|
158
158
|
return setPasswordHidden(function (prevPassState) {
|
|
159
159
|
return !prevPassState;
|
|
160
160
|
});
|
|
161
|
-
}, [
|
|
161
|
+
}, []);
|
|
162
162
|
|
|
163
163
|
var setTextareaHeight = function setTextareaHeight() {
|
|
164
164
|
if (!(fieldNode === null || fieldNode === void 0 ? void 0 : fieldNode.current)) {
|
|
@@ -181,7 +181,7 @@ var TextField = function TextField(_ref) {
|
|
|
181
181
|
|
|
182
182
|
!isControlled && setInputValue(e.target.value);
|
|
183
183
|
checkSymbolMaxLimit(e.target.value);
|
|
184
|
-
onChange
|
|
184
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
185
185
|
};
|
|
186
186
|
|
|
187
187
|
var handleTextareaClick = function handleTextareaClick() {
|
|
@@ -198,18 +198,18 @@ var TextField = function TextField(_ref) {
|
|
|
198
198
|
var isClearFuncAvailable = !customIcon && !onCustomIconClick && verification === ERROR;
|
|
199
199
|
var field = fieldNode.current;
|
|
200
200
|
isPasswordType && togglePasswordHiding();
|
|
201
|
-
onCustomIconClick
|
|
201
|
+
onCustomIconClick === null || onCustomIconClick === void 0 ? void 0 : onCustomIconClick(e);
|
|
202
202
|
|
|
203
203
|
if (!isControlled && isClearFuncAvailable) {
|
|
204
204
|
setInputValue('');
|
|
205
|
-
field
|
|
205
|
+
field === null || field === void 0 ? void 0 : field.focus();
|
|
206
206
|
}
|
|
207
|
-
}, [isPasswordType, togglePasswordHiding, onCustomIconClick, verification,
|
|
207
|
+
}, [isPasswordType, togglePasswordHiding, onCustomIconClick, verification, customIcon, isControlled]);
|
|
208
208
|
var handleFocus = useCallback(function (e) {
|
|
209
|
-
onFocus
|
|
209
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
|
|
210
210
|
}, [onFocus]);
|
|
211
211
|
var handleBlur = useCallback(function (e) {
|
|
212
|
-
onBlur
|
|
212
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
213
213
|
}, [onBlur]);
|
|
214
214
|
var handleBeforeMaskChange = useCallback(function (newState, oldState, inputedValue) {
|
|
215
215
|
return onBeforeMaskChange && onBeforeMaskChange(inputedValue, newState, oldState);
|
|
@@ -256,7 +256,7 @@ var TextField = function TextField(_ref) {
|
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
fieldNode.current = node;
|
|
259
|
-
inputRef
|
|
259
|
+
inputRef === null || inputRef === void 0 ? void 0 : inputRef(node);
|
|
260
260
|
};
|
|
261
261
|
|
|
262
262
|
var getIcon = function getIcon() {
|