@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","_interopRequireDefault","require","_reactTransitionGroup","_warning","_globalObject","_getDOMRect","LayoutEvents","_interopRequireWildcard","_ZIndex","_RenderContainer","_utils","_client","_ThemeContext","_currentEnvironment","_CommonWrapper","_Emotion","_decorator","_MobilePopup","_rootNode","_InstanceWithAnchorElement","_createPropsGetter","_isInstanceOf","_featureFlagsContext","_mergeRefs","_getVisualStateDataAttributes","_PopupPinNew","_PopupHelper","_Popup2","_PopupPin","_class","_Popup","POPUP_BORDER_DEFAULT_COLOR","TRANSITION_TIMEOUT","enter","exit","PopupNonPinnablePositions","exports","PopupPinnablePositions","PopupPositions","concat","DefaultPosition","DUMMY_LOCATION","position","coordinates","top","left","isFullyVisible","PopupDataTids","root","content","contentInner","popupPin","PopupIds","Popup","responsiveLayout","rootNode","_React$Component","_this","_len","arguments","length","args","Array","_key","call","apply","getProps","createPropsGetter","defaultProps","state","location","props","opened","locationUpdateId","refForTransition","React","createRef","hasAnchorElementListeners","rootId","getRandomID","anchorElement","absoluteParent","renderInPortal","anchor","ref","default","createElement","RenderContainer","isMobileLayout","withoutMobile","renderMobile","renderContent","renderWithoutPortal","EmptyWrapper","updateAbsoluteElement","className","styles","updateAnchorElement","instance","childDomNode","isInstanceWithAnchorElement","getAnchorElement","getRootNode","removeEventListeners","addEventListeners","handleMouseEnter","event","onMouseEnter","handleMouseLeave","onMouseLeave","handleClick","onClick","handleFocus","onFocus","handleBlur","onBlur","calculateWidth","width","includes","anchorWidth","getDOMRect","replace","percent","parseFloat","children","backgroundColor","_this$getProps","minWidth","theme","mergeRefs","refPopupContentElement","style","prepareDataVisualState","_this$state$location","_getVisualStateDataAt","attrName","getVisualStateDataAttributes","resetLocation","cancelDelayedUpdateLocation","setState","element","lastPopupContentElement","handleLayoutEvent","updateLocation","popupContentElement","getLocation","onPositionChange","locationEquals","getRelativeShift","_this2","disablePortal","rect","PopupHelper","getElementAbsoluteRect","_inheritsLoose2","_proto","prototype","componentDidMount","layoutEventsToken","addListener","getDerivedStateFromProps","componentDidUpdate","prevProps","prevState","hadNoLocation","hasLocation","wasClosed","onOpen","onClose","delayUpdateLocation","componentWillUnmount","remove","render","_this3","ReactUIFeatureFlagsContext","Consumer","flags","featureFlags","getFullReactUIFlagsContext","ThemeContext","renderMain","renderChildren","CommonWrapper","rootNodeRef","setRootNode","MobilePopup","withoutRenderContainer","onCloseRequest","mobileOnCloseRequest","_anchor","useWrapper","isInstanceOf","globalObject","Element","isValidElement","anchorWithRef","isRefableElement","cloneElement","canGetAnchorNode","renderRef","renderAnchor","addEventListener","removeEventListener","_this4","_this$props","maxWidth","_this$getProps2","hasShadow","disableAnimations","ignoreHover","relativeShift","_PopupHelper$getPosit","getPositionObject","direction","rootStyle","Transition","timeout","appear","in","Boolean","mountOnEnter","unmountOnExit","onExited","nodeRef","_this4$props$id","_extends2","_ref","_extends3","ZIndex","id","priority","cx","popup","shadow","popupIgnoreHover","transitionEnter","transitionEnterActive","transitionExit","renderPin","isFunction","positionName","isDefaultBorderColor","popupBorderColor","pinBorder","isIE11","_this$props2","pinSize","borderColor","_this$getProps3","hasPin","popupFixPinTearing","PopupPinNew","popupElement","popupPosition","size","parseInt","popupPinSize","offset","getPinOffset","align","popupBackground","PopupPin","borderWidth","requestAnimationFrame","cancelAnimationFrame","x","y","isNullable","isEdge","Math","abs","reorderPropsPositionsWithPriorityPos","positions","pos_","pos","index","findIndex","startsWith","warning","join","slice","_this$getProps4","tryPreserveFirstRenderedPosition","anchorRect","popupRect","getCoordinates","canBecomeVisible","canBecomeFullyVisible","_iterator","_createForOfIteratorHelperLoose2","_step","done","value","getPinnedPopupOffset","test","anchorSize","height","max","marginFromProps","margin","isNonNullable","isNaN","popupMargin","popupOffset","getHorizontalPosition","getVerticalPosition","Error","pinOffset","popupPinOffsetY","popupPinOffsetX","Component","__KONTUR_REACT_UI__","displayName","isTestEnv","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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;;AAEA,IAAAI,WAAA,GAAAJ,OAAA;;AAEA,IAAAK,YAAA,GAAAC,uBAAA,CAAAN,OAAA;;AAEA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,gBAAA,GAAAR,OAAA;;AAEA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,OAAA,GAAAV,OAAA;AACA,IAAAW,aAAA,GAAAX,OAAA;;AAEA,IAAAY,mBAAA,GAAAZ,OAAA;;AAEA,IAAAa,cAAA,GAAAb,OAAA;AACA,IAAAc,QAAA,GAAAd,OAAA;AACA,IAAAe,UAAA,GAAAf,OAAA;AACA,IAAAgB,YAAA,GAAAhB,OAAA;;AAEA,IAAAiB,SAAA,GAAAjB,OAAA;AACA,IAAAkB,0BAAA,GAAAlB,OAAA;AACA,IAAAmB,kBAAA,GAAAnB,OAAA;AACA,IAAAoB,aAAA,GAAApB,OAAA;;AAEA,IAAAqB,oBAAA,GAAArB,OAAA;AACA,IAAAsB,UAAA,GA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,EAAEF,cAAM,CAACsF,UAAU,CAACrQ,KAAK,CACnC,CAAC,EAAAvB,MAAA,CAKsB6R,eAAe,GAAG,IAAI,EAAA7R,MAAA,MAAAD,MAAA,KAAAA,MAAA;;;AA8nB/C;AAAA;;;;AAKMgE,YAAY,0BAAA+N,iBAAA,YAAA/N,aAAA,UAAA+N,iBAAA,CAAA3P,KAAA,OAAAN,SAAA,eAAA+F,eAAA,CAAArE,OAAA,EAAAQ,YAAA,EAAA+N,iBAAA,MAAAC,OAAA,GAAAhO,YAAA,CAAA+D,SAAA,CAAAiK,OAAA;EACTjJ,MAAM,GAAb,SAAAA,OAAA,EAAgB;IACd,OAAO,IAAI,CAACrG,KAAK,CAACqD,QAAQ;EAC5B,CAAC,QAAA/B,YAAA,GAHwBlB,cAAK,CAAC2O,SAAS","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_reactTransitionGroup","_warning","_globalObject","_getDOMRect","LayoutEvents","_interopRequireWildcard","_ZIndex","_RenderContainer","_utils","_client","_ThemeContext","_currentEnvironment","_CommonWrapper","_Emotion","_decorator","_MobilePopup","_rootNode","_InstanceWithAnchorElement","_createPropsGetter","_isInstanceOf","_featureFlagsContext","_mergeRefs","_getVisualStateDataAttributes","_PopupPinNew","_PopupHelper","_Popup2","_PopupPin","_class","_Popup","POPUP_BORDER_DEFAULT_COLOR","TRANSITION_TIMEOUT","enter","exit","PopupNonPinnablePositions","exports","PopupPinnablePositions","PopupPositions","concat","DefaultPosition","DUMMY_LOCATION","position","coordinates","top","left","isFullyVisible","PopupDataTids","root","content","contentInner","popupPin","PopupIds","Popup","responsiveLayout","rootNode","_React$Component","_this","_len","arguments","length","args","Array","_key","call","apply","getProps","createPropsGetter","defaultProps","state","location","props","opened","locationUpdateId","refForTransition","React","createRef","hasAnchorElementListeners","rootId","getRandomID","anchorElement","absoluteParent","renderInPortal","anchor","ref","default","createElement","RenderContainer","isMobileLayout","withoutMobile","renderMobile","renderContent","renderWithoutPortal","EmptyWrapper","updateAbsoluteElement","className","styles","updateAnchorElement","instance","childDomNode","isInstanceWithAnchorElement","getAnchorElement","getRootNode","removeEventListeners","addEventListeners","handleMouseEnter","event","onMouseEnter","handleMouseLeave","onMouseLeave","handleClick","onClick","handleFocus","onFocus","handleBlur","onBlur","calculateWidth","width","includes","anchorWidth","getDOMRect","replace","percent","parseFloat","children","backgroundColor","_this$getProps","minWidth","theme","mergeRefs","refPopupContentElement","style","prepareDataVisualState","_this$state$location","_getVisualStateDataAt","attrName","getVisualStateDataAttributes","resetLocation","cancelDelayedUpdateLocation","setState","element","lastPopupContentElement","handleLayoutEvent","updateLocation","popupContentElement","getLocation","onPositionChange","locationEquals","getRelativeShift","_this2","disablePortal","rect","PopupHelper","getElementAbsoluteRect","_inheritsLoose2","_proto","prototype","componentDidMount","layoutEventsToken","addListener","getDerivedStateFromProps","componentDidUpdate","prevProps","prevState","hadNoLocation","hasLocation","wasClosed","onOpen","onClose","delayUpdateLocation","componentWillUnmount","remove","render","_this3","ReactUIFeatureFlagsContext","Consumer","flags","featureFlags","getFullReactUIFlagsContext","ThemeContext","renderMain","renderChildren","CommonWrapper","rootNodeRef","setRootNode","MobilePopup","withoutRenderContainer","onCloseRequest","mobileOnCloseRequest","_anchor","useWrapper","isInstanceOf","globalObject","Element","isValidElement","anchorWithRef","isRefableElement","cloneElement","canGetAnchorNode","renderRef","renderAnchor","addEventListener","removeEventListener","_this4","_this$props","maxWidth","_this$getProps2","hasShadow","disableAnimations","ignoreHover","relativeShift","_PopupHelper$getPosit","getPositionObject","direction","rootStyle","Transition","timeout","appear","in","Boolean","mountOnEnter","unmountOnExit","onExited","nodeRef","_this4$props$id","_extends2","_ref","_extends3","ZIndex","id","priority","cx","popup","shadow","popupIgnoreHover","transitionEnter","transitionEnterActive","transitionExit","renderPin","isFunction","positionName","isDefaultBorderColor","popupBorderColor","pinBorder","isIE11","_this$props2","pinSize","borderColor","_this$getProps3","hasPin","popupFixPinTearing","PopupPinNew","popupElement","popupPosition","size","parseInt","popupPinSize","offset","getPinOffset","align","popupBackground","PopupPin","borderWidth","requestAnimationFrame","cancelAnimationFrame","x","y","isNullable","isEdge","Math","abs","getOrderedPositions","positions","pos_","pos","index","findIndex","startsWith","warning","join","slice","_this$getProps4","tryBestFallbackPosition","anchorRect","popupRect","reusedLocation","tryReuseCurrentLocation","fullyVisibleLocation","tryGetFirstFullyVisibleLocation","getFallbackLocation","_this$getProps5","tryPreserveFirstRenderedPosition","getCoordinates","canBecomeVisible","canBecomeFullyVisible","shouldReuseCurrentLocation","_iterator","_createForOfIteratorHelperLoose2","_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","isNonNullable","isNaN","popupMargin","popupOffset","getHorizontalPosition","getVerticalPosition","Error","pinOffset","popupPinOffsetY","popupPinOffsetX","Component","__KONTUR_REACT_UI__","displayName","isTestEnv","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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;;AAEA,IAAAI,WAAA,GAAAJ,OAAA;;AAEA,IAAAK,YAAA,GAAAC,uBAAA,CAAAN,OAAA;;AAEA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,gBAAA,GAAAR,OAAA;;AAEA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,OAAA,GAAAV,OAAA;AACA,IAAAW,aAAA,GAAAX,OAAA;;AAEA,IAAAY,mBAAA,GAAAZ,OAAA;;AAEA,IAAAa,cAAA,GAAAb,OAAA;AACA,IAAAc,QAAA,GAAAd,OAAA;AACA,IAAAe,UAAA,GAAAf,OAAA;AACA,IAAAgB,YAAA,GAAAhB,OAAA;;AAEA,IAAAiB,SAAA,GAAAjB,OAAA;AACA,IAAAkB,0BAAA,GAAAlB,OAAA;AACA,IAAAmB,kBAAA,GAAAnB,OAAA;AACA,IAAA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jR,aAAA,UAAAiR,iBAAA,CAAA7S,KAAA,OAAAN,SAAA,eAAA+F,eAAA,CAAArE,OAAA,EAAAQ,YAAA,EAAAiR,iBAAA,MAAAC,OAAA,GAAAlR,YAAA,CAAA+D,SAAA,CAAAmN,OAAA;EACTnM,MAAM,GAAb,SAAAA,OAAA,EAAgB;IACd,OAAO,IAAI,CAACrG,KAAK,CAACqD,QAAQ;EAC5B,CAAC,QAAA/B,YAAA,GAHwBlB,cAAK,CAAC6R,SAAS","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 {};
@@ -1,4 +1,4 @@
1
- "use strict";exports.__esModule = true;exports.PopupHelper = void 0;var _globalObject = require("@skbkontur/global-object");
1
+ "use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;exports.__esModule = true;exports.PopupHelper = void 0;var _createForOfIteratorHelperLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/createForOfIteratorHelperLoose"));var _globalObject = require("@skbkontur/global-object");
2
2
 
