@hh.ru/magritte-ui-modal-deprecated 1.0.38 → 1.0.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Modal.js CHANGED
@@ -13,7 +13,7 @@ import { useNoBubbling } from '@hh.ru/magritte-common-use-no-bubbling';
13
13
  import { isActionBarComponent } from '@hh.ru/magritte-ui-action-bar';
14
14
  import { Breakpoint, useBreakpoint } from '@hh.ru/magritte-ui-breakpoint';
15
15
  import { Layer } from '@hh.ru/magritte-ui-layer';
16
- import { s as styles, M as ModalContentWithHeader } from './ModalContentWithHeader-Cmr-Wfi6.js';
16
+ import { s as styles, M as ModalContentWithHeader } from './ModalContentWithHeader-B7tpHFBW.js';
17
17
  import { useModalOrder } from './useModalOrder.js';
18
18
  import { isProgressBarComponent } from '@hh.ru/magritte-ui-progress-bar';
19
19
  import { ThemeWrapper } from '@hh.ru/magritte-ui-theme-wrapper';
@@ -140,7 +140,7 @@ const Modal = forwardRef(({ visible, size = 'medium', title, titleAlignment = 'l
140
140
  onEntering();
141
141
  // visible не должно быть в зависимостях, т.к. этот эффект обрабатывает только изменение брейкпоинта
142
142
  // visible обрабатывается CSSTransition
143
- // eslint-disable-next-line disable-autofix/react-hooks/exhaustive-deps
143
+ // eslint-disable-next-line react-hooks/exhaustive-deps
144
144
  }, [breakpoint, onEntering, onExited, onExit]);
145
145
  useEffect(() => {
146
146
  return () => {
@@ -173,6 +173,8 @@ const Modal = forwardRef(({ visible, size = 'medium', title, titleAlignment = 'l
173
173
  const keyframes = { top: [`${pageHeaderPadding}px`, '0px'] };
174
174
  if (hasScrollTimeline) {
175
175
  const timeline = new ScrollTimeline({ source: document.documentElement, axis: 'y' });
176
+ // TS 7 (type-aware правила oxlint) уже знает rangeStart/rangeEnd, а TS 5 без каста не пропускает
177
+ // oxlint-disable-next-line typescript/no-unnecessary-type-assertion
176
178
  animation = overlay.animate(keyframes, {
177
179
  timeline,
178
180
  rangeStart: '0px',
package/Modal.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.js","sources":["src/Modal.tsx"],"sourcesContent":["import {\n forwardRef,\n HTMLAttributes,\n useLayoutEffect,\n useRef,\n useState,\n useCallback,\n useId,\n useEffect,\n cloneElement,\n Children,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { CSSTransition } from 'react-transition-group';\nimport classnames from 'classnames';\n\nimport { useServerEnv } from '@hh.ru/magritte-common-is-server-env';\nimport { keyboardMatch, keyboardKeys, useKeyboardNavigation } from '@hh.ru/magritte-common-keyboard';\nimport { disableScroll, TimeoutCallback } from '@hh.ru/magritte-common-modal-helper';\nimport { CloseByClickOutsideContext } from '@hh.ru/magritte-common-mouse/useCloseByClickOutside';\nimport { useMultipleRefs } from '@hh.ru/magritte-common-use-multiple-refs';\nimport { useNoBubbling } from '@hh.ru/magritte-common-use-no-bubbling';\nimport { isActionBarComponent } from '@hh.ru/magritte-ui-action-bar';\nimport { useBreakpoint, Breakpoint } from '@hh.ru/magritte-ui-breakpoint';\nimport { Layer } from '@hh.ru/magritte-ui-layer';\nimport { ModalContentWithHeader } from '@hh.ru/magritte-ui-modal-deprecated/ModalContentWithHeader';\nimport { ModalHeaderProps, ModalProps } from '@hh.ru/magritte-ui-modal-deprecated/types';\nimport { useModalOrder } from '@hh.ru/magritte-ui-modal-deprecated/useModalOrder';\nimport { isProgressBarComponent } from '@hh.ru/magritte-ui-progress-bar';\nimport { ThemeWrapper } from '@hh.ru/magritte-ui-theme-wrapper';\nimport { isValidTreeSelectorWrapper } from '@hh.ru/magritte-ui-tree-selector';\n\nimport styles from './modal.less';\n\nconst DEFAULT_ACTION_BAR_PADDING = 24;\nconst DEFAULT_PAGE_HEADER_PADDING = 72;\n\nconst noop = () => undefined;\n\nconst toNumber = (value: string) => {\n const result = parseInt(value, 10);\n return Number.isInteger(result) ? result : 0;\n};\n\nconst CSS_CLASSES = {\n center: {\n appear: styles.animationEnterCenter,\n appearActive: styles.animationEnterCenterActive,\n enter: styles.animationEnterCenter,\n enterActive: styles.animationEnterCenterActive,\n exit: styles.animationExitCenter,\n exitActive: styles.animationExitCenterActive,\n },\n left: {\n appear: styles.animationEnterLeft,\n appearActive: styles.animationEnterLeftActive,\n enter: styles.animationEnterLeft,\n enterActive: styles.animationEnterLeftActive,\n exit: styles.animationExitLeft,\n exitActive: styles.animationExitLeftActive,\n },\n right: {\n appear: styles.animationEnterRight,\n appearActive: styles.animationEnterRightActive,\n enter: styles.animationEnterRight,\n enterActive: styles.animationEnterRightActive,\n exit: styles.animationExitRight,\n exitActive: styles.animationExitRightActive,\n },\n};\n\nconst INVISIBLE_FOR_BREAKPOINTS = [Breakpoint.XS, Breakpoint.S];\n\n/** @deprecated Компонент устарел. Используйте `Modal` из `@hh.ru/magritte-ui-modal` */\nexport const Modal = forwardRef<\n HTMLDivElement,\n ModalProps &\n Omit<HTMLAttributes<HTMLDivElement>, keyof ModalProps | 'role' | 'tabindex' | 'className' | 'aria-labeledby'>\n>(\n (\n {\n visible,\n size = 'medium',\n title,\n titleAlignment = 'left',\n titleSize = 'large',\n titleMaxLines,\n titleElement = 'h2',\n titleDescription,\n titleDescriptionMaxLines,\n titleStyle,\n titleDescriptionStyle,\n children,\n onClose = noop,\n headerImageUrl,\n headerImage,\n headerHeight,\n host,\n options,\n actions,\n actionLink,\n footer,\n disableVerticalPaddings = false,\n disableHorizontalPaddings = false,\n closeByClickOutside = true,\n onAppear,\n onBeforeExit,\n onAfterExit,\n position = 'center',\n height = position === 'center' ? 'content' : 'full-screen',\n minHeight,\n showOverlay: _showOverlay = true,\n pageHeaderPadding = DEFAULT_PAGE_HEADER_PADDING,\n returnFocusOnClose,\n ...rest\n },\n ref\n ) => {\n const isServerEnv = useServerEnv();\n const enableScrollRef = useRef<TimeoutCallback>();\n const onAfterExitRef = useRef(onAfterExit);\n const onBeforeExitRef = useRef(onBeforeExit);\n onAfterExitRef.current = onAfterExit;\n onBeforeExitRef.current = onBeforeExit;\n const [animationTimeout, setAnimationTimeout] = useState<{ enter: number; exit: number }>({\n enter: 0,\n exit: 0,\n });\n const animationTimeoutExitRef = useRef(animationTimeout.exit);\n animationTimeoutExitRef.current = animationTimeout.exit;\n const labelId = useId();\n const additionalProps: { 'aria-labelledby'?: string } = {};\n if (title) {\n additionalProps['aria-labelledby'] = labelId;\n }\n const modalRef = useRef<HTMLDivElement>(null);\n const overlayRef = useRef<HTMLDivElement>(null);\n const keyboardNavigationRef = useKeyboardNavigation({ enabled: visible && !isServerEnv, mode: 'loop' });\n const modalRefCallback = useMultipleRefs(ref, modalRef, keyboardNavigationRef);\n\n const isPaddingsDisableAllowed =\n !title &&\n !headerImageUrl &&\n !headerImage &&\n !titleDescription &&\n !footer &&\n !options &&\n !actionLink &&\n !actions;\n const isVerticalPaddingsDisabled = disableVerticalPaddings && isPaddingsDisableAllowed;\n const isHorizontalPaddingsDisabled = disableHorizontalPaddings && isPaddingsDisableAllowed;\n\n const showOverlay = position === 'center' || _showOverlay;\n\n const activatorRef = useRef<HTMLElement | null>(null);\n const onEntering = useCallback(() => {\n if (returnFocusOnClose && document.activeElement instanceof HTMLElement) {\n activatorRef.current = document.activeElement;\n }\n if (!enableScrollRef.current && showOverlay) {\n enableScrollRef.current = disableScroll();\n }\n if (modalRef.current && !modalRef.current.contains(document.activeElement)) {\n modalRef.current.focus();\n }\n }, [returnFocusOnClose, showOverlay]);\n\n const onEntered = useCallback(() => {\n onAppear?.();\n }, [onAppear]);\n\n const onExit = useCallback(() => {\n onBeforeExitRef.current?.();\n }, []);\n\n const onExited = useCallback(() => {\n // оставляем обработку скрола еще и тут\n // чтобы обработать историю со сменой breakpoint\n enableScrollRef.current?.();\n enableScrollRef.current = undefined;\n\n onAfterExitRef.current?.();\n\n if (activatorRef.current !== null && document.contains(activatorRef.current)) {\n activatorRef.current?.focus();\n activatorRef.current = null;\n }\n }, []);\n\n useModalOrder(!!visible && !isServerEnv, modalRef);\n\n const { breakpoint } = useBreakpoint();\n useEffect(() => {\n if (!visible) {\n return;\n }\n\n const currentBreakpointVisible = !INVISIBLE_FOR_BREAKPOINTS.includes(breakpoint);\n if (!currentBreakpointVisible) {\n onExit();\n onExited();\n return;\n }\n\n onEntering();\n // visible не должно быть в зависимостях, т.к. этот эффект обрабатывает только изменение брейкпоинта\n // visible обрабатывается CSSTransition\n // eslint-disable-next-line disable-autofix/react-hooks/exhaustive-deps\n }, [breakpoint, onEntering, onExited, onExit]);\n\n useEffect(() => {\n return () => {\n enableScrollRef.current?.(animationTimeoutExitRef.current);\n enableScrollRef.current = undefined;\n };\n }, [visible]);\n\n useLayoutEffect(() => {\n const animationTimeoutElement = document.createElement('div');\n animationTimeoutElement.classList.add(styles.animationTimeout);\n document.body.appendChild(animationTimeoutElement);\n const style = window.getComputedStyle(animationTimeoutElement);\n setAnimationTimeout({\n enter: toNumber(style.getPropertyValue('--enter-animation-duration')),\n exit: toNumber(style.getPropertyValue('--exit-animation-duration')),\n });\n document.body.removeChild(animationTimeoutElement);\n }, [setAnimationTimeout]);\n\n useEffect(() => {\n if (showOverlay || !pageHeaderPadding || !visible) {\n return void 0;\n }\n\n const hasScrollTimeline = 'ScrollTimeline' in window;\n const overlay = overlayRef.current;\n\n if (!overlay) {\n return void 0;\n }\n\n let animation: Animation;\n const abortController = new AbortController();\n const keyframes = { top: [`${pageHeaderPadding}px`, '0px'] };\n if (hasScrollTimeline) {\n const timeline = new ScrollTimeline({ source: document.documentElement, axis: 'y' });\n animation = overlay.animate(keyframes, {\n timeline,\n rangeStart: '0px',\n // calc нужен для устранения бага https://issues.chromium.org/issues/40929569\n rangeEnd: `calc(0% + ${pageHeaderPadding}px)`,\n } as KeyframeAnimationOptions);\n } else {\n animation = overlay.animate(keyframes, { duration: 1000, fill: 'forwards' });\n animation.pause();\n\n window.addEventListener(\n 'scroll',\n () => {\n animation.currentTime =\n (Math.min(document.documentElement.scrollTop, pageHeaderPadding) / pageHeaderPadding) *\n 1000;\n },\n { signal: abortController.signal }\n );\n }\n\n return () => {\n abortController.abort();\n };\n }, [showOverlay, pageHeaderPadding, visible]);\n\n const overlayEventHandlers = useNoBubbling({\n onKeyDown: (event) => {\n if (keyboardMatch(event.nativeEvent as KeyboardEvent, keyboardKeys.Escape)) {\n onClose(event);\n }\n },\n onMouseDown: (event) => {\n if (!closeByClickOutside || modalRef.current?.contains(event.target as HTMLElement)) {\n return;\n }\n onClose(event);\n },\n });\n const overlayProps = showOverlay\n ? overlayEventHandlers\n : {\n onKeyDown: (event: React.KeyboardEvent) => {\n if (keyboardMatch(event.nativeEvent, keyboardKeys.Escape)) {\n onClose(event);\n }\n },\n };\n\n if (INVISIBLE_FOR_BREAKPOINTS.includes(breakpoint) || isServerEnv) {\n return null;\n }\n\n const modalHeaderProps = {\n title,\n titleElement,\n titleAlignment,\n titleSize,\n titleMaxLines,\n titleDescription,\n titleDescriptionMaxLines,\n titleStyle,\n titleDescriptionStyle,\n headerImageUrl,\n headerImage,\n headerHeight,\n options,\n actions,\n actionLink,\n } as ModalHeaderProps;\n\n const isTreeSelectorChild = Children.toArray(children).some(isValidTreeSelectorWrapper);\n // если есть progress bar, нужно скрыть divider (но showProgress - это слот под reactNode)\n const isActionBarHaveProgressBar =\n !!footer &&\n isActionBarComponent(footer) &&\n Boolean(footer.props.showProgress) &&\n isProgressBarComponent(footer.props.showProgress);\n\n return createPortal(\n <CSSTransition\n appear\n in={visible && !isServerEnv}\n nodeRef={overlayRef}\n onEntering={onEntering}\n onEntered={onEntered}\n onExit={onExit}\n onExited={onExited}\n classNames={CSS_CLASSES[position]}\n timeout={animationTimeout}\n unmountOnExit\n >\n <ThemeWrapper>\n {(themeClass) => (\n <Layer layer=\"modal\">\n <div\n {...overlayProps}\n ref={overlayRef}\n className={classnames(styles.modalOverlay, themeClass, {\n [styles.modalOverlayWithBackground]: showOverlay,\n [styles.modalOverlayLeft]: position === 'left',\n [styles.modalOverlayRight]: position === 'right',\n })}\n data-qa=\"modal-overlay\"\n >\n <CloseByClickOutsideContext.Provider value={overlayRef}>\n <div\n {...rest}\n {...additionalProps}\n aria-modal={visible && showOverlay && !isServerEnv}\n role=\"dialog\"\n className={classnames(styles.modal, {\n [styles.sizeSmall]: size === 'small',\n [styles.sizeMedium]: size === 'medium',\n [styles.modalFullHeight]: height === 'full-screen' || isTreeSelectorChild,\n [styles.noVerticalPaddings]: isVerticalPaddingsDisabled,\n [styles.noHorizontalPaddings]: isHorizontalPaddingsDisabled,\n [styles.modalWithBorder]: !showOverlay,\n })}\n ref={modalRefCallback}\n tabIndex={-1}\n style={{\n height: typeof height === 'number' ? `${height}px` : undefined,\n minHeight:\n typeof minHeight === 'number'\n ? `min(calc(100vh - 12px * 2), ${minHeight}px)`\n : undefined,\n }}\n >\n <ModalContentWithHeader\n {...modalHeaderProps}\n labelId={labelId}\n isTreeSelectorChild={isTreeSelectorChild}\n height={height}\n showDivider={!isActionBarHaveProgressBar}\n >\n {children}\n </ModalContentWithHeader>\n {!!footer && (\n <div className={styles.modalFooter} data-qa=\"modal-footer\">\n {isActionBarComponent(footer)\n ? cloneElement(footer, {\n type: footer.props.type || 'auto',\n padding: footer.props.padding || DEFAULT_ACTION_BAR_PADDING,\n showDivider: false,\n })\n : footer}\n </div>\n )}\n </div>\n </CloseByClickOutsideContext.Provider>\n </div>\n </Layer>\n )}\n </ThemeWrapper>\n </CSSTransition>,\n host || document.body\n );\n }\n);\n\nModal.displayName = 'Modal';\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAM,0BAA0B,GAAG,EAAE,CAAC;AACtC,MAAM,2BAA2B,GAAG,EAAE,CAAC;AAEvC,MAAM,IAAI,GAAG,MAAM,SAAS,CAAC;AAE7B,MAAM,QAAQ,GAAG,CAAC,KAAa,KAAI;IAC/B,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACnC,IAAA,OAAO,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,CAAC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CAAA,EAAA,CACH,EAChB,IAAI,IAAI,QAAQ,CAAC,IAAI,CACxB,CAAC;AACN,CAAC,EACH;AAEF,KAAK,CAAC,WAAW,GAAG,OAAO;;;;"}
1
+ {"version":3,"file":"Modal.js","sources":["src/Modal.tsx"],"sourcesContent":["import {\n forwardRef,\n HTMLAttributes,\n useLayoutEffect,\n useRef,\n useState,\n useCallback,\n useId,\n useEffect,\n cloneElement,\n Children,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { CSSTransition } from 'react-transition-group';\nimport classnames from 'classnames';\n\nimport { useServerEnv } from '@hh.ru/magritte-common-is-server-env';\nimport { keyboardMatch, keyboardKeys, useKeyboardNavigation } from '@hh.ru/magritte-common-keyboard';\nimport { disableScroll, TimeoutCallback } from '@hh.ru/magritte-common-modal-helper';\nimport { CloseByClickOutsideContext } from '@hh.ru/magritte-common-mouse/useCloseByClickOutside';\nimport { useMultipleRefs } from '@hh.ru/magritte-common-use-multiple-refs';\nimport { useNoBubbling } from '@hh.ru/magritte-common-use-no-bubbling';\nimport { isActionBarComponent } from '@hh.ru/magritte-ui-action-bar';\nimport { useBreakpoint, Breakpoint } from '@hh.ru/magritte-ui-breakpoint';\nimport { Layer } from '@hh.ru/magritte-ui-layer';\nimport { ModalContentWithHeader } from '@hh.ru/magritte-ui-modal-deprecated/ModalContentWithHeader';\nimport { ModalHeaderProps, ModalProps } from '@hh.ru/magritte-ui-modal-deprecated/types';\nimport { useModalOrder } from '@hh.ru/magritte-ui-modal-deprecated/useModalOrder';\nimport { isProgressBarComponent } from '@hh.ru/magritte-ui-progress-bar';\nimport { ThemeWrapper } from '@hh.ru/magritte-ui-theme-wrapper';\nimport { isValidTreeSelectorWrapper } from '@hh.ru/magritte-ui-tree-selector';\n\nimport styles from './modal.less';\n\nconst DEFAULT_ACTION_BAR_PADDING = 24;\nconst DEFAULT_PAGE_HEADER_PADDING = 72;\n\nconst noop = () => undefined;\n\nconst toNumber = (value: string) => {\n const result = parseInt(value, 10);\n return Number.isInteger(result) ? result : 0;\n};\n\nconst CSS_CLASSES = {\n center: {\n appear: styles.animationEnterCenter,\n appearActive: styles.animationEnterCenterActive,\n enter: styles.animationEnterCenter,\n enterActive: styles.animationEnterCenterActive,\n exit: styles.animationExitCenter,\n exitActive: styles.animationExitCenterActive,\n },\n left: {\n appear: styles.animationEnterLeft,\n appearActive: styles.animationEnterLeftActive,\n enter: styles.animationEnterLeft,\n enterActive: styles.animationEnterLeftActive,\n exit: styles.animationExitLeft,\n exitActive: styles.animationExitLeftActive,\n },\n right: {\n appear: styles.animationEnterRight,\n appearActive: styles.animationEnterRightActive,\n enter: styles.animationEnterRight,\n enterActive: styles.animationEnterRightActive,\n exit: styles.animationExitRight,\n exitActive: styles.animationExitRightActive,\n },\n};\n\nconst INVISIBLE_FOR_BREAKPOINTS = [Breakpoint.XS, Breakpoint.S];\n\n/** @deprecated Компонент устарел. Используйте `Modal` из `@hh.ru/magritte-ui-modal` */\nexport const Modal = forwardRef<\n HTMLDivElement,\n ModalProps &\n Omit<HTMLAttributes<HTMLDivElement>, keyof ModalProps | 'role' | 'tabindex' | 'className' | 'aria-labeledby'>\n>(\n (\n {\n visible,\n size = 'medium',\n title,\n titleAlignment = 'left',\n titleSize = 'large',\n titleMaxLines,\n titleElement = 'h2',\n titleDescription,\n titleDescriptionMaxLines,\n titleStyle,\n titleDescriptionStyle,\n children,\n onClose = noop,\n headerImageUrl,\n headerImage,\n headerHeight,\n host,\n options,\n actions,\n actionLink,\n footer,\n disableVerticalPaddings = false,\n disableHorizontalPaddings = false,\n closeByClickOutside = true,\n onAppear,\n onBeforeExit,\n onAfterExit,\n position = 'center',\n height = position === 'center' ? 'content' : 'full-screen',\n minHeight,\n showOverlay: _showOverlay = true,\n pageHeaderPadding = DEFAULT_PAGE_HEADER_PADDING,\n returnFocusOnClose,\n ...rest\n },\n ref\n ) => {\n const isServerEnv = useServerEnv();\n const enableScrollRef = useRef<TimeoutCallback>();\n const onAfterExitRef = useRef(onAfterExit);\n const onBeforeExitRef = useRef(onBeforeExit);\n onAfterExitRef.current = onAfterExit;\n onBeforeExitRef.current = onBeforeExit;\n const [animationTimeout, setAnimationTimeout] = useState<{ enter: number; exit: number }>({\n enter: 0,\n exit: 0,\n });\n const animationTimeoutExitRef = useRef(animationTimeout.exit);\n animationTimeoutExitRef.current = animationTimeout.exit;\n const labelId = useId();\n const additionalProps: { 'aria-labelledby'?: string } = {};\n if (title) {\n additionalProps['aria-labelledby'] = labelId;\n }\n const modalRef = useRef<HTMLDivElement>(null);\n const overlayRef = useRef<HTMLDivElement>(null);\n const keyboardNavigationRef = useKeyboardNavigation({ enabled: visible && !isServerEnv, mode: 'loop' });\n const modalRefCallback = useMultipleRefs(ref, modalRef, keyboardNavigationRef);\n\n const isPaddingsDisableAllowed =\n !title &&\n !headerImageUrl &&\n !headerImage &&\n !titleDescription &&\n !footer &&\n !options &&\n !actionLink &&\n !actions;\n const isVerticalPaddingsDisabled = disableVerticalPaddings && isPaddingsDisableAllowed;\n const isHorizontalPaddingsDisabled = disableHorizontalPaddings && isPaddingsDisableAllowed;\n\n const showOverlay = position === 'center' || _showOverlay;\n\n const activatorRef = useRef<HTMLElement | null>(null);\n const onEntering = useCallback(() => {\n if (returnFocusOnClose && document.activeElement instanceof HTMLElement) {\n activatorRef.current = document.activeElement;\n }\n if (!enableScrollRef.current && showOverlay) {\n enableScrollRef.current = disableScroll();\n }\n if (modalRef.current && !modalRef.current.contains(document.activeElement)) {\n modalRef.current.focus();\n }\n }, [returnFocusOnClose, showOverlay]);\n\n const onEntered = useCallback(() => {\n onAppear?.();\n }, [onAppear]);\n\n const onExit = useCallback(() => {\n onBeforeExitRef.current?.();\n }, []);\n\n const onExited = useCallback(() => {\n // оставляем обработку скрола еще и тут\n // чтобы обработать историю со сменой breakpoint\n enableScrollRef.current?.();\n enableScrollRef.current = undefined;\n\n onAfterExitRef.current?.();\n\n if (activatorRef.current !== null && document.contains(activatorRef.current)) {\n activatorRef.current?.focus();\n activatorRef.current = null;\n }\n }, []);\n\n useModalOrder(!!visible && !isServerEnv, modalRef);\n\n const { breakpoint } = useBreakpoint();\n useEffect(() => {\n if (!visible) {\n return;\n }\n\n const currentBreakpointVisible = !INVISIBLE_FOR_BREAKPOINTS.includes(breakpoint);\n if (!currentBreakpointVisible) {\n onExit();\n onExited();\n return;\n }\n\n onEntering();\n // visible не должно быть в зависимостях, т.к. этот эффект обрабатывает только изменение брейкпоинта\n // visible обрабатывается CSSTransition\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [breakpoint, onEntering, onExited, onExit]);\n\n useEffect(() => {\n return () => {\n enableScrollRef.current?.(animationTimeoutExitRef.current);\n enableScrollRef.current = undefined;\n };\n }, [visible]);\n\n useLayoutEffect(() => {\n const animationTimeoutElement = document.createElement('div');\n animationTimeoutElement.classList.add(styles.animationTimeout);\n document.body.appendChild(animationTimeoutElement);\n const style = window.getComputedStyle(animationTimeoutElement);\n setAnimationTimeout({\n enter: toNumber(style.getPropertyValue('--enter-animation-duration')),\n exit: toNumber(style.getPropertyValue('--exit-animation-duration')),\n });\n document.body.removeChild(animationTimeoutElement);\n }, [setAnimationTimeout]);\n\n useEffect(() => {\n if (showOverlay || !pageHeaderPadding || !visible) {\n return void 0;\n }\n\n const hasScrollTimeline = 'ScrollTimeline' in window;\n const overlay = overlayRef.current;\n\n if (!overlay) {\n return void 0;\n }\n\n let animation: Animation;\n const abortController = new AbortController();\n const keyframes = { top: [`${pageHeaderPadding}px`, '0px'] };\n if (hasScrollTimeline) {\n const timeline = new ScrollTimeline({ source: document.documentElement, axis: 'y' });\n // TS 7 (type-aware правила oxlint) уже знает rangeStart/rangeEnd, а TS 5 без каста не пропускает\n // oxlint-disable-next-line typescript/no-unnecessary-type-assertion\n animation = overlay.animate(keyframes, {\n timeline,\n rangeStart: '0px',\n // calc нужен для устранения бага https://issues.chromium.org/issues/40929569\n rangeEnd: `calc(0% + ${pageHeaderPadding}px)`,\n } as KeyframeAnimationOptions);\n } else {\n animation = overlay.animate(keyframes, { duration: 1000, fill: 'forwards' });\n animation.pause();\n\n window.addEventListener(\n 'scroll',\n () => {\n animation.currentTime =\n (Math.min(document.documentElement.scrollTop, pageHeaderPadding) / pageHeaderPadding) *\n 1000;\n },\n { signal: abortController.signal }\n );\n }\n\n return () => {\n abortController.abort();\n };\n }, [showOverlay, pageHeaderPadding, visible]);\n\n const overlayEventHandlers = useNoBubbling({\n onKeyDown: (event) => {\n if (keyboardMatch(event.nativeEvent as KeyboardEvent, keyboardKeys.Escape)) {\n onClose(event);\n }\n },\n onMouseDown: (event) => {\n if (!closeByClickOutside || modalRef.current?.contains(event.target as HTMLElement)) {\n return;\n }\n onClose(event);\n },\n });\n const overlayProps = showOverlay\n ? overlayEventHandlers\n : {\n onKeyDown: (event: React.KeyboardEvent) => {\n if (keyboardMatch(event.nativeEvent, keyboardKeys.Escape)) {\n onClose(event);\n }\n },\n };\n\n if (INVISIBLE_FOR_BREAKPOINTS.includes(breakpoint) || isServerEnv) {\n return null;\n }\n\n const modalHeaderProps = {\n title,\n titleElement,\n titleAlignment,\n titleSize,\n titleMaxLines,\n titleDescription,\n titleDescriptionMaxLines,\n titleStyle,\n titleDescriptionStyle,\n headerImageUrl,\n headerImage,\n headerHeight,\n options,\n actions,\n actionLink,\n } as ModalHeaderProps;\n\n const isTreeSelectorChild = Children.toArray(children).some(isValidTreeSelectorWrapper);\n // если есть progress bar, нужно скрыть divider (но showProgress - это слот под reactNode)\n const isActionBarHaveProgressBar =\n !!footer &&\n isActionBarComponent(footer) &&\n Boolean(footer.props.showProgress) &&\n isProgressBarComponent(footer.props.showProgress);\n\n return createPortal(\n <CSSTransition\n appear\n in={visible && !isServerEnv}\n nodeRef={overlayRef}\n onEntering={onEntering}\n onEntered={onEntered}\n onExit={onExit}\n onExited={onExited}\n classNames={CSS_CLASSES[position]}\n timeout={animationTimeout}\n unmountOnExit\n >\n <ThemeWrapper>\n {(themeClass) => (\n <Layer layer=\"modal\">\n <div\n {...overlayProps}\n ref={overlayRef}\n className={classnames(styles.modalOverlay, themeClass, {\n [styles.modalOverlayWithBackground]: showOverlay,\n [styles.modalOverlayLeft]: position === 'left',\n [styles.modalOverlayRight]: position === 'right',\n })}\n data-qa=\"modal-overlay\"\n >\n <CloseByClickOutsideContext.Provider value={overlayRef}>\n <div\n {...rest}\n {...additionalProps}\n aria-modal={visible && showOverlay && !isServerEnv}\n role=\"dialog\"\n className={classnames(styles.modal, {\n [styles.sizeSmall]: size === 'small',\n [styles.sizeMedium]: size === 'medium',\n [styles.modalFullHeight]: height === 'full-screen' || isTreeSelectorChild,\n [styles.noVerticalPaddings]: isVerticalPaddingsDisabled,\n [styles.noHorizontalPaddings]: isHorizontalPaddingsDisabled,\n [styles.modalWithBorder]: !showOverlay,\n })}\n ref={modalRefCallback}\n tabIndex={-1}\n style={{\n height: typeof height === 'number' ? `${height}px` : undefined,\n minHeight:\n typeof minHeight === 'number'\n ? `min(calc(100vh - 12px * 2), ${minHeight}px)`\n : undefined,\n }}\n >\n <ModalContentWithHeader\n {...modalHeaderProps}\n labelId={labelId}\n isTreeSelectorChild={isTreeSelectorChild}\n height={height}\n showDivider={!isActionBarHaveProgressBar}\n >\n {children}\n </ModalContentWithHeader>\n {!!footer && (\n <div className={styles.modalFooter} data-qa=\"modal-footer\">\n {isActionBarComponent(footer)\n ? cloneElement(footer, {\n type: footer.props.type || 'auto',\n padding: footer.props.padding || DEFAULT_ACTION_BAR_PADDING,\n showDivider: false,\n })\n : footer}\n </div>\n )}\n </div>\n </CloseByClickOutsideContext.Provider>\n </div>\n </Layer>\n )}\n </ThemeWrapper>\n </CSSTransition>,\n host || document.body\n );\n }\n);\n\nModal.displayName = 'Modal';\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAM,0BAA0B,GAAG,EAAE,CAAC;AACtC,MAAM,2BAA2B,GAAG,EAAE,CAAC;AAEvC,MAAM,IAAI,GAAG,MAAM,SAAS,CAAC;AAE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O,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,IAAI,0BAA0B;AAC3D,4CAAA,WAAW,EAAE,KAAK;yCACrB,CAAC;AACJ,0CAAE,MAAM,EAAA,CACV,CACT,CACC,EAAA,CAAA,EAAA,CAC4B,GACpC,EACF,CAAA,CACX,EACU,CAAA,EAAA,CACH,EAChB,IAAI,IAAI,QAAQ,CAAC,IAAI,CACxB,CAAC;AACN,CAAC,EACH;AAEF,KAAK,CAAC,WAAW,GAAG,OAAO;;;;"}
@@ -10,7 +10,7 @@ import { ModalHeader } from './ModalHeader.js';
10
10
  import { useScrollbar, Scrollbar } from '@hh.ru/magritte-ui-scrollbar';
11
11
  import { TextAreaGrowLimiter } from '@hh.ru/magritte-ui-textarea';
12
12
 
13
- var styles = {"modal-overlay":"magritte-modal-overlay___uurgp_1-0-38","modalOverlay":"magritte-modal-overlay___uurgp_1-0-38","modal-overlay-with-background":"magritte-modal-overlay-with-background___mR-T0_1-0-38","modalOverlayWithBackground":"magritte-modal-overlay-with-background___mR-T0_1-0-38","modal":"magritte-modal___2Wc4s_1-0-38","modal-overlay-left":"magritte-modal-overlay-left___qaiC9_1-0-38","modalOverlayLeft":"magritte-modal-overlay-left___qaiC9_1-0-38","modal-overlay-right":"magritte-modal-overlay-right___-HTKs_1-0-38","modalOverlayRight":"magritte-modal-overlay-right___-HTKs_1-0-38","size-small":"magritte-size-small___nSBwy_1-0-38","sizeSmall":"magritte-size-small___nSBwy_1-0-38","size-medium":"magritte-size-medium___Zuz-t_1-0-38","sizeMedium":"magritte-size-medium___Zuz-t_1-0-38","no-vertical-paddings":"magritte-no-vertical-paddings___XgMGS_1-0-38","noVerticalPaddings":"magritte-no-vertical-paddings___XgMGS_1-0-38","no-horizontal-paddings":"magritte-no-horizontal-paddings___MJDv4_1-0-38","noHorizontalPaddings":"magritte-no-horizontal-paddings___MJDv4_1-0-38","modal-full-height":"magritte-modal-full-height___UThtH_1-0-38","modalFullHeight":"magritte-modal-full-height___UThtH_1-0-38","modal-with-border":"magritte-modal-with-border___bqsql_1-0-38","modalWithBorder":"magritte-modal-with-border___bqsql_1-0-38","modal-content-wrapper":"magritte-modal-content-wrapper___-eFo3_1-0-38","modalContentWrapper":"magritte-modal-content-wrapper___-eFo3_1-0-38","modal-content":"magritte-modal-content___KY9ma_1-0-38","modalContent":"magritte-modal-content___KY9ma_1-0-38","modal-scroll-container":"magritte-modal-scroll-container___dg8jC_1-0-38","modalScrollContainer":"magritte-modal-scroll-container___dg8jC_1-0-38","modal-content-wrapper__one-line":"magritte-modal-content-wrapper__one-line___ZkEgT_1-0-38","modalContentWrapperOneLine":"magritte-modal-content-wrapper__one-line___ZkEgT_1-0-38","content-sticky-container":"magritte-content-sticky-container___VkZxO_1-0-38","contentStickyContainer":"magritte-content-sticky-container___VkZxO_1-0-38","divider-container":"magritte-divider-container___jKyxB_1-0-38","dividerContainer":"magritte-divider-container___jKyxB_1-0-38","divider-container-hidden":"magritte-divider-container-hidden___20nI5_1-0-38","dividerContainerHidden":"magritte-divider-container-hidden___20nI5_1-0-38","modal-footer":"magritte-modal-footer___TbH6x_1-0-38","modalFooter":"magritte-modal-footer___TbH6x_1-0-38","modal-buttons-container":"magritte-modal-buttons-container___9hXUo_1-0-38","modalButtonsContainer":"magritte-modal-buttons-container___9hXUo_1-0-38","animation-timeout":"magritte-animation-timeout___vK6nU_1-0-38","animationTimeout":"magritte-animation-timeout___vK6nU_1-0-38","animation-enter-center":"magritte-animation-enter-center___9zWOQ_1-0-38","animationEnterCenter":"magritte-animation-enter-center___9zWOQ_1-0-38","animation-enter-center-active":"magritte-animation-enter-center-active___dfICf_1-0-38","animationEnterCenterActive":"magritte-animation-enter-center-active___dfICf_1-0-38","animation-exit-center":"magritte-animation-exit-center___mrTCE_1-0-38","animationExitCenter":"magritte-animation-exit-center___mrTCE_1-0-38","animation-exit-center-active":"magritte-animation-exit-center-active___WZXYp_1-0-38","animationExitCenterActive":"magritte-animation-exit-center-active___WZXYp_1-0-38","animation-enter-left":"magritte-animation-enter-left___XiXzr_1-0-38","animationEnterLeft":"magritte-animation-enter-left___XiXzr_1-0-38","animation-enter-left-active":"magritte-animation-enter-left-active___4Uaz6_1-0-38","animationEnterLeftActive":"magritte-animation-enter-left-active___4Uaz6_1-0-38","animation-exit-left":"magritte-animation-exit-left___NHvvO_1-0-38","animationExitLeft":"magritte-animation-exit-left___NHvvO_1-0-38","animation-exit-left-active":"magritte-animation-exit-left-active___oDszE_1-0-38","animationExitLeftActive":"magritte-animation-exit-left-active___oDszE_1-0-38","animation-enter-right":"magritte-animation-enter-right___1bqPX_1-0-38","animationEnterRight":"magritte-animation-enter-right___1bqPX_1-0-38","animation-enter-right-active":"magritte-animation-enter-right-active___OR65U_1-0-38","animationEnterRightActive":"magritte-animation-enter-right-active___OR65U_1-0-38","animation-exit-right":"magritte-animation-exit-right___hyYBh_1-0-38","animationExitRight":"magritte-animation-exit-right___hyYBh_1-0-38","animation-exit-right-active":"magritte-animation-exit-right-active___ft6Lz_1-0-38","animationExitRightActive":"magritte-animation-exit-right-active___ft6Lz_1-0-38","space-preserver":"magritte-space-preserver___nz3Nw_1-0-38","spacePreserver":"magritte-space-preserver___nz3Nw_1-0-38","tree-selector-container":"magritte-tree-selector-container___XZh1C_1-0-38","treeSelectorContainer":"magritte-tree-selector-container___XZh1C_1-0-38","grow-limiter":"magritte-grow-limiter___SPuoT_1-0-38","growLimiter":"magritte-grow-limiter___SPuoT_1-0-38"};
13
+ var styles = {"modal-overlay":"magritte-modal-overlay___uurgp_1-0-39","modalOverlay":"magritte-modal-overlay___uurgp_1-0-39","modal-overlay-with-background":"magritte-modal-overlay-with-background___mR-T0_1-0-39","modalOverlayWithBackground":"magritte-modal-overlay-with-background___mR-T0_1-0-39","modal":"magritte-modal___2Wc4s_1-0-39","modal-overlay-left":"magritte-modal-overlay-left___qaiC9_1-0-39","modalOverlayLeft":"magritte-modal-overlay-left___qaiC9_1-0-39","modal-overlay-right":"magritte-modal-overlay-right___-HTKs_1-0-39","modalOverlayRight":"magritte-modal-overlay-right___-HTKs_1-0-39","size-small":"magritte-size-small___nSBwy_1-0-39","sizeSmall":"magritte-size-small___nSBwy_1-0-39","size-medium":"magritte-size-medium___Zuz-t_1-0-39","sizeMedium":"magritte-size-medium___Zuz-t_1-0-39","no-vertical-paddings":"magritte-no-vertical-paddings___XgMGS_1-0-39","noVerticalPaddings":"magritte-no-vertical-paddings___XgMGS_1-0-39","no-horizontal-paddings":"magritte-no-horizontal-paddings___MJDv4_1-0-39","noHorizontalPaddings":"magritte-no-horizontal-paddings___MJDv4_1-0-39","modal-full-height":"magritte-modal-full-height___UThtH_1-0-39","modalFullHeight":"magritte-modal-full-height___UThtH_1-0-39","modal-with-border":"magritte-modal-with-border___bqsql_1-0-39","modalWithBorder":"magritte-modal-with-border___bqsql_1-0-39","modal-content-wrapper":"magritte-modal-content-wrapper___-eFo3_1-0-39","modalContentWrapper":"magritte-modal-content-wrapper___-eFo3_1-0-39","modal-content":"magritte-modal-content___KY9ma_1-0-39","modalContent":"magritte-modal-content___KY9ma_1-0-39","modal-scroll-container":"magritte-modal-scroll-container___dg8jC_1-0-39","modalScrollContainer":"magritte-modal-scroll-container___dg8jC_1-0-39","modal-content-wrapper__one-line":"magritte-modal-content-wrapper__one-line___ZkEgT_1-0-39","modalContentWrapperOneLine":"magritte-modal-content-wrapper__one-line___ZkEgT_1-0-39","content-sticky-container":"magritte-content-sticky-container___VkZxO_1-0-39","contentStickyContainer":"magritte-content-sticky-container___VkZxO_1-0-39","divider-container":"magritte-divider-container___jKyxB_1-0-39","dividerContainer":"magritte-divider-container___jKyxB_1-0-39","divider-container-hidden":"magritte-divider-container-hidden___20nI5_1-0-39","dividerContainerHidden":"magritte-divider-container-hidden___20nI5_1-0-39","modal-footer":"magritte-modal-footer___TbH6x_1-0-39","modalFooter":"magritte-modal-footer___TbH6x_1-0-39","modal-buttons-container":"magritte-modal-buttons-container___9hXUo_1-0-39","modalButtonsContainer":"magritte-modal-buttons-container___9hXUo_1-0-39","animation-timeout":"magritte-animation-timeout___vK6nU_1-0-39","animationTimeout":"magritte-animation-timeout___vK6nU_1-0-39","animation-enter-center":"magritte-animation-enter-center___9zWOQ_1-0-39","animationEnterCenter":"magritte-animation-enter-center___9zWOQ_1-0-39","animation-enter-center-active":"magritte-animation-enter-center-active___dfICf_1-0-39","animationEnterCenterActive":"magritte-animation-enter-center-active___dfICf_1-0-39","animation-exit-center":"magritte-animation-exit-center___mrTCE_1-0-39","animationExitCenter":"magritte-animation-exit-center___mrTCE_1-0-39","animation-exit-center-active":"magritte-animation-exit-center-active___WZXYp_1-0-39","animationExitCenterActive":"magritte-animation-exit-center-active___WZXYp_1-0-39","animation-enter-left":"magritte-animation-enter-left___XiXzr_1-0-39","animationEnterLeft":"magritte-animation-enter-left___XiXzr_1-0-39","animation-enter-left-active":"magritte-animation-enter-left-active___4Uaz6_1-0-39","animationEnterLeftActive":"magritte-animation-enter-left-active___4Uaz6_1-0-39","animation-exit-left":"magritte-animation-exit-left___NHvvO_1-0-39","animationExitLeft":"magritte-animation-exit-left___NHvvO_1-0-39","animation-exit-left-active":"magritte-animation-exit-left-active___oDszE_1-0-39","animationExitLeftActive":"magritte-animation-exit-left-active___oDszE_1-0-39","animation-enter-right":"magritte-animation-enter-right___1bqPX_1-0-39","animationEnterRight":"magritte-animation-enter-right___1bqPX_1-0-39","animation-enter-right-active":"magritte-animation-enter-right-active___OR65U_1-0-39","animationEnterRightActive":"magritte-animation-enter-right-active___OR65U_1-0-39","animation-exit-right":"magritte-animation-exit-right___hyYBh_1-0-39","animationExitRight":"magritte-animation-exit-right___hyYBh_1-0-39","animation-exit-right-active":"magritte-animation-exit-right-active___ft6Lz_1-0-39","animationExitRightActive":"magritte-animation-exit-right-active___ft6Lz_1-0-39","space-preserver":"magritte-space-preserver___nz3Nw_1-0-39","spacePreserver":"magritte-space-preserver___nz3Nw_1-0-39","tree-selector-container":"magritte-tree-selector-container___XZh1C_1-0-39","treeSelectorContainer":"magritte-tree-selector-container___XZh1C_1-0-39","grow-limiter":"magritte-grow-limiter___SPuoT_1-0-39","growLimiter":"magritte-grow-limiter___SPuoT_1-0-39"};
14
14
 
15
15
  const checkIsScrolledToBottom = (el) => {
16
16
  return Math.abs(el.scrollHeight - el.scrollTop - el.clientHeight) < 1;
@@ -147,4 +147,4 @@ const ModalContentWithHeader = ({ labelId, children, headerHeight: _headerHeight
147
147
  };
148
148
 
149
149
  export { ModalContentWithHeader as M, styles as s };
150
- //# sourceMappingURL=ModalContentWithHeader-Cmr-Wfi6.js.map
150
+ //# sourceMappingURL=ModalContentWithHeader-B7tpHFBW.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ModalContentWithHeader-Cmr-Wfi6.js","sources":["src/ModalContentWithHeader.tsx"],"sourcesContent":["import { FC, PropsWithChildren, useCallback, useLayoutEffect, useRef, useState } from 'react';\nimport classnames from 'classnames';\n\nimport { requestAnimation } from '@hh.ru/magritte-common-func-utils';\nimport { useMultipleRefs } from '@hh.ru/magritte-common-use-multiple-refs';\nimport { ContentOverlayRoot } from '@hh.ru/magritte-ui-content-overlay';\nimport { Divider } from '@hh.ru/magritte-ui-divider';\nimport { ModalHeader } from '@hh.ru/magritte-ui-modal-deprecated/ModalHeader';\nimport { ModalHeaderProps, ModalHeight } from '@hh.ru/magritte-ui-modal-deprecated/types';\nimport { Scrollbar, useScrollbar } from '@hh.ru/magritte-ui-scrollbar';\nimport { TextAreaGrowLimiter } from '@hh.ru/magritte-ui-textarea';\n\nimport styles from './modal.less';\n\nconst checkIsScrolledToBottom = (el: HTMLElement) => {\n return Math.abs(el.scrollHeight - el.scrollTop - el.clientHeight) < 1;\n};\n\nconst clamp = (value: number, min: number, max: number) => Math.min(Math.max(value, min), max);\n\n// Минимальная высота до которой может сжаться хедер\nconst HEADER_SHRINK_MIN_HEIGHT = 148;\n// Минимальная высота отступа между хедером и контентом\nconst HEADER_MARGIN_MIN_HEIGHT = 12;\n// Максимальная высота отступа между хедером и контентом\nconst HEADER_MARGIN_MAX_HEIGHT = 24;\nconst HEADER_MARGIN_HEIGHT_DELTA = HEADER_MARGIN_MAX_HEIGHT - HEADER_MARGIN_MIN_HEIGHT;\n\n// Вычисляет минимальную высоту до которой может сжаться хедер с учетом высоты контента, чтобы не спровоцировать\n// изменение размера модалки\nconst calcHeaderShrinkLimit = (\n headerHeight: number,\n headerMaxHeight: number,\n contentHeight: number,\n contentScrollHeight: number,\n marginHeight: number\n) => {\n // Высота контента скрытого под скроллом когда хедер и марджин под ним имеет максимальную допустимую высоту\n const contentScrollDelta =\n contentScrollHeight - // Высота контента скрытого под скроллом в текущем состоянии\n contentHeight + // Высота контейнера содержащего контент\n (HEADER_MARGIN_MAX_HEIGHT - marginHeight) + // Дельта между текущей высотой марджина и максимальной допустимой\n (headerMaxHeight - headerHeight); // Дельта между текущей высотой хедера и максимальной допустимой\n\n const headerShrinkMinHeight = headerMaxHeight - (contentScrollDelta - HEADER_MARGIN_HEIGHT_DELTA);\n\n return Math.max(headerShrinkMinHeight, HEADER_SHRINK_MIN_HEIGHT);\n};\n\nconst shrinkByDelta = (\n headerImageContainer: HTMLDivElement | null,\n headerWrapper: HTMLDivElement | null,\n headerMinHeight: number,\n headerMaxHeight: number,\n scrollDeltaY: number\n) => {\n if (!headerImageContainer || !headerWrapper) {\n return;\n }\n\n const marginHeight = clamp(\n HEADER_MARGIN_MAX_HEIGHT - scrollDeltaY,\n HEADER_MARGIN_MIN_HEIGHT,\n HEADER_MARGIN_MAX_HEIGHT\n );\n headerWrapper.style.marginBottom = `${marginHeight}px`;\n\n const headerHeight = clamp(\n // Тут прибаляем дельту марджина потому что сначала должен сжаться отступ\n Math.floor(headerMaxHeight - scrollDeltaY + HEADER_MARGIN_HEIGHT_DELTA),\n headerMinHeight,\n headerMaxHeight\n );\n headerImageContainer.style.height = `${headerHeight}px`;\n};\n\nexport const ModalContentWithHeader: FC<\n PropsWithChildren<\n ModalHeaderProps & { labelId: string; isTreeSelectorChild: boolean; height?: ModalHeight; showDivider: boolean }\n >\n> = ({\n labelId,\n children,\n headerHeight: _headerHeight = 0,\n isTreeSelectorChild,\n height,\n showDivider = true,\n ...modalHeaderProps\n}) => {\n const { title, headerImageUrl, headerImage, actions, actionLink, options } = modalHeaderProps;\n\n const bottomDividerVisibleRef = useRef(false);\n const contentContainerRef = useRef<HTMLDivElement>(null);\n const headerImageContainerRef = useRef<HTMLDivElement>(null);\n const headerWrapperRef = useRef<HTMLDivElement>(null);\n const spacePreserverRef = useRef<HTMLDivElement>(null);\n const stickyContainerRef = useRef<HTMLDivElement>(null);\n const hasHeaderImageRef = useRef(!!headerImageUrl || !!headerImage);\n hasHeaderImageRef.current = !!headerImageUrl || !!headerImage;\n const headerHeightRef = useRef(0);\n headerHeightRef.current = hasHeaderImageRef.current ? Math.max(_headerHeight, 200) : 0;\n const minHeaderHeightRef = useRef(0);\n const contentOverlayRef = useRef<HTMLDivElement>(null);\n\n const bottomDividerContainerRef = useRef<HTMLDivElement>(null);\n const topDividerContainerRef = useRef<HTMLDivElement>(null);\n\n const withoutHeader = !title && !hasHeaderImageRef.current && !actions && !actionLink && !options;\n const onlyActions = !title && !hasHeaderImageRef.current && !options && (actions || actionLink);\n\n const [growLimiterContextValue, _] = useState(() => ({\n containerRef: contentContainerRef,\n }));\n\n const isTopDividerVisible = () => {\n if (!contentContainerRef.current) {\n return false;\n }\n\n const topDividerVisible = hasHeaderImageRef.current\n ? contentContainerRef.current.scrollTop >\n headerHeightRef.current - minHeaderHeightRef.current + HEADER_MARGIN_HEIGHT_DELTA\n : contentContainerRef.current.scrollTop !== 0;\n\n return topDividerVisible && (options || !hasHeaderImageRef.current) && !onlyActions && !withoutHeader;\n };\n\n const recalcContentOverlayPosition = useCallback(() => {\n if (contentOverlayRef.current !== null && contentContainerRef.current !== null) {\n contentOverlayRef.current.style.height = `${contentContainerRef.current.clientHeight}px`;\n }\n }, []);\n\n const updateHeaderDimensions = useCallback(() => {\n if (\n !headerImageContainerRef.current ||\n !headerWrapperRef.current ||\n !stickyContainerRef.current ||\n !spacePreserverRef.current ||\n !contentContainerRef.current\n ) {\n return;\n }\n\n if (!hasHeaderImageRef.current) {\n spacePreserverRef.current.style.height = '0';\n return;\n }\n\n minHeaderHeightRef.current = calcHeaderShrinkLimit(\n headerImageContainerRef.current.clientHeight,\n headerHeightRef.current,\n contentContainerRef.current.clientHeight,\n stickyContainerRef.current.scrollHeight,\n parseInt(headerWrapperRef.current.style.marginBottom || '0', 10)\n );\n\n shrinkByDelta(\n headerImageContainerRef.current,\n headerWrapperRef.current,\n minHeaderHeightRef.current,\n headerHeightRef.current,\n contentContainerRef.current.scrollTop\n );\n const preserverSize = headerHeightRef.current - minHeaderHeightRef.current + HEADER_MARGIN_HEIGHT_DELTA;\n spacePreserverRef.current.style.height = `${preserverSize}px`;\n }, []);\n\n useLayoutEffect(() => {\n if (contentContainerRef.current) {\n const observer = new ResizeObserver(\n requestAnimation(() => {\n if (!contentContainerRef.current) {\n return;\n }\n const isScrollable =\n contentContainerRef.current.scrollHeight > contentContainerRef.current.clientHeight;\n const hasScroll = isScrollable && !checkIsScrolledToBottom(contentContainerRef.current);\n bottomDividerVisibleRef.current = hasScroll;\n bottomDividerContainerRef.current?.classList.toggle(\n styles.dividerContainerHidden,\n !bottomDividerVisibleRef.current\n );\n updateHeaderDimensions();\n recalcContentOverlayPosition();\n })\n );\n observer.observe(contentContainerRef.current);\n return () => observer.disconnect();\n }\n\n return undefined;\n }, [updateHeaderDimensions, recalcContentOverlayPosition]);\n\n useLayoutEffect(() => {\n updateHeaderDimensions();\n recalcContentOverlayPosition();\n if (!options && (headerImageUrl || headerImage)) {\n topDividerContainerRef.current?.classList.toggle(styles.dividerContainerHidden, true);\n }\n }, [headerImageUrl, headerImage, updateHeaderDimensions, recalcContentOverlayPosition, options]);\n\n const handleScroll = () => {\n if (!contentContainerRef.current) {\n return;\n }\n\n bottomDividerVisibleRef.current = !checkIsScrolledToBottom(contentContainerRef.current);\n bottomDividerContainerRef.current?.classList.toggle(\n styles.dividerContainerHidden,\n !bottomDividerVisibleRef.current\n );\n topDividerContainerRef.current?.classList.toggle(styles.dividerContainerHidden, !isTopDividerVisible());\n if (hasHeaderImageRef.current) {\n shrinkByDelta(\n headerImageContainerRef.current,\n headerWrapperRef.current,\n minHeaderHeightRef.current,\n headerHeightRef.current,\n contentContainerRef.current.scrollTop\n );\n }\n };\n\n const { hasVerticalScroll, verticalScrollbarProps, ...scrollbar } = useScrollbar({ axis: 'vertical' });\n const contentContainerRefCallback = useMultipleRefs(contentContainerRef, scrollbar.scrollContainerRef);\n const stickyContainerRefCallback = useMultipleRefs(stickyContainerRef, scrollbar.contentWrapperRef);\n\n return (\n <>\n <div\n className={classnames(styles.modalContentWrapper, {\n [styles.modalContentWrapperOneLine]: onlyActions,\n })}\n >\n <ModalHeader\n {...modalHeaderProps}\n headerHeight={headerHeightRef.current}\n labelId={labelId}\n wrapperRef={headerWrapperRef}\n ref={headerImageContainerRef}\n />\n <div\n className={classnames(styles.dividerContainer, {\n [styles.dividerContainerHidden]: !isTopDividerVisible(),\n })}\n ref={topDividerContainerRef}\n >\n <Divider />\n </div>\n\n <div className={classnames(styles.modalContent, scrollbar.hoverContainerCssClass)}>\n <ContentOverlayRoot ref={contentOverlayRef}>\n {isTreeSelectorChild ? (\n <div className={styles.treeSelectorContainer}>{children}</div>\n ) : (\n <>\n <div\n className={classnames(styles.modalScrollContainer)}\n ref={contentContainerRefCallback}\n onScroll={handleScroll}\n data-qa=\"modal-content-scroll-container\"\n >\n <div\n className={classnames(styles.contentStickyContainer)}\n ref={stickyContainerRefCallback}\n >\n <TextAreaGrowLimiter\n {...growLimiterContextValue}\n className={styles.growLimiter}\n >\n {children}\n </TextAreaGrowLimiter>\n </div>\n <div className={styles.spacePreserver} ref={spacePreserverRef} />\n </div>\n {hasVerticalScroll && <Scrollbar {...verticalScrollbarProps} />}\n </>\n )}\n </ContentOverlayRoot>\n </div>\n </div>\n {showDivider && (\n <div\n className={classnames(styles.dividerContainer, {\n [styles.dividerContainerHidden]: !bottomDividerVisibleRef.current,\n })}\n ref={bottomDividerContainerRef}\n >\n <Divider />\n </div>\n )}\n </>\n );\n};\n"],"names":["_jsxs","_Fragment","_jsx"],"mappings":";;;;;;;;;;;;;AAcA,MAAM,uBAAuB,GAAG,CAAC,EAAe,KAAI;AAChD,IAAA,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,YAAY,GAAG,EAAE,CAAC,SAAS,GAAG,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;AAC1E,CAAC,CAAC;AAEF,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,GAAW,EAAE,GAAW,KAAK,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;AAE/F;AACA,MAAM,wBAAwB,GAAG,GAAG,CAAC;AACrC;AACA,MAAM,wBAAwB,GAAG,EAAE,CAAC;AACpC;AACA,MAAM,wBAAwB,GAAG,EAAE,CAAC;AACpC,MAAM,0BAA0B,GAAG,wBAAwB,GAAG,wBAAwB,CAAC;AAEvF;AACA;AACA,MAAM,qBAAqB,GAAG,CAC1B,YAAoB,EACpB,eAAuB,EACvB,aAAqB,EACrB,mBAA2B,EAC3B,YAAoB,KACpB;;AAEA,IAAA,MAAM,kBAAkB,GACpB,mBAAmB;AACnB,QAAA,aAAa;AACb,SAAC,wBAAwB,GAAG,YAAY,CAAC;AACzC,SAAC,eAAe,GAAG,YAAY,CAAC,CAAC;IAErC,MAAM,qBAAqB,GAAG,eAAe,IAAI,kBAAkB,GAAG,0BAA0B,CAAC,CAAC;IAElG,OAAO,IAAI,CAAC,GAAG,CAAC,qBAAqB,EAAE,wBAAwB,CAAC,CAAC;AACrE,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CAClB,oBAA2C,EAC3C,aAAoC,EACpC,eAAuB,EACvB,eAAuB,EACvB,YAAoB,KACpB;AACA,IAAA,IAAI,CAAC,oBAA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,QAAQ,EAAE,YAAY,EACd,SAAA,EAAA,gCAAgC,EAExC,QAAA,EAAA,CAAAE,GAAA,CAAA,KAAA,EAAA,EACI,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,sBAAsB,CAAC,EACpD,GAAG,EAAE,0BAA0B,EAAA,QAAA,EAE/BA,GAAC,CAAA,mBAAmB,EACZ,EAAA,GAAA,uBAAuB,EAC3B,SAAS,EAAE,MAAM,CAAC,WAAW,EAAA,QAAA,EAE5B,QAAQ,EAAA,CACS,EACpB,CAAA,EACNA,aAAK,SAAS,EAAE,MAAM,CAAC,cAAc,EAAE,GAAG,EAAE,iBAAiB,EAAI,CAAA,CAAA,EAAA,CAC/D,EACL,iBAAiB,IAAIA,GAAA,CAAC,SAAS,EAAA,EAAA,GAAK,sBAAsB,EAAI,CAAA,CAAA,EAAA,CAChE,CACN,EAAA,CACgB,EACnB,CAAA,CAAA,EAAA,CACJ,EACL,WAAW,KACRA,GAAA,CAAA,KAAA,EAAA,EACI,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,gBAAgB,EAAE;oBAC3C,CAAC,MAAM,CAAC,sBAAsB,GAAG,CAAC,uBAAuB,CAAC,OAAO;AACpE,iBAAA,CAAC,EACF,GAAG,EAAE,yBAAyB,EAE9B,QAAA,EAAAA,GAAA,CAAC,OAAO,EAAA,EAAA,CAAG,EACT,CAAA,CACT,CACF,EAAA,CAAA,EACL;AACN;;;;"}
1
+ {"version":3,"file":"ModalContentWithHeader-B7tpHFBW.js","sources":["src/ModalContentWithHeader.tsx"],"sourcesContent":["import { FC, PropsWithChildren, useCallback, useLayoutEffect, useRef, useState } from 'react';\nimport classnames from 'classnames';\n\nimport { requestAnimation } from '@hh.ru/magritte-common-func-utils';\nimport { useMultipleRefs } from '@hh.ru/magritte-common-use-multiple-refs';\nimport { ContentOverlayRoot } from '@hh.ru/magritte-ui-content-overlay';\nimport { Divider } from '@hh.ru/magritte-ui-divider';\nimport { ModalHeader } from '@hh.ru/magritte-ui-modal-deprecated/ModalHeader';\nimport { ModalHeaderProps, ModalHeight } from '@hh.ru/magritte-ui-modal-deprecated/types';\nimport { Scrollbar, useScrollbar } from '@hh.ru/magritte-ui-scrollbar';\nimport { TextAreaGrowLimiter } from '@hh.ru/magritte-ui-textarea';\n\nimport styles from './modal.less';\n\nconst checkIsScrolledToBottom = (el: HTMLElement) => {\n return Math.abs(el.scrollHeight - el.scrollTop - el.clientHeight) < 1;\n};\n\nconst clamp = (value: number, min: number, max: number) => Math.min(Math.max(value, min), max);\n\n// Минимальная высота до которой может сжаться хедер\nconst HEADER_SHRINK_MIN_HEIGHT = 148;\n// Минимальная высота отступа между хедером и контентом\nconst HEADER_MARGIN_MIN_HEIGHT = 12;\n// Максимальная высота отступа между хедером и контентом\nconst HEADER_MARGIN_MAX_HEIGHT = 24;\nconst HEADER_MARGIN_HEIGHT_DELTA = HEADER_MARGIN_MAX_HEIGHT - HEADER_MARGIN_MIN_HEIGHT;\n\n// Вычисляет минимальную высоту до которой может сжаться хедер с учетом высоты контента, чтобы не спровоцировать\n// изменение размера модалки\nconst calcHeaderShrinkLimit = (\n headerHeight: number,\n headerMaxHeight: number,\n contentHeight: number,\n contentScrollHeight: number,\n marginHeight: number\n) => {\n // Высота контента скрытого под скроллом когда хедер и марджин под ним имеет максимальную допустимую высоту\n const contentScrollDelta =\n contentScrollHeight - // Высота контента скрытого под скроллом в текущем состоянии\n contentHeight + // Высота контейнера содержащего контент\n (HEADER_MARGIN_MAX_HEIGHT - marginHeight) + // Дельта между текущей высотой марджина и максимальной допустимой\n (headerMaxHeight - headerHeight); // Дельта между текущей высотой хедера и максимальной допустимой\n\n const headerShrinkMinHeight = headerMaxHeight - (contentScrollDelta - HEADER_MARGIN_HEIGHT_DELTA);\n\n return Math.max(headerShrinkMinHeight, HEADER_SHRINK_MIN_HEIGHT);\n};\n\nconst shrinkByDelta = (\n headerImageContainer: HTMLDivElement | null,\n headerWrapper: HTMLDivElement | null,\n headerMinHeight: number,\n headerMaxHeight: number,\n scrollDeltaY: number\n) => {\n if (!headerImageContainer || !headerWrapper) {\n return;\n }\n\n const marginHeight = clamp(\n HEADER_MARGIN_MAX_HEIGHT - scrollDeltaY,\n HEADER_MARGIN_MIN_HEIGHT,\n HEADER_MARGIN_MAX_HEIGHT\n );\n headerWrapper.style.marginBottom = `${marginHeight}px`;\n\n const headerHeight = clamp(\n // Тут прибаляем дельту марджина потому что сначала должен сжаться отступ\n Math.floor(headerMaxHeight - scrollDeltaY + HEADER_MARGIN_HEIGHT_DELTA),\n headerMinHeight,\n headerMaxHeight\n );\n headerImageContainer.style.height = `${headerHeight}px`;\n};\n\nexport const ModalContentWithHeader: FC<\n PropsWithChildren<\n ModalHeaderProps & { labelId: string; isTreeSelectorChild: boolean; height?: ModalHeight; showDivider: boolean }\n >\n> = ({\n labelId,\n children,\n headerHeight: _headerHeight = 0,\n isTreeSelectorChild,\n height,\n showDivider = true,\n ...modalHeaderProps\n}) => {\n const { title, headerImageUrl, headerImage, actions, actionLink, options } = modalHeaderProps;\n\n const bottomDividerVisibleRef = useRef(false);\n const contentContainerRef = useRef<HTMLDivElement>(null);\n const headerImageContainerRef = useRef<HTMLDivElement>(null);\n const headerWrapperRef = useRef<HTMLDivElement>(null);\n const spacePreserverRef = useRef<HTMLDivElement>(null);\n const stickyContainerRef = useRef<HTMLDivElement>(null);\n const hasHeaderImageRef = useRef(!!headerImageUrl || !!headerImage);\n hasHeaderImageRef.current = !!headerImageUrl || !!headerImage;\n const headerHeightRef = useRef(0);\n headerHeightRef.current = hasHeaderImageRef.current ? Math.max(_headerHeight, 200) : 0;\n const minHeaderHeightRef = useRef(0);\n const contentOverlayRef = useRef<HTMLDivElement>(null);\n\n const bottomDividerContainerRef = useRef<HTMLDivElement>(null);\n const topDividerContainerRef = useRef<HTMLDivElement>(null);\n\n const withoutHeader = !title && !hasHeaderImageRef.current && !actions && !actionLink && !options;\n const onlyActions = !title && !hasHeaderImageRef.current && !options && (actions || actionLink);\n\n const [growLimiterContextValue, _] = useState(() => ({\n containerRef: contentContainerRef,\n }));\n\n const isTopDividerVisible = () => {\n if (!contentContainerRef.current) {\n return false;\n }\n\n const topDividerVisible = hasHeaderImageRef.current\n ? contentContainerRef.current.scrollTop >\n headerHeightRef.current - minHeaderHeightRef.current + HEADER_MARGIN_HEIGHT_DELTA\n : contentContainerRef.current.scrollTop !== 0;\n\n return topDividerVisible && (options || !hasHeaderImageRef.current) && !onlyActions && !withoutHeader;\n };\n\n const recalcContentOverlayPosition = useCallback(() => {\n if (contentOverlayRef.current !== null && contentContainerRef.current !== null) {\n contentOverlayRef.current.style.height = `${contentContainerRef.current.clientHeight}px`;\n }\n }, []);\n\n const updateHeaderDimensions = useCallback(() => {\n if (\n !headerImageContainerRef.current ||\n !headerWrapperRef.current ||\n !stickyContainerRef.current ||\n !spacePreserverRef.current ||\n !contentContainerRef.current\n ) {\n return;\n }\n\n if (!hasHeaderImageRef.current) {\n spacePreserverRef.current.style.height = '0';\n return;\n }\n\n minHeaderHeightRef.current = calcHeaderShrinkLimit(\n headerImageContainerRef.current.clientHeight,\n headerHeightRef.current,\n contentContainerRef.current.clientHeight,\n stickyContainerRef.current.scrollHeight,\n parseInt(headerWrapperRef.current.style.marginBottom || '0', 10)\n );\n\n shrinkByDelta(\n headerImageContainerRef.current,\n headerWrapperRef.current,\n minHeaderHeightRef.current,\n headerHeightRef.current,\n contentContainerRef.current.scrollTop\n );\n const preserverSize = headerHeightRef.current - minHeaderHeightRef.current + HEADER_MARGIN_HEIGHT_DELTA;\n spacePreserverRef.current.style.height = `${preserverSize}px`;\n }, []);\n\n useLayoutEffect(() => {\n if (contentContainerRef.current) {\n const observer = new ResizeObserver(\n requestAnimation(() => {\n if (!contentContainerRef.current) {\n return;\n }\n const isScrollable =\n contentContainerRef.current.scrollHeight > contentContainerRef.current.clientHeight;\n const hasScroll = isScrollable && !checkIsScrolledToBottom(contentContainerRef.current);\n bottomDividerVisibleRef.current = hasScroll;\n bottomDividerContainerRef.current?.classList.toggle(\n styles.dividerContainerHidden,\n !bottomDividerVisibleRef.current\n );\n updateHeaderDimensions();\n recalcContentOverlayPosition();\n })\n );\n observer.observe(contentContainerRef.current);\n return () => observer.disconnect();\n }\n\n return undefined;\n }, [updateHeaderDimensions, recalcContentOverlayPosition]);\n\n useLayoutEffect(() => {\n updateHeaderDimensions();\n recalcContentOverlayPosition();\n if (!options && (headerImageUrl || headerImage)) {\n topDividerContainerRef.current?.classList.toggle(styles.dividerContainerHidden, true);\n }\n }, [headerImageUrl, headerImage, updateHeaderDimensions, recalcContentOverlayPosition, options]);\n\n const handleScroll = () => {\n if (!contentContainerRef.current) {\n return;\n }\n\n bottomDividerVisibleRef.current = !checkIsScrolledToBottom(contentContainerRef.current);\n bottomDividerContainerRef.current?.classList.toggle(\n styles.dividerContainerHidden,\n !bottomDividerVisibleRef.current\n );\n topDividerContainerRef.current?.classList.toggle(styles.dividerContainerHidden, !isTopDividerVisible());\n if (hasHeaderImageRef.current) {\n shrinkByDelta(\n headerImageContainerRef.current,\n headerWrapperRef.current,\n minHeaderHeightRef.current,\n headerHeightRef.current,\n contentContainerRef.current.scrollTop\n );\n }\n };\n\n const { hasVerticalScroll, verticalScrollbarProps, ...scrollbar } = useScrollbar({ axis: 'vertical' });\n const contentContainerRefCallback = useMultipleRefs(contentContainerRef, scrollbar.scrollContainerRef);\n const stickyContainerRefCallback = useMultipleRefs(stickyContainerRef, scrollbar.contentWrapperRef);\n\n return (\n <>\n <div\n className={classnames(styles.modalContentWrapper, {\n [styles.modalContentWrapperOneLine]: onlyActions,\n })}\n >\n <ModalHeader\n {...modalHeaderProps}\n headerHeight={headerHeightRef.current}\n labelId={labelId}\n wrapperRef={headerWrapperRef}\n ref={headerImageContainerRef}\n />\n <div\n className={classnames(styles.dividerContainer, {\n [styles.dividerContainerHidden]: !isTopDividerVisible(),\n })}\n ref={topDividerContainerRef}\n >\n <Divider />\n </div>\n\n <div className={classnames(styles.modalContent, scrollbar.hoverContainerCssClass)}>\n <ContentOverlayRoot ref={contentOverlayRef}>\n {isTreeSelectorChild ? (\n <div className={styles.treeSelectorContainer}>{children}</div>\n ) : (\n <>\n <div\n className={classnames(styles.modalScrollContainer)}\n ref={contentContainerRefCallback}\n onScroll={handleScroll}\n data-qa=\"modal-content-scroll-container\"\n >\n <div\n className={classnames(styles.contentStickyContainer)}\n ref={stickyContainerRefCallback}\n >\n <TextAreaGrowLimiter\n {...growLimiterContextValue}\n className={styles.growLimiter}\n >\n {children}\n </TextAreaGrowLimiter>\n </div>\n <div className={styles.spacePreserver} ref={spacePreserverRef} />\n </div>\n {hasVerticalScroll && <Scrollbar {...verticalScrollbarProps} />}\n </>\n )}\n </ContentOverlayRoot>\n </div>\n </div>\n {showDivider && (\n <div\n className={classnames(styles.dividerContainer, {\n [styles.dividerContainerHidden]: !bottomDividerVisibleRef.current,\n })}\n ref={bottomDividerContainerRef}\n >\n <Divider />\n </div>\n )}\n </>\n );\n};\n"],"names":["_jsxs","_Fragment","_jsx"],"mappings":";;;;;;;;;;;;;AAcA,MAAM,uBAAuB,GAAG,CAAC,EAAe,KAAI;AAChD,IAAA,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,YAAY,GAAG,EAAE,CAAC,SAAS,GAAG,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;AAC1E,CAAC,CAAC;AAEF,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,GAAW,EAAE,GAAW,KAAK,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;AAE/F;AACA,MAAM,wBAAwB,GAAG,GAAG,CAAC;AACrC;AACA,MAAM,wBAAwB,GAAG,EAAE,CAAC;AACpC;AACA,MAAM,wBAAwB,GAAG,EAAE,CAAC;AACpC,MAAM,0BAA0B,GAAG,wBAAwB,GAAG,wBAAwB,CAAC;AAEvF;AACA;AACA,MAAM,qBAAqB,GAAG,CAC1B,YAAoB,E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BAAA,CAAC,EACF,GAAG,EAAE,yBAAyB,EAE9B,QAAA,EAAAA,GAAA,CAAC,OAAO,EAAA,EAAA,CAAG,EACT,CAAA,CACT,CACF,EAAA,CAAA,EACL;AACN;;;;"}
@@ -9,7 +9,7 @@ import '@hh.ru/magritte-ui-divider';
9
9
  import './ModalHeader.js';
10
10
  import '@hh.ru/magritte-ui-scrollbar';
11
11
  import '@hh.ru/magritte-ui-textarea';
12
- export { M as ModalContentWithHeader } from './ModalContentWithHeader-Cmr-Wfi6.js';
12
+ export { M as ModalContentWithHeader } from './ModalContentWithHeader-B7tpHFBW.js';
13
13
  import '@hh.ru/magritte-ui-icon';
14
14
  import '@hh.ru/magritte-ui-title';
15
15
  //# sourceMappingURL=ModalContentWithHeader.js.map
package/ModalHeader.js CHANGED
@@ -5,7 +5,7 @@ import classnames from 'classnames';
5
5
  import { isIconElement } from '@hh.ru/magritte-ui-icon';
6
6
  import { Title } from '@hh.ru/magritte-ui-title';
7
7
 
8
- var styles = {"content":"magritte-content___dnhh5_1-0-38","options":"magritte-options___DlTFU_1-0-38","actions":"magritte-actions___r-a0l_1-0-38","actions-with-link":"magritte-actions-with-link___y3-dV_1-0-38","actionsWithLink":"magritte-actions-with-link___y3-dV_1-0-38","content-with-image":"magritte-content-with-image___IwN4b_1-0-38","contentWithImage":"magritte-content-with-image___IwN4b_1-0-38","actions-single":"magritte-actions-single___QaDKO_1-0-38","actionsSingle":"magritte-actions-single___QaDKO_1-0-38","image-container":"magritte-image-container___2MBxK_1-0-38","imageContainer":"magritte-image-container___2MBxK_1-0-38","title-wrapper":"magritte-title-wrapper___XEFse_1-0-38","titleWrapper":"magritte-title-wrapper___XEFse_1-0-38","wrapper":"magritte-wrapper___R4t9N_1-0-38","only-actions":"magritte-only-actions___ypqS-_1-0-38","onlyActions":"magritte-only-actions___ypqS-_1-0-38"};
8
+ var styles = {"content":"magritte-content___dnhh5_1-0-39","options":"magritte-options___DlTFU_1-0-39","actions":"magritte-actions___r-a0l_1-0-39","actions-with-link":"magritte-actions-with-link___y3-dV_1-0-39","actionsWithLink":"magritte-actions-with-link___y3-dV_1-0-39","content-with-image":"magritte-content-with-image___IwN4b_1-0-39","contentWithImage":"magritte-content-with-image___IwN4b_1-0-39","actions-single":"magritte-actions-single___QaDKO_1-0-39","actionsSingle":"magritte-actions-single___QaDKO_1-0-39","image-container":"magritte-image-container___2MBxK_1-0-39","imageContainer":"magritte-image-container___2MBxK_1-0-39","title-wrapper":"magritte-title-wrapper___XEFse_1-0-39","titleWrapper":"magritte-title-wrapper___XEFse_1-0-39","wrapper":"magritte-wrapper___R4t9N_1-0-39","only-actions":"magritte-only-actions___ypqS-_1-0-39","onlyActions":"magritte-only-actions___ypqS-_1-0-39"};
9
9
 
10
10
  const ModalHeader = forwardRef(({ title, headerImageUrl, headerImage, headerHeight, titleAlignment, titleElement, titleMaxLines, titleSize, titleDescription, titleDescriptionMaxLines, titleStyle, titleDescriptionStyle, options, actions: _actions, actionLink, labelId, wrapperRef, }, ref) => {
11
11
  const actions = Array.isArray(_actions) ? _actions.slice(0, 5) : _actions;
package/index.css CHANGED
@@ -1,15 +1,15 @@
1
1
  :root{
2
- --magritte-color-component-modal-background-action-v25-1-0:#20262bad;
3
- --magritte-gradient-component-modal-background-fade-v25-1-0:#00000000 0%, #0000007a 100%;
2
+ --magritte-color-component-modal-background-action-v25-1-1:#20262bad;
3
+ --magritte-gradient-component-modal-background-fade-v25-1-1:#00000000 0%, #0000007a 100%;
4
4
  }
5
- .magritte-content___dnhh5_1-0-38{
5
+ .magritte-content___dnhh5_1-0-39{
6
6
  display:flex;
7
7
  align-items:flex-start;
8
8
  }
9
- .magritte-content___dnhh5_1-0-38 + .magritte-options___DlTFU_1-0-38{
9
+ .magritte-content___dnhh5_1-0-39 + .magritte-options___DlTFU_1-0-39{
10
10
  margin-top:24px;
11
11
  }
12
- .magritte-actions___r-a0l_1-0-38{
12
+ .magritte-actions___r-a0l_1-0-39{
13
13
  position:relative;
14
14
  z-index:1;
15
15
  display:flex;
@@ -18,10 +18,10 @@
18
18
  margin-left:auto;
19
19
  --magritte-ui-link-padding-override:9px;
20
20
  }
21
- .magritte-actions-with-link___y3-dV_1-0-38{
21
+ .magritte-actions-with-link___y3-dV_1-0-39{
22
22
  padding:0 8px 0 28px;
23
23
  }
24
- .magritte-content-with-image___IwN4b_1-0-38{
24
+ .magritte-content-with-image___IwN4b_1-0-39{
25
25
  position:relative;
26
26
  flex-direction:column;
27
27
  justify-content:flex-end;
@@ -31,61 +31,61 @@
31
31
  padding:12px 24px 24px;
32
32
  box-sizing:border-box;
33
33
  }
34
- .magritte-content-with-image___IwN4b_1-0-38 .magritte-actions___r-a0l_1-0-38{
34
+ .magritte-content-with-image___IwN4b_1-0-39 .magritte-actions___r-a0l_1-0-39{
35
35
  order:-1;
36
36
  gap:0;
37
37
  margin-right:-16px;
38
38
  margin-top:-4px;
39
39
  margin-bottom:auto;
40
40
  }
41
- .magritte-content-with-image___IwN4b_1-0-38 .magritte-actions___r-a0l_1-0-38:not(.magritte-actions-with-link___y3-dV_1-0-38){
41
+ .magritte-content-with-image___IwN4b_1-0-39 .magritte-actions___r-a0l_1-0-39:not(.magritte-actions-with-link___y3-dV_1-0-39){
42
42
  padding:0 4px;
43
- background-color:var(--magritte-color-component-modal-background-action-v25-1-0);
43
+ background-color:var(--magritte-color-component-modal-background-action-v25-1-1);
44
44
  border-radius:12px;
45
45
  }
46
- .magritte-content-with-image___IwN4b_1-0-38 .magritte-actions___r-a0l_1-0-38.magritte-actions-single___QaDKO_1-0-38:not(.magritte-actions-with-link___y3-dV_1-0-38){
46
+ .magritte-content-with-image___IwN4b_1-0-39 .magritte-actions___r-a0l_1-0-39.magritte-actions-single___QaDKO_1-0-39:not(.magritte-actions-with-link___y3-dV_1-0-39){
47
47
  padding:0;
48
48
  }
49
- .magritte-image-container___2MBxK_1-0-38{
49
+ .magritte-image-container___2MBxK_1-0-39{
50
50
  position:absolute;
51
51
  left:0;
52
52
  bottom:0;
53
53
  right:0;
54
54
  background-size:cover;
55
- --modal-header-gradient:linear-gradient(180deg, var(--magritte-gradient-component-modal-background-fade-v25-1-0));
55
+ --modal-header-gradient:linear-gradient(180deg, var(--magritte-gradient-component-modal-background-fade-v25-1-1));
56
56
  }
57
- .magritte-title-wrapper___XEFse_1-0-38{
57
+ .magritte-title-wrapper___XEFse_1-0-39{
58
58
  position:relative;
59
59
  width:100%;
60
60
  }
61
- .magritte-wrapper___R4t9N_1-0-38{
61
+ .magritte-wrapper___R4t9N_1-0-39{
62
62
  margin-bottom:24px;
63
63
  }
64
- .magritte-only-actions___ypqS-_1-0-38 .magritte-actions___r-a0l_1-0-38{
64
+ .magritte-only-actions___ypqS-_1-0-39 .magritte-actions___r-a0l_1-0-39{
65
65
  padding-left:0;
66
66
  }
67
- .magritte-only-actions___ypqS-_1-0-38 .magritte-actions-with-link___y3-dV_1-0-38{
67
+ .magritte-only-actions___ypqS-_1-0-39 .magritte-actions-with-link___y3-dV_1-0-39{
68
68
  padding-left:12px;
69
69
  }
70
70
 
71
71
  :root{
72
- --magritte-color-background-overlay-v25-1-0:#20262bad;
73
- --magritte-color-stroke-neutral-v25-1-0:#DCE3EB;
74
- --magritte-color-component-modal-background-content-v25-1-0:#ffffff;
72
+ --magritte-color-background-overlay-v25-1-1:#20262bad;
73
+ --magritte-color-stroke-neutral-v25-1-1:#DCE3EB;
74
+ --magritte-color-component-modal-background-content-v25-1-1:#ffffff;
75
75
  }
76
76
 
77
77
  :root{
78
- --magritte-semantic-animation-ease-in-out-200-timing-function-v25-1-0:cubic-bezier(0.25, 0.1, 0.25, 1);
79
- --magritte-semantic-animation-ease-in-out-200-duration-v25-1-0:200ms;
80
- --magritte-semantic-animation-ease-in-out-300-timing-function-v25-1-0:cubic-bezier(0.25, 0.1, 0.25, 1);
81
- --magritte-semantic-animation-ease-in-out-300-duration-v25-1-0:300ms;
78
+ --magritte-semantic-animation-ease-in-out-200-timing-function-v25-1-1:cubic-bezier(0.25, 0.1, 0.25, 1);
79
+ --magritte-semantic-animation-ease-in-out-200-duration-v25-1-1:200ms;
80
+ --magritte-semantic-animation-ease-in-out-300-timing-function-v25-1-1:cubic-bezier(0.25, 0.1, 0.25, 1);
81
+ --magritte-semantic-animation-ease-in-out-300-duration-v25-1-1:300ms;
82
82
  }
83
83
 
84
84
  .magritte-night-theme{
85
- --magritte-color-stroke-neutral-v25-1-0:#303030;
86
- --magritte-color-component-modal-background-content-v25-1-0:#111;
85
+ --magritte-color-stroke-neutral-v25-1-1:#303030;
86
+ --magritte-color-component-modal-background-content-v25-1-1:#111;
87
87
  }
88
- .magritte-modal-overlay___uurgp_1-0-38{
88
+ .magritte-modal-overlay___uurgp_1-0-39{
89
89
  position:fixed;
90
90
  top:0;
91
91
  right:0;
@@ -95,25 +95,25 @@
95
95
  align-items:center;
96
96
  justify-content:center;
97
97
  }
98
- .magritte-modal-overlay-with-background___mR-T0_1-0-38{
99
- background-color:var(--magritte-color-background-overlay-v25-1-0);
98
+ .magritte-modal-overlay-with-background___mR-T0_1-0-39{
99
+ background-color:var(--magritte-color-background-overlay-v25-1-1);
100
100
  transition-property:opacity, transform;
101
101
  user-select:text;
102
102
  z-index:1;
103
103
  }
104
- .magritte-modal-overlay___uurgp_1-0-38:not(.magritte-modal-overlay-with-background___mR-T0_1-0-38){
104
+ .magritte-modal-overlay___uurgp_1-0-39:not(.magritte-modal-overlay-with-background___mR-T0_1-0-39){
105
105
  pointer-events:none;
106
106
  }
107
- .magritte-modal-overlay___uurgp_1-0-38:not(.magritte-modal-overlay-with-background___mR-T0_1-0-38) .magritte-modal___2Wc4s_1-0-38{
107
+ .magritte-modal-overlay___uurgp_1-0-39:not(.magritte-modal-overlay-with-background___mR-T0_1-0-39) .magritte-modal___2Wc4s_1-0-39{
108
108
  pointer-events:auto;
109
109
  }
110
- .magritte-modal-overlay-left___qaiC9_1-0-38{
110
+ .magritte-modal-overlay-left___qaiC9_1-0-39{
111
111
  justify-content:flex-start;
112
112
  }
113
- .magritte-modal-overlay-right___-HTKs_1-0-38{
113
+ .magritte-modal-overlay-right___-HTKs_1-0-39{
114
114
  justify-content:flex-end;
115
115
  }
116
- .magritte-modal___2Wc4s_1-0-38{
116
+ .magritte-modal___2Wc4s_1-0-39{
117
117
  display:flex;
118
118
  box-sizing:border-box;
119
119
  margin:0 12px;
@@ -122,40 +122,40 @@
122
122
  max-height:calc(100% - 12px * 2);
123
123
  max-width:calc(100vw - 12px * 2);
124
124
  position:relative;
125
- background-color:var(--magritte-color-component-modal-background-content-v25-1-0);
125
+ background-color:var(--magritte-color-component-modal-background-content-v25-1-1);
126
126
  border-radius:24px;
127
127
  overflow:hidden;
128
128
  width:800px;
129
129
  transition-property:opacity, transform;
130
130
  container-type:inline-size;
131
131
  }
132
- .magritte-modal___2Wc4s_1-0-38.magritte-size-small___nSBwy_1-0-38{
132
+ .magritte-modal___2Wc4s_1-0-39.magritte-size-small___nSBwy_1-0-39{
133
133
  width:480px;
134
134
  }
135
- .magritte-modal___2Wc4s_1-0-38.magritte-size-medium___Zuz-t_1-0-38{
135
+ .magritte-modal___2Wc4s_1-0-39.magritte-size-medium___Zuz-t_1-0-39{
136
136
  width:620px;
137
137
  }
138
- .magritte-no-vertical-paddings___XgMGS_1-0-38{
138
+ .magritte-no-vertical-paddings___XgMGS_1-0-39{
139
139
  padding-top:0;
140
140
  padding-bottom:0;
141
141
  }
142
- .magritte-no-horizontal-paddings___MJDv4_1-0-38{
142
+ .magritte-no-horizontal-paddings___MJDv4_1-0-39{
143
143
  padding-left:0;
144
144
  padding-right:0;
145
145
  }
146
- .magritte-modal-full-height___UThtH_1-0-38{
146
+ .magritte-modal-full-height___UThtH_1-0-39{
147
147
  height:100%;
148
148
  }
149
- .magritte-modal-with-border___bqsql_1-0-38{
150
- outline:1px solid var(--magritte-color-stroke-neutral-v25-1-0);
149
+ .magritte-modal-with-border___bqsql_1-0-39{
150
+ outline:1px solid var(--magritte-color-stroke-neutral-v25-1-1);
151
151
  }
152
- .magritte-modal-content-wrapper___-eFo3_1-0-38{
152
+ .magritte-modal-content-wrapper___-eFo3_1-0-39{
153
153
  display:flex;
154
154
  flex-direction:column;
155
155
  min-height:0;
156
156
  flex:1 1;
157
157
  }
158
- .magritte-modal-content___KY9ma_1-0-38{
158
+ .magritte-modal-content___KY9ma_1-0-39{
159
159
  position:relative;
160
160
  display:flex;
161
161
  flex-direction:column;
@@ -166,7 +166,7 @@
166
166
  width:calc(100% + 24px);
167
167
  width:calc(100cqw + 24px);
168
168
  }
169
- .magritte-modal-scroll-container___dg8jC_1-0-38{
169
+ .magritte-modal-scroll-container___dg8jC_1-0-39{
170
170
  display:flex;
171
171
  flex-direction:column;
172
172
  flex:1 1;
@@ -177,212 +177,212 @@
177
177
  padding:0 4px;
178
178
  margin:0 -4px;
179
179
  }
180
- .magritte-modal-scroll-container___dg8jC_1-0-38::-webkit-scrollbar{
180
+ .magritte-modal-scroll-container___dg8jC_1-0-39::-webkit-scrollbar{
181
181
  display:none;
182
182
  }
183
- .magritte-modal-content-wrapper__one-line___ZkEgT_1-0-38{
183
+ .magritte-modal-content-wrapper__one-line___ZkEgT_1-0-39{
184
184
  flex-direction:row-reverse;
185
185
  }
186
- .magritte-modal-content-wrapper__one-line___ZkEgT_1-0-38 .magritte-modal-content___KY9ma_1-0-38{
186
+ .magritte-modal-content-wrapper__one-line___ZkEgT_1-0-39 .magritte-modal-content___KY9ma_1-0-39{
187
187
  width:auto;
188
188
  container-type:inline-size;
189
189
  margin-right:0;
190
190
  }
191
- .magritte-modal-content-wrapper__one-line___ZkEgT_1-0-38 .magritte-content-sticky-container___VkZxO_1-0-38{
191
+ .magritte-modal-content-wrapper__one-line___ZkEgT_1-0-39 .magritte-content-sticky-container___VkZxO_1-0-39{
192
192
  max-width:calc(100% - 16px);
193
193
  max-width:calc(100cqw - 16px);
194
194
  }
195
- .magritte-divider-container___jKyxB_1-0-38{
195
+ .magritte-divider-container___jKyxB_1-0-39{
196
196
  margin:0 -24px;
197
197
  }
198
- .magritte-divider-container___jKyxB_1-0-38.magritte-divider-container-hidden___20nI5_1-0-38{
198
+ .magritte-divider-container___jKyxB_1-0-39.magritte-divider-container-hidden___20nI5_1-0-39{
199
199
  display:none;
200
200
  }
201
- .magritte-modal-footer___TbH6x_1-0-38{
201
+ .magritte-modal-footer___TbH6x_1-0-39{
202
202
  margin:0 -24px -24px;
203
- background-color:var(--magritte-color-component-modal-background-content-v25-1-0);
203
+ background-color:var(--magritte-color-component-modal-background-content-v25-1-1);
204
204
  z-index:1;
205
- --magritte-ui-container-background-color-override:var(--magritte-color-component-modal-background-content-v25-1-0);
205
+ --magritte-ui-container-background-color-override:var(--magritte-color-component-modal-background-content-v25-1-1);
206
206
  }
207
- .magritte-modal-buttons-container___9hXUo_1-0-38{
207
+ .magritte-modal-buttons-container___9hXUo_1-0-39{
208
208
  display:flex;
209
209
  gap:12px;
210
210
  }
211
- .magritte-animation-timeout___vK6nU_1-0-38{
211
+ .magritte-animation-timeout___vK6nU_1-0-39{
212
212
  --enter-animation-duration:0;
213
213
  --exit-animation-duration:0;
214
214
  }
215
215
  @media (prefers-reduced-motion: no-preference){
216
- .magritte-animation-timeout___vK6nU_1-0-38{
217
- --enter-animation-duration:var(--magritte-semantic-animation-ease-in-out-300-duration-v25-1-0);
218
- --exit-animation-duration:var(--magritte-semantic-animation-ease-in-out-200-duration-v25-1-0);
216
+ .magritte-animation-timeout___vK6nU_1-0-39{
217
+ --enter-animation-duration:var(--magritte-semantic-animation-ease-in-out-300-duration-v25-1-1);
218
+ --exit-animation-duration:var(--magritte-semantic-animation-ease-in-out-200-duration-v25-1-1);
219
219
  }
220
220
  }
221
- .magritte-animation-enter-center___9zWOQ_1-0-38.magritte-modal-overlay-with-background___mR-T0_1-0-38{
221
+ .magritte-animation-enter-center___9zWOQ_1-0-39.magritte-modal-overlay-with-background___mR-T0_1-0-39{
222
222
  opacity:0;
223
223
  }
224
- .magritte-animation-enter-center___9zWOQ_1-0-38 .magritte-modal___2Wc4s_1-0-38{
224
+ .magritte-animation-enter-center___9zWOQ_1-0-39 .magritte-modal___2Wc4s_1-0-39{
225
225
  opacity:0;
226
226
  }
227
- .magritte-animation-enter-center-active___dfICf_1-0-38{
227
+ .magritte-animation-enter-center-active___dfICf_1-0-39{
228
228
  --enter-animation-duration:0;
229
229
  --exit-animation-duration:0;
230
230
  }
231
231
  @media (prefers-reduced-motion: no-preference){
232
- .magritte-animation-enter-center-active___dfICf_1-0-38{
233
- --enter-animation-duration:var(--magritte-semantic-animation-ease-in-out-300-duration-v25-1-0);
234
- --exit-animation-duration:var(--magritte-semantic-animation-ease-in-out-200-duration-v25-1-0);
232
+ .magritte-animation-enter-center-active___dfICf_1-0-39{
233
+ --enter-animation-duration:var(--magritte-semantic-animation-ease-in-out-300-duration-v25-1-1);
234
+ --exit-animation-duration:var(--magritte-semantic-animation-ease-in-out-200-duration-v25-1-1);
235
235
  }
236
236
  }
237
- .magritte-animation-enter-center-active___dfICf_1-0-38 .magritte-modal___2Wc4s_1-0-38,
238
- .magritte-animation-enter-center-active___dfICf_1-0-38.magritte-modal-overlay-with-background___mR-T0_1-0-38{
237
+ .magritte-animation-enter-center-active___dfICf_1-0-39 .magritte-modal___2Wc4s_1-0-39,
238
+ .magritte-animation-enter-center-active___dfICf_1-0-39.magritte-modal-overlay-with-background___mR-T0_1-0-39{
239
239
  opacity:1;
240
240
  transition-duration:var(--enter-animation-duration);
241
- transition-timing-function:var(--magritte-semantic-animation-ease-in-out-300-timing-function-v25-1-0);
241
+ transition-timing-function:var(--magritte-semantic-animation-ease-in-out-300-timing-function-v25-1-1);
242
242
  }
243
- .magritte-animation-exit-center___mrTCE_1-0-38.magritte-modal-overlay-with-background___mR-T0_1-0-38{
243
+ .magritte-animation-exit-center___mrTCE_1-0-39.magritte-modal-overlay-with-background___mR-T0_1-0-39{
244
244
  opacity:1;
245
245
  }
246
- .magritte-animation-exit-center___mrTCE_1-0-38 .magritte-modal___2Wc4s_1-0-38{
246
+ .magritte-animation-exit-center___mrTCE_1-0-39 .magritte-modal___2Wc4s_1-0-39{
247
247
  opacity:1;
248
248
  }
249
- .magritte-animation-exit-center-active___WZXYp_1-0-38{
249
+ .magritte-animation-exit-center-active___WZXYp_1-0-39{
250
250
  --enter-animation-duration:0;
251
251
  --exit-animation-duration:0;
252
252
  }
253
253
  @media (prefers-reduced-motion: no-preference){
254
- .magritte-animation-exit-center-active___WZXYp_1-0-38{
255
- --enter-animation-duration:var(--magritte-semantic-animation-ease-in-out-300-duration-v25-1-0);
256
- --exit-animation-duration:var(--magritte-semantic-animation-ease-in-out-200-duration-v25-1-0);
254
+ .magritte-animation-exit-center-active___WZXYp_1-0-39{
255
+ --enter-animation-duration:var(--magritte-semantic-animation-ease-in-out-300-duration-v25-1-1);
256
+ --exit-animation-duration:var(--magritte-semantic-animation-ease-in-out-200-duration-v25-1-1);
257
257
  }
258
258
  }
259
- .magritte-animation-exit-center-active___WZXYp_1-0-38.magritte-modal-overlay-with-background___mR-T0_1-0-38{
259
+ .magritte-animation-exit-center-active___WZXYp_1-0-39.magritte-modal-overlay-with-background___mR-T0_1-0-39{
260
260
  opacity:0;
261
261
  }
262
- .magritte-animation-exit-center-active___WZXYp_1-0-38 .magritte-modal___2Wc4s_1-0-38{
262
+ .magritte-animation-exit-center-active___WZXYp_1-0-39 .magritte-modal___2Wc4s_1-0-39{
263
263
  opacity:0;
264
264
  }
265
- .magritte-animation-exit-center-active___WZXYp_1-0-38 .magritte-modal___2Wc4s_1-0-38,
266
- .magritte-animation-exit-center-active___WZXYp_1-0-38.magritte-modal-overlay-with-background___mR-T0_1-0-38{
265
+ .magritte-animation-exit-center-active___WZXYp_1-0-39 .magritte-modal___2Wc4s_1-0-39,
266
+ .magritte-animation-exit-center-active___WZXYp_1-0-39.magritte-modal-overlay-with-background___mR-T0_1-0-39{
267
267
  transition-duration:var(--exit-animation-duration);
268
- transition-timing-function:var(--magritte-semantic-animation-ease-in-out-200-timing-function-v25-1-0);
268
+ transition-timing-function:var(--magritte-semantic-animation-ease-in-out-200-timing-function-v25-1-1);
269
269
  }
270
- .magritte-animation-enter-left___XiXzr_1-0-38.magritte-modal-overlay-with-background___mR-T0_1-0-38{
270
+ .magritte-animation-enter-left___XiXzr_1-0-39.magritte-modal-overlay-with-background___mR-T0_1-0-39{
271
271
  opacity:0;
272
272
  }
273
- .magritte-animation-enter-left___XiXzr_1-0-38 .magritte-modal___2Wc4s_1-0-38{
273
+ .magritte-animation-enter-left___XiXzr_1-0-39 .magritte-modal___2Wc4s_1-0-39{
274
274
  opacity:0;
275
275
  transform:translateX(-100%);
276
276
  }
277
- .magritte-animation-enter-left-active___4Uaz6_1-0-38{
277
+ .magritte-animation-enter-left-active___4Uaz6_1-0-39{
278
278
  --enter-animation-duration:0;
279
279
  --exit-animation-duration:0;
280
280
  }
281
281
  @media (prefers-reduced-motion: no-preference){
282
- .magritte-animation-enter-left-active___4Uaz6_1-0-38{
283
- --enter-animation-duration:var(--magritte-semantic-animation-ease-in-out-300-duration-v25-1-0);
284
- --exit-animation-duration:var(--magritte-semantic-animation-ease-in-out-200-duration-v25-1-0);
282
+ .magritte-animation-enter-left-active___4Uaz6_1-0-39{
283
+ --enter-animation-duration:var(--magritte-semantic-animation-ease-in-out-300-duration-v25-1-1);
284
+ --exit-animation-duration:var(--magritte-semantic-animation-ease-in-out-200-duration-v25-1-1);
285
285
  }
286
286
  }
287
- .magritte-animation-enter-left-active___4Uaz6_1-0-38 .magritte-modal___2Wc4s_1-0-38,
288
- .magritte-animation-enter-left-active___4Uaz6_1-0-38.magritte-modal-overlay-with-background___mR-T0_1-0-38{
287
+ .magritte-animation-enter-left-active___4Uaz6_1-0-39 .magritte-modal___2Wc4s_1-0-39,
288
+ .magritte-animation-enter-left-active___4Uaz6_1-0-39.magritte-modal-overlay-with-background___mR-T0_1-0-39{
289
289
  opacity:1;
290
290
  transition-duration:var(--enter-animation-duration);
291
- transition-timing-function:var(--magritte-semantic-animation-ease-in-out-300-timing-function-v25-1-0);
291
+ transition-timing-function:var(--magritte-semantic-animation-ease-in-out-300-timing-function-v25-1-1);
292
292
  transform:translateX(0);
293
293
  }
294
- .magritte-animation-exit-left___NHvvO_1-0-38.magritte-modal-overlay-with-background___mR-T0_1-0-38{
294
+ .magritte-animation-exit-left___NHvvO_1-0-39.magritte-modal-overlay-with-background___mR-T0_1-0-39{
295
295
  opacity:1;
296
296
  }
297
- .magritte-animation-exit-left___NHvvO_1-0-38 .magritte-modal___2Wc4s_1-0-38{
297
+ .magritte-animation-exit-left___NHvvO_1-0-39 .magritte-modal___2Wc4s_1-0-39{
298
298
  opacity:1;
299
299
  transform:translateX(0);
300
300
  }
301
- .magritte-animation-exit-left-active___oDszE_1-0-38{
301
+ .magritte-animation-exit-left-active___oDszE_1-0-39{
302
302
  --enter-animation-duration:0;
303
303
  --exit-animation-duration:0;
304
304
  }
305
305
  @media (prefers-reduced-motion: no-preference){
306
- .magritte-animation-exit-left-active___oDszE_1-0-38{
307
- --enter-animation-duration:var(--magritte-semantic-animation-ease-in-out-300-duration-v25-1-0);
308
- --exit-animation-duration:var(--magritte-semantic-animation-ease-in-out-200-duration-v25-1-0);
306
+ .magritte-animation-exit-left-active___oDszE_1-0-39{
307
+ --enter-animation-duration:var(--magritte-semantic-animation-ease-in-out-300-duration-v25-1-1);
308
+ --exit-animation-duration:var(--magritte-semantic-animation-ease-in-out-200-duration-v25-1-1);
309
309
  }
310
310
  }
311
- .magritte-animation-exit-left-active___oDszE_1-0-38.magritte-modal-overlay-with-background___mR-T0_1-0-38{
311
+ .magritte-animation-exit-left-active___oDszE_1-0-39.magritte-modal-overlay-with-background___mR-T0_1-0-39{
312
312
  opacity:0;
313
313
  }
314
- .magritte-animation-exit-left-active___oDszE_1-0-38 .magritte-modal___2Wc4s_1-0-38{
314
+ .magritte-animation-exit-left-active___oDszE_1-0-39 .magritte-modal___2Wc4s_1-0-39{
315
315
  opacity:0;
316
316
  transform:translateX(-100%);
317
317
  }
318
- .magritte-animation-exit-left-active___oDszE_1-0-38 .magritte-modal___2Wc4s_1-0-38,
319
- .magritte-animation-exit-left-active___oDszE_1-0-38.magritte-modal-overlay-with-background___mR-T0_1-0-38{
318
+ .magritte-animation-exit-left-active___oDszE_1-0-39 .magritte-modal___2Wc4s_1-0-39,
319
+ .magritte-animation-exit-left-active___oDszE_1-0-39.magritte-modal-overlay-with-background___mR-T0_1-0-39{
320
320
  transition-duration:var(--exit-animation-duration);
321
- transition-timing-function:var(--magritte-semantic-animation-ease-in-out-200-timing-function-v25-1-0);
321
+ transition-timing-function:var(--magritte-semantic-animation-ease-in-out-200-timing-function-v25-1-1);
322
322
  }
323
- .magritte-animation-enter-right___1bqPX_1-0-38.magritte-modal-overlay-with-background___mR-T0_1-0-38{
323
+ .magritte-animation-enter-right___1bqPX_1-0-39.magritte-modal-overlay-with-background___mR-T0_1-0-39{
324
324
  opacity:0;
325
325
  }
326
- .magritte-animation-enter-right___1bqPX_1-0-38 .magritte-modal___2Wc4s_1-0-38{
326
+ .magritte-animation-enter-right___1bqPX_1-0-39 .magritte-modal___2Wc4s_1-0-39{
327
327
  opacity:0;
328
328
  transform:translateX(100%);
329
329
  }
330
- .magritte-animation-enter-right-active___OR65U_1-0-38{
330
+ .magritte-animation-enter-right-active___OR65U_1-0-39{
331
331
  --enter-animation-duration:0;
332
332
  --exit-animation-duration:0;
333
333
  }
334
334
  @media (prefers-reduced-motion: no-preference){
335
- .magritte-animation-enter-right-active___OR65U_1-0-38{
336
- --enter-animation-duration:var(--magritte-semantic-animation-ease-in-out-300-duration-v25-1-0);
337
- --exit-animation-duration:var(--magritte-semantic-animation-ease-in-out-200-duration-v25-1-0);
335
+ .magritte-animation-enter-right-active___OR65U_1-0-39{
336
+ --enter-animation-duration:var(--magritte-semantic-animation-ease-in-out-300-duration-v25-1-1);
337
+ --exit-animation-duration:var(--magritte-semantic-animation-ease-in-out-200-duration-v25-1-1);
338
338
  }
339
339
  }
340
- .magritte-animation-enter-right-active___OR65U_1-0-38 .magritte-modal___2Wc4s_1-0-38,
341
- .magritte-animation-enter-right-active___OR65U_1-0-38.magritte-modal-overlay-with-background___mR-T0_1-0-38{
340
+ .magritte-animation-enter-right-active___OR65U_1-0-39 .magritte-modal___2Wc4s_1-0-39,
341
+ .magritte-animation-enter-right-active___OR65U_1-0-39.magritte-modal-overlay-with-background___mR-T0_1-0-39{
342
342
  opacity:1;
343
343
  transition-duration:var(--enter-animation-duration);
344
- transition-timing-function:var(--magritte-semantic-animation-ease-in-out-300-timing-function-v25-1-0);
344
+ transition-timing-function:var(--magritte-semantic-animation-ease-in-out-300-timing-function-v25-1-1);
345
345
  transform:translateX(0);
346
346
  }
347
- .magritte-animation-exit-right___hyYBh_1-0-38.magritte-modal-overlay-with-background___mR-T0_1-0-38{
347
+ .magritte-animation-exit-right___hyYBh_1-0-39.magritte-modal-overlay-with-background___mR-T0_1-0-39{
348
348
  opacity:1;
349
349
  }
350
- .magritte-animation-exit-right___hyYBh_1-0-38 .magritte-modal___2Wc4s_1-0-38{
350
+ .magritte-animation-exit-right___hyYBh_1-0-39 .magritte-modal___2Wc4s_1-0-39{
351
351
  opacity:1;
352
352
  transform:translateX(0);
353
353
  }
354
- .magritte-animation-exit-right-active___ft6Lz_1-0-38{
354
+ .magritte-animation-exit-right-active___ft6Lz_1-0-39{
355
355
  --enter-animation-duration:0;
356
356
  --exit-animation-duration:0;
357
357
  }
358
358
  @media (prefers-reduced-motion: no-preference){
359
- .magritte-animation-exit-right-active___ft6Lz_1-0-38{
360
- --enter-animation-duration:var(--magritte-semantic-animation-ease-in-out-300-duration-v25-1-0);
361
- --exit-animation-duration:var(--magritte-semantic-animation-ease-in-out-200-duration-v25-1-0);
359
+ .magritte-animation-exit-right-active___ft6Lz_1-0-39{
360
+ --enter-animation-duration:var(--magritte-semantic-animation-ease-in-out-300-duration-v25-1-1);
361
+ --exit-animation-duration:var(--magritte-semantic-animation-ease-in-out-200-duration-v25-1-1);
362
362
  }
363
363
  }
364
- .magritte-animation-exit-right-active___ft6Lz_1-0-38.magritte-modal-overlay-with-background___mR-T0_1-0-38{
364
+ .magritte-animation-exit-right-active___ft6Lz_1-0-39.magritte-modal-overlay-with-background___mR-T0_1-0-39{
365
365
  opacity:0;
366
366
  }
367
- .magritte-animation-exit-right-active___ft6Lz_1-0-38 .magritte-modal___2Wc4s_1-0-38{
367
+ .magritte-animation-exit-right-active___ft6Lz_1-0-39 .magritte-modal___2Wc4s_1-0-39{
368
368
  opacity:0;
369
369
  transform:translateX(100%);
370
370
  }
371
- .magritte-animation-exit-right-active___ft6Lz_1-0-38 .magritte-modal___2Wc4s_1-0-38,
372
- .magritte-animation-exit-right-active___ft6Lz_1-0-38.magritte-modal-overlay-with-background___mR-T0_1-0-38{
371
+ .magritte-animation-exit-right-active___ft6Lz_1-0-39 .magritte-modal___2Wc4s_1-0-39,
372
+ .magritte-animation-exit-right-active___ft6Lz_1-0-39.magritte-modal-overlay-with-background___mR-T0_1-0-39{
373
373
  transition-duration:var(--exit-animation-duration);
374
- transition-timing-function:var(--magritte-semantic-animation-ease-in-out-200-timing-function-v25-1-0);
374
+ transition-timing-function:var(--magritte-semantic-animation-ease-in-out-200-timing-function-v25-1-1);
375
375
  }
376
- .magritte-space-preserver___nz3Nw_1-0-38{
376
+ .magritte-space-preserver___nz3Nw_1-0-39{
377
377
  flex:0 0 auto;
378
378
  }
379
- .magritte-tree-selector-container___XZh1C_1-0-38{
379
+ .magritte-tree-selector-container___XZh1C_1-0-39{
380
380
  height:100%;
381
381
  max-width:calc(100% - 24px);
382
382
  max-width:100cqw;
383
383
  --magritte-ui-scrollbar-offset-right:-24px;
384
384
  }
385
- .magritte-content-sticky-container___VkZxO_1-0-38{
385
+ .magritte-content-sticky-container___VkZxO_1-0-39{
386
386
  display:flex;
387
387
  flex-direction:column;
388
388
  position:sticky;
@@ -392,6 +392,6 @@
392
392
  max-width:calc(100% - 24px);
393
393
  max-width:100cqw;
394
394
  }
395
- .magritte-grow-limiter___SPuoT_1-0-38{
395
+ .magritte-grow-limiter___SPuoT_1-0-39{
396
396
  flex:1 0;
397
397
  }
package/index.js CHANGED
@@ -14,7 +14,7 @@ import '@hh.ru/magritte-common-use-no-bubbling';
14
14
  import '@hh.ru/magritte-ui-action-bar';
15
15
  import '@hh.ru/magritte-ui-breakpoint';
16
16
  import '@hh.ru/magritte-ui-layer';
17
- import './ModalContentWithHeader-Cmr-Wfi6.js';
17
+ import './ModalContentWithHeader-B7tpHFBW.js';
18
18
  import '@hh.ru/magritte-common-func-utils';
19
19
  import '@hh.ru/magritte-ui-content-overlay';
20
20
  import '@hh.ru/magritte-ui-divider';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hh.ru/magritte-ui-modal-deprecated",
3
- "version": "1.0.38",
3
+ "version": "1.0.39",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "sideEffects": [
@@ -12,36 +12,36 @@
12
12
  "prepack": "yarn root:prepack $(pwd)",
13
13
  "postpublish": "yarn root:postpublish $(pwd)",
14
14
  "stylelint-check": "yarn root:stylelint-check $(pwd)",
15
- "eslint-check": "yarn root:eslint-check $(pwd)",
15
+ "lint-check": "yarn root:lint-check $(pwd)",
16
16
  "ts-config": "yarn root:ts-config $(pwd)",
17
17
  "ts-check": "yarn root:ts-check $(pwd)",
18
18
  "test": "yarn root:test $(pwd)",
19
19
  "watch": "yarn root:watch $(pwd)"
20
20
  },
21
21
  "dependencies": {
22
- "@hh.ru/magritte-common-dom-storage": "1.0.9",
23
- "@hh.ru/magritte-common-func-utils": "1.3.15",
24
- "@hh.ru/magritte-common-is-server-env": "1.0.8",
25
- "@hh.ru/magritte-common-keyboard": "4.3.5",
26
- "@hh.ru/magritte-common-modal-helper": "1.3.4",
27
- "@hh.ru/magritte-common-mouse": "1.2.0",
28
- "@hh.ru/magritte-common-use-multiple-refs": "1.1.11",
29
- "@hh.ru/magritte-common-use-no-bubbling": "1.0.8",
30
- "@hh.ru/magritte-design-tokens": "25.1.0",
31
- "@hh.ru/magritte-internal-layer-name": "3.4.1",
32
- "@hh.ru/magritte-ui-action-bar": "5.4.22",
33
- "@hh.ru/magritte-ui-breakpoint": "6.1.1",
34
- "@hh.ru/magritte-ui-content-overlay": "1.2.1",
35
- "@hh.ru/magritte-ui-divider": "3.2.9",
36
- "@hh.ru/magritte-ui-icon": "15.1.2",
37
- "@hh.ru/magritte-ui-layer": "3.2.7",
38
- "@hh.ru/magritte-ui-mock-component": "1.1.7",
39
- "@hh.ru/magritte-ui-progress-bar": "5.0.34",
40
- "@hh.ru/magritte-ui-scrollbar": "1.0.36",
41
- "@hh.ru/magritte-ui-textarea": "3.3.52",
42
- "@hh.ru/magritte-ui-theme-wrapper": "1.1.26",
43
- "@hh.ru/magritte-ui-title": "8.3.11",
44
- "@hh.ru/magritte-ui-tree-selector": "5.5.78"
22
+ "@hh.ru/magritte-common-dom-storage": "1.0.10",
23
+ "@hh.ru/magritte-common-func-utils": "1.3.16",
24
+ "@hh.ru/magritte-common-is-server-env": "1.0.9",
25
+ "@hh.ru/magritte-common-keyboard": "4.3.6",
26
+ "@hh.ru/magritte-common-modal-helper": "1.3.5",
27
+ "@hh.ru/magritte-common-mouse": "1.2.1",
28
+ "@hh.ru/magritte-common-use-multiple-refs": "1.1.12",
29
+ "@hh.ru/magritte-common-use-no-bubbling": "1.0.9",
30
+ "@hh.ru/magritte-design-tokens": "25.1.1",
31
+ "@hh.ru/magritte-internal-layer-name": "3.4.2",
32
+ "@hh.ru/magritte-ui-action-bar": "5.4.23",
33
+ "@hh.ru/magritte-ui-breakpoint": "6.1.2",
34
+ "@hh.ru/magritte-ui-content-overlay": "1.2.2",
35
+ "@hh.ru/magritte-ui-divider": "3.2.10",
36
+ "@hh.ru/magritte-ui-icon": "15.1.3",
37
+ "@hh.ru/magritte-ui-layer": "3.2.8",
38
+ "@hh.ru/magritte-ui-mock-component": "1.1.8",
39
+ "@hh.ru/magritte-ui-progress-bar": "5.0.35",
40
+ "@hh.ru/magritte-ui-scrollbar": "1.0.37",
41
+ "@hh.ru/magritte-ui-textarea": "3.3.53",
42
+ "@hh.ru/magritte-ui-theme-wrapper": "1.1.27",
43
+ "@hh.ru/magritte-ui-title": "8.3.12",
44
+ "@hh.ru/magritte-ui-tree-selector": "5.5.79"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "classnames": ">=2.3.2",
@@ -52,5 +52,5 @@
52
52
  "publishConfig": {
53
53
  "access": "public"
54
54
  },
55
- "gitHead": "4420819c71c2d263ef47b3208c47942e9f0a1d30"
55
+ "gitHead": "46d606980abbb523a41afba452c0a852ee902864"
56
56
  }
package/useModalOrder.js CHANGED
@@ -65,7 +65,7 @@ const useModalOrder = (visible, modalRef) => {
65
65
  useLayoutEffect(() => {
66
66
  counter.updateVisiblility(id, visible);
67
67
  counter.notifyAll();
68
- // eslint-disable-next-line disable-autofix/react-hooks/exhaustive-deps
68
+ // eslint-disable-next-line react-hooks/exhaustive-deps
69
69
  }, [visible]);
70
70
  useEffect(() => {
71
71
  counter.subscribe(id, setPosition);
@@ -75,7 +75,7 @@ const useModalOrder = (visible, modalRef) => {
75
75
  counter.updateVisiblility(id, false);
76
76
  counter.notifyAll();
77
77
  };
78
- // eslint-disable-next-line disable-autofix/react-hooks/exhaustive-deps
78
+ // eslint-disable-next-line react-hooks/exhaustive-deps
79
79
  }, [id]);
80
80
  useLayoutEffect(() => {
81
81
  // Если это самый "верхний" модал передаем туда фокус
@@ -1 +1 @@
1
- {"version":3,"file":"useModalOrder.js","sources":["src/useModalOrder.ts"],"sourcesContent":["import { RefObject, useEffect, useLayoutEffect, useState } from 'react';\n\nimport { storeValueInDom, getValueFromDom, useDomStoredUniqueId } from '@hh.ru/magritte-common-dom-storage';\n\ntype NotifyCallbackArg = { position: number; count: number };\n\ntype Subscribers = Record<string, (position: NotifyCallbackArg) => void>;\ntype VisibilityMap = Record<string, boolean>;\ntype PositionMap = Record<string, number>;\n\ntype ModalCounterState = {\n prevVisiblility: VisibilityMap;\n positions: PositionMap;\n subscribers: Subscribers;\n count: number;\n};\n\nconst STORAGE_NAME = '_MAGRITTE_MODAL_COUNTER_';\n\nconst getState = (): ModalCounterState => {\n const state = getValueFromDom<ModalCounterState>(STORAGE_NAME);\n if (state === undefined) {\n return {\n prevVisiblility: {},\n positions: {},\n subscribers: {},\n count: 0,\n };\n }\n return state;\n};\n\nconst storeState = (state: ModalCounterState): void => {\n storeValueInDom(STORAGE_NAME, state);\n};\n\nconst counterFactory = () => {\n return {\n updateVisiblility: (id: string, visible: boolean) => {\n // eslint-disable-next-line prefer-const\n const state = getState();\n const prevVisible = !!state.prevVisiblility[id];\n if (visible === prevVisible) {\n return;\n }\n state.prevVisiblility[id] = visible;\n if (visible) {\n state.count += 1;\n state.positions[id] = state.count;\n } else {\n state.count -= 1;\n const currentPosition = state.positions[id];\n state.positions[id] = 0;\n Object.entries(state.positions).forEach(([key, value]) => {\n state.positions[key] = value > currentPosition ? value - 1 : value;\n });\n }\n storeState(state);\n },\n subscribe: (id: string, callback: (position: NotifyCallbackArg) => void) => {\n const state = getState();\n state.subscribers[id] = callback;\n storeState(state);\n },\n unsubscribe: (id: string) => {\n const state = getState();\n delete state.subscribers[id];\n storeState(state);\n },\n notifyAll: () => {\n const { subscribers, count, positions } = getState();\n Object.entries(subscribers).forEach(([id, callback]) => callback({ position: positions[id], count }));\n },\n };\n};\n\nconst counter = counterFactory();\n\nexport const useModalOrder = (visible: boolean, modalRef: RefObject<HTMLDivElement>): [number, number] => {\n const [position, setPosition] = useState<{ position: number; count: number }>({ position: 0, count: 0 });\n const id = useDomStoredUniqueId();\n\n useLayoutEffect(() => {\n counter.updateVisiblility(id, visible);\n counter.notifyAll();\n // eslint-disable-next-line disable-autofix/react-hooks/exhaustive-deps\n }, [visible]);\n\n useEffect(() => {\n counter.subscribe(id, setPosition);\n counter.updateVisiblility(id, visible);\n return () => {\n counter.unsubscribe(id);\n counter.updateVisiblility(id, false);\n counter.notifyAll();\n };\n // eslint-disable-next-line disable-autofix/react-hooks/exhaustive-deps\n }, [id]);\n\n useLayoutEffect(() => {\n // Если это самый \"верхний\" модал передаем туда фокус\n if (\n position.position === position.count &&\n position.count > 0 &&\n !modalRef.current?.contains(document.activeElement)\n ) {\n modalRef.current?.focus();\n }\n }, [position, modalRef]);\n\n return [position.position, position.count];\n};\n"],"names":[],"mappings":";;;AAiBA,MAAM,YAAY,GAAG,0BAA0B,CAAC;AAEhD,MAAM,QAAQ,GAAG,MAAwB;AACrC,IAAA,MAAM,KAAK,GAAG,eAAe,CAAoB,YAAY,CAAC,CAAC;AAC/D,IAAA,IAAI,KAAK,KAAK,SAAS,EAAE;QACrB,OAAO;AACH,YAAA,eAAe,EAAE,EAAE;AACnB,YAAA,SAAS,EAAE,EAAE;AACb,YAAA,WAAW,EAAE,EAAE;AACf,YAAA,KAAK,EAAE,CAAC;SACX,CAAC;KACL;AACD,IAAA,OAAO,KAAK,CAAC;AACjB,CAAC,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,KAAwB,KAAU;AAClD,IAAA,eAAe,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;AACzC,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,MAAK;IACxB,OAAO;AACH,QAAA,iBAAiB,EAAE,CAAC,EAAU,EAAE,OAAgB,KAAI;;AAEhD,YAAA,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;YACzB,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;AAChD,YAAA,IAAI,OAAO,KAAK,WAAW,EAAE;gBACzB,OAAO;aACV;AACD,YAAA,KAAK,CAAC,eAAe,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC;YACpC,IAAI,OAAO,EAAE;AACT,gBAAA,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC;gBACjB,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC;aACrC;iBAAM;AACH,gBAAA,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC;gBACjB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;;;;"}
1
+ {"version":3,"file":"useModalOrder.js","sources":["src/useModalOrder.ts"],"sourcesContent":["import { RefObject, useEffect, useLayoutEffect, useState } from 'react';\n\nimport { storeValueInDom, getValueFromDom, useDomStoredUniqueId } from '@hh.ru/magritte-common-dom-storage';\n\ntype NotifyCallbackArg = { position: number; count: number };\n\ntype Subscribers = Record<string, (position: NotifyCallbackArg) => void>;\ntype VisibilityMap = Record<string, boolean>;\ntype PositionMap = Record<string, number>;\n\ntype ModalCounterState = {\n prevVisiblility: VisibilityMap;\n positions: PositionMap;\n subscribers: Subscribers;\n count: number;\n};\n\nconst STORAGE_NAME = '_MAGRITTE_MODAL_COUNTER_';\n\nconst getState = (): ModalCounterState => {\n const state = getValueFromDom<ModalCounterState>(STORAGE_NAME);\n if (state === undefined) {\n return {\n prevVisiblility: {},\n positions: {},\n subscribers: {},\n count: 0,\n };\n }\n return state;\n};\n\nconst storeState = (state: ModalCounterState): void => {\n storeValueInDom(STORAGE_NAME, state);\n};\n\nconst counterFactory = () => {\n return {\n updateVisiblility: (id: string, visible: boolean) => {\n // eslint-disable-next-line prefer-const\n const state = getState();\n const prevVisible = !!state.prevVisiblility[id];\n if (visible === prevVisible) {\n return;\n }\n state.prevVisiblility[id] = visible;\n if (visible) {\n state.count += 1;\n state.positions[id] = state.count;\n } else {\n state.count -= 1;\n const currentPosition = state.positions[id];\n state.positions[id] = 0;\n Object.entries(state.positions).forEach(([key, value]) => {\n state.positions[key] = value > currentPosition ? value - 1 : value;\n });\n }\n storeState(state);\n },\n subscribe: (id: string, callback: (position: NotifyCallbackArg) => void) => {\n const state = getState();\n state.subscribers[id] = callback;\n storeState(state);\n },\n unsubscribe: (id: string) => {\n const state = getState();\n delete state.subscribers[id];\n storeState(state);\n },\n notifyAll: () => {\n const { subscribers, count, positions } = getState();\n Object.entries(subscribers).forEach(([id, callback]) => callback({ position: positions[id], count }));\n },\n };\n};\n\nconst counter = counterFactory();\n\nexport const useModalOrder = (visible: boolean, modalRef: RefObject<HTMLDivElement>): [number, number] => {\n const [position, setPosition] = useState<{ position: number; count: number }>({ position: 0, count: 0 });\n const id = useDomStoredUniqueId();\n\n useLayoutEffect(() => {\n counter.updateVisiblility(id, visible);\n counter.notifyAll();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [visible]);\n\n useEffect(() => {\n counter.subscribe(id, setPosition);\n counter.updateVisiblility(id, visible);\n return () => {\n counter.unsubscribe(id);\n counter.updateVisiblility(id, false);\n counter.notifyAll();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [id]);\n\n useLayoutEffect(() => {\n // Если это самый \"верхний\" модал передаем туда фокус\n if (\n position.position === position.count &&\n position.count > 0 &&\n !modalRef.current?.contains(document.activeElement)\n ) {\n modalRef.current?.focus();\n }\n }, [position, modalRef]);\n\n return [position.position, position.count];\n};\n"],"names":[],"mappings":";;;AAiBA,MAAM,YAAY,GAAG,0BAA0B,CAAC;AAEhD,MAAM,QAAQ,GAAG,MAAwB;AACrC,IAAA,MAAM,KAAK,GAAG,eAAe,CAAoB,YAAY,CAAC,CAAC;AAC/D,IAAA,IAAI,KAAK,KAAK,SAAS,EAAE;QACrB,OAAO;AACH,YAAA,eAAe,EAAE,EAAE;AACnB,YAAA,SAAS,EAAE,EAAE;AACb,YAAA,WAAW,EAAE,EAAE;AACf,YAAA,KAAK,EAAE,CAAC;SACX,CAAC;KACL;AACD,IAAA,OAAO,KAAK,CAAC;AACjB,CAAC,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,KAAwB,KAAU;AAClD,IAAA,eAAe,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;AACzC,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,MAAK;IACxB,OAAO;AACH,QAAA,iBAAiB,EAAE,CAAC,EAAU,EAAE,OAAgB,KAAI;;AAEhD,YAAA,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;YACzB,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,E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