@megafon/ui-core 7.7.0 → 7.9.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 (33) hide show
  1. package/dist/es/components/ErrorLoad/ErrorLoad.css +1 -0
  2. package/dist/es/components/ErrorLoad/ErrorLoad.d.ts +23 -0
  3. package/dist/es/components/ErrorLoad/ErrorLoad.js +59 -0
  4. package/dist/es/components/Modal/Modal.d.ts +4 -1
  5. package/dist/es/components/Modal/Modal.js +29 -3
  6. package/dist/es/components/Modal/_ModalContent/ModalContent.css +1 -1
  7. package/dist/es/components/Modal/_ModalContent/ModalContent.js +1 -1
  8. package/dist/es/components/Modal/_ModalMobileBottom/ModalMobileBottom.js +9 -4
  9. package/dist/es/components/Modal/mocks.js +4 -0
  10. package/dist/es/components/Modal/types.d.ts +1 -0
  11. package/dist/es/components/ScrollBar/ScrollBar.d.ts +2 -0
  12. package/dist/es/components/ScrollBar/ScrollBar.js +12 -3
  13. package/dist/es/components/Search/Search.d.ts +2 -0
  14. package/dist/es/components/Search/Search.js +3 -0
  15. package/dist/es/index.d.ts +1 -0
  16. package/dist/es/index.js +1 -0
  17. package/dist/lib/components/ErrorLoad/ErrorLoad.css +1 -0
  18. package/dist/lib/components/ErrorLoad/ErrorLoad.d.ts +23 -0
  19. package/dist/lib/components/ErrorLoad/ErrorLoad.js +68 -0
  20. package/dist/lib/components/Modal/Modal.d.ts +4 -1
  21. package/dist/lib/components/Modal/Modal.js +29 -3
  22. package/dist/lib/components/Modal/_ModalContent/ModalContent.css +1 -1
  23. package/dist/lib/components/Modal/_ModalContent/ModalContent.js +1 -1
  24. package/dist/lib/components/Modal/_ModalMobileBottom/ModalMobileBottom.js +9 -4
  25. package/dist/lib/components/Modal/mocks.js +4 -0
  26. package/dist/lib/components/Modal/types.d.ts +1 -0
  27. package/dist/lib/components/ScrollBar/ScrollBar.d.ts +2 -0
  28. package/dist/lib/components/ScrollBar/ScrollBar.js +12 -3
  29. package/dist/lib/components/Search/Search.d.ts +2 -0
  30. package/dist/lib/components/Search/Search.js +3 -0
  31. package/dist/lib/index.d.ts +1 -0
  32. package/dist/lib/index.js +7 -0
  33. package/package.json +4 -4
@@ -0,0 +1 @@
1
+ h1,h2,h3,h4,h5{margin:0}.mfui-error-load{background:inherit}.mfui-error-load_cardinal_vertical{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;gap:12px;-ms-flex-align:center;-ms-flex-item-align:stretch;align-self:stretch}.mfui-error-load_cardinal_horizontal,.mfui-error-load_cardinal_vertical{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;align-items:center}.mfui-error-load_cardinal_horizontal{gap:8px;-ms-flex-align:center;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.mfui-error-load__header{text-align:center}.mfui-error-load__text .mfui-error-load__caption_background_on-color,.mfui-error-load__text .mfui-error-load__header_background_on-color{color:var(--stcWhite)}.mfui-error-load__text .mfui-error-load__caption_background_on-base{color:var(--spbSky3)}.mfui-error-load__text{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;gap:4px}.mfui-error-load__text_cardinal_vertical{-webkit-box-align:center;-ms-flex-align:center;align-items:center;-ms-flex-item-align:stretch;align-self:stretch}
@@ -0,0 +1,23 @@
1
+ import * as React from 'react';
2
+ import { IButtonProps } from '../Button/Button';
3
+ import './ErrorLoad.scss';
4
+ type ButtonProps = Pick<IButtonProps, 'disabled' | 'showLoader' | 'onClick'>;
5
+ export interface IErrorLoadProps {
6
+ /** Размер блока */
7
+ big?: boolean;
8
+ /** Цветовая тема */
9
+ background?: 'on-base' | 'on-color';
10
+ /** Ориентация блока */
11
+ cardinalDirection?: 'vertical' | 'horizontal';
12
+ /** Параметры кнопки */
13
+ buttonParams?: ButtonProps;
14
+ /** Дополнительный класс корневого элемента */
15
+ className?: string;
16
+ /** Дополнительные data атрибуты к внутренним элементам */
17
+ dataAttrs?: {
18
+ root?: Record<string, string>;
19
+ button?: Record<string, string>;
20
+ };
21
+ }
22
+ declare const ErrorLoad: React.FC<IErrorLoadProps>;
23
+ export default ErrorLoad;
@@ -0,0 +1,59 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import "core-js/modules/es.string.big.js";
3
+ import * as React from 'react';
4
+ import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
5
+ import Button from "../Button/Button";
6
+ import Caption from "../Caption/Caption";
7
+ import Header from "../Header/Header";
8
+ import "./ErrorLoad.css";
9
+ var RefreshIcon24 = function RefreshIcon24(props) {
10
+ return /*#__PURE__*/React.createElement("svg", _extends({
11
+ viewBox: "0 0 32 32"
12
+ }, props), /*#__PURE__*/React.createElement("path", {
13
+ fillRule: "evenodd",
14
+ clipRule: "evenodd",
15
+ d: "M16.064 8C11.604 8 8 11.588 8 16s3.604 8 8.064 8c4.1 0 7.478-3.033 7.995-6.948l1.983.262C25.393 22.223 21.17 26 16.064 26 10.513 26 6 21.53 6 16S10.513 6 16.064 6c3.456 0 6.507 1.731 8.32 4.371l.704-2.345 1.915.575-1.419 4.726a1 1 0 01-1.228.675l-4.855-1.364.541-1.925 2.664.748A8.074 8.074 0 0016.064 8z"
16
+ }));
17
+ };
18
+ var cn = cnCreate('mfui-error-load');
19
+ var ErrorLoad = function ErrorLoad(_ref) {
20
+ var _ref$background = _ref.background,
21
+ background = _ref$background === void 0 ? 'on-base' : _ref$background,
22
+ _ref$big = _ref.big,
23
+ big = _ref$big === void 0 ? true : _ref$big,
24
+ _ref$cardinalDirectio = _ref.cardinalDirection,
25
+ cardinalDirection = _ref$cardinalDirectio === void 0 ? 'horizontal' : _ref$cardinalDirectio,
26
+ className = _ref.className,
27
+ dataAttrs = _ref.dataAttrs,
28
+ buttonParams = _ref.buttonParams;
29
+ var isBaseBackground = background === 'on-base';
30
+ var isSmallIconSize = cardinalDirection === 'horizontal' || !big;
31
+ return /*#__PURE__*/React.createElement("div", _extends({
32
+ className: cn({
33
+ cardinal: cardinalDirection
34
+ }, className)
35
+ }, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root)), /*#__PURE__*/React.createElement("div", {
36
+ className: cn('text', {
37
+ cardinal: cardinalDirection
38
+ })
39
+ }, /*#__PURE__*/React.createElement(Header, {
40
+ as: big ? 'h3' : 'h5',
41
+ className: cn('header', {
42
+ background: background
43
+ })
44
+ }, "\u0414\u0430\u043D\u043D\u044B\u0435 \u043D\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043B\u0438\u0441\u044C"), big && /*#__PURE__*/React.createElement(Caption, {
45
+ hasMargin: false,
46
+ className: cn('caption', {
47
+ background: background
48
+ })
49
+ }, "\u041E\u0431\u043D\u043E\u0432\u0438\u0442\u0435 \u0438\u043B\u0438 \u0437\u0430\u0439\u0434\u0438\u0442\u0435 \u043F\u043E\u0437\u0436\u0435")), /*#__PURE__*/React.createElement(Button, _extends({
50
+ icon: /*#__PURE__*/React.createElement(RefreshIcon24, null),
51
+ theme: isBaseBackground ? 'green' : 'white',
52
+ sizeAll: isSmallIconSize ? 'small' : 'medium'
53
+ }, buttonParams, {
54
+ dataAttrs: {
55
+ root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.button
56
+ }
57
+ })));
58
+ };
59
+ export default ErrorLoad;
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import type { IScrollBarProps } from '../ScrollBar/ScrollBar';
3
3
  import './Modal.scss';
4
4
  export declare enum MODAL_MOBILE_VIEWS_ENUM {
5
- FULL_SCREEN = "full-screen",
5
+ FULL_SCREEN = "fullScreen",// use camelCase for simple using in props from backend
6
6
  BOTTOM = "bottom"
7
7
  }
