@alfalab/core-components-base-modal 5.9.0 → 6.0.0-snapshot-1393ffa

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 (104) hide show
  1. package/Component.js +17 -18
  2. package/Component.js.map +1 -0
  3. package/cssm/Component.js +17 -16
  4. package/cssm/Component.js.map +1 -0
  5. package/cssm/helpers/lockScroll.js +1 -0
  6. package/cssm/helpers/lockScroll.js.map +1 -0
  7. package/cssm/index.js +6 -5
  8. package/cssm/index.js.map +1 -0
  9. package/cssm/index.module.css +3 -23
  10. package/cssm/matches-polyfill.js +1 -0
  11. package/cssm/matches-polyfill.js.map +1 -0
  12. package/{Component.d.ts → cssm/src/Component.d.ts} +8 -11
  13. package/cssm/src/helpers/lockScroll.d.ts +8 -0
  14. package/cssm/src/index.d.ts +3 -0
  15. package/cssm/src/utils.d.ts +5 -0
  16. package/cssm/utils.js +6 -5
  17. package/cssm/utils.js.map +1 -0
  18. package/esm/Component.js +3 -4
  19. package/esm/Component.js.map +1 -0
  20. package/esm/helpers/lockScroll.js +1 -0
  21. package/esm/helpers/lockScroll.js.map +1 -0
  22. package/esm/index.css +17 -38
  23. package/esm/index.js +1 -0
  24. package/esm/index.js.map +1 -0
  25. package/esm/index.module.css.js +6 -0
  26. package/esm/index.module.css.js.map +1 -0
  27. package/esm/matches-polyfill.js +1 -0
  28. package/esm/matches-polyfill.js.map +1 -0
  29. package/{cssm → esm/src}/Component.d.ts +8 -11
  30. package/esm/src/helpers/lockScroll.d.ts +8 -0
  31. package/esm/src/index.d.ts +3 -0
  32. package/esm/src/utils.d.ts +5 -0
  33. package/esm/utils.js +1 -0
  34. package/esm/utils.js.map +1 -0
  35. package/helpers/lockScroll.js +1 -0
  36. package/helpers/lockScroll.js.map +1 -0
  37. package/index.css +17 -38
  38. package/index.js +6 -5
  39. package/index.js.map +1 -0
  40. package/index.module.css.js +8 -0
  41. package/index.module.css.js.map +1 -0
  42. package/matches-polyfill.js +1 -0
  43. package/matches-polyfill.js.map +1 -0
  44. package/modern/Component.js +3 -4
  45. package/modern/Component.js.map +1 -0
  46. package/modern/helpers/lockScroll.js +1 -0
  47. package/modern/helpers/lockScroll.js.map +1 -0
  48. package/modern/index.css +17 -38
  49. package/modern/index.js +1 -0
  50. package/modern/index.js.map +1 -0
  51. package/modern/index.module.css.js +6 -0
  52. package/modern/index.module.css.js.map +1 -0
  53. package/modern/matches-polyfill.js +1 -0
  54. package/modern/matches-polyfill.js.map +1 -0
  55. package/{esm → modern/src}/Component.d.ts +8 -11
  56. package/modern/src/helpers/lockScroll.d.ts +8 -0
  57. package/modern/src/index.d.ts +3 -0
  58. package/modern/src/utils.d.ts +5 -0
  59. package/modern/utils.js +1 -0
  60. package/modern/utils.js.map +1 -0
  61. package/moderncssm/Component.js +2 -1
  62. package/moderncssm/Component.js.map +1 -0
  63. package/moderncssm/helpers/lockScroll.js +1 -0
  64. package/moderncssm/helpers/lockScroll.js.map +1 -0
  65. package/moderncssm/index.js +1 -0
  66. package/moderncssm/index.js.map +1 -0
  67. package/moderncssm/index.module.css +1 -3
  68. package/moderncssm/matches-polyfill.js +1 -0
  69. package/moderncssm/matches-polyfill.js.map +1 -0
  70. package/{modern → moderncssm/src}/Component.d.ts +8 -11
  71. package/moderncssm/src/helpers/lockScroll.d.ts +8 -0
  72. package/moderncssm/src/index.d.ts +3 -0
  73. package/moderncssm/src/utils.d.ts +5 -0
  74. package/moderncssm/utils.js +1 -0
  75. package/moderncssm/utils.js.map +1 -0
  76. package/package.json +10 -11
  77. package/src/Component.d.ts +164 -0
  78. package/src/Component.tsx +1 -1
  79. package/src/helpers/lockScroll.d.ts +8 -0
  80. package/src/index.d.ts +3 -0
  81. package/src/utils.d.ts +5 -0
  82. package/utils.js +1 -0
  83. package/utils.js.map +1 -0
  84. package/cssm/helpers/lockScroll.d.ts +0 -5
  85. package/cssm/index.d.ts +0 -3
  86. package/cssm/matches-polyfill.d.ts +0 -1
  87. package/cssm/utils.d.ts +0 -6
  88. package/esm/helpers/lockScroll.d.ts +0 -5
  89. package/esm/index.d.ts +0 -3
  90. package/esm/matches-polyfill.d.ts +0 -1
  91. package/esm/utils.d.ts +0 -6
  92. package/helpers/lockScroll.d.ts +0 -5
  93. package/index.d.ts +0 -3
  94. package/matches-polyfill.d.ts +0 -1
  95. package/modern/helpers/lockScroll.d.ts +0 -5
  96. package/modern/index.d.ts +0 -3
  97. package/modern/matches-polyfill.d.ts +0 -1
  98. package/modern/utils.d.ts +0 -6
  99. package/moderncssm/Component.d.ts +0 -167
  100. package/moderncssm/helpers/lockScroll.d.ts +0 -5
  101. package/moderncssm/index.d.ts +0 -3
  102. package/moderncssm/matches-polyfill.d.ts +0 -1
  103. package/moderncssm/utils.d.ts +0 -6
  104. package/utils.d.ts +0 -6
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ require('./index.css');
4
+
5
+ var styles = {"component":"base-modal__component_1000t","wrapper":"base-modal__wrapper_1000t","content":"base-modal__content_1000t","hasFooter":"base-modal__hasFooter_1000t","hasHeader":"base-modal__hasHeader_1000t","hidden":"base-modal__hidden_1000t","backdrop":"base-modal__backdrop_1000t","appear":"base-modal__appear_1000t","enter":"base-modal__enter_1000t","appearActive":"base-modal__appearActive_1000t","enterActive":"base-modal__enterActive_1000t","exit":"base-modal__exit_1000t","exitActive":"base-modal__exitActive_1000t","exitDone":"base-modal__exitDone_1000t"};
6
+
7
+ module.exports = styles;
8
+ //# sourceMappingURL=index.module.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.module.css.js","sources":["src/index.module.css"],"sourcesContent":["@import '../../vars/src/index.css';\n\n:root {\n --window-inner-scrollY: 10px; /* fallback value to prevent ci error */\n}\n\nbody:global(.is-locked) {\n margin-top: calc(var(--window-inner-scrollY) * -1);\n position: fixed;\n overflow: hidden;\n}\n\n.component {\n position: relative;\n box-sizing: border-box;\n background: var(--color-light-modal-bg-primary);\n margin: auto;\n flex-shrink: 0;\n}\n\n.wrapper {\n position: fixed;\n top: var(--gap-0);\n left: var(--gap-0);\n right: var(--gap-0);\n bottom: var(--gap-0);\n\n overflow: auto;\n display: flex;\n flex-direction: column;\n align-items: center;\n outline: 0;\n overscroll-behavior: none;\n}\n\n.content {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n flex: 1;\n\n &.hasFooter {\n @media (display-mode: standalone) {\n padding-bottom: unset;\n }\n }\n\n &.hasHeader {\n @media (display-mode: standalone) {\n padding-top: unset;\n }\n }\n}\n\n.hidden {\n display: none;\n}\n\n.backdrop {\n z-index: 0;\n}\n\n.appear,\n.enter {\n opacity: 0;\n}\n\n.appearActive,\n.enterActive {\n opacity: 1;\n transition: opacity 200ms ease-in;\n}\n\n.exit {\n opacity: 1;\n}\n\n.exitActive,\n.exitDone {\n opacity: 0;\n transition: opacity 200ms ease-out;\n}\n"],"names":[],"mappings":";;;;AAEgB,aAAe,CAAC,WAAW,CAAC,6BAA6B,CAAC,SAAS,CAAC,2BAA2B,CAAC,SAAS,CAAC,2BAA2B,CAAC,WAAW,CAAC,6BAA6B,CAAC,WAAW,CAAC,6BAA6B,CAAC,QAAQ,CAAC,0BAA0B,CAAC,UAAU,CAAC,4BAA4B,CAAC,QAAQ,CAAC,0BAA0B,CAAC,OAAO,CAAC,yBAAyB,CAAC,cAAc,CAAC,gCAAgC,CAAC,aAAa,CAAC,+BAA+B,CAAC,MAAM,CAAC,wBAAwB,CAAC,YAAY,CAAC,8BAA8B,CAAC,UAAU,CAAC,4BAA4B,CAAC;;;;"}
@@ -18,3 +18,4 @@ if (typeof window !== 'undefined') {
18
18
  };
19
19
  }
20
20
  }
