@skbkontur/react-ui 5.6.8 → 5.6.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/cjs/components/FileUploader/FileUploader.js +2 -1
  3. package/cjs/components/FileUploader/FileUploader.js.map +1 -1
  4. package/cjs/components/FileUploader/FileUploader.styles.d.ts +2 -1
  5. package/cjs/components/FileUploader/FileUploader.styles.js +15 -8
  6. package/cjs/components/FileUploader/FileUploader.styles.js.map +1 -1
  7. package/cjs/internal/CustomComboBox/ComboBoxView.d.ts +1 -4
  8. package/cjs/internal/CustomComboBox/ComboBoxView.js +1 -0
  9. package/cjs/internal/CustomComboBox/ComboBoxView.js.map +1 -1
  10. package/cjs/internal/MobilePopup/MobilePopup.d.ts +3 -0
  11. package/cjs/internal/MobilePopup/MobilePopup.js +20 -2
  12. package/cjs/internal/MobilePopup/MobilePopup.js.map +1 -1
  13. package/cjs/internal/MobilePopup/MobilePopup.styles.js +1 -2
  14. package/cjs/internal/MobilePopup/MobilePopup.styles.js.map +1 -1
  15. package/cjs/internal/Popup/Popup.d.ts +13 -1
  16. package/cjs/internal/Popup/Popup.js +183 -11
  17. package/cjs/internal/Popup/Popup.js.map +1 -1
  18. package/cjs/internal/Popup/PopupHelper.d.ts +25 -0
  19. package/cjs/internal/Popup/PopupHelper.js +116 -4
  20. package/cjs/internal/Popup/PopupHelper.js.map +1 -1
  21. package/components/FileUploader/FileUploader/FileUploader.js +2 -2
  22. package/components/FileUploader/FileUploader/FileUploader.js.map +1 -1
  23. package/components/FileUploader/FileUploader.styles/FileUploader.styles.js +11 -8
  24. package/components/FileUploader/FileUploader.styles/FileUploader.styles.js.map +1 -1
  25. package/components/FileUploader/FileUploader.styles.d.ts +2 -1
  26. package/internal/CustomComboBox/ComboBoxView/ComboBoxView.js +1 -0
  27. package/internal/CustomComboBox/ComboBoxView/ComboBoxView.js.map +1 -1
  28. package/internal/CustomComboBox/ComboBoxView.d.ts +1 -4
  29. package/internal/MobilePopup/MobilePopup/MobilePopup.js +16 -2
  30. package/internal/MobilePopup/MobilePopup/MobilePopup.js.map +1 -1
  31. package/internal/MobilePopup/MobilePopup.d.ts +3 -0
  32. package/internal/MobilePopup/MobilePopup.styles/MobilePopup.styles.js +1 -1
  33. package/internal/MobilePopup/MobilePopup.styles/MobilePopup.styles.js.map +1 -1
  34. package/internal/Popup/Popup/Popup.js +121 -29
  35. package/internal/Popup/Popup/Popup.js.map +1 -1
  36. package/internal/Popup/Popup.d.ts +13 -1
  37. package/internal/Popup/PopupHelper/PopupHelper.js +106 -3
  38. package/internal/Popup/PopupHelper/PopupHelper.js.map +1 -1
  39. package/internal/Popup/PopupHelper.d.ts +25 -0
  40. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":["React","Transition","warning","globalObject","getDOMRect","LayoutEvents","ZIndex","RenderContainer","getRandomID","isFunction","isNonNullable","isNullable","isRefableElement","isIE11","isEdge","ThemeContext","isTestEnv","CommonWrapper","cx","responsiveLayout","MobilePopup","getRootNode","rootNode","isInstanceWithAnchorElement","createPropsGetter","isInstanceOf","getFullReactUIFlagsContext","ReactUIFeatureFlagsContext","mergeRefs","getVisualStateDataAttributes","PopupPinNew","PopupHelper","styles","PopupPin","POPUP_BORDER_DEFAULT_COLOR","TRANSITION_TIMEOUT","enter","exit","PopupNonPinnablePositions","PopupPinnablePositions","PopupPositions","concat","DefaultPosition","DUMMY_LOCATION","position","coordinates","top","left","isFullyVisible","PopupDataTids","root","content","contentInner","popupPin","PopupIds","Popup","_class","_Popup","_React$Component","_this","_len","arguments","length","args","Array","_key","call","apply","getProps","defaultProps","state","location","props","opened","locationUpdateId","refForTransition","createRef","hasAnchorElementListeners","rootId","anchorElement","absoluteParent","renderInPortal","anchor","ref","createElement","isMobileLayout","withoutMobile","renderMobile","renderContent","renderWithoutPortal","EmptyWrapper","updateAbsoluteElement","className","updateAnchorElement","instance","childDomNode","getAnchorElement","removeEventListeners","addEventListeners","handleMouseEnter","event","onMouseEnter","handleMouseLeave","onMouseLeave","handleClick","onClick","handleFocus","onFocus","handleBlur","onBlur","calculateWidth","width","includes","anchorWidth","replace","percent","parseFloat","children","backgroundColor","_this$getProps","minWidth","theme","refPopupContentElement","style","prepareDataVisualState","_this$state$location","_getVisualStateDataAt","attrName","resetLocation","cancelDelayedUpdateLocation","setState","element","lastPopupContentElement","handleLayoutEvent","updateLocation","popupContentElement","getLocation","onPositionChange","locationEquals","getRelativeShift","_this2","disablePortal","rect","getElementAbsoluteRect","_inheritsLoose","_proto","prototype","componentDidMount","layoutEventsToken","addListener","getDerivedStateFromProps","componentDidUpdate","prevProps","prevState","hadNoLocation","hasLocation","wasClosed","onOpen","onClose","delayUpdateLocation","componentWillUnmount","remove","render","_this3","Consumer","flags","featureFlags","renderMain","renderChildren","rootNodeRef","setRootNode","withoutRenderContainer","onCloseRequest","mobileOnCloseRequest","_anchor","useWrapper","Element","isValidElement","anchorWithRef","cloneElement","canGetAnchorNode","renderRef","renderAnchor","addEventListener","removeEventListener","_this4","_this$props","maxWidth","_this$getProps2","hasShadow","disableAnimations","ignoreHover","relativeShift","_PopupHelper$getPosit","getPositionObject","direction","rootStyle","timeout","appear","Boolean","mountOnEnter","unmountOnExit","onExited","nodeRef","_this4$props$id","_extends2","_ref","_extends","id","priority","popup","shadow","popupIgnoreHover","transitionEnter","transitionEnterActive","transitionExit","renderPin","positionName","isDefaultBorderColor","popupBorderColor","pinBorder","_this$props2","pinSize","borderColor","_this$getProps3","hasPin","popupFixPinTearing","popupElement","popupPosition","size","parseInt","popupPinSize","offset","getPinOffset","align","popupBackground","borderWidth","requestAnimationFrame","cancelAnimationFrame","x","y","Math","abs","reorderPropsPositionsWithPriorityPos","positions","pos_","pos","index","findIndex","startsWith","join","slice","_this$getProps4","tryPreserveFirstRenderedPosition","anchorRect","popupRect","getCoordinates","canBecomeVisible","canBecomeFullyVisible","_iterator","_createForOfIteratorHelperLoose","_step","done","value","getPinnedPopupOffset","test","anchorSize","height","max","marginFromProps","margin","isNaN","popupMargin","popupOffset","getHorizontalPosition","getVerticalPosition","Error","pinOffset","popupPinOffsetY","popupPinOffsetX","Component","__KONTUR_REACT_UI__","displayName","priorities","defaultRootNode","_React$Component2","_proto2"],"sources":["Popup.tsx"],"sourcesContent":["import type { HTMLAttributes, LegacyRef } from 'react';\nimport React from 'react';\nimport { Transition } from 'react-transition-group';\nimport warning from 'warning';\nimport { globalObject } from '@skbkontur/global-object';\n\nimport { getDOMRect } from '../../lib/dom/getDOMRect';\nimport type { Nullable } from '../../typings/utility-types';\nimport * as LayoutEvents from '../../lib/LayoutEvents';\nimport type { Priority } from '../ZIndex';\nimport { ZIndex } from '../ZIndex';\nimport { RenderContainer } from '../RenderContainer';\nimport type { FocusEventType, MouseEventType } from '../../typings/event-types';\nimport { getRandomID, isFunction, isNonNullable, isNullable, isRefableElement } from '../../lib/utils';\nimport { isIE11, isEdge } from '../../lib/client';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport type { Theme } from '../../lib/theming/Theme';\nimport { isTestEnv } from '../../lib/currentEnvironment';\nimport type { CommonProps } from '../CommonWrapper';\nimport { CommonWrapper } from '../CommonWrapper';\nimport { cx } from '../../lib/theming/Emotion';\nimport { responsiveLayout } from '../../components/ResponsiveLayout/decorator';\nimport { MobilePopup } from '../MobilePopup';\nimport type { TGetRootNode, TSetRootNode } from '../../lib/rootNode';\nimport { getRootNode, rootNode } from '../../lib/rootNode';\nimport { isInstanceWithAnchorElement } from '../../lib/InstanceWithAnchorElement';\nimport { createPropsGetter } from '../../lib/createPropsGetter';\nimport { isInstanceOf } from '../../lib/isInstanceOf';\nimport type { ReactUIFeatureFlags } from '../../lib/featureFlagsContext';\nimport { getFullReactUIFlagsContext, ReactUIFeatureFlagsContext } from '../../lib/featureFlagsContext';\nimport { mergeRefs } from '../../lib/mergeRefs';\nimport { getVisualStateDataAttributes } from '../CommonWrapper/utils/getVisualStateDataAttributes';\n\nimport { PopupPinNew } from './PopupPinNew';\nimport type { Offset, PositionObject, Rect } from './PopupHelper';\nimport { PopupHelper } from './PopupHelper';\nimport { styles } from './Popup.styles';\nimport { PopupPin } from './PopupPin';\n\nconst POPUP_BORDER_DEFAULT_COLOR = 'transparent';\nconst TRANSITION_TIMEOUT = { enter: 0, exit: 200 };\n\nexport const PopupNonPinnablePositions = ['middle center', 'middle left', 'middle right'];\n\nexport const PopupPinnablePositions = [\n 'top center',\n 'top left',\n 'top right',\n 'bottom center',\n 'bottom left',\n 'bottom right',\n 'left middle',\n 'left top',\n 'left bottom',\n 'right middle',\n 'right top',\n 'right bottom',\n];\n\nexport const PopupPositions = [...PopupPinnablePositions, ...PopupNonPinnablePositions] as const;\n\nexport const DefaultPosition = PopupPositions[0];\n\nexport type PopupPositionsType = (typeof PopupPositions)[number];\nexport type PopupPinnablePositionsType = (typeof PopupPinnablePositions)[number];\nexport type ShortPopupPositionsType = 'top' | 'bottom' | 'left' | 'right';\n\nexport const DUMMY_LOCATION: PopupLocation = {\n position: DefaultPosition,\n coordinates: {\n top: -9999,\n left: -9999,\n },\n isFullyVisible: false,\n};\n\nexport interface PopupHandlerProps {\n onMouseEnter?: (event: MouseEventType) => void;\n onMouseLeave?: (event: MouseEventType) => void;\n onClick?: (event: MouseEventType) => void;\n onFocus?: (event: FocusEventType) => void;\n onBlur?: (event: FocusEventType) => void;\n onOpen?: () => void;\n onClose?: () => void;\n}\n\nexport interface PopupProps\n extends Omit<CommonProps, 'children'>,\n PopupHandlerProps,\n Pick<HTMLAttributes<HTMLDivElement>, 'id'> {\n /**\n * Ссылка (ref) на элемент или React компонент, для которого рисуется попап\n */\n anchorElement: React.ReactNode | Element;\n /**\n * Фон попапа и пина\n */\n backgroundColor?: React.CSSProperties['backgroundColor'];\n borderColor?: React.CSSProperties['borderColor'];\n children: React.ReactNode | (() => React.ReactNode);\n /**\n * Показывать ли пин\n */\n hasPin?: boolean;\n /**\n * Применять ли box-shadow на попапе. При false отключает границу на пине\n */\n hasShadow?: boolean;\n disableAnimations?: boolean;\n /**\n * Отступ попапа от элемента\n */\n margin?: number;\n maxWidth?: number | string;\n /**\n * Показан или скрыт попап\n */\n opened: boolean;\n /**\n * Смещение пина от края попапа. Край задаётся в пропе position вторым словом\n */\n pinOffset?: number;\n /**\n * Сторона пина без учёта границы.\n * Пин представляет собой равносторонний треугольник, высота от попапа\n * до \"носика\" пина будет соответствовать формуле (size* √3)/2\n */\n pinSize?: number;\n /**\n * смещение попапа относительно родительского элемента\n */\n popupOffset?: number;\n priority?: Priority;\n /**\n * С какой стороны показывать попап и край попапа,\n * на котором будет отображаться пин\n */\n positions?: Readonly<PopupPositionsType[]>;\n /**\n * Приоритетная позиция попапа\n */\n pos?: PopupPositionsType | ShortPopupPositionsType;\n /**\n * Явно указывает, что вложенные элементы должны быть обёрнуты в `<span/>`. <br/> Используется для корректного позиционирования тултипа при двух и более вложенных элементах.\n *\n * _Примечание_: при **двух и более** вложенных элементах обёртка будет добавлена автоматически.\n */\n useWrapper?: boolean;\n /**\n * Игнорировать ли события hover/click\n */\n ignoreHover?: boolean;\n width?: React.CSSProperties['width'];\n minWidth?: React.CSSProperties['minWidth'];\n /**\n * При очередном рендере пытаться сохранить первоначальную позицию попапа\n * (в том числе, когда он выходит за пределы экрана, но может быть проскролен в него).\n *\n * Нужен только для Tooltip. В остальных случаях позиция перестраивается автоматически.\n * @see https://github.com/skbkontur/retail-ui/pull/1195\n */\n tryPreserveFirstRenderedPosition?: boolean;\n withoutMobile?: boolean;\n /** @ignore */\n disablePortal?: boolean;\n mobileOnCloseRequest?: () => void;\n /**\n * Возвращает текущую позицию попапа\n */\n onPositionChange?: (pos: PopupPositionsType, isFullyVisible: boolean) => void;\n}\n\ninterface PopupLocation {\n coordinates: {\n left: number;\n top: number;\n };\n position: PopupPositionsType;\n isFullyVisible: boolean;\n}\n\nexport interface PopupState {\n location: Nullable<PopupLocation>;\n}\n\nexport const PopupDataTids = {\n root: 'Popup__root',\n content: 'PopupContent',\n contentInner: 'PopupContentInner',\n popupPin: 'PopupPin__root',\n} as const;\n\nexport const PopupIds = {\n root: PopupDataTids.root,\n};\n\ntype DefaultProps = Required<\n Pick<\n PopupProps,\n | 'popupOffset'\n | 'hasPin'\n | 'hasShadow'\n | 'disablePortal'\n | 'disableAnimations'\n | 'useWrapper'\n | 'ignoreHover'\n | 'width'\n | 'priority'\n >\n>;\n\n@responsiveLayout\n@rootNode\nexport class Popup extends React.Component<PopupProps, PopupState> {\n public static __KONTUR_REACT_UI__ = 'Popup';\n public static displayName = 'Popup';\n\n public static defaultProps: DefaultProps = {\n popupOffset: 0,\n hasPin: false,\n hasShadow: false,\n disableAnimations: isTestEnv,\n useWrapper: false,\n ignoreHover: false,\n disablePortal: false,\n width: 'auto',\n priority: ZIndex.priorities.Popup,\n };\n\n private getProps = createPropsGetter(Popup.defaultProps);\n\n // see #2873 and #2895\n public static readonly defaultRootNode = null;\n\n public state: PopupState = { location: this.props.opened ? DUMMY_LOCATION : null };\n private theme!: Theme;\n public featureFlags!: ReactUIFeatureFlags;\n private layoutEventsToken: Nullable<ReturnType<typeof LayoutEvents.addListener>>;\n private locationUpdateId: Nullable<number> = null;\n private lastPopupContentElement: Nullable<Element>;\n private isMobileLayout!: boolean;\n public getRootNode!: TGetRootNode;\n private setRootNode!: TSetRootNode;\n private refForTransition = React.createRef<HTMLDivElement>();\n private hasAnchorElementListeners = false;\n private rootId = PopupIds.root + getRandomID();\n\n public anchorElement: Nullable<Element> = null;\n private absoluteParent: Nullable<HTMLDivElement> = null;\n\n public componentDidMount() {\n this.updateLocation();\n this.layoutEventsToken = LayoutEvents.addListener(this.handleLayoutEvent);\n\n if (!this.hasAnchorElementListeners) {\n this.addEventListeners(this.anchorElement);\n }\n }\n\n public static getDerivedStateFromProps(props: Readonly<PopupProps>, state: PopupState) {\n /**\n * Delaying updateLocation to ensure it happens after props update\n */\n if (props.opened) {\n if (!state.location) {\n return { location: DUMMY_LOCATION };\n }\n } else if (state.location) {\n return { location: DUMMY_LOCATION };\n }\n return state;\n }\n\n public componentDidUpdate(prevProps: PopupProps, prevState: PopupState) {\n const hadNoLocation = prevState.location === DUMMY_LOCATION;\n const hasLocation = this.state.location !== DUMMY_LOCATION;\n const wasClosed = prevProps.opened && !this.props.opened;\n\n if (this.isMobileLayout && prevState.location === null && this.state.location === null) {\n this.setState({ location: DUMMY_LOCATION });\n }\n\n if (this.props.opened && hadNoLocation && hasLocation && this.props.onOpen) {\n this.props.onOpen();\n }\n if (wasClosed && !hasLocation && this.props.onClose) {\n this.props.onClose();\n }\n if (this.props.opened) {\n this.delayUpdateLocation();\n }\n }\n\n public componentWillUnmount() {\n this.cancelDelayedUpdateLocation();\n if (this.hasAnchorElementListeners) {\n this.removeEventListeners(this.anchorElement);\n }\n if (this.layoutEventsToken) {\n this.layoutEventsToken.remove();\n this.layoutEventsToken = null;\n }\n if (this.state.location && this.props.onClose) {\n this.props.onClose();\n }\n }\n\n public render() {\n return (\n <ReactUIFeatureFlagsContext.Consumer>\n {(flags) => {\n this.featureFlags = getFullReactUIFlagsContext(flags);\n return (\n <ThemeContext.Consumer>\n {(theme) => {\n this.theme = theme;\n return this.renderMain();\n }}\n </ThemeContext.Consumer>\n );\n }}\n </ReactUIFeatureFlagsContext.Consumer>\n );\n }\n\n private renderMobile() {\n const { opened } = this.props;\n const children = this.renderChildren();\n\n return children ? (\n <CommonWrapper rootNodeRef={this.setRootNode}>\n <MobilePopup opened={opened} withoutRenderContainer onCloseRequest={this.props.mobileOnCloseRequest}>\n {this.content(children)}\n </MobilePopup>\n </CommonWrapper>\n ) : null;\n }\n\n private renderMain() {\n const { anchorElement } = this.props;\n const useWrapper = this.getProps().useWrapper;\n\n let anchor: Nullable<React.ReactNode> = null;\n if (isInstanceOf(anchorElement, globalObject.Element)) {\n this.updateAnchorElement(anchorElement);\n } else if (React.isValidElement(anchorElement)) {\n anchor = useWrapper ? <span>{anchorElement}</span> : anchorElement;\n } else {\n anchor = <span>{anchorElement}</span>;\n }\n\n const anchorWithRef =\n anchor && React.isValidElement(anchor) && isRefableElement(anchor)\n ? React.cloneElement(anchor, {\n ref: mergeRefs(\n (anchor as React.RefAttributes<typeof anchor>)?.ref as React.RefCallback<any>,\n this.updateAnchorElement,\n ),\n } as { ref: (instance: Nullable<React.ReactInstance>) => void })\n : null;\n // we need to get anchor's DOM node\n // so we either set our own ref on it via cloning\n // or relay on findDOMNode (inside getRootNode)\n // which should be called within updateAnchorElement\n // in the case when the anchor is not refable\n\n const canGetAnchorNode = !!anchorWithRef || isInstanceOf(anchorElement, globalObject.Element);\n const renderRef = canGetAnchorNode ? null : this.updateAnchorElement;\n const renderAnchor = anchorWithRef || anchor;\n\n return this.props.disablePortal\n ? this.renderWithoutPortal(renderAnchor, renderRef)\n : this.renderInPortal(renderAnchor, renderRef);\n }\n\n private renderInPortal = (anchor: React.ReactNode, ref: null | LegacyRef<RenderContainer>) => {\n const { location } = this.state;\n\n return (\n <RenderContainer anchor={anchor} ref={ref}>\n {this.isMobileLayout && !this.props.withoutMobile\n ? this.renderMobile()\n : location && this.renderContent(location)}\n </RenderContainer>\n );\n };\n\n private renderWithoutPortal = (anchor: React.ReactNode, ref: null | LegacyRef<EmptyWrapper>) => {\n const { location } = this.state;\n\n return (\n <EmptyWrapper ref={ref}>\n {anchor}\n {location && (\n <div ref={this.updateAbsoluteElement} className={styles.absoluteParent()}>\n {this.renderContent(location)}\n </div>\n )}\n </EmptyWrapper>\n );\n };\n\n private updateAnchorElement = (instance: Nullable<React.ReactInstance>) => {\n const childDomNode = isInstanceWithAnchorElement(instance) ? instance.getAnchorElement() : getRootNode(instance);\n const anchorElement = this.anchorElement;\n\n if (childDomNode !== anchorElement) {\n this.removeEventListeners(anchorElement);\n this.anchorElement = childDomNode;\n this.addEventListeners(childDomNode);\n }\n };\n\n private updateAbsoluteElement = (instance: HTMLDivElement) => {\n this.absoluteParent = instance;\n };\n\n private addEventListeners(element: Nullable<Element>) {\n if (element && isInstanceOf(element, globalObject.Element)) {\n // @ts-expect-error: Type ElementEventMap is missing events: https://github.com/skbkontur/retail-ui/pull/2946#discussion_r931072657\n element.addEventListener('mouseenter', this.handleMouseEnter);\n // @ts-expect-error: See the comment above\n element.addEventListener('mouseleave', this.handleMouseLeave);\n // @ts-expect-error: See the comment above\n element.addEventListener('click', this.handleClick);\n element.addEventListener('focusin', this.handleFocus as EventListener);\n element.addEventListener('focusout', this.handleBlur as EventListener);\n\n this.hasAnchorElementListeners = true;\n }\n }\n\n private removeEventListeners(element: Nullable<Element>) {\n if (element && isInstanceOf(element, globalObject.Element)) {\n // @ts-expect-error: Type ElementEventMap is missing events: https://github.com/skbkontur/retail-ui/pull/2946#discussion_r931072657\n element.removeEventListener('mouseenter', this.handleMouseEnter);\n // @ts-expect-error: See the comment above\n element.removeEventListener('mouseleave', this.handleMouseLeave);\n // @ts-expect-error: See the comment above\n element.removeEventListener('click', this.handleClick);\n element.removeEventListener('focusin', this.handleFocus as EventListener);\n element.removeEventListener('focusout', this.handleBlur as EventListener);\n\n this.hasAnchorElementListeners = false;\n }\n }\n\n private handleMouseEnter = (event: MouseEventType) => {\n if (this.props.onMouseEnter) {\n this.props.onMouseEnter(event);\n }\n };\n\n private handleMouseLeave = (event: MouseEventType) => {\n if (this.props.onMouseLeave) {\n this.props.onMouseLeave(event);\n }\n };\n\n private handleClick = (event: MouseEventType) => {\n if (this.props.onClick) {\n this.props.onClick(event);\n }\n };\n\n private handleFocus = (event: FocusEventType) => {\n if (this.props.onFocus) {\n this.props.onFocus(event);\n }\n };\n\n private handleBlur = (event: FocusEventType) => {\n if (this.props.onBlur) {\n this.props.onBlur(event);\n }\n };\n\n private calculateWidth = (width: PopupProps['width']) => {\n if (typeof width === 'string' && width.includes('%')) {\n const anchorWidth = getDOMRect(this.anchorElement).width;\n\n return width.replace(/(\\d)+%/g, (percent: string) => `${(anchorWidth * parseFloat(percent)) / 100}px`);\n }\n return width;\n };\n\n private content = (children: React.ReactNode) => {\n const { backgroundColor } = this.props;\n const { width, minWidth } = this.getProps();\n\n return (\n <div\n className={styles.content(this.theme)}\n data-tid={PopupDataTids.content}\n ref={mergeRefs(this.refForTransition, this.refPopupContentElement)}\n >\n <div\n className={styles.contentInner(this.theme)}\n style={{ backgroundColor, width: this.calculateWidth(width), minWidth: this.calculateWidth(minWidth) }}\n data-tid={PopupDataTids.contentInner}\n >\n {children}\n </div>\n </div>\n );\n };\n\n private renderContent(location: PopupLocation) {\n const { maxWidth, opened } = this.props;\n const { hasShadow, disableAnimations, ignoreHover } = this.getProps();\n const children = this.renderChildren();\n\n const relativeShift = this.getRelativeShift();\n const { direction } = PopupHelper.getPositionObject(location.position);\n const rootStyle: React.CSSProperties = {\n maxWidth,\n top: location.coordinates.top + relativeShift.top,\n left: location.coordinates.left + relativeShift.left,\n };\n\n return (\n <Transition\n timeout={TRANSITION_TIMEOUT}\n appear={!disableAnimations}\n in={Boolean(opened && children)}\n mountOnEnter\n unmountOnExit\n enter={!disableAnimations}\n exit={!disableAnimations}\n onExited={this.resetLocation}\n nodeRef={this.refForTransition}\n >\n {(state: string) => (\n <CommonWrapper {...this.props} rootNodeRef={this.setRootNode} {...this.prepareDataVisualState()}>\n <ZIndex\n id={this.props.id ?? this.rootId}\n data-tid={PopupDataTids.root}\n priority={this.props.priority}\n className={cx({\n [styles.popup(this.theme)]: true,\n [styles.shadow(this.theme)]: hasShadow,\n [styles.popupIgnoreHover()]: ignoreHover,\n ...(disableAnimations\n ? {}\n : {\n [styles[`transition-enter-${direction}` as keyof typeof styles](this.theme)]: true,\n [styles.transitionEnter()]: state === 'entering',\n [styles.transitionEnterActive()]: state === 'entered',\n [styles.transitionExit()]: state === 'exiting',\n }),\n })}\n style={rootStyle}\n onMouseEnter={this.handleMouseEnter}\n onMouseLeave={this.handleMouseLeave}\n >\n {this.content(children)}\n {(!this.isMobileLayout || this.props.withoutMobile) && this.renderPin(location.position)}\n </ZIndex>\n </CommonWrapper>\n )}\n </Transition>\n );\n }\n\n private prepareDataVisualState = () => {\n const position = this.state.location?.position;\n if (position) {\n const attrName = `position-` + position.replace(' ', '-');\n return getVisualStateDataAttributes({ [attrName]: true });\n }\n return {};\n };\n\n private resetLocation = () => {\n this.cancelDelayedUpdateLocation();\n this.state.location !== null && this.setState({ location: null });\n };\n\n private renderChildren() {\n return isFunction(this.props.children) ? this.props.children() : this.props.children;\n }\n\n private refPopupContentElement = (element: HTMLDivElement) => {\n this.lastPopupContentElement = element;\n };\n\n private renderPin(positionName: string): React.ReactNode {\n const isDefaultBorderColor = this.theme.popupBorderColor === POPUP_BORDER_DEFAULT_COLOR;\n const pinBorder = isIE11 && isDefaultBorderColor ? 'rgba(0, 0, 0, 0.09)' : this.theme.popupBorderColor;\n\n const { pinSize, backgroundColor, borderColor } = this.props;\n const { hasShadow, hasPin } = this.getProps();\n const position = PopupHelper.getPositionObject(positionName);\n\n return (\n hasPin &&\n !PopupNonPinnablePositions.includes(positionName) &&\n (this.featureFlags.popupFixPinTearing ? (\n <PopupPinNew\n popupElement={this.lastPopupContentElement}\n popupPosition={positionName}\n size={pinSize || parseInt(this.theme.popupPinSize)}\n offset={this.getPinOffset(position.align)}\n backgroundColor={backgroundColor || this.theme.popupBackground}\n />\n ) : (\n <PopupPin\n popupElement={this.lastPopupContentElement}\n popupPosition={positionName}\n size={pinSize || parseInt(this.theme.popupPinSize)}\n offset={this.getPinOffset(position.align)}\n borderWidth={hasShadow ? 1 : 0}\n backgroundColor={backgroundColor || this.theme.popupBackground}\n borderColor={borderColor || pinBorder}\n />\n ))\n );\n }\n\n private handleLayoutEvent = () => {\n if (!this.state.location) {\n return;\n }\n this.updateLocation();\n };\n\n private delayUpdateLocation() {\n this.cancelDelayedUpdateLocation();\n this.locationUpdateId = globalObject.requestAnimationFrame?.(this.updateLocation);\n }\n\n private cancelDelayedUpdateLocation() {\n if (this.locationUpdateId) {\n globalObject.cancelAnimationFrame?.(this.locationUpdateId);\n this.locationUpdateId = null;\n }\n }\n\n private updateLocation = () => {\n const popupContentElement = this.lastPopupContentElement;\n\n if (!popupContentElement) {\n return;\n }\n\n const location = this.getLocation(popupContentElement, this.state.location);\n if (location) {\n this.props.onPositionChange?.(location.position, location.isFullyVisible);\n }\n\n if (!this.locationEquals(this.state.location, location)) {\n this.setState({ location });\n }\n };\n\n private locationEquals(x: Nullable<PopupLocation>, y: Nullable<PopupLocation>) {\n if (x === y) {\n return true;\n }\n\n if (isNullable(x) || isNullable(y)) {\n return false;\n }\n\n if (!isIE11 && !isEdge) {\n return (\n x.coordinates.left === y.coordinates.left &&\n x.coordinates.top === y.coordinates.top &&\n x.position === y.position\n );\n }\n\n // Для ie/edge обновляем позицию только при разнице минимум в 1. Иначе есть вероятность\n // уйти в бесконечный ререндер\n\n return (\n x.position === y.position &&\n Math.abs(x.coordinates.top - y.coordinates.top) <= 1 &&\n Math.abs(x.coordinates.left - y.coordinates.left) <= 1\n );\n }\n\n private reorderPropsPositionsWithPriorityPos() {\n const positions = this.props.positions ? this.props.positions : PopupPinnablePositions;\n let pos_ = '';\n if (this.props.pos) {\n pos_ = this.props.pos;\n } else {\n pos_ = positions[0];\n }\n const index = positions.findIndex((position) => position.startsWith(pos_));\n if (index === -1) {\n warning(false, 'Unexpected position ' + pos_ + ' passed to Popup. Expected one of: ' + positions.join(', '));\n return positions;\n }\n return [...positions.slice(index), ...positions.slice(0, index)];\n }\n\n private getLocation(popupElement: Element, location?: Nullable<PopupLocation>): Nullable<PopupLocation> {\n const { tryPreserveFirstRenderedPosition } = this.getProps();\n const positions = this.reorderPropsPositionsWithPriorityPos();\n\n const anchorElement = this.anchorElement;\n\n warning(\n anchorElement && isInstanceOf(anchorElement, globalObject.Element),\n 'Anchor element is not defined or not instance of Element',\n );\n\n if (!(anchorElement && isInstanceOf(anchorElement, globalObject.Element))) {\n return location;\n }\n\n const anchorRect = PopupHelper.getElementAbsoluteRect(anchorElement);\n const popupRect = PopupHelper.getElementAbsoluteRect(popupElement);\n\n let position: PopupPositionsType;\n let coordinates: Offset;\n\n if (location && location !== DUMMY_LOCATION && location.position) {\n position = location.position;\n coordinates = this.getCoordinates(anchorRect, popupRect, position);\n\n const isFullyVisible = PopupHelper.isFullyVisible(coordinates, popupRect);\n const canBecomeVisible = !isFullyVisible && PopupHelper.canBecomeFullyVisible(position, coordinates);\n\n if (\n // если нужно сохранить первоначальную позицию и Попап целиком\n // находится в пределах вьюпорта (или может быть проскроллен в него)\n (tryPreserveFirstRenderedPosition && (isFullyVisible || canBecomeVisible)) ||\n // если Попап целиком во вьюпорте и в самой приоритетной позиции\n // (иначе нужно попытаться позицию сменить)\n (isFullyVisible && position === positions[0])\n ) {\n // сохраняем текущую позицию\n return { coordinates, position, isFullyVisible: true };\n }\n }\n\n for (position of positions) {\n coordinates = this.getCoordinates(anchorRect, popupRect, position);\n if (PopupHelper.isFullyVisible(coordinates, popupRect)) {\n return { coordinates, position, isFullyVisible: true };\n }\n }\n\n position = positions[0];\n coordinates = this.getCoordinates(anchorRect, popupRect, position);\n\n return { coordinates, position, isFullyVisible: false };\n }\n\n private getPinnedPopupOffset(anchorRect: Rect, position: PositionObject) {\n if (!this.getProps().hasPin || /center|middle/.test(position.align)) {\n return 0;\n }\n\n const anchorSize = /top|bottom/.test(position.direction) ? anchorRect.width : anchorRect.height;\n\n const { pinSize } = this.props;\n\n return Math.max(\n 0,\n this.getPinOffset(position.align) + (pinSize || parseInt(this.theme.popupPinSize)) - anchorSize / 2,\n );\n }\n\n private getRelativeShift = () => {\n const { absoluteParent } = this;\n\n if (!this.props.disablePortal || !absoluteParent) {\n return {\n top: 0,\n left: 0,\n };\n }\n\n const rect = PopupHelper.getElementAbsoluteRect(absoluteParent);\n\n return {\n top: -rect.top,\n left: -rect.left,\n };\n };\n\n private getCoordinates(anchorRect: Rect, popupRect: Rect, positionName: string) {\n const { margin: marginFromProps } = this.props;\n const margin =\n isNonNullable(marginFromProps) && !isNaN(marginFromProps)\n ? marginFromProps\n : parseInt(this.theme.popupMargin) || 0;\n const position = PopupHelper.getPositionObject(positionName);\n const popupOffset = this.getProps().popupOffset + this.getPinnedPopupOffset(anchorRect, position);\n\n switch (position.direction) {\n case 'top':\n return {\n top: anchorRect.top - popupRect.height - margin,\n left: this.getHorizontalPosition(anchorRect, popupRect, position.align, popupOffset),\n };\n case 'middle':\n return {\n top: anchorRect.top + anchorRect.height / 2 - popupRect.height / 2,\n left: this.getHorizontalPosition(anchorRect, popupRect, position.align, popupOffset),\n };\n case 'bottom':\n return {\n top: anchorRect.top + anchorRect.height + margin,\n left: this.getHorizontalPosition(anchorRect, popupRect, position.align, popupOffset),\n };\n case 'left':\n return {\n top: this.getVerticalPosition(anchorRect, popupRect, position.align, popupOffset),\n left: anchorRect.left - popupRect.width - margin,\n };\n case 'right':\n return {\n top: this.getVerticalPosition(anchorRect, popupRect, position.align, popupOffset),\n left: anchorRect.left + anchorRect.width + margin,\n };\n default:\n throw new Error(`Unexpected direction '${position.direction}'`);\n }\n }\n\n private getPinOffset(align: string) {\n const { pinOffset } = this.props;\n\n switch (align) {\n case 'top':\n case 'bottom':\n return pinOffset || parseInt(this.theme.popupPinOffsetY);\n case 'left':\n case 'right':\n return pinOffset || parseInt(this.theme.popupPinOffsetX);\n case 'center':\n case 'middle':\n return 0;\n default:\n throw new Error(`Unexpected align '${align}'`);\n }\n }\n\n private getHorizontalPosition(anchorRect: Rect, popupRect: Rect, align: string, popupOffset: number) {\n switch (align) {\n case 'left':\n return anchorRect.left - popupOffset;\n case 'center':\n return anchorRect.left - (popupRect.width - anchorRect.width) / 2;\n case 'right':\n return anchorRect.left - (popupRect.width - anchorRect.width) + popupOffset;\n default:\n throw new Error(`Unexpected align '${align}'`);\n }\n }\n\n private getVerticalPosition(anchorRect: Rect, popupRect: Rect, align: string, popupOffset: number) {\n switch (align) {\n case 'top':\n return anchorRect.top - popupOffset;\n case 'middle':\n return anchorRect.top - (popupRect.height - anchorRect.height) / 2;\n case 'bottom':\n return anchorRect.top - (popupRect.height - anchorRect.height) + popupOffset;\n default:\n throw new Error(`Unexpected align '${align}'`);\n }\n }\n}\n\n// Нужно, чтобы получать по рефу dom-элемент, в который зарендерится anchor\ntype EmptyWrapperProps = Readonly<{\n children: React.ReactNode;\n}>;\n\nclass EmptyWrapper extends React.Component<EmptyWrapperProps> {\n public render() {\n return this.props.children;\n }\n}\n"],"mappings":";AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAQ,wBAAwB;AACnD,OAAOC,OAAO,MAAM,SAAS;AAC7B,SAASC,YAAY,QAAQ,0BAA0B;;AAEvD,SAASC,UAAU,QAAQ,0BAA0B;;AAErD,OAAO,KAAKC,YAAY,MAAM,wBAAwB;;AAEtD,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,eAAe,QAAQ,oBAAoB;;AAEpD,SAASC,WAAW,EAAEC,UAAU,EAAEC,aAAa,EAAEC,UAAU,EAAEC,gBAAgB,QAAQ,iBAAiB;AACtG,SAASC,MAAM,EAAEC,MAAM,QAAQ,kBAAkB;AACjD,SAASC,YAAY,QAAQ,gCAAgC;;AAE7D,SAASC,SAAS,QAAQ,8BAA8B;;AAExD,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,EAAE,QAAQ,2BAA2B;AAC9C,SAASC,gBAAgB,QAAQ,6CAA6C;AAC9E,SAASC,WAAW,QAAQ,gBAAgB;;AAE5C,SAASC,WAAW,EAAEC,QAAQ,QAAQ,oBAAoB;AAC1D,SAASC,2BAA2B,QAAQ,qCAAqC;AACjF,SAASC,iBAAiB,QAAQ,6BAA6B;AAC/D,SAASC,YAAY,QAAQ,wBAAwB;;AAErD,SAASC,0BAA0B,EAAEC,0BAA0B,QAAQ,+BAA+B;AACtG,SAASC,SAAS,QAAQ,qBAAqB;AAC/C,SAASC,4BAA4B,QAAQ,qDAAqD;;AAElG,SAASC,WAAW,QAAQ,eAAe;;AAE3C,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,MAAM,QAAQ,gBAAgB;AACvC,SAASC,QAAQ,QAAQ,YAAY;;AA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AAO,EAAAjO,MAAA,CAErBY,YAAY,GAAiB,EACzC4M,WAAW,EAAE,CAAC,EACdhD,MAAM,EAAE,KAAK,EACbpC,SAAS,EAAE,KAAK,EAChBC,iBAAiB,EAAE9K,SAAS,EAC5B+J,UAAU,EAAE,KAAK,EACjBgB,WAAW,EAAE,KAAK,EAClBlD,aAAa,EAAE,KAAK,EACpB9B,KAAK,EAAE,MAAM,EACbkG,QAAQ,EAAE3M,MAAM,CAACqR,UAAU,CAACpO,KAAK,CACnC,CAAC,EAAAE,MAAA,CAKsBmO,eAAe,GAAG,IAAI,EAAAnO,MAAA,MAAAD,MAAA,KAAAA,MAAA;;;AA8nB/C;AAAA;;;;AAKMkC,YAAY,0BAAAmM,iBAAA,YAAAnM,aAAA,UAAAmM,iBAAA,CAAA1N,KAAA,OAAAN,SAAA,WAAAmF,cAAA,CAAAtD,YAAA,EAAAmM,iBAAA,MAAAC,OAAA,GAAApM,YAAA,CAAAwD,SAAA,CAAA4I,OAAA;EACT5H,MAAM,GAAb,SAAAA,OAAA,EAAgB;IACd,OAAO,IAAI,CAAC1F,KAAK,CAAC6C,QAAQ;EAC5B,CAAC,QAAA3B,YAAA,GAHwB1F,KAAK,CAACwR,SAAS","ignoreList":[]}
1
+ {"version":3,"names":["React","Transition","warning","globalObject","getDOMRect","LayoutEvents","ZIndex","RenderContainer","getRandomID","isFunction","isNonNullable","isNullable","isRefableElement","isIE11","isEdge","ThemeContext","isTestEnv","CommonWrapper","cx","responsiveLayout","MobilePopup","getRootNode","rootNode","isInstanceWithAnchorElement","createPropsGetter","isInstanceOf","getFullReactUIFlagsContext","ReactUIFeatureFlagsContext","mergeRefs","getVisualStateDataAttributes","PopupPinNew","PopupHelper","styles","PopupPin","POPUP_BORDER_DEFAULT_COLOR","TRANSITION_TIMEOUT","enter","exit","PopupNonPinnablePositions","PopupPinnablePositions","PopupPositions","concat","DefaultPosition","DUMMY_LOCATION","position","coordinates","top","left","isFullyVisible","PopupDataTids","root","content","contentInner","popupPin","PopupIds","Popup","_class","_Popup","_React$Component","_this","_len","arguments","length","args","Array","_key","call","apply","getProps","defaultProps","state","location","props","opened","locationUpdateId","refForTransition","createRef","hasAnchorElementListeners","rootId","anchorElement","absoluteParent","renderInPortal","anchor","ref","createElement","isMobileLayout","withoutMobile","renderMobile","renderContent","renderWithoutPortal","EmptyWrapper","updateAbsoluteElement","className","updateAnchorElement","instance","childDomNode","getAnchorElement","removeEventListeners","addEventListeners","handleMouseEnter","event","onMouseEnter","handleMouseLeave","onMouseLeave","handleClick","onClick","handleFocus","onFocus","handleBlur","onBlur","calculateWidth","width","includes","anchorWidth","replace","percent","parseFloat","children","backgroundColor","_this$getProps","minWidth","theme","refPopupContentElement","style","prepareDataVisualState","_this$state$location","_getVisualStateDataAt","attrName","resetLocation","cancelDelayedUpdateLocation","setState","element","lastPopupContentElement","handleLayoutEvent","updateLocation","popupContentElement","getLocation","onPositionChange","locationEquals","getRelativeShift","_this2","disablePortal","rect","getElementAbsoluteRect","_inheritsLoose","_proto","prototype","componentDidMount","layoutEventsToken","addListener","getDerivedStateFromProps","componentDidUpdate","prevProps","prevState","hadNoLocation","hasLocation","wasClosed","onOpen","onClose","delayUpdateLocation","componentWillUnmount","remove","render","_this3","Consumer","flags","featureFlags","renderMain","renderChildren","rootNodeRef","setRootNode","withoutRenderContainer","onCloseRequest","mobileOnCloseRequest","_anchor","useWrapper","Element","isValidElement","anchorWithRef","cloneElement","canGetAnchorNode","renderRef","renderAnchor","addEventListener","removeEventListener","_this4","_this$props","maxWidth","_this$getProps2","hasShadow","disableAnimations","ignoreHover","relativeShift","_PopupHelper$getPosit","getPositionObject","direction","rootStyle","timeout","appear","Boolean","mountOnEnter","unmountOnExit","onExited","nodeRef","_this4$props$id","_extends2","_ref","_extends","id","priority","popup","shadow","popupIgnoreHover","transitionEnter","transitionEnterActive","transitionExit","renderPin","positionName","isDefaultBorderColor","popupBorderColor","pinBorder","_this$props2","pinSize","borderColor","_this$getProps3","hasPin","popupFixPinTearing","popupElement","popupPosition","size","parseInt","popupPinSize","offset","getPinOffset","align","popupBackground","borderWidth","requestAnimationFrame","cancelAnimationFrame","x","y","Math","abs","getOrderedPositions","positions","pos_","pos","index","findIndex","startsWith","join","slice","_this$getProps4","tryBestFallbackPosition","anchorRect","popupRect","reusedLocation","tryReuseCurrentLocation","fullyVisibleLocation","tryGetFirstFullyVisibleLocation","getFallbackLocation","_this$getProps5","tryPreserveFirstRenderedPosition","getCoordinates","canBecomeVisible","canBecomeFullyVisible","shouldReuseCurrentLocation","_iterator","_createForOfIteratorHelperLoose","_step","done","value","pickBestFallbackPosition","_this5","defaultPosition","coords","overflow","getOverflowEdges","preferredDirection","getPreferredDirection","preferredAlignOrder","right","candidates","getOrderedFallbackCandidates","positionsSet","Set","viewport","getViewportAbsoluteRect","evaluatedCandidates","map","evaluateFallbackCandidate","bestAreaCandidate","pickBestAreaCandidate","bestOverflowCandidate","pickBestOverflowCandidate","visibleArea","popupAbsolute","height","overlapWidth","min","max","overlapHeight","visibleWidth","visibleHeight","isAreaEligible","overflowCount","getOverflowCount","bestCandidate","_iterator2","_step2","candidate","isBetterArea","has","_iterator3","_step3","isBetterOverflow","getPinnedPopupOffset","test","anchorSize","marginFromProps","margin","isNaN","popupMargin","popupOffset","getHorizontalPosition","getVerticalPosition","Error","pinOffset","popupPinOffsetY","popupPinOffsetX","Component","__KONTUR_REACT_UI__","displayName","priorities","defaultRootNode","_React$Component2","_proto2"],"sources":["Popup.tsx"],"sourcesContent":["import type { HTMLAttributes, LegacyRef } from 'react';\nimport React from 'react';\nimport { Transition } from 'react-transition-group';\nimport warning from 'warning';\nimport { globalObject } from '@skbkontur/global-object';\n\nimport { getDOMRect } from '../../lib/dom/getDOMRect';\nimport type { Nullable } from '../../typings/utility-types';\nimport * as LayoutEvents from '../../lib/LayoutEvents';\nimport type { Priority } from '../ZIndex';\nimport { ZIndex } from '../ZIndex';\nimport { RenderContainer } from '../RenderContainer';\nimport type { FocusEventType, MouseEventType } from '../../typings/event-types';\nimport { getRandomID, isFunction, isNonNullable, isNullable, isRefableElement } from '../../lib/utils';\nimport { isIE11, isEdge } from '../../lib/client';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport type { Theme } from '../../lib/theming/Theme';\nimport { isTestEnv } from '../../lib/currentEnvironment';\nimport type { CommonProps } from '../CommonWrapper';\nimport { CommonWrapper } from '../CommonWrapper';\nimport { cx } from '../../lib/theming/Emotion';\nimport { responsiveLayout } from '../../components/ResponsiveLayout/decorator';\nimport { MobilePopup } from '../MobilePopup';\nimport type { TGetRootNode, TSetRootNode } from '../../lib/rootNode';\nimport { getRootNode, rootNode } from '../../lib/rootNode';\nimport { isInstanceWithAnchorElement } from '../../lib/InstanceWithAnchorElement';\nimport { createPropsGetter } from '../../lib/createPropsGetter';\nimport { isInstanceOf } from '../../lib/isInstanceOf';\nimport type { ReactUIFeatureFlags } from '../../lib/featureFlagsContext';\nimport { getFullReactUIFlagsContext, ReactUIFeatureFlagsContext } from '../../lib/featureFlagsContext';\nimport { mergeRefs } from '../../lib/mergeRefs';\nimport { getVisualStateDataAttributes } from '../CommonWrapper/utils/getVisualStateDataAttributes';\n\nimport { PopupPinNew } from './PopupPinNew';\nimport type { Offset, PositionObject, Rect } from './PopupHelper';\nimport { PopupHelper } from './PopupHelper';\nimport { styles } from './Popup.styles';\nimport { PopupPin } from './PopupPin';\n\nconst POPUP_BORDER_DEFAULT_COLOR = 'transparent';\nconst TRANSITION_TIMEOUT = { enter: 0, exit: 200 };\n\nexport const PopupNonPinnablePositions = ['middle center', 'middle left', 'middle right'];\n\nexport const PopupPinnablePositions = [\n 'top center',\n 'top left',\n 'top right',\n 'bottom center',\n 'bottom left',\n 'bottom right',\n 'left middle',\n 'left top',\n 'left bottom',\n 'right middle',\n 'right top',\n 'right bottom',\n];\n\nexport const PopupPositions = [...PopupPinnablePositions, ...PopupNonPinnablePositions] as const;\n\nexport const DefaultPosition = PopupPositions[0];\n\nexport type PopupPositionsType = (typeof PopupPositions)[number];\nexport type PopupPinnablePositionsType = (typeof PopupPinnablePositions)[number];\nexport type ShortPopupPositionsType = 'top' | 'bottom' | 'left' | 'right';\n\nexport const DUMMY_LOCATION: PopupLocation = {\n position: DefaultPosition,\n coordinates: {\n top: -9999,\n left: -9999,\n },\n isFullyVisible: false,\n};\n\nexport interface PopupHandlerProps {\n onMouseEnter?: (event: MouseEventType) => void;\n onMouseLeave?: (event: MouseEventType) => void;\n onClick?: (event: MouseEventType) => void;\n onFocus?: (event: FocusEventType) => void;\n onBlur?: (event: FocusEventType) => void;\n onOpen?: () => void;\n onClose?: () => void;\n}\n\nexport interface PopupProps\n extends Omit<CommonProps, 'children'>,\n PopupHandlerProps,\n Pick<HTMLAttributes<HTMLDivElement>, 'id'> {\n /**\n * Ссылка (ref) на элемент или React компонент, для которого рисуется попап\n */\n anchorElement: React.ReactNode | Element;\n /**\n * Фон попапа и пина\n */\n backgroundColor?: React.CSSProperties['backgroundColor'];\n borderColor?: React.CSSProperties['borderColor'];\n children: React.ReactNode | (() => React.ReactNode);\n /**\n * Показывать ли пин\n */\n hasPin?: boolean;\n /**\n * Применять ли box-shadow на попапе. При false отключает границу на пине\n */\n hasShadow?: boolean;\n disableAnimations?: boolean;\n /**\n * Отступ попапа от элемента\n */\n margin?: number;\n maxWidth?: number | string;\n /**\n * Показан или скрыт попап\n */\n opened: boolean;\n /**\n * Смещение пина от края попапа. Край задаётся в пропе position вторым словом\n */\n pinOffset?: number;\n /**\n * Сторона пина без учёта границы.\n * Пин представляет собой равносторонний треугольник, высота от попапа\n * до \"носика\" пина будет соответствовать формуле (size* √3)/2\n */\n pinSize?: number;\n /**\n * смещение попапа относительно родительского элемента\n */\n popupOffset?: number;\n priority?: Priority;\n /**\n * С какой стороны показывать попап и край попапа,\n * на котором будет отображаться пин\n */\n positions?: Readonly<PopupPositionsType[]>;\n /**\n * Приоритетная позиция попапа\n */\n pos?: PopupPositionsType | ShortPopupPositionsType;\n /**\n * Явно указывает, что вложенные элементы должны быть обёрнуты в `<span/>`. <br/> Используется для корректного позиционирования тултипа при двух и более вложенных элементах.\n *\n * _Примечание_: при **двух и более** вложенных элементах обёртка будет добавлена автоматически.\n */\n useWrapper?: boolean;\n /**\n * Игнорировать ли события hover/click\n */\n ignoreHover?: boolean;\n width?: React.CSSProperties['width'];\n minWidth?: React.CSSProperties['minWidth'];\n /**\n * При очередном рендере пытаться сохранить первоначальную позицию попапа\n * (в том числе, когда он выходит за пределы экрана, но может быть проскролен в него).\n *\n * Нужен только для Tooltip. В остальных случаях позиция перестраивается автоматически.\n * @see https://github.com/skbkontur/retail-ui/pull/1195\n */\n tryPreserveFirstRenderedPosition?: boolean;\n /**\n * Включает поиск наиболее подходящей позиции попапа, если ни одна заданная позиция попапа не влезает во вьюпорт.\n * Выбирается позиция с наибольшей видимой площадью.\n */\n tryBestFallbackPosition?: boolean;\n withoutMobile?: boolean;\n /** @ignore */\n disablePortal?: boolean;\n mobileOnCloseRequest?: () => void;\n /**\n * Возвращает текущую позицию попапа\n */\n onPositionChange?: (pos: PopupPositionsType, isFullyVisible: boolean) => void;\n}\n\ninterface PopupLocation {\n coordinates: {\n left: number;\n top: number;\n };\n position: PopupPositionsType;\n isFullyVisible: boolean;\n}\n\nexport interface PopupState {\n location: Nullable<PopupLocation>;\n}\n\ninterface FallbackCandidateEvaluation {\n position: PopupPositionsType;\n coordinates: Offset;\n overflowCount: number;\n visibleArea: number;\n isFullyVisible: boolean;\n isAreaEligible: boolean;\n}\n\nexport const PopupDataTids = {\n root: 'Popup__root',\n content: 'PopupContent',\n contentInner: 'PopupContentInner',\n popupPin: 'PopupPin__root',\n} as const;\n\nexport const PopupIds = {\n root: PopupDataTids.root,\n};\n\ntype DefaultProps = Required<\n Pick<\n PopupProps,\n | 'popupOffset'\n | 'hasPin'\n | 'hasShadow'\n | 'disablePortal'\n | 'disableAnimations'\n | 'useWrapper'\n | 'ignoreHover'\n | 'width'\n | 'priority'\n >\n>;\n\n@responsiveLayout\n@rootNode\nexport class Popup extends React.Component<PopupProps, PopupState> {\n public static __KONTUR_REACT_UI__ = 'Popup';\n public static displayName = 'Popup';\n\n public static defaultProps: DefaultProps = {\n popupOffset: 0,\n hasPin: false,\n hasShadow: false,\n disableAnimations: isTestEnv,\n useWrapper: false,\n ignoreHover: false,\n disablePortal: false,\n width: 'auto',\n priority: ZIndex.priorities.Popup,\n };\n\n private getProps = createPropsGetter(Popup.defaultProps);\n\n // see #2873 and #2895\n public static readonly defaultRootNode = null;\n\n public state: PopupState = { location: this.props.opened ? DUMMY_LOCATION : null };\n private theme!: Theme;\n public featureFlags!: ReactUIFeatureFlags;\n private layoutEventsToken: Nullable<ReturnType<typeof LayoutEvents.addListener>>;\n private locationUpdateId: Nullable<number> = null;\n private lastPopupContentElement: Nullable<Element>;\n private isMobileLayout!: boolean;\n public getRootNode!: TGetRootNode;\n private setRootNode!: TSetRootNode;\n private refForTransition = React.createRef<HTMLDivElement>();\n private hasAnchorElementListeners = false;\n private rootId = PopupIds.root + getRandomID();\n\n public anchorElement: Nullable<Element> = null;\n private absoluteParent: Nullable<HTMLDivElement> = null;\n\n public componentDidMount() {\n this.updateLocation();\n this.layoutEventsToken = LayoutEvents.addListener(this.handleLayoutEvent);\n\n if (!this.hasAnchorElementListeners) {\n this.addEventListeners(this.anchorElement);\n }\n }\n\n public static getDerivedStateFromProps(props: Readonly<PopupProps>, state: PopupState) {\n /**\n * Delaying updateLocation to ensure it happens after props update\n */\n if (props.opened) {\n if (!state.location) {\n return { location: DUMMY_LOCATION };\n }\n } else if (state.location) {\n return { location: DUMMY_LOCATION };\n }\n return state;\n }\n\n public componentDidUpdate(prevProps: PopupProps, prevState: PopupState) {\n const hadNoLocation = prevState.location === DUMMY_LOCATION;\n const hasLocation = this.state.location !== DUMMY_LOCATION;\n const wasClosed = prevProps.opened && !this.props.opened;\n\n if (this.isMobileLayout && prevState.location === null && this.state.location === null) {\n this.setState({ location: DUMMY_LOCATION });\n }\n\n if (this.props.opened && hadNoLocation && hasLocation && this.props.onOpen) {\n this.props.onOpen();\n }\n if (wasClosed && !hasLocation && this.props.onClose) {\n this.props.onClose();\n }\n if (this.props.opened) {\n this.delayUpdateLocation();\n }\n }\n\n public componentWillUnmount() {\n this.cancelDelayedUpdateLocation();\n if (this.hasAnchorElementListeners) {\n this.removeEventListeners(this.anchorElement);\n }\n if (this.layoutEventsToken) {\n this.layoutEventsToken.remove();\n this.layoutEventsToken = null;\n }\n if (this.state.location && this.props.onClose) {\n this.props.onClose();\n }\n }\n\n public render() {\n return (\n <ReactUIFeatureFlagsContext.Consumer>\n {(flags) => {\n this.featureFlags = getFullReactUIFlagsContext(flags);\n return (\n <ThemeContext.Consumer>\n {(theme) => {\n this.theme = theme;\n return this.renderMain();\n }}\n </ThemeContext.Consumer>\n );\n }}\n </ReactUIFeatureFlagsContext.Consumer>\n );\n }\n\n private renderMobile() {\n const { opened } = this.props;\n const children = this.renderChildren();\n\n return children ? (\n <CommonWrapper rootNodeRef={this.setRootNode}>\n <MobilePopup opened={opened} withoutRenderContainer onCloseRequest={this.props.mobileOnCloseRequest}>\n {this.content(children)}\n </MobilePopup>\n </CommonWrapper>\n ) : null;\n }\n\n private renderMain() {\n const { anchorElement } = this.props;\n const useWrapper = this.getProps().useWrapper;\n\n let anchor: Nullable<React.ReactNode> = null;\n if (isInstanceOf(anchorElement, globalObject.Element)) {\n this.updateAnchorElement(anchorElement);\n } else if (React.isValidElement(anchorElement)) {\n anchor = useWrapper ? <span>{anchorElement}</span> : anchorElement;\n } else {\n anchor = <span>{anchorElement}</span>;\n }\n\n const anchorWithRef =\n anchor && React.isValidElement(anchor) && isRefableElement(anchor)\n ? React.cloneElement(anchor, {\n ref: mergeRefs(\n (anchor as React.RefAttributes<typeof anchor>)?.ref as React.RefCallback<any>,\n this.updateAnchorElement,\n ),\n } as { ref: (instance: Nullable<React.ReactInstance>) => void })\n : null;\n // we need to get anchor's DOM node\n // so we either set our own ref on it via cloning\n // or relay on findDOMNode (inside getRootNode)\n // which should be called within updateAnchorElement\n // in the case when the anchor is not refable\n\n const canGetAnchorNode = !!anchorWithRef || isInstanceOf(anchorElement, globalObject.Element);\n const renderRef = canGetAnchorNode ? null : this.updateAnchorElement;\n const renderAnchor = anchorWithRef || anchor;\n\n return this.props.disablePortal\n ? this.renderWithoutPortal(renderAnchor, renderRef)\n : this.renderInPortal(renderAnchor, renderRef);\n }\n\n private renderInPortal = (anchor: React.ReactNode, ref: null | LegacyRef<RenderContainer>) => {\n const { location } = this.state;\n\n return (\n <RenderContainer anchor={anchor} ref={ref}>\n {this.isMobileLayout && !this.props.withoutMobile\n ? this.renderMobile()\n : location && this.renderContent(location)}\n </RenderContainer>\n );\n };\n\n private renderWithoutPortal = (anchor: React.ReactNode, ref: null | LegacyRef<EmptyWrapper>) => {\n const { location } = this.state;\n\n return (\n <EmptyWrapper ref={ref}>\n {anchor}\n {location && (\n <div ref={this.updateAbsoluteElement} className={styles.absoluteParent()}>\n {this.renderContent(location)}\n </div>\n )}\n </EmptyWrapper>\n );\n };\n\n private updateAnchorElement = (instance: Nullable<React.ReactInstance>) => {\n const childDomNode = isInstanceWithAnchorElement(instance) ? instance.getAnchorElement() : getRootNode(instance);\n const anchorElement = this.anchorElement;\n\n if (childDomNode !== anchorElement) {\n this.removeEventListeners(anchorElement);\n this.anchorElement = childDomNode;\n this.addEventListeners(childDomNode);\n }\n };\n\n private updateAbsoluteElement = (instance: HTMLDivElement) => {\n this.absoluteParent = instance;\n };\n\n private addEventListeners(element: Nullable<Element>) {\n if (element && isInstanceOf(element, globalObject.Element)) {\n // @ts-expect-error: Type ElementEventMap is missing events: https://github.com/skbkontur/retail-ui/pull/2946#discussion_r931072657\n element.addEventListener('mouseenter', this.handleMouseEnter);\n // @ts-expect-error: See the comment above\n element.addEventListener('mouseleave', this.handleMouseLeave);\n // @ts-expect-error: See the comment above\n element.addEventListener('click', this.handleClick);\n element.addEventListener('focusin', this.handleFocus as EventListener);\n element.addEventListener('focusout', this.handleBlur as EventListener);\n\n this.hasAnchorElementListeners = true;\n }\n }\n\n private removeEventListeners(element: Nullable<Element>) {\n if (element && isInstanceOf(element, globalObject.Element)) {\n // @ts-expect-error: Type ElementEventMap is missing events: https://github.com/skbkontur/retail-ui/pull/2946#discussion_r931072657\n element.removeEventListener('mouseenter', this.handleMouseEnter);\n // @ts-expect-error: See the comment above\n element.removeEventListener('mouseleave', this.handleMouseLeave);\n // @ts-expect-error: See the comment above\n element.removeEventListener('click', this.handleClick);\n element.removeEventListener('focusin', this.handleFocus as EventListener);\n element.removeEventListener('focusout', this.handleBlur as EventListener);\n\n this.hasAnchorElementListeners = false;\n }\n }\n\n private handleMouseEnter = (event: MouseEventType) => {\n if (this.props.onMouseEnter) {\n this.props.onMouseEnter(event);\n }\n };\n\n private handleMouseLeave = (event: MouseEventType) => {\n if (this.props.onMouseLeave) {\n this.props.onMouseLeave(event);\n }\n };\n\n private handleClick = (event: MouseEventType) => {\n if (this.props.onClick) {\n this.props.onClick(event);\n }\n };\n\n private handleFocus = (event: FocusEventType) => {\n if (this.props.onFocus) {\n this.props.onFocus(event);\n }\n };\n\n private handleBlur = (event: FocusEventType) => {\n if (this.props.onBlur) {\n this.props.onBlur(event);\n }\n };\n\n private calculateWidth = (width: PopupProps['width']) => {\n if (typeof width === 'string' && width.includes('%')) {\n const anchorWidth = getDOMRect(this.anchorElement).width;\n\n return width.replace(/(\\d)+%/g, (percent: string) => `${(anchorWidth * parseFloat(percent)) / 100}px`);\n }\n return width;\n };\n\n private content = (children: React.ReactNode) => {\n const { backgroundColor } = this.props;\n const { width, minWidth } = this.getProps();\n\n return (\n <div\n className={styles.content(this.theme)}\n data-tid={PopupDataTids.content}\n ref={mergeRefs(this.refForTransition, this.refPopupContentElement)}\n >\n <div\n className={styles.contentInner(this.theme)}\n style={{ backgroundColor, width: this.calculateWidth(width), minWidth: this.calculateWidth(minWidth) }}\n data-tid={PopupDataTids.contentInner}\n >\n {children}\n </div>\n </div>\n );\n };\n\n private renderContent(location: PopupLocation) {\n const { maxWidth, opened } = this.props;\n const { hasShadow, disableAnimations, ignoreHover } = this.getProps();\n const children = this.renderChildren();\n\n const relativeShift = this.getRelativeShift();\n const { direction } = PopupHelper.getPositionObject(location.position);\n const rootStyle: React.CSSProperties = {\n maxWidth,\n top: location.coordinates.top + relativeShift.top,\n left: location.coordinates.left + relativeShift.left,\n };\n\n return (\n <Transition\n timeout={TRANSITION_TIMEOUT}\n appear={!disableAnimations}\n in={Boolean(opened && children)}\n mountOnEnter\n unmountOnExit\n enter={!disableAnimations}\n exit={!disableAnimations}\n onExited={this.resetLocation}\n nodeRef={this.refForTransition}\n >\n {(state: string) => (\n <CommonWrapper {...this.props} rootNodeRef={this.setRootNode} {...this.prepareDataVisualState()}>\n <ZIndex\n id={this.props.id ?? this.rootId}\n data-tid={PopupDataTids.root}\n priority={this.props.priority}\n className={cx({\n [styles.popup(this.theme)]: true,\n [styles.shadow(this.theme)]: hasShadow,\n [styles.popupIgnoreHover()]: ignoreHover,\n ...(disableAnimations\n ? {}\n : {\n [styles[`transition-enter-${direction}` as keyof typeof styles](this.theme)]: true,\n [styles.transitionEnter()]: state === 'entering',\n [styles.transitionEnterActive()]: state === 'entered',\n [styles.transitionExit()]: state === 'exiting',\n }),\n })}\n style={rootStyle}\n onMouseEnter={this.handleMouseEnter}\n onMouseLeave={this.handleMouseLeave}\n >\n {this.content(children)}\n {(!this.isMobileLayout || this.props.withoutMobile) && this.renderPin(location.position)}\n </ZIndex>\n </CommonWrapper>\n )}\n </Transition>\n );\n }\n\n private prepareDataVisualState = () => {\n const position = this.state.location?.position;\n if (position) {\n const attrName = `position-` + position.replace(' ', '-');\n return getVisualStateDataAttributes({ [attrName]: true });\n }\n return {};\n };\n\n private resetLocation = () => {\n this.cancelDelayedUpdateLocation();\n this.state.location !== null && this.setState({ location: null });\n };\n\n private renderChildren() {\n return isFunction(this.props.children) ? this.props.children() : this.props.children;\n }\n\n private refPopupContentElement = (element: HTMLDivElement) => {\n this.lastPopupContentElement = element;\n };\n\n private renderPin(positionName: string): React.ReactNode {\n const isDefaultBorderColor = this.theme.popupBorderColor === POPUP_BORDER_DEFAULT_COLOR;\n const pinBorder = isIE11 && isDefaultBorderColor ? 'rgba(0, 0, 0, 0.09)' : this.theme.popupBorderColor;\n\n const { pinSize, backgroundColor, borderColor } = this.props;\n const { hasShadow, hasPin } = this.getProps();\n const position = PopupHelper.getPositionObject(positionName);\n\n return (\n hasPin &&\n !PopupNonPinnablePositions.includes(positionName) &&\n (this.featureFlags.popupFixPinTearing ? (\n <PopupPinNew\n popupElement={this.lastPopupContentElement}\n popupPosition={positionName}\n size={pinSize || parseInt(this.theme.popupPinSize)}\n offset={this.getPinOffset(position.align)}\n backgroundColor={backgroundColor || this.theme.popupBackground}\n />\n ) : (\n <PopupPin\n popupElement={this.lastPopupContentElement}\n popupPosition={positionName}\n size={pinSize || parseInt(this.theme.popupPinSize)}\n offset={this.getPinOffset(position.align)}\n borderWidth={hasShadow ? 1 : 0}\n backgroundColor={backgroundColor || this.theme.popupBackground}\n borderColor={borderColor || pinBorder}\n />\n ))\n );\n }\n\n private handleLayoutEvent = () => {\n if (!this.state.location) {\n return;\n }\n this.updateLocation();\n };\n\n private delayUpdateLocation() {\n this.cancelDelayedUpdateLocation();\n this.locationUpdateId = globalObject.requestAnimationFrame?.(this.updateLocation);\n }\n\n private cancelDelayedUpdateLocation() {\n if (this.locationUpdateId) {\n globalObject.cancelAnimationFrame?.(this.locationUpdateId);\n this.locationUpdateId = null;\n }\n }\n\n private updateLocation = () => {\n const popupContentElement = this.lastPopupContentElement;\n\n if (!popupContentElement) {\n return;\n }\n\n const location = this.getLocation(popupContentElement, this.state.location);\n if (location) {\n this.props.onPositionChange?.(location.position, location.isFullyVisible);\n }\n\n if (!this.locationEquals(this.state.location, location)) {\n this.setState({ location });\n }\n };\n\n private locationEquals(x: Nullable<PopupLocation>, y: Nullable<PopupLocation>) {\n if (x === y) {\n return true;\n }\n\n if (isNullable(x) || isNullable(y)) {\n return false;\n }\n\n if (!isIE11 && !isEdge) {\n return (\n x.coordinates.left === y.coordinates.left &&\n x.coordinates.top === y.coordinates.top &&\n x.position === y.position\n );\n }\n\n // Для ie/edge обновляем позицию только при разнице минимум в 1. Иначе есть вероятность\n // уйти в бесконечный ререндер\n\n return (\n x.position === y.position &&\n Math.abs(x.coordinates.top - y.coordinates.top) <= 1 &&\n Math.abs(x.coordinates.left - y.coordinates.left) <= 1\n );\n }\n\n private getOrderedPositions() {\n const positions = this.props.positions ? this.props.positions : PopupPinnablePositions;\n let pos_ = '';\n if (this.props.pos) {\n pos_ = this.props.pos;\n } else {\n pos_ = positions[0];\n }\n const index = positions.findIndex((position) => position.startsWith(pos_));\n if (index === -1) {\n warning(false, 'Unexpected position ' + pos_ + ' passed to Popup. Expected one of: ' + positions.join(', '));\n return positions;\n }\n return [...positions.slice(index), ...positions.slice(0, index)];\n }\n\n private getLocation(popupElement: Element, location?: Nullable<PopupLocation>): Nullable<PopupLocation> {\n const { tryBestFallbackPosition } = this.getProps();\n const positions = this.getOrderedPositions();\n\n const anchorElement = this.anchorElement;\n\n warning(\n anchorElement && isInstanceOf(anchorElement, globalObject.Element),\n 'Anchor element is not defined or not instance of Element',\n );\n\n if (!(anchorElement && isInstanceOf(anchorElement, globalObject.Element))) {\n return location;\n }\n\n const anchorRect = PopupHelper.getElementAbsoluteRect(anchorElement);\n const popupRect = PopupHelper.getElementAbsoluteRect(popupElement);\n\n const reusedLocation = this.tryReuseCurrentLocation(location, positions, anchorRect, popupRect);\n if (reusedLocation) {\n return reusedLocation;\n }\n\n const fullyVisibleLocation = this.tryGetFirstFullyVisibleLocation(positions, anchorRect, popupRect);\n if (fullyVisibleLocation) {\n return fullyVisibleLocation;\n }\n\n return this.getFallbackLocation(positions, anchorRect, popupRect, Boolean(tryBestFallbackPosition));\n }\n\n private tryReuseCurrentLocation(\n location: Nullable<PopupLocation> | undefined,\n positions: Readonly<PopupPositionsType[]>,\n anchorRect: Rect,\n popupRect: Rect,\n ): Nullable<PopupLocation> {\n const { tryPreserveFirstRenderedPosition } = this.getProps();\n\n if (!(location && location !== DUMMY_LOCATION && location.position)) {\n return null;\n }\n\n const position = location.position;\n const coordinates = this.getCoordinates(anchorRect, popupRect, position);\n const isFullyVisible = PopupHelper.isFullyVisible(coordinates, popupRect);\n const canBecomeVisible = !isFullyVisible && PopupHelper.canBecomeFullyVisible(position, coordinates);\n const shouldReuseCurrentLocation =\n // если нужно сохранить первоначальную позицию и Попап целиком\n // находится в пределах вьюпорта (или может быть проскроллен в него)\n (tryPreserveFirstRenderedPosition && (isFullyVisible || canBecomeVisible)) ||\n // если Попап целиком во вьюпорте и в самой приоритетной позиции\n // (иначе нужно попытаться позицию сменить)\n (isFullyVisible && position === positions[0]);\n\n if (!shouldReuseCurrentLocation) {\n return null;\n }\n\n return { coordinates, position, isFullyVisible: true };\n }\n\n private tryGetFirstFullyVisibleLocation(\n positions: Readonly<PopupPositionsType[]>,\n anchorRect: Rect,\n popupRect: Rect,\n ): Nullable<PopupLocation> {\n for (const position of positions) {\n const coordinates = this.getCoordinates(anchorRect, popupRect, position);\n if (PopupHelper.isFullyVisible(coordinates, popupRect)) {\n return { coordinates, position, isFullyVisible: true };\n }\n }\n\n return null;\n }\n\n private getFallbackLocation(\n positions: Readonly<PopupPositionsType[]>,\n anchorRect: Rect,\n popupRect: Rect,\n tryBestFallbackPosition: boolean,\n ): PopupLocation {\n const position = tryBestFallbackPosition\n ? this.pickBestFallbackPosition(positions, anchorRect, popupRect)\n : positions[0];\n const coordinates = this.getCoordinates(anchorRect, popupRect, position);\n\n return { coordinates, position, isFullyVisible: PopupHelper.isFullyVisible(coordinates, popupRect) };\n }\n\n private pickBestFallbackPosition(\n positions: Readonly<PopupPositionsType[]>,\n anchorRect: Rect,\n popupRect: Rect,\n ): PopupPositionsType {\n const defaultPosition = positions[0];\n const coords = this.getCoordinates(anchorRect, popupRect, defaultPosition);\n const overflow = PopupHelper.getOverflowEdges(coords, popupRect);\n const preferredDirection = PopupHelper.getPreferredDirection(overflow, defaultPosition);\n const preferredAlignOrder =\n overflow.left || overflow.right ? ['right', 'center', 'left'] : ['center', 'left', 'right'];\n const candidates = PopupHelper.getOrderedFallbackCandidates(\n positions,\n overflow,\n preferredDirection,\n preferredAlignOrder,\n PopupPinnablePositions,\n );\n const positionsSet = new Set(positions);\n const viewport = PopupHelper.getViewportAbsoluteRect();\n const evaluatedCandidates = candidates.map((position) =>\n this.evaluateFallbackCandidate(position, anchorRect, popupRect, viewport),\n );\n const bestAreaCandidate = this.pickBestAreaCandidate(evaluatedCandidates, positionsSet);\n const bestOverflowCandidate = this.pickBestOverflowCandidate(evaluatedCandidates, positionsSet);\n\n // Если есть хотя бы одна позиция с ненулевой видимой площадью,\n // выбираем её (с приоритетом полностью видимых вариантов).\n // Иначе — используем старую эвристику по количеству переполненных сторон.\n return bestAreaCandidate && bestAreaCandidate.visibleArea > 0\n ? bestAreaCandidate.position\n : bestOverflowCandidate.position;\n }\n\n private evaluateFallbackCandidate(\n position: PopupPositionsType,\n anchorRect: Rect,\n popupRect: Rect,\n viewport: Rect,\n ): FallbackCandidateEvaluation {\n const coordinates = this.getCoordinates(anchorRect, popupRect, position);\n const popupAbsolute = {\n top: coordinates.top,\n left: coordinates.left,\n width: popupRect.width,\n height: popupRect.height,\n };\n const overlapWidth =\n Math.min(popupAbsolute.left + popupAbsolute.width, viewport.left + viewport.width) -\n Math.max(popupAbsolute.left, viewport.left);\n const overlapHeight =\n Math.min(popupAbsolute.top + popupAbsolute.height, viewport.top + viewport.height) -\n Math.max(popupAbsolute.top, viewport.top);\n const visibleWidth = Math.max(0, overlapWidth);\n const visibleHeight = Math.max(0, overlapHeight);\n const overflow = PopupHelper.getOverflowEdges(coordinates, popupRect);\n const isFullyVisible = visibleWidth === popupAbsolute.width && visibleHeight === popupAbsolute.height;\n const isAreaEligible = PopupHelper.getPositionObject(position).direction !== 'left' || isFullyVisible;\n\n return {\n position,\n coordinates,\n overflowCount: PopupHelper.getOverflowCount(overflow),\n visibleArea: visibleWidth * visibleHeight,\n isFullyVisible,\n isAreaEligible,\n };\n }\n\n private pickBestAreaCandidate(\n candidates: Readonly<FallbackCandidateEvaluation[]>,\n positionsSet: ReadonlySet<PopupPositionsType>,\n ): Nullable<FallbackCandidateEvaluation> {\n let bestCandidate: Nullable<FallbackCandidateEvaluation> = null;\n\n for (const candidate of candidates) {\n if (!candidate.isAreaEligible || candidate.visibleArea <= 0) {\n continue;\n }\n\n const isBetterArea =\n !bestCandidate ||\n // предпочитаем любые полностью видимые позиции\n (candidate.isFullyVisible && !bestCandidate.isFullyVisible) ||\n // среди одинаковых по полноте — большую видимую площадь\n (candidate.isFullyVisible === bestCandidate.isFullyVisible &&\n candidate.visibleArea > bestCandidate.visibleArea) ||\n // при равной площади — ту, что указана в props.positions\n (candidate.visibleArea === bestCandidate.visibleArea &&\n positionsSet.has(candidate.position) &&\n !positionsSet.has(bestCandidate.position));\n\n if (isBetterArea) {\n bestCandidate = candidate;\n }\n }\n\n return bestCandidate;\n }\n\n private pickBestOverflowCandidate(\n candidates: Readonly<FallbackCandidateEvaluation[]>,\n positionsSet: ReadonlySet<PopupPositionsType>,\n ): FallbackCandidateEvaluation {\n let bestCandidate = candidates[0];\n\n for (const candidate of candidates) {\n const isBetterOverflow =\n candidate.overflowCount < bestCandidate.overflowCount ||\n (candidate.overflowCount === bestCandidate.overflowCount &&\n positionsSet.has(candidate.position) &&\n !positionsSet.has(bestCandidate.position));\n\n if (isBetterOverflow) {\n bestCandidate = candidate;\n }\n }\n\n return bestCandidate;\n }\n\n private getPinnedPopupOffset(anchorRect: Rect, position: PositionObject) {\n if (!this.getProps().hasPin || /center|middle/.test(position.align)) {\n return 0;\n }\n\n const anchorSize = /top|bottom/.test(position.direction) ? anchorRect.width : anchorRect.height;\n\n const { pinSize } = this.props;\n\n return Math.max(\n 0,\n this.getPinOffset(position.align) + (pinSize || parseInt(this.theme.popupPinSize)) - anchorSize / 2,\n );\n }\n\n private getRelativeShift = () => {\n const { absoluteParent } = this;\n\n if (!this.props.disablePortal || !absoluteParent) {\n return {\n top: 0,\n left: 0,\n };\n }\n\n const rect = PopupHelper.getElementAbsoluteRect(absoluteParent);\n\n return {\n top: -rect.top,\n left: -rect.left,\n };\n };\n\n private getCoordinates(anchorRect: Rect, popupRect: Rect, positionName: string) {\n const { margin: marginFromProps } = this.props;\n const margin =\n isNonNullable(marginFromProps) && !isNaN(marginFromProps)\n ? marginFromProps\n : parseInt(this.theme.popupMargin) || 0;\n const position = PopupHelper.getPositionObject(positionName);\n const popupOffset = this.getProps().popupOffset + this.getPinnedPopupOffset(anchorRect, position);\n\n switch (position.direction) {\n case 'top':\n return {\n top: anchorRect.top - popupRect.height - margin,\n left: this.getHorizontalPosition(anchorRect, popupRect, position.align, popupOffset),\n };\n case 'middle':\n return {\n top: anchorRect.top + anchorRect.height / 2 - popupRect.height / 2,\n left: this.getHorizontalPosition(anchorRect, popupRect, position.align, popupOffset),\n };\n case 'bottom':\n return {\n top: anchorRect.top + anchorRect.height + margin,\n left: this.getHorizontalPosition(anchorRect, popupRect, position.align, popupOffset),\n };\n case 'left':\n return {\n top: this.getVerticalPosition(anchorRect, popupRect, position.align, popupOffset),\n left: anchorRect.left - popupRect.width - margin,\n };\n case 'right':\n return {\n top: this.getVerticalPosition(anchorRect, popupRect, position.align, popupOffset),\n left: anchorRect.left + anchorRect.width + margin,\n };\n default:\n throw new Error(`Unexpected direction '${position.direction}'`);\n }\n }\n\n private getPinOffset(align: string) {\n const { pinOffset } = this.props;\n\n switch (align) {\n case 'top':\n case 'bottom':\n return pinOffset || parseInt(this.theme.popupPinOffsetY);\n case 'left':\n case 'right':\n return pinOffset || parseInt(this.theme.popupPinOffsetX);\n case 'center':\n case 'middle':\n return 0;\n default:\n throw new Error(`Unexpected align '${align}'`);\n }\n }\n\n private getHorizontalPosition(anchorRect: Rect, popupRect: Rect, align: string, popupOffset: number) {\n switch (align) {\n case 'left':\n return anchorRect.left - popupOffset;\n case 'center':\n return anchorRect.left - (popupRect.width - anchorRect.width) / 2;\n case 'right':\n return anchorRect.left - (popupRect.width - anchorRect.width) + popupOffset;\n default:\n throw new Error(`Unexpected align '${align}'`);\n }\n }\n\n private getVerticalPosition(anchorRect: Rect, popupRect: Rect, align: string, popupOffset: number) {\n switch (align) {\n case 'top':\n return anchorRect.top - popupOffset;\n case 'middle':\n return anchorRect.top - (popupRect.height - anchorRect.height) / 2;\n case 'bottom':\n return anchorRect.top - (popupRect.height - anchorRect.height) + popupOffset;\n default:\n throw new Error(`Unexpected align '${align}'`);\n }\n }\n}\n\n// Нужно, чтобы получать по рефу dom-элемент, в который зарендерится anchor\ntype EmptyWrapperProps = Readonly<{\n children: React.ReactNode;\n}>;\n\nclass EmptyWrapper extends React.Component<EmptyWrapperProps> {\n public render() {\n return this.props.children;\n }\n}\n"],"mappings":";AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAQ,wBAAwB;AACnD,OAAOC,OAAO,MAAM,SAAS;AAC7B,SAASC,YAAY,QAAQ,0BAA0B;;AAEvD,SAASC,UAAU,QAAQ,0BAA0B;;AAErD,OAAO,KAAKC,YAAY,MAAM,wBAAwB;;AAEtD,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,eAAe,QAAQ,oBAAoB;;AAEpD,SAASC,WAAW,EAAEC,UAAU,EAAEC,aAAa,EAAEC,UAAU,EAAEC,gBAAgB,QAAQ,iBAAiB;AACtG,SAASC,MAAM,EAAEC,MAAM,QAAQ,kBAAkB;AACjD,SAASC,YAAY,QAAQ,gCAAgC;;AAE7D,SAASC,SAAS,QAAQ,8BAA8B;;AAExD,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,EAAE,QAAQ,2BAA2B;AAC9C,SAASC,gBAAgB,QAAQ,6CAA6C;AAC9E,SAASC,WAAW,QAAQ,gBAAgB;;AAE5C,SAASC,WAAW,EAAEC,QAAQ,QAAQ,oBAAoB;AAC1D,SAASC,2BAA2B,QAAQ,qCAAqC;A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,EAAAlR,MAAA,CAC7BmR,WAAW,GAAG,OAAO,EAAAnR,MAAA,CAErBY,YAAY,GAAiB,EACzC8P,WAAW,EAAE,CAAC,EACdlG,MAAM,EAAE,KAAK,EACbpC,SAAS,EAAE,KAAK,EAChBC,iBAAiB,EAAE9K,SAAS,EAC5B+J,UAAU,EAAE,KAAK,EACjBgB,WAAW,EAAE,KAAK,EAClBlD,aAAa,EAAE,KAAK,EACpB9B,KAAK,EAAE,MAAM,EACbkG,QAAQ,EAAE3M,MAAM,CAACuU,UAAU,CAACtR,KAAK,CACnC,CAAC,EAAAE,MAAA,CAKsBqR,eAAe,GAAG,IAAI,EAAArR,MAAA,MAAAD,MAAA,KAAAA,MAAA;;;AA4xB/C;AAAA;;;;AAKMkC,YAAY,0BAAAqP,iBAAA,YAAArP,aAAA,UAAAqP,iBAAA,CAAA5Q,KAAA,OAAAN,SAAA,WAAAmF,cAAA,CAAAtD,YAAA,EAAAqP,iBAAA,MAAAC,OAAA,GAAAtP,YAAA,CAAAwD,SAAA,CAAA8L,OAAA;EACT9K,MAAM,GAAb,SAAAA,OAAA,EAAgB;IACd,OAAO,IAAI,CAAC1F,KAAK,CAAC6C,QAAQ;EAC5B,CAAC,QAAA3B,YAAA,GAHwB1F,KAAK,CAAC0U,SAAS","ignoreList":[]}
@@ -96,6 +96,11 @@ export interface PopupProps extends Omit<CommonProps, 'children'>, PopupHandlerP
96
96
  * @see https://github.com/skbkontur/retail-ui/pull/1195
97
97
  */
98
98
  tryPreserveFirstRenderedPosition?: boolean;
99
+ /**
100
+ * Включает поиск наиболее подходящей позиции попапа, если ни одна заданная позиция попапа не влезает во вьюпорт.
101
+ * Выбирается позиция с наибольшей видимой площадью.
102
+ */
103
+ tryBestFallbackPosition?: boolean;
99
104
  withoutMobile?: boolean;
100
105
  /** @ignore */
101
106
  disablePortal?: boolean;
@@ -177,8 +182,15 @@ export declare class Popup extends React.Component<PopupProps, PopupState> {
177
182
  private cancelDelayedUpdateLocation;
178
183
  private updateLocation;
179
184
  private locationEquals;
180
- private reorderPropsPositionsWithPriorityPos;
185
+ private getOrderedPositions;
181
186
  private getLocation;
187
+ private tryReuseCurrentLocation;
188
+ private tryGetFirstFullyVisibleLocation;
189
+ private getFallbackLocation;
190
+ private pickBestFallbackPosition;
191
+ private evaluateFallbackCandidate;
192
+ private pickBestAreaCandidate;
193
+ private pickBestOverflowCandidate;
182
194
  private getPinnedPopupOffset;
183
195
  private getRelativeShift;
184
196
  private getCoordinates;
@@ -1,3 +1,4 @@
1
+ import _createForOfIteratorHelperLoose from "@babel/runtime/helpers/esm/createForOfIteratorHelperLoose";
1
2
  import { globalObject } from '@skbkontur/global-object';
2
3
  import { getDOMRect } from "../../../lib/dom/getDOMRect";
3
4
  function getPositionObject(position) {
@@ -23,7 +24,7 @@ function isAbsoluteRectFullyVisible(coordinates, popupRect) {
23
24
  return _rectContainsRect(windowAbsoluteRect, absoluteRect);
24
25
  }
25
26
 
26
- // Can become fully visible by scrolling into viewport
27
+ /** Может стать полностью видимым после прокрутки в область видимости */
27
28
  function canBecomeFullyVisible(positionName, coordinates) {
28
29
  var position = getPositionObject(positionName);
29
30
  if (position.direction === 'top') {
@@ -35,7 +36,7 @@ function canBecomeFullyVisible(positionName, coordinates) {
35
36
  return coordinates.left + _availableScrollDistances.left >= 0;
36
37
  }
37
38
 
38
- // NOTE: for bottom/right cases browser will always expand document size
39
+ // NOTE: в случаях bottom/right браузер всегда расширяет размер документа
39
40
  return true;
40
41
  }
41
42
  function _getElementRelativeRect(element) {
@@ -91,6 +92,103 @@ function _getAbsoluteOffset() {
91
92
  function _rectContainsRect(outerRect, innerRect) {
92
93
  return innerRect.top > outerRect.top && innerRect.top + innerRect.height < outerRect.top + outerRect.height && innerRect.left > outerRect.left && innerRect.left + innerRect.width < outerRect.left + outerRect.width;
93
94
  }
95
+
96
+ /** Прямоугольник вьюпорта в координатах документа (абсолютных) */
97
+ function getViewportAbsoluteRect() {
98
+ return convertRectToAbsolute(_getWindowRelativeRect());
99
+ }
100
+
101
+ /** Какие стороны попапа (с заданными координатами) выходят за пределы вьюпорта */
102
+ function getOverflowEdges(coordinates, popupRect) {
103
+ var viewport = getViewportAbsoluteRect();
104
+ var popup = {
105
+ top: coordinates.top,
106
+ left: coordinates.left,
107
+ width: popupRect.width,
108
+ height: popupRect.height
109
+ };
110
+ return {
111
+ top: popup.top < viewport.top,
112
+ bottom: popup.top + popup.height > viewport.top + viewport.height,
113
+ left: popup.left < viewport.left,
114
+ right: popup.left + popup.width > viewport.left + viewport.width
115
+ };
116
+ }
117
+
118
+ /** Количество сторон, по которым попап выходит за вьюпорт (0–4) */
119
+ function getOverflowCount(overflow) {
120
+ return [overflow.top, overflow.bottom, overflow.left, overflow.right].filter(Boolean).length;
121
+ }
122
+
123
+ /** Предпочтительное направление по вертикали при переполнении */
124
+ function getPreferredDirection(overflow, defaultPosition) {
125
+ if (overflow.bottom) {
126
+ return 'top';
127
+ }
128
+ if (overflow.top) {
129
+ return 'bottom';
130
+ }
131
+ return getPositionObject(defaultPosition).direction;
132
+ }
133
+
134
+ /**
135
+ * Упорядоченный список кандидатов для fallback-позиции: при горизонтальном переполнении
136
+ * сначала позиции с нужным align (в т.ч. из pinnablePositions), затем по direction и positions.
137
+ */
138
+ function getOrderedFallbackCandidates(positions, overflow, preferredDirection, preferredAlignOrder, pinnablePositions) {
139
+ var seen = new Set();
140
+ var add = function add(p) {
141
+ if (!seen.has(p)) {
142
+ seen.add(p);
143
+ return true;
144
+ }
145
+ return false;
146
+ };
147
+ var candidates = [];
148
+ var hasHorizontalOverflow = overflow.left || overflow.right;
149
+ if (hasHorizontalOverflow) {
150
+ var preferredAlign = preferredAlignOrder[0];
151
+ for (var _i = 0, _arr = ['bottom', 'top']; _i < _arr.length; _i++) {
152
+ var dir = _arr[_i];
153
+ var p = dir + " " + preferredAlign;
154
+ if (pinnablePositions.includes(p) && add(p)) {
155
+ candidates.push(p);
156
+ }
157
+ }
158
+ for (var _iterator = _createForOfIteratorHelperLoose(preferredAlignOrder), _step; !(_step = _iterator()).done;) {
159
+ var align = _step.value;
160
+ for (var _iterator2 = _createForOfIteratorHelperLoose(positions), _step2; !(_step2 = _iterator2()).done;) {
161
+ var _p = _step2.value;
162
+ if (getPositionObject(_p).align === align && add(_p)) {
163
+ candidates.push(_p);
164
+ }
165
+ }
166
+ }
167
+ }
168
+ for (var _iterator3 = _createForOfIteratorHelperLoose(preferredAlignOrder), _step3; !(_step3 = _iterator3()).done;) {
169
+ var _align = _step3.value;
170
+ for (var _iterator6 = _createForOfIteratorHelperLoose(positions), _step6; !(_step6 = _iterator6()).done;) {
171
+ var _p2 = _step6.value;
172
+ var pos = getPositionObject(_p2);
173
+ if (pos.direction === preferredDirection && pos.align === _align && add(_p2)) {
174
+ candidates.push(_p2);
175
+ }
176
+ }
177
+ }
178
+ for (var _iterator4 = _createForOfIteratorHelperLoose(positions), _step4; !(_step4 = _iterator4()).done;) {
179
+ var _p3 = _step4.value;
180
+ if (getPositionObject(_p3).direction === preferredDirection && add(_p3)) {
181
+ candidates.push(_p3);
182
+ }
183
+ }
184
+ for (var _iterator5 = _createForOfIteratorHelperLoose(positions), _step5; !(_step5 = _iterator5()).done;) {
185
+ var _p4 = _step5.value;
186
+ if (add(_p4)) {
187
+ candidates.push(_p4);
188
+ }
189
+ }
190
+ return candidates;
191
+ }
94
192
  function _getViewProperty(getProperty) {
95
193
  var _globalObject$documen, _globalObject$documen2;
96
194
  var views = [(_globalObject$documen = globalObject.document) == null ? void 0 : _globalObject$documen.documentElement, (_globalObject$documen2 = globalObject.document) == null ? void 0 : _globalObject$documen2.body];
@@ -102,5 +200,10 @@ export var PopupHelper = {
102
200
  getPositionObject: getPositionObject,
103
201
  getElementAbsoluteRect: getElementAbsoluteRect,
104
202
  isFullyVisible: isAbsoluteRectFullyVisible,
105
- canBecomeFullyVisible: canBecomeFullyVisible
203
+ canBecomeFullyVisible: canBecomeFullyVisible,
204
+ getViewportAbsoluteRect: getViewportAbsoluteRect,
205
+ getOverflowEdges: getOverflowEdges,
206
+ getOverflowCount: getOverflowCount,
207
+ getPreferredDirection: getPreferredDirection,
208
+ getOrderedFallbackCandidates: getOrderedFallbackCandidates
106
209
  };
@@ -1 +1 @@
1
- {"version":3,"names":["globalObject","getDOMRect","getPositionObject","position","x","split","direction","align","getElementAbsoluteRect","element","rect","_getElementRelativeRect","convertRectToAbsolute","isAbsoluteRectFullyVisible","coordinates","popupRect","windowRelativeRect","_getWindowRelativeRect","windowAbsoluteRect","absoluteRect","top","left","height","width","_rectContainsRect","canBecomeFullyVisible","positionName","availableScrollDistances","right","bottom","_getViewProperty","clientWidth","innerWidth","clientHeight","innerHeight","offset","_getAbsoluteOffset","scrollTop","pageYOffset","scrollLeft","pageXOffset","clientTop","clientLeft","outerRect","innerRect","getProperty","_globalObject$documen","_globalObject$documen2","views","document","documentElement","body","map","find","Boolean","PopupHelper","isFullyVisible"],"sources":["PopupHelper.tsx"],"sourcesContent":["import { globalObject } from '@skbkontur/global-object';\n\nimport { getDOMRect } from '../../lib/dom/getDOMRect';\n\nimport type { PopupPositionsType } from './Popup';\n\nexport interface Rect {\n top: number;\n left: number;\n width: number;\n height: number;\n}\n\nexport interface Offset {\n top: number;\n left: number;\n}\n\nexport interface PositionObject {\n direction: string;\n align: string;\n}\n\nfunction getPositionObject(position: string): PositionObject {\n const x = position.split(' ');\n\n return {\n direction: x[0],\n align: x[1],\n };\n}\n\nfunction getElementAbsoluteRect(element: Element): Rect {\n const rect = _getElementRelativeRect(element);\n return convertRectToAbsolute(rect);\n}\n\nfunction isAbsoluteRectFullyVisible(coordinates: Offset, popupRect: Rect): boolean {\n const windowRelativeRect = _getWindowRelativeRect();\n const windowAbsoluteRect = convertRectToAbsolute(windowRelativeRect);\n const absoluteRect = {\n top: coordinates.top,\n left: coordinates.left,\n height: popupRect.height,\n width: popupRect.width,\n };\n\n return _rectContainsRect(windowAbsoluteRect, absoluteRect);\n}\n\n// Can become fully visible by scrolling into viewport\nfunction canBecomeFullyVisible(positionName: PopupPositionsType, coordinates: Offset) {\n const position = getPositionObject(positionName);\n\n if (position.direction === 'top') {\n const availableScrollDistances = convertRectToAbsolute(_getWindowRelativeRect());\n return coordinates.top + availableScrollDistances.top >= 0;\n }\n\n if (position.direction === 'left') {\n const availableScrollDistances = convertRectToAbsolute(_getWindowRelativeRect());\n return coordinates.left + availableScrollDistances.left >= 0;\n }\n\n // NOTE: for bottom/right cases browser will always expand document size\n return true;\n}\n\nfunction _getElementRelativeRect(element: Element) {\n const rect = getDOMRect(element);\n\n return {\n top: rect.top,\n left: rect.left,\n width: rect.right - rect.left,\n height: rect.bottom - rect.top,\n };\n}\n\nfunction _getWindowRelativeRect(): Rect {\n return {\n top: 0,\n left: 0,\n width: _getViewProperty((x) => x.clientWidth) || globalObject.innerWidth || 0,\n height: _getViewProperty((x) => x.clientHeight) || globalObject.innerHeight || 0,\n };\n}\n\nfunction convertRectToAbsolute(rect: Rect): Rect {\n const offset = _getAbsoluteOffset();\n\n return {\n top: rect.top + offset.top,\n left: rect.left + offset.left,\n width: rect.width,\n height: rect.height,\n };\n}\n\nfunction _getAbsoluteOffset(): Offset {\n const scrollTop = globalObject.pageYOffset || _getViewProperty((x) => x.scrollTop);\n const scrollLeft = globalObject.pageXOffset || _getViewProperty((x) => x.scrollLeft);\n\n const clientTop = _getViewProperty((x) => x.clientTop);\n const clientLeft = _getViewProperty((x) => x.clientLeft);\n\n const top = scrollTop - clientTop;\n const left = scrollLeft - clientLeft;\n\n return {\n top,\n left,\n };\n}\n\nfunction _rectContainsRect(outerRect: Rect, innerRect: Rect): boolean {\n return (\n innerRect.top > outerRect.top &&\n innerRect.top + innerRect.height < outerRect.top + outerRect.height &&\n innerRect.left > outerRect.left &&\n innerRect.left + innerRect.width < outerRect.left + outerRect.width\n );\n}\n\nfunction _getViewProperty(getProperty: (e: Element) => number): number {\n const views = [globalObject.document?.documentElement, globalObject.document?.body];\n return views.map((x) => x && getProperty(x)).find(Boolean) || 0;\n}\n\nexport const Pop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A,CAAuBI,eAAe,GAAAH,sBAAA,GAAE/C,YAAY,CAACiD,QAAQ,qBAArBF,sBAAA,CAAuBI,IAAI,CAAC;EACnF,OAAOH,KAAK,CAACI,GAAG,CAAC,UAAChD,CAAC,UAAKA,CAAC,IAAIyC,WAAW,CAACzC,CAAC,CAAC,GAAC,CAACiD,IAAI,CAACC,OAAO,CAAC,IAAI,CAAC;AACjE;;AAEA,OAAO,IAAMC,WAAW,GAAG;EACzBrD,iBAAiB,EAAjBA,iBAAiB;EACjBM,sBAAsB,EAAtBA,sBAAsB;EACtBgD,cAAc,EAAE3C,0BAA0B;EAC1CY,qBAAqB,EAArBA;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["globalObject","getDOMRect","getPositionObject","position","x","split","direction","align","getElementAbsoluteRect","element","rect","_getElementRelativeRect","convertRectToAbsolute","isAbsoluteRectFullyVisible","coordinates","popupRect","windowRelativeRect","_getWindowRelativeRect","windowAbsoluteRect","absoluteRect","top","left","height","width","_rectContainsRect","canBecomeFullyVisible","positionName","availableScrollDistances","right","bottom","_getViewProperty","clientWidth","innerWidth","clientHeight","innerHeight","offset","_getAbsoluteOffset","scrollTop","pageYOffset","scrollLeft","pageXOffset","clientTop","clientLeft","outerRect","innerRect","getViewportAbsoluteRect","getOverflowEdges","viewport","popup","getOverflowCount","overflow","filter","Boolean","length","getPreferredDirection","defaultPosition","getOrderedFallbackCandidates","positions","preferredDirection","preferredAlignOrder","pinnablePositions","seen","Set","add","p","has","candidates","hasHorizontalOverflow","preferredAlign","_i","_arr","dir","includes","push","_iterator","_createForOfIteratorHelperLoose","_step","done","value","_iterator2","_step2","_iterator3","_step3","_iterator6","_step6","pos","_iterator4","_step4","_iterator5","_step5","getProperty","_globalObject$documen","_globalObject$documen2","views","document","documentElement","body","map","find","PopupHelper","isFullyVisible"],"sources":["PopupHelper.tsx"],"sourcesContent":["import { globalObject } from '@skbkontur/global-object';\n\nimport { getDOMRect } from '../../lib/dom/getDOMRect';\n\nimport type { PopupPositionsType } from './Popup';\n\nexport interface Rect {\n top: number;\n left: number;\n width: number;\n height: number;\n}\n\nexport interface Offset {\n top: number;\n left: number;\n}\n\nexport interface PositionObject {\n direction: string;\n align: string;\n}\n\nfunction getPositionObject(position: string): PositionObject {\n const x = position.split(' ');\n\n return {\n direction: x[0],\n align: x[1],\n };\n}\n\nfunction getElementAbsoluteRect(element: Element): Rect {\n const rect = _getElementRelativeRect(element);\n return convertRectToAbsolute(rect);\n}\n\nfunction isAbsoluteRectFullyVisible(coordinates: Offset, popupRect: Rect): boolean {\n const windowRelativeRect = _getWindowRelativeRect();\n const windowAbsoluteRect = convertRectToAbsolute(windowRelativeRect);\n const absoluteRect = {\n top: coordinates.top,\n left: coordinates.left,\n height: popupRect.height,\n width: popupRect.width,\n };\n\n return _rectContainsRect(windowAbsoluteRect, absoluteRect);\n}\n\n/** Может стать полностью видимым после прокрутки в область видимости */\nfunction canBecomeFullyVisible(positionName: PopupPositionsType, coordinates: Offset) {\n const position = getPositionObject(positionName);\n\n if (position.direction === 'top') {\n const availableScrollDistances = convertRectToAbsolute(_getWindowRelativeRect());\n return coordinates.top + availableScrollDistances.top >= 0;\n }\n\n if (position.direction === 'left') {\n const availableScrollDistances = convertRectToAbsolute(_getWindowRelativeRect());\n return coordinates.left + availableScrollDistances.left >= 0;\n }\n\n // NOTE: в случаях bottom/right браузер всегда расширяет размер документа\n return true;\n}\n\nfunction _getElementRelativeRect(element: Element) {\n const rect = getDOMRect(element);\n\n return {\n top: rect.top,\n left: rect.left,\n width: rect.right - rect.left,\n height: rect.bottom - rect.top,\n };\n}\n\nfunction _getWindowRelativeRect(): Rect {\n return {\n top: 0,\n left: 0,\n width: _getViewProperty((x) => x.clientWidth) || globalObject.innerWidth || 0,\n height: _getViewProperty((x) => x.clientHeight) || globalObject.innerHeight || 0,\n };\n}\n\nfunction convertRectToAbsolute(rect: Rect): Rect {\n const offset = _getAbsoluteOffset();\n\n return {\n top: rect.top + offset.top,\n left: rect.left + offset.left,\n width: rect.width,\n height: rect.height,\n };\n}\n\nfunction _getAbsoluteOffset(): Offset {\n const scrollTop = globalObject.pageYOffset || _getViewProperty((x) => x.scrollTop);\n const scrollLeft = globalObject.pageXOffset || _getViewProperty((x) => x.scrollLeft);\n\n const clientTop = _getViewProperty((x) => x.clientTop);\n const clientLeft = _getViewProperty((x) => x.clientLeft);\n\n const top = scrollTop - clientTop;\n const left = scrollLeft - clientLeft;\n\n return {\n top,\n left,\n };\n}\n\nfunction _rectContainsRect(outerRect: Rect, innerRect: Rect): boolean {\n return (\n innerRect.top > outerRect.top &&\n innerRect.top + innerRect.height < outerRect.top + outerRect.height &&\n innerRect.left > outerRect.left &&\n innerRect.left + innerRect.width < outerRect.left + outerRect.width\n );\n}\n\n/** Прямоугольник вьюпорта в координатах документа (абсолютных) */\nfunction getViewportAbsoluteRect(): Rect {\n return convertRectToAbsolute(_getWindowRelativeRect());\n}\n\nexport interface OverflowEdges {\n top: boolean;\n bottom: boolean;\n left: boolean;\n right: boolean;\n}\n\n/** Какие стороны попапа (с заданными координатами) выходят за пределы вьюпорта */\nfunction getOverflowEdges(coordinates: Offset, popupRect: Rect): OverflowEdges {\n const viewport = getViewportAbsoluteRect();\n const popup = {\n top: coordinates.top,\n left: coordinates.left,\n width: popupRect.width,\n height: popupRect.height,\n };\n return {\n top: popup.top < viewport.top,\n bottom: popup.top + popup.height > viewport.top + viewport.height,\n left: popup.left < viewport.left,\n right: popup.left + popup.width > viewport.left + viewport.width,\n };\n}\n\n/** Количество сторон, по которым попап выходит за вьюпорт (0–4) */\nfunction getOverflowCount(overflow: OverflowEdges): number {\n return [overflow.top, overflow.bottom, overflow.left, overflow.right].filter(Boolean).length;\n}\n\n/** Предпочтительное направление по вертикали при переполнении */\nfunction getPreferredDirection(overflow: OverflowEdges, defaultPosition: PopupPositionsType): string {\n if (overflow.bottom) {\n return 'top';\n }\n if (overflow.top) {\n return 'bottom';\n }\n return getPositionObject(defaultPosition).direction;\n}\n\n/**\n * Упорядоченный список кандидатов для fallback-позиции: при горизонтальном переполнении\n * сначала позиции с нужным align (в т.ч. из pinnablePositions), затем по direction и positions.\n */\nfunction getOrderedFallbackCandidates(\n positions: Readonly<PopupPositionsType[]>,\n overflow: OverflowEdges,\n preferredDirection: string,\n preferredAlignOrder: string[],\n pinnablePositions: Readonly<PopupPositionsType[]>,\n): PopupPositionsType[] {\n const seen = new Set<PopupPositionsType>();\n const add = (p: PopupPositionsType) => {\n if (!seen.has(p)) {\n seen.add(p);\n return true;\n }\n return false;\n };\n\n const candidates: PopupPositionsType[] = [];\n const hasHorizontalOverflow = overflow.left || overflow.right;\n\n if (hasHorizontalOverflow) {\n const preferredAlign = preferredAlignOrder[0];\n for (const dir of ['bottom', 'top']) {\n const p = `${dir} ${preferredAlign}` as PopupPositionsType;\n if (pinnablePositions.includes(p) && add(p)) {\n candidates.push(p);\n }\n }\n for (const align of preferredAlignOrder) {\n for (const p of positions) {\n if (getPositionObject(p).align === align && add(p)) {\n candidates.push(p);\n }\n }\n }\n }\n\n for (const align of preferredAlignOrder) {\n for (const p of positions) {\n const pos = getPositionObject(p);\n if (pos.direction === preferredDirection && pos.align === align && add(p)) {\n candidates.push(p);\n }\n }\n }\n for (const p of positions) {\n if (getPositionObject(p).direction === preferredDirection && add(p)) {\n candidates.push(p);\n }\n }\n for (const p of positions) {\n if (add(p)) {\n candidates.push(p);\n }\n }\n\n return candidates;\n}\n\nfunction _getViewProperty(getProperty: (e: Element) => number): number {\n const views = [globalObject.document?.documentElement, globalObject.document?.body];\n return views.map((x) => x && getProperty(x)).find(Boolean) || 0;\n}\n\nexport const PopupHelper = {\n getPositionObject,\n getElementAbsoluteRect,\n isFullyVisible: isAbsoluteRectFullyVisible,\n canBecomeFullyVisible,\n getViewportAbsoluteRect,\n getOverflowEdges,\n getOverflowCount,\n getPreferredDirection,\n getOrderedFallbackCandidates,\n};\n"],"mappings":"wGAAA,SAASA,YAAY,QAAQ,0BAA0B;;AAEvD,SAASC,UAAU,QA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AG,EAAAF,qBAAA,GAAC3F,YAAY,CAAC8F,QAAQ,qBAArBH,qBAAA,CAAuBI,eAAe,GAAAH,sBAAA,GAAE5F,YAAY,CAAC8F,QAAQ,qBAArBF,sBAAA,CAAuBI,IAAI,CAAC;EACnF,OAAOH,KAAK,CAACI,GAAG,CAAC,UAAC7F,CAAC,UAAKA,CAAC,IAAIsF,WAAW,CAACtF,CAAC,CAAC,GAAC,CAAC8F,IAAI,CAAC9C,OAAO,CAAC,IAAI,CAAC;AACjE;;AAEA,OAAO,IAAM+C,WAAW,GAAG;EACzBjG,iBAAiB,EAAjBA,iBAAiB;EACjBM,sBAAsB,EAAtBA,sBAAsB;EACtB4F,cAAc,EAAEvF,0BAA0B;EAC1CY,qBAAqB,EAArBA,qBAAqB;EACrBoB,uBAAuB,EAAvBA,uBAAuB;EACvBC,gBAAgB,EAAhBA,gBAAgB;EAChBG,gBAAgB,EAAhBA,gBAAgB;EAChBK,qBAAqB,EAArBA,qBAAqB;EACrBE,4BAA4B,EAA5BA;AACF,CAAC","ignoreList":[]}
@@ -16,11 +16,36 @@ export interface PositionObject {
16
16
  declare function getPositionObject(position: string): PositionObject;
17
17
  declare function getElementAbsoluteRect(element: Element): Rect;
18
18
  declare function isAbsoluteRectFullyVisible(coordinates: Offset, popupRect: Rect): boolean;
19
+ /** Может стать полностью видимым после прокрутки в область видимости */
19
20
  declare function canBecomeFullyVisible(positionName: PopupPositionsType, coordinates: Offset): boolean;
21
+ /** Прямоугольник вьюпорта в координатах документа (абсолютных) */
22
+ declare function getViewportAbsoluteRect(): Rect;
23
+ export interface OverflowEdges {
24
+ top: boolean;
25
+ bottom: boolean;
26
+ left: boolean;
27
+ right: boolean;
28
+ }
29
+ /** Какие стороны попапа (с заданными координатами) выходят за пределы вьюпорта */
30
+ declare function getOverflowEdges(coordinates: Offset, popupRect: Rect): OverflowEdges;
31
+ /** Количество сторон, по которым попап выходит за вьюпорт (0–4) */
32
+ declare function getOverflowCount(overflow: OverflowEdges): number;
33
+ /** Предпочтительное направление по вертикали при переполнении */
34
+ declare function getPreferredDirection(overflow: OverflowEdges, defaultPosition: PopupPositionsType): string;
35
+ /**
36
+ * Упорядоченный список кандидатов для fallback-позиции: при горизонтальном переполнении
37
+ * сначала позиции с нужным align (в т.ч. из pinnablePositions), затем по direction и positions.
38
+ */
39
+ declare function getOrderedFallbackCandidates(positions: Readonly<PopupPositionsType[]>, overflow: OverflowEdges, preferredDirection: string, preferredAlignOrder: string[], pinnablePositions: Readonly<PopupPositionsType[]>): PopupPositionsType[];
20
40
  export declare const PopupHelper: {
21
41
  getPositionObject: typeof getPositionObject;
22
42
  getElementAbsoluteRect: typeof getElementAbsoluteRect;
23
43
  isFullyVisible: typeof isAbsoluteRectFullyVisible;
24
44
  canBecomeFullyVisible: typeof canBecomeFullyVisible;
45
+ getViewportAbsoluteRect: typeof getViewportAbsoluteRect;
46
+ getOverflowEdges: typeof getOverflowEdges;
47
+ getOverflowCount: typeof getOverflowCount;
48
+ getPreferredDirection: typeof getPreferredDirection;
49
+ getOrderedFallbackCandidates: typeof getOrderedFallbackCandidates;
25
50
  };
26
51
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skbkontur/react-ui",
3
- "version": "5.6.8",
3
+ "version": "5.6.9",
4
4
  "description": "UI Components",
5
5
  "main": "cjs/index.js",
6
6
  "module": "index.js",