@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.
Files changed (132) hide show
  1. package/CHANGELOG.md +51 -67
  2. package/dist/es/colors/Colors.d.ts +2 -2
  3. package/dist/es/components/Accordion/Accordion.css +1 -15
  4. package/dist/es/components/Accordion/Accordion.d.ts +11 -5
  5. package/dist/es/components/Accordion/Accordion.js +16 -14
  6. package/dist/es/components/Banner/Banner.css +28 -0
  7. package/dist/es/components/Banner/Banner.d.ts +12 -0
  8. package/dist/es/components/Banner/Banner.js +40 -21
  9. package/dist/es/components/Banner/BannerDot.d.ts +3 -0
  10. package/dist/es/components/Banner/BannerDot.js +8 -3
  11. package/dist/es/components/Button/Button.d.ts +8 -2
  12. package/dist/es/components/Button/Button.js +17 -9
  13. package/dist/es/components/Calendar/Calendar.js +3 -2
  14. package/dist/es/components/Calendar/components/Day/Day.js +1 -1
  15. package/dist/es/components/Carousel/Carousel.d.ts +9 -2
  16. package/dist/es/components/Carousel/Carousel.js +31 -22
  17. package/dist/es/components/Checkbox/Checkbox.d.ts +8 -2
  18. package/dist/es/components/Checkbox/Checkbox.js +13 -8
  19. package/dist/es/components/Collapse/Collapse.d.ts +15 -3
  20. package/dist/es/components/Collapse/Collapse.js +11 -4
  21. package/dist/es/components/Counter/Counter.js +3 -3
  22. package/dist/es/components/Header/Header.d.ts +5 -2
  23. package/dist/es/components/Header/Header.js +4 -2
  24. package/dist/es/components/InputLabel/InputLabel.d.ts +3 -0
  25. package/dist/es/components/InputLabel/InputLabel.js +9 -4
  26. package/dist/es/components/Link/Link.d.ts +7 -3
  27. package/dist/es/components/Link/Link.js +26 -10
  28. package/dist/es/components/Notification/Notification.d.ts +8 -0
  29. package/dist/es/components/Notification/Notification.js +21 -4
  30. package/dist/es/components/Pagination/Pagination.d.ts +9 -2
  31. package/dist/es/components/Pagination/Pagination.js +20 -3
  32. package/dist/es/components/Pagination/components/PaginationButton/PaginationButton.d.ts +6 -3
  33. package/dist/es/components/Pagination/components/PaginationButton/PaginationButton.js +12 -7
  34. package/dist/es/components/Pagination/components/PaginationButtons/PaginationButtons.d.ts +5 -2
  35. package/dist/es/components/Pagination/components/PaginationButtons/PaginationButtons.js +10 -2
  36. package/dist/es/components/Pagination/components/PaginationNavigation/PaginationNavigation.d.ts +5 -2
  37. package/dist/es/components/Pagination/components/PaginationNavigation/PaginationNavigation.js +6 -1
  38. package/dist/es/components/Pagination/helpers.d.ts +1 -1
  39. package/dist/es/components/Paragraph/Paragraph.css +0 -9
  40. package/dist/es/components/Paragraph/Paragraph.d.ts +4 -3
  41. package/dist/es/components/Paragraph/Paragraph.js +9 -7
  42. package/dist/es/components/Preloader/Preloader.d.ts +4 -0
  43. package/dist/es/components/Preloader/Preloader.js +10 -5
  44. package/dist/es/components/RadioButton/RadioButton.d.ts +7 -2
  45. package/dist/es/components/RadioButton/RadioButton.js +11 -7
  46. package/dist/es/components/Search/Search.js +4 -3
  47. package/dist/es/components/Select/Select.css +5 -2
  48. package/dist/es/components/Select/Select.d.ts +43 -50
  49. package/dist/es/components/Select/Select.js +374 -461
  50. package/dist/es/components/Select/reducer/selectReducer.d.ts +34 -0
  51. package/dist/es/components/Select/reducer/selectReducer.js +123 -0
  52. package/dist/es/components/Switcher/Switcher.css +19 -15
  53. package/dist/es/components/Switcher/Switcher.js +1 -1
  54. package/dist/es/components/Tabs/Tab.d.ts +5 -2
  55. package/dist/es/components/Tabs/Tab.js +4 -2
  56. package/dist/es/components/Tabs/Tabs.d.ts +10 -0
  57. package/dist/es/components/Tabs/Tabs.js +123 -70
  58. package/dist/es/components/TextField/TextField.d.ts +11 -1
  59. package/dist/es/components/TextField/TextField.js +36 -20
  60. package/dist/es/components/TextLink/TextLink.js +6 -1
  61. package/dist/es/components/Tile/Tile.d.ts +5 -2
  62. package/dist/es/components/Tile/Tile.js +2 -2
  63. package/dist/es/components/Tooltip/Tooltip.d.ts +5 -0
  64. package/dist/es/components/Tooltip/Tooltip.js +27 -19
  65. package/dist/es/index.d.ts +1 -0
  66. package/dist/es/index.js +1 -0
  67. package/dist/lib/colors/Colors.d.ts +2 -2
  68. package/dist/lib/components/Accordion/Accordion.css +1 -15
  69. package/dist/lib/components/Accordion/Accordion.d.ts +11 -5
  70. package/dist/lib/components/Accordion/Accordion.js +16 -14
  71. package/dist/lib/components/Banner/Banner.css +28 -0
  72. package/dist/lib/components/Banner/Banner.d.ts +12 -0
  73. package/dist/lib/components/Banner/Banner.js +40 -20
  74. package/dist/lib/components/Banner/BannerDot.d.ts +3 -0
  75. package/dist/lib/components/Banner/BannerDot.js +10 -2
  76. package/dist/lib/components/Button/Button.d.ts +8 -2
  77. package/dist/lib/components/Button/Button.js +17 -9
  78. package/dist/lib/components/Calendar/Calendar.js +3 -3
  79. package/dist/lib/components/Calendar/components/Day/Day.js +1 -1
  80. package/dist/lib/components/Carousel/Carousel.d.ts +9 -2
  81. package/dist/lib/components/Carousel/Carousel.js +29 -20
  82. package/dist/lib/components/Checkbox/Checkbox.d.ts +8 -2
  83. package/dist/lib/components/Checkbox/Checkbox.js +13 -8
  84. package/dist/lib/components/Collapse/Collapse.d.ts +15 -3
  85. package/dist/lib/components/Collapse/Collapse.js +13 -4
  86. package/dist/lib/components/Counter/Counter.js +3 -3
  87. package/dist/lib/components/Header/Header.d.ts +5 -2
  88. package/dist/lib/components/Header/Header.js +4 -2
  89. package/dist/lib/components/InputLabel/InputLabel.d.ts +3 -0
  90. package/dist/lib/components/InputLabel/InputLabel.js +11 -3
  91. package/dist/lib/components/Link/Link.d.ts +7 -3
  92. package/dist/lib/components/Link/Link.js +37 -23
  93. package/dist/lib/components/Notification/Notification.d.ts +8 -0
  94. package/dist/lib/components/Notification/Notification.js +20 -3
  95. package/dist/lib/components/Pagination/Pagination.d.ts +9 -2
  96. package/dist/lib/components/Pagination/Pagination.js +20 -2
  97. package/dist/lib/components/Pagination/components/PaginationButton/PaginationButton.d.ts +6 -3
  98. package/dist/lib/components/Pagination/components/PaginationButton/PaginationButton.js +12 -6
  99. package/dist/lib/components/Pagination/components/PaginationButtons/PaginationButtons.d.ts +5 -2
  100. package/dist/lib/components/Pagination/components/PaginationButtons/PaginationButtons.js +9 -1
  101. package/dist/lib/components/Pagination/components/PaginationNavigation/PaginationNavigation.d.ts +5 -2
  102. package/dist/lib/components/Pagination/components/PaginationNavigation/PaginationNavigation.js +6 -1
  103. package/dist/lib/components/Pagination/helpers.d.ts +1 -1
  104. package/dist/lib/components/Paragraph/Paragraph.css +0 -9
  105. package/dist/lib/components/Paragraph/Paragraph.d.ts +4 -3
  106. package/dist/lib/components/Paragraph/Paragraph.js +11 -6
  107. package/dist/lib/components/Preloader/Preloader.d.ts +4 -0
  108. package/dist/lib/components/Preloader/Preloader.js +10 -4
  109. package/dist/lib/components/RadioButton/RadioButton.d.ts +7 -2
  110. package/dist/lib/components/RadioButton/RadioButton.js +11 -7
  111. package/dist/lib/components/Search/Search.js +4 -3
  112. package/dist/lib/components/Select/Select.css +5 -2
  113. package/dist/lib/components/Select/Select.d.ts +43 -50
  114. package/dist/lib/components/Select/Select.js +368 -484
  115. package/dist/lib/components/Select/reducer/selectReducer.d.ts +34 -0
  116. package/dist/lib/components/Select/reducer/selectReducer.js +136 -0
  117. package/dist/lib/components/Switcher/Switcher.css +19 -15
  118. package/dist/lib/components/Switcher/Switcher.js +1 -1
  119. package/dist/lib/components/Tabs/Tab.d.ts +5 -2
  120. package/dist/lib/components/Tabs/Tab.js +4 -2
  121. package/dist/lib/components/Tabs/Tabs.d.ts +10 -0
  122. package/dist/lib/components/Tabs/Tabs.js +123 -70
  123. package/dist/lib/components/TextField/TextField.d.ts +11 -1
  124. package/dist/lib/components/TextField/TextField.js +34 -19
  125. package/dist/lib/components/TextLink/TextLink.js +6 -1
  126. package/dist/lib/components/Tile/Tile.d.ts +5 -2
  127. package/dist/lib/components/Tile/Tile.js +2 -2
  128. package/dist/lib/components/Tooltip/Tooltip.d.ts +5 -0
  129. package/dist/lib/components/Tooltip/Tooltip.js +26 -18
  130. package/dist/lib/index.d.ts +1 -0
  131. package/dist/lib/index.js +8 -0
  132. package/package.json +4 -4