21
+ //# sourceMappingURL=matches-polyfill.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matches-polyfill.js","sources":["../src/matches-polyfill.ts"],"sourcesContent":["/* eslint-disable */\n// @ts-nocheck\n\nif (typeof window !== 'undefined') {\n if (Element && !Element.prototype.matches) {\n Element.prototype.matches =\n Element.prototype.matchesSelector ||\n Element.prototype.mozMatchesSelector ||\n Element.prototype.msMatchesSelector ||\n Element.prototype.oMatchesSelector ||\n Element.prototype.webkitMatchesSelector ||\n function (s) {\n const matches = (this.document || this.ownerDocument).querySelectorAll(s);\n let i = matches.length;\n while (--i >= 0 && matches.item(i) !== this) {}\n return i > -1;\n };\n }\n}\n"],"names":[],"mappings":";;AAAA;AACA;AAEA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;IAC/B,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,EAAE;QACvC,OAAO,CAAC,SAAS,CAAC,OAAO;YACrB,OAAO,CAAC,SAAS,CAAC,eAAe;gBACjC,OAAO,CAAC,SAAS,CAAC,kBAAkB;gBACpC,OAAO,CAAC,SAAS,CAAC,iBAAiB;gBACnC,OAAO,CAAC,SAAS,CAAC,gBAAgB;gBAClC,OAAO,CAAC,SAAS,CAAC,qBAAqB;AACvC,gBAAA,UAAU,CAAC,EAAA;AACP,oBAAA,IAAM,OAAO,GAAG,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC,CAAC;AACzE,oBAAA,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM;AACtB,oBAAA,OAAO,EAAE,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE;AAC7C,oBAAA,OAAO,CAAC,GAAG,EAAE;AACjB,iBAAC;AACR;AACJ;;"}
@@ -8,14 +8,12 @@ import { Backdrop } from '@alfalab/core-components-backdrop/modern';
8
8
  import { Portal } from '@alfalab/core-components-portal/modern';
9
9
  import { os, browser } from '@alfalab/core-components-shared/modern';
10
10
  import { Stack } from '@alfalab/core-components-stack/modern';
11
- import { stackingOrder } from '@alfalab/stack-context';
11
+ import { stackingOrder } from '@alfalab/core-components-stack-context/modern';
12
12
  import { unlockScroll, syncHeight, lockScroll } from './helpers/lockScroll.js';
13
13
  import { isScrolledToTop, isScrolledToBottom, handleContainer, restoreContainerStyles, hasScrollbar } from './utils.js';
14
+ import styles from './index.module.css.js';
14
15
  import './matches-polyfill.js';
15
16
 