3
3
  var _getDOMRect = require("../../lib/dom/getDOMRect");
4
4
 
@@ -48,7 +48,7 @@ function isAbsoluteRectFullyVisible(coordinates, popupRect) {
48
48
  return _rectContainsRect(windowAbsoluteRect, absoluteRect);
49
49
  }
50
50
 
51
- // Can become fully visible by scrolling into viewport
51
+ /** Может стать полностью видимым после прокрутки в область видимости */
52
52
  function canBecomeFullyVisible(positionName, coordinates) {
53
53
  var position = getPositionObject(positionName);
54
54
 
@@ -62,7 +62,7 @@ function canBecomeFullyVisible(positionName, coordinates) {
62
62
  return coordinates.left + _availableScrollDistances.left >= 0;
63
63
  }
64
64
 
65
- // NOTE: for bottom/right cases browser will always expand document size
65
+ // NOTE: в случаях bottom/right браузер всегда расширяет размер документа
66
66
  return true;
67
67
  }
68
68
 
@@ -122,6 +122,113 @@ function _rectContainsRect(outerRect, innerRect) {
122
122
 
123
123
  }
124
124
 
125
+ /** Прямоугольник вьюпорта в координатах документа (абсолютных) */
126
+ function getViewportAbsoluteRect() {
127
+ return convertRectToAbsolute(_getWindowRelativeRect());
128
+ }
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+ /** Какие стороны попапа (с заданными координатами) выходят за пределы вьюпорта */
138
+ function getOverflowEdges(coordinates, popupRect) {
139
+ var viewport = getViewportAbsoluteRect();
140
+ var popup = {
141
+ top: coordinates.top,
142
+ left: coordinates.left,
143
+ width: popupRect.width,
144
+ height: popupRect.height
145
+ };
146
+ return {
147
+ top: popup.top < viewport.top,
148
+ bottom: popup.top + popup.height > viewport.top + viewport.height,
149
+ left: popup.left < viewport.left,
150
+ right: popup.left + popup.width > viewport.left + viewport.width
151
+ };
152
+ }
153
+
154
+ /** Количество сторон, по которым попап выходит за вьюпорт (0–4) */
155
+ function getOverflowCount(overflow) {
156
+ return [overflow.top, overflow.bottom, overflow.left, overflow.right].filter(Boolean).length;
157
+ }
158
+
159
+ /** Предпочтительное направление по вертикали при переполнении */
160
+ function getPreferredDirection(overflow, defaultPosition) {
161
+ if (overflow.bottom) {
162
+ return 'top';
163
+ }
164
+ if (overflow.top) {
165
+ return 'bottom';
166
+ }
167
+ return getPositionObject(defaultPosition).direction;
168
+ }
169
+
170
+ /**
171
+ * Упорядоченный список кандидатов для fallback-позиции: при горизонтальном переполнении
172
+ * сначала позиции с нужным align (в т.ч. из pinnablePositions), затем по direction и positions.
173
+ */
174
+ function getOrderedFallbackCandidates(
175
+ positions,
176
+ overflow,
177
+ preferredDirection,
178
+ preferredAlignOrder,
179
+ pinnablePositions)
180
+ {
181
+ var seen = new Set();
182
+ var add = function add(p) {
183
+ if (!seen.has(p)) {
184
+ seen.add(p);
185
+ return true;
186
+ }
187
+ return false;
188
+ };
189
+
190
+ var candidates = [];
191
+ var hasHorizontalOverflow = overflow.left || overflow.right;
192
+
193
+ if (hasHorizontalOverflow) {
194
+ var preferredAlign = preferredAlignOrder[0];
195
+ for (var _i = 0, _arr = ['bottom', 'top']; _i < _arr.length; _i++) {var dir = _arr[_i];
196
+ var p = dir + " " + preferredAlign;
197
+ if (pinnablePositions.includes(p) && add(p)) {
198
+ candidates.push(p);
199
+ }
200
+ }
201
+ for (var _iterator = (0, _createForOfIteratorHelperLoose2.default)(preferredAlignOrder), _step; !(_step = _iterator()).done;) {var align = _step.value;
202
+ for (var _iterator2 = (0, _createForOfIteratorHelperLoose2.default)(positions), _step2; !(_step2 = _iterator2()).done;) {var _p = _step2.value;
203
+ if (getPositionObject(_p).align === align && add(_p)) {
204
+ candidates.push(_p);
205
+ }
206
+ }
207
+ }
208
+ }
209
+
210
+ for (var _iterator3 = (0, _createForOfIteratorHelperLoose2.default)(preferredAlignOrder), _step3; !(_step3 = _iterator3()).done;) {var _align = _step3.value;
211
+ for (var _iterator6 = (0, _createForOfIteratorHelperLoose2.default)(positions), _step6; !(_step6 = _iterator6()).done;) {var _p2 = _step6.value;
212
+ var pos = getPositionObject(_p2);
213
+ if (pos.direction === preferredDirection && pos.align === _align && add(_p2)) {
214
+ candidates.push(_p2);
215
+ }
216
+ }
217
+ }
218
+ for (var _iterator4 = (0, _createForOfIteratorHelperLoose2.default)(positions), _step4; !(_step4 = _iterator4()).done;) {var _p3 = _step4.value;
219
+ if (getPositionObject(_p3).direction === preferredDirection && add(_p3)) {
220
+ candidates.push(_p3);
221
+ }
222
+ }
223
+ for (var _iterator5 = (0, _createForOfIteratorHelperLoose2.default)(positions), _step5; !(_step5 = _iterator5()).done;) {var _p4 = _step5.value;
224
+ if (add(_p4)) {
225
+ candidates.push(_p4);
226
+ }
227
+ }
228
+
229
+ return candidates;
230
+ }
231
+
125
232
  function _getViewProperty(getProperty) {var _globalObject$documen, _globalObject$documen2;
126
233
  var views = [(_globalObject$documen = _globalObject.globalObject.document) == null ? void 0 : _globalObject$documen.documentElement, (_globalObject$documen2 = _globalObject.globalObject.document) == null ? void 0 : _globalObject$documen2.body];
127
234
  return views.map(function (x) {return x && getProperty(x);}).find(Boolean) || 0;
@@ -131,5 +238,10 @@ var PopupHelper = exports.PopupHelper = {
131
238
  getPositionObject: getPositionObject,
132
239
  getElementAbsoluteRect: getElementAbsoluteRect,
133
240
  isFullyVisible: isAbsoluteRectFullyVisible,
134
- canBecomeFullyVisible: canBecomeFullyVisible
241
+ canBecomeFullyVisible: canBecomeFullyVisible,
242
+ getViewportAbsoluteRect: getViewportAbsoluteRect,
243
+ getOverflowEdges: getOverflowEdges,
244
+ getOverflowCount: getOverflowCount,
245
+ getPreferredDirection: getPreferredDirection,
246
+ getOrderedFallbackCandidates: getOrderedFallbackCandidates
135
247
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_globalObject","require","_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","getDOMRect","right","bottom","_getViewProperty","clientWidth","globalObject","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","exports","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 PopupHelper = {\n getPositionObject,\n getElementAbsoluteRect,\n isFullyVisible: isAbsoluteRectFullyVisible,\n canBecomeFullyVisible,\n};\n"],"mappings":"oEAAA,IAAAA,aAAA,GAAAC,OAAA;;AAEA,IAAAC,WAAA,GAAAD,OAAA;;;;;;;;;;;;;;;;;;;;;AAqBA,SAASE,iBAAiBA,CAACC,QAAgB,EAAkB;EAC3D,IAAMC,CAAC,GAAGD,QAAQ,CAACE,KAAK,CAAC,GAAG,CAAC;;EAE7B,OAAO;IACLC,SAAS,EAAEF,CAAC,CAAC,CAAC,CAAC;IACfG,KAAK,EAAEH,CAAC,CAAC,CAAC;EACZ,CAAC;AACH;;AAEA,SAASI,sBAAsBA,CAACC,OAAgB,EAAQ;EACtD,IAAMC,IAAI,GAAGC,uBAAuB,CAACF,OAAO,CAAC;EAC7C,OAAOG,qBAAqB,CAACF,IAAI,CAAC;AACpC;;AAEA,SAASG,0BAA0BA,CAACC,WAAmB,EAAEC,SAAe,EAAW;EACjF,IAAMC,kBAAkB,GAAGC,sBAAsB,CAAC,CAAC;EACnD,IAAMC,kBAAkB,GAAGN,qBAAqB,CAACI,kBAAkB,CAAC;EACpE,IAAMG,YAAY,GAAG;IACnBC,GAAG,EAAEN,WAAW,CAACM,GAAG;IACpBC,IAAI,EAAEP,WAAW,CAACO,IAAI;IACtBC,MAAM,EAAEP,SAAS,CAACO,MAAM;IACxBC,KAAK,EAAER,SAAS,CAACQ;EACnB,CAAC;;EAED,OAAOC,iBAAiB,CAACN,kBAAkB,EAAEC,YAAY,CAAC;AAC5D;;AAEA;AACA,SAASM,qBAAqBA,CA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I,GAAGyB,SAAS,CAACvB,KAAK,GAAGsB,SAAS,CAACxB,IAAI,GAAGwB,SAAS,CAACtB,KAAK;;AAEvE;;AAEA,SAASQ,gBAAgBA,CAACgB,WAAmC,EAAU,KAAAC,qBAAA,EAAAC,sBAAA;EACrE,IAAMC,KAAK,GAAG,EAAAF,qBAAA,GAACf,0BAAY,CAACkB,QAAQ,qBAArBH,qBAAA,CAAuBI,eAAe,GAAAH,sBAAA,GAAEhB,0BAAY,CAACkB,QAAQ,qBAArBF,sBAAA,CAAuBI,IAAI,CAAC;EACnF,OAAOH,KAAK,CAACI,GAAG,CAAC,UAAClD,CAAC,UAAKA,CAAC,IAAI2C,WAAW,CAAC3C,CAAC,CAAC,GAAC,CAACmD,IAAI,CAACC,OAAO,CAAC,IAAI,CAAC;AACjE;;AAEO,IAAMC,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG;EACzBvD,iBAAiB,EAAjBA,iBAAiB;EACjBM,sBAAsB,EAAtBA,sBAAsB;EACtBmD,cAAc,EAAE9C,0BAA0B;EAC1CY,qBAAqB,EAArBA;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_globalObject","require","_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","getDOMRect","right","bottom","_getViewProperty","clientWidth","globalObject","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","_createForOfIteratorHelperLoose2","default","_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","exports","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":"iSAAA,IAAAA,aAAA,GAAAC,OAAA;;AAEA,IAAAC,WAAA,GAAAD,OAAA;;;;;;;;;;;;;;;;;;;;;AAqBA,SAASE,iBAAiBA,CAACC,QAAgB,EAAkB;EAC3D,IAAMC,CAAC,GAAGD,QAAQ,CAACE,KAAK,CAAC,GAAG,CAAC;;EAE7B,OAAO;IACLC,SAAS,EAAEF,CAAC,CAAC,CAAC,CAAC;IACfG,KAAK,EAAEH,CAAC,CAAC,CAAC;EACZ,CAAC;AACH;;AAEA,SAASI,sBAAsBA,CAACC,OAAgB,EAAQ;EACtD,IAAMC,IAAI,GAAGC,uBAAuB,CAACF,OAAO,CAAC;EAC7C,OAAOG,qBAAqB,CAACF,IAAI,CAAC;AACpC;;AAEA,SAASG,0BAA0BA,CAACC,WAAmB,EAAEC,SAAe,EAAW;EACjF,IAAMC,kBAAkB,GAAGC,sBAAsB,CAAC,CAAC;EACnD,IAAMC,kBAAkB,GAAGN,qBAAqB,CAACI,kBAAkB,CAAC;EACpE,IAAMG,YAAY,GAAG;IACnBC,GAAG,EAAEN,WAAW,CAACM,GAAG;IACpBC,IAAI,EAAEP,WAAW,CAACO,IAAI;IACtBC,MAAM,EAAEP,SAAS,CAACO,MAAM;IACxBC,KAAK,EAAER,SAAS,CAACQ;EACnB,CAAC;;EAED,OAAOC,iBAAiB,CAACN,kBAAkB,EAAEC,YAAY,CAAC;AAC5D;;AAEA;AACA,SAASM,qBAAqBA,CAACC,YAAgC,EAAEZ,WAAmB,EAAE;EACpF,IAAMX,QAAQ,GAAGD,iBAAiB,CAACwB,YAAY,CAAC;;EAEhD,I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ACA,SAAAyB,UAAA,OAAAd,gCAAA,CAAAC,OAAA,EAAgBnB,SAAS,GAAAiC,MAAA,IAAAA,MAAA,GAAAD,UAAA,IAAAX,IAAA,GAAE,KAAhBd,GAAC,GAAA0B,MAAA,CAAAX,KAAA;IACV,IAAIhB,GAAG,CAACC,GAAC,CAAC,EAAE;MACVE,UAAU,CAACO,IAAI,CAACT,GAAC,CAAC;IACpB;EACF;;EAEA,OAAOE,UAAU;AACnB;;AAEA,SAASrC,gBAAgBA,CAAC8D,WAAmC,EAAU,KAAAC,qBAAA,EAAAC,sBAAA;EACrE,IAAMC,KAAK,GAAG,EAAAF,qBAAA,GAAC7D,0BAAY,CAACgE,QAAQ,qBAArBH,qBAAA,CAAuBI,eAAe,GAAAH,sBAAA,GAAE9D,0BAAY,CAACgE,QAAQ,qBAArBF,sBAAA,CAAuBI,IAAI,CAAC;EACnF,OAAOH,KAAK,CAACI,GAAG,CAAC,UAAChG,CAAC,UAAKA,CAAC,IAAIyF,WAAW,CAACzF,CAAC,CAAC,GAAC,CAACiG,IAAI,CAAC/C,OAAO,CAAC,IAAI,CAAC;AACjE;;AAEO,IAAMgD,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG;EACzBpG,iBAAiB,EAAjBA,iBAAiB;EACjBM,sBAAsB,EAAtBA,sBAAsB;EACtBgG,cAAc,EAAE3F,0BAA0B;EAC1CY,qBAAqB,EAArBA,qBAAqB;EACrBsB,uBAAuB,EAAvBA,uBAAuB;EACvBC,gBAAgB,EAAhBA,gBAAgB;EAChBG,gBAAgB,EAAhBA,gBAAgB;EAChBK,qBAAqB,EAArBA,qBAAqB;EACrBE,4BAA4B,EAA5BA;AACF,CAAC","ignoreList":[]}
@@ -283,11 +283,11 @@ var _FileUploader = forwardRefAndName('FileUploader', function (props, ref) {
283
283
  var hasOneFileForSingle = isSingleMode && hasOneFile && !hideFiles;
284
284
  var hasError = !!error || ((_files$ = files[0]) == null ? void 0 : _files$.status) === FileUploaderFileStatus.Error;
285
285
  var hasWarning = !!warning || ((_files$2 = files[0]) == null ? void 0 : _files$2.status) === FileUploaderFileStatus.Warning;
286
- var uploadButtonClassNames = cx(jsStyles.uploadButton(theme), jsViewStyles.uploadButton(), sizeClassName, versionGTE5_5 && hasOneFileForSingle && jsViewStyles.uploadButtonWithFile(theme), focusedByTab && jsStyles.uploadButtonFocus(theme), disabled && (_ref2 = {}, _ref2[jsStyles.disabled(theme)] = true, _ref2[jsStyles.disabledBackground(theme)] = !versionGTE5_5 || !hasFiles, _ref2), (focusedByTab || !hasOneFileForSingle || !versionGTE5_5) && (_ref3 = {}, _ref3[jsStyles.warningButton(theme)] = hasWarning, _ref3[jsStyles.errorButton(theme)] = hasError, _ref3), versionGTE5_5 && hasOneFileForSingle && (_ref4 = {}, _ref4[uploadButtonTileWithFileClassName] = isTileView, _ref4[jsStyles.warningFile(theme)] = (!isTileView || hovered) && hasWarning, _ref4[jsStyles.errorFile(theme)] = (!isTileView || hovered) && hasError, _ref4), !disabled && hovered && (_ref5 = {}, _ref5[jsStyles.hovered(theme)] = true, _ref5[jsStyles.hoveredBorderColor(theme)] = !versionGTE5_5, _ref5), isDraggable && !disabled && jsStyles.dragOver(theme));
286
+ var uploadButtonClassNames = cx(jsStyles.uploadButton(theme), jsViewStyles.uploadButton(), sizeClassName, versionGTE5_5 && hasOneFileForSingle && jsViewStyles.uploadButtonWithFile(theme), focusedByTab && jsStyles.uploadButtonFocus(theme), disabled && (_ref2 = {}, _ref2[jsStyles.disabled(theme)] = true, _ref2[jsStyles.disabledBackground(theme)] = !versionGTE5_5 || !hasFiles, _ref2), (focusedByTab || !hasOneFileForSingle || !versionGTE5_5) && (_ref3 = {}, _ref3[jsStyles.warningButton(theme)] = hasWarning, _ref3[jsStyles.errorButton(theme)] = hasError, _ref3), versionGTE5_5 && hasOneFileForSingle && (_ref4 = {}, _ref4[uploadButtonTileWithFileClassName] = isTileView, _ref4[jsTileStyles.verticalAlign()] = isTileView, _ref4[jsStyles.warningFile(theme)] = (!isTileView || hovered) && hasWarning, _ref4[jsStyles.errorFile(theme)] = (!isTileView || hovered) && hasError, _ref4), !disabled && hovered && (_ref5 = {}, _ref5[jsStyles.hovered(theme)] = true, _ref5[jsStyles.hoveredBorderColor(theme)] = !versionGTE5_5, _ref5), isDraggable && !disabled && jsStyles.dragOver(theme));
287
287
  var canDrop = isWindowDraggable && !disabled;
288
288
  var uploadButtonWrapperClassNames = cx(isTileView && (_ref6 = {}, _ref6[sizeWrapperClass] = true, _ref6[sizeWrapperEmptyFileClass] = !hasOneFileForSingle, _ref6), jsViewStyles.uploadButtonWrapper(), canDrop && jsStyles.windowDragOver(theme));
289
289
  var uploadButtonIconClassNames = cx(jsStyles.icon(theme), sizeIconClass, disabled && jsStyles.iconDisabled(theme), !versionGTE5_5 && jsStyles.iconRight(), versionGTE5_5 && uploadButtonIconGapClass);
290
- var rootClassNames = cx(jsStyles.root(theme), versionGTE5_5 && (_ref7 = {}, _ref7[jsStyles.root5_5()] = true, _ref7[jsRowStyles.root()] = !isTileView, _ref7));
290
+ var rootClassNames = cx(jsStyles.root(theme), versionGTE5_5 && (_ref7 = {}, _ref7[jsStyles.root5_5(theme)] = true, _ref7[jsRowStyles.root()] = !isTileView, _ref7));
291
291
  var contentClassNames = cx(jsViewStyles.content(), (_cx = {}, _cx[jsViewStyles.contentWithFiles()] = hasOneFileForSingle, _cx[contentInnerClass] = !isTileView && (!files.length || !isSingleMode), _cx));
292
292
  var afterLinkTextClassNames = cx(globalClasses.afterLinkText, hasOneFileForSingle ? jsStyles.afterLinkText_HasFiles() : jsStyles.afterLinkText(), !versionGTE5_5 && jsStyles.afterLinkTextColor(theme));
293
293
  var linkClassNames = cx(jsStyles.link(theme), !disabled && hovered && jsStyles.linkHovered(theme), disabled && jsStyles.linkDisabled(theme));