@megafon/ui-core 3.0.0-beta.3 → 3.0.0-beta.7
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 +63 -0
- package/dist/es/colors/Colors.js +13 -0
- package/dist/es/components/Accordion/Accordion.d.ts +11 -3
- package/dist/es/components/Accordion/Accordion.js +14 -7
- package/dist/es/components/Banner/Banner.d.ts +10 -0
- package/dist/es/components/Banner/Banner.js +25 -11
- 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 +14 -6
- package/dist/es/components/Carousel/Carousel.d.ts +9 -2
- package/dist/es/components/Carousel/Carousel.js +14 -8
- package/dist/es/components/Checkbox/Checkbox.d.ts +8 -2
- package/dist/es/components/Checkbox/Checkbox.js +12 -7
- package/dist/es/components/Collapse/Collapse.d.ts +15 -3
- package/dist/es/components/Collapse/Collapse.js +11 -4
- package/dist/es/components/ContentArea/ContentArea.css +8 -59
- package/dist/es/components/ContentArea/ContentArea.d.ts +2 -6
- package/dist/es/components/ContentArea/ContentArea.js +5 -38
- package/dist/es/components/Counter/Counter.css +0 -47
- package/dist/es/components/Grid/Grid.css +0 -47
- package/dist/es/components/Header/Header.d.ts +6 -20
- package/dist/es/components/Header/Header.js +30 -66
- 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 +6 -2
- package/dist/es/components/Link/Link.js +28 -4
- package/dist/es/components/Notification/Notification.css +0 -47
- 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.css +0 -47
- package/dist/es/components/Pagination/components/PaginationButton/PaginationButton.d.ts +6 -3
- package/dist/es/components/Pagination/components/PaginationButton/PaginationButton.js +11 -6
- 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.css +0 -47
- 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/Paragraph/Paragraph.css +9 -11
- package/dist/es/components/Paragraph/Paragraph.d.ts +12 -12
- package/dist/es/components/Paragraph/Paragraph.js +14 -36
- 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 +8 -28
- package/dist/es/components/RadioButton/RadioButton.js +50 -85
- package/dist/es/components/Select/Select.d.ts +38 -5
- package/dist/es/components/Select/Select.js +50 -34
- 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 +8 -0
- package/dist/es/components/Tabs/Tabs.js +29 -21
- package/dist/es/components/TextField/TextField.d.ts +8 -0
- package/dist/es/components/TextField/TextField.js +22 -10
- package/dist/es/components/TextLink/TextLink.js +7 -2
- package/dist/es/components/Tile/Tile.d.ts +5 -2
- package/dist/es/components/Tile/Tile.js +1 -1
- package/dist/es/components/Tooltip/Tooltip.d.ts +5 -0
- package/dist/es/components/Tooltip/Tooltip.js +10 -2
- package/dist/lib/colors/Colors.js +10 -0
- package/dist/lib/components/Accordion/Accordion.d.ts +11 -3
- package/dist/lib/components/Accordion/Accordion.js +14 -7
- package/dist/lib/components/Banner/Banner.d.ts +10 -0
- package/dist/lib/components/Banner/Banner.js +25 -10
- 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 +14 -6
- package/dist/lib/components/Carousel/Carousel.d.ts +9 -2
- package/dist/lib/components/Carousel/Carousel.js +14 -8
- package/dist/lib/components/Checkbox/Checkbox.d.ts +8 -2
- package/dist/lib/components/Checkbox/Checkbox.js +12 -7
- package/dist/lib/components/Collapse/Collapse.d.ts +15 -3
- package/dist/lib/components/Collapse/Collapse.js +13 -4
- package/dist/lib/components/ContentArea/ContentArea.css +8 -59
- package/dist/lib/components/ContentArea/ContentArea.d.ts +2 -6
- package/dist/lib/components/ContentArea/ContentArea.js +5 -41
- package/dist/lib/components/Counter/Counter.css +0 -47
- package/dist/lib/components/Grid/Grid.css +0 -47
- package/dist/lib/components/Header/Header.d.ts +6 -20
- package/dist/lib/components/Header/Header.js +30 -97
- 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 +6 -2
- package/dist/lib/components/Link/Link.js +33 -4
- package/dist/lib/components/Notification/Notification.css +0 -47
- 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.css +0 -47
- package/dist/lib/components/Pagination/components/PaginationButton/PaginationButton.d.ts +6 -3
- package/dist/lib/components/Pagination/components/PaginationButton/PaginationButton.js +11 -5
- 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.css +0 -47
- 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/Paragraph/Paragraph.css +9 -11
- package/dist/lib/components/Paragraph/Paragraph.d.ts +12 -12
- package/dist/lib/components/Paragraph/Paragraph.js +15 -37
- 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 +8 -28
- package/dist/lib/components/RadioButton/RadioButton.js +51 -117
- package/dist/lib/components/Select/Select.d.ts +38 -5
- package/dist/lib/components/Select/Select.js +50 -34
- 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 +8 -0
- package/dist/lib/components/Tabs/Tabs.js +29 -21
- package/dist/lib/components/TextField/TextField.d.ts +8 -0
- package/dist/lib/components/TextField/TextField.js +20 -9
- package/dist/lib/components/TextLink/TextLink.js +7 -2
- package/dist/lib/components/Tile/Tile.d.ts +5 -2
- package/dist/lib/components/Tile/Tile.js +1 -1
- package/dist/lib/components/Tooltip/Tooltip.d.ts +5 -0
- package/dist/lib/components/Tooltip/Tooltip.js +9 -1
- package/package.json +5 -4
- package/styles/base.less +1 -60
- package/styles/colors.css +60 -0
- package/styles/colorsDark.css +62 -0
- package/styles/base.css +0 -54
|
@@ -62,6 +62,14 @@ export declare type TextFieldProps = {
|
|
|
62
62
|
classes?: {
|
|
63
63
|
input?: string;
|
|
64
64
|
};
|
|
65
|
+
/** Дополнительные data атрибуты к внутренним элементам */
|
|
66
|
+
dataAttrs?: {
|
|
67
|
+
root?: Record<string, string>;
|
|
68
|
+
label?: Record<string, string>;
|
|
69
|
+
notice?: Record<string, string>;
|
|
70
|
+
input?: Record<string, string>;
|
|
71
|
+
iconBox?: Record<string, string>;
|
|
72
|
+
};
|
|
65
73
|
/** Аргумент элемента input */
|
|
66
74
|
inputMode?: 'numeric' | 'tel' | 'decimal' | 'email' | 'url' | 'search' | 'none';
|
|
67
75
|
/** Переводит компонент в контролируемое состояние */
|
|
@@ -5,7 +5,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
5
5
|
import _extends from "@babel/runtime/helpers/extends";
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import { useCallback, useEffect, useState, useRef, useMemo } from 'react';
|
|
8
|
-
import { cnCreate, detectTouch } from '@megafon/ui-helpers';
|
|
8
|
+
import { cnCreate, detectTouch, filterDataAttrs } from '@megafon/ui-helpers';
|
|
9
9
|
import * as PropTypes from 'prop-types';
|
|
10
10
|
import InputMask from 'react-input-mask';
|
|
11
11
|
import InputLabel from "../InputLabel/InputLabel";
|
|
@@ -98,7 +98,8 @@ var TextField = function TextField(_ref) {
|
|
|
98
98
|
inputMode = _ref.inputMode,
|
|
99
99
|
_ref$classes = _ref.classes;
|
|
100
100
|
_ref$classes = _ref$classes === void 0 ? {} : _ref$classes;
|
|
101
|
-
var input = _ref$classes.input
|
|
101
|
+
var input = _ref$classes.input,
|
|
102
|
+
dataAttrs = _ref.dataAttrs;
|
|
102
103
|
|
|
103
104
|
var _useState = useState(true),
|
|
104
105
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -215,7 +216,8 @@ var TextField = function TextField(_ref) {
|
|
|
215
216
|
}, [onBeforeMaskChange]);
|
|
216
217
|
var textareaType = textarea === TextareaTypes.FLEXIBLE ? TextareaTypes.FLEXIBLE : TextareaTypes.FIXED;
|
|
217
218
|
var hasScrolling = initialTextareaHeight >= TEXTAREA_MAX_HEIGHT || isTextareaResized;
|
|
218
|
-
|
|
219
|
+
|
|
220
|
+
var commonParams = _extends(_extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.input)), {
|
|
219
221
|
disabled: disabled,
|
|
220
222
|
id: id,
|
|
221
223
|
name: name,
|
|
@@ -228,7 +230,7 @@ var TextField = function TextField(_ref) {
|
|
|
228
230
|
placeholder: placeholder,
|
|
229
231
|
required: required,
|
|
230
232
|
inputMode: inputMode
|
|
231
|
-
};
|
|
233
|
+
});
|
|
232
234
|
|
|
233
235
|
var inputParams = _extends(_extends({}, commonParams), {
|
|
234
236
|
className: cn('field', input),
|
|
@@ -299,14 +301,14 @@ var TextField = function TextField(_ref) {
|
|
|
299
301
|
|
|
300
302
|
var renderIconBlock = function renderIconBlock() {
|
|
301
303
|
var icon = getIcon();
|
|
302
|
-
return icon && /*#__PURE__*/React.createElement("div", {
|
|
304
|
+
return icon && /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.iconBox), {
|
|
303
305
|
className: cn('icon-box', {
|
|
304
306
|
error: verification === Verification.ERROR && !customIcon,
|
|
305
307
|
password: isPasswordType,
|
|
306
308
|
'custom-handler': !!onCustomIconClick
|
|
307
309
|
}),
|
|
308
310
|
onClick: handleIconClick
|
|
309
|
-
}, icon);
|
|
311
|
+
}), icon);
|
|
310
312
|
};
|
|
311
313
|
|
|
312
314
|
var renderInput = function renderInput() {
|
|
@@ -328,7 +330,7 @@ var TextField = function TextField(_ref) {
|
|
|
328
330
|
var isPlaceholderShowed = isPasswordType && isPasswordHidden && !!inputValue;
|
|
329
331
|
var valueHasSymbols = inputValue !== null && inputValue !== undefined;
|
|
330
332
|
var currentSymbolCount = valueHasSymbols && String(inputValue).length || 0;
|
|
331
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
333
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
332
334
|
className: cn({
|
|
333
335
|
disabled: disabled,
|
|
334
336
|
theme: theme,
|
|
@@ -337,7 +339,10 @@ var TextField = function TextField(_ref) {
|
|
|
337
339
|
icon: !hideIcon && (!!verification || !!customIcon || type === 'password') && !textarea,
|
|
338
340
|
password: isPlaceholderShowed
|
|
339
341
|
}, className)
|
|
340
|
-
}, label && /*#__PURE__*/React.createElement(InputLabel, {
|
|
342
|
+
}), label && /*#__PURE__*/React.createElement(InputLabel, {
|
|
343
|
+
dataAttrs: {
|
|
344
|
+
root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.label
|
|
345
|
+
},
|
|
341
346
|
htmlFor: id
|
|
342
347
|
}, label, required && /*#__PURE__*/React.createElement("span", {
|
|
343
348
|
className: cn('require-mark')
|
|
@@ -347,12 +352,12 @@ var TextField = function TextField(_ref) {
|
|
|
347
352
|
})
|
|
348
353
|
}, renderField()), /*#__PURE__*/React.createElement("div", {
|
|
349
354
|
className: cn('wrap')
|
|
350
|
-
}, noticeText && /*#__PURE__*/React.createElement("div", {
|
|
355
|
+
}, noticeText && /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.notice), {
|
|
351
356
|
className: cn('text', {
|
|
352
357
|
error: verification === Verification.ERROR,
|
|
353
358
|
success: verification === Verification.VALID
|
|
354
359
|
})
|
|
355
|
-
}, noticeText), symbolCounter && /*#__PURE__*/React.createElement(Paragraph, {
|
|
360
|
+
}), noticeText), symbolCounter && /*#__PURE__*/React.createElement(Paragraph, {
|
|
356
361
|
size: "small",
|
|
357
362
|
hasMargin: false,
|
|
358
363
|
className: cn('counter', {
|
|
@@ -391,6 +396,13 @@ TextField.propTypes = {
|
|
|
391
396
|
inputRef: PropTypes.func,
|
|
392
397
|
classes: PropTypes.shape({
|
|
393
398
|
input: PropTypes.string
|
|
399
|
+
}),
|
|
400
|
+
dataAttrs: PropTypes.shape({
|
|
401
|
+
root: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
402
|
+
label: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
403
|
+
notice: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
404
|
+
input: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
405
|
+
iconBox: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
394
406
|
})
|
|
395
407
|
};
|
|
396
408
|
export default TextField;
|
|
@@ -15,8 +15,10 @@ var TextLink = function TextLink(_ref) {
|
|
|
15
15
|
rel = _ref.rel,
|
|
16
16
|
onClick = _ref.onClick,
|
|
17
17
|
children = _ref.children,
|
|
18
|
-
download = _ref.download
|
|
18
|
+
download = _ref.download,
|
|
19
|
+
dataAttrs = _ref.dataAttrs;
|
|
19
20
|
return /*#__PURE__*/React.createElement(Link, {
|
|
21
|
+
dataAttrs: dataAttrs,
|
|
20
22
|
target: target,
|
|
21
23
|
href: href,
|
|
22
24
|
rel: rel,
|
|
@@ -31,9 +33,12 @@ var TextLink = function TextLink(_ref) {
|
|
|
31
33
|
};
|
|
32
34
|
|
|
33
35
|
TextLink.propTypes = {
|
|
34
|
-
color: PropTypes.oneOf(['default', 'white', 'black', 'gray', 'green', 'inherit']),
|
|
36
|
+
color: PropTypes.oneOf(['default', 'white', 'black', 'gray', 'green', 'blue', 'inherit']),
|
|
35
37
|
underlineVisibility: PropTypes.oneOf(['hover', 'always']),
|
|
36
38
|
underlineStyle: PropTypes.oneOf(['solid', 'dashed', 'border', 'none']),
|
|
39
|
+
dataAttrs: PropTypes.shape({
|
|
40
|
+
root: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
41
|
+
}),
|
|
37
42
|
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element), PropTypes.element, PropTypes.string, PropTypes.node])
|
|
38
43
|
};
|
|
39
44
|
TextLink.defaultProps = {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { IFilterDataAttrs } from '@megafon/ui-helpers';
|
|
3
2
|
import './Tile.less';
|
|
4
3
|
export declare const Theme: {
|
|
5
4
|
readonly LIGHT: "light";
|
|
@@ -18,7 +17,7 @@ export declare const Shadow: {
|
|
|
18
17
|
readonly HOVER: "hover";
|
|
19
18
|
};
|
|
20
19
|
declare type ShadowType = typeof Shadow[keyof typeof Shadow];
|
|
21
|
-
export interface ITileProps
|
|
20
|
+
export interface ITileProps {
|
|
22
21
|
/** Ссылка */
|
|
23
22
|
href?: string;
|
|
24
23
|
/** Тема */
|
|
@@ -31,6 +30,10 @@ export interface ITileProps extends IFilterDataAttrs {
|
|
|
31
30
|
isInteractive?: boolean;
|
|
32
31
|
/** Дополнительный класс корневого элемента */
|
|
33
32
|
className?: string;
|
|
33
|
+
/** Дополнительные data атрибуты к внутренним элементам */
|
|
34
|
+
dataAttrs?: {
|
|
35
|
+
root?: Record<string, string>;
|
|
36
|
+
};
|
|
34
37
|
/** Обработчик клика */
|
|
35
38
|
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
36
39
|
}
|
|
@@ -49,7 +49,7 @@ var Tile = function Tile(_ref) {
|
|
|
49
49
|
interactive: isInteractive
|
|
50
50
|
}, className),
|
|
51
51
|
onClick: handleClick
|
|
52
|
-
}, filterDataAttrs(dataAttrs)), href && /*#__PURE__*/React.createElement("a", {
|
|
52
|
+
}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root)), href && /*#__PURE__*/React.createElement("a", {
|
|
53
53
|
href: href,
|
|
54
54
|
className: cn('link')
|
|
55
55
|
}, children), !href && children);
|
|
@@ -46,6 +46,11 @@ export interface ITooltipProps {
|
|
|
46
46
|
content?: string;
|
|
47
47
|
contentShadow?: string;
|
|
48
48
|
};
|
|
49
|
+
/** Дополнительные data атрибуты к внутренним элементам */
|
|
50
|
+
dataAttrs?: {
|
|
51
|
+
root?: Record<string, string>;
|
|
52
|
+
content?: Record<string, string>;
|
|
53
|
+
};
|
|
49
54
|
/** Обработчик на открытие */
|
|
50
55
|
onOpen?: (e: AccessibilityEventTypeNative) => void;
|
|
51
56
|
/** Обработчик на закрытие */
|
|
@@ -4,7 +4,7 @@ import _typeof from "@babel/runtime/helpers/typeof";
|
|
|
4
4
|
import _extends from "@babel/runtime/helpers/extends";
|
|
5
5
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
6
6
|
import React, { useState, useCallback, useEffect, useMemo } from 'react';
|
|
7
|
-
import { cnCreate, detectTouch, checkNativeEventIsClickOrEnterPress } from '@megafon/ui-helpers';
|
|
7
|
+
import { cnCreate, detectTouch, checkNativeEventIsClickOrEnterPress, filterDataAttrs } from '@megafon/ui-helpers';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import { usePopper } from 'react-popper';
|
|
10
10
|
import Tile from "../Tile/Tile";
|
|
@@ -52,6 +52,7 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
52
52
|
arrowClassName = _ref$classes.arrow,
|
|
53
53
|
contentClassName = _ref$classes.content,
|
|
54
54
|
contentShadowClassName = _ref$classes.contentShadow,
|
|
55
|
+
dataAttrs = _ref.dataAttrs,
|
|
55
56
|
onOpen = _ref.onOpen,
|
|
56
57
|
onClose = _ref.onClose;
|
|
57
58
|
var currentTrigger = triggerElement.current;
|
|
@@ -214,7 +215,7 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
214
215
|
|
|
215
216
|
return undefined;
|
|
216
217
|
}, [triggerEventName, isOpen, currentTrigger, handleOutsideEvent, handleClick]);
|
|
217
|
-
return /*#__PURE__*/React.createElement("div", _extends({
|
|
218
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
218
219
|
className: cn({
|
|
219
220
|
paddings: paddings,
|
|
220
221
|
open: isOpen
|
|
@@ -229,6 +230,9 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
229
230
|
className: cn('arrow-shadow'),
|
|
230
231
|
style: styles.arrow
|
|
231
232
|
}), /*#__PURE__*/React.createElement(Tile, {
|
|
233
|
+
dataAttrs: {
|
|
234
|
+
root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.content
|
|
235
|
+
},
|
|
232
236
|
className: cn('content', [contentClassName])
|
|
233
237
|
}, children), /*#__PURE__*/React.createElement(Tile, {
|
|
234
238
|
shadowLevel: "high",
|
|
@@ -271,6 +275,10 @@ Tooltip.propTypes = {
|
|
|
271
275
|
content: PropTypes.string,
|
|
272
276
|
contentShadow: PropTypes.string
|
|
273
277
|
}),
|
|
278
|
+
dataAttrs: PropTypes.shape({
|
|
279
|
+
root: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
280
|
+
content: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
281
|
+
}),
|
|
274
282
|
onOpen: PropTypes.func,
|
|
275
283
|
onClose: PropTypes.func
|
|
276
284
|
};
|
|
@@ -157,6 +157,16 @@ var Colors = function Colors() {
|
|
|
157
157
|
_React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
|
|
158
158
|
setCurrentTheme = _React$useState2[1];
|
|
159
159
|
|
|
160
|
+
var _React$useState3 = React.useState(false),
|
|
161
|
+
_React$useState4 = (0, _slicedToArray2["default"])(_React$useState3, 2),
|
|
162
|
+
setLoad = _React$useState4[1];
|
|
163
|
+
|
|
164
|
+
React.useEffect(function () {
|
|
165
|
+
function load() {
|
|
166
|
+
setLoad(true);
|
|
167
|
+
}
|
|
168
|
+
}, []);
|
|
169
|
+
|
|
160
170
|
var getCurrentColorValue = function getCurrentColorValue(code) {
|
|
161
171
|
return typeof document !== 'undefined' ? document.documentElement.style.getPropertyValue("--".concat(code)) : '';
|
|
162
172
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { IFilterDataAttrs } from '@megafon/ui-helpers';
|
|
3
2
|
import './Accordion.less';
|
|
4
|
-
export interface IAccordionProps
|
|
3
|
+
export interface IAccordionProps {
|
|
5
4
|
/** Ссылка на корневой элемент */
|
|
6
5
|
rootRef?: React.Ref<HTMLDivElement>;
|
|
7
6
|
/** Заголовок */
|
|
@@ -14,11 +13,20 @@ export interface IAccordionProps extends IFilterDataAttrs {
|
|
|
14
13
|
className?: string;
|
|
15
14
|
/** Дополнительные классы для корневого и внутренних элементов */
|
|
16
15
|
classes?: {
|
|
17
|
-
openedClass?: string;
|
|
18
16
|
root?: string;
|
|
17
|
+
openedClass?: string;
|
|
19
18
|
collapse?: string;
|
|
20
19
|
titleWrap?: string;
|
|
21
20
|
};
|
|
21
|
+
/** Дополнительные data атрибуты к внутренним элементам */
|
|
22
|
+
dataAttrs?: {
|
|
23
|
+
root?: Record<string, string>;
|
|
24
|
+
header?: Record<string, string>;
|
|
25
|
+
collapse?: Record<string, string>;
|
|
26
|
+
titleWrap?: Record<string, string>;
|
|
27
|
+
arrowUp?: Record<string, string>;
|
|
28
|
+
arrowDown?: Record<string, string>;
|
|
29
|
+
};
|
|
22
30
|
/** Обработчик клика */
|
|
23
31
|
onClickAccordion?: (isOpened: boolean) => void;
|
|
24
32
|
}
|
|
@@ -80,30 +80,30 @@ var Accordion = function Accordion(_ref) {
|
|
|
80
80
|
};
|
|
81
81
|
|
|
82
82
|
var openedClassName = isOpenedState ? openedClass : undefined;
|
|
83
|
-
return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs), {
|
|
83
|
+
return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
84
84
|
ref: rootRef,
|
|
85
85
|
className: cn({
|
|
86
86
|
open: isOpenedState
|
|
87
87
|
}, [className, rootPropsClasses, openedClassName])
|
|
88
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
88
|
+
}), /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.titleWrap), {
|
|
89
89
|
className: cn('title-wrap', [titleWrapPropsClasses]),
|
|
90
90
|
onClick: handleClickTitle,
|
|
91
91
|
onKeyDown: handleClickTitle
|
|
92
|
-
}, /*#__PURE__*/React.createElement(_Header["default"], {
|
|
92
|
+
}), /*#__PURE__*/React.createElement(_Header["default"], (0, _extends2["default"])({
|
|
93
93
|
as: "h5"
|
|
94
|
-
}, title), /*#__PURE__*/React.createElement("div", {
|
|
94
|
+
}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.header)), title), /*#__PURE__*/React.createElement("div", {
|
|
95
95
|
tabIndex: 0,
|
|
96
96
|
role: "button",
|
|
97
97
|
className: cn('icon-box', {
|
|
98
98
|
open: isOpenedState
|
|
99
99
|
})
|
|
100
|
-
}, isOpenedState ? /*#__PURE__*/React.createElement(ArrowUp, null) : /*#__PURE__*/React.createElement(ArrowDown, null))), /*#__PURE__*/React.createElement(_Collapse["default"], {
|
|
100
|
+
}, isOpenedState ? /*#__PURE__*/React.createElement(ArrowUp, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowUp)) : /*#__PURE__*/React.createElement(ArrowDown, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowDown)))), /*#__PURE__*/React.createElement(_Collapse["default"], (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.collapse), {
|
|
101
101
|
className: cn('content', collapsePropsClasses),
|
|
102
102
|
classNameContainer: cn('content-inner', {
|
|
103
103
|
'v-padding': hasVerticalPaddings
|
|
104
104
|
}),
|
|
105
105
|
isOpened: isOpenedState
|
|
106
|
-
}, children));
|
|
106
|
+
}), children));
|
|
107
107
|
};
|
|
108
108
|
|
|
109
109
|
Accordion.propTypes = {
|
|
@@ -120,7 +120,14 @@ Accordion.propTypes = {
|
|
|
120
120
|
collapse: PropTypes.string,
|
|
121
121
|
titleWrap: PropTypes.string
|
|
122
122
|
}),
|
|
123
|
-
dataAttrs: PropTypes.
|
|
123
|
+
dataAttrs: PropTypes.shape({
|
|
124
|
+
root: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
125
|
+
header: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
126
|
+
collapse: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
127
|
+
titleWrap: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
128
|
+
arrowUp: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
129
|
+
arrowDown: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
130
|
+
}),
|
|
124
131
|
onClickAccordion: PropTypes.func
|
|
125
132
|
};
|
|
126
133
|
var _default = Accordion;
|
|
@@ -16,6 +16,16 @@ export interface IBannerProps {
|
|
|
16
16
|
slide?: string;
|
|
17
17
|
arrow?: string;
|
|
18
18
|
};
|
|
19
|
+
/** Дополнительные data атрибуты к внутренним элементам */
|
|
20
|
+
dataAttrs?: {
|
|
21
|
+
root?: Record<string, string>;
|
|
22
|
+
swiper?: Record<string, string>;
|
|
23
|
+
slide?: Record<string, string>;
|
|
24
|
+
arrowPrev?: Record<string, string>;
|
|
25
|
+
arrowNext?: Record<string, string>;
|
|
26
|
+
pagination?: Record<string, string>;
|
|
27
|
+
dot?: Record<string, string>;
|
|
28
|
+
};
|
|
19
29
|
/** Автоматическая прокрутка */
|
|
20
30
|
autoPlay?: boolean;
|
|
21
31
|
/** Задержка автоматической прокрутки */
|
|
@@ -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"));
|
|
@@ -72,7 +74,8 @@ var Banner = function Banner(_ref) {
|
|
|
72
74
|
onNextClick = _ref.onNextClick,
|
|
73
75
|
onPrevClick = _ref.onPrevClick,
|
|
74
76
|
onDotClick = _ref.onDotClick,
|
|
75
|
-
onChange = _ref.onChange
|
|
77
|
+
onChange = _ref.onChange,
|
|
78
|
+
dataAttrs = _ref.dataAttrs;
|
|
76
79
|
|
|
77
80
|
var _React$useState = React.useState(),
|
|
78
81
|
_React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
|
|
@@ -173,11 +176,11 @@ var Banner = function Banner(_ref) {
|
|
|
173
176
|
var handleAutoplayStop = React.useCallback(function () {
|
|
174
177
|
setAutoPlayning(false);
|
|
175
178
|
}, []);
|
|
176
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
179
|
+
return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
177
180
|
className: cn({
|
|
178
181
|
'nav-theme': navTheme
|
|
179
182
|
}, className)
|
|
180
|
-
}, /*#__PURE__*/React.createElement(_react2.Swiper, {
|
|
183
|
+
}), /*#__PURE__*/React.createElement(_react2.Swiper, (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.swiper), {
|
|
181
184
|
className: cn('swiper'),
|
|
182
185
|
loop: loop,
|
|
183
186
|
autoplay: autoPlay ? getAutoPlayConfig(autoPlayDelay) : false,
|
|
@@ -188,19 +191,19 @@ var Banner = function Banner(_ref) {
|
|
|
188
191
|
onSlideChange: handleSlideChange,
|
|
189
192
|
onAutoplayStop: handleAutoplayStop,
|
|
190
193
|
onTouchEnd: increaseAutoplayDelay
|
|
191
|
-
}, React.Children.map(children, function (child, i) {
|
|
192
|
-
return /*#__PURE__*/React.createElement(_react2.SwiperSlide, {
|
|
194
|
+
}), React.Children.map(children, function (child, i) {
|
|
195
|
+
return /*#__PURE__*/React.createElement(_react2.SwiperSlide, (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.slide, i + 1), {
|
|
193
196
|
key: i,
|
|
194
197
|
className: cn('slide', classes === null || classes === void 0 ? void 0 : classes.slide)
|
|
195
|
-
}, child);
|
|
196
|
-
})), /*#__PURE__*/React.createElement(_NavArrow["default"], {
|
|
198
|
+
}), child);
|
|
199
|
+
})), /*#__PURE__*/React.createElement(_NavArrow["default"], (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowPrev), {
|
|
197
200
|
className: cn('arrow', {
|
|
198
201
|
prev: true
|
|
199
202
|
}, [classes.arrow]),
|
|
200
203
|
onClick: handlePrevClick,
|
|
201
204
|
disabled: !loop && isBeginning,
|
|
202
205
|
theme: navArrowTheme
|
|
203
|
-
}), /*#__PURE__*/React.createElement(_NavArrow["default"], {
|
|
206
|
+
})), /*#__PURE__*/React.createElement(_NavArrow["default"], (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowNext), {
|
|
204
207
|
className: cn('arrow', {
|
|
205
208
|
next: true
|
|
206
209
|
}, [classes.arrow]),
|
|
@@ -208,12 +211,15 @@ var Banner = function Banner(_ref) {
|
|
|
208
211
|
onClick: handleNextClick,
|
|
209
212
|
disabled: !loop && isEnd,
|
|
210
213
|
theme: navArrowTheme
|
|
211
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
214
|
+
})), /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.pagination), {
|
|
212
215
|
className: cn('pagination', {
|
|
213
216
|
theme: navTheme
|
|
214
217
|
})
|
|
215
|
-
}, React.Children.map(children, function (_, i) {
|
|
218
|
+
}), React.Children.map(children, function (_, i) {
|
|
216
219
|
return /*#__PURE__*/React.createElement(_BannerDot["default"], {
|
|
220
|
+
dataAttrs: {
|
|
221
|
+
root: (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.dot, i + 1))
|
|
222
|
+
},
|
|
217
223
|
key: i,
|
|
218
224
|
className: cn('dot'),
|
|
219
225
|
index: i,
|
|
@@ -231,6 +237,15 @@ Banner.propTypes = {
|
|
|
231
237
|
classes: PropTypes.shape({
|
|
232
238
|
slide: PropTypes.string
|
|
233
239
|
}),
|
|
240
|
+
dataAttrs: PropTypes.shape({
|
|
241
|
+
root: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
242
|
+
swiper: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
243
|
+
slide: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
244
|
+
arrowPrev: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
245
|
+
arrowNext: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
246
|
+
pagination: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
247
|
+
dot: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
248
|
+
}),
|
|
234
249
|
autoPlay: PropTypes.bool,
|
|
235
250
|
autoPlayDelay: PropTypes.number,
|
|
236
251
|
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
|
/** Тип компонента */
|
|
@@ -152,9 +152,9 @@ 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')
|
|
@@ -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),
|
|
@@ -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])]),
|
|
@@ -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
|
/** Смена слайдов с зацикливанием */
|