16
- const styles = {"component":"base-modal__component_14ddh","wrapper":"base-modal__wrapper_14ddh","content":"base-modal__content_14ddh","hasFooter":"base-modal__hasFooter_14ddh","hasHeader":"base-modal__hasHeader_14ddh","hidden":"base-modal__hidden_14ddh","backdrop":"base-modal__backdrop_14ddh","appear":"base-modal__appear_14ddh","enter":"base-modal__enter_14ddh","appearActive":"base-modal__appearActive_14ddh","enterActive":"base-modal__enterActive_14ddh","exit":"base-modal__exit_14ddh","exitActive":"base-modal__exitActive_14ddh","exitDone":"base-modal__exitDone_14ddh"};
17
- require('./index.css')
18
-
19
17
  /* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
20
18
  // eslint-disable-next-line @typescript-eslint/no-redeclare
21
19
  const BaseModalContext = React.createContext({
@@ -270,3 +268,4 @@ BaseModal.displayName = 'BaseModal';
270
268
  BaseModalContext.displayName = 'BaseModalContext';
271
269
 
272
270
  export { BaseModal, BaseModalContext };
271
+ //# sourceMappingURL=Component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Component.js","sources":["../../src/Component.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\nimport React, {\n ComponentType,\n forwardRef,\n KeyboardEvent,\n MouseEvent,\n MutableRefObject,\n ReactNode,\n Ref,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n WheelEvent,\n} from 'react';\nimport FocusLock from 'react-focus-lock';\nimport mergeRefs from 'react-merge-refs';\nimport { CSSTransition } from 'react-transition-group';\nimport { TransitionProps } from 'react-transition-group/Transition';\nimport { ResizeObserver as ResizeObserverPolyfill } from '@juggle/resize-observer';\nimport cn from 'classnames';\n\nimport { Backdrop as DefaultBackdrop, BackdropProps } from '@alfalab/core-components-backdrop';\nimport { Portal, PortalProps } from '@alfalab/core-components-portal';\nimport { browser, os } from '@alfalab/core-components-shared';\nimport { Stack } from '@alfalab/core-components-stack';\nimport { stackingOrder } from '@alfalab/core-components-stack-context';\n\nimport { lockScroll, syncHeight, unlockScroll } from './helpers/lockScroll';\nimport {\n handleContainer,\n hasScrollbar,\n isScrolledToBottom,\n isScrolledToTop,\n restoreContainerStyles,\n} from './utils';\n\nimport styles from './index.module.css';\n\n// TODO Без полифила крашится FocusLock в IE11. Выпилить в будущем!!!.\nimport './matches-polyfill';\n\nexport type BaseModalProps = {\n /**\n * Контент\n */\n children?: ReactNode;\n\n /**\n * Компонент бэкдропа\n */\n Backdrop?: ComponentType<BackdropProps>;\n\n /**\n * Свойства для Бэкдропа\n */\n backdropProps?: Partial<BackdropProps> & Record<string, unknown>;\n\n /**\n * Нода, компонент или функция возвращающая их\n *\n * Контейнер к которому будут добавляться порталы\n */\n container?: PortalProps['getPortalContainer'];\n\n /**\n * Отключает автоматический перевод фокуса на модалку при открытии\n * @default false\n */\n disableAutoFocus?: boolean;\n\n /**\n * Отключает ловушку фокуса\n * @default false\n */\n disableFocusLock?: boolean;\n\n /**\n * Отключает восстановление фокуса на предыдущем элементе после закрытия модалки\n * @default false\n */\n disableRestoreFocus?: boolean;\n\n /**\n * Отключает вызов `callback` при нажатии Escape\n * @default false\n */\n disableEscapeKeyDown?: boolean;\n\n /**\n * Отключает вызов `callback` при клике на бэкдроп\n * @default false\n */\n disableBackdropClick?: boolean;\n\n /**\n * Отключает блокировку скролла при открытии модального окна\n * @default false\n */\n disableBlockingScroll?: boolean;\n\n /**\n * Содержимое модалки всегда в DOM\n * @default false\n */\n keepMounted?: boolean;\n\n /**\n * Управление видимостью модалки\n */\n open: boolean;\n\n /**\n * Дополнительный класс\n */\n className?: string;\n\n /**\n * Дополнительный класс\n */\n contentClassName?: string;\n\n /**\n * Дополнительные пропсы на dialog wrapper\n */\n wrapperProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;\n\n /**\n * Дополнительные пропсы на обертку контента\n */\n contentProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;\n\n /**\n * Дополнительные пропсы на компонентную обертку контента\n */\n componentDivProps?: React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLDivElement>,\n HTMLDivElement\n >;\n\n /**\n * Дополнительный класс для обертки (Modal)\n */\n wrapperClassName?: string;\n\n /**\n * Обработчик скролла контента\n */\n scrollHandler?: 'wrapper' | 'content' | MutableRefObject<HTMLDivElement | null>;\n\n /**\n * Пропсы для анимации (CSSTransition)\n */\n transitionProps?: Partial<TransitionProps>;\n\n /**\n * Рендерить ли в контейнер через портал.\n * @default true\n */\n usePortal?: boolean;\n\n /**\n * Обработчик события нажатия на бэкдроп\n */\n onBackdropClick?: (event: MouseEvent) => void;\n\n /**\n * Обработчик события нажатия на Escape\n *\n * Если `disableEscapeKeyDown` - false и модальное окно в фокусе\n */\n onEscapeKeyDown?: (event: KeyboardEvent) => void;\n\n /**\n * Обработчик закрытия\n */\n onClose?: (\n event: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>,\n reason?: 'backdropClick' | 'escapeKeyDown' | 'closerClick',\n ) => void;\n\n /**\n * Обработчик события onEntered компонента Transition\n */\n onMount?: () => void;\n\n /**\n * Обработчик события onExited компонента Transition\n */\n onUnmount?: () => void;\n\n /**\n * Идентификатор для систем автоматизированного тестирования\n */\n dataTestId?: string;\n\n /**\n * z-index компонента\n */\n zIndex?: number;\n\n /**\n * Реф, который должен быть установлен компонентной области\n */\n componentRef?: MutableRefObject<HTMLDivElement | null>;\n\n /**\n * Реф контентной области\n */\n contentElementRef?: MutableRefObject<HTMLDivElement | null>;\n\n /**\n * Блокирует скролл когда модальное окно открыто. Работает только на iOS.\n */\n iOSLock?: boolean;\n\n /**\n * Хэндлер события прокрутки колесиком\n */\n onWheel?: (e: WheelEvent<HTMLElement>) => void;\n};\n\nexport type BaseModalContext = {\n parentRef: React.RefObject<HTMLDivElement>;\n componentRef: React.RefObject<HTMLDivElement>;\n hasFooter?: boolean;\n hasHeader?: boolean;\n hasScroll?: boolean;\n headerHighlighted?: boolean;\n footerHighlighted?: boolean;\n headerOffset?: number;\n setHeaderOffset: (offset: number) => void;\n contentRef: Ref<HTMLElement>;\n setHasHeader: (exists: boolean) => void;\n setHasFooter: (exists: boolean) => void;\n onClose: Required<BaseModalProps>['onClose'];\n};\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const BaseModalContext = React.createContext<BaseModalContext>({\n parentRef: { current: null },\n componentRef: { current: null },\n hasFooter: false,\n hasHeader: false,\n hasScroll: false,\n headerHighlighted: false,\n footerHighlighted: false,\n headerOffset: 0,\n setHeaderOffset: () => null,\n contentRef: () => null,\n setHasHeader: () => null,\n setHasFooter: () => null,\n onClose: () => null,\n});\n\nexport const BaseModal = forwardRef<HTMLDivElement, BaseModalProps>(\n (\n {\n open,\n container,\n children,\n scrollHandler = 'wrapper',\n Backdrop = DefaultBackdrop,\n backdropProps = {},\n transitionProps = {},\n disableBackdropClick,\n disableAutoFocus = false,\n disableFocusLock = false,\n disableEscapeKeyDown = false,\n disableRestoreFocus = false,\n disableBlockingScroll = false,\n keepMounted = false,\n className,\n contentClassName,\n wrapperProps,\n contentProps,\n componentDivProps,\n wrapperClassName,\n onBackdropClick,\n onClose,\n onEscapeKeyDown,\n onMount,\n onUnmount,\n dataTestId,\n zIndex = stackingOrder.MODAL,\n componentRef = null,\n contentElementRef = null,\n usePortal = true,\n iOSLock = false,\n onWheel,\n },\n ref,\n ) => {\n const [exited, setExited] = useState<boolean | null>(null);\n const [hasScroll, setHasScroll] = useState(false);\n const [hasHeader, setHasHeader] = useState(false);\n const [hasFooter, setHasFooter] = useState(false);\n const [headerHighlighted, setHeaderHighlighted] = useState(false);\n const [footerHighlighted, setFooterHighlighted] = useState(false);\n const [headerOffset, setHeaderOffset] = useState(0);\n\n const componentNodeRef = useRef<HTMLDivElement>(null);\n const wrapperRef = useRef<HTMLDivElement>(null);\n const scrollableNodeRef = useRef<HTMLDivElement | null>(null);\n const contentNodeRef = useRef<HTMLDivElement | null>(null);\n const restoreContainerStylesRef = useRef<null | (() => void)>(null);\n const mouseDownTarget = useRef<HTMLElement>();\n const resizeObserverRef = useRef<ResizeObserver>();\n\n const checkToHasScrollBar = () => {\n if (scrollableNodeRef.current) {\n const scrollExists = hasScrollbar(scrollableNodeRef.current);\n\n setFooterHighlighted(scrollExists);\n setHasScroll(scrollExists);\n }\n };\n\n const isExited = exited || exited === null;\n const shouldRender = keepMounted || open || !isExited;\n\n const getContainer = useCallback(\n () => (container ? container() : document.body) as HTMLElement,\n [container],\n );\n\n const addResizeHandle = useCallback(() => {\n if (!resizeObserverRef.current) return;\n\n if (scrollableNodeRef.current) {\n resizeObserverRef.current.observe(scrollableNodeRef.current);\n }\n if (contentNodeRef.current) {\n resizeObserverRef.current.observe(contentNodeRef.current);\n }\n }, []);\n\n const removeResizeHandle = useCallback(() => resizeObserverRef.current?.disconnect(), []);\n\n const contentRef = useCallback((node: HTMLDivElement) => {\n if (node !== null) {\n contentNodeRef.current = node;\n if (resizeObserverRef.current) {\n resizeObserverRef.current.observe(node);\n }\n checkToHasScrollBar();\n }\n }, []);\n\n const handleScroll = useCallback(() => {\n if (!scrollableNodeRef.current || !componentNodeRef.current) return;\n\n if (hasHeader) {\n setHeaderHighlighted(\n !isScrolledToTop(scrollableNodeRef.current) &&\n componentNodeRef.current.getBoundingClientRect().top - headerOffset <= 1,\n );\n }\n\n if (hasFooter) {\n setFooterHighlighted(\n !isScrolledToBottom(scrollableNodeRef.current) &&\n componentNodeRef.current.getBoundingClientRect().bottom >=\n window.innerHeight - 1,\n );\n }\n }, [hasFooter, hasHeader, headerOffset]);\n\n const handleClose = useCallback<Required<BaseModalProps>['onClose']>(\n (event, reason) => {\n if (iOSLock && os.isIOS()) {\n unlockScroll();\n }\n\n if (onClose) {\n onClose(event, reason);\n }\n\n if (reason === 'backdropClick' && onBackdropClick) {\n onBackdropClick(event as MouseEvent);\n }\n\n if (reason === 'escapeKeyDown' && onEscapeKeyDown) {\n onEscapeKeyDown(event as KeyboardEvent);\n }\n\n return null;\n },\n [onBackdropClick, onClose, onEscapeKeyDown, iOSLock],\n );\n\n const handleBackdropMouseDown = (event: MouseEvent<HTMLElement>) => {\n let clickedOnScrollbar = false;\n const clientWidth = (event.target as HTMLElement)?.clientWidth;\n\n if (event.clientX && clientWidth) {\n // Устанавливаем смещение для абсолютно спозиционированного скроллбара в OSX в 17px.\n const offset = browser.getScrollbarSize() === 0 ? 17 : 0;\n\n clickedOnScrollbar = event.clientX + offset > clientWidth;\n }\n\n if (!disableBackdropClick && !clickedOnScrollbar) {\n mouseDownTarget.current = event.target as HTMLElement;\n }\n };\n\n const handleBackdropMouseUp = (event: MouseEvent<HTMLElement>) => {\n if (\n !disableBackdropClick &&\n event.target === wrapperRef.current &&\n mouseDownTarget.current === wrapperRef.current\n ) {\n handleClose(event, 'backdropClick');\n }\n\n mouseDownTarget.current = undefined;\n };\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n /*\n * Чтобы сохранить дефолтное поведение элементов и событий форм,\n * обработчик не устанавливает event.preventDefault()\n */\n if (event.key !== 'Escape') {\n return;\n }\n\n // Если есть обработчик escape на body\n event.stopPropagation();\n\n if (!disableEscapeKeyDown && handleClose) {\n handleClose(event, 'escapeKeyDown');\n }\n },\n [disableEscapeKeyDown, handleClose],\n );\n\n const getScrollHandler = useCallback(() => {\n if (scrollHandler === 'wrapper') return wrapperRef.current;\n if (scrollHandler === 'content') return componentNodeRef.current;\n\n return scrollHandler.current || wrapperRef.current;\n }, [scrollHandler]);\n\n const handleEntered: Required<TransitionProps>['onEntered'] = useCallback(\n (node, isAppearing) => {\n scrollableNodeRef.current = getScrollHandler();\n\n addResizeHandle();\n\n if (scrollableNodeRef.current) {\n scrollableNodeRef.current.addEventListener('scroll', handleScroll);\n handleScroll();\n }\n\n if (transitionProps.onEntered) {\n transitionProps.onEntered(node, isAppearing);\n }\n\n if (onMount) onMount();\n },\n [addResizeHandle, getScrollHandler, handleScroll, onMount, transitionProps],\n );\n\n const handleExited: Required<TransitionProps>['onExited'] = useCallback(\n (node) => {\n removeResizeHandle();\n\n setExited(true);\n\n if (scrollableNodeRef.current) {\n scrollableNodeRef.current.removeEventListener('scroll', handleScroll);\n }\n\n if (transitionProps.onExited) {\n transitionProps.onExited(node);\n }\n\n if (onUnmount) onUnmount();\n\n if (restoreContainerStylesRef.current) {\n restoreContainerStylesRef.current();\n }\n },\n [handleScroll, onUnmount, removeResizeHandle, transitionProps],\n );\n\n useEffect(() => {\n if (open && isExited) {\n if (!disableBlockingScroll) {\n const el = getContainer();\n\n const shouldIOSLock = iOSLock && os.isIOS();\n\n handleContainer(el, shouldIOSLock);\n if (shouldIOSLock) {\n syncHeight();\n lockScroll();\n }\n\n restoreContainerStylesRef.current = () => {\n restoreContainerStylesRef.current = null;\n restoreContainerStyles(el);\n };\n }\n\n setExited(false);\n }\n\n if (!open) {\n unlockScroll();\n }\n }, [getContainer, open, disableBlockingScroll, isExited, iOSLock]);\n\n useEffect(() => {\n const ResizeObserver = window.ResizeObserver || ResizeObserverPolyfill;\n\n resizeObserverRef.current = new ResizeObserver(checkToHasScrollBar);\n\n return () => {\n if (restoreContainerStylesRef.current) {\n restoreContainerStylesRef.current();\n }\n\n if (resizeObserverRef.current) {\n resizeObserverRef.current.disconnect();\n }\n };\n }, []);\n\n useEffect(() => {\n if (disableAutoFocus || !open) return;\n\n wrapperRef.current?.focus();\n }, [open, disableAutoFocus]);\n\n const contextValue = useMemo<BaseModalContext>(\n () => ({\n parentRef: wrapperRef,\n componentRef: componentNodeRef,\n hasHeader,\n hasFooter,\n hasScroll,\n headerHighlighted,\n footerHighlighted,\n headerOffset,\n setHeaderOffset,\n contentRef,\n setHasHeader,\n setHasFooter,\n onClose: handleClose,\n }),\n [\n contentRef,\n hasHeader,\n hasFooter,\n hasScroll,\n headerHighlighted,\n footerHighlighted,\n headerOffset,\n setHeaderOffset,\n handleClose,\n ],\n );\n\n const renderContent = () => (\n <Stack value={zIndex}>\n {(computedZIndex) => (\n <BaseModalContext.Provider value={contextValue}>\n <FocusLock\n disabled={disableFocusLock || !open}\n returnFocus={!disableRestoreFocus}\n >\n {Backdrop && (\n <Backdrop\n {...backdropProps}\n className={cn(backdropProps.className, styles.backdrop)}\n open={open}\n style={{\n zIndex: computedZIndex,\n }}\n />\n )}\n <div\n {...wrapperProps}\n role='dialog'\n className={cn(\n styles.wrapper,\n wrapperClassName,\n wrapperProps?.className,\n {\n [styles.hidden]: !open && isExited,\n },\n )}\n ref={mergeRefs([\n ref,\n wrapperRef,\n wrapperProps?.ref as Ref<HTMLDivElement>,\n ])}\n onKeyDown={handleKeyDown}\n onMouseDown={handleBackdropMouseDown}\n onMouseUp={handleBackdropMouseUp}\n onWheel={onWheel}\n tabIndex={-1}\n data-test-id={dataTestId}\n style={{\n zIndex: computedZIndex,\n }}\n >\n <CSSTransition\n appear={true}\n timeout={200}\n classNames={styles}\n nodeRef={componentNodeRef}\n {...transitionProps}\n in={open}\n onEntered={handleEntered}\n onExited={handleExited}\n >\n <div\n {...componentDivProps}\n className={cn(\n styles.component,\n className,\n componentDivProps?.className,\n )}\n ref={mergeRefs([\n componentRef,\n componentNodeRef,\n componentDivProps?.ref || null,\n ])}\n >\n <div\n {...contentProps}\n className={cn(\n styles.content,\n contentClassName,\n contentProps?.className,\n {\n [styles.hasFooter]: hasFooter,\n [styles.hasHeader]: hasHeader,\n },\n )}\n ref={contentElementRef}\n >\n {children}\n </div>\n </div>\n </CSSTransition>\n </div>\n </FocusLock>\n </BaseModalContext.Provider>\n )}\n </Stack>\n );\n\n if (!shouldRender) return null;\n\n return usePortal ? (\n <Portal getPortalContainer={container} immediateMount={true}>\n {renderContent()}\n </Portal>\n ) : (\n renderContent()\n );\n },\n);\n\nBaseModal.displayName = 'BaseModal';\nBaseModalContext.displayName = 'BaseModalContext';\n"],"names":["Backdrop","DefaultBackdrop","ResizeObserver","ResizeObser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AAG,EACZ,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,gBAAgB,EACrB,GAAA,eAAe,EACnB,EAAE,EAAE,IAAI,EACR,SAAS,EAAE,aAAa,EACxB,QAAQ,EAAE,YAAY,EAAA;oBAEtB,KACQ,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,GAAA,iBAAiB,EACrB,SAAS,EAAE,EAAE,CACT,MAAM,CAAC,SAAS,EAChB,SAAS,EACT,iBAAiB,EAAE,SAAS,CAC/B,EACD,GAAG,EAAE,SAAS,CAAC;4BACX,YAAY;4BACZ,gBAAgB;4BAChB,iBAAiB,EAAE,GAAG,IAAI,IAAI;yBACjC,CAAC,EAAA;AAEF,wBAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,GACQ,YAAY,EAChB,SAAS,EAAE,EAAE,CACT,MAAM,CAAC,OAAO,EACd,gBAAgB,EAChB,YAAY,EAAE,SAAS,EACvB;AACI,gCAAA,CAAC,MAAM,CAAC,SAAS,GAAG,SAAS;AAC7B,gCAAA,CAAC,MAAM,CAAC,SAAS,GAAG,SAAS;AAChC,6BAAA,CACJ,EACD,GAAG,EAAE,iBAAiB,IAErB,QAAQ,CACP,CACJ,CACM,CACd,CACE,CACY,CAC/B,CACG,CACX;AAED,IAAA,IAAI,CAAC,YAAY;AAAE,QAAA,OAAO,IAAI;IAE9B,OAAO,SAAS,IACZ,KAAC,CAAA,aAAA,CAAA,MAAM,EAAC,EAAA,kBAAkB,EAAE,SAAS,EAAE,cAAc,EAAE,IAAI,EACtD,EAAA,aAAa,EAAE,CACX,KAET,aAAa,EAAE,CAClB;AACL,CAAC;AAGL,SAAS,CAAC,WAAW,GAAG,WAAW;AACnC,gBAAgB,CAAC,WAAW,GAAG,kBAAkB;;;;"}
@@ -19,3 +19,4 @@ const syncHeight = () => {
19
19
  };
20
20
 
21
21
  export { isScrollLocked, lockScroll, syncHeight, unlockScroll };
22
+ //# sourceMappingURL=lockScroll.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lockScroll.js","sources":["../../../src/helpers/lockScroll.ts"],"sourcesContent":["/**\n * Хелпер для блокирования скроллинга в iOS\n * В проекте используется overflow: hidden для блокировки, но в некоторых случаях этого недостаточно. Данный хелпер призван решать эту проблему\n */\n\nlet scrollY: number;\n\nexport const isScrollLocked = () => document.body.classList.contains('is-locked');\n\nexport const lockScroll = () => {\n scrollY = window.scrollY;\n document.body.classList.add('is-locked');\n};\n\nexport const unlockScroll = () => {\n if (!isScrollLocked()) return;\n\n document.body.classList.remove('is-locked');\n window.scrollTo(0, scrollY);\n};\n\nexport const syncHeight = () => {\n document.body.style.setProperty('--window-inner-scrollY', `${window.scrollY}px`);\n};\n"],"names":[],"mappings":"AAAA;;;AAGG;AAEH,IAAI,OAAe;AAEN,MAAA,cAAc,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,WAAW;AAEzE,MAAM,UAAU,GAAG,MAAK;AAC3B,IAAA,OAAO,GAAG,MAAM,CAAC,OAAO;IACxB,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC;AAC5C;AAEO,MAAM,YAAY,GAAG,MAAK;IAC7B,IAAI,CAAC,cAAc,EAAE;QAAE;IAEvB,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC;AAC3C,IAAA,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC;AAC/B;AAEO,MAAM,UAAU,GAAG,MAAK;AAC3B,IAAA,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,wBAAwB,EAAE,GAAG,MAAM,CAAC,OAAO,CAAA,EAAA,CAAI,CAAC;AACpF;;;;"}
package/modern/index.css CHANGED
@@ -1,41 +1,20 @@
1
- /* hash: kce08 */
2
- :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
3
- } /* deprecated */ :root {
4
- --color-light-modal-bg-primary: #fff; /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
5
- } :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
6
- } :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
1
+ :root {
2
+ --color-light-modal-bg-primary: #fff;
7
3
  } :root {
8
-
9
- /* Hard */
10
-
11
- /* Up */
12
-
13
- /* Hard up */
14
- } :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
15
-
16
- /* новые значения, используйте их */
17
- } :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
18
-
19
- /* новые значения, используйте их */
20
-
21
- /* no-unit может приводить к проблемам в calc (#1559) */
22
- /* stylelint-disable-next-line length-zero-no-unit */
23
4
  --gap-0: 0px;
24
5
  } :root {
25
- } :root {
26
- } /* сбрасывает синюю подсветку при нажатии */ :root {
27
- --window-inner-scrollY: 10px; /* fallback value to prevent ci error */
6
+ --window-inner-scrollY: 10px;
28
7
  } body.is-locked {
29
8
  margin-top: calc(var(--window-inner-scrollY) * -1);
30
9
  position: fixed;
31
10
  overflow: hidden;
32
- } .base-modal__component_14ddh {
11
+ } .base-modal__component_1000t {
33
12
  position: relative;
34
13
  box-sizing: border-box;
35
14
  background: var(--color-light-modal-bg-primary);
36
15
  margin: auto;
37
16
  flex-shrink: 0;
38
- } .base-modal__wrapper_14ddh {
17
+ } .base-modal__wrapper_1000t {
39
18
  position: fixed;
40
19
  top: var(--gap-0);
41
20
  left: var(--gap-0);
@@ -48,33 +27,33 @@
48
27
  align-items: center;
49
28
  outline: 0;
50
29
  overscroll-behavior: none;
51
- } .base-modal__content_14ddh {
30
+ } .base-modal__content_1000t {
52
31
  width: 100%;
53
32
  height: 100%;
54
33
  display: flex;
55
34
  flex-direction: column;
56
35
  flex: 1
57
- } @media (display-mode: standalone) { .base-modal__content_14ddh.base-modal__hasFooter_14ddh {
36
+ } @media (display-mode: standalone) { .base-modal__content_1000t.base-modal__hasFooter_1000t {
58
37
  padding-bottom: unset
59
38
  }
60
- } @media (display-mode: standalone) { .base-modal__content_14ddh.base-modal__hasHeader_14ddh {
39
+ } @media (display-mode: standalone) { .base-modal__content_1000t.base-modal__hasHeader_1000t {
61
40
  padding-top: unset
62
41
  }
63
- } .base-modal__hidden_14ddh {
42
+ } .base-modal__hidden_1000t {
64
43
  display: none;
65
- } .base-modal__backdrop_14ddh {
44
+ } .base-modal__backdrop_1000t {
66
45
  z-index: 0;
67
- } .base-modal__appear_14ddh,
68
- .base-modal__enter_14ddh {
46
+ } .base-modal__appear_1000t,
47
+ .base-modal__enter_1000t {
69
48
  opacity: 0;
70
- } .base-modal__appearActive_14ddh,
71
- .base-modal__enterActive_14ddh {
49
+ } .base-modal__appearActive_1000t,
50
+ .base-modal__enterActive_1000t {
72
51
  opacity: 1;
73
52
  transition: opacity 200ms ease-in;
74
- } .base-modal__exit_14ddh {
53
+ } .base-modal__exit_1000t {
75
54
  opacity: 1;
76
- } .base-modal__exitActive_14ddh,
77
- .base-modal__exitDone_14ddh {
55
+ } .base-modal__exitActive_1000t,
56
+ .base-modal__exitDone_1000t {
78
57
  opacity: 0;
79
58
  transition: opacity 200ms ease-out;
80
59
  }
package/modern/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export { BaseModal, BaseModalContext } from './Component.js';
2
2
  export { handleContainer, hasScrollbar, isScrolledToBottom, isScrolledToTop, restoreContainerStyles } from './utils.js';
3
3
  export { isScrollLocked, lockScroll, syncHeight, unlockScroll } from './helpers/lockScroll.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -0,0 +1,6 @@
1
+ import './index.css';
2
+
3
+ const styles = {"component":"base-modal__component_1000t","wrapper":"base-modal__wrapper_1000t","content":"base-modal__content_1000t","hasFooter":"base-modal__hasFooter_1000t","hasHeader":"base-modal__hasHeader_1000t","hidden":"base-modal__hidden_1000t","backdrop":"base-modal__backdrop_1000t","appear":"base-modal__appear_1000t","enter":"base-modal__enter_1000t","appearActive":"base-modal__appearActive_1000t","enterActive":"base-modal__enterActive_1000t","exit":"base-modal__exit_1000t","exitActive":"base-modal__exitActive_1000t","exitDone":"base-modal__exitDone_1000t"};
4
+
5
+ export { styles as default };
6
+ //# sourceMappingURL=index.module.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.module.css.js","sources":["src/index.module.css"],"sourcesContent":["@import '../../vars/src/index.css';\n\n:root {\n --window-inner-scrollY: 10px; /* fallback value to prevent ci error */\n}\n\nbody:global(.is-locked) {\n margin-top: calc(var(--window-inner-scrollY) * -1);\n position: fixed;\n overflow: hidden;\n}\n\n.component {\n position: relative;\n box-sizing: border-box;\n background: var(--color-light-modal-bg-primary);\n margin: auto;\n flex-shrink: 0;\n}\n\n.wrapper {\n position: fixed;\n top: var(--gap-0);\n left: var(--gap-0);\n right: var(--gap-0);\n bottom: var(--gap-0);\n\n overflow: auto;\n display: flex;\n flex-direction: column;\n align-items: center;\n outline: 0;\n overscroll-behavior: none;\n}\n\n.content {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n flex: 1;\n\n &.hasFooter {\n @media (display-mode: standalone) {\n padding-bottom: unset;\n }\n }\n\n &.hasHeader {\n @media (display-mode: standalone) {\n padding-top: unset;\n }\n }\n}\n\n.hidden {\n display: none;\n}\n\n.backdrop {\n z-index: 0;\n}\n\n.appear,\n.enter {\n opacity: 0;\n}\n\n.appearActive,\n.enterActive {\n opacity: 1;\n transition: opacity 200ms ease-in;\n}\n\n.exit {\n opacity: 1;\n}\n\n.exitActive,\n.exitDone {\n opacity: 0;\n transition: opacity 200ms ease-out;\n}\n"],"names":[],"mappings":";;AAEgB,eAAe,CAAC,WAAW,CAAC,6BAA6B,CAAC,SAAS,CAAC,2BAA2B,CAAC,SAAS,CAAC,2BAA2B,CAAC,WAAW,CAAC,6BAA6B,CAAC,WAAW,CAAC,6BAA6B,CAAC,QAAQ,CAAC,0BAA0B,CAAC,UAAU,CAAC,4BAA4B,CAAC,QAAQ,CAAC,0BAA0B,CAAC,OAAO,CAAC,yBAAyB,CAAC,cAAc,CAAC,gCAAgC,CAAC,aAAa,CAAC,+BAA+B,CAAC,MAAM,CAAC,wBAAwB,CAAC,YAAY,CAAC,8BAA8B,CAAC,UAAU,CAAC,4BAA4B,CAAC;;;;"}
@@ -16,3 +16,4 @@ if (typeof window !== 'undefined') {
16
16
  };
17
17
  }
18
18
  }