8
8
  export declare enum MODAL_TRANSITIONS_STEPS_ENUM {
@@ -20,6 +20,7 @@ export type ModalClassesType = {
20
20
  containerInner?: string;
21
21
  containerBody?: string;
22
22
  header?: string;
23
+ headerBackButton?: string;
23
24
  headerCloseButton?: string;
24
25
  titleArea?: string;
25
26
  title?: string;
@@ -88,6 +89,8 @@ export interface IModalProps {
88
89
  isDisabledBackgroundClick?: boolean;
89
90
  /** Восстанавливает фокус на элементе, который был сфокусирован до открытия модального окна */
90
91
  isReturnFocusAfterClose?: boolean;
92
+ /** Пересчитывать максимальную высоту скролла */
93
+ isRecalculateHeight?: boolean;
91
94
  /** Должен ли root-элемент приложения быть скрыт */
92
95
  hideAriaApp?: boolean;
93
96
  /** Устанавливает aria-label */
@@ -5,6 +5,7 @@ import { cnCreate, breakpoints } from '@megafon/ui-helpers';
5
5
  import throttle from 'lodash.throttle';
6
6
  import ReactModal from 'react-modal';
7
7
  import THROTTLE_TIME from "../../constants/throttleTime";
8
+ import usePrevious from "../../hooks/usePrevious";
8
9
  import useResolution from "../../hooks/useResolution";
9
10
  import ModalDesktop from "./_ModalDesktop/ModalDesktop";
10
11
  import ModalMobileBottom from "./_ModalMobileBottom/ModalMobileBottom";
@@ -15,7 +16,7 @@ var MOBILE_BIG_START = breakpoints.MOBILE_BIG_START;
15
16
  var HEIGHT_TRANSITION_PROPERTY = 'height';
16
17
  export var MODAL_MOBILE_VIEWS_ENUM;
17
18
  (function (MODAL_MOBILE_VIEWS_ENUM) {
18
- MODAL_MOBILE_VIEWS_ENUM["FULL_SCREEN"] = "full-screen";
19
+ MODAL_MOBILE_VIEWS_ENUM["FULL_SCREEN"] = "fullScreen";
19
20
  MODAL_MOBILE_VIEWS_ENUM["BOTTOM"] = "bottom";
20
21
  })(MODAL_MOBILE_VIEWS_ENUM || (MODAL_MOBILE_VIEWS_ENUM = {}));
21
22
  export var MODAL_TRANSITIONS_STEPS_ENUM;
@@ -40,6 +41,7 @@ var Modal = function Modal(_ref) {
40
41
  isEnabledNativeScroll = _ref.isEnabledNativeScroll,
41
42
  isSwipeDisabled = _ref.isSwipeDisabled,
42
43
  isDisabledBackgroundClick = _ref.isDisabledBackgroundClick,
44
+ isRecalculateHeight = _ref.isRecalculateHeight,
43
45
  _ref$hideAriaApp = _ref.hideAriaApp,
44
46
  hideAriaApp = _ref$hideAriaApp === void 0 ? false : _ref$hideAriaApp,
45
47
  contentLabel = _ref.contentLabel,
@@ -85,6 +87,7 @@ var Modal = function Modal(_ref) {
85
87
  var containerWrapRef = React.useRef(null);
86
88
  var containerInnerRef = React.useRef(null);
87
89
  var containerBodyRef = React.useRef(null);
90
+ var scrollBarScrollableRef = React.useRef(null);
88
91
  var resizeObserver = React.useRef(null);
89
92
  var _useResolution = useResolution(),
90
93
  isMobile = _useResolution.isMobile;
@@ -93,6 +96,15 @@ var Modal = function Modal(_ref) {
93
96
  var isBottomTransitionIn = transitionStep !== MODAL_TRANSITIONS_STEPS_ENUM.END_STEP && transitionStep !== MODAL_TRANSITIONS_STEPS_ENUM.MOVE_END_STEP;
94
97
  var isTransitionMoveStep = transitionStep === MODAL_TRANSITIONS_STEPS_ENUM.MOVE_STEP;
95
98
  var isTransitionEndStep = transitionStep === MODAL_TRANSITIONS_STEPS_ENUM.END_STEP;
99
+ var prevMobileView = usePrevious(mobileView);
100
+ var isChangeMobileView = mobileView !== prevMobileView;
101
+ var prevHeaderProps = usePrevious(headerProps);
102
+ var prevFooterProps = usePrevious(footerProps);
103
+ var isHeaderPropsDiff = headerProps !== prevHeaderProps;
104
+ var isFooterPropsDiff = footerProps !== prevFooterProps;
105
+ var handleGetScrollBarScrollableRef = function handleGetScrollBarScrollableRef(node) {
106
+ scrollBarScrollableRef.current = node;
107
+ };
96
108
  var handleChangeTransitionStep = function handleChangeTransitionStep(value) {
97
109
  setTransitionStep(value);
98
110
  };
@@ -201,6 +213,18 @@ var Modal = function Modal(_ref) {
201
213
  window.removeEventListener('resize', handleThrottleResize);
202
214
  };
203
215
  }, [isEnabledNativeScroll, handleSetScrollContentMaxHeight]);
216
+ React.useEffect(function () {
217
+ if (!isMobile || !isChangeMobileView) {
218
+ return;
219
+ }
220
+ handleSetScrollContentMaxHeight();
221
+ }, [isMobile, isChangeMobileView, handleSetScrollContentMaxHeight]);
222
+ React.useEffect(function () {
223
+ if (isEnabledNativeScroll || !(isRecalculateHeight && (isHeaderPropsDiff || isFooterPropsDiff))) {
224
+ return;
225
+ }
226
+ handleSetScrollContentMaxHeight();
227
+ }, [isEnabledNativeScroll, isFooterPropsDiff, isRecalculateHeight, isHeaderPropsDiff, handleSetScrollContentMaxHeight]);
204
228
  React.useEffect(function () {
205
229
  return function () {
206
230
  setIsPopupOpened(false);
@@ -215,7 +239,8 @@ var Modal = function Modal(_ref) {
215
239
  classes: classes,
216
240
  dataAttrs: dataAttrs,
217
241
  scrollBarParams: _extends(_extends({}, scrollBarParams), {
218
- maxHeight: scrollMaxHeight
242
+ maxHeight: scrollMaxHeight,
243
+ getScrollable: handleGetScrollBarScrollableRef
219
244
  }),
220
245
  headerProps: headerProps,
221
246
  footerProps: footerProps,
@@ -225,7 +250,8 @@ var Modal = function Modal(_ref) {
225
250
  footerRef: footerRef,
226
251
  containerWrapRef: containerWrapRef,
227
252
  containerInnerRef: containerInnerRef,
228
- containerBodyRef: containerBodyRef
253
+ containerBodyRef: containerBodyRef,
254
+ scrollBarScrollableRef: scrollBarScrollableRef
229
255
  },
230
256
  isEnabledNativeScroll: isEnabledNativeScroll,
231
257
  isDisabledBackgroundClick: isDisabledBackgroundClick,
@@ -1 +1 @@
1
- h1,h2,h3,h4,h5{margin:0}.mfui-modal-content__background{background-color:rgba(0,0,0,.8);bottom:0;left:0;position:fixed;right:0;top:0}.mfui-modal-content__container-wrap{-webkit-animation:show-popup .3s ease-out;animation:show-popup .3s ease-out;position:relative;width:100%}@media screen and (min-width:768px){.mfui-modal-content__container-wrap{-webkit-transition:height .1s;transition:height .1s;width:740px}}.mfui-modal-content__container-inner{background-color:var(--background);font-family:inherit;width:100%}.mfui-modal-content__header{position:relative}.mfui-modal-content__header_shadow{-webkit-box-shadow:0 2px 12px rgba(0,0,0,.1);box-shadow:0 2px 12px rgba(0,0,0,.1)}.mfui-modal-content__header-main{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;min-height:52px}@media screen and (min-width:768px){.mfui-modal-content__header-main{min-height:64px}}.mfui-modal-content__header-button{display:-webkit-box;display:-ms-flexbox;display:flex;position:absolute;top:12px;z-index:2;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;background:transparent;border:none;cursor:pointer;height:32px;justify-content:center;outline:none;width:32px}@media screen and (min-width:768px){.mfui-modal-content__header-button{height:40px;width:40px}}.mfui-modal-content__header-button_back{left:16px}.mfui-modal-content__header-button_close{right:16px}.mfui-modal-content__header-button_shadow{background:var(--base);border-radius:50%;-webkit-box-shadow:0 2px 12px rgba(0,0,0,.1);box-shadow:0 2px 12px rgba(0,0,0,.1)}.mfui-modal-content__header-button svg{fill:var(--content)}.mfui-modal-content__title-area{-webkit-box-sizing:border-box;box-sizing:border-box;margin:0 48px;padding:12px}@media screen and (min-width:768px){.mfui-modal-content__title-area{margin:0 56px;padding:16px}}.mfui-modal-content__title{font-size:18px;font-weight:500;letter-spacing:.5px;line-height:24px;text-align:center}@media screen and (min-width:1280px){.mfui-modal-content__title{font-size:20px;line-height:28px}}@media screen and (min-width:768px){.mfui-modal-content__title{font-size:20px;font-weight:500;letter-spacing:.5px;line-height:28px}}.mfui-modal-content__header-additional{-webkit-box-sizing:border-box;box-sizing:border-box;padding:8px 16px;text-align:center}@media screen and (min-width:768px){.mfui-modal-content__header-additional{padding-left:32px;padding-right:32px}}.mfui-modal-content__container-body{-webkit-box-sizing:border-box;box-sizing:border-box;padding-bottom:24px;padding-right:6px}@media screen and (min-width:768px){.mfui-modal-content__container-body{padding-bottom:32px;padding-right:12px}}.mfui-modal-content__children{-webkit-box-sizing:border-box;box-sizing:border-box;padding-left:16px;padding-right:4px;padding-top:24px}@media screen and (min-width:768px){.mfui-modal-content__children{padding-left:32px;padding-right:14px}}.mfui-modal-content__footer{padding-left:16px;padding-right:16px}.mfui-modal-content__container-wrap_static-header .mfui-modal-content__container-body{padding-top:24px}.mfui-modal-content__container-wrap_static-header .mfui-modal-content__children{padding-top:0}.mfui-modal-content__container-wrap_static-header .mfui-modal-content__header{margin-bottom:24px;margin-left:-16px;margin-right:-16px}@media screen and (min-width:768px){.mfui-modal-content__container-wrap_static-header .mfui-modal-content__header{margin-left:-32px;margin-right:-32px}}.mfui-modal-content__container-wrap_static-header .mfui-modal-content__header-main{min-height:40px}.mfui-modal-content__container-wrap_static-header .mfui-modal-content__header-button{top:0}.mfui-modal-content__container-wrap_static-header .mfui-modal-content__title-area{padding-bottom:4px;padding-top:4px}.mfui-modal-content__container-wrap_hide-header .mfui-modal-content__container-body{padding-top:24px}.mfui-modal-content__container-wrap_hide-header .mfui-modal-content__children{padding-top:0}.mfui-modal-content__container-wrap_sticky-footer .mfui-modal-content__container-body{padding-bottom:0}.mfui-modal-content__container-wrap_sticky-footer .mfui-modal-content__footer_shadow{-webkit-box-shadow:0 2px 12px rgba(0,0,0,.1);box-shadow:0 2px 12px rgba(0,0,0,.1)}.mfui-modal-content__container-wrap_out-side-buttons .mfui-modal-content__container-body{padding-top:24px}.mfui-modal-content__container-wrap_native-scroll .mfui-modal-content__children,.mfui-modal-content__container-wrap_native-scroll .mfui-modal-content__container-body{padding:0}.mfui-modal-content__container-wrap_transition-end{-webkit-animation:hide-popup .2s ease-in;animation:hide-popup .2s ease-in}@-webkit-keyframes show-popup{0%{-webkit-transform:scale(95%);transform:scale(95%);-webkit-transform-origin:top;transform-origin:top}to{-webkit-transform:scale(100%);transform:scale(100%)}}@keyframes show-popup{0%{-webkit-transform:scale(95%);transform:scale(95%);-webkit-transform-origin:top;transform-origin:top}to{-webkit-transform:scale(100%);transform:scale(100%)}}@-webkit-keyframes hide-popup{0%{-webkit-transform:scale(100%);transform:scale(100%)}to{-webkit-transform:scale(95%);transform:scale(95%)}}@keyframes hide-popup{0%{-webkit-transform:scale(100%);transform:scale(100%)}to{-webkit-transform:scale(95%);transform:scale(95%)}}
1
+ h1,h2,h3,h4,h5{margin:0}.mfui-modal-content__background{background-color:rgba(0,0,0,.8);bottom:0;left:0;position:fixed;right:0;top:0}.mfui-modal-content__container-wrap{-webkit-animation:show-popup .3s ease-out;animation:show-popup .3s ease-out;position:relative;width:100%}@media screen and (min-width:768px){.mfui-modal-content__container-wrap{-webkit-transition:height .1s;transition:height .1s;width:740px}}.mfui-modal-content__container-inner{background-color:var(--background);font-family:inherit;width:100%}.mfui-modal-content__header{position:relative}.mfui-modal-content__header_shadow{-webkit-box-shadow:0 2px 12px rgba(0,0,0,.1);box-shadow:0 2px 12px rgba(0,0,0,.1)}.mfui-modal-content__header-main{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;min-height:52px}@media screen and (min-width:768px){.mfui-modal-content__header-main{min-height:64px}}.mfui-modal-content__header-button{display:-webkit-box;display:-ms-flexbox;display:flex;position:absolute;top:12px;z-index:2;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;background:transparent;border:none;cursor:pointer;height:32px;justify-content:center;outline:none;width:32px}@media screen and (min-width:768px){.mfui-modal-content__header-button{height:40px;width:40px}}.mfui-modal-content__header-button_back{left:16px}.mfui-modal-content__header-button_close{right:16px}.mfui-modal-content__header-button_shadow{background:var(--base);border-radius:50%;-webkit-box-shadow:0 2px 12px rgba(0,0,0,.1);box-shadow:0 2px 12px rgba(0,0,0,.1)}.mfui-modal-content__header-button svg{fill:var(--content)}.mfui-modal-content__title-area{-webkit-box-sizing:border-box;box-sizing:border-box;margin:0 48px;padding:12px}@media screen and (min-width:768px){.mfui-modal-content__title-area{margin:0 56px;padding:16px}}.mfui-modal-content__title{font-size:18px;font-weight:500;letter-spacing:.5px;line-height:24px;text-align:center}@media screen and (min-width:1280px){.mfui-modal-content__title{font-size:20px;line-height:28px}}@media screen and (min-width:768px){.mfui-modal-content__title{font-size:20px;font-weight:500;letter-spacing:.5px;line-height:28px}}.mfui-modal-content__header-additional{-webkit-box-sizing:border-box;box-sizing:border-box;padding:8px 16px;text-align:center}@media screen and (min-width:768px){.mfui-modal-content__header-additional{padding-left:32px;padding-right:32px}}.mfui-modal-content__container-body{-webkit-box-sizing:border-box;box-sizing:border-box;padding-bottom:24px;padding-right:6px}@media screen and (min-width:768px){.mfui-modal-content__container-body{padding-bottom:32px;padding-right:12px}}.mfui-modal-content__children{-webkit-box-sizing:border-box;box-sizing:border-box;padding-left:16px;padding-right:4px;padding-top:24px}@media screen and (min-width:768px){.mfui-modal-content__children{padding-left:32px;padding-right:14px}}.mfui-modal-content__container-wrap_static-header .mfui-modal-content__container-body{padding-top:24px}.mfui-modal-content__container-wrap_static-header .mfui-modal-content__children{padding-top:0}.mfui-modal-content__container-wrap_static-header .mfui-modal-content__header{margin-bottom:24px;margin-left:-16px;margin-right:-16px}@media screen and (min-width:768px){.mfui-modal-content__container-wrap_static-header .mfui-modal-content__header{margin-left:-32px;margin-right:-32px}}.mfui-modal-content__container-wrap_static-header .mfui-modal-content__header-main{min-height:40px}.mfui-modal-content__container-wrap_static-header .mfui-modal-content__header-button{top:0}.mfui-modal-content__container-wrap_static-header .mfui-modal-content__title-area{padding-bottom:4px;padding-top:4px}.mfui-modal-content__container-wrap_hide-header .mfui-modal-content__container-body{padding-top:24px}.mfui-modal-content__container-wrap_hide-header .mfui-modal-content__children{padding-top:0}.mfui-modal-content__container-wrap_sticky-footer .mfui-modal-content__container-body{padding-bottom:0}.mfui-modal-content__container-wrap_sticky-footer .mfui-modal-content__footer{padding-left:16px;padding-right:16px}@media screen and (min-width:768px){.mfui-modal-content__container-wrap_sticky-footer .mfui-modal-content__footer{padding-left:32px;padding-right:32px}}.mfui-modal-content__container-wrap_sticky-footer .mfui-modal-content__footer_shadow{-webkit-box-shadow:0 2px 12px rgba(0,0,0,.1);box-shadow:0 2px 12px rgba(0,0,0,.1)}.mfui-modal-content__container-wrap_out-side-buttons .mfui-modal-content__container-body{padding-top:24px}.mfui-modal-content__container-wrap_native-scroll .mfui-modal-content__children,.mfui-modal-content__container-wrap_native-scroll .mfui-modal-content__container-body{padding:0}.mfui-modal-content__container-wrap_transition-end{-webkit-animation:hide-popup .2s ease-in;animation:hide-popup .2s ease-in}@-webkit-keyframes show-popup{0%{-webkit-transform:scale(95%);transform:scale(95%);-webkit-transform-origin:top;transform-origin:top}to{-webkit-transform:scale(100%);transform:scale(100%)}}@keyframes show-popup{0%{-webkit-transform:scale(95%);transform:scale(95%);-webkit-transform-origin:top;transform-origin:top}to{-webkit-transform:scale(100%);transform:scale(100%)}}@-webkit-keyframes hide-popup{0%{-webkit-transform:scale(100%);transform:scale(100%)}to{-webkit-transform:scale(95%);transform:scale(95%)}}@keyframes hide-popup{0%{-webkit-transform:scale(100%);transform:scale(100%)}to{-webkit-transform:scale(95%);transform:scale(95%)}}
@@ -94,7 +94,7 @@ var ModalContent = function ModalContent(_ref) {
94
94
  className: cn('header-button', {
95
95
  back: true,
96
96
  shadow: hasHeaderButtonsShadow
97
- }),
97
+ }, classes === null || classes === void 0 ? void 0 : classes.headerBackButton),
98
98
  type: "button",
99
99
  onClick: onBackButtonClick
100
100
  }), isSmallIcon ? /*#__PURE__*/React.createElement(ArrowLeft24, null) : /*#__PURE__*/React.createElement(ArrowLeft32, null));
@@ -31,6 +31,7 @@ var ModalMobileBottom = function ModalMobileBottom(_a) {
31
31
  var _restProps$refs = restProps.refs,
32
32
  containerWrapRef = _restProps$refs.containerWrapRef,
33
33
  containerInnerRef = _restProps$refs.containerInnerRef,
34
+ scrollBarScrollableRef = _restProps$refs.scrollBarScrollableRef,
34
35
  isTransitionMoveStep = restProps.isTransitionMoveStep,
35
36
  isTransitionEndStep = restProps.isTransitionEndStep;
36
37
  var _React$useState = React.useState(null),
@@ -51,9 +52,11 @@ var ModalMobileBottom = function ModalMobileBottom(_a) {
51
52
  window.cancelAnimationFrame(animationFrameId.current);
52
53
  }
53
54
  var containerWrapNode = containerWrapRef.current;
55
+ var scrollableNode = scrollBarScrollableRef.current;
54
56
  animationFrameId.current = window.requestAnimationFrame(function () {
55
57
  onChangeTransitionStep(MODAL_TRANSITIONS_STEPS_ENUM.MOVE_STEP);
56
- if (!containerWrapNode || e.target !== containerWrapNode) {
58
+ var isScrollTop = ((scrollableNode === null || scrollableNode === void 0 ? void 0 : scrollableNode.scrollTop) || 0) === 0;
59
+ if (!containerWrapNode || !isScrollTop) {
57
60
  return;
58
61
  }
59
62
  if (!initialContainerWrapHeight) {
@@ -74,11 +77,13 @@ var ModalMobileBottom = function ModalMobileBottom(_a) {
74
77
  onChangeContainerWrapTransform("translateY(".concat(positionsDiffAbs, "px)"));
75
78
  animationFrameId.current = 0;
76
79
  });
77
- }, [containerWrapRef, initialContainerWrapHeight, initialTouchPosition, onChangeContainerWrapTransform, onChangeTransitionStep]);
80
+ }, [containerWrapRef, scrollBarScrollableRef, initialContainerWrapHeight, initialTouchPosition, onChangeContainerWrapTransform, onChangeTransitionStep]);
78
81
  var handleWindowTouchEnd = React.useCallback(function (e) {
79
82
  var _a;
80
83
  var containerWrapNode = containerWrapRef.current;
81
- if (!containerWrapNode || !isTransitionMoveStep || e.target !== containerWrapNode) {
84
+ var scrollableNode = scrollBarScrollableRef.current;
85
+ var isScrollTop = ((scrollableNode === null || scrollableNode === void 0 ? void 0 : scrollableNode.scrollTop) || 0) === 0;
86
+ if (!containerWrapNode || !isTransitionMoveStep || !isScrollTop) {
82
87
  return;
83
88
  }
84
89
  window.cancelAnimationFrame(animationFrameId.current);
@@ -87,7 +92,7 @@ var ModalMobileBottom = function ModalMobileBottom(_a) {
87
92
  setInitialTouchPosition(null);
88
93
  onChangeContainerWrapTransform(isMoreHalfClosed ? 'translateY(100%)' : 'none');
89
94
  onChangeTransitionStep(isMoreHalfClosed ? MODAL_TRANSITIONS_STEPS_ENUM.MOVE_END_STEP : MODAL_TRANSITIONS_STEPS_ENUM.INITIAL_STEP);
90
- }, [containerWrapRef, isTransitionMoveStep, offsetHeightCenter, onChangeContainerWrapTransform, onChangeTransitionStep]);
95
+ }, [containerWrapRef, scrollBarScrollableRef, isTransitionMoveStep, offsetHeightCenter, onChangeContainerWrapTransform, onChangeTransitionStep]);
91
96
  React.useEffect(function () {
92
97
  if (isSwipeDisabled) {
93
98
  return undefined;
@@ -8,6 +8,7 @@ var mockModalContextProps = {
8
8
  containerInner: 'containerInner-class',
9
9
  containerBody: 'containerBody-class',
10
10
  header: 'header-class',
11
+ headerBackButton: 'headerBackButton-class',
11
12
  headerCloseButton: 'headerCloseButton-class',
12
13
  titleArea: 'titleArea-class',
13
14
  title: 'title-class',
@@ -62,6 +63,9 @@ var mockModalContextProps = {
62
63
  },
63
64
  containerBodyRef: {
64
65
  current: null
66
+ },
67
+ scrollBarScrollableRef: {
68
+ current: null
65
69
  }
66
70
  },
67
71
  isMobile: false,
@@ -11,6 +11,7 @@ type ModalContextPropsType = ModalComponentPropsType & {
11
11
  containerWrapRef: RefType;
12
12
  containerInnerRef: RefType;
13
13
  containerBodyRef: RefType;
14
+ scrollBarScrollableRef: React.MutableRefObject<HTMLElement | null>;
14
15
  };
15
16
  isMobile: boolean;
16
17
  isTransitionMoveStep: boolean;
@@ -30,6 +30,8 @@ export interface IScrollBarProps {
30
30
  showAlways?: boolean;
31
31
  /** Ref обработчик */
32
32
  getScrollBar?: (node: HTMLElement) => void;
33
+ /** Ref обработчик для Scrollable element */
34
+ getScrollable?: (node: HTMLElement) => void;
33
35
  children?: React.ReactNode;
34
36
  }
35
37
  declare const ScrollBar: React.FC<IScrollBarProps>;
@@ -17,12 +17,14 @@ var ScrollBar = function ScrollBar(_ref) {
17
17
  hideMobile = _ref.hideMobile,
18
18
  showAlways = _ref.showAlways,
19
19
  getScrollBar = _ref.getScrollBar,
20
+ getScrollable = _ref.getScrollable,
20
21
  children = _ref.children;
21
22
  var _React$useState = React.useState(false),
22
23
  _React$useState2 = _slicedToArray(_React$useState, 2),
23
24
  isInitialHide = _React$useState2[0],
24
25
  setIsInitialHide = _React$useState2[1];
25
26
  var scrollBarInitNode = React.useRef(null);
27
+ var scrollableNode = React.useRef(null);
26
28
  var resizeObserver = React.useRef(null);
27
29
  function handleGetScrollBarRef(node) {
28
30
  if (!node) {
@@ -32,6 +34,10 @@ var ScrollBar = function ScrollBar(_ref) {
32
34
  scrollBarInitNode.current = scrollInitEl;
33
35
  getScrollBar === null || getScrollBar === void 0 ? void 0 : getScrollBar(scrollInitEl);
34
36
  }
37
+ function handleGetScrollableRef(node) {
38
+ scrollableNode.current = node;
39
+ getScrollable === null || getScrollable === void 0 ? void 0 : getScrollable(node);
40
+ }
35
41
  var handleSetInitialHide = React.useCallback(function () {
36
42
  if (!scrollBarInitNode.current || !maxHeight) {
37
43
  setIsInitialHide(false);
@@ -57,7 +63,7 @@ var ScrollBar = function ScrollBar(_ref) {
57
63
  }
58
64
  };
59
65
  }, [handleSetInitialHide, maxHeight]);
60
- return /*#__PURE__*/React.createElement("div", _extends({
66
+ return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
61
67
  className: cn({
62
68
  'initial-hide': isInitialHide,
63
69
  'hide-all': hideAll,
@@ -67,7 +73,7 @@ var ScrollBar = function ScrollBar(_ref) {
67
73
  'hide-mobile': hideMobile,
68
74
  'show-always': showAlways
69
75
  }, [classes === null || classes === void 0 ? void 0 : classes.root])
70
- }, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root)), /*#__PURE__*/React.createElement(SimpleBar, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.init), {
76
+ }), /*#__PURE__*/React.createElement(SimpleBar, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.init), {
71
77
  className: cn('init', [classes === null || classes === void 0 ? void 0 : classes.init]),
72
78
  classNames: {
73
79
  track: cn('scroll-track'),
@@ -80,7 +86,10 @@ var ScrollBar = function ScrollBar(_ref) {
80
86
  maxHeight: "".concat(maxHeight, "px")
81
87
  },
82
88
  forceVisible: "y",
83
- ref: handleGetScrollBarRef
89
+ ref: handleGetScrollBarRef,
90
+ scrollableNodeProps: {
91
+ ref: handleGetScrollableRef
92
+ }
84
93
  }), /*#__PURE__*/React.createElement("div", {
85
94
  className: cn('children-wrap', [classes === null || classes === void 0 ? void 0 : classes.childrenWrap])
86
95
  }, children)));
@@ -68,6 +68,8 @@ export interface ISearchProps {
68
68
  verification?: VerificationType;
69
69
  /** Дополнительный текст под полем. Свойство verification влияет на цвет текста. */
70
70
  noticeText?: string | JSX.Element;
71
+ /** Максимальное вводимое количество текста */
72
+ maxLength?: number;
71
73
  /** Отключение поля ввода */
72
74
  disabled?: boolean;
73
75
  /** Делает поле обязательным */
@@ -85,6 +85,7 @@ var Search = function Search(_ref) {
85
85
  disabled = _ref.disabled,
86
86
  required = _ref.required,
87
87
  noticeText = _ref.noticeText,
88
+ maxLength = _ref.maxLength,
88
89
  className = _ref.className,
89
90
  classes = _ref.classes,
90
91
  _ref$type = _ref.type,
@@ -500,6 +501,7 @@ var Search = function Search(_ref) {
500
501
  }, [classes === null || classes === void 0 ? void 0 : classes.input]),
501
502
  placeholder: placeholder,
502
503
  value: searchQuery,
504
+ maxLength: maxLength,
503
505
  onChange: handleChange,
504
506
  onFocus: handleFocus,
505
507
  onBlur: handleBlur,
@@ -526,6 +528,7 @@ var Search = function Search(_ref) {
526
528
  },
527
529
  placeholder: placeholder,
528
530
  value: searchQuery,
531
+ maxLength: maxLength,
529
532
  onChange: handleChange,
530
533
  onFocus: handleFocus,
531
534
  onBlur: handleBlur,
@@ -18,6 +18,7 @@ export { default as Counter } from './components/Counter/Counter';
18
18
  export { default as CounterBadge } from './components/Badges/CounterBadge/CounterBadge';
19
19
  export { default as countGraphemes } from './components/TextField/utils/countGraphemes';
20
20
  export { default as Day } from './components/Calendar/components/_Day/Day';
21
+ export { default as ErrorLoad } from './components/ErrorLoad/ErrorLoad';
21
22
  export { default as Grid } from './components/Grid/Grid';
22
23
  export { default as GridColumn } from './components/Grid/GridColumn';
23
24
  export { default as Header } from './components/Header/Header';
package/dist/es/index.js CHANGED
@@ -18,6 +18,7 @@ export { default as Counter } from "./components/Counter/Counter";
18
18
  export { default as CounterBadge } from "./components/Badges/CounterBadge/CounterBadge";
19
19
  export { default as countGraphemes } from "./components/TextField/utils/countGraphemes";
20
20
  export { default as Day } from "./components/Calendar/components/_Day/Day";
21
+ export { default as ErrorLoad } from "./components/ErrorLoad/ErrorLoad";
21
22
  export { default as Grid } from "./components/Grid/Grid";
22
23
  export { default as GridColumn } from "./components/Grid/GridColumn";
23
24
  export { default as Header } from "./components/Header/Header";
@@ -0,0 +1 @@
1
+ h1,h2,h3,h4,h5{margin:0}.mfui-error-load{background:inherit}.mfui-error-load_cardinal_vertical{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;gap:12px;-ms-flex-align:center;-ms-flex-item-align:stretch;align-self:stretch}.mfui-error-load_cardinal_horizontal,.mfui-error-load_cardinal_vertical{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;align-items:center}.mfui-error-load_cardinal_horizontal{gap:8px;-ms-flex-align:center;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.mfui-error-load__header{text-align:center}.mfui-error-load__text .mfui-error-load__caption_background_on-color,.mfui-error-load__text .mfui-error-load__header_background_on-color{color:var(--stcWhite)}.mfui-error-load__text .mfui-error-load__caption_background_on-base{color:var(--spbSky3)}.mfui-error-load__text{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;gap:4px}.mfui-error-load__text_cardinal_vertical{-webkit-box-align:center;-ms-flex-align:center;align-items:center;-ms-flex-item-align:stretch;align-self:stretch}
@@ -0,0 +1,23 @@
1
+ import * as React from 'react';
2
+ import { IButtonProps } from '../Button/Button';
3
+ import './ErrorLoad.scss';
4
+ type ButtonProps = Pick<IButtonProps, 'disabled' | 'showLoader' | 'onClick'>;
5
+ export interface IErrorLoadProps {
6
+ /** Размер блока */
7
+ big?: boolean;
8
+ /** Цветовая тема */
9
+ background?: 'on-base' | 'on-color';
10
+ /** Ориентация блока */
11
+ cardinalDirection?: 'vertical' | 'horizontal';
12
+ /** Параметры кнопки */
13
+ buttonParams?: ButtonProps;
14
+ /** Дополнительный класс корневого элемента */
15
+ className?: string;
16
+ /** Дополнительные data атрибуты к внутренним элементам */
17
+ dataAttrs?: {
18
+ root?: Record<string, string>;
19
+ button?: Record<string, string>;
20
+ };
21
+ }
22
+ declare const ErrorLoad: React.FC<IErrorLoadProps>;
23
+ export default ErrorLoad;
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ require("core-js/modules/es.string.big.js");
10
+ var React = _interopRequireWildcard(require("react"));
11
+ var _uiHelpers = require("@megafon/ui-helpers");
12
+ var _Button = _interopRequireDefault(require("../Button/Button"));
13
+ var _Caption = _interopRequireDefault(require("../Caption/Caption"));
14
+ var _Header = _interopRequireDefault(require("../Header/Header"));
15
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
16
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
17
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
18
+ var RefreshIcon24 = function RefreshIcon24(props) {
19
+ return /*#__PURE__*/React.createElement("svg", (0, _extends2["default"])({
20
+ viewBox: "0 0 32 32"
21
+ }, props), /*#__PURE__*/React.createElement("path", {
22
+ fillRule: "evenodd",
23
+ clipRule: "evenodd",
24
+ d: "M16.064 8C11.604 8 8 11.588 8 16s3.604 8 8.064 8c4.1 0 7.478-3.033 7.995-6.948l1.983.262C25.393 22.223 21.17 26 16.064 26 10.513 26 6 21.53 6 16S10.513 6 16.064 6c3.456 0 6.507 1.731 8.32 4.371l.704-2.345 1.915.575-1.419 4.726a1 1 0 01-1.228.675l-4.855-1.364.541-1.925 2.664.748A8.074 8.074 0 0016.064 8z"
25
+ }));
26
+ };
27
+ var cn = (0, _uiHelpers.cnCreate)('mfui-error-load');
28
+ var ErrorLoad = function ErrorLoad(_ref) {
29
+ var _ref$background = _ref.background,
30
+ background = _ref$background === void 0 ? 'on-base' : _ref$background,
31
+ _ref$big = _ref.big,
32
+ big = _ref$big === void 0 ? true : _ref$big,
33
+ _ref$cardinalDirectio = _ref.cardinalDirection,
34
+ cardinalDirection = _ref$cardinalDirectio === void 0 ? 'horizontal' : _ref$cardinalDirectio,
35
+ className = _ref.className,
36
+ dataAttrs = _ref.dataAttrs,
37
+ buttonParams = _ref.buttonParams;
38
+ var isBaseBackground = background === 'on-base';
39
+ var isSmallIconSize = cardinalDirection === 'horizontal' || !big;
40
+ return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({
41
+ className: cn({
42
+ cardinal: cardinalDirection
43
+ }, className)
44
+ }, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root)), /*#__PURE__*/React.createElement("div", {
45
+ className: cn('text', {
46
+ cardinal: cardinalDirection
47
+ })
48
+ }, /*#__PURE__*/React.createElement(_Header["default"], {
49
+ as: big ? 'h3' : 'h5',
50
+ className: cn('header', {
51
+ background: background
52
+ })
53
+ }, "\u0414\u0430\u043D\u043D\u044B\u0435 \u043D\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043B\u0438\u0441\u044C"), big && /*#__PURE__*/React.createElement(_Caption["default"], {
54
+ hasMargin: false,
55
+ className: cn('caption', {
56
+ background: background
57
+ })
58
+ }, "\u041E\u0431\u043D\u043E\u0432\u0438\u0442\u0435 \u0438\u043B\u0438 \u0437\u0430\u0439\u0434\u0438\u0442\u0435 \u043F\u043E\u0437\u0436\u0435")), /*#__PURE__*/React.createElement(_Button["default"], (0, _extends2["default"])({
59
+ icon: /*#__PURE__*/React.createElement(RefreshIcon24, null),
60
+ theme: isBaseBackground ? 'green' : 'white',
61
+ sizeAll: isSmallIconSize ? 'small' : 'medium'
62
+ }, buttonParams, {
63
+ dataAttrs: {
64
+ root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.button
65
+ }
66
+ })));
67
+ };
68
+ var _default = exports["default"] = ErrorLoad;
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import type { IScrollBarProps } from '../ScrollBar/ScrollBar';
3
3
  import './Modal.scss';
4
4
  export declare enum MODAL_MOBILE_VIEWS_ENUM {
5
- FULL_SCREEN = "full-screen",
5
+ FULL_SCREEN = "fullScreen",// use camelCase for simple using in props from backend
6
6
  BOTTOM = "bottom"
7
7
  }
8
8
  export declare enum MODAL_TRANSITIONS_STEPS_ENUM {
@@ -20,6 +20,7 @@ export type ModalClassesType = {
20
20
  containerInner?: string;
21
21
  containerBody?: string;
22
22
  header?: string;
23
+ headerBackButton?: string;
23
24
  headerCloseButton?: string;
24
25
  titleArea?: string;
25
26
  title?: string;
@@ -88,6 +89,8 @@ export interface IModalProps {
88
89
  isDisabledBackgroundClick?: boolean;
89
90
  /** Восстанавливает фокус на элементе, который был сфокусирован до открытия модального окна */
90
91
  isReturnFocusAfterClose?: boolean;
92
+ /** Пересчитывать максимальную высоту скролла */
93
+ isRecalculateHeight?: boolean;
91
94
  /** Должен ли root-элемент приложения быть скрыт */
92
95
  hideAriaApp?: boolean;
93
96
  /** Устанавливает aria-label */
@@ -12,6 +12,7 @@ var _uiHelpers = require("@megafon/ui-helpers");
12
12
  var _lodash = _interopRequireDefault(require("lodash.throttle"));
13
13
  var _reactModal = _interopRequireDefault(require("react-modal"));
14
14
  var _throttleTime = _interopRequireDefault(require("../../constants/throttleTime"));
15
+ var _usePrevious = _interopRequireDefault(require("../../hooks/usePrevious"));
15
16
  var _useResolution2 = _interopRequireDefault(require("../../hooks/useResolution"));
16
17
  var _ModalDesktop = _interopRequireDefault(require("./_ModalDesktop/ModalDesktop"));
17
18
  var _ModalMobileBottom = _interopRequireDefault(require("./_ModalMobileBottom/ModalMobileBottom"));
@@ -24,7 +25,7 @@ var MOBILE_BIG_START = _uiHelpers.breakpoints.MOBILE_BIG_START;
24
25
  var HEIGHT_TRANSITION_PROPERTY = 'height';
25
26
  var MODAL_MOBILE_VIEWS_ENUM;
26
27
  (function (MODAL_MOBILE_VIEWS_ENUM) {
27
- MODAL_MOBILE_VIEWS_ENUM["FULL_SCREEN"] = "full-screen";
28
+ MODAL_MOBILE_VIEWS_ENUM["FULL_SCREEN"] = "fullScreen";
28
29
  MODAL_MOBILE_VIEWS_ENUM["BOTTOM"] = "bottom";
29
30
  })(MODAL_MOBILE_VIEWS_ENUM || (exports.MODAL_MOBILE_VIEWS_ENUM = MODAL_MOBILE_VIEWS_ENUM = {}));
30
31
  var MODAL_TRANSITIONS_STEPS_ENUM;
@@ -49,6 +50,7 @@ var Modal = function Modal(_ref) {
49
50
  isEnabledNativeScroll = _ref.isEnabledNativeScroll,
50
51
  isSwipeDisabled = _ref.isSwipeDisabled,
51
52
  isDisabledBackgroundClick = _ref.isDisabledBackgroundClick,
53
+ isRecalculateHeight = _ref.isRecalculateHeight,
52
54
  _ref$hideAriaApp = _ref.hideAriaApp,
53
55
  hideAriaApp = _ref$hideAriaApp === void 0 ? false : _ref$hideAriaApp,
54
56
  contentLabel = _ref.contentLabel,
@@ -94,6 +96,7 @@ var Modal = function Modal(_ref) {
94
96
  var containerWrapRef = React.useRef(null);
95
97
  var containerInnerRef = React.useRef(null);
96
98
  var containerBodyRef = React.useRef(null);
99
+ var scrollBarScrollableRef = React.useRef(null);
97
100
  var resizeObserver = React.useRef(null);
98
101
  var _useResolution = (0, _useResolution2["default"])(),
99
102
  isMobile = _useResolution.isMobile;
@@ -102,6 +105,15 @@ var Modal = function Modal(_ref) {
102
105
  var isBottomTransitionIn = transitionStep !== MODAL_TRANSITIONS_STEPS_ENUM.END_STEP && transitionStep !== MODAL_TRANSITIONS_STEPS_ENUM.MOVE_END_STEP;
103
106
  var isTransitionMoveStep = transitionStep === MODAL_TRANSITIONS_STEPS_ENUM.MOVE_STEP;
104
107
  var isTransitionEndStep = transitionStep === MODAL_TRANSITIONS_STEPS_ENUM.END_STEP;
108
+ var prevMobileView = (0, _usePrevious["default"])(mobileView);
109
+ var isChangeMobileView = mobileView !== prevMobileView;
110
+ var prevHeaderProps = (0, _usePrevious["default"])(headerProps);
111
+ var prevFooterProps = (0, _usePrevious["default"])(footerProps);
112
+ var isHeaderPropsDiff = headerProps !== prevHeaderProps;
113
+ var isFooterPropsDiff = footerProps !== prevFooterProps;
114
+ var handleGetScrollBarScrollableRef = function handleGetScrollBarScrollableRef(node) {
115
+ scrollBarScrollableRef.current = node;
116
+ };
105
117
  var handleChangeTransitionStep = function handleChangeTransitionStep(value) {
106
118
  setTransitionStep(value);
107
119
  };
@@ -210,6 +222,18 @@ var Modal = function Modal(_ref) {
210
222
  window.removeEventListener('resize', handleThrottleResize);
211
223
  };
212
224
  }, [isEnabledNativeScroll, handleSetScrollContentMaxHeight]);
225
+ React.useEffect(function () {
226
+ if (!isMobile || !isChangeMobileView) {
227
+ return;
228
+ }
229
+ handleSetScrollContentMaxHeight();
230
+ }, [isMobile, isChangeMobileView, handleSetScrollContentMaxHeight]);
231
+ React.useEffect(function () {
232
+ if (isEnabledNativeScroll || !(isRecalculateHeight && (isHeaderPropsDiff || isFooterPropsDiff))) {
233
+ return;
234
+ }
235
+ handleSetScrollContentMaxHeight();
236
+ }, [isEnabledNativeScroll, isFooterPropsDiff, isRecalculateHeight, isHeaderPropsDiff, handleSetScrollContentMaxHeight]);
213
237
  React.useEffect(function () {
214
238
  return function () {
215
239
  setIsPopupOpened(false);
@@ -224,7 +248,8 @@ var Modal = function Modal(_ref) {
224
248
  classes: classes,
225
249
  dataAttrs: dataAttrs,
226
250
  scrollBarParams: (0, _extends2["default"])((0, _extends2["default"])({}, scrollBarParams), {
227
- maxHeight: scrollMaxHeight
251
+ maxHeight: scrollMaxHeight,
252
+ getScrollable: handleGetScrollBarScrollableRef
228
253
  }),
229
254
  headerProps: headerProps,
230
255
  footerProps: footerProps,
@@ -234,7 +259,8 @@ var Modal = function Modal(_ref) {
234
259
  footerRef: footerRef,
235
260
  containerWrapRef: containerWrapRef,
236
261
  containerInnerRef: containerInnerRef,
237
- containerBodyRef: containerBodyRef
262
+ containerBodyRef: containerBodyRef,
263
+ scrollBarScrollableRef: scrollBarScrollableRef
238
264
  },
239
265
  isEnabledNativeScroll: isEnabledNativeScroll,
240
266
  isDisabledBackgroundClick: isDisabledBackgroundClick,
@@ -1 +1 @@
1
- h1,h2,h3,h4,h5{margin:0}.mfui-modal-content__background{background-color:rgba(0,0,0,.8);bottom:0;left:0;position:fixed;right:0;top:0}.mfui-modal-content__container-wrap{-webkit-animation:show-popup .3s ease-out;animation:show-popup .3s ease-out;position:relative;width:100%}@media screen and (min-width:768px){.mfui-modal-content__container-wrap{-webkit-transition:height .1s;transition:height .1s;width:740px}}.mfui-modal-content__container-inner{background-color:var(--background);font-family:inherit;width:100%}.mfui-modal-content__header{position:relative}.mfui-modal-content__header_shadow{-webkit-box-shadow:0 2px 12px rgba(0,0,0,.1);box-shadow:0 2px 12px rgba(0,0,0,.1)}.mfui-modal-content__header-main{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;min-height:52px}@media screen and (min-width:768px){.mfui-modal-content__header-main{min-height:64px}}.mfui-modal-content__header-button{display:-webkit-box;display:-ms-flexbox;display:flex;position:absolute;top:12px;z-index:2;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;background:transparent;border:none;cursor:pointer;height:32px;justify-content:center;outline:none;width:32px}@media screen and (min-width:768px){.mfui-modal-content__header-button{height:40px;width:40px}}.mfui-modal-content__header-button_back{left:16px}.mfui-modal-content__header-button_close{right:16px}.mfui-modal-content__header-button_shadow{background:var(--base);border-radius:50%;-webkit-box-shadow:0 2px 12px rgba(0,0,0,.1);box-shadow:0 2px 12px rgba(0,0,0,.1)}.mfui-modal-content__header-button svg{fill:var(--content)}.mfui-modal-content__title-area{-webkit-box-sizing:border-box;box-sizing:border-box;margin:0 48px;padding:12px}@media screen and (min-width:768px){.mfui-modal-content__title-area{margin:0 56px;padding:16px}}.mfui-modal-content__title{font-size:18px;font-weight:500;letter-spacing:.5px;line-height:24px;text-align:center}@media screen and (min-width:1280px){.mfui-modal-content__title{font-size:20px;line-height:28px}}@media screen and (min-width:768px){.mfui-modal-content__title{font-size:20px;font-weight:500;letter-spacing:.5px;line-height:28px}}.mfui-modal-content__header-additional{-webkit-box-sizing:border-box;box-sizing:border-box;padding:8px 16px;text-align:center}@media screen and (min-width:768px){.mfui-modal-content__header-additional{padding-left:32px;padding-right:32px}}.mfui-modal-content__container-body{-webkit-box-sizing:border-box;box-sizing:border-box;padding-bottom:24px;padding-right:6px}@media screen and (min-width:768px){.mfui-modal-content__container-body{padding-bottom:32px;padding-right:12px}}.mfui-modal-content__children{-webkit-box-sizing:border-box;box-sizing:border-box;padding-left:16px;padding-right:4px;padding-top:24px}@media screen and (min-width:768px){.mfui-modal-content__children{padding-left:32px;padding-right:14px}}.mfui-modal-content__footer{padding-left:16px;padding-right:16px}.mfui-modal-content__container-wrap_static-header .mfui-modal-content__container-body{padding-top:24px}.mfui-modal-content__container-wrap_static-header .mfui-modal-content__children{padding-top:0}.mfui-modal-content__container-wrap_static-header .mfui-modal-content__header{margin-bottom:24px;margin-left:-16px;margin-right:-16px}@media screen and (min-width:768px){.mfui-modal-content__container-wrap_static-header .mfui-modal-content__header{margin-left:-32px;margin-right:-32px}}.mfui-modal-content__container-wrap_static-header .mfui-modal-content__header-main{min-height:40px}.mfui-modal-content__container-wrap_static-header .mfui-modal-content__header-button{top:0}.mfui-modal-content__container-wrap_static-header .mfui-modal-content__title-area{padding-bottom:4px;padding-top:4px}.mfui-modal-content__container-wrap_hide-header .mfui-modal-content__container-body{padding-top:24px}.mfui-modal-content__container-wrap_hide-header .mfui-modal-content__children{padding-top:0}.mfui-modal-content__container-wrap_sticky-footer .mfui-modal-content__container-body{padding-bottom:0}.mfui-modal-content__container-wrap_sticky-footer .mfui-modal-content__footer_shadow{-webkit-box-shadow:0 2px 12px rgba(0,0,0,.1);box-shadow:0 2px 12px rgba(0,0,0,.1)}.mfui-modal-content__container-wrap_out-side-buttons .mfui-modal-content__container-body{padding-top:24px}.mfui-modal-content__container-wrap_native-scroll .mfui-modal-content__children,.mfui-modal-content__container-wrap_native-scroll .mfui-modal-content__container-body{padding:0}.mfui-modal-content__container-wrap_transition-end{-webkit-animation:hide-popup .2s ease-in;animation:hide-popup .2s ease-in}@-webkit-keyframes show-popup{0%{-webkit-transform:scale(95%);transform:scale(95%);-webkit-transform-origin:top;transform-origin:top}to{-webkit-transform:scale(100%);transform:scale(100%)}}@keyframes show-popup{0%{-webkit-transform:scale(95%);transform:scale(95%);-webkit-transform-origin:top;transform-origin:top}to{-webkit-transform:scale(100%);transform:scale(100%)}}@-webkit-keyframes hide-popup{0%{-webkit-transform:scale(100%);transform:scale(100%)}to{-webkit-transform:scale(95%);transform:scale(95%)}}@keyframes hide-popup{0%{-webkit-transform:scale(100%);transform:scale(100%)}to{-webkit-transform:scale(95%);transform:scale(95%)}}
1
+ h1,h2,h3,h4,h5{margin:0}.mfui-modal-content__background{background-color:rgba(0,0,0,.8);bottom:0;left:0;position:fixed;right:0;top:0}.mfui-modal-content__container-wrap{-webkit-animation:show-popup .3s ease-out;animation:show-popup .3s ease-out;position:relative;width:100%}@media screen and (min-width:768px){.mfui-modal-content__container-wrap{-webkit-transition:height .1s;transition:height .1s;width:740px}}.mfui-modal-content__container-inner{background-color:var(--background);font-family:inherit;width:100%}.mfui-modal-content__header{position:relative}.mfui-modal-content__header_shadow{-webkit-box-shadow:0 2px 12px rgba(0,0,0,.1);box-shadow:0 2px 12px rgba(0,0,0,.1)}.mfui-modal-content__header-main{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;min-height:52px}@media screen and (min-width:768px){.mfui-modal-content__header-main{min-height:64px}}.mfui-modal-content__header-button{display:-webkit-box;display:-ms-flexbox;display:flex;position:absolute;top:12px;z-index:2;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;background:transparent;border:none;cursor:pointer;height:32px;justify-content:center;outline:none;width:32px}@media screen and (min-width:768px){.mfui-modal-content__header-button{height:40px;width:40px}}.mfui-modal-content__header-button_back{left:16px}.mfui-modal-content__header-button_close{right:16px}.mfui-modal-content__header-button_shadow{background:var(--base);border-radius:50%;-webkit-box-shadow:0 2px 12px rgba(0,0,0,.1);box-shadow:0 2px 12px rgba(0,0,0,.1)}.mfui-modal-content__header-button svg{fill:var(--content)}.mfui-modal-content__title-area{-webkit-box-sizing:border-box;box-sizing:border-box;margin:0 48px;padding:12px}@media screen and (min-width:768px){.mfui-modal-content__title-area{margin:0 56px;padding:16px}}.mfui-modal-content__title{font-size:18px;font-weight:500;letter-spacing:.5px;line-height:24px;text-align:center}@media screen and (min-width:1280px){.mfui-modal-content__title{font-size:20px;line-height:28px}}@media screen and (min-width:768px){.mfui-modal-content__title{font-size:20px;font-weight:500;letter-spacing:.5px;line-height:28px}}.mfui-modal-content__header-additional{-webkit-box-sizing:border-box;box-sizing:border-box;padding:8px 16px;text-align:center}@media screen and (min-width:768px){.mfui-modal-content__header-additional{padding-left:32px;padding-right:32px}}.mfui-modal-content__container-body{-webkit-box-sizing:border-box;box-sizing:border-box;padding-bottom:24px;padding-right:6px}@media screen and (min-width:768px){.mfui-modal-content__container-body{padding-bottom:32px;padding-right:12px}}.mfui-modal-content__children{-webkit-box-sizing:border-box;box-sizing:border-box;padding-left:16px;padding-right:4px;padding-top:24px}@media screen and (min-width:768px){.mfui-modal-content__children{padding-left:32px;padding-right:14px}}.mfui-modal-content__container-wrap_static-header .mfui-modal-content__container-body{padding-top:24px}.mfui-modal-content__container-wrap_static-header .mfui-modal-content__children{padding-top:0}.mfui-modal-content__container-wrap_static-header .mfui-modal-content__header{margin-bottom:24px;margin-left:-16px;margin-right:-16px}@media screen and (min-width:768px){.mfui-modal-content__container-wrap_static-header .mfui-modal-content__header{margin-left:-32px;margin-right:-32px}}.mfui-modal-content__container-wrap_static-header .mfui-modal-content__header-main{min-height:40px}.mfui-modal-content__container-wrap_static-header .mfui-modal-content__header-button{top:0}.mfui-modal-content__container-wrap_static-header .mfui-modal-content__title-area{padding-bottom:4px;padding-top:4px}.mfui-modal-content__container-wrap_hide-header .mfui-modal-content__container-body{padding-top:24px}.mfui-modal-content__container-wrap_hide-header .mfui-modal-content__children{padding-top:0}.mfui-modal-content__container-wrap_sticky-footer .mfui-modal-content__container-body{padding-bottom:0}.mfui-modal-content__container-wrap_sticky-footer .mfui-modal-content__footer{padding-left:16px;padding-right:16px}@media screen and (min-width:768px){.mfui-modal-content__container-wrap_sticky-footer .mfui-modal-content__footer{padding-left:32px;padding-right:32px}}.mfui-modal-content__container-wrap_sticky-footer .mfui-modal-content__footer_shadow{-webkit-box-shadow:0 2px 12px rgba(0,0,0,.1);box-shadow:0 2px 12px rgba(0,0,0,.1)}.mfui-modal-content__container-wrap_out-side-buttons .mfui-modal-content__container-body{padding-top:24px}.mfui-modal-content__container-wrap_native-scroll .mfui-modal-content__children,.mfui-modal-content__container-wrap_native-scroll .mfui-modal-content__container-body{padding:0}.mfui-modal-content__container-wrap_transition-end{-webkit-animation:hide-popup .2s ease-in;animation:hide-popup .2s ease-in}@-webkit-keyframes show-popup{0%{-webkit-transform:scale(95%);transform:scale(95%);-webkit-transform-origin:top;transform-origin:top}to{-webkit-transform:scale(100%);transform:scale(100%)}}@keyframes show-popup{0%{-webkit-transform:scale(95%);transform:scale(95%);-webkit-transform-origin:top;transform-origin:top}to{-webkit-transform:scale(100%);transform:scale(100%)}}@-webkit-keyframes hide-popup{0%{-webkit-transform:scale(100%);transform:scale(100%)}to{-webkit-transform:scale(95%);transform:scale(95%)}}@keyframes hide-popup{0%{-webkit-transform:scale(100%);transform:scale(100%)}to{-webkit-transform:scale(95%);transform:scale(95%)}}
@@ -103,7 +103,7 @@ var ModalContent = function ModalContent(_ref) {
103
103
  className: cn('header-button', {
104
104
  back: true,
105
105
  shadow: hasHeaderButtonsShadow
106
- }),
106
+ }, classes === null || classes === void 0 ? void 0 : classes.headerBackButton),
107
107
  type: "button",
108
108
  onClick: onBackButtonClick
109
109
  }), isSmallIcon ? /*#__PURE__*/React.createElement(ArrowLeft24, null) : /*#__PURE__*/React.createElement(ArrowLeft32, null));
@@ -40,6 +40,7 @@ var ModalMobileBottom = function ModalMobileBottom(_a) {
40
40
  var _restProps$refs = restProps.refs,
41
41
  containerWrapRef = _restProps$refs.containerWrapRef,
42
42
  containerInnerRef = _restProps$refs.containerInnerRef,
43
+ scrollBarScrollableRef = _restProps$refs.scrollBarScrollableRef,
43
44
  isTransitionMoveStep = restProps.isTransitionMoveStep,
44
45
  isTransitionEndStep = restProps.isTransitionEndStep;
45
46
  var _React$useState = React.useState(null),
@@ -60,9 +61,11 @@ var ModalMobileBottom = function ModalMobileBottom(_a) {
60
61
  window.cancelAnimationFrame(animationFrameId.current);
61
62
  }
62
63
  var containerWrapNode = containerWrapRef.current;
64
+ var scrollableNode = scrollBarScrollableRef.current;
63
65
  animationFrameId.current = window.requestAnimationFrame(function () {
64
66
  onChangeTransitionStep(_Modal.MODAL_TRANSITIONS_STEPS_ENUM.MOVE_STEP);
65
- if (!containerWrapNode || e.target !== containerWrapNode) {
67
+ var isScrollTop = ((scrollableNode === null || scrollableNode === void 0 ? void 0 : scrollableNode.scrollTop) || 0) === 0;
68
+ if (!containerWrapNode || !isScrollTop) {
66
69
  return;
67
70
  }
68
71
  if (!initialContainerWrapHeight) {
@@ -83,11 +86,13 @@ var ModalMobileBottom = function ModalMobileBottom(_a) {
83
86
  onChangeContainerWrapTransform("translateY(".concat(positionsDiffAbs, "px)"));
84
87
  animationFrameId.current = 0;
85
88
  });
86
- }, [containerWrapRef, initialContainerWrapHeight, initialTouchPosition, onChangeContainerWrapTransform, onChangeTransitionStep]);
89
+ }, [containerWrapRef, scrollBarScrollableRef, initialContainerWrapHeight, initialTouchPosition, onChangeContainerWrapTransform, onChangeTransitionStep]);
87
90
  var handleWindowTouchEnd = React.useCallback(function (e) {
88
91
  var _a;
89
92
  var containerWrapNode = containerWrapRef.current;
90
- if (!containerWrapNode || !isTransitionMoveStep || e.target !== containerWrapNode) {
93
+ var scrollableNode = scrollBarScrollableRef.current;
94
+ var isScrollTop = ((scrollableNode === null || scrollableNode === void 0 ? void 0 : scrollableNode.scrollTop) || 0) === 0;
95
+ if (!containerWrapNode || !isTransitionMoveStep || !isScrollTop) {
91
96
  return;
92
97
  }
93
98
  window.cancelAnimationFrame(animationFrameId.current);
@@ -96,7 +101,7 @@ var ModalMobileBottom = function ModalMobileBottom(_a) {
96
101
  setInitialTouchPosition(null);
97
102
  onChangeContainerWrapTransform(isMoreHalfClosed ? 'translateY(100%)' : 'none');
98
103
  onChangeTransitionStep(isMoreHalfClosed ? _Modal.MODAL_TRANSITIONS_STEPS_ENUM.MOVE_END_STEP : _Modal.MODAL_TRANSITIONS_STEPS_ENUM.INITIAL_STEP);
99
- }, [containerWrapRef, isTransitionMoveStep, offsetHeightCenter, onChangeContainerWrapTransform, onChangeTransitionStep]);
104
+ }, [containerWrapRef, scrollBarScrollableRef, isTransitionMoveStep, offsetHeightCenter, onChangeContainerWrapTransform, onChangeTransitionStep]);
100
105
  React.useEffect(function () {
101
106
  if (isSwipeDisabled) {
102
107
  return undefined;
@@ -14,6 +14,7 @@ var mockModalContextProps = {
14
14
  containerInner: 'containerInner-class',
15
15
  containerBody: 'containerBody-class',
16
16
  header: 'header-class',
17
+ headerBackButton: 'headerBackButton-class',
17
18
  headerCloseButton: 'headerCloseButton-class',
18
19
  titleArea: 'titleArea-class',
19
20
  title: 'title-class',
@@ -68,6 +69,9 @@ var mockModalContextProps = {
68
69
  },
69
70
  containerBodyRef: {
70
71
  current: null
72
+ },
73
+ scrollBarScrollableRef: {
74
+ current: null
71
75
  }
72
76
  },
73
77
  isMobile: false,
@@ -11,6 +11,7 @@ type ModalContextPropsType = ModalComponentPropsType & {
11
11
  containerWrapRef: RefType;
12
12
  containerInnerRef: RefType;
13
13
  containerBodyRef: RefType;
14
+ scrollBarScrollableRef: React.MutableRefObject<HTMLElement | null>;
14
15
  };
15
16
  isMobile: boolean;
16
17
  isTransitionMoveStep: boolean;
@@ -30,6 +30,8 @@ export interface IScrollBarProps {
30
30
  showAlways?: boolean;
31
31
  /** Ref обработчик */
32
32
  getScrollBar?: (node: HTMLElement) => void;
33
+ /** Ref обработчик для Scrollable element */
34
+ getScrollable?: (node: HTMLElement) => void;
33
35
  children?: React.ReactNode;
34
36
  }
35
37
  declare const ScrollBar: React.FC<IScrollBarProps>;
@@ -25,12 +25,14 @@ var ScrollBar = function ScrollBar(_ref) {
25
25
  hideMobile = _ref.hideMobile,
26
26
  showAlways = _ref.showAlways,
27
27
  getScrollBar = _ref.getScrollBar,
28
+ getScrollable = _ref.getScrollable,
28
29
  children = _ref.children;
29
30
  var _React$useState = React.useState(false),
30
31
  _React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
31
32
  isInitialHide = _React$useState2[0],
32
33
  setIsInitialHide = _React$useState2[1];
33
34
  var scrollBarInitNode = React.useRef(null);
35
+ var scrollableNode = React.useRef(null);
34
36
  var resizeObserver = React.useRef(null);
35
37
  function handleGetScrollBarRef(node) {
36
38
  if (!node) {
@@ -40,6 +42,10 @@ var ScrollBar = function ScrollBar(_ref) {
40
42
  scrollBarInitNode.current = scrollInitEl;
41
43
  getScrollBar === null || getScrollBar === void 0 ? void 0 : getScrollBar(scrollInitEl);
42
44
  }
45
+ function handleGetScrollableRef(node) {
46
+ scrollableNode.current = node;
47
+ getScrollable === null || getScrollable === void 0 ? void 0 : getScrollable(node);
48
+ }
43
49
  var handleSetInitialHide = React.useCallback(function () {
44
50
  if (!scrollBarInitNode.current || !maxHeight) {
45
51
  setIsInitialHide(false);
@@ -65,7 +71,7 @@ var ScrollBar = function ScrollBar(_ref) {
65
71
  }
66
72
  };
67
73
  }, [handleSetInitialHide, maxHeight]);
68
- return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({
74
+ return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
69
75
  className: cn({
70
76
  'initial-hide': isInitialHide,
71
77
  'hide-all': hideAll,
@@ -75,7 +81,7 @@ var ScrollBar = function ScrollBar(_ref) {
75
81
  'hide-mobile': hideMobile,
76
82
  'show-always': showAlways
77
83
  }, [classes === null || classes === void 0 ? void 0 : classes.root])
78
- }, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root)), /*#__PURE__*/React.createElement(_simplebarReact["default"], (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.init), {
84
+ }), /*#__PURE__*/React.createElement(_simplebarReact["default"], (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.init), {
79
85
  className: cn('init', [classes === null || classes === void 0 ? void 0 : classes.init]),
80
86
  classNames: {
81
87
  track: cn('scroll-track'),
@@ -88,7 +94,10 @@ var ScrollBar = function ScrollBar(_ref) {
88
94
  maxHeight: "".concat(maxHeight, "px")
89
95
  },
90
96
  forceVisible: "y",
91
- ref: handleGetScrollBarRef
97
+ ref: handleGetScrollBarRef,
98
+ scrollableNodeProps: {
99
+ ref: handleGetScrollableRef
100
+ }
92
101
  }), /*#__PURE__*/React.createElement("div", {
93
102
  className: cn('children-wrap', [classes === null || classes === void 0 ? void 0 : classes.childrenWrap])
94
103
  }, children)));
@@ -68,6 +68,8 @@ export interface ISearchProps {
68
68
  verification?: VerificationType;
69
69
  /** Дополнительный текст под полем. Свойство verification влияет на цвет текста. */
70
70
  noticeText?: string | JSX.Element;
71
+ /** Максимальное вводимое количество текста */
72
+ maxLength?: number;
71
73
  /** Отключение поля ввода */
72
74
  disabled?: boolean;
73
75
  /** Делает поле обязательным */
@@ -94,6 +94,7 @@ var Search = function Search(_ref) {
94
94
  disabled = _ref.disabled,
95
95
  required = _ref.required,
96
96
  noticeText = _ref.noticeText,
97
+ maxLength = _ref.maxLength,
97
98
  className = _ref.className,
98
99
  classes = _ref.classes,
99
100
  _ref$type = _ref.type,
@@ -509,6 +510,7 @@ var Search = function Search(_ref) {
509
510
  }, [classes === null || classes === void 0 ? void 0 : classes.input]),
510
511
  placeholder: placeholder,
511
512
  value: searchQuery,
513
+ maxLength: maxLength,
512
514
  onChange: handleChange,
513
515
  onFocus: handleFocus,
514
516
  onBlur: handleBlur,
@@ -535,6 +537,7 @@ var Search = function Search(_ref) {
535
537
  },
536
538
  placeholder: placeholder,
537
539
  value: searchQuery,
540
+ maxLength: maxLength,
538
541
  onChange: handleChange,
539
542
  onFocus: handleFocus,
540
543
  onBlur: handleBlur,
@@ -18,6 +18,7 @@ export { default as Counter } from './components/Counter/Counter';
18
18
  export { default as CounterBadge } from './components/Badges/CounterBadge/CounterBadge';
19
19
  export { default as countGraphemes } from './components/TextField/utils/countGraphemes';
20
20
  export { default as Day } from './components/Calendar/components/_Day/Day';
21
+ export { default as ErrorLoad } from './components/ErrorLoad/ErrorLoad';
21
22
  export { default as Grid } from './components/Grid/Grid';
22
23
  export { default as GridColumn } from './components/Grid/GridColumn';
23
24
  export { default as Header } from './components/Header/Header';
package/dist/lib/index.js CHANGED
@@ -111,6 +111,12 @@ Object.defineProperty(exports, "Day", {
111
111
  return _Day["default"];
112
112
  }
113
113
  });
114
+ Object.defineProperty(exports, "ErrorLoad", {
115
+ enumerable: true,
116
+ get: function get() {
117
+ return _ErrorLoad["default"];
118
+ }
119
+ });
114
120
  Object.defineProperty(exports, "Grid", {
115
121
  enumerable: true,
116
122
  get: function get() {
@@ -497,6 +503,7 @@ var _Counter = _interopRequireDefault(require("./components/Counter/Counter"));
497
503
  var _CounterBadge = _interopRequireDefault(require("./components/Badges/CounterBadge/CounterBadge"));
498
504
  var _countGraphemes = _interopRequireDefault(require("./components/TextField/utils/countGraphemes"));
499
505
  var _Day = _interopRequireDefault(require("./components/Calendar/components/_Day/Day"));
506
+ var _ErrorLoad = _interopRequireDefault(require("./components/ErrorLoad/ErrorLoad"));
500
507
  var _Grid = _interopRequireDefault(require("./components/Grid/Grid"));
501
508
  var _GridColumn = _interopRequireDefault(require("./components/Grid/GridColumn"));
502
509
  var _Header = _interopRequireDefault(require("./components/Header/Header"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megafon/ui-core",
3
- "version": "7.7.0",
3
+ "version": "7.9.0",
4
4
  "files": [
5
5
  "dist",
6
6
  "styles"
@@ -50,7 +50,7 @@
50
50
  "@babel/preset-env": "^7.8.6",
51
51
  "@babel/preset-react": "^7.8.3",
52
52
  "@babel/preset-typescript": "^7.8.3",
53
- "@megafon/ui-icons": "^3.5.0",
53
+ "@megafon/ui-icons": "^3.5.1",
54
54
  "@svgr/core": "^2.4.1",
55
55
  "@testing-library/jest-dom": "^6.5.0",
56
56
  "@testing-library/react": "^16.0.1",
@@ -89,7 +89,7 @@
89
89
  "@datepicker-react/hooks": "^2.7.0",
90
90
  "@dnd-kit/core": "^6.1.0",
91
91
  "@dnd-kit/sortable": "^8.0.0",
92
- "@megafon/ui-helpers": "^3.1.1",
92
+ "@megafon/ui-helpers": "^3.1.2",
93
93
  "@mona-health/react-input-mask": "^3.0.3",
94
94
  "@popperjs/core": "^2.11.8",
95
95
  "core-js": "^3.6.4",
@@ -104,5 +104,5 @@
104
104
  "simplebar-react": "^3.2.5",
105
105
  "swiper": "^11.1.1"
106
106
  },
107
- "gitHead": "a573f87db1256b45a663aa9acc352edc61a58004"
107
+ "gitHead": "a981889514af3bc91afd05caf40ffe989995abcf"
108
108
  }