@hh.ru/magritte-ui-modal 9.3.4 → 9.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Modal.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  import { HTMLAttributes } from 'react';
2
- export declare const Modal: import("react").ForwardRefExoticComponent<import("@hh.ru/magritte-ui-modal/types").ModalBaseProps & import("@hh.ru/magritte-ui-modal/types").ModalHeaderBaseProps & import("@hh.ru/magritte-ui-modal/types").ModalHeaderAdditionalProps & Omit<HTMLAttributes<HTMLDivElement>, keyof import("@hh.ru/magritte-ui-modal/types").ModalHeaderBaseProps | keyof import("@hh.ru/magritte-ui-modal/types").ModalHeaderAdditionalProps | "className" | "role" | keyof import("@hh.ru/magritte-ui-modal/types").ModalBaseProps | "tabindex" | "aria-labeledby"> & import("react").RefAttributes<HTMLDivElement>>;
2
+ import { ModalHeaderProps } from '@hh.ru/magritte-ui-modal/types';
3
+ export declare const Modal: import("react").ForwardRefExoticComponent<import("@hh.ru/magritte-ui-modal/types").ModalBaseProps & ModalHeaderProps & Omit<HTMLAttributes<HTMLDivElement>, keyof ModalHeaderProps | "className" | "role" | keyof import("@hh.ru/magritte-ui-modal/types").ModalBaseProps | "tabindex" | "aria-labeledby"> & import("react").RefAttributes<HTMLDivElement>>;
package/Modal.js CHANGED
@@ -12,7 +12,7 @@ import { useNoBubbling } from '@hh.ru/magritte-common-use-no-bubbling';
12
12
  import { isActionBarComponent } from '@hh.ru/magritte-ui-action-bar';
13
13
  import { Breakpoint, useBreakpoint } from '@hh.ru/magritte-ui-breakpoint';
14
14
  import { Layer } from '@hh.ru/magritte-ui-layer';
15
- import { s as styles, M as ModalContentWithHeader } from './ModalContentWithHeader-BgN1dYE-.js';
15
+ import { s as styles, M as ModalContentWithHeader } from './ModalContentWithHeader-_Kk54Y7Z.js';
16
16
  import { useModalOrder } from './useModalOrder.js';
17
17
  import { isProgressBarComponent } from '@hh.ru/magritte-ui-progress-bar';
18
18
  import { isValidTreeSelectorWrapper } from '@hh.ru/magritte-ui-tree-selector';
@@ -27,6 +27,7 @@ import '@hh.ru/magritte-ui-textarea';
27
27
  import '@hh.ru/magritte-common-dom-storage';
28
28
 
29
29
  const DEFAULT_ACTION_BAR_PADDING = 24;
30
+ const DEFAULT_PAGE_HEADER_PADDING = 72;
30
31
  const noop = () => undefined;
31
32
  const toNumber = (value) => {
32
33
  const result = parseInt(value, 10);
@@ -59,7 +60,7 @@ const CSS_CLASSES = {
59
60
  },
60
61
  };
61
62
  const INVISIBLE_FOR_BREAKPOINTS = [Breakpoint.XS, Breakpoint.S];
