@megafon/ui-core 3.0.0-beta.6 → 3.0.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 +51 -67
- package/dist/es/colors/Colors.d.ts +2 -2
- package/dist/es/components/Accordion/Accordion.css +1 -15
- package/dist/es/components/Accordion/Accordion.d.ts +11 -5
- package/dist/es/components/Accordion/Accordion.js +16 -14
- package/dist/es/components/Banner/Banner.css +28 -0
- package/dist/es/components/Banner/Banner.d.ts +12 -0
- package/dist/es/components/Banner/Banner.js +40 -21
- package/dist/es/components/Banner/BannerDot.d.ts +3 -0
- package/dist/es/components/Banner/BannerDot.js +8 -3
- package/dist/es/components/Button/Button.d.ts +8 -2
- package/dist/es/components/Button/Button.js +17 -9
- 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.d.ts +9 -2
- package/dist/es/components/Carousel/Carousel.js +31 -22
- package/dist/es/components/Checkbox/Checkbox.d.ts +8 -2
- package/dist/es/components/Checkbox/Checkbox.js +13 -8
- package/dist/es/components/Collapse/Collapse.d.ts +15 -3
- package/dist/es/components/Collapse/Collapse.js +11 -4
- package/dist/es/components/Counter/Counter.js +3 -3
- package/dist/es/components/Header/Header.d.ts +5 -2
- package/dist/es/components/Header/Header.js +4 -2
- package/dist/es/components/InputLabel/InputLabel.d.ts +3 -0
- package/dist/es/components/InputLabel/InputLabel.js +9 -4
- package/dist/es/components/Link/Link.d.ts +7 -3
- package/dist/es/components/Link/Link.js +26 -10
- package/dist/es/components/Notification/Notification.d.ts +8 -0
- package/dist/es/components/Notification/Notification.js +21 -4
- package/dist/es/components/Pagination/Pagination.d.ts +9 -2
- package/dist/es/components/Pagination/Pagination.js +20 -3
- package/dist/es/components/Pagination/components/PaginationButton/PaginationButton.d.ts +6 -3
- package/dist/es/components/Pagination/components/PaginationButton/PaginationButton.js +12 -7
- package/dist/es/components/Pagination/components/PaginationButtons/PaginationButtons.d.ts +5 -2
- package/dist/es/components/Pagination/components/PaginationButtons/PaginationButtons.js +10 -2
- package/dist/es/components/Pagination/components/PaginationNavigation/PaginationNavigation.d.ts +5 -2
- package/dist/es/components/Pagination/components/PaginationNavigation/PaginationNavigation.js +6 -1
- package/dist/es/components/Pagination/helpers.d.ts +1 -1
- package/dist/es/components/Paragraph/Paragraph.css +0 -9
- package/dist/es/components/Paragraph/Paragraph.d.ts +4 -3
- package/dist/es/components/Paragraph/Paragraph.js +9 -7
- package/dist/es/components/Preloader/Preloader.d.ts +4 -0
- package/dist/es/components/Preloader/Preloader.js +10 -5
- package/dist/es/components/RadioButton/RadioButton.d.ts +7 -2
- package/dist/es/components/RadioButton/RadioButton.js +11 -7
- package/dist/es/components/Search/Search.js +4 -3
- package/dist/es/components/Select/Select.css +5 -2
- package/dist/es/components/Select/Select.d.ts +43 -50
- package/dist/es/components/Select/Select.js +374 -461
- package/dist/es/components/Select/reducer/selectReducer.d.ts +34 -0
- package/dist/es/components/Select/reducer/selectReducer.js +123 -0
- package/dist/es/components/Switcher/Switcher.css +19 -15
- package/dist/es/components/Switcher/Switcher.js +1 -1
- package/dist/es/components/Tabs/Tab.d.ts +5 -2
- package/dist/es/components/Tabs/Tab.js +4 -2
- package/dist/es/components/Tabs/Tabs.d.ts +10 -0
- package/dist/es/components/Tabs/Tabs.js +123 -70
- package/dist/es/components/TextField/TextField.d.ts +11 -1
- package/dist/es/components/TextField/TextField.js +36 -20
- package/dist/es/components/TextLink/TextLink.js +6 -1
- package/dist/es/components/Tile/Tile.d.ts +5 -2
- package/dist/es/components/Tile/Tile.js +2 -2
- package/dist/es/components/Tooltip/Tooltip.d.ts +5 -0
- package/dist/es/components/Tooltip/Tooltip.js +27 -19
- package/dist/es/index.d.ts +1 -0
- package/dist/es/index.js +1 -0
- package/dist/lib/colors/Colors.d.ts +2 -2
- package/dist/lib/components/Accordion/Accordion.css +1 -15
- package/dist/lib/components/Accordion/Accordion.d.ts +11 -5
- package/dist/lib/components/Accordion/Accordion.js +16 -14
- package/dist/lib/components/Banner/Banner.css +28 -0
- package/dist/lib/components/Banner/Banner.d.ts +12 -0
- package/dist/lib/components/Banner/Banner.js +40 -20
- package/dist/lib/components/Banner/BannerDot.d.ts +3 -0
- package/dist/lib/components/Banner/BannerDot.js +10 -2
- package/dist/lib/components/Button/Button.d.ts +8 -2
- package/dist/lib/components/Button/Button.js +17 -9
- 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.d.ts +9 -2
- package/dist/lib/components/Carousel/Carousel.js +29 -20
- package/dist/lib/components/Checkbox/Checkbox.d.ts +8 -2
- package/dist/lib/components/Checkbox/Checkbox.js +13 -8
- package/dist/lib/components/Collapse/Collapse.d.ts +15 -3
- package/dist/lib/components/Collapse/Collapse.js +13 -4
- package/dist/lib/components/Counter/Counter.js +3 -3
- package/dist/lib/components/Header/Header.d.ts +5 -2
- package/dist/lib/components/Header/Header.js +4 -2
- package/dist/lib/components/InputLabel/InputLabel.d.ts +3 -0
- package/dist/lib/components/InputLabel/InputLabel.js +11 -3
- package/dist/lib/components/Link/Link.d.ts +7 -3
- package/dist/lib/components/Link/Link.js +37 -23
- package/dist/lib/components/Notification/Notification.d.ts +8 -0
- package/dist/lib/components/Notification/Notification.js +20 -3
- package/dist/lib/components/Pagination/Pagination.d.ts +9 -2
- package/dist/lib/components/Pagination/Pagination.js +20 -2
- package/dist/lib/components/Pagination/components/PaginationButton/PaginationButton.d.ts +6 -3
- package/dist/lib/components/Pagination/components/PaginationButton/PaginationButton.js +12 -6
- package/dist/lib/components/Pagination/components/PaginationButtons/PaginationButtons.d.ts +5 -2
- package/dist/lib/components/Pagination/components/PaginationButtons/PaginationButtons.js +9 -1
- package/dist/lib/components/Pagination/components/PaginationNavigation/PaginationNavigation.d.ts +5 -2
- package/dist/lib/components/Pagination/components/PaginationNavigation/PaginationNavigation.js +6 -1
- package/dist/lib/components/Pagination/helpers.d.ts +1 -1
- package/dist/lib/components/Paragraph/Paragraph.css +0 -9
- package/dist/lib/components/Paragraph/Paragraph.d.ts +4 -3
- package/dist/lib/components/Paragraph/Paragraph.js +11 -6
- package/dist/lib/components/Preloader/Preloader.d.ts +4 -0
- package/dist/lib/components/Preloader/Preloader.js +10 -4
- package/dist/lib/components/RadioButton/RadioButton.d.ts +7 -2
- package/dist/lib/components/RadioButton/RadioButton.js +11 -7
- package/dist/lib/components/Search/Search.js +4 -3
- package/dist/lib/components/Select/Select.css +5 -2
- package/dist/lib/components/Select/Select.d.ts +43 -50
- package/dist/lib/components/Select/Select.js +368 -484
- package/dist/lib/components/Select/reducer/selectReducer.d.ts +34 -0
- package/dist/lib/components/Select/reducer/selectReducer.js +136 -0
- package/dist/lib/components/Switcher/Switcher.css +19 -15
- package/dist/lib/components/Switcher/Switcher.js +1 -1
- package/dist/lib/components/Tabs/Tab.d.ts +5 -2
- package/dist/lib/components/Tabs/Tab.js +4 -2
- package/dist/lib/components/Tabs/Tabs.d.ts +10 -0
- package/dist/lib/components/Tabs/Tabs.js +123 -70
- package/dist/lib/components/TextField/TextField.d.ts +11 -1
- package/dist/lib/components/TextField/TextField.js +34 -19
- package/dist/lib/components/TextLink/TextLink.js +6 -1
- package/dist/lib/components/Tile/Tile.d.ts +5 -2
- package/dist/lib/components/Tile/Tile.js +2 -2
- package/dist/lib/components/Tooltip/Tooltip.d.ts +5 -0
- package/dist/lib/components/Tooltip/Tooltip.js +26 -18
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +8 -0
- package/package.json +4 -4
|
@@ -11,6 +11,8 @@ require("core-js/modules/es.array.map");
|
|
|
11
11
|
|
|
12
12
|
require("core-js/modules/es.object.values");
|
|
13
13
|
|
|
14
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
|
+
|
|
14
16
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
15
17
|
|
|
16
18
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
@@ -59,6 +61,8 @@ var Banner = function Banner(_ref) {
|
|
|
59
61
|
var className = _ref.className,
|
|
60
62
|
_ref$classes = _ref.classes,
|
|
61
63
|
classes = _ref$classes === void 0 ? {} : _ref$classes,
|
|
64
|
+
_ref$withPaginationBo = _ref.withPaginationBottomOffset,
|
|
65
|
+
withPaginationBottomOffset = _ref$withPaginationBo === void 0 ? false : _ref$withPaginationBo,
|
|
62
66
|
_ref$autoPlay = _ref.autoPlay,
|
|
63
67
|
autoPlay = _ref$autoPlay === void 0 ? false : _ref$autoPlay,
|
|
64
68
|
_ref$autoPlayDelay = _ref.autoPlayDelay,
|
|
@@ -72,7 +76,8 @@ var Banner = function Banner(_ref) {
|
|
|
72
76
|
onNextClick = _ref.onNextClick,
|
|
73
77
|
onPrevClick = _ref.onPrevClick,
|
|
74
78
|
onDotClick = _ref.onDotClick,
|
|
75
|
-
onChange = _ref.onChange
|
|
79
|
+
onChange = _ref.onChange,
|
|
80
|
+
dataAttrs = _ref.dataAttrs;
|
|
76
81
|
|
|
77
82
|
var _React$useState = React.useState(),
|
|
78
83
|
_React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
|
|
@@ -110,7 +115,8 @@ var Banner = function Banner(_ref) {
|
|
|
110
115
|
return;
|
|
111
116
|
}
|
|
112
117
|
|
|
113
|
-
autoplay.stop();
|
|
118
|
+
autoplay.stop(); // eslint-disable-next-line no-param-reassign
|
|
119
|
+
|
|
114
120
|
params.autoplay.delay = autoPlayDelay * 3;
|
|
115
121
|
autoplay.start();
|
|
116
122
|
}, [autoPlayDelay]);
|
|
@@ -120,18 +126,18 @@ var Banner = function Banner(_ref) {
|
|
|
120
126
|
}
|
|
121
127
|
|
|
122
128
|
swiperInstance.slidePrev();
|
|
123
|
-
onPrevClick
|
|
129
|
+
onPrevClick === null || onPrevClick === void 0 ? void 0 : onPrevClick(swiperInstance.realIndex);
|
|
124
130
|
increaseAutoplayDelay(swiperInstance);
|
|
125
|
-
}, [swiperInstance, onPrevClick]);
|
|
131
|
+
}, [swiperInstance, onPrevClick, increaseAutoplayDelay]);
|
|
126
132
|
var handleNextClick = React.useCallback(function () {
|
|
127
133
|
if (!swiperInstance) {
|
|
128
134
|
return;
|
|
129
135
|
}
|
|
130
136
|
|
|
131
137
|
swiperInstance.slideNext();
|
|
132
|
-
onNextClick
|
|
138
|
+
onNextClick === null || onNextClick === void 0 ? void 0 : onNextClick(swiperInstance.realIndex);
|
|
133
139
|
increaseAutoplayDelay(swiperInstance);
|
|
134
|
-
}, [swiperInstance, onNextClick]);
|
|
140
|
+
}, [swiperInstance, onNextClick, increaseAutoplayDelay]);
|
|
135
141
|
var handleDotClick = React.useCallback(function (index) {
|
|
136
142
|
if (!swiperInstance) {
|
|
137
143
|
return;
|
|
@@ -143,9 +149,9 @@ var Banner = function Banner(_ref) {
|
|
|
143
149
|
swiperInstance.slideTo(index);
|
|
144
150
|
}
|
|
145
151
|
|
|
146
|
-
onDotClick
|
|
152
|
+
onDotClick === null || onDotClick === void 0 ? void 0 : onDotClick(swiperInstance.realIndex);
|
|
147
153
|
increaseAutoplayDelay(swiperInstance);
|
|
148
|
-
}, [swiperInstance, loop, onDotClick]);
|
|
154
|
+
}, [swiperInstance, loop, onDotClick, increaseAutoplayDelay]);
|
|
149
155
|
var handleSwiper = React.useCallback(function (swiper) {
|
|
150
156
|
setSwiperInstance(swiper);
|
|
151
157
|
}, []);
|
|
@@ -168,16 +174,16 @@ var Banner = function Banner(_ref) {
|
|
|
168
174
|
var handleSlideChange = React.useCallback(function (_ref4) {
|
|
169
175
|
var realIndex = _ref4.realIndex;
|
|
170
176
|
setActiveIndex(realIndex);
|
|
171
|
-
onChange
|
|
172
|
-
}, []);
|
|
177
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(realIndex);
|
|
178
|
+
}, [onChange]);
|
|
173
179
|
var handleAutoplayStop = React.useCallback(function () {
|
|
174
180
|
setAutoPlayning(false);
|
|
175
181
|
}, []);
|
|
176
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
182
|
+
return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
177
183
|
className: cn({
|
|
178
184
|
'nav-theme': navTheme
|
|
179
185
|
}, className)
|
|
180
|
-
}, /*#__PURE__*/React.createElement(_react2.Swiper, {
|
|
186
|
+
}), /*#__PURE__*/React.createElement(_react2.Swiper, (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.swiper), {
|
|
181
187
|
className: cn('swiper'),
|
|
182
188
|
loop: loop,
|
|
183
189
|
autoplay: autoPlay ? getAutoPlayConfig(autoPlayDelay) : false,
|
|
@@ -188,19 +194,19 @@ var Banner = function Banner(_ref) {
|
|
|
188
194
|
onSlideChange: handleSlideChange,
|
|
189
195
|
onAutoplayStop: handleAutoplayStop,
|
|
190
196
|
onTouchEnd: increaseAutoplayDelay
|
|
191
|
-
}, React.Children.map(children, function (child, i) {
|
|
192
|
-
return /*#__PURE__*/React.createElement(_react2.SwiperSlide, {
|
|
197
|
+
}), React.Children.map(children, function (child, i) {
|
|
198
|
+
return /*#__PURE__*/React.createElement(_react2.SwiperSlide, (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.slide, i + 1), {
|
|
193
199
|
key: i,
|
|
194
200
|
className: cn('slide', classes === null || classes === void 0 ? void 0 : classes.slide)
|
|
195
|
-
}, child);
|
|
196
|
-
})), /*#__PURE__*/React.createElement(_NavArrow["default"], {
|
|
201
|
+
}), child);
|
|
202
|
+
})), /*#__PURE__*/React.createElement(_NavArrow["default"], (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowPrev), {
|
|
197
203
|
className: cn('arrow', {
|
|
198
204
|
prev: true
|
|
199
205
|
}, [classes.arrow]),
|
|
200
206
|
onClick: handlePrevClick,
|
|
201
207
|
disabled: !loop && isBeginning,
|
|
202
208
|
theme: navArrowTheme
|
|
203
|
-
}), /*#__PURE__*/React.createElement(_NavArrow["default"], {
|
|
209
|
+
})), /*#__PURE__*/React.createElement(_NavArrow["default"], (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowNext), {
|
|
204
210
|
className: cn('arrow', {
|
|
205
211
|
next: true
|
|
206
212
|
}, [classes.arrow]),
|
|
@@ -208,12 +214,16 @@ var Banner = function Banner(_ref) {
|
|
|
208
214
|
onClick: handleNextClick,
|
|
209
215
|
disabled: !loop && isEnd,
|
|
210
216
|
theme: navArrowTheme
|
|
211
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
217
|
+
})), /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.pagination), {
|
|
212
218
|
className: cn('pagination', {
|
|
213
|
-
theme: navTheme
|
|
219
|
+
theme: navTheme,
|
|
220
|
+
'bottom-offset': withPaginationBottomOffset
|
|
214
221
|
})
|
|
215
|
-
}, React.Children.map(children, function (_, i) {
|
|
222
|
+
}), React.Children.map(children, function (_, i) {
|
|
216
223
|
return /*#__PURE__*/React.createElement(_BannerDot["default"], {
|
|
224
|
+
dataAttrs: {
|
|
225
|
+
root: (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.dot, i + 1))
|
|
226
|
+
},
|
|
217
227
|
key: i,
|
|
218
228
|
className: cn('dot'),
|
|
219
229
|
index: i,
|
|
@@ -231,6 +241,16 @@ Banner.propTypes = {
|
|
|
231
241
|
classes: PropTypes.shape({
|
|
232
242
|
slide: PropTypes.string
|
|
233
243
|
}),
|
|
244
|
+
withPaginationBottomOffset: PropTypes.bool,
|
|
245
|
+
dataAttrs: PropTypes.shape({
|
|
246
|
+
root: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
247
|
+
swiper: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
248
|
+
slide: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
249
|
+
arrowPrev: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
250
|
+
arrowNext: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
251
|
+
pagination: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
252
|
+
dot: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
253
|
+
}),
|
|
234
254
|
autoPlay: PropTypes.bool,
|
|
235
255
|
autoPlayDelay: PropTypes.number,
|
|
236
256
|
navTheme: PropTypes.oneOf(Object.values(NavTheme)),
|
|
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports["default"] = void 0;
|
|
9
9
|
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
|
|
10
12
|
var React = _interopRequireWildcard(require("react"));
|
|
11
13
|
|
|
12
14
|
var _uiHelpers = require("@megafon/ui-helpers");
|
|
@@ -17,10 +19,13 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
|
|
|
17
19
|
|
|
18
20
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
21
|
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
|
+
|
|
20
24
|
var cn = (0, _uiHelpers.cnCreate)('mfui-banner-dot');
|
|
21
25
|
|
|
22
26
|
var BannerDot = function BannerDot(_ref) {
|
|
23
27
|
var className = _ref.className,
|
|
28
|
+
dataAttrs = _ref.dataAttrs,
|
|
24
29
|
index = _ref.index,
|
|
25
30
|
isActive = _ref.isActive,
|
|
26
31
|
showTimer = _ref.showTimer,
|
|
@@ -29,13 +34,13 @@ var BannerDot = function BannerDot(_ref) {
|
|
|
29
34
|
var handleDotClick = React.useCallback(function () {
|
|
30
35
|
onClick(index);
|
|
31
36
|
}, [onClick, index]);
|
|
32
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
37
|
+
return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
33
38
|
className: cn({
|
|
34
39
|
active: isActive,
|
|
35
40
|
timer: showTimer
|
|
36
41
|
}, className),
|
|
37
42
|
onClick: handleDotClick
|
|
38
|
-
}, showTimer && isActive && /*#__PURE__*/React.createElement("svg", {
|
|
43
|
+
}), showTimer && isActive && /*#__PURE__*/React.createElement("svg", {
|
|
39
44
|
className: cn('timer'),
|
|
40
45
|
viewBox: "0 0 100 100"
|
|
41
46
|
}, /*#__PURE__*/React.createElement("circle", {
|
|
@@ -51,6 +56,9 @@ var BannerDot = function BannerDot(_ref) {
|
|
|
51
56
|
|
|
52
57
|
BannerDot.propTypes = {
|
|
53
58
|
className: PropTypes.string,
|
|
59
|
+
dataAttrs: PropTypes.shape({
|
|
60
|
+
root: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
61
|
+
}),
|
|
54
62
|
index: PropTypes.number.isRequired,
|
|
55
63
|
isActive: PropTypes.bool.isRequired,
|
|
56
64
|
showTimer: PropTypes.bool.isRequired,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { Ref } from 'react';
|
|
2
|
-
import { IFilterDataAttrs } from '@megafon/ui-helpers';
|
|
3
2
|
import './Button.less';
|
|
4
3
|
export declare const ButtonTypes: {
|
|
5
4
|
readonly PRIMARY: "primary";
|
|
@@ -19,7 +18,7 @@ export declare const ButtonSizes: {
|
|
|
19
18
|
readonly LARGE: "large";
|
|
20
19
|
};
|
|
21
20
|
declare type ButtonSizesType = typeof ButtonSizes[keyof typeof ButtonSizes];
|
|
22
|
-
export interface IButtonProps
|
|
21
|
+
export interface IButtonProps {
|
|
23
22
|
/** Дополнительный класс корневого элемента */
|
|
24
23
|
className?: string | string[];
|
|
25
24
|
/** Дополнительные классы для внутренних элементов */
|
|
@@ -31,6 +30,13 @@ export interface IButtonProps extends IFilterDataAttrs {
|
|
|
31
30
|
/** Inner container class */
|
|
32
31
|
inner?: string;
|
|
33
32
|
};
|
|
33
|
+
/** Дополнительные data атрибуты к внутренним элементам */
|
|
34
|
+
dataAttrs?: {
|
|
35
|
+
root?: Record<string, string>;
|
|
36
|
+
content?: Record<string, string>;
|
|
37
|
+
inner?: Record<string, string>;
|
|
38
|
+
loader?: Record<string, string>;
|
|
39
|
+
};
|
|
34
40
|
/** Тема компонента */
|
|
35
41
|
theme?: ButtonThemesType;
|
|
36
42
|
/** Тип компонента */
|
|
@@ -123,7 +123,7 @@ var Button = function Button(_ref) {
|
|
|
123
123
|
return;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
onClick
|
|
126
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
127
127
|
}, [disabled, onClick]);
|
|
128
128
|
|
|
129
129
|
var currentTheme = _react["default"].useMemo(function () {
|
|
@@ -152,16 +152,16 @@ var Button = function Button(_ref) {
|
|
|
152
152
|
return null;
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
155
|
+
return /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.content), {
|
|
156
156
|
className: cn('content', contentClassName)
|
|
157
|
-
}, icon && /*#__PURE__*/_react["default"].createElement("div", {
|
|
157
|
+
}), icon && /*#__PURE__*/_react["default"].createElement("div", {
|
|
158
158
|
className: cn('icon')
|
|
159
159
|
}, icon), children && /*#__PURE__*/_react["default"].createElement("span", {
|
|
160
160
|
className: cn('text')
|
|
161
161
|
}, children), !icon && showArrow && /*#__PURE__*/_react["default"].createElement(Arrow, {
|
|
162
162
|
className: cn('icon-arrow')
|
|
163
163
|
}));
|
|
164
|
-
}, [
|
|
164
|
+
}, [children, icon, dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.content, contentClassName, showArrow]);
|
|
165
165
|
|
|
166
166
|
var contentType = _react["default"].useMemo(function () {
|
|
167
167
|
switch (true) {
|
|
@@ -178,6 +178,9 @@ var Button = function Button(_ref) {
|
|
|
178
178
|
|
|
179
179
|
var renderedLoader = _react["default"].useMemo(function () {
|
|
180
180
|
return /*#__PURE__*/_react["default"].createElement(_Preloader["default"], {
|
|
181
|
+
dataAttrs: {
|
|
182
|
+
root: (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.loader)
|
|
183
|
+
},
|
|
181
184
|
color: loaderColor,
|
|
182
185
|
sizeAll: getLoaderSize(sizeAll),
|
|
183
186
|
sizeWide: sizeWide && getLoaderSize(sizeWide),
|
|
@@ -185,7 +188,7 @@ var Button = function Button(_ref) {
|
|
|
185
188
|
sizeTablet: sizeTablet && getLoaderSize(sizeTablet),
|
|
186
189
|
sizeMobile: sizeMobile && getLoaderSize(sizeMobile)
|
|
187
190
|
});
|
|
188
|
-
}, [sizeAll, sizeWide, sizeDesktop, sizeTablet, sizeMobile]);
|
|
191
|
+
}, [dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.loader, loaderColor, sizeAll, sizeWide, sizeDesktop, sizeTablet, sizeMobile]);
|
|
189
192
|
|
|
190
193
|
var setRelAttribute = function setRelAttribute() {
|
|
191
194
|
if (ElementType !== 'a') {
|
|
@@ -209,7 +212,7 @@ var Button = function Button(_ref) {
|
|
|
209
212
|
setTouch((0, _uiHelpers.detectTouch)());
|
|
210
213
|
}, []);
|
|
211
214
|
|
|
212
|
-
return /*#__PURE__*/_react["default"].createElement(ElementType, (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs), {
|
|
215
|
+
return /*#__PURE__*/_react["default"].createElement(ElementType, (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
213
216
|
className: cn({
|
|
214
217
|
type: type,
|
|
215
218
|
theme: currentTheme,
|
|
@@ -232,9 +235,9 @@ var Button = function Button(_ref) {
|
|
|
232
235
|
onClick: handleClick,
|
|
233
236
|
disabled: !href && disabled,
|
|
234
237
|
ref: buttonRef
|
|
235
|
-
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
238
|
+
}), /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.inner), {
|
|
236
239
|
className: cn('inner', innerClassName)
|
|
237
|
-
}, !showLoader ? renderedContent : renderedLoader));
|
|
240
|
+
}), !showLoader ? renderedContent : renderedLoader));
|
|
238
241
|
};
|
|
239
242
|
|
|
240
243
|
Button.propTypes = {
|
|
@@ -243,6 +246,12 @@ Button.propTypes = {
|
|
|
243
246
|
content: _propTypes["default"].string,
|
|
244
247
|
inner: _propTypes["default"].string
|
|
245
248
|
}),
|
|
249
|
+
dataAttrs: _propTypes["default"].shape({
|
|
250
|
+
root: _propTypes["default"].objectOf(_propTypes["default"].string.isRequired),
|
|
251
|
+
content: _propTypes["default"].objectOf(_propTypes["default"].string.isRequired),
|
|
252
|
+
inner: _propTypes["default"].objectOf(_propTypes["default"].string.isRequired),
|
|
253
|
+
loader: _propTypes["default"].objectOf(_propTypes["default"].string.isRequired)
|
|
254
|
+
}),
|
|
246
255
|
theme: _propTypes["default"].oneOf(Object.values(ButtonThemes)),
|
|
247
256
|
type: _propTypes["default"].oneOf(Object.values(ButtonTypes)),
|
|
248
257
|
href: _propTypes["default"].string,
|
|
@@ -260,7 +269,6 @@ Button.propTypes = {
|
|
|
260
269
|
showArrow: _propTypes["default"].bool,
|
|
261
270
|
icon: _propTypes["default"].element,
|
|
262
271
|
disabled: _propTypes["default"].bool,
|
|
263
|
-
dataAttrs: _propTypes["default"].objectOf(_propTypes["default"].string.isRequired),
|
|
264
272
|
buttonRef: _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
265
273
|
current: _propTypes["default"].elementType
|
|
266
274
|
}), _propTypes["default"].any])]),
|
|
@@ -146,7 +146,7 @@ var Calendar = function Calendar(_ref) {
|
|
|
146
146
|
(0, _react.useEffect)(function () {
|
|
147
147
|
var propsStartDate = calendarStateFromProps.startDate;
|
|
148
148
|
setCalendarState(calendarStateFromProps);
|
|
149
|
-
propsStartDate && goToDate(propsStartDate);
|
|
149
|
+
propsStartDate && goToDate(propsStartDate); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
150
150
|
}, [calendarStateFromProps]);
|
|
151
151
|
|
|
152
152
|
var getCalendarState = function getCalendarState(date) {
|
|
@@ -211,7 +211,7 @@ var Calendar = function Calendar(_ref) {
|
|
|
211
211
|
var nextStartDate = nextState.startDate,
|
|
212
212
|
nextEndDate = nextState.endDate;
|
|
213
213
|
setCalendarState(nextState);
|
|
214
|
-
onChange
|
|
214
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(nextStartDate, nextEndDate);
|
|
215
215
|
};
|
|
216
216
|
|
|
217
217
|
var handleDateHover = function handleDateHover(date) {
|
|
@@ -255,7 +255,7 @@ var Calendar = function Calendar(_ref) {
|
|
|
255
255
|
var renderMonths = function renderMonths() {
|
|
256
256
|
return activeMonths.map(function (_ref2) {
|
|
257
257
|
var month = _ref2.month,
|
|
258
|
-
year = _ref2.year;
|
|
258
|
+
year = _ref2.year; // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
259
259
|
|
|
260
260
|
var _useMonth = (0, _hooks.useMonth)({
|
|
261
261
|
year: year,
|
|
@@ -79,7 +79,7 @@ var Day = function Day(_a) {
|
|
|
79
79
|
};
|
|
80
80
|
|
|
81
81
|
var handleMouseLeave = function handleMouseLeave() {
|
|
82
|
-
onMouseLeave
|
|
82
|
+
onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave();
|
|
83
83
|
};
|
|
84
84
|
|
|
85
85
|
return /*#__PURE__*/_react["default"].createElement("button", {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { IFilterDataAttrs } from '@megafon/ui-helpers';
|
|
3
2
|
import SwiperCore from 'swiper';
|
|
4
3
|
import { PaginationOptions } from 'swiper/types/components/pagination';
|
|
5
4
|
import './Carousel.less';
|
|
@@ -24,7 +23,7 @@ export declare type SlidesSettingsType = {
|
|
|
24
23
|
spaceBetween: number;
|
|
25
24
|
};
|
|
26
25
|
};
|
|
27
|
-
export interface ICarouselProps
|
|
26
|
+
export interface ICarouselProps {
|
|
28
27
|
/** Ссылка на корневой элемент */
|
|
29
28
|
rootRef?: React.Ref<HTMLDivElement>;
|
|
30
29
|
/** Дополнительные классы для корневого элемента */
|
|
@@ -39,6 +38,14 @@ export interface ICarouselProps extends IFilterDataAttrs {
|
|
|
39
38
|
next?: string;
|
|
40
39
|
slide?: string;
|
|
41
40
|
};
|
|
41
|
+
/** Дополнительные data атрибуты к внутренним элементам */
|
|
42
|
+
dataAttrs?: {
|
|
43
|
+
root?: Record<string, string>;
|
|
44
|
+
slider?: Record<string, string>;
|
|
45
|
+
prev?: Record<string, string>;
|
|
46
|
+
next?: Record<string, string>;
|
|
47
|
+
slide?: Record<string, string>;
|
|
48
|
+
};
|
|
42
49
|
/** Настройки слайдов */
|
|
43
50
|
slidesSettings?: SlidesSettingsType;
|
|
44
51
|
/** Смена слайдов с зацикливанием */
|
|
@@ -154,7 +154,8 @@ var Carousel = function Carousel(_ref) {
|
|
|
154
154
|
return;
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
autoplay.stop();
|
|
157
|
+
autoplay.stop(); // eslint-disable-next-line no-param-reassign
|
|
158
|
+
|
|
158
159
|
params.autoplay.delay = autoPlayDelay * 3;
|
|
159
160
|
autoplay.start();
|
|
160
161
|
}, [autoPlayDelay]);
|
|
@@ -164,7 +165,7 @@ var Carousel = function Carousel(_ref) {
|
|
|
164
165
|
}
|
|
165
166
|
|
|
166
167
|
swiperInstance.slidePrev();
|
|
167
|
-
onPrevClick
|
|
168
|
+
onPrevClick === null || onPrevClick === void 0 ? void 0 : onPrevClick(swiperInstance.realIndex);
|
|
168
169
|
increaseAutoplayDelay(swiperInstance);
|
|
169
170
|
}, [swiperInstance, onPrevClick, increaseAutoplayDelay]);
|
|
170
171
|
var handleNextClick = React.useCallback(function () {
|
|
@@ -173,14 +174,14 @@ var Carousel = function Carousel(_ref) {
|
|
|
173
174
|
}
|
|
174
175
|
|
|
175
176
|
swiperInstance.slideNext();
|
|
176
|
-
onNextClick
|
|
177
|
+
onNextClick === null || onNextClick === void 0 ? void 0 : onNextClick(swiperInstance.realIndex);
|
|
177
178
|
increaseAutoplayDelay(swiperInstance);
|
|
178
179
|
}, [swiperInstance, onNextClick, increaseAutoplayDelay]);
|
|
179
180
|
var handleSwiper = React.useCallback(function (swiper) {
|
|
180
181
|
setSwiperInstance(swiper);
|
|
181
182
|
setLocked(swiper.isBeginning && swiper.isEnd);
|
|
182
|
-
getSwiper
|
|
183
|
-
}, []);
|
|
183
|
+
getSwiper === null || getSwiper === void 0 ? void 0 : getSwiper(swiper);
|
|
184
|
+
}, [getSwiper]);
|
|
184
185
|
var handleReachBeginnig = React.useCallback(function () {
|
|
185
186
|
setBeginning(true);
|
|
186
187
|
}, []);
|
|
@@ -201,7 +202,7 @@ var Carousel = function Carousel(_ref) {
|
|
|
201
202
|
var realIndex = _ref4.realIndex,
|
|
202
203
|
previousIndex = _ref4.previousIndex,
|
|
203
204
|
params = _ref4.params;
|
|
204
|
-
onChange
|
|
205
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(realIndex, previousIndex, params.slidesPerView);
|
|
205
206
|
}, [onChange]);
|
|
206
207
|
|
|
207
208
|
var handleRootClick = function handleRootClick(e) {
|
|
@@ -214,13 +215,15 @@ var Carousel = function Carousel(_ref) {
|
|
|
214
215
|
}; // https://github.com/nolimits4web/Swiper/issues/2346
|
|
215
216
|
|
|
216
217
|
|
|
217
|
-
var handleSwiperResize = React.useCallback(
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
218
|
+
var handleSwiperResize = React.useCallback(function () {
|
|
219
|
+
(0, _lodash["default"])(function (swiper) {
|
|
220
|
+
setBeginning(swiper.isBeginning);
|
|
221
|
+
setEnd(swiper.isEnd);
|
|
222
|
+
setLocked(swiper.isBeginning && swiper.isEnd);
|
|
221
223
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
+
if (swiper.params.slidesPerView === SlidesPerView.AUTO) {}
|
|
225
|
+
}, _throttleTime["default"].resize);
|
|
226
|
+
}, []);
|
|
224
227
|
|
|
225
228
|
var handleSlideFocus = function handleSlideFocus(index) {
|
|
226
229
|
return function (e) {
|
|
@@ -245,7 +248,7 @@ var Carousel = function Carousel(_ref) {
|
|
|
245
248
|
e.nativeEvent.preventDefault();
|
|
246
249
|
};
|
|
247
250
|
|
|
248
|
-
return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs), {
|
|
251
|
+
return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
249
252
|
ref: rootRef,
|
|
250
253
|
className: cn({
|
|
251
254
|
'nav-theme': navTheme
|
|
@@ -253,7 +256,7 @@ var Carousel = function Carousel(_ref) {
|
|
|
253
256
|
onClick: handleRootClick
|
|
254
257
|
}), /*#__PURE__*/React.createElement(_react2.Swiper, (0, _extends2["default"])({}, containerModifier ? {
|
|
255
258
|
containerModifierClass: containerModifier
|
|
256
|
-
} : {}, {
|
|
259
|
+
} : {}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.slider), {
|
|
257
260
|
className: cn('swiper', {
|
|
258
261
|
'default-inner-indents': !innerIndentsClass
|
|
259
262
|
}, [innerIndentsClass, containerClass]),
|
|
@@ -283,13 +286,13 @@ var Carousel = function Carousel(_ref) {
|
|
|
283
286
|
onTouchEnd: increaseAutoplayDelay,
|
|
284
287
|
onResize: handleSwiperResize
|
|
285
288
|
}), React.Children.map(children, function (child, i) {
|
|
286
|
-
return /*#__PURE__*/React.createElement(_react2.SwiperSlide, {
|
|
289
|
+
return /*#__PURE__*/React.createElement(_react2.SwiperSlide, (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.slide, i + 1), {
|
|
287
290
|
key: i,
|
|
288
291
|
className: cn('slide', slideClass),
|
|
289
292
|
onFocus: handleSlideFocus(i),
|
|
290
293
|
onMouseDown: disableFocusOnSlideClick
|
|
291
|
-
}, child);
|
|
292
|
-
})), /*#__PURE__*/React.createElement(_NavArrow["default"], {
|
|
294
|
+
}), child);
|
|
295
|
+
})), /*#__PURE__*/React.createElement(_NavArrow["default"], (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.prev), {
|
|
293
296
|
className: cn('arrow', {
|
|
294
297
|
prev: true,
|
|
295
298
|
locked: isLocked
|
|
@@ -297,7 +300,7 @@ var Carousel = function Carousel(_ref) {
|
|
|
297
300
|
onClick: handlePrevClick,
|
|
298
301
|
disabled: !loop && isBeginning,
|
|
299
302
|
theme: _NavArrow.Theme.PURPLE
|
|
300
|
-
}), /*#__PURE__*/React.createElement(_NavArrow["default"], {
|
|
303
|
+
})), /*#__PURE__*/React.createElement(_NavArrow["default"], (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.next), {
|
|
301
304
|
className: cn('arrow', {
|
|
302
305
|
next: true,
|
|
303
306
|
locked: isLocked
|
|
@@ -306,7 +309,7 @@ var Carousel = function Carousel(_ref) {
|
|
|
306
309
|
onClick: handleNextClick,
|
|
307
310
|
disabled: !loop && isEnd,
|
|
308
311
|
theme: _NavArrow.Theme.PURPLE
|
|
309
|
-
}));
|
|
312
|
+
})));
|
|
310
313
|
};
|
|
311
314
|
|
|
312
315
|
Carousel.propTypes = {
|
|
@@ -323,7 +326,13 @@ Carousel.propTypes = {
|
|
|
323
326
|
next: PropTypes.string,
|
|
324
327
|
slide: PropTypes.string
|
|
325
328
|
}),
|
|
326
|
-
dataAttrs: PropTypes.
|
|
329
|
+
dataAttrs: PropTypes.shape({
|
|
330
|
+
root: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
331
|
+
slider: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
332
|
+
prev: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
333
|
+
next: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
334
|
+
slide: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
335
|
+
}),
|
|
327
336
|
slidesSettings: PropTypes.objectOf((0, _checkBreakpointsPropTypes["default"])({
|
|
328
337
|
slidesPerView: PropTypes.oneOfType([PropTypes.number, PropTypes.oneOf(Object.values(SlidesPerView))]).isRequired,
|
|
329
338
|
spaceBetween: PropTypes.number.isRequired,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { IFilterDataAttrs } from '@megafon/ui-helpers';
|
|
3
2
|
import './Checkbox.less';
|
|
4
|
-
export interface ICheckboxProps
|
|
3
|
+
export interface ICheckboxProps {
|
|
5
4
|
/** Цвет чекбокса */
|
|
6
5
|
color?: 'dark' | 'light';
|
|
7
6
|
/** Дополнительный класс корневого элемента */
|
|
@@ -11,6 +10,13 @@ export interface ICheckboxProps extends IFilterDataAttrs {
|
|
|
11
10
|
inner?: string;
|
|
12
11
|
icon?: string;
|
|
13
12
|
};
|
|
13
|
+
/** Дополнительные data атрибуты к внутренним элементам */
|
|
14
|
+
dataAttrs?: {
|
|
15
|
+
root?: Record<string, string>;
|
|
16
|
+
input?: Record<string, string>;
|
|
17
|
+
customInput?: Record<string, string>;
|
|
18
|
+
extraContent?: Record<string, string>;
|
|
19
|
+
};
|
|
14
20
|
/** Размер текста */
|
|
15
21
|
fontSize?: 'regular' | 'small';
|
|
16
22
|
/** Имя компонента в DOM */
|
|
@@ -67,7 +67,7 @@ var Checkbox = function Checkbox(_ref) {
|
|
|
67
67
|
var handleChange = function handleChange(e) {
|
|
68
68
|
if ((0, _uiHelpers.checkEventIsClickOrEnterPress)(e) || e.type === CHANGE_KEY) {
|
|
69
69
|
setIsChecked(!isChecked);
|
|
70
|
-
onChange
|
|
70
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(!isChecked);
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
73
|
|
|
@@ -79,13 +79,13 @@ var Checkbox = function Checkbox(_ref) {
|
|
|
79
79
|
disabled: disabled,
|
|
80
80
|
error: error
|
|
81
81
|
}, className)
|
|
82
|
-
}, (0, _uiHelpers.filterDataAttrs)(dataAttrs)), /*#__PURE__*/_react["default"].createElement("div", {
|
|
82
|
+
}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root)), /*#__PURE__*/_react["default"].createElement("div", {
|
|
83
83
|
className: cn('inner', [classes === null || classes === void 0 ? void 0 : classes.inner])
|
|
84
84
|
}, /*#__PURE__*/_react["default"].createElement("label", {
|
|
85
85
|
className: cn('label', {
|
|
86
86
|
'no-touch': !isTouch
|
|
87
87
|
})
|
|
88
|
-
}, /*#__PURE__*/_react["default"].createElement("input", {
|
|
88
|
+
}, /*#__PURE__*/_react["default"].createElement("input", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.input), {
|
|
89
89
|
className: cn('input'),
|
|
90
90
|
type: "checkbox",
|
|
91
91
|
tabIndex: -1,
|
|
@@ -94,17 +94,17 @@ var Checkbox = function Checkbox(_ref) {
|
|
|
94
94
|
checked: isChecked,
|
|
95
95
|
onChange: handleChange,
|
|
96
96
|
disabled: disabled
|
|
97
|
-
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
97
|
+
})), /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.customInput), {
|
|
98
98
|
tabIndex: 0,
|
|
99
99
|
role: "checkbox",
|
|
100
100
|
"aria-checked": isChecked,
|
|
101
101
|
className: cn('custom-input', [classes === null || classes === void 0 ? void 0 : classes.icon]),
|
|
102
102
|
onKeyDown: handleChange
|
|
103
|
-
}, /*#__PURE__*/_react["default"].createElement(CheckedIcon, {
|
|
103
|
+
}), /*#__PURE__*/_react["default"].createElement(CheckedIcon, {
|
|
104
104
|
className: cn('icon')
|
|
105
|
-
})), children), extraContent && /*#__PURE__*/_react["default"].createElement("span", {
|
|
105
|
+
})), children), extraContent && /*#__PURE__*/_react["default"].createElement("span", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.extraContent), {
|
|
106
106
|
className: cn('extra-content')
|
|
107
|
-
}, extraContent)));
|
|
107
|
+
}), extraContent)));
|
|
108
108
|
};
|
|
109
109
|
|
|
110
110
|
Checkbox.propTypes = {
|
|
@@ -116,9 +116,14 @@ Checkbox.propTypes = {
|
|
|
116
116
|
checked: PropTypes.bool,
|
|
117
117
|
disabled: PropTypes.bool,
|
|
118
118
|
error: PropTypes.bool,
|
|
119
|
+
dataAttrs: PropTypes.shape({
|
|
120
|
+
root: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
121
|
+
input: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
122
|
+
customInput: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
123
|
+
extraContent: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
124
|
+
}),
|
|
119
125
|
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element.isRequired), PropTypes.element, PropTypes.string]).isRequired,
|
|
120
126
|
extraContent: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element.isRequired), PropTypes.element, PropTypes.string]),
|
|
121
|
-
dataAttrs: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
122
127
|
onChange: PropTypes.func
|
|
123
128
|
};
|
|
124
129
|
var _default = Checkbox;
|
|
@@ -1,23 +1,35 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import * as PropTypes from 'prop-types';
|
|
3
|
-
declare type
|
|
3
|
+
declare type CollapseDefaultProps = {
|
|
4
4
|
animation?: boolean;
|
|
5
5
|
animationDuration?: number;
|
|
6
6
|
};
|
|
7
|
-
declare type
|
|
7
|
+
declare type CollapseProps = CollapseDefaultProps & {
|
|
8
8
|
className: string;
|
|
9
9
|
classNameContainer: string;
|
|
10
10
|
isOpened: boolean;
|
|
11
|
+
dataAttrs?: {
|
|
12
|
+
root?: Record<string, string>;
|
|
13
|
+
inner?: Record<string, string>;
|
|
14
|
+
};
|
|
11
15
|
children: React.ReactNode;
|
|
12
16
|
};
|
|
13
17
|
declare const Collapse: {
|
|
14
|
-
(props:
|
|
18
|
+
(props: CollapseProps): React.FunctionComponentElement<CollapseProps>;
|
|
15
19
|
propTypes: {
|
|
16
20
|
className: PropTypes.Requireable<string>;
|
|
17
21
|
classNameContainer: PropTypes.Requireable<string>;
|
|
18
22
|
isOpened: PropTypes.Validator<boolean>;
|
|
19
23
|
animationDuration: PropTypes.Requireable<number>;
|
|
20
24
|
animation: PropTypes.Requireable<boolean>;
|
|
25
|
+
dataAttrs: PropTypes.Requireable<PropTypes.InferProps<{
|
|
26
|
+
root: PropTypes.Requireable<{
|
|
27
|
+
[x: string]: string;
|
|
28
|
+
}>;
|
|
29
|
+
inner: PropTypes.Requireable<{
|
|
30
|
+
[x: string]: string;
|
|
31
|
+
}>;
|
|
32
|
+
}>>;
|
|
21
33
|
children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
|
|
22
34
|
};
|
|
23
35
|
};
|