@@ -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";
@@ -96,9 +96,11 @@ var TextField = function TextField(_ref) {
96
96
  noticeText = _ref.noticeText,
97
97
  inputRef = _ref.inputRef,
98
98
  inputMode = _ref.inputMode,
99
+ autoComplete = _ref.autoComplete,
99
100
  _ref$classes = _ref.classes;
100
101
  _ref$classes = _ref$classes === void 0 ? {} : _ref$classes;
101
- var input = _ref$classes.input;
102
+ var input = _ref$classes.input,
103
+ dataAttrs = _ref.dataAttrs;
102
104
 
103
105
  var _useState = useState(true),
104
106
  _useState2 = _slicedToArray(_useState, 2),
@@ -149,7 +151,7 @@ var TextField = function TextField(_ref) {
149
151
  useEffect(function () {
150
152
  !isControlled && setInputValue(value);
151
153
  checkSymbolMaxLimit(value);
152
- }, [value, checkSymbolMaxLimit]);
154
+ }, [value, checkSymbolMaxLimit, isControlled]);
153
155
  useEffect(function () {
154
156
  setTouch(detectTouch());
155
157
  }, []);
@@ -157,7 +159,7 @@ var TextField = function TextField(_ref) {
157
159
  return setPasswordHidden(function (prevPassState) {
158
160
  return !prevPassState;
159
161
  });
160
- }, [isPasswordHidden]);
162
+ }, []);
161
163
 