62
- const Modal = forwardRef(({ visible, size = 'medium', title, titleAlignment = 'left', titleSize = 'large', titleMaxLines, titleElement = 'h2', titleDescription, titleDescriptionMaxLines, titleStyle, titleDescriptionStyle, children, onClose = noop, headerImageUrl, headerImage, headerHeight, host, options, actions, actionLink, footer, disableVerticalPaddings = false, disableHorizontalPaddings = false, closeByClickOutside = true, onAppear, onBeforeExit, onAfterExit, position = 'center', height = position === 'center' ? 'content' : 'full-screen', minHeight, ...rest }, ref) => {
63
+ const Modal = forwardRef(({ visible, size = 'medium', title, titleAlignment = 'left', titleSize = 'large', titleMaxLines, titleElement = 'h2', titleDescription, titleDescriptionMaxLines, titleStyle, titleDescriptionStyle, children, onClose = noop, headerImageUrl, headerImage, headerHeight, host, options, actions, actionLink, footer, disableVerticalPaddings = false, disableHorizontalPaddings = false, closeByClickOutside = true, onAppear, onBeforeExit, onAfterExit, position = 'center', height = position === 'center' ? 'content' : 'full-screen', minHeight, showOverlay: _showOverlay = true, pageHeaderPadding = DEFAULT_PAGE_HEADER_PADDING, ...rest }, ref) => {
63
64
  const isServerEnv = useServerEnv();
64
65
  const enableScrollRef = useRef();
65
66
  const onAfterExitRef = useRef(onAfterExit);
@@ -90,14 +91,15 @@ const Modal = forwardRef(({ visible, size = 'medium', title, titleAlignment = 'l
90
91
  !actions;
91
92
  const isVerticalPaddingsDisabled = disableVerticalPaddings && isPaddingsDisableAllowed;
92
93
  const isHorizontalPaddingsDisabled = disableHorizontalPaddings && isPaddingsDisableAllowed;
94
+ const showOverlay = position === 'center' || _showOverlay;
93
95
  const onEntering = useCallback(() => {
94
- if (!enableScrollRef.current) {
96
+ if (!enableScrollRef.current && showOverlay) {
95
97
  enableScrollRef.current = disableScroll();
96
98
  }
97
99
  if (modalRef.current && !modalRef.current.contains(document.activeElement)) {
98
100
  modalRef.current.focus();
99
101
  }
100
- }, []);
102
+ }, [showOverlay]);
101
103
  const onEntered = useCallback(() => {
102
104
  onAppear?.();
103
105
  }, [onAppear]);
@@ -143,6 +145,41 @@ const Modal = forwardRef(({ visible, size = 'medium', title, titleAlignment = 'l
143
145
  });
144
146
  document.body.removeChild(animationTimeoutElement);
145
147
  }, [setAnimationTimeout]);
148
+ useEffect(() => {
149
+ if (showOverlay || !pageHeaderPadding || !visible) {
150
+ return void 0;
151
+ }
152
+ const hasScrollTimeline = 'ScrollTimeline' in window;
153
+ const overlay = overlayRef.current;
154
+ if (!overlay) {
155
+ return void 0;
156
+ }
157
+ let animation;
158
+ const abortController = new AbortController();
159
+ const keyframes = { top: [`${pageHeaderPadding}px`, '0px'] };
160
+ if (hasScrollTimeline) {
161
+ const timeline = new ScrollTimeline({ source: document.documentElement, axis: 'y' });
162
+ animation = overlay.animate(keyframes, {
163
+ timeline,
164
+ rangeStart: '0px',
165
+ // calc нужен для устранения бага https://issues.chromium.org/issues/40929569
166
+ rangeEnd: `calc(0% + ${pageHeaderPadding}px)`,
167
+ });
168
+ }
169
+ else {
170
+ animation = overlay.animate(keyframes, { duration: 1000, fill: 'forwards' });
171
+ animation.pause();
172
+ const { signal } = abortController;
173
+ window.addEventListener('scroll', () => {
174
+ animation.currentTime =
175
+ (Math.min(document.documentElement.scrollTop, pageHeaderPadding) / pageHeaderPadding) *
176
+ 1000;
177
+ }, { signal });
178
+ }
179
+ return () => {
180
+ abortController.abort();
181
+ };
182
+ }, [showOverlay, pageHeaderPadding, visible]);
146
183
  const overlayEventHandlers = useNoBubbling({
147
184
  onKeyDown: (event) => {
148
185
  if (keyboardMatch(event.nativeEvent, keyboardKeys.Escape)) {
@@ -156,6 +193,7 @@ const Modal = forwardRef(({ visible, size = 'medium', title, titleAlignment = 'l
156
193
  onClose(event);
157
194
  },
158
195
  });
196
+ const overlayProps = showOverlay ? overlayEventHandlers : undefined;
159
197
  if (INVISIBLE_FOR_BREAKPOINTS.includes(breakpoint) || isServerEnv) {
160
198
  return null;
161
199
  }
@@ -182,15 +220,17 @@ const Modal = forwardRef(({ visible, size = 'medium', title, titleAlignment = 'l
182
220
  isActionBarComponent(footer) &&
183
221
  Boolean(footer.props.showProgress) &&
184
222
  isProgressBarComponent(footer.props.showProgress);
185
- return createPortal(jsx(CSSTransition, { appear: true, in: visible && !isServerEnv, nodeRef: overlayRef, onEntering: onEntering, onEntered: onEntered, onExit: onExit, onExited: onExited, classNames: CSS_CLASSES[position], timeout: animationTimeout, unmountOnExit: true, children: jsx(Layer, { layer: "modal", children: jsx("div", { ...overlayEventHandlers, ref: overlayRef, className: classnames(styles.modalOverlay, {
186
- [styles.overlayLeft]: position === 'left',
187
- [styles.overlayRight]: position === 'right',
223
+ return createPortal(jsx(CSSTransition, { appear: true, in: visible && !isServerEnv, nodeRef: overlayRef, onEntering: onEntering, onEntered: onEntered, onExit: onExit, onExited: onExited, classNames: CSS_CLASSES[position], timeout: animationTimeout, unmountOnExit: true, children: jsx(Layer, { layer: "modal", children: jsx("div", { ...overlayProps, ref: overlayRef, className: classnames(styles.modalOverlay, {
224
+ [styles.modalOverlayWithBackground]: showOverlay,
225
+ [styles.modalOverlayLeft]: position === 'left',
226
+ [styles.modalOverlayRight]: position === 'right',
188
227
  }), "data-qa": "modal-overlay", children: jsxs("div", { ...rest, ...additionalProps, role: "dialog", className: classnames(styles.modal, {
189
228
  [styles.sizeSmall]: size === 'small',
190
229
  [styles.sizeMedium]: size === 'medium',
191
230
  [styles.modalFullHeight]: height === 'full-screen' || isTreeSelectorChild,
192
231
  [styles.noVerticalPaddings]: isVerticalPaddingsDisabled,
193
232
  [styles.noHorizontalPaddings]: isHorizontalPaddingsDisabled,
233
+ [styles.modalWithBorder]: !showOverlay,
194
234
  }), ref: modalRefCallback, tabIndex: 0, style: {
195
235
  height: typeof height === 'number' ? `${height}px` : undefined,
196
236
  minHeight: typeof minHeight === 'number'
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} 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 } from '@hh.ru/magritte-common-keyboard';\nimport { disableScroll, TimeoutCallback } from '@hh.ru/magritte-common-modal-helper';\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/ModalContentWithHeader';\nimport { ModalHeaderProps, ModalProps } from '@hh.ru/magritte-ui-modal/types';\nimport { useModalOrder } from '@hh.ru/magritte-ui-modal/useModalOrder';\nimport { isProgressBarComponent } from '@hh.ru/magritte-ui-progress-bar';\nimport { isValidTreeSelectorWrapper } from '@hh.ru/magritte-ui-tree-selector';\n\nimport styles from './modal.less';\n\nconst DEFAULT_ACTION_BAR_PADDING = 24;\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\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 ...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 modalRefCallback = useMultipleRefs(ref, modalRef);\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 onEntering = useCallback(() => {\n if (!enableScrollRef.current) {\n enableScrollRef.current = disableScroll();\n }\n if (modalRef.current && !modalRef.current.contains(document.activeElement)) {\n modalRef.current.focus();\n }\n }, []);\n\n const onEntered = useCallback(() => {\n onAppear?.();\n }, [onAppear]);\n\n const onExit = useCallback(() => {\n onBeforeExitRef.current?.();\n }, []);\n const onExited = useCallback(() => {\n // оставляем обработку скрола еще и тут\n // чтобы обработать историю со сменой breakpoint\n enableScrollRef.current?.();\n enableScrollRef.current = undefined;\n onAfterExitRef.current?.();\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 () => () => {\n enableScrollRef.current?.(animationTimeoutExitRef.current);\n enableScrollRef.current = undefined;\n },\n [visible]\n );\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 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\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 = isValidTreeSelectorWrapper(children);\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 <Layer layer=\"modal\">\n <div\n {...overlayEventHandlers}\n ref={overlayRef}\n className={classnames(styles.modalOverlay, {\n [styles.overlayLeft]: position === 'left',\n [styles.overlayRight]: position === 'right',\n })}\n data-qa=\"modal-overlay\"\n >\n <div\n {...rest}\n {...additionalProps}\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 })}\n ref={modalRefCallback}\n tabIndex={0}\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 </div>\n </Layer>\n </CSSTransition>,\n host || document.body\n );\n }\n);\n\nModal.displayName = 'Modal';\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAEtC,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,CAAC;AACjD,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG;AAChB,IAAA,MAAM,EAAE;QACJ,MAAM,EAAE,MAAM,CAAC,oBAAoB;QACnC,YAAY,EAAE,MAAM,CAAC,0BAA0B;QAC/C,KAAK,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IAAC,sBAAsB,EAAA,EAAA,GACf,gBAAgB,EACpB,OAAO,EAAE,OAAO,EAChB,mBAAmB,EAAE,mBAAmB,EACxC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,CAAC,0BAA0B,EAEvC,QAAA,EAAA,QAAQ,GACY,EACxB,CAAC,CAAC,MAAM,KACLA,GAAK,CAAA,KAAA,EAAA,EAAA,SAAS,EAAE,MAAM,CAAC,WAAW,EAAU,SAAA,EAAA,cAAc,YACrD,oBAAoB,CAAC,MAAM,CAAC;AACzB,kCAAE,YAAY,CAAC,MAAM,EAAE;AACjB,oCAAA,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,IAAI,MAAM;AACjC,oCAAA,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,IAAI,0BAA0B;AAC3D,oCAAA,WAAW,EAAE,KAAK;iCACrB,CAAC;AACJ,kCAAE,MAAM,EACV,CAAA,CACT,IACC,EACJ,CAAA,EAAA,CACF,EACI,CAAA,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} 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 } from '@hh.ru/magritte-common-keyboard';\nimport { disableScroll, TimeoutCallback } from '@hh.ru/magritte-common-modal-helper';\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/ModalContentWithHeader';\nimport { ModalHeaderProps, ModalProps } from '@hh.ru/magritte-ui-modal/types';\nimport { useModalOrder } from '@hh.ru/magritte-ui-modal/useModalOrder';\nimport { isProgressBarComponent } from '@hh.ru/magritte-ui-progress-bar';\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\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 ...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 modalRefCallback = useMultipleRefs(ref, modalRef);\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 onEntering = useCallback(() => {\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 }, [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 onAfterExitRef.current?.();\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 () => () => {\n enableScrollRef.current?.(animationTimeoutExitRef.current);\n enableScrollRef.current = undefined;\n },\n [visible]\n );\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 const { signal } = abortController;\n window.addEventListener(\n 'scroll',\n () => {\n animation.currentTime =\n (Math.min(document.documentElement.scrollTop, pageHeaderPadding) / pageHeaderPadding) *\n 1000;\n },\n { 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 ? overlayEventHandlers : undefined;\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 = isValidTreeSelectorWrapper(children);\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 <Layer layer=\"modal\">\n <div\n {...overlayProps}\n ref={overlayRef}\n className={classnames(styles.modalOverlay, {\n [styles.modalOverlayWithBackground]: showOverlay,\n [styles.modalOverlayLeft]: position === 'left',\n [styles.modalOverlayRight]: position === 'right',\n })}\n data-qa=\"modal-overlay\"\n >\n <div\n {...rest}\n {...additionalProps}\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={0}\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 </div>\n </Layer>\n </CSSTransition>,\n host || document.body\n );\n }\n);\n\nModal.displayName = 'Modal';\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,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,CAAC;AAC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M,CAAC,KAAK,CAAC,OAAO,IAAI,0BAA0B;AAC3D,oCAAA,WAAW,EAAE,KAAK;iCACrB,CAAC;AACJ,kCAAE,MAAM,EACV,CAAA,CACT,IACC,EACJ,CAAA,EAAA,CACF,EACI,CAAA,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___lK22l_9-3-4","modalOverlay":"magritte-modal-overlay___lK22l_9-3-4","overlay-left":"magritte-overlay-left___JtHK4_9-3-4","overlayLeft":"magritte-overlay-left___JtHK4_9-3-4","overlay-right":"magritte-overlay-right___uKTDt_9-3-4","overlayRight":"magritte-overlay-right___uKTDt_9-3-4","modal":"magritte-modal___RAW6S_9-3-4","size-small":"magritte-size-small___2JTM2_9-3-4","sizeSmall":"magritte-size-small___2JTM2_9-3-4","size-medium":"magritte-size-medium___cWCe7_9-3-4","sizeMedium":"magritte-size-medium___cWCe7_9-3-4","no-vertical-paddings":"magritte-no-vertical-paddings___Z3-oM_9-3-4","noVerticalPaddings":"magritte-no-vertical-paddings___Z3-oM_9-3-4","no-horizontal-paddings":"magritte-no-horizontal-paddings___aT95Y_9-3-4","noHorizontalPaddings":"magritte-no-horizontal-paddings___aT95Y_9-3-4","modal-full-height":"magritte-modal-full-height___gIM4E_9-3-4","modalFullHeight":"magritte-modal-full-height___gIM4E_9-3-4","modal-content-wrapper":"magritte-modal-content-wrapper___23XFT_9-3-4","modalContentWrapper":"magritte-modal-content-wrapper___23XFT_9-3-4","modal-content":"magritte-modal-content___46QFS_9-3-4","modalContent":"magritte-modal-content___46QFS_9-3-4","modal-scroll-container":"magritte-modal-scroll-container___Tf8Ns_9-3-4","modalScrollContainer":"magritte-modal-scroll-container___Tf8Ns_9-3-4","modal-content-wrapper__one-line":"magritte-modal-content-wrapper__one-line___tYg8d_9-3-4","modalContentWrapperOneLine":"magritte-modal-content-wrapper__one-line___tYg8d_9-3-4","content-sticky-container":"magritte-content-sticky-container___nqEXj_9-3-4","contentStickyContainer":"magritte-content-sticky-container___nqEXj_9-3-4","divider-container":"magritte-divider-container___qP3VK_9-3-4","dividerContainer":"magritte-divider-container___qP3VK_9-3-4","divider-container-hidden":"magritte-divider-container-hidden___EIxB-_9-3-4","dividerContainerHidden":"magritte-divider-container-hidden___EIxB-_9-3-4","modal-footer":"magritte-modal-footer___8xPqQ_9-3-4","modalFooter":"magritte-modal-footer___8xPqQ_9-3-4","modal-buttons-container":"magritte-modal-buttons-container___1O1Nr_9-3-4","modalButtonsContainer":"magritte-modal-buttons-container___1O1Nr_9-3-4","animation-timeout":"magritte-animation-timeout___w-j7K_9-3-4","animationTimeout":"magritte-animation-timeout___w-j7K_9-3-4","animation-enter-center":"magritte-animation-enter-center___7jogC_9-3-4","animationEnterCenter":"magritte-animation-enter-center___7jogC_9-3-4","animation-enter-center-active":"magritte-animation-enter-center-active___fywwW_9-3-4","animationEnterCenterActive":"magritte-animation-enter-center-active___fywwW_9-3-4","animation-exit-center":"magritte-animation-exit-center___3Fa6x_9-3-4","animationExitCenter":"magritte-animation-exit-center___3Fa6x_9-3-4","animation-exit-center-active":"magritte-animation-exit-center-active___tY0UA_9-3-4","animationExitCenterActive":"magritte-animation-exit-center-active___tY0UA_9-3-4","animation-enter-left":"magritte-animation-enter-left___5YB8B_9-3-4","animationEnterLeft":"magritte-animation-enter-left___5YB8B_9-3-4","animation-enter-left-active":"magritte-animation-enter-left-active___5GK8s_9-3-4","animationEnterLeftActive":"magritte-animation-enter-left-active___5GK8s_9-3-4","animation-exit-left":"magritte-animation-exit-left___OnkQE_9-3-4","animationExitLeft":"magritte-animation-exit-left___OnkQE_9-3-4","animation-exit-left-active":"magritte-animation-exit-left-active___AEGxY_9-3-4","animationExitLeftActive":"magritte-animation-exit-left-active___AEGxY_9-3-4","animation-enter-right":"magritte-animation-enter-right___2aXOm_9-3-4","animationEnterRight":"magritte-animation-enter-right___2aXOm_9-3-4","animation-enter-right-active":"magritte-animation-enter-right-active___8wX4-_9-3-4","animationEnterRightActive":"magritte-animation-enter-right-active___8wX4-_9-3-4","animation-exit-right":"magritte-animation-exit-right___iczoc_9-3-4","animationExitRight":"magritte-animation-exit-right___iczoc_9-3-4","animation-exit-right-active":"magritte-animation-exit-right-active___eFS4O_9-3-4","animationExitRightActive":"magritte-animation-exit-right-active___eFS4O_9-3-4","content-scroll-preserver":"magritte-content-scroll-preserver___Tw5Px_9-3-4","contentScrollPreserver":"magritte-content-scroll-preserver___Tw5Px_9-3-4","tree-selector-container":"magritte-tree-selector-container___fdhI-_9-3-4","treeSelectorContainer":"magritte-tree-selector-container___fdhI-_9-3-4","grow-limiter":"magritte-grow-limiter___zeIwy_9-3-4","growLimiter":"magritte-grow-limiter___zeIwy_9-3-4"};
13
+ var styles = {"modal-overlay":"magritte-modal-overlay___lK22l_9-4-0","modalOverlay":"magritte-modal-overlay___lK22l_9-4-0","modal-overlay-with-background":"magritte-modal-overlay-with-background___ZYsA-_9-4-0","modalOverlayWithBackground":"magritte-modal-overlay-with-background___ZYsA-_9-4-0","modal":"magritte-modal___RAW6S_9-4-0","modal-overlay-left":"magritte-modal-overlay-left___4Qsdn_9-4-0","modalOverlayLeft":"magritte-modal-overlay-left___4Qsdn_9-4-0","modal-overlay-right":"magritte-modal-overlay-right___xAjO7_9-4-0","modalOverlayRight":"magritte-modal-overlay-right___xAjO7_9-4-0","size-small":"magritte-size-small___2JTM2_9-4-0","sizeSmall":"magritte-size-small___2JTM2_9-4-0","size-medium":"magritte-size-medium___cWCe7_9-4-0","sizeMedium":"magritte-size-medium___cWCe7_9-4-0","no-vertical-paddings":"magritte-no-vertical-paddings___Z3-oM_9-4-0","noVerticalPaddings":"magritte-no-vertical-paddings___Z3-oM_9-4-0","no-horizontal-paddings":"magritte-no-horizontal-paddings___aT95Y_9-4-0","noHorizontalPaddings":"magritte-no-horizontal-paddings___aT95Y_9-4-0","modal-full-height":"magritte-modal-full-height___gIM4E_9-4-0","modalFullHeight":"magritte-modal-full-height___gIM4E_9-4-0","modal-with-border":"magritte-modal-with-border___wYWgv_9-4-0","modalWithBorder":"magritte-modal-with-border___wYWgv_9-4-0","modal-content-wrapper":"magritte-modal-content-wrapper___23XFT_9-4-0","modalContentWrapper":"magritte-modal-content-wrapper___23XFT_9-4-0","modal-content":"magritte-modal-content___46QFS_9-4-0","modalContent":"magritte-modal-content___46QFS_9-4-0","modal-scroll-container":"magritte-modal-scroll-container___Tf8Ns_9-4-0","modalScrollContainer":"magritte-modal-scroll-container___Tf8Ns_9-4-0","modal-content-wrapper__one-line":"magritte-modal-content-wrapper__one-line___tYg8d_9-4-0","modalContentWrapperOneLine":"magritte-modal-content-wrapper__one-line___tYg8d_9-4-0","content-sticky-container":"magritte-content-sticky-container___nqEXj_9-4-0","contentStickyContainer":"magritte-content-sticky-container___nqEXj_9-4-0","divider-container":"magritte-divider-container___qP3VK_9-4-0","dividerContainer":"magritte-divider-container___qP3VK_9-4-0","divider-container-hidden":"magritte-divider-container-hidden___EIxB-_9-4-0","dividerContainerHidden":"magritte-divider-container-hidden___EIxB-_9-4-0","modal-footer":"magritte-modal-footer___8xPqQ_9-4-0","modalFooter":"magritte-modal-footer___8xPqQ_9-4-0","modal-buttons-container":"magritte-modal-buttons-container___1O1Nr_9-4-0","modalButtonsContainer":"magritte-modal-buttons-container___1O1Nr_9-4-0","animation-timeout":"magritte-animation-timeout___w-j7K_9-4-0","animationTimeout":"magritte-animation-timeout___w-j7K_9-4-0","animation-enter-center":"magritte-animation-enter-center___7jogC_9-4-0","animationEnterCenter":"magritte-animation-enter-center___7jogC_9-4-0","animation-enter-center-active":"magritte-animation-enter-center-active___fywwW_9-4-0","animationEnterCenterActive":"magritte-animation-enter-center-active___fywwW_9-4-0","animation-exit-center":"magritte-animation-exit-center___3Fa6x_9-4-0","animationExitCenter":"magritte-animation-exit-center___3Fa6x_9-4-0","animation-exit-center-active":"magritte-animation-exit-center-active___tY0UA_9-4-0","animationExitCenterActive":"magritte-animation-exit-center-active___tY0UA_9-4-0","animation-enter-left":"magritte-animation-enter-left___5YB8B_9-4-0","animationEnterLeft":"magritte-animation-enter-left___5YB8B_9-4-0","animation-enter-left-active":"magritte-animation-enter-left-active___5GK8s_9-4-0","animationEnterLeftActive":"magritte-animation-enter-left-active___5GK8s_9-4-0","animation-exit-left":"magritte-animation-exit-left___OnkQE_9-4-0","animationExitLeft":"magritte-animation-exit-left___OnkQE_9-4-0","animation-exit-left-active":"magritte-animation-exit-left-active___AEGxY_9-4-0","animationExitLeftActive":"magritte-animation-exit-left-active___AEGxY_9-4-0","animation-enter-right":"magritte-animation-enter-right___2aXOm_9-4-0","animationEnterRight":"magritte-animation-enter-right___2aXOm_9-4-0","animation-enter-right-active":"magritte-animation-enter-right-active___8wX4-_9-4-0","animationEnterRightActive":"magritte-animation-enter-right-active___8wX4-_9-4-0","animation-exit-right":"magritte-animation-exit-right___iczoc_9-4-0","animationExitRight":"magritte-animation-exit-right___iczoc_9-4-0","animation-exit-right-active":"magritte-animation-exit-right-active___eFS4O_9-4-0","animationExitRightActive":"magritte-animation-exit-right-active___eFS4O_9-4-0","content-scroll-preserver":"magritte-content-scroll-preserver___Tw5Px_9-4-0","contentScrollPreserver":"magritte-content-scroll-preserver___Tw5Px_9-4-0","tree-selector-container":"magritte-tree-selector-container___fdhI-_9-4-0","treeSelectorContainer":"magritte-tree-selector-container___fdhI-_9-4-0","grow-limiter":"magritte-grow-limiter___zeIwy_9-4-0","growLimiter":"magritte-grow-limiter___zeIwy_9-4-0"};
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-BgN1dYE-.js.map
150
+ //# sourceMappingURL=ModalContentWithHeader-_Kk54Y7Z.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ModalContentWithHeader-BgN1dYE-.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/ModalHeader';\nimport { ModalHeaderProps, ModalHeight } from '@hh.ru/magritte-ui-modal/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 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,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mB,EAAA,EAAA,GACZ,uBAAuB,EAC3B,SAAS,EAAE,MAAM,CAAC,WAAW,EAAA,QAAA,EAE5B,QAAQ,EACS,CAAA,EAAA,CACpB,EACNA,GAAA,CAAA,KAAA,EAAA,EAAK,GAAG,EAAE,iBAAiB,EAAA,CAAI,CAC7B,EAAA,CAAA,EACL,iBAAiB,IAAIA,GAAC,CAAA,SAAS,EAAK,EAAA,GAAA,sBAAsB,GAAI,CAChE,EAAA,CAAA,CACN,EACgB,CAAA,EAAA,CACnB,CACJ,EAAA,CAAA,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-_Kk54Y7Z.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/ModalHeader';\nimport { ModalHeaderProps, ModalHeight } from '@hh.ru/magritte-ui-modal/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 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,0B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-ui-textarea';
12
- export { M as ModalContentWithHeader } from './ModalContentWithHeader-BgN1dYE-.js';
12
+ export { M as ModalContentWithHeader } from './ModalContentWithHeader-_Kk54Y7Z.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.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { RefObject } from 'react';
2
- export declare const ModalHeader: import("react").ForwardRefExoticComponent<import("@hh.ru/magritte-ui-modal/types").ModalHeaderBaseProps & import("@hh.ru/magritte-ui-modal/types").ModalHeaderAdditionalProps & {
2
+ import { ModalHeaderProps } from '@hh.ru/magritte-ui-modal/types';
3
+ export declare const ModalHeader: import("react").ForwardRefExoticComponent<ModalHeaderProps & {
3
4
  labelId: string;
4
5
  wrapperRef: RefObject<HTMLDivElement>;
5
6
  } & import("react").RefAttributes<HTMLDivElement>>;
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___o6ktq_9-3-4","options":"magritte-options___qfErQ_9-3-4","actions":"magritte-actions___nQILV_9-3-4","actions-with-link":"magritte-actions-with-link___hnDux_9-3-4","actionsWithLink":"magritte-actions-with-link___hnDux_9-3-4","content-with-image":"magritte-content-with-image___YarBO_9-3-4","contentWithImage":"magritte-content-with-image___YarBO_9-3-4","actions-single":"magritte-actions-single___usfKu_9-3-4","actionsSingle":"magritte-actions-single___usfKu_9-3-4","image-container":"magritte-image-container___ioL3y_9-3-4","imageContainer":"magritte-image-container___ioL3y_9-3-4","title-wrapper":"magritte-title-wrapper___O--QR_9-3-4","titleWrapper":"magritte-title-wrapper___O--QR_9-3-4","wrapper":"magritte-wrapper___zH8vB_9-3-4","only-actions":"magritte-only-actions___ZC4jx_9-3-4","onlyActions":"magritte-only-actions___ZC4jx_9-3-4"};
8
+ var styles = {"content":"magritte-content___o6ktq_9-4-0","options":"magritte-options___qfErQ_9-4-0","actions":"magritte-actions___nQILV_9-4-0","actions-with-link":"magritte-actions-with-link___hnDux_9-4-0","actionsWithLink":"magritte-actions-with-link___hnDux_9-4-0","content-with-image":"magritte-content-with-image___YarBO_9-4-0","contentWithImage":"magritte-content-with-image___YarBO_9-4-0","actions-single":"magritte-actions-single___usfKu_9-4-0","actionsSingle":"magritte-actions-single___usfKu_9-4-0","image-container":"magritte-image-container___ioL3y_9-4-0","imageContainer":"magritte-image-container___ioL3y_9-4-0","title-wrapper":"magritte-title-wrapper___O--QR_9-4-0","titleWrapper":"magritte-title-wrapper___O--QR_9-4-0","wrapper":"magritte-wrapper___zH8vB_9-4-0","only-actions":"magritte-only-actions___ZC4jx_9-4-0","onlyActions":"magritte-only-actions___ZC4jx_9-4-0"};
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
@@ -2,14 +2,14 @@
2
2
  --magritte-color-component-modal-background-action-v24-0-1:#20262b99;
3
3
  --magritte-gradient-component-modal-background-fade-v24-0-1:linear-gradient(180deg, #00000000 0%, #0000007a 100%);
4
4
  }
5
- .magritte-content___o6ktq_9-3-4{
5
+ .magritte-content___o6ktq_9-4-0{
6
6
  display:flex;
7
7
  align-items:flex-start;
8
8
  }
9
- .magritte-content___o6ktq_9-3-4 + .magritte-options___qfErQ_9-3-4{
9
+ .magritte-content___o6ktq_9-4-0 + .magritte-options___qfErQ_9-4-0{
10
10
  margin-top:24px;
11
11
  }
12
- .magritte-actions___nQILV_9-3-4{
12
+ .magritte-actions___nQILV_9-4-0{
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___hnDux_9-3-4{
21
+ .magritte-actions-with-link___hnDux_9-4-0{
22
22
  padding:0 8px 0 28px;
23
23
  }
24
- .magritte-content-with-image___YarBO_9-3-4{
24
+ .magritte-content-with-image___YarBO_9-4-0{
25
25
  position:relative;
26
26
  flex-direction:column;
27
27
  justify-content:flex-end;
@@ -31,22 +31,22 @@
31
31
  padding:12px 24px 24px;
32
32
  box-sizing:border-box;
33
33
  }
34
- .magritte-content-with-image___YarBO_9-3-4 .magritte-actions___nQILV_9-3-4{
34
+ .magritte-content-with-image___YarBO_9-4-0 .magritte-actions___nQILV_9-4-0{
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___YarBO_9-3-4 .magritte-actions___nQILV_9-3-4:not(.magritte-actions-with-link___hnDux_9-3-4){
41
+ .magritte-content-with-image___YarBO_9-4-0 .magritte-actions___nQILV_9-4-0:not(.magritte-actions-with-link___hnDux_9-4-0){
42
42
  padding:0 4px;
43
43
  background-color:var(--magritte-color-component-modal-background-action-v24-0-1);
44
44
  border-radius:12px;
45
45
  }
46
- .magritte-content-with-image___YarBO_9-3-4 .magritte-actions___nQILV_9-3-4.magritte-actions-single___usfKu_9-3-4:not(.magritte-actions-with-link___hnDux_9-3-4){
46
+ .magritte-content-with-image___YarBO_9-4-0 .magritte-actions___nQILV_9-4-0.magritte-actions-single___usfKu_9-4-0:not(.magritte-actions-with-link___hnDux_9-4-0){
47
47
  padding:0;
48
48
  }
49
- .magritte-image-container___ioL3y_9-3-4{
49
+ .magritte-image-container___ioL3y_9-4-0{
50
50
  position:absolute;
51
51
  left:0;
52
52
  bottom:0;
@@ -54,22 +54,23 @@
54
54
  background-size:cover;
55
55
  --modal-header-gradient:var(--magritte-gradient-component-modal-background-fade-v24-0-1);
56
56
  }
57
- .magritte-title-wrapper___O--QR_9-3-4{
57
+ .magritte-title-wrapper___O--QR_9-4-0{
58
58
  position:relative;
59
59
  width:100%;
60
60
  }
61
- .magritte-wrapper___zH8vB_9-3-4{
61
+ .magritte-wrapper___zH8vB_9-4-0{
62
62
  margin-bottom:24px;
63
63
  }
64
- .magritte-only-actions___ZC4jx_9-3-4 .magritte-actions___nQILV_9-3-4{
64
+ .magritte-only-actions___ZC4jx_9-4-0 .magritte-actions___nQILV_9-4-0{
65
65
  padding-left:0;
66
66
  }
67
- .magritte-only-actions___ZC4jx_9-3-4 .magritte-actions-with-link___hnDux_9-3-4{
67
+ .magritte-only-actions___ZC4jx_9-4-0 .magritte-actions-with-link___hnDux_9-4-0{
68
68
  padding-left:12px;
69
69
  }
70
70
 
71
71
  :root{
72
72
  --magritte-color-background-overlay-v24-0-1:#20262b99;
73
+ --magritte-color-stroke-neutral-v24-0-1:#DCE3EB;
73
74
  --magritte-color-component-modal-background-content-v24-0-1:#ffffff;
74
75
  }
75
76
 
@@ -81,9 +82,10 @@
81
82
  }
82
83
 
83
84
  .magritte-night-theme{
85
+ --magritte-color-stroke-neutral-v24-0-1:#303030;
84
86
  --magritte-color-component-modal-background-content-v24-0-1:#1B1B1B;
85
87
  }
86
- .magritte-modal-overlay___lK22l_9-3-4{
88
+ .magritte-modal-overlay___lK22l_9-4-0{
87
89
  position:fixed;
88
90
  top:0;
89
91
  right:0;
@@ -92,24 +94,32 @@
92
94
  display:flex;
93
95
  align-items:center;
94
96
  justify-content:center;
97
+ }
98
+ .magritte-modal-overlay-with-background___ZYsA-_9-4-0{
95
99
  background-color:var(--magritte-color-background-overlay-v24-0-1);
96
- z-index:1;
97
- user-select:text;
98
100
  transition-property:opacity, transform;
101
+ user-select:text;
102
+ z-index:1;
103
+ }
104
+ .magritte-modal-overlay___lK22l_9-4-0:not(.magritte-modal-overlay-with-background___ZYsA-_9-4-0){
105
+ pointer-events:none;
99
106
  }
100
- .magritte-overlay-left___JtHK4_9-3-4{
107
+ .magritte-modal-overlay___lK22l_9-4-0:not(.magritte-modal-overlay-with-background___ZYsA-_9-4-0) .magritte-modal___RAW6S_9-4-0{
108
+ pointer-events:auto;
109
+ }
110
+ .magritte-modal-overlay-left___4Qsdn_9-4-0{
101
111
  justify-content:flex-start;
102
112
  }
103
- .magritte-overlay-right___uKTDt_9-3-4{
113
+ .magritte-modal-overlay-right___xAjO7_9-4-0{
104
114
  justify-content:flex-end;
105
115
  }
106
- .magritte-modal___RAW6S_9-3-4{
116
+ .magritte-modal___RAW6S_9-4-0{
107
117
  display:flex;
108
118
  box-sizing:border-box;
109
119
  margin:0 12px;
110
120
  padding:24px;
111
121
  flex-direction:column;
112
- max-height:calc(100vh - 12px * 2);
122
+ max-height:calc(100% - 12px * 2);
113
123
  max-width:calc(100vw - 12px * 2);
114
124
  position:relative;
115
125
  background-color:var(--magritte-color-component-modal-background-content-v24-0-1);
@@ -119,30 +129,33 @@
119
129
  transition-property:opacity, transform;
120
130
  container-type:inline-size;
121
131
  }
122
- .magritte-modal___RAW6S_9-3-4.magritte-size-small___2JTM2_9-3-4{
132
+ .magritte-modal___RAW6S_9-4-0.magritte-size-small___2JTM2_9-4-0{
123
133
  width:480px;
124
134
  }
125
- .magritte-modal___RAW6S_9-3-4.magritte-size-medium___cWCe7_9-3-4{
135
+ .magritte-modal___RAW6S_9-4-0.magritte-size-medium___cWCe7_9-4-0{
126
136
  width:620px;
127
137
  }
128
- .magritte-no-vertical-paddings___Z3-oM_9-3-4{
138
+ .magritte-no-vertical-paddings___Z3-oM_9-4-0{
129
139
  padding-top:0;
130
140
  padding-bottom:0;
131
141
  }
132
- .magritte-no-horizontal-paddings___aT95Y_9-3-4{
142
+ .magritte-no-horizontal-paddings___aT95Y_9-4-0{
133
143
  padding-left:0;
134
144
  padding-right:0;
135
145
  }
136
- .magritte-modal-full-height___gIM4E_9-3-4{
146
+ .magritte-modal-full-height___gIM4E_9-4-0{
137
147
  height:100%;
138
148
  }
139
- .magritte-modal-content-wrapper___23XFT_9-3-4{
149
+ .magritte-modal-with-border___wYWgv_9-4-0{
150
+ outline:1px solid var(--magritte-color-stroke-neutral-v24-0-1);
151
+ }
152
+ .magritte-modal-content-wrapper___23XFT_9-4-0{
140
153
  display:flex;
141
154
  flex-direction:column;
142
155
  min-height:0;
143
156
  flex:1 1;
144
157
  }
145
- .magritte-modal-content___46QFS_9-3-4{
158
+ .magritte-modal-content___46QFS_9-4-0{
146
159
  position:relative;
147
160
  display:flex;
148
161
  flex-direction:column;
@@ -153,7 +166,7 @@
153
166
  width:calc(100% + 24px);
154
167
  width:calc(100cqw + 24px);
155
168
  }
156
- .magritte-modal-scroll-container___Tf8Ns_9-3-4{
169
+ .magritte-modal-scroll-container___Tf8Ns_9-4-0{
157
170
  display:flex;
158
171
  flex-direction:column;
159
172
  flex:1 1;
@@ -162,217 +175,217 @@
162
175
  overscroll-behavior:none;
163
176
  scrollbar-width:none;
164
177
  }
165
- .magritte-modal-scroll-container___Tf8Ns_9-3-4::-webkit-scrollbar{
178
+ .magritte-modal-scroll-container___Tf8Ns_9-4-0::-webkit-scrollbar{
166
179
  display:none;
167
180
  }
168
- .magritte-modal-content-wrapper__one-line___tYg8d_9-3-4{
181
+ .magritte-modal-content-wrapper__one-line___tYg8d_9-4-0{
169
182
  flex-direction:row-reverse;
170
183
  }
171
- .magritte-modal-content-wrapper__one-line___tYg8d_9-3-4 .magritte-modal-content___46QFS_9-3-4{
184
+ .magritte-modal-content-wrapper__one-line___tYg8d_9-4-0 .magritte-modal-content___46QFS_9-4-0{
172
185
  width:auto;
173
186
  container-type:inline-size;
174
187
  margin-right:0;
175
188
  }
176
- .magritte-modal-content-wrapper__one-line___tYg8d_9-3-4 .magritte-content-sticky-container___nqEXj_9-3-4{
189
+ .magritte-modal-content-wrapper__one-line___tYg8d_9-4-0 .magritte-content-sticky-container___nqEXj_9-4-0{
177
190
  max-width:calc(100% - 16px);
178
191
  max-width:calc(100cqw - 16px);
179
192
  }
180
- .magritte-divider-container___qP3VK_9-3-4{
193
+ .magritte-divider-container___qP3VK_9-4-0{
181
194
  margin:0 -24px;
182
195
  }
183
- .magritte-divider-container___qP3VK_9-3-4.magritte-divider-container-hidden___EIxB-_9-3-4{
196
+ .magritte-divider-container___qP3VK_9-4-0.magritte-divider-container-hidden___EIxB-_9-4-0{
184
197
  display:none;
185
198
  }
186
- .magritte-modal-footer___8xPqQ_9-3-4{
199
+ .magritte-modal-footer___8xPqQ_9-4-0{
187
200
  margin:0 -24px -24px;
188
201
  background-color:var(--magritte-color-component-modal-background-content-v24-0-1);
189
202
  z-index:1;
190
203
  --magritte-ui-action-bar-background-color-override:var(--magritte-color-component-modal-background-content-v24-0-1);
191
204
  }
192
- .magritte-modal-buttons-container___1O1Nr_9-3-4{
205
+ .magritte-modal-buttons-container___1O1Nr_9-4-0{
193
206
  display:flex;
194
207
  gap:12px;
195
208
  }
196
- .magritte-animation-timeout___w-j7K_9-3-4{
209
+ .magritte-animation-timeout___w-j7K_9-4-0{
197
210
  --enter-animation-duration:0;
198
211
  --exit-animation-duration:0;
199
212
  }
200
213
  @media (prefers-reduced-motion: no-preference){
201
- .magritte-animation-timeout___w-j7K_9-3-4{
214
+ .magritte-animation-timeout___w-j7K_9-4-0{
202
215
  --enter-animation-duration:var(--magritte-semantic-animation-ease-in-out-300-duration-v24-0-1);
203
216
  --exit-animation-duration:var(--magritte-semantic-animation-ease-in-out-200-duration-v24-0-1);
204
217
  }
205
218
  }
206
- .magritte-animation-enter-center___7jogC_9-3-4.magritte-modal-overlay___lK22l_9-3-4{
219
+ .magritte-animation-enter-center___7jogC_9-4-0.magritte-modal-overlay-with-background___ZYsA-_9-4-0{
207
220
  opacity:0;
208
221
  }
209
- .magritte-animation-enter-center___7jogC_9-3-4 .magritte-modal___RAW6S_9-3-4{
222
+ .magritte-animation-enter-center___7jogC_9-4-0 .magritte-modal___RAW6S_9-4-0{
210
223
  opacity:0;
211
224
  transform:scale(0.96);
212
225
  }
213
- .magritte-animation-enter-center-active___fywwW_9-3-4{
226
+ .magritte-animation-enter-center-active___fywwW_9-4-0{
214
227
  --enter-animation-duration:0;
215
228
  --exit-animation-duration:0;
216
229
  }
217
230
  @media (prefers-reduced-motion: no-preference){
218
- .magritte-animation-enter-center-active___fywwW_9-3-4{
231
+ .magritte-animation-enter-center-active___fywwW_9-4-0{
219
232
  --enter-animation-duration:var(--magritte-semantic-animation-ease-in-out-300-duration-v24-0-1);
220
233
  --exit-animation-duration:var(--magritte-semantic-animation-ease-in-out-200-duration-v24-0-1);
221
234
  }
222
235
  }
223
- .magritte-animation-enter-center-active___fywwW_9-3-4 .magritte-modal___RAW6S_9-3-4,
224
- .magritte-animation-enter-center-active___fywwW_9-3-4.magritte-modal-overlay___lK22l_9-3-4{
236
+ .magritte-animation-enter-center-active___fywwW_9-4-0 .magritte-modal___RAW6S_9-4-0,
237
+ .magritte-animation-enter-center-active___fywwW_9-4-0.magritte-modal-overlay-with-background___ZYsA-_9-4-0{
225
238
  opacity:1;
226
239
  transition-duration:var(--enter-animation-duration);
227
240
  transition-timing-function:var(--magritte-semantic-animation-ease-in-out-300-timing-function-v24-0-1);
228
241
  transform:scale(1);
229
242
  }
230
- .magritte-animation-exit-center___3Fa6x_9-3-4.magritte-modal-overlay___lK22l_9-3-4{
243
+ .magritte-animation-exit-center___3Fa6x_9-4-0.magritte-modal-overlay-with-background___ZYsA-_9-4-0{
231
244
  opacity:1;
232
245
  }
233
- .magritte-animation-exit-center___3Fa6x_9-3-4 .magritte-modal___RAW6S_9-3-4{
246
+ .magritte-animation-exit-center___3Fa6x_9-4-0 .magritte-modal___RAW6S_9-4-0{
234
247
  opacity:1;
235
248
  transform:scale(1);
236
249
  }
237
- .magritte-animation-exit-center-active___tY0UA_9-3-4{
250
+ .magritte-animation-exit-center-active___tY0UA_9-4-0{
238
251
  --enter-animation-duration:0;
239
252
  --exit-animation-duration:0;
240
253
  }
241
254
  @media (prefers-reduced-motion: no-preference){
242
- .magritte-animation-exit-center-active___tY0UA_9-3-4{
255
+ .magritte-animation-exit-center-active___tY0UA_9-4-0{
243
256
  --enter-animation-duration:var(--magritte-semantic-animation-ease-in-out-300-duration-v24-0-1);
244
257
  --exit-animation-duration:var(--magritte-semantic-animation-ease-in-out-200-duration-v24-0-1);
245
258
  }
246
259
  }
247
- .magritte-animation-exit-center-active___tY0UA_9-3-4.magritte-modal-overlay___lK22l_9-3-4{
260
+ .magritte-animation-exit-center-active___tY0UA_9-4-0.magritte-modal-overlay-with-background___ZYsA-_9-4-0{
248
261
  opacity:0;
249
262
  }
250
- .magritte-animation-exit-center-active___tY0UA_9-3-4 .magritte-modal___RAW6S_9-3-4{
263
+ .magritte-animation-exit-center-active___tY0UA_9-4-0 .magritte-modal___RAW6S_9-4-0{
251
264
  opacity:0;
252
265
  transform:scale(0.96);
253
266
  }
254
- .magritte-animation-exit-center-active___tY0UA_9-3-4 .magritte-modal___RAW6S_9-3-4,
255
- .magritte-animation-exit-center-active___tY0UA_9-3-4.magritte-modal-overlay___lK22l_9-3-4{
267
+ .magritte-animation-exit-center-active___tY0UA_9-4-0 .magritte-modal___RAW6S_9-4-0,
268
+ .magritte-animation-exit-center-active___tY0UA_9-4-0.magritte-modal-overlay-with-background___ZYsA-_9-4-0{
256
269
  transition-duration:var(--exit-animation-duration);
257
270
  transition-timing-function:var(--magritte-semantic-animation-ease-in-out-200-timing-function-v24-0-1);
258
271
  }
259
- .magritte-animation-enter-left___5YB8B_9-3-4.magritte-modal-overlay___lK22l_9-3-4{
272
+ .magritte-animation-enter-left___5YB8B_9-4-0.magritte-modal-overlay-with-background___ZYsA-_9-4-0{
260
273
  opacity:0;
261
274
  }
262
- .magritte-animation-enter-left___5YB8B_9-3-4 .magritte-modal___RAW6S_9-3-4{
275
+ .magritte-animation-enter-left___5YB8B_9-4-0 .magritte-modal___RAW6S_9-4-0{
263
276
  opacity:0;
264
277
  transform:translateX(-100%);
265
278
  }
266
- .magritte-animation-enter-left-active___5GK8s_9-3-4{
279
+ .magritte-animation-enter-left-active___5GK8s_9-4-0{
267
280
  --enter-animation-duration:0;
268
281
  --exit-animation-duration:0;
269
282
  }
270
283
  @media (prefers-reduced-motion: no-preference){
271
- .magritte-animation-enter-left-active___5GK8s_9-3-4{
284
+ .magritte-animation-enter-left-active___5GK8s_9-4-0{
272
285
  --enter-animation-duration:var(--magritte-semantic-animation-ease-in-out-300-duration-v24-0-1);
273
286
  --exit-animation-duration:var(--magritte-semantic-animation-ease-in-out-200-duration-v24-0-1);
274
287
  }
275
288
  }
276
- .magritte-animation-enter-left-active___5GK8s_9-3-4 .magritte-modal___RAW6S_9-3-4,
277
- .magritte-animation-enter-left-active___5GK8s_9-3-4.magritte-modal-overlay___lK22l_9-3-4{
289
+ .magritte-animation-enter-left-active___5GK8s_9-4-0 .magritte-modal___RAW6S_9-4-0,
290
+ .magritte-animation-enter-left-active___5GK8s_9-4-0.magritte-modal-overlay-with-background___ZYsA-_9-4-0{
278
291
  opacity:1;
279
292
  transition-duration:var(--enter-animation-duration);
280
293
  transition-timing-function:var(--magritte-semantic-animation-ease-in-out-300-timing-function-v24-0-1);
281
294
  transform:translateX(0);
282
295
  }
283
- .magritte-animation-exit-left___OnkQE_9-3-4.magritte-modal-overlay___lK22l_9-3-4{
296
+ .magritte-animation-exit-left___OnkQE_9-4-0.magritte-modal-overlay-with-background___ZYsA-_9-4-0{
284
297
  opacity:1;
285
298
  }
286
- .magritte-animation-exit-left___OnkQE_9-3-4 .magritte-modal___RAW6S_9-3-4{
299
+ .magritte-animation-exit-left___OnkQE_9-4-0 .magritte-modal___RAW6S_9-4-0{
287
300
  opacity:1;
288
301
  transform:translateX(0);
289
302
  }
290
- .magritte-animation-exit-left-active___AEGxY_9-3-4{
303
+ .magritte-animation-exit-left-active___AEGxY_9-4-0{
291
304
  --enter-animation-duration:0;
292
305
  --exit-animation-duration:0;
293
306
  }
294
307
  @media (prefers-reduced-motion: no-preference){
295
- .magritte-animation-exit-left-active___AEGxY_9-3-4{
308
+ .magritte-animation-exit-left-active___AEGxY_9-4-0{
296
309
  --enter-animation-duration:var(--magritte-semantic-animation-ease-in-out-300-duration-v24-0-1);
297
310
  --exit-animation-duration:var(--magritte-semantic-animation-ease-in-out-200-duration-v24-0-1);
298
311
  }
299
312
  }
300
- .magritte-animation-exit-left-active___AEGxY_9-3-4.magritte-modal-overlay___lK22l_9-3-4{
313
+ .magritte-animation-exit-left-active___AEGxY_9-4-0.magritte-modal-overlay-with-background___ZYsA-_9-4-0{
301
314
  opacity:0;
302
315
  }
303
- .magritte-animation-exit-left-active___AEGxY_9-3-4 .magritte-modal___RAW6S_9-3-4{
316
+ .magritte-animation-exit-left-active___AEGxY_9-4-0 .magritte-modal___RAW6S_9-4-0{
304
317
  opacity:0;
305
318
  transform:translateX(-100%);
306
319
  }
307
- .magritte-animation-exit-left-active___AEGxY_9-3-4 .magritte-modal___RAW6S_9-3-4,
308
- .magritte-animation-exit-left-active___AEGxY_9-3-4.magritte-modal-overlay___lK22l_9-3-4{
320
+ .magritte-animation-exit-left-active___AEGxY_9-4-0 .magritte-modal___RAW6S_9-4-0,
321
+ .magritte-animation-exit-left-active___AEGxY_9-4-0.magritte-modal-overlay-with-background___ZYsA-_9-4-0{
309
322
  transition-duration:var(--exit-animation-duration);
310
323
  transition-timing-function:var(--magritte-semantic-animation-ease-in-out-200-timing-function-v24-0-1);
311
324
  }
312
- .magritte-animation-enter-right___2aXOm_9-3-4.magritte-modal-overlay___lK22l_9-3-4{
325
+ .magritte-animation-enter-right___2aXOm_9-4-0.magritte-modal-overlay-with-background___ZYsA-_9-4-0{
313
326
  opacity:0;
314
327
  }
315
- .magritte-animation-enter-right___2aXOm_9-3-4 .magritte-modal___RAW6S_9-3-4{
328
+ .magritte-animation-enter-right___2aXOm_9-4-0 .magritte-modal___RAW6S_9-4-0{
316
329
  opacity:0;
317
330
  transform:translateX(100%);
318
331
  }
319
- .magritte-animation-enter-right-active___8wX4-_9-3-4{
332
+ .magritte-animation-enter-right-active___8wX4-_9-4-0{
320
333
  --enter-animation-duration:0;
321
334
  --exit-animation-duration:0;
322
335
  }
323
336
  @media (prefers-reduced-motion: no-preference){
324
- .magritte-animation-enter-right-active___8wX4-_9-3-4{
337
+ .magritte-animation-enter-right-active___8wX4-_9-4-0{
325
338
  --enter-animation-duration:var(--magritte-semantic-animation-ease-in-out-300-duration-v24-0-1);
326
339
  --exit-animation-duration:var(--magritte-semantic-animation-ease-in-out-200-duration-v24-0-1);
327
340
  }
328
341
  }
329
- .magritte-animation-enter-right-active___8wX4-_9-3-4 .magritte-modal___RAW6S_9-3-4,
330
- .magritte-animation-enter-right-active___8wX4-_9-3-4.magritte-modal-overlay___lK22l_9-3-4{
342
+ .magritte-animation-enter-right-active___8wX4-_9-4-0 .magritte-modal___RAW6S_9-4-0,
343
+ .magritte-animation-enter-right-active___8wX4-_9-4-0.magritte-modal-overlay-with-background___ZYsA-_9-4-0{
331
344
  opacity:1;
332
345
  transition-duration:var(--enter-animation-duration);
333
346
  transition-timing-function:var(--magritte-semantic-animation-ease-in-out-300-timing-function-v24-0-1);
334
347
  transform:translateX(0);
335
348
  }
336
- .magritte-animation-exit-right___iczoc_9-3-4.magritte-modal-overlay___lK22l_9-3-4{
349
+ .magritte-animation-exit-right___iczoc_9-4-0.magritte-modal-overlay-with-background___ZYsA-_9-4-0{
337
350
  opacity:1;
338
351
  }
339
- .magritte-animation-exit-right___iczoc_9-3-4 .magritte-modal___RAW6S_9-3-4{
352
+ .magritte-animation-exit-right___iczoc_9-4-0 .magritte-modal___RAW6S_9-4-0{
340
353
  opacity:1;
341
354
  transform:translateX(0);
342
355
  }
343
- .magritte-animation-exit-right-active___eFS4O_9-3-4{
356
+ .magritte-animation-exit-right-active___eFS4O_9-4-0{
344
357
  --enter-animation-duration:0;
345
358
  --exit-animation-duration:0;
346
359
  }
347
360
  @media (prefers-reduced-motion: no-preference){
348
- .magritte-animation-exit-right-active___eFS4O_9-3-4{
361
+ .magritte-animation-exit-right-active___eFS4O_9-4-0{
349
362
  --enter-animation-duration:var(--magritte-semantic-animation-ease-in-out-300-duration-v24-0-1);
350
363
  --exit-animation-duration:var(--magritte-semantic-animation-ease-in-out-200-duration-v24-0-1);
351
364
  }
352
365
  }
353
- .magritte-animation-exit-right-active___eFS4O_9-3-4.magritte-modal-overlay___lK22l_9-3-4{
366
+ .magritte-animation-exit-right-active___eFS4O_9-4-0.magritte-modal-overlay-with-background___ZYsA-_9-4-0{
354
367
  opacity:0;
355
368
  }
356
- .magritte-animation-exit-right-active___eFS4O_9-3-4 .magritte-modal___RAW6S_9-3-4{
369
+ .magritte-animation-exit-right-active___eFS4O_9-4-0 .magritte-modal___RAW6S_9-4-0{
357
370
  opacity:0;
358
371
  transform:translateX(100%);
359
372
  }
360
- .magritte-animation-exit-right-active___eFS4O_9-3-4 .magritte-modal___RAW6S_9-3-4,
361
- .magritte-animation-exit-right-active___eFS4O_9-3-4.magritte-modal-overlay___lK22l_9-3-4{
373
+ .magritte-animation-exit-right-active___eFS4O_9-4-0 .magritte-modal___RAW6S_9-4-0,
374
+ .magritte-animation-exit-right-active___eFS4O_9-4-0.magritte-modal-overlay-with-background___ZYsA-_9-4-0{
362
375
  transition-duration:var(--exit-animation-duration);
363
376
  transition-timing-function:var(--magritte-semantic-animation-ease-in-out-200-timing-function-v24-0-1);
364
377
  }
365
- .magritte-content-scroll-preserver___Tw5Px_9-3-4{
378
+ .magritte-content-scroll-preserver___Tw5Px_9-4-0{
366
379
  width:100%;
367
380
  height:0;
368
381
  }
369
- .magritte-tree-selector-container___fdhI-_9-3-4{
382
+ .magritte-tree-selector-container___fdhI-_9-4-0{
370
383
  height:100%;
371
384
  max-width:calc(100% - 24px);
372
385
  max-width:100cqw;
373
386
  --magritte-ui-scrollbar-offset-right:-24px;
374
387
  }
375
- .magritte-content-sticky-container___nqEXj_9-3-4{
388
+ .magritte-content-sticky-container___nqEXj_9-4-0{
376
389
  display:flex;
377
390
  flex-direction:column;
378
391
  position:sticky;
@@ -382,6 +395,6 @@
382
395
  max-width:calc(100% - 24px);
383
396
  max-width:100cqw;
384
397
  }
385
- .magritte-grow-limiter___zeIwy_9-3-4{
398
+ .magritte-grow-limiter___zeIwy_9-4-0{
386
399
  flex:1 0;
387
400
  }
package/index.js CHANGED
@@ -13,7 +13,7 @@ import '@hh.ru/magritte-common-use-no-bubbling';
13
13
  import '@hh.ru/magritte-ui-action-bar';
14
14
  import '@hh.ru/magritte-ui-breakpoint';
15
15
  import '@hh.ru/magritte-ui-layer';
16
- import './ModalContentWithHeader-BgN1dYE-.js';
16
+ import './ModalContentWithHeader-_Kk54Y7Z.js';
17
17
  import '@hh.ru/magritte-common-func-utils';
18
18
  import '@hh.ru/magritte-ui-content-overlay';
19
19
  import '@hh.ru/magritte-ui-divider';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hh.ru/magritte-ui-modal",
3
- "version": "9.3.4",
3
+ "version": "9.4.0",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "sideEffects": [
@@ -28,19 +28,19 @@
28
28
  "@hh.ru/magritte-common-use-no-bubbling": "1.0.6",
29
29
  "@hh.ru/magritte-design-tokens": "24.0.1",
30
30
  "@hh.ru/magritte-internal-layer-name": "3.1.1",
31
- "@hh.ru/magritte-ui-action-bar": "5.0.17",
31
+ "@hh.ru/magritte-ui-action-bar": "5.0.19",
32
32
  "@hh.ru/magritte-ui-breakpoint": "6.0.1",
33
33
  "@hh.ru/magritte-ui-content-overlay": "1.1.0",
34
34
  "@hh.ru/magritte-ui-divider": "3.0.9",
35
- "@hh.ru/magritte-ui-icon": "13.3.0",
35
+ "@hh.ru/magritte-ui-icon": "13.3.1",
36
36
  "@hh.ru/magritte-ui-layer": "3.0.5",
37
37
  "@hh.ru/magritte-ui-mock-component": "1.1.5",
38
38
  "@hh.ru/magritte-ui-progress-bar": "5.0.9",
39
39
  "@hh.ru/magritte-ui-scrollbar": "1.0.7",
40
- "@hh.ru/magritte-ui-textarea": "3.1.12",
40
+ "@hh.ru/magritte-ui-textarea": "3.1.13",
41
41
  "@hh.ru/magritte-ui-theme-wrapper": "1.1.5",
42
42
  "@hh.ru/magritte-ui-title": "7.0.13",
43
- "@hh.ru/magritte-ui-tree-selector": "5.2.12"
43
+ "@hh.ru/magritte-ui-tree-selector": "5.2.13"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "classnames": ">=2.3.2",
@@ -51,5 +51,5 @@
51
51
  "publishConfig": {
52
52
  "access": "public"
53
53
  },
54
- "gitHead": "8a0169936e3009404c090e950b82e6b81efc6bc9"
54
+ "gitHead": "7612a94e1e1e13fc2afe19d0602f6c02a82faa7d"
55
55
  }
package/types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ReactNode, PropsWithChildren, SyntheticEvent } from 'react';
2
2
  import { TitleProps } from '@hh.ru/magritte-ui-title';
3
3
  export type ModalHeight = 'content' | 'full-screen' | number;
4
- export interface ModalHeaderBaseProps {
4
+ export interface ModalHeaderProps {
5
5
  /** Текст заголовка */
6
6
  title?: TitleProps['children'];
7
7
  /** Размер заголовка */
@@ -25,20 +25,6 @@ export interface ModalHeaderBaseProps {
25
25
  headerImage?: ReactNode;
26
26
  /** Высота заголовка в пикселях, если не передан проп headerImageUrl или headerImage, этот проп игнорируется */
27
27
  headerHeight?: number;
28
- /** Колбек, который будет вызван после завершения анимации открытия */
29
- onAppear?: VoidFunction;
30
- /** Колбек, который будет вызван перед началом анимации закрытия */
31
- onBeforeExit?: VoidFunction;
32
- /** Колбек, который будет вызван после анимации закрытия */
33
- onAfterExit?: VoidFunction;
34
- /** Положение компонента на экране, определяет дефолтное значение пропа height */
35
- position?: 'center' | 'left' | 'right';
36
- /** Высота (по контенту, во весь экран или фиксированная в пикселях) */
37
- height?: ModalHeight;
38
- /** Минимальная высота в пикселях. Имеет приоритет перед height. */
39
- minHeight?: number;
40
- }
41
- export interface ModalHeaderAdditionalProps {
42
28
  /** Опциональный контент внизу хедера */
43
29
  options?: ReactNode;
44
30
  /** набор Icon-s внутри хедера */
@@ -46,7 +32,6 @@ export interface ModalHeaderAdditionalProps {
46
32
  /** Link внутри хедера */
47
33
  actionLink?: ReactNode;
48
34
  }
49
- export type ModalHeaderProps = ModalHeaderBaseProps & ModalHeaderAdditionalProps;
50
35
  export interface ModalBaseProps extends PropsWithChildren {
51
36
  /** Обработчик нажатия на кнопку закрытия */
52
37
  onClose?: (event?: SyntheticEvent) => void;
@@ -64,5 +49,21 @@ export interface ModalBaseProps extends PropsWithChildren {
64
49
  disableHorizontalPaddings?: boolean;
65
50
  /** Флаг управляющий закрытием при клике вне Modal */
66
51
  closeByClickOutside?: boolean;
52
+ /** Колбек, который будет вызван после завершения анимации открытия */
53
+ onAppear?: VoidFunction;
54
+ /** Колбек, который будет вызван перед началом анимации закрытия */
55
+ onBeforeExit?: VoidFunction;
56
+ /** Колбек, который будет вызван после анимации закрытия */
57
+ onAfterExit?: VoidFunction;
58
+ /** Высота (по контенту, во весь экран или фиксированная в пикселях) */
59
+ height?: ModalHeight;
60
+ /** Минимальная высота в пикселях. Имеет приоритет перед height. */
61
+ minHeight?: number;
62
+ /** Положение компонента на экране, определяет дефолтное значение пропа height */
63
+ position?: 'center' | 'left' | 'right';
64
+ /** Показывать ли оверлей, применяется только если position=left|right */
65
+ showOverlay?: boolean;
66
+ /** Отступ от верхнего края экрана под навигацию, применяется только если position=left|right и showOverlay=false */
67
+ pageHeaderPadding?: number;
67
68
  }
68
69
  export type ModalProps = ModalBaseProps & ModalHeaderProps;