19
+ //# sourceMappingURL=matches-polyfill.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matches-polyfill.js","sources":["../../src/matches-polyfill.ts"],"sourcesContent":["/* eslint-disable */\n// @ts-nocheck\n\nif (typeof window !== 'undefined') {\n if (Element && !Element.prototype.matches) {\n Element.prototype.matches =\n Element.prototype.matchesSelector ||\n Element.prototype.mozMatchesSelector ||\n Element.prototype.msMatchesSelector ||\n Element.prototype.oMatchesSelector ||\n Element.prototype.webkitMatchesSelector ||\n function (s) {\n const matches = (this.document || this.ownerDocument).querySelectorAll(s);\n let i = matches.length;\n while (--i >= 0 && matches.item(i) !== this) {}\n return i > -1;\n };\n }\n}\n"],"names":[],"mappings":"AAAA;AACA;AAEA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;IAC/B,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,EAAE;QACvC,OAAO,CAAC,SAAS,CAAC,OAAO;YACrB,OAAO,CAAC,SAAS,CAAC,eAAe;gBACjC,OAAO,CAAC,SAAS,CAAC,kBAAkB;gBACpC,OAAO,CAAC,SAAS,CAAC,iBAAiB;gBACnC,OAAO,CAAC,SAAS,CAAC,gBAAgB;gBAClC,OAAO,CAAC,SAAS,CAAC,qBAAqB;AACvC,gBAAA,UAAU,CAAC,EAAA;AACP,oBAAA,MAAM,OAAO,GAAG,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC,CAAC;AACzE,oBAAA,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM;AACtB,oBAAA,OAAO,EAAE,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE;AAC7C,oBAAA,OAAO,CAAC,GAAG,EAAE;AACjB,iBAAC;AACR;AACJ"}
@@ -1,11 +1,9 @@
1
- /// <reference types="react" />
2
- /// <reference types="react-transition-group" />
3
- import React from 'react';
4
- import { ComponentType, KeyboardEvent, MouseEvent, MutableRefObject, ReactNode, Ref, WheelEvent } from "react";
1
+ import React, { ComponentType, KeyboardEvent, MouseEvent, MutableRefObject, ReactNode, Ref, WheelEvent } from 'react';
5
2
  import { TransitionProps } from 'react-transition-group/Transition';