162
164
  var setTextareaHeight = function setTextareaHeight() {
163
165
  if (!(fieldNode === null || fieldNode === void 0 ? void 0 : fieldNode.current)) {
@@ -180,7 +182,7 @@ var TextField = function TextField(_ref) {
180
182
 
181
183
  !isControlled && setInputValue(e.target.value);
182
184
  checkSymbolMaxLimit(e.target.value);
183
- onChange && onChange(e);
185
+ onChange === null || onChange === void 0 ? void 0 : onChange(e);
184
186
  };
185
187
 
186
188
  var handleTextareaClick = function handleTextareaClick() {
@@ -197,25 +199,26 @@ var TextField = function TextField(_ref) {
197
199
  var isClearFuncAvailable = !customIcon && !onCustomIconClick && verification === ERROR;
198
200
  var field = fieldNode.current;
199
201
  isPasswordType && togglePasswordHiding();
200
- onCustomIconClick && onCustomIconClick(e);
202
+ onCustomIconClick === null || onCustomIconClick === void 0 ? void 0 : onCustomIconClick(e);
201
203
 
202
204
  if (!isControlled && isClearFuncAvailable) {
203
205
  setInputValue('');
204
- field && field.focus();
206
+ field === null || field === void 0 ? void 0 : field.focus();
205
207
  }
206
- }, [isPasswordType, togglePasswordHiding, onCustomIconClick, verification, setInputValue]);
208
+ }, [isPasswordType, togglePasswordHiding, onCustomIconClick, verification, customIcon, isControlled]);
207
209
  var handleFocus = useCallback(function (e) {
208
- onFocus && onFocus(e);
210
+ onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
209
211
  }, [onFocus]);
210
212
  var handleBlur = useCallback(function (e) {
211
- onBlur && onBlur(e);
213
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
212
214
  }, [onBlur]);
213
215
  var handleBeforeMaskChange = useCallback(function (newState, oldState, inputedValue) {
214
216
  return onBeforeMaskChange && onBeforeMaskChange(inputedValue, newState, oldState);
215
217
  }, [onBeforeMaskChange]);
216
218
  var textareaType = textarea === TextareaTypes.FLEXIBLE ? TextareaTypes.FLEXIBLE : TextareaTypes.FIXED;
217
219
  var hasScrolling = initialTextareaHeight >= TEXTAREA_MAX_HEIGHT || isTextareaResized;
218
- var commonParams = {
220
+
221
+ var commonParams = _extends(_extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.input)), {
219
222
  disabled: disabled,
220
223
  id: id,
221
224
  name: name,
@@ -228,11 +231,12 @@ var TextField = function TextField(_ref) {
228
231
  placeholder: placeholder,
229
232
  required: required,
230
233
  inputMode: inputMode
231
- };
234
+ });
232
235
 
233
236
  var inputParams = _extends(_extends({}, commonParams), {
234
237
  className: cn('field', input),
235
- type: isVisiblePassword ? 'text' : type
238
+ type: isVisiblePassword ? 'text' : type,
239
+ autoComplete: autoComplete
236
240
  });
237
241
 
238
242
  var inputMaskParams = {
@@ -254,7 +258,7 @@ var TextField = function TextField(_ref) {
254
258
  }
255
259
 
256
260
  fieldNode.current = node;
257
- inputRef && inputRef(node);
261
+ inputRef === null || inputRef === void 0 ? void 0 : inputRef(node);
258
262
  };
259
263
 
260
264
  var getIcon = function getIcon() {
@@ -299,14 +303,14 @@ var TextField = function TextField(_ref) {
299
303
 
300
304
  var renderIconBlock = function renderIconBlock() {
301
305
  var icon = getIcon();
302
- return icon && /*#__PURE__*/React.createElement("div", {
306
+ return icon && /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.iconBox), {
303
307
  className: cn('icon-box', {
304
308
  error: verification === Verification.ERROR && !customIcon,
305
309
  password: isPasswordType,
306
310
  'custom-handler': !!onCustomIconClick
307
311
  }),
308
312
  onClick: handleIconClick
309
- }, icon);
313
+ }), icon);
310
314
  };
311
315
 