6
- import { BackdropProps } from "@alfalab/core-components-backdrop";
7
- import { PortalProps } from "@alfalab/core-components-portal";
8
- type BaseModalProps = {
3
+ import { BackdropProps } from '@alfalab/core-components-backdrop';
4
+ import { PortalProps } from '@alfalab/core-components-portal';
5
+ import './matches-polyfill';
6
+ export declare type BaseModalProps = {
9
7
  /**
10
8
  * Контент
11
9
  */
@@ -147,7 +145,7 @@ type BaseModalProps = {
147
145
  */
148
146
  onWheel?: (e: WheelEvent<HTMLElement>) => void;
149
147
  };
150
- type BaseModalContext = {
148
+ export declare type BaseModalContext = {
151
149
  parentRef: React.RefObject<HTMLDivElement>;
152
150
  componentRef: React.RefObject<HTMLDivElement>;
153
151
  hasFooter?: boolean;
@@ -162,6 +160,5 @@ type BaseModalContext = {
162
160
  setHasFooter: (exists: boolean) => void;
163
161
  onClose: Required<BaseModalProps>['onClose'];
164
162
  };
165
- declare const BaseModalContext: React.Context<BaseModalContext>;
166
- declare const BaseModal: React.ForwardRefExoticComponent<BaseModalProps & React.RefAttributes<HTMLDivElement>>;
167
- export { BaseModalProps, BaseModalContext, BaseModal };
163
+ export declare const BaseModalContext: React.Context<BaseModalContext>;
164
+ export declare const BaseModal: React.ForwardRefExoticComponent<BaseModalProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Хелпер для блокирования скроллинга в iOS
3
+ * В проекте используется overflow: hidden для блокировки, но в некоторых случаях этого недостаточно. Данный хелпер призван решать эту проблему
4
+ */
5
+ export declare const isScrollLocked: () => boolean;
6
+ export declare const lockScroll: () => void;
7
+ export declare const unlockScroll: () => void;
8
+ export declare const syncHeight: () => void;
@@ -0,0 +1,3 @@
1
+ export * from './Component';
2
+ export * from './utils';
3
+ export * from './helpers/lockScroll';
@@ -0,0 +1,5 @@
1
+ export declare function isScrolledToTop(target: HTMLElement): boolean;
2
+ export declare function isScrolledToBottom(target: HTMLElement): boolean;
3
+ export declare function hasScrollbar(target: HTMLElement): boolean;
4
+ export declare const restoreContainerStyles: (container: HTMLElement) => void;
5
+ export declare const handleContainer: (container?: HTMLElement, shouldIOSLock?: boolean) => void;
package/modern/utils.js CHANGED
@@ -85,3 +85,4 @@ const handleContainer = (container, shouldIOSLock = false) => {
85
85
  };
86
86
 
87
87
  export { handleContainer, hasScrollbar, isScrolledToBottom, isScrolledToTop, restoreContainerStyles };
88
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sources":["../../src/utils.ts"],"sourcesContent":["import { getModalStore, SavedStyle } from '@alfalab/core-components-global-store';\nimport { browser } from '@alfalab/core-components-shared';\n\nexport function isScrolledToTop(target: HTMLElement) {\n return target.scrollTop <= 0;\n}\n\nexport function isScrolledToBottom(target: HTMLElement) {\n return target.scrollHeight - target.offsetHeight <= target.scrollTop;\n}\n\nexport function hasScrollbar(target: HTMLElement) {\n return target.scrollHeight > target.clientHeight;\n}\n\nconst isOverflowing = (container: Element) => {\n if (document.body === container) {\n return window.innerWidth > document.documentElement.clientWidth;\n }\n\n return container.scrollHeight > container.clientHeight;\n};\n\nconst getPaddingRight = (node: Element) =>\n parseInt(window.getComputedStyle(node).paddingRight, 10) || 0;\n\nexport const restoreContainerStyles = (container: HTMLElement) => {\n const modalRestoreStyles = getModalStore().getRestoreStyles();\n\n const index = modalRestoreStyles.findIndex((s) => s.container === container);\n const existingStyles = modalRestoreStyles[index];\n\n if (!existingStyles) return;\n\n existingStyles.modals -= 1;\n\n if (existingStyles.modals <= 0) {\n modalRestoreStyles.splice(index, 1);\n\n existingStyles.styles.forEach(({ value, el, key }) => {\n if (value) {\n el.style.setProperty(key, value);\n } else {\n el.style.removeProperty(key);\n }\n });\n }\n};\n\nexport const handleContainer = (container?: HTMLElement, shouldIOSLock = false) => {\n if (!container) return;\n\n const modalRestoreStyles = getModalStore().getRestoreStyles();\n\n const existingStyles = modalRestoreStyles.find((s) => s.container === container);\n\n if (existingStyles) {\n existingStyles.modals += 1;\n\n return;\n }\n\n const containerStyles: SavedStyle[] = [];\n\n if (isOverflowing(container)) {\n // Вычисляет размер до применения `overflow hidden` для избежания скачков\n const scrollbarSize = browser.getScrollbarSize();\n\n containerStyles.push({\n value: container.style.paddingRight,\n key: 'padding-right',\n el: container,\n });\n // Вычисляем стили, чтобы получить реальный `padding` c шириной сколлбара\n // eslint-disable-next-line no-param-reassign\n container.style.paddingRight = `${getPaddingRight(container) + scrollbarSize}px`;\n }\n\n const parent = container.parentElement;\n const scrollContainer =\n // TODO: заменить на optional chaining\n parent &&\n parent.nodeName === 'HTML' &&\n window.getComputedStyle(parent).overflowY === 'scroll'\n ? parent\n : container;\n\n // Блокируем скролл даже если отсутствует скроллбар\n if (scrollContainer.style.overflow !== 'hidden') {\n containerStyles.push({\n value: scrollContainer.style.overflow,\n key: 'overflow',\n el: scrollContainer,\n });\n }\n\n if (!shouldIOSLock) {\n scrollContainer.style.overflow = 'hidden';\n }\n\n modalRestoreStyles.push({\n container,\n modals: 1,\n styles: containerStyles,\n });\n};\n"],"names":[],"mappings":";;;AAGM,SAAU,eAAe,CAAC,MAAmB,EAAA;AAC/C,IAAA,OAAO,MAAM,CAAC,SAAS,IAAI,CAAC;AAChC;AAEM,SAAU,kBAAkB,CAAC,MAAmB,EAAA;IAClD,OAAO,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,SAAS;AACxE;AAEM,SAAU,YAAY,CAAC,MAAmB,EAAA;AAC5C,IAAA,OAAO,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY;AACpD;AAEA,MAAM,aAAa,GAAG,CAAC,SAAkB,KAAI;AACzC,IAAA,IAAI,QAAQ,CAAC,IAAI,KAAK,SAAS,EAAE;QAC7B,OAAO,MAAM,CAAC,UAAU,GAAG,QAAQ,CAAC,eAAe,CAAC,WAAW;AAClE;AAED,IAAA,OAAO,SAAS,CAAC,YAAY,GAAG,SAAS,CAAC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
  import { Portal } from '@alfalab/core-components-portal/moderncssm';
9
9
  import { os, browser } from '@alfalab/core-components-shared/moderncssm';
10
10
  import { Stack } from '@alfalab/core-components-stack/moderncssm';
11
- import { stackingOrder } from '@alfalab/stack-context';
11
+ import { stackingOrder } from '@alfalab/core-components-stack-context/moderncssm';
12
12
  import { unlockScroll, syncHeight, lockScroll } from './helpers/lockScroll.js';
13
13
  import { isScrolledToTop, isScrolledToBottom, handleContainer, restoreContainerStyles, hasScrollbar } from './utils.js';
14
14
  import styles from './index.module.css';
@@ -268,3 +268,4 @@ BaseModal.displayName = 'BaseModal';
268
268
  BaseModalContext.displayName = 'BaseModalContext';
269
269
 
270
270
  export { BaseModal, BaseModalContext };
271
+ //# sourceMappingURL=Component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Component.js","sources":["../../src/Component.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\nimport React, {\n ComponentType,\n forwardRef,\n KeyboardEvent,\n MouseEvent,\n MutableRefObject,\n ReactNode,\n Ref,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n WheelEvent,\n} from 'react';\nimport FocusLock from 'react-focus-lock';\nimport mergeRefs from 'react-merge-refs';\nimport { CSSTransition } from 'react-transition-group';\nimport { TransitionProps } from 'react-transition-group/Transition';\nimport { ResizeObserver as ResizeObserverPolyfill } from '@juggle/resize-observer';\nimport cn from 'classnames';\n\nimport { Backdrop as DefaultBackdrop, BackdropProps } from '@alfalab/core-components-backdrop';\nimport { Portal, PortalProps } from '@alfalab/core-components-portal';\nimport { browser, os } from '@alfalab/core-components-shared';\nimport { Stack } from '@alfalab/core-components-stack';\nimport { stackingOrder } from '@alfalab/core-components-stack-context';\n\nimport { lockScroll, syncHeight, unlockScroll } from './helpers/lockScroll';\nimport {\n handleContainer,\n hasScrollbar,\n isScrolledToBottom,\n isScrolledToTop,\n restoreContainerStyles,\n} from './utils';\n\nimport styles from './index.module.css';\n\n// TODO Без полифила крашится FocusLock в IE11. Выпилить в будущем!!!.\nimport './matches-polyfill';\n\nexport type BaseModalProps = {\n /**\n * Контент\n */\n children?: ReactNode;\n\n /**\n * Компонент бэкдропа\n */\n Backdrop?: ComponentType<BackdropProps>;\n\n /**\n * Свойства для Бэкдропа\n */\n backdropProps?: Partial<BackdropProps> & Record<string, unknown>;\n\n /**\n * Нода, компонент или функция возвращающая их\n *\n * Контейнер к которому будут добавляться порталы\n */\n container?: PortalProps['getPortalContainer'];\n\n /**\n * Отключает автоматический перевод фокуса на модалку при открытии\n * @default false\n */\n disableAutoFocus?: boolean;\n\n /**\n * Отключает ловушку фокуса\n * @default false\n */\n disableFocusLock?: boolean;\n\n /**\n * Отключает восстановление фокуса на предыдущем элементе после закрытия модалки\n * @default false\n */\n disableRestoreFocus?: boolean;\n\n /**\n * Отключает вызов `callback` при нажатии Escape\n * @default false\n */\n disableEscapeKeyDown?: boolean;\n\n /**\n * Отключает вызов `callback` при клике на бэкдроп\n * @default false\n */\n disableBackdropClick?: boolean;\n\n /**\n * Отключает блокировку скролла при открытии модального окна\n * @default false\n */\n disableBlockingScroll?: boolean;\n\n /**\n * Содержимое модалки всегда в DOM\n * @default false\n */\n keepMounted?: boolean;\n\n /**\n * Управление видимостью модалки\n */\n open: boolean;\n\n /**\n * Дополнительный класс\n */\n className?: string;\n\n /**\n * Дополнительный класс\n */\n contentClassName?: string;\n\n /**\n * Дополнительные пропсы на dialog wrapper\n */\n wrapperProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;\n\n /**\n * Дополнительные пропсы на обертку контента\n */\n contentProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;\n\n /**\n * Дополнительные пропсы на компонентную обертку контента\n */\n componentDivProps?: React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLDivElement>,\n HTMLDivElement\n >;\n\n /**\n * Дополнительный класс для обертки (Modal)\n */\n wrapperClassName?: string;\n\n /**\n * Обработчик скролла контента\n */\n scrollHandler?: 'wrapper' | 'content' | MutableRefObject<HTMLDivElement | null>;\n\n /**\n * Пропсы для анимации (CSSTransition)\n */\n transitionProps?: Partial<TransitionProps>;\n\n /**\n * Рендерить ли в контейнер через портал.\n * @default true\n */\n usePortal?: boolean;\n\n /**\n * Обработчик события нажатия на бэкдроп\n */\n onBackdropClick?: (event: MouseEvent) => void;\n\n /**\n * Обработчик события нажатия на Escape\n *\n * Если `disableEscapeKeyDown` - false и модальное окно в фокусе\n */\n onEscapeKeyDown?: (event: KeyboardEvent) => void;\n\n /**\n * Обработчик закрытия\n */\n onClose?: (\n event: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>,\n reason?: 'backdropClick' | 'escapeKeyDown' | 'closerClick',\n ) => void;\n\n /**\n * Обработчик события onEntered компонента Transition\n */\n onMount?: () => void;\n\n /**\n * Обработчик события onExited компонента Transition\n */\n onUnmount?: () => void;\n\n /**\n * Идентификатор для систем автоматизированного тестирования\n */\n dataTestId?: string;\n\n /**\n * z-index компонента\n */\n zIndex?: number;\n\n /**\n * Реф, который должен быть установлен компонентной области\n */\n componentRef?: MutableRefObject<HTMLDivElement | null>;\n\n /**\n * Реф контентной области\n */\n contentElementRef?: MutableRefObject<HTMLDivElement | null>;\n\n /**\n * Блокирует скролл когда модальное окно открыто. Работает только на iOS.\n */\n iOSLock?: boolean;\n\n /**\n * Хэндлер события прокрутки колесиком\n */\n onWheel?: (e: WheelEvent<HTMLElement>) => void;\n};\n\nexport type BaseModalContext = {\n parentRef: React.RefObject<HTMLDivElement>;\n componentRef: React.RefObject<HTMLDivElement>;\n hasFooter?: boolean;\n hasHeader?: boolean;\n hasScroll?: boolean;\n headerHighlighted?: boolean;\n footerHighlighted?: boolean;\n headerOffset?: number;\n setHeaderOffset: (offset: number) => void;\n contentRef: Ref<HTMLElement>;\n setHasHeader: (exists: boolean) => void;\n setHasFooter: (exists: boolean) => void;\n onClose: Required<BaseModalProps>['onClose'];\n};\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const BaseModalContext = React.createContext<BaseModalContext>({\n parentRef: { current: null },\n componentRef: { current: null },\n hasFooter: false,\n hasHeader: false,\n hasScroll: false,\n headerHighlighted: false,\n footerHighlighted: false,\n headerOffset: 0,\n setHeaderOffset: () => null,\n contentRef: () => null,\n setHasHeader: () => null,\n setHasFooter: () => null,\n onClose: () => null,\n});\n\nexport const BaseModal = forwardRef<HTMLDivElement, BaseModalProps>(\n (\n {\n open,\n container,\n children,\n scrollHandler = 'wrapper',\n Backdrop = DefaultBackdrop,\n backdropProps = {},\n transitionProps = {},\n disableBackdropClick,\n disableAutoFocus = false,\n disableFocusLock = false,\n disableEscapeKeyDown = false,\n disableRestoreFocus = false,\n disableBlockingScroll = false,\n keepMounted = false,\n className,\n contentClassName,\n wrapperProps,\n contentProps,\n componentDivProps,\n wrapperClassName,\n onBackdropClick,\n onClose,\n onEscapeKeyDown,\n onMount,\n onUnmount,\n dataTestId,\n zIndex = stackingOrder.MODAL,\n componentRef = null,\n contentElementRef = null,\n usePortal = true,\n iOSLock = false,\n onWheel,\n },\n ref,\n ) => {\n const [exited, setExited] = useState<boolean | null>(null);\n const [hasScroll, setHasScroll] = useState(false);\n const [hasHeader, setHasHeader] = useState(false);\n const [hasFooter, setHasFooter] = useState(false);\n const [headerHighlighted, setHeaderHighlighted] = useState(false);\n const [footerHighlighted, setFooterHighlighted] = useState(false);\n const [headerOffset, setHeaderOffset] = useState(0);\n\n const componentNodeRef = useRef<HTMLDivElement>(null);\n const wrapperRef = useRef<HTMLDivElement>(null);\n const scrollableNodeRef = useRef<HTMLDivElement | null>(null);\n const contentNodeRef = useRef<HTMLDivElement | null>(null);\n const restoreContainerStylesRef = useRef<null | (() => void)>(null);\n const mouseDownTarget = useRef<HTMLElement>();\n const resizeObserverRef = useRef<ResizeObserver>();\n\n const checkToHasScrollBar = () => {\n if (scrollableNodeRef.current) {\n const scrollExists = hasScrollbar(scrollableNodeRef.current);\n\n setFooterHighlighted(scrollExists);\n setHasScroll(scrollExists);\n }\n };\n\n const isExited = exited || exited === null;\n const shouldRender = keepMounted || open || !isExited;\n\n const getContainer = useCallback(\n () => (container ? container() : document.body) as HTMLElement,\n [container],\n );\n\n const addResizeHandle = useCallback(() => {\n if (!resizeObserverRef.current) return;\n\n if (scrollableNodeRef.current) {\n resizeObserverRef.current.observe(scrollableNodeRef.current);\n }\n if (contentNodeRef.current) {\n resizeObserverRef.current.observe(contentNodeRef.current);\n }\n }, []);\n\n const removeResizeHandle = useCallback(() => resizeObserverRef.current?.disconnect(), []);\n\n const contentRef = useCallback((node: HTMLDivElement) => {\n if (node !== null) {\n contentNodeRef.current = node;\n if (resizeObserverRef.current) {\n resizeObserverRef.current.observe(node);\n }\n checkToHasScrollBar();\n }\n }, []);\n\n const handleScroll = useCallback(() => {\n if (!scrollableNodeRef.current || !componentNodeRef.current) return;\n\n if (hasHeader) {\n setHeaderHighlighted(\n !isScrolledToTop(scrollableNodeRef.current) &&\n componentNodeRef.current.getBoundingClientRect().top - headerOffset <= 1,\n );\n }\n\n if (hasFooter) {\n setFooterHighlighted(\n !isScrolledToBottom(scrollableNodeRef.current) &&\n componentNodeRef.current.getBoundingClientRect().bottom >=\n window.innerHeight - 1,\n );\n }\n }, [hasFooter, hasHeader, headerOffset]);\n\n const handleClose = useCallback<Required<BaseModalProps>['onClose']>(\n (event, reason) => {\n if (iOSLock && os.isIOS()) {\n unlockScroll();\n }\n\n if (onClose) {\n onClose(event, reason);\n }\n\n if (reason === 'backdropClick' && onBackdropClick) {\n onBackdropClick(event as MouseEvent);\n }\n\n if (reason === 'escapeKeyDown' && onEscapeKeyDown) {\n onEscapeKeyDown(event as KeyboardEvent);\n }\n\n return null;\n },\n [onBackdropClick, onClose, onEscapeKeyDown, iOSLock],\n );\n\n const handleBackdropMouseDown = (event: MouseEvent<HTMLElement>) => {\n let clickedOnScrollbar = false;\n const clientWidth = (event.target as HTMLElement)?.clientWidth;\n\n if (event.clientX && clientWidth) {\n // Устанавливаем смещение для абсолютно спозиционированного скроллбара в OSX в 17px.\n const offset = browser.getScrollbarSize() === 0 ? 17 : 0;\n\n clickedOnScrollbar = event.clientX + offset > clientWidth;\n }\n\n if (!disableBackdropClick && !clickedOnScrollbar) {\n mouseDownTarget.current = event.target as HTMLElement;\n }\n };\n\n const handleBackdropMouseUp = (event: MouseEvent<HTMLElement>) => {\n if (\n !disableBackdropClick &&\n event.target === wrapperRef.current &&\n mouseDownTarget.current === wrapperRef.current\n ) {\n handleClose(event, 'backdropClick');\n }\n\n mouseDownTarget.current = undefined;\n };\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n /*\n * Чтобы сохранить дефолтное поведение элементов и событий форм,\n * обработчик не устанавливает event.preventDefault()\n */\n if (event.key !== 'Escape') {\n return;\n }\n\n // Если есть обработчик escape на body\n event.stopPropagation();\n\n if (!disableEscapeKeyDown && handleClose) {\n handleClose(event, 'escapeKeyDown');\n }\n },\n [disableEscapeKeyDown, handleClose],\n );\n\n const getScrollHandler = useCallback(() => {\n if (scrollHandler === 'wrapper') return wrapperRef.current;\n if (scrollHandler === 'content') return componentNodeRef.current;\n\n return scrollHandler.current || wrapperRef.current;\n }, [scrollHandler]);\n\n const handleEntered: Required<TransitionProps>['onEntered'] = useCallback(\n (node, isAppearing) => {\n scrollableNodeRef.current = getScrollHandler();\n\n addResizeHandle();\n\n if (scrollableNodeRef.current) {\n scrollableNodeRef.current.addEventListener('scroll', handleScroll);\n handleScroll();\n }\n\n if (transitionProps.onEntered) {\n transitionProps.onEntered(node, isAppearing);\n }\n\n if (onMount) onMount();\n },\n [addResizeHandle, getScrollHandler, handleScroll, onMount, transitionProps],\n );\n\n const handleExited: Required<TransitionProps>['onExited'] = useCallback(\n (node) => {\n removeResizeHandle();\n\n setExited(true);\n\n if (scrollableNodeRef.current) {\n scrollableNodeRef.current.removeEventListener('scroll', handleScroll);\n }\n\n if (transitionProps.onExited) {\n transitionProps.onExited(node);\n }\n\n if (onUnmount) onUnmount();\n\n if (restoreContainerStylesRef.current) {\n restoreContainerStylesRef.current();\n }\n },\n [handleScroll, onUnmount, removeResizeHandle, transitionProps],\n );\n\n useEffect(() => {\n if (open && isExited) {\n if (!disableBlockingScroll) {\n const el = getContainer();\n\n const shouldIOSLock = iOSLock && os.isIOS();\n\n handleContainer(el, shouldIOSLock);\n if (shouldIOSLock) {\n syncHeight();\n lockScroll();\n }\n\n restoreContainerStylesRef.current = () => {\n restoreContainerStylesRef.current = null;\n restoreContainerStyles(el);\n };\n }\n\n setExited(false);\n }\n\n if (!open) {\n unlockScroll();\n }\n }, [getContainer, open, disableBlockingScroll, isExited, iOSLock]);\n\n useEffect(() => {\n const ResizeObserver = window.ResizeObserver || ResizeObserverPolyfill;\n\n resizeObserverRef.current = new ResizeObserver(checkToHasScrollBar);\n\n return () => {\n if (restoreContainerStylesRef.current) {\n restoreContainerStylesRef.current();\n }\n\n if (resizeObserverRef.current) {\n resizeObserverRef.current.disconnect();\n }\n };\n }, []);\n\n useEffect(() => {\n if (disableAutoFocus || !open) return;\n\n wrapperRef.current?.focus();\n }, [open, disableAutoFocus]);\n\n const contextValue = useMemo<BaseModalContext>(\n () => ({\n parentRef: wrapperRef,\n componentRef: componentNodeRef,\n hasHeader,\n hasFooter,\n hasScroll,\n headerHighlighted,\n footerHighlighted,\n headerOffset,\n setHeaderOffset,\n contentRef,\n setHasHeader,\n setHasFooter,\n onClose: handleClose,\n }),\n [\n contentRef,\n hasHeader,\n hasFooter,\n hasScroll,\n headerHighlighted,\n footerHighlighted,\n headerOffset,\n setHeaderOffset,\n handleClose,\n ],\n );\n\n const renderContent = () => (\n <Stack value={zIndex}>\n {(computedZIndex) => (\n <BaseModalContext.Provider value={contextValue}>\n <FocusLock\n disabled={disableFocusLock || !open}\n returnFocus={!disableRestoreFocus}\n >\n {Backdrop && (\n <Backdrop\n {...backdropProps}\n className={cn(backdropProps.className, styles.backdrop)}\n open={open}\n style={{\n zIndex: computedZIndex,\n }}\n />\n )}\n <div\n {...wrapperProps}\n role='dialog'\n className={cn(\n styles.wrapper,\n wrapperClassName,\n wrapperProps?.className,\n {\n [styles.hidden]: !open && isExited,\n },\n )}\n ref={mergeRefs([\n ref,\n wrapperRef,\n wrapperProps?.ref as Ref<HTMLDivElement>,\n ])}\n onKeyDown={handleKeyDown}\n onMouseDown={handleBackdropMouseDown}\n onMouseUp={handleBackdropMouseUp}\n onWheel={onWheel}\n tabIndex={-1}\n data-test-id={dataTestId}\n style={{\n zIndex: computedZIndex,\n }}\n >\n <CSSTransition\n appear={true}\n timeout={200}\n classNames={styles}\n nodeRef={componentNodeRef}\n {...transitionProps}\n in={open}\n onEntered={handleEntered}\n onExited={handleExited}\n >\n <div\n {...componentDivProps}\n className={cn(\n styles.component,\n className,\n componentDivProps?.className,\n )}\n ref={mergeRefs([\n componentRef,\n componentNodeRef,\n componentDivProps?.ref || null,\n ])}\n >\n <div\n {...contentProps}\n className={cn(\n styles.content,\n contentClassName,\n contentProps?.className,\n {\n [styles.hasFooter]: hasFooter,\n [styles.hasHeader]: hasHeader,\n },\n )}\n ref={contentElementRef}\n >\n {children}\n </div>\n </div>\n </CSSTransition>\n </div>\n </FocusLock>\n </BaseModalContext.Provider>\n )}\n </Stack>\n );\n\n if (!shouldRender) return null;\n\n return usePortal ? (\n <Portal getPortalContainer={container} immediateMount={true}>\n {renderContent()}\n </Portal>\n ) : (\n renderContent()\n );\n },\n);\n\nBaseModal.displayName = 'BaseModal';\nBaseModalContext.displayName = 'BaseModalContext';\n"],"names":["Backdrop","DefaultBackdrop","ResizeObserver","ResizeObserverPolyfill"],"mappings":";;;;;;;;;;;;;;;;AAAA;AA+OA;AACa,MAAA,gBAAgB,GAAG,KAAK,CAAC,aAAa,CAAmB;AAClE,IAAA,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;AAC5B,IAAA,YAAY,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;AAC/B,IAAA,SAAS,EAAE,KAAK;AAChB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,MAAM,CAAC,SAAS,EAChB,SAAS,EACT,iBAAiB,EAAE,SAAS,CAC/B,EACD,GAAG,EAAE,SAAS,CAAC;4BACX,YAAY;4BACZ,gBAAgB;4BAChB,iBAAiB,EAAE,GAAG,IAAI,IAAI;yBACjC,CAAC,EAAA;AAEF,wBAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,GACQ,YAAY,EAChB,SAAS,EAAE,EAAE,CACT,MAAM,CAAC,OAAO,EACd,gBAAgB,EAChB,YAAY,EAAE,SAAS,EACvB;AACI,gCAAA,CAAC,MAAM,CAAC,SAAS,GAAG,SAAS;AAC7B,gCAAA,CAAC,MAAM,CAAC,SAAS,GAAG,SAAS;AAChC,6BAAA,CACJ,EACD,GAAG,EAAE,iBAAiB,IAErB,QAAQ,CACP,CACJ,CACM,CACd,CACE,CACY,CAC/B,CACG,CACX;AAED,IAAA,IAAI,CAAC,YAAY;AAAE,QAAA,OAAO,IAAI;IAE9B,OAAO,SAAS,IACZ,KAAC,CAAA,aAAA,CAAA,MAAM,EAAC,EAAA,kBAAkB,EAAE,SAAS,EAAE,cAAc,EAAE,IAAI,EACtD,EAAA,aAAa,EAAE,CACX,KAET,aAAa,EAAE,CAClB;AACL,CAAC;AAGL,SAAS,CAAC,WAAW,GAAG,WAAW;AACnC,gBAAgB,CAAC,WAAW,GAAG,kBAAkB;;;;"}
@@ -19,3 +19,4 @@ const syncHeight = () => {
19
19
  };
20
20
 
21
21
  export { isScrollLocked, lockScroll, syncHeight, unlockScroll };
22
+ //# sourceMappingURL=lockScroll.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lockScroll.js","sources":["../../../src/helpers/lockScroll.ts"],"sourcesContent":["/**\n * Хелпер для блокирования скроллинга в iOS\n * В проекте используется overflow: hidden для блокировки, но в некоторых случаях этого недостаточно. Данный хелпер призван решать эту проблему\n */\n\nlet scrollY: number;\n\nexport const isScrollLocked = () => document.body.classList.contains('is-locked');\n\nexport const lockScroll = () => {\n scrollY = window.scrollY;\n document.body.classList.add('is-locked');\n};\n\nexport const unlockScroll = () => {\n if (!isScrollLocked()) return;\n\n document.body.classList.remove('is-locked');\n window.scrollTo(0, scrollY);\n};\n\nexport const syncHeight = () => {\n document.body.style.setProperty('--window-inner-scrollY', `${window.scrollY}px`);\n};\n"],"names":[],"mappings":"AAAA;;;AAGG;AAEH,IAAI,OAAe;AAEN,MAAA,cAAc,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,WAAW;AAEzE,MAAM,UAAU,GAAG,MAAK;AAC3B,IAAA,OAAO,GAAG,MAAM,CAAC,OAAO;IACxB,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC;AAC5C;AAEO,MAAM,YAAY,GAAG,MAAK;IAC7B,IAAI,CAAC,cAAc,EAAE;QAAE;IAEvB,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC;AAC3C,IAAA,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC;AAC/B;AAEO,MAAM,UAAU,GAAG,MAAK;AAC3B,IAAA,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,wBAAwB,EAAE,GAAG,MAAM,CAAC,OAAO,CAAA,EAAA,CAAI,CAAC;AACpF;;;;"}
@@ -1,3 +1,4 @@
1
1
  export { BaseModal, BaseModalContext } from './Component.js';
2
2
  export { handleContainer, hasScrollbar, isScrolledToBottom, isScrolledToTop, restoreContainerStyles } from './utils.js';
3
3
  export { isScrollLocked, lockScroll, syncHeight, unlockScroll } from './helpers/lockScroll.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -1,7 +1,5 @@
1
- /* */
2
-
3
1
  :root {
4
- --window-inner-scrollY: 10px; /* fallback value to prevent ci error */
2
+ --window-inner-scrollY: 10px;
5
3
  }
6
4
 
7
5
  body:global(.is-locked) {
@@ -16,3 +16,4 @@ if (typeof window !== 'undefined') {
16
16
  };
17
17
  }
18
18
  }
19
+ //# sourceMappingURL=matches-polyfill.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matches-polyfill.js","sources":["../../src/matches-polyfill.ts"],"sourcesContent":["/* eslint-disable */\n// @ts-nocheck\n\nif (typeof window !== 'undefined') {\n if (Element && !Element.prototype.matches) {\n Element.prototype.matches =\n Element.prototype.matchesSelector ||\n Element.prototype.mozMatchesSelector ||\n Element.prototype.msMatchesSelector ||\n Element.prototype.oMatchesSelector ||\n Element.prototype.webkitMatchesSelector ||\n function (s) {\n const matches = (this.document || this.ownerDocument).querySelectorAll(s);\n let i = matches.length;\n while (--i >= 0 && matches.item(i) !== this) {}\n return i > -1;\n };\n }\n}\n"],"names":[],"mappings":"AAAA;AACA;AAEA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;IAC/B,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,EAAE;QACvC,OAAO,CAAC,SAAS,CAAC,OAAO;YACrB,OAAO,CAAC,SAAS,CAAC,eAAe;gBACjC,OAAO,CAAC,SAAS,CAAC,kBAAkB;gBACpC,OAAO,CAAC,SAAS,CAAC,iBAAiB;gBACnC,OAAO,CAAC,SAAS,CAAC,gBAAgB;gBAClC,OAAO,CAAC,SAAS,CAAC,qBAAqB;AACvC,gBAAA,UAAU,CAAC,EAAA;AACP,oBAAA,MAAM,OAAO,GAAG,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC,CAAC;AACzE,oBAAA,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM;AACtB,oBAAA,OAAO,EAAE,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE;AAC7C,oBAAA,OAAO,CAAC,GAAG,EAAE;AACjB,iBAAC;AACR;AACJ"}
@@ -1,11 +1,9 @@
1
- /// <reference types="react" />
2
- /// <reference types="react-transition-group" />
3
- import React from 'react';
4
- import { ComponentType, KeyboardEvent, MouseEvent, MutableRefObject, ReactNode, Ref, WheelEvent } from "react";
1
+ import React, { ComponentType, KeyboardEvent, MouseEvent, MutableRefObject, ReactNode, Ref, WheelEvent } from 'react';
5
2
  import { TransitionProps } from 'react-transition-group/Transition';
6
- import { BackdropProps } from "@alfalab/core-components-backdrop";
7
- import { PortalProps } from "@alfalab/core-components-portal";
8
- type BaseModalProps = {
3
+ import { BackdropProps } from '@alfalab/core-components-backdrop';
4
+ import { PortalProps } from '@alfalab/core-components-portal';
5
+ import './matches-polyfill';
6
+ export declare type BaseModalProps = {
9
7
  /**
10
8
  * Контент
11
9
  */
@@ -147,7 +145,7 @@ type BaseModalProps = {
147
145
  */
148
146
  onWheel?: (e: WheelEvent<HTMLElement>) => void;
149
147
  };
150
- type BaseModalContext = {
148
+ export declare type BaseModalContext = {
151
149
  parentRef: React.RefObject<HTMLDivElement>;
152
150
  componentRef: React.RefObject<HTMLDivElement>;
153
151
  hasFooter?: boolean;
@@ -162,6 +160,5 @@ type BaseModalContext = {
162
160
  setHasFooter: (exists: boolean) => void;
163
161
  onClose: Required<BaseModalProps>['onClose'];
164
162
  };
165
- declare const BaseModalContext: React.Context<BaseModalContext>;
166
- declare const BaseModal: React.ForwardRefExoticComponent<BaseModalProps & React.RefAttributes<HTMLDivElement>>;
167
- export { BaseModalProps, BaseModalContext, BaseModal };
163
+ export declare const BaseModalContext: React.Context<BaseModalContext>;
164
+ export declare const BaseModal: React.ForwardRefExoticComponent<BaseModalProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Хелпер для блокирования скроллинга в iOS
3
+ * В проекте используется overflow: hidden для блокировки, но в некоторых случаях этого недостаточно. Данный хелпер призван решать эту проблему
4
+ */
5
+ export declare const isScrollLocked: () => boolean;
6
+ export declare const lockScroll: () => void;
7
+ export declare const unlockScroll: () => void;
8
+ export declare const syncHeight: () => void;
@@ -0,0 +1,3 @@
1
+ export * from './Component';
2
+ export * from './utils';
3
+ export * from './helpers/lockScroll';
@@ -0,0 +1,5 @@
1
+ export declare function isScrolledToTop(target: HTMLElement): boolean;
2
+ export declare function isScrolledToBottom(target: HTMLElement): boolean;
3
+ export declare function hasScrollbar(target: HTMLElement): boolean;
4
+ export declare const restoreContainerStyles: (container: HTMLElement) => void;
5
+ export declare const handleContainer: (container?: HTMLElement, shouldIOSLock?: boolean) => void;