312
316
  var renderInput = function renderInput() {
@@ -328,7 +332,7 @@ var TextField = function TextField(_ref) {
328
332
  var isPlaceholderShowed = isPasswordType && isPasswordHidden && !!inputValue;
329
333
  var valueHasSymbols = inputValue !== null && inputValue !== undefined;
330
334
  var currentSymbolCount = valueHasSymbols && String(inputValue).length || 0;
331
- return /*#__PURE__*/React.createElement("div", {
335
+ return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
332
336
  className: cn({
333
337
  disabled: disabled,
334
338
  theme: theme,
@@ -337,7 +341,10 @@ var TextField = function TextField(_ref) {
337
341
  icon: !hideIcon && (!!verification || !!customIcon || type === 'password') && !textarea,
338
342
  password: isPlaceholderShowed
339
343
  }, className)
340
- }, label && /*#__PURE__*/React.createElement(InputLabel, {
344
+ }), label && /*#__PURE__*/React.createElement(InputLabel, {
345
+ dataAttrs: {
346
+ root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.label
347
+ },
341
348
  htmlFor: id
342
349
  }, label, required && /*#__PURE__*/React.createElement("span", {
343
350
  className: cn('require-mark')
@@ -347,12 +354,12 @@ var TextField = function TextField(_ref) {
347
354
  })
348
355
  }, renderField()), /*#__PURE__*/React.createElement("div", {
349
356
  className: cn('wrap')
350
- }, noticeText && /*#__PURE__*/React.createElement("div", {
357
+ }, noticeText && /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.notice), {
351
358
  className: cn('text', {
352
359
  error: verification === Verification.ERROR,
353
360
  success: verification === Verification.VALID
354
361
  })
355
- }, noticeText), symbolCounter && /*#__PURE__*/React.createElement(Paragraph, {
362
+ }), noticeText), symbolCounter && /*#__PURE__*/React.createElement(Paragraph, {
356
363
  size: "small",
357
364
  hasMargin: false,
358
365
  className: cn('counter', {
@@ -370,6 +377,8 @@ TextField.propTypes = {
370
377
  disabled: PropTypes.bool,
371
378
  required: PropTypes.bool,
372
379
  type: PropTypes.oneOf(['text', 'password', 'tel', 'email']),
380
+ inputMode: PropTypes.oneOf(['numeric', 'tel', 'decimal', 'email', 'url', 'search', 'none']),
381
+ autoComplete: PropTypes.string,
373
382
  name: PropTypes.string,
374
383
  placeholder: PropTypes.string,
375
384
  id: PropTypes.string,
@@ -391,6 +400,13 @@ TextField.propTypes = {
391
400
  inputRef: PropTypes.func,
392
401
  classes: PropTypes.shape({
393
402
  input: PropTypes.string
403
+ }),
404
+ dataAttrs: PropTypes.shape({
405
+ root: PropTypes.objectOf(PropTypes.string.isRequired),
406
+ label: PropTypes.objectOf(PropTypes.string.isRequired),
407
+ notice: PropTypes.objectOf(PropTypes.string.isRequired),
408
+ input: PropTypes.objectOf(PropTypes.string.isRequired),
409
+ iconBox: PropTypes.objectOf(PropTypes.string.isRequired)
394
410
  })
395
411
  };
396
412
  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,
@@ -34,6 +36,9 @@ TextLink.propTypes = {
34
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 extends IFilterDataAttrs {
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
  }
@@ -36,7 +36,7 @@ var Tile = function Tile(_ref) {
36
36
  dataAttrs = _ref.dataAttrs;
37
37
 
38
38
  var handleClick = function handleClick(e) {
39
- onClick && onClick(e);
39
+ onClick === null || onClick === void 0 ? void 0 : onClick(e);
40
40
  };
41
41
 
42
42
  var isPointer = !!href || isInteractive;
@@ -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;
@@ -75,7 +76,7 @@ var Tooltip = function Tooltip(_ref) {
75
76
 
76
77
  useEffect(function () {
77
78
  return setIsOpen(isOpened);
78
- }, [isOpened, setIsOpen]);
79
+ }, [isOpened]);
79
80
  var options = useMemo(function () {
80
81
  return {
81
82
  placement: placement,
@@ -103,7 +104,7 @@ var Tooltip = function Tooltip(_ref) {
103
104
  }
104
105
  }]
105
106
  };
106
- }, [placement, arrowElement, currentBoundary, isOpen]);
107
+ }, [placement, arrowElement, currentBoundary, isOpen, fallbackPlacements]);
107
108
 
108
109
  var _usePopper = usePopper(currentTarget, popperElement, options),
109
110
  styles = _usePopper.styles,
@@ -111,7 +112,7 @@ var Tooltip = function Tooltip(_ref) {
111
112
  update = _usePopper.update;
112
113
 
113
114
  useEffect(function () {
114
- update && update();
115
+ update === null || update === void 0 ? void 0 : update();
115
116
  }, [children, update]);
116
117
 
117
118
  var _useState7 = useState(false),
@@ -121,7 +122,7 @@ var Tooltip = function Tooltip(_ref) {
121
122
 
122
123
  useEffect(function () {
123
124
  return setIsTouchDevice(detectTouch());
124
- }, [detectTouch, setIsTouchDevice]);
125
+ }, []);
125
126
  var clickEvent = useMemo(function () {
126
127
  return isTouchDevice ? TOUCH_KEY : MOUSE_KEY;
127
128
  }, [isTouchDevice]);
@@ -131,9 +132,9 @@ var Tooltip = function Tooltip(_ref) {
131
132
  var handleMouseEnter = useCallback(function (e) {
132
133
  if (!isOpen) {
133
134
  setIsOpen(true);
134
- onOpen && onOpen(e);
135
+ onOpen === null || onOpen === void 0 ? void 0 : onOpen(e);
135
136
  }
136
- }, [isOpen, onOpen, setIsOpen]);
137
+ }, [isOpen, onOpen]);
137
138
  var handleClick = useCallback(function (e) {
138
139
  if (!checkNativeEventIsClickOrEnterPress(e)) {
139
140
  return;
@@ -144,24 +145,24 @@ var Tooltip = function Tooltip(_ref) {
144
145
  });
145
146
 
146
147
  if (!isOpen) {
147
- onOpen && onOpen(e);
148
+ onOpen === null || onOpen === void 0 ? void 0 : onOpen(e);
148
149
  } else {
149
- onClose && onClose(e);
150
+ onClose === null || onClose === void 0 ? void 0 : onClose(e);
150
151
  }
151
- }, [isOpen, onOpen, onClose, setIsOpen]);
152
+ }, [isOpen, onOpen, onClose]);
152
153
  var handleOutsideEvent = useCallback(function (e) {
153
154
  var isTargetInPopper = e.target instanceof Element && popperElement && popperElement.contains(e.target);
154
155
  var isTargetInTrigger = e.target instanceof Element && currentTrigger && currentTrigger.contains(e.target);
155
156
 
156
157
  if (!isTargetInPopper && !isTargetInTrigger) {
157
158
  setIsOpen(false);
158
- onClose && onClose(e);
159
+ onClose === null || onClose === void 0 ? void 0 : onClose(e);
159
160
  }
160
- }, [onClose, currentTrigger, popperElement, setIsOpen]);
161
+ }, [onClose, currentTrigger, popperElement]);
161
162
  var handleBlurEvent = useCallback(function (e) {
162
163
  setIsOpen(false);
163
- onClose && onClose(e);
164
- }, [onClose, setIsOpen]);
164
+ onClose === null || onClose === void 0 ? void 0 : onClose(e);
165
+ }, [onClose]);
165
166
  useEffect(function () {
166
167
  if (triggerEventName === TriggerEvent.HOVER) {
167
168
  if (currentTrigger) {
@@ -171,10 +172,10 @@ var Tooltip = function Tooltip(_ref) {
171
172
 
172
173
  if (isOpen) {
173
174
  document.addEventListener('mouseover', handleOutsideEvent);
174
- currentTrigger && currentTrigger.addEventListener('blur', handleBlurEvent);
175
+ currentTrigger === null || currentTrigger === void 0 ? void 0 : currentTrigger.addEventListener('blur', handleBlurEvent);
175
176
  } else {
176
177
  document.removeEventListener('mouseover', handleOutsideEvent);
177
- currentTrigger && currentTrigger.removeEventListener('blur', handleBlurEvent);
178
+ currentTrigger === null || currentTrigger === void 0 ? void 0 : currentTrigger.removeEventListener('blur', handleBlurEvent);
178
179
  }
179
180
 
180
181
  return function () {
@@ -188,7 +189,7 @@ var Tooltip = function Tooltip(_ref) {
188
189
  }
189
190
 
190
191
  return undefined;
191
- }, [triggerEventName, isOpen, currentTrigger, handleOutsideEvent, handleMouseEnter]);
192
+ }, [triggerEventName, isOpen, currentTrigger, handleOutsideEvent, handleMouseEnter, handleBlurEvent]);
192
193
  useEffect(function () {
193
194
  if (triggerEventName === TriggerEvent.CLICK) {
194
195
  if (currentTrigger) {
@@ -213,8 +214,8 @@ var Tooltip = function Tooltip(_ref) {
213
214
  }
214
215
 
215
216
  return undefined;
216
- }, [triggerEventName, isOpen, currentTrigger, handleOutsideEvent, handleClick]);
217
- return /*#__PURE__*/React.createElement("div", _extends({
217
+ }, [triggerEventName, isOpen, currentTrigger, handleOutsideEvent, handleClick, clickEvent]);
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
  };
@@ -31,6 +31,7 @@ export { default as Preloader } from './components/Preloader/Preloader';
31
31
  export { default as RadioButton } from './components/RadioButton/RadioButton';
32
32
  export { default as Search } from './components/Search/Search';
33
33
  export { default as Select } from './components/Select/Select';
34
+ export { default as selectReducer } from './components/Select/reducer/selectReducer';
34
35
  export { default as Switcher } from './components/Switcher/Switcher';
35
36
  export { default as Tab } from './components/Tabs/Tab';
36
37
  export { default as Tabs } from './components/Tabs/Tabs';
package/dist/es/index.js CHANGED
@@ -31,6 +31,7 @@ export { default as Preloader } from "./components/Preloader/Preloader";
31
31
  export { default as RadioButton } from "./components/RadioButton/RadioButton";
32
32
  export { default as Search } from "./components/Search/Search";
33
33
  export { default as Select } from "./components/Select/Select";
34
+ export { default as selectReducer } from "./components/Select/reducer/selectReducer";
34
35
  export { default as Switcher } from "./components/Switcher/Switcher";
35
36
  export { default as Tab } from "./components/Tabs/Tab";
36
37
  export { default as Tabs } from "./components/Tabs/Tabs";
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import './Colors.less';
3
- declare const Colors: () => JSX.Element;
3
+ declare const Colors: React.FC;
4
4
  export default Colors;
@@ -40,25 +40,11 @@
40
40
  .mfui-accordion__content-inner {
41
41
  padding: 24px 16px;
42
42
  }
43
- @media screen and (min-width: 768px) and (max-width: 1023px) {
43
+ @media screen and (min-width: 768px) {
44
44
  .mfui-accordion__content-inner {
45
45
  padding: 24px;
46
46
  }
47
47
  }
48
- @media screen and (min-width: 1024px) and (max-width: 1279px) {
49
- .mfui-accordion__content-inner {
50
- padding: 24px 48px;
51
- }
52
- }
53
- @media screen and (min-width: 1280px) {
54
- .mfui-accordion__content-inner {
55
- padding: 24px 40px;
56
- }
57
- }
58
- .mfui-accordion__content-inner_v-padding {
59
- padding-top: 24px;
60
- padding-bottom: 24px;
61
- }
62
48
  .mfui-accordion__icon {
63
49
  fill: var(--content);
64
50
  }
@@ -1,24 +1,30 @@
1
1
  import * as React from 'react';
2
- import { IFilterDataAttrs } from '@megafon/ui-helpers';
3
2
  import './Accordion.less';
4
- export interface IAccordionProps extends IFilterDataAttrs {
3
+ export interface IAccordionProps {
5
4
  /** Ссылка на корневой элемент */
6
5
  rootRef?: React.Ref<HTMLDivElement>;
7
6
  /** Заголовок */
8
7
  title: string | React.ReactNode | React.ReactNode[];
9
8
  /** Состояние открытости */
10
9
  isOpened?: boolean;
11
- /** Вертикальные отступы */
12
- hasVerticalPaddings?: boolean;
13
10
  /** Дополнительный класс для корневого элемента */
14
11
  className?: string;
15
12
  /** Дополнительные классы для корневого и внутренних элементов */
16
13
  classes?: {
17
- openedClass?: string;
18
14
  root?: string;
15
+ openedClass?: string;
19
16
  collapse?: string;
20
17
  titleWrap?: string;
21
18
  };
19
+ /** Дополнительные data атрибуты к внутренним элементам */
20
+ dataAttrs?: {
21
+ root?: Record<string, string>;
22
+ header?: Record<string, string>;
23
+ collapse?: Record<string, string>;
24
+ titleWrap?: Record<string, string>;
25
+ arrowUp?: Record<string, string>;
26
+ arrowDown?: Record<string, string>;
27
+ };
22
28
  /** Обработчик клика */
23
29
  onClickAccordion?: (isOpened: boolean) => void;
24
30
  }
@@ -50,8 +50,6 @@ var Accordion = function Accordion(_ref) {
50
50
  title = _ref.title,
51
51
  _ref$isOpened = _ref.isOpened,
52
52
  isOpened = _ref$isOpened === void 0 ? false : _ref$isOpened,
53
- _ref$hasVerticalPaddi = _ref.hasVerticalPaddings,
54
- hasVerticalPaddings = _ref$hasVerticalPaddi === void 0 ? false : _ref$hasVerticalPaddi,
55
53
  className = _ref.className,
56
54
  _ref$classes = _ref.classes;
57
55
  _ref$classes = _ref$classes === void 0 ? {} : _ref$classes;
@@ -74,36 +72,34 @@ var Accordion = function Accordion(_ref) {
74
72
 
75
73
  var handleClickTitle = function handleClickTitle(e) {
76
74
  if ((0, _uiHelpers.checkEventIsClickOrEnterPress)(e)) {
77
- onClickAccordion && onClickAccordion(!isOpenedState);
75
+ onClickAccordion === null || onClickAccordion === void 0 ? void 0 : onClickAccordion(!isOpenedState);
78
76
  setIsOpenedState(!isOpenedState);
79
77
  }
80
78
  };
81
79
 
82
80
  var openedClassName = isOpenedState ? openedClass : undefined;
83
- return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs), {
81
+ return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
84
82
  ref: rootRef,
85
83
  className: cn({
86
84
  open: isOpenedState
87
85
  }, [className, rootPropsClasses, openedClassName])
88
- }), /*#__PURE__*/React.createElement("div", {
86
+ }), /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.titleWrap), {
89
87
  className: cn('title-wrap', [titleWrapPropsClasses]),
90
88
  onClick: handleClickTitle,
91
89
  onKeyDown: handleClickTitle
92
- }, /*#__PURE__*/React.createElement(_Header["default"], {
90
+ }), /*#__PURE__*/React.createElement(_Header["default"], (0, _extends2["default"])({
93
91
  as: "h5"
94
- }, title), /*#__PURE__*/React.createElement("div", {
92
+ }, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.header)), title), /*#__PURE__*/React.createElement("div", {
95
93
  tabIndex: 0,
96
94
  role: "button",
97
95
  className: cn('icon-box', {
98
96
  open: isOpenedState
99
97
  })
100
- }, isOpenedState ? /*#__PURE__*/React.createElement(ArrowUp, null) : /*#__PURE__*/React.createElement(ArrowDown, null))), /*#__PURE__*/React.createElement(_Collapse["default"], {
98
+ }, 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
99
  className: cn('content', collapsePropsClasses),
102
- classNameContainer: cn('content-inner', {
103
- 'v-padding': hasVerticalPaddings
104
- }),
100
+ classNameContainer: cn('content-inner'),
105
101
  isOpened: isOpenedState
106
- }, children));
102
+ }), children));
107
103
  };
108
104
 
109
105
  Accordion.propTypes = {
@@ -112,7 +108,6 @@ Accordion.propTypes = {
112
108
  }), PropTypes.any])]),
113
109
  title: PropTypes.oneOfType([PropTypes.string, PropTypes.node, PropTypes.arrayOf(PropTypes.node)]).isRequired,
114
110
  isOpened: PropTypes.bool,
115
- hasVerticalPaddings: PropTypes.bool,
116
111
  className: PropTypes.string,
117
112
  classes: PropTypes.shape({
118
113
  openedClass: PropTypes.string,
@@ -120,7 +115,14 @@ Accordion.propTypes = {
120
115
  collapse: PropTypes.string,
121
116
  titleWrap: PropTypes.string
122
117
  }),
123
- dataAttrs: PropTypes.objectOf(PropTypes.string.isRequired),
118
+ dataAttrs: PropTypes.shape({
119
+ root: PropTypes.objectOf(PropTypes.string.isRequired),
120
+ header: PropTypes.objectOf(PropTypes.string.isRequired),
121
+ collapse: PropTypes.objectOf(PropTypes.string.isRequired),
122
+ titleWrap: PropTypes.objectOf(PropTypes.string.isRequired),
123
+ arrowUp: PropTypes.objectOf(PropTypes.string.isRequired),
124
+ arrowDown: PropTypes.objectOf(PropTypes.string.isRequired)
125
+ }),
124
126
  onClickAccordion: PropTypes.func
125
127
  };
126
128
  var _default = Accordion;
@@ -34,6 +34,11 @@
34
34
  -webkit-transform: translateY(-50%);
35
35
  transform: translateY(-50%);
36
36
  }
37
+ @media screen and (max-width: 767px) {
38
+ .mfui-banner__arrow {
39
+ display: none;
40
+ }
41
+ }
37
42
  .mfui-banner__arrow_prev {
38
43
  left: 12px;
39
44
  }
@@ -98,6 +103,29 @@
98
103
  .mfui-banner__pagination_theme_dark {
99
104
  background-color: var(--stcBlack20);
100
105
  }
106
+ .mfui-banner__pagination_bottom-offset {
107
+ bottom: 60px;
108
+ }
109
+ @media screen and (min-width: 768px) and (max-width: 1023px) {
110
+ .mfui-banner__pagination_bottom-offset {
111
+ bottom: 89px;
112
+ }
113
+ }
114
+ @media screen and (min-width: 1024px) and (max-width: 1279px) {
115
+ .mfui-banner__pagination_bottom-offset {
116
+ bottom: 90px;
117
+ }
118
+ }
119
+ @media screen and (min-width: 1280px) and (max-width: 1439px) {
120
+ .mfui-banner__pagination_bottom-offset {
121
+ bottom: 65px;
122
+ }
123
+ }
124
+ @media screen and (min-width: 1440px) {
125
+ .mfui-banner__pagination_bottom-offset {
126
+ bottom: 72px;
127
+ }
128
+ }
101
129
  .mfui-banner__dot {
102
130
  width: 12px;
103
131
  height: 12px;
@@ -16,6 +16,18 @@ 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
+ };
29
+ /** Предполагается использование с наезжанием на баннер следующего за баннером элемента */
30
+ withPaginationBottomOffset?: boolean;
19
31
  /** Автоматическая прокрутка */
20
32
  autoPlay?: boolean;
21
33
  /** Задержка автоматической прокрутки */