@skbkontur/react-ui 3.11.0-select-right-2 → 3.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/LICENSE +21 -21
- package/cjs/components/CurrencyLabel/CurrencyLabel.md +23 -23
- package/cjs/components/Gapped/Gapped.md +43 -43
- package/cjs/components/Input/Input.md +13 -13
- package/cjs/components/PasswordInput/PasswordInput.md +9 -9
- package/cjs/components/RadioGroup/RadioGroup.md +43 -43
- package/cjs/components/Select/Select.js +2 -1
- package/cjs/components/Select/Select.js.map +1 -1
- package/cjs/components/SidePage/SidePage.d.ts +4 -1
- package/cjs/components/SidePage/SidePage.js +18 -9
- package/cjs/components/SidePage/SidePage.js.map +1 -1
- package/cjs/components/SidePage/SidePageContext.d.ts +2 -0
- package/cjs/components/SidePage/SidePageContext.js +3 -0
- package/cjs/components/SidePage/SidePageContext.js.map +1 -1
- package/cjs/components/SidePage/SidePageHeader.d.ts +3 -0
- package/cjs/components/SidePage/SidePageHeader.js +26 -8
- package/cjs/components/SidePage/SidePageHeader.js.map +1 -1
- package/cjs/components/Sticky/Sticky.d.ts +6 -1
- package/cjs/components/Sticky/Sticky.js +5 -0
- package/cjs/components/Sticky/Sticky.js.map +1 -1
- package/cjs/components/Token/Token.md +112 -112
- package/cjs/internal/DropdownContainer/DropdownContainer.d.ts +1 -1
- package/cjs/internal/DropdownContainer/DropdownContainer.js +1 -1
- package/cjs/internal/DropdownContainer/DropdownContainer.js.map +1 -1
- package/cjs/internal/Menu/Menu.js +29 -23
- package/cjs/internal/Menu/Menu.js.map +1 -1
- package/cjs/internal/Menu/Menu.styles.d.ts +1 -1
- package/cjs/internal/Menu/Menu.styles.js +3 -2
- package/cjs/internal/Menu/Menu.styles.js.map +1 -1
- package/cjs/internal/Popup/Popup.js +3 -1
- package/cjs/internal/Popup/Popup.js.map +1 -1
- package/cjs/internal/ThemeShowcase/ThemeShowcase.md +13 -13
- package/components/CurrencyLabel/CurrencyLabel.md +23 -23
- package/components/Gapped/Gapped.md +43 -43
- package/components/Input/Input.md +13 -13
- package/components/PasswordInput/PasswordInput.md +9 -9
- package/components/RadioGroup/RadioGroup.md +43 -43
- package/components/Select/Select/Select.js +2 -1
- package/components/Select/Select/Select.js.map +1 -1
- package/components/SidePage/SidePage/SidePage.js +20 -13
- package/components/SidePage/SidePage/SidePage.js.map +1 -1
- package/components/SidePage/SidePage.d.ts +4 -1
- package/components/SidePage/SidePageContext/SidePageContext.js +3 -0
- package/components/SidePage/SidePageContext/SidePageContext.js.map +1 -1
- package/components/SidePage/SidePageContext.d.ts +2 -0
- package/components/SidePage/SidePageHeader/SidePageHeader.js +21 -2
- package/components/SidePage/SidePageHeader/SidePageHeader.js.map +1 -1
- package/components/SidePage/SidePageHeader.d.ts +3 -0
- package/components/Sticky/Sticky/Sticky.js.map +1 -1
- package/components/Sticky/Sticky.d.ts +6 -1
- package/components/Token/Token.md +112 -112
- package/internal/DropdownContainer/DropdownContainer/DropdownContainer.js +1 -1
- package/internal/DropdownContainer/DropdownContainer/DropdownContainer.js.map +1 -1
- package/internal/DropdownContainer/DropdownContainer.d.ts +1 -1
- package/internal/Menu/Menu/Menu.js +28 -13
- package/internal/Menu/Menu/Menu.js.map +1 -1
- package/internal/Menu/Menu.styles/Menu.styles.js +2 -2
- package/internal/Menu/Menu.styles/Menu.styles.js.map +1 -1
- package/internal/Menu/Menu.styles.d.ts +1 -1
- package/internal/Popup/Popup/Popup.js +2 -1
- package/internal/Popup/Popup/Popup.js.map +1 -1
- package/internal/ThemeShowcase/ThemeShowcase.md +13 -13
- package/package.json +6 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Popup.tsx"],"names":["POPUP_BORDER_DEFAULT_COLOR","TRANSITION_TIMEOUT","enter","exit","PopupPositions","DefaultPosition","DUMMY_LOCATION","position","coordinates","top","left","Popup","rootNode","state","location","props","opened","theme","layoutEventsToken","locationUpdateId","lastPopupElement","anchorElement","setRootNode","refForTransition","React","createRef","renderContainerRef","childInstance","updateAnchorElement","handleMouseEnter","event","onMouseEnter","handleMouseLeave","onMouseLeave","handleClick","onClick","handleFocus","onFocus","handleBlur","onBlur","calculateWidth","width","includes","offsetWidth","parseFloat","resetLocation","cancelDelayedUpdateLocation","setState","refPopupElement","element","handleLayoutEvent","updateLocation","popupElement","getLocation","locationEquals","componentDidMount","LayoutEvents","addListener","getDerivedStateFromProps","componentDidUpdate","prevProps","prevState","hadNoLocation","hasLocation","wasClosed","onOpen","onClose","delayUpdateLocation","componentWillUnmount","removeEventListeners","remove","render","renderMain","useWrapper","anchor","isValidElement","anchorWithRef","cloneElement","ref","instance","originalRef","renderContent","childDomNode","addEventListeners","addEventListener","removeEventListener","backgroundColor","disableAnimations","maxWidth","hasShadow","ignoreHover","children","renderChildren","PopupHelper","getPositionObject","direction","rootStyle","shouldFallbackShadow","isIE11","isEdge","isSafari","Boolean","styles","popup","shadow","shadowFallback","popupIgnoreHover","transitionEnter","transitionEnterActive","transitionExit","content","contentInner","renderPin","positionName","isDefaultBorderColor","popupBorderColor","pinBorder","pinSize","borderColor","hasPin","parseInt","popupPinSize","getPinOffset","align","popupBackground","raf","cancel","x","y","Math","abs","positions","tryPreserveFirstRenderedPosition","anchorRect","getElementAbsoluteRect","popupRect","getCoordinates","isFullyVisible","canBecomeVisible","canBecomeFullyVisible","getPinnedPopupOffset","test","anchorSize","height","max","marginFromProps","margin","isNaN","popupMargin","popupOffset","getHorizontalPosition","getVerticalPosition","Error","pinOffset","popupPinOffset","popupPinOffsetY","popupPinOffsetX","Component","__KONTUR_REACT_UI__","propTypes","PropTypes","oneOfType","HTMLElement","node","isRequired","string","func","bool","number","array","defaultProps","isTestEnv"],"mappings":"6cAAA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uC;;AAEA,IAAMA,0BAA0B,GAAG,aAA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JzE,EAMxB;AACJ;AACA,KACI9E,eAAe,EAAE0E,mBAAUK,MATH,EAWxB1E,QAAQ,EAAEqE,mBAAUC,SAAV,CAAoB,CAACD,mBAAUG,IAAX,EAAiBH,mBAAUM,IAA3B,CAApB,CAXc,EAaxB;AACJ;AACA,KACI/C,MAAM,EAAEyC,mBAAUO,IAhBM,EAkBxB;AACJ;AACA,KACI9E,SAAS,EAAEuE,mBAAUO,IArBG,EAuBxB;AACJ;AACA,KACIrB,MAAM,EAAEc,mBAAUQ,MA1BM,EA4BxB;AACJ;AACA,KACIxJ,MAAM,EAAEgJ,mBAAUO,IA/BM,EAiCxB;AACJ;AACA,KACId,SAAS,EAAEO,mBAAUQ,MApCG,EAsCxB;AACJ;AACA;AACA;AACA,KACInD,OAAO,EAAE2C,mBAAUQ,MA3CK,EA6CxB;AACJ;AACA,KACInB,WAAW,EAAEW,mBAAUQ,MAhDC,EAkDxB;AACJ;AACA;AACA,KACIrC,SAAS,EAAE6B,mBAAUS,KAtDG,EAwDxB;AACJ;AACA,KACI/E,WAAW,EAAEsE,mBAAUO,IA3DC,E,UA8DZG,Y,GAAe,EAC3BrB,WAAW,EAAE,CADc,EAE3B9B,MAAM,EAAE,KAFmB,EAG3B9B,SAAS,EAAE,KAHgB,EAI3BF,iBAAiB,EAAEoF,6BAJQ,EAK3BlG,UAAU,EAAE,KALe,EAM3BiB,WAAW,EAAE,KANc,EAO3BjD,KAAK,EAAE,MAPoB,E","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { Transition } from 'react-transition-group';\nimport raf from 'raf';\nimport warning from 'warning';\n\nimport { Nullable } from '../../typings/utility-types';\nimport * as LayoutEvents from '../../lib/LayoutEvents';\nimport { ZIndex } from '../ZIndex';\nimport { RenderContainer } from '../RenderContainer';\nimport { FocusEventType, MouseEventType } from '../../typings/event-types';\nimport { isFunction, isNonNullable, isRefableElement } from '../../lib/utils';\nimport { isIE11, isEdge, isSafari } from '../../lib/client';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { Theme } from '../../lib/theming/Theme';\nimport { isHTMLElement, safePropTypesInstanceOf } from '../../lib/SSRSafe';\nimport { isTestEnv } from '../../lib/currentEnvironment';\nimport { CommonProps, CommonWrapper } from '../CommonWrapper';\nimport { cx } from '../../lib/theming/Emotion';\nimport { getRootNode, rootNode, TSetRootNode } from '../../lib/rootNode';\nimport { callChildRef } from '../../lib/callChildRef/callChildRef';\n\nimport { PopupPin } from './PopupPin';\nimport { Offset, PopupHelper, PositionObject, Rect } from './PopupHelper';\nimport { styles } from './Popup.styles';\n\nconst POPUP_BORDER_DEFAULT_COLOR = 'transparent';\nconst TRANSITION_TIMEOUT = { enter: 0, exit: 200 };\n\nexport const PopupPositions = [\n 'top left',\n 'top center',\n 'top right',\n 'right top',\n 'right middle',\n 'right bottom',\n 'bottom right',\n 'bottom center',\n 'bottom left',\n 'left bottom',\n 'left middle',\n 'left top',\n] as const;\nexport const DefaultPosition = PopupPositions[0];\n\nexport type PopupPositionsType = typeof PopupPositions[number];\n\nconst DUMMY_LOCATION: PopupLocation = {\n position: DefaultPosition,\n coordinates: {\n top: -9999,\n left: -9999,\n },\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 extends CommonProps, PopupHandlerProps {\n anchorElement: React.ReactNode | HTMLElement;\n backgroundColor?: React.CSSProperties['backgroundColor'];\n borderColor?: React.CSSProperties['borderColor'];\n children: React.ReactNode | (() => React.ReactNode);\n hasPin: boolean;\n hasShadow: boolean;\n disableAnimations: boolean;\n margin?: number;\n maxWidth?: number | string;\n opened: boolean;\n pinOffset?: number;\n pinSize?: number;\n popupOffset: number;\n positions: Readonly<PopupPositionsType[]>;\n /**\n * Явно указывает, что вложенные элементы должны быть обёрнуты в `<span/>`. <br/> Используется для корректного позиционирования тултипа при двух и более вложенных элементах.\n *\n * _Примечание_: при **двух и более** вложенных элементах обёртка будет добавлена автоматически.\n */\n useWrapper: boolean;\n ignoreHover: boolean;\n width: React.CSSProperties['width'];\n /**\n * При очередном рендере пытаться сохранить первоначальную позицию попапа\n * (в числе числе, когда он выходит за пределы экрана, но может быть проскролен в него).\n *\n * Нужен только для Tooltip. В остальных случаях позиция перестраивается автоматически.\n * @see https://github.com/skbkontur/retail-ui/pull/1195\n */\n tryPreserveFirstRenderedPosition?: boolean;\n}\n\ninterface PopupLocation {\n coordinates: {\n left: number;\n top: number;\n };\n position: PopupPositionsType;\n}\n\nexport interface PopupState {\n location: Nullable<PopupLocation>;\n}\n\n@rootNode\nexport class Popup extends React.Component<PopupProps, PopupState> {\n public static __KONTUR_REACT_UI__ = 'Popup';\n\n public static propTypes = {\n /**\n * Ссылка (ref) на элемент или React компонент, для которого рисуется попап\n */\n anchorElement: PropTypes.oneOfType([safePropTypesInstanceOf(() => HTMLElement), PropTypes.node]).isRequired,\n\n /**\n * Фон попапа и пина\n */\n backgroundColor: PropTypes.string,\n\n children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),\n\n /**\n * Показывать ли пин\n */\n hasPin: PropTypes.bool,\n\n /**\n * Применять ли box-shadow на попапе. При false отключает границу на пине\n */\n hasShadow: PropTypes.bool,\n\n /**\n * Отступ попапа от элемента\n */\n margin: PropTypes.number,\n\n /**\n * Показан или скрыт попап\n */\n opened: PropTypes.bool,\n\n /**\n * Смещение пина от края попапа. Край задаётся в пропе position вторым словом\n */\n pinOffset: PropTypes.number,\n\n /**\n * Сторона пина без учёта границы.\n * Пин представляет собой равносторонний треугольник, высота от попапа\n * до \"носика\" пина будет соответствовать формуле (size* √3)/2\n */\n pinSize: PropTypes.number,\n\n /**\n * смещение попапа относительно родительского элемента\n */\n popupOffset: PropTypes.number,\n\n /**\n * С какой стороны показывать попап и край попапа,\n * на котором будет отображаться пин\n */\n positions: PropTypes.array,\n\n /**\n * Игнорировать ли события hover/click\n */\n ignoreHover: PropTypes.bool,\n };\n\n public static defaultProps = {\n popupOffset: 0,\n hasPin: false,\n hasShadow: false,\n disableAnimations: isTestEnv,\n useWrapper: false,\n ignoreHover: false,\n width: 'auto',\n };\n\n public state: PopupState = { location: this.props.opened ? DUMMY_LOCATION : null };\n private theme!: Theme;\n private layoutEventsToken: Nullable<ReturnType<typeof LayoutEvents.addListener>>;\n private locationUpdateId: Nullable<number> = null;\n private lastPopupElement: Nullable<HTMLElement>;\n private anchorElement: Nullable<HTMLElement> = null;\n private setRootNode!: TSetRootNode;\n private refForTransition = React.createRef<HTMLDivElement>();\n\n public componentDidMount() {\n this.updateLocation();\n this.layoutEventsToken = LayoutEvents.addListener(this.handleLayoutEvent);\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 (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 this.removeEventListeners(this.anchorElement);\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 <ThemeContext.Consumer>\n {(theme) => {\n this.theme = theme;\n return this.renderMain();\n }}\n </ThemeContext.Consumer>\n );\n }\n\n private renderMain() {\n const { location } = this.state;\n const { anchorElement, useWrapper } = this.props;\n\n let anchor: Nullable<React.ReactNode> = null;\n if (isHTMLElement(anchorElement)) {\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: (instance: Nullable<React.ReactInstance>) => {\n this.updateAnchorElement(instance);\n const originalRef = (anchor as React.RefAttributes<any>)?.ref;\n originalRef && callChildRef(originalRef, instance);\n },\n })\n : null;\n\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 with RenderContainer's ref\n // in the case when the anchor is not refable\n\n return (\n <RenderContainer anchor={anchorWithRef || anchor} ref={anchorWithRef ? null : this.renderContainerRef}>\n {location && this.renderContent(location)}\n </RenderContainer>\n );\n }\n\n private renderContainerRef = (childInstance: Nullable<React.ReactInstance>) => {\n this.updateAnchorElement(childInstance);\n };\n\n private updateAnchorElement(childInstance: Nullable<React.ReactInstance>) {\n const childDomNode = getRootNode(childInstance);\n const anchorElement = this.anchorElement;\n\n if (childDomNode !== anchorElement) {\n this.removeEventListeners(anchorElement);\n this.anchorElement = childDomNode;\n this.addEventListeners(childDomNode);\n this.setRootNode(childDomNode);\n }\n }\n\n private addEventListeners(element: Nullable<HTMLElement>) {\n if (element && isHTMLElement(element)) {\n element.addEventListener('mouseenter', this.handleMouseEnter);\n element.addEventListener('mouseleave', this.handleMouseLeave);\n element.addEventListener('click', this.handleClick);\n element.addEventListener('focusin', this.handleFocus as EventListener);\n element.addEventListener('focusout', this.handleBlur as EventListener);\n }\n }\n\n private removeEventListeners(element: Nullable<HTMLElement>) {\n if (element && isHTMLElement(element)) {\n element.removeEventListener('mouseenter', this.handleMouseEnter);\n element.removeEventListener('mouseleave', this.handleMouseLeave);\n element.removeEventListener('click', this.handleClick);\n element.removeEventListener('focusin', this.handleFocus as EventListener);\n element.removeEventListener('focusout', this.handleBlur as EventListener);\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 return this.anchorElement ? (this.anchorElement.offsetWidth * parseFloat(width)) / 100 : 0;\n }\n return width;\n };\n\n private renderContent(location: PopupLocation) {\n const { backgroundColor, disableAnimations, maxWidth, hasShadow, ignoreHover, opened, width } = this.props;\n const children = this.renderChildren();\n\n const { direction } = PopupHelper.getPositionObject(location.position);\n const rootStyle: React.CSSProperties = { ...location.coordinates, maxWidth };\n\n const shouldFallbackShadow = isIE11 || isEdge || isSafari;\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}>\n <ZIndex\n wrapperRef={this.refPopupElement}\n priority={'Popup'}\n className={cx({\n [styles.popup(this.theme)]: true,\n [styles.shadow(this.theme)]: hasShadow && !shouldFallbackShadow,\n [styles.shadowFallback(this.theme)]: hasShadow && shouldFallbackShadow,\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 <div className={styles.content(this.theme)} data-tid={'PopupContent'} ref={this.refForTransition}>\n <div\n className={styles.contentInner(this.theme)}\n style={{ backgroundColor, width: this.calculateWidth(width) }}\n data-tid={'PopupContentInner'}\n >\n {children}\n </div>\n </div>\n {this.renderPin(location.position)}\n </ZIndex>\n </CommonWrapper>\n )}\n </Transition>\n );\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 refPopupElement = (element: Nullable<HTMLElement>) => {\n this.lastPopupElement = element;\n };\n\n private renderPin(positionName: string): React.ReactNode {\n /**\n * Box-shadow does not appear under the pin. Borders are used instead.\n * In non-ie browsers drop-shadow filter is used. It is applying\n * shadow to the pin too.\n */\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, hasShadow, backgroundColor, borderColor } = this.props;\n const position = PopupHelper.getPositionObject(positionName);\n\n return (\n this.props.hasPin && (\n <PopupPin\n popupElement={this.lastPopupElement}\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 = raf(this.updateLocation);\n }\n\n private cancelDelayedUpdateLocation() {\n if (this.locationUpdateId) {\n raf.cancel(this.locationUpdateId);\n this.locationUpdateId = null;\n }\n }\n\n private updateLocation = () => {\n const popupElement = this.lastPopupElement;\n\n if (!popupElement) {\n return;\n }\n\n const location = this.getLocation(popupElement, this.state.location);\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 (x == null || y == null) {\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 getLocation(popupElement: HTMLElement, location?: Nullable<PopupLocation>) {\n const { positions, tryPreserveFirstRenderedPosition } = this.props;\n const anchorElement = this.anchorElement;\n\n warning(\n anchorElement && isHTMLElement(anchorElement),\n 'Anchor element is not defined or not instance of HTMLElement',\n );\n\n if (!(anchorElement && isHTMLElement(anchorElement))) {\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 };\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 };\n }\n }\n\n position = positions[0];\n coordinates = this.getCoordinates(anchorRect, popupRect, position);\n return { coordinates, position };\n }\n\n private getPinnedPopupOffset(anchorRect: Rect, position: PositionObject) {\n if (!this.props.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 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.props.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 '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.popupPinOffset) || parseInt(this.theme.popupPinOffsetY);\n case 'left':\n case 'right':\n return pinOffset || parseInt(this.theme.popupPinOffset) || 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"]}
|
|
1
|
+
{"version":3,"sources":["Popup.tsx"],"names":["POPUP_BORDER_DEFAULT_COLOR","TRANSITION_TIMEOUT","enter","exit","PopupPositions","DefaultPosition","DUMMY_LOCATION","position","coordinates","top","left","Popup","rootNode","state","location","props","opened","theme","layoutEventsToken","locationUpdateId","lastPopupElement","anchorElement","setRootNode","refForTransition","React","createRef","renderContainerRef","childInstance","updateAnchorElement","handleMouseEnter","event","onMouseEnter","handleMouseLeave","onMouseLeave","handleClick","onClick","handleFocus","onFocus","handleBlur","onBlur","calculateWidth","width","includes","offsetWidth","parseFloat","resetLocation","cancelDelayedUpdateLocation","setState","refPopupElement","element","handleLayoutEvent","updateLocation","popupElement","getLocation","locationEquals","componentDidMount","LayoutEvents","addListener","getDerivedStateFromProps","componentDidUpdate","prevProps","prevState","hadNoLocation","hasLocation","wasClosed","onOpen","onClose","delayUpdateLocation","componentWillUnmount","removeEventListeners","remove","render","renderMain","useWrapper","anchor","isValidElement","anchorWithRef","cloneElement","ref","instance","originalRef","canGetAnchorNode","renderContent","childDomNode","addEventListeners","addEventListener","removeEventListener","backgroundColor","disableAnimations","maxWidth","hasShadow","ignoreHover","children","renderChildren","PopupHelper","getPositionObject","direction","rootStyle","shouldFallbackShadow","isIE11","isEdge","isSafari","Boolean","styles","popup","shadow","shadowFallback","popupIgnoreHover","transitionEnter","transitionEnterActive","transitionExit","content","contentInner","renderPin","positionName","isDefaultBorderColor","popupBorderColor","pinBorder","pinSize","borderColor","hasPin","parseInt","popupPinSize","getPinOffset","align","popupBackground","raf","cancel","x","y","Math","abs","positions","tryPreserveFirstRenderedPosition","anchorRect","getElementAbsoluteRect","popupRect","getCoordinates","isFullyVisible","canBecomeVisible","canBecomeFullyVisible","getPinnedPopupOffset","test","anchorSize","height","max","marginFromProps","margin","isNaN","popupMargin","popupOffset","getHorizontalPosition","getVerticalPosition","Error","pinOffset","popupPinOffset","popupPinOffsetY","popupPinOffsetX","Component","__KONTUR_REACT_UI__","propTypes","PropTypes","oneOfType","HTMLElement","node","isRequired","string","func","bool","number","array","defaultProps","isTestEnv"],"mappings":"6cAAA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uC;;AAEA,IAAMA,0BAA0B,GAAG,aAAnC;AACA,IAAMC,kBAAkB,GAAG,EAAEC,KAAK,EAAE,CAAT,EAAYC,IAAI,EAAE,GAAlB,EAA3B;;AAEO,IAAMC,cAAc,GAAG;AAC5B,UAD4B;AAE5B,YAF4B;AAG5B,WAH4B;AAI5B,WAJ4B;AAK5B,cAL4B;AAM5B,cAN4B;AAO5B,cAP4B;AAQ5B,eAR4B;AAS5B,aAT4B;AAU5B,aAV4B;AAW5B,aAX4B;AAY5B,UAZ4B,CAAvB,C;;AAcA,IAAMC,eAAe,GAAGD,cAA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EuE,mBAAUO,IArBG,EAuBxB;AACJ;AACA,KACIrB,MAAM,EAAEc,mBAAUQ,MA1BM,EA4BxB;AACJ;AACA,KACIzJ,MAAM,EAAEiJ,mBAAUO,IA/BM,EAiCxB;AACJ;AACA,KACId,SAAS,EAAEO,mBAAUQ,MApCG,EAsCxB;AACJ;AACA;AACA;AACA,KACInD,OAAO,EAAE2C,mBAAUQ,MA3CK,EA6CxB;AACJ;AACA,KACInB,WAAW,EAAEW,mBAAUQ,MAhDC,EAkDxB;AACJ;AACA;AACA,KACIrC,SAAS,EAAE6B,mBAAUS,KAtDG,EAwDxB;AACJ;AACA,KACI/E,WAAW,EAAEsE,mBAAUO,IA3DC,E,UA8DZG,Y,GAAe,EAC3BrB,WAAW,EAAE,CADc,EAE3B9B,MAAM,EAAE,KAFmB,EAG3B9B,SAAS,EAAE,KAHgB,EAI3BF,iBAAiB,EAAEoF,6BAJQ,EAK3BnG,UAAU,EAAE,KALe,EAM3BkB,WAAW,EAAE,KANc,EAO3BlD,KAAK,EAAE,MAPoB,E","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { Transition } from 'react-transition-group';\nimport raf from 'raf';\nimport warning from 'warning';\n\nimport { Nullable } from '../../typings/utility-types';\nimport * as LayoutEvents from '../../lib/LayoutEvents';\nimport { ZIndex } from '../ZIndex';\nimport { RenderContainer } from '../RenderContainer';\nimport { FocusEventType, MouseEventType } from '../../typings/event-types';\nimport { isFunction, isNonNullable, isRefableElement } from '../../lib/utils';\nimport { isIE11, isEdge, isSafari } from '../../lib/client';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { Theme } from '../../lib/theming/Theme';\nimport { isHTMLElement, safePropTypesInstanceOf } from '../../lib/SSRSafe';\nimport { isTestEnv } from '../../lib/currentEnvironment';\nimport { CommonProps, CommonWrapper } from '../CommonWrapper';\nimport { cx } from '../../lib/theming/Emotion';\nimport { getRootNode, rootNode, TSetRootNode } from '../../lib/rootNode';\nimport { callChildRef } from '../../lib/callChildRef/callChildRef';\n\nimport { PopupPin } from './PopupPin';\nimport { Offset, PopupHelper, PositionObject, Rect } from './PopupHelper';\nimport { styles } from './Popup.styles';\n\nconst POPUP_BORDER_DEFAULT_COLOR = 'transparent';\nconst TRANSITION_TIMEOUT = { enter: 0, exit: 200 };\n\nexport const PopupPositions = [\n 'top left',\n 'top center',\n 'top right',\n 'right top',\n 'right middle',\n 'right bottom',\n 'bottom right',\n 'bottom center',\n 'bottom left',\n 'left bottom',\n 'left middle',\n 'left top',\n] as const;\nexport const DefaultPosition = PopupPositions[0];\n\nexport type PopupPositionsType = typeof PopupPositions[number];\n\nconst DUMMY_LOCATION: PopupLocation = {\n position: DefaultPosition,\n coordinates: {\n top: -9999,\n left: -9999,\n },\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 extends CommonProps, PopupHandlerProps {\n anchorElement: React.ReactNode | HTMLElement;\n backgroundColor?: React.CSSProperties['backgroundColor'];\n borderColor?: React.CSSProperties['borderColor'];\n children: React.ReactNode | (() => React.ReactNode);\n hasPin: boolean;\n hasShadow: boolean;\n disableAnimations: boolean;\n margin?: number;\n maxWidth?: number | string;\n opened: boolean;\n pinOffset?: number;\n pinSize?: number;\n popupOffset: number;\n positions: Readonly<PopupPositionsType[]>;\n /**\n * Явно указывает, что вложенные элементы должны быть обёрнуты в `<span/>`. <br/> Используется для корректного позиционирования тултипа при двух и более вложенных элементах.\n *\n * _Примечание_: при **двух и более** вложенных элементах обёртка будет добавлена автоматически.\n */\n useWrapper: boolean;\n ignoreHover: boolean;\n width: React.CSSProperties['width'];\n /**\n * При очередном рендере пытаться сохранить первоначальную позицию попапа\n * (в числе числе, когда он выходит за пределы экрана, но может быть проскролен в него).\n *\n * Нужен только для Tooltip. В остальных случаях позиция перестраивается автоматически.\n * @see https://github.com/skbkontur/retail-ui/pull/1195\n */\n tryPreserveFirstRenderedPosition?: boolean;\n}\n\ninterface PopupLocation {\n coordinates: {\n left: number;\n top: number;\n };\n position: PopupPositionsType;\n}\n\nexport interface PopupState {\n location: Nullable<PopupLocation>;\n}\n\n@rootNode\nexport class Popup extends React.Component<PopupProps, PopupState> {\n public static __KONTUR_REACT_UI__ = 'Popup';\n\n public static propTypes = {\n /**\n * Ссылка (ref) на элемент или React компонент, для которого рисуется попап\n */\n anchorElement: PropTypes.oneOfType([safePropTypesInstanceOf(() => HTMLElement), PropTypes.node]).isRequired,\n\n /**\n * Фон попапа и пина\n */\n backgroundColor: PropTypes.string,\n\n children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),\n\n /**\n * Показывать ли пин\n */\n hasPin: PropTypes.bool,\n\n /**\n * Применять ли box-shadow на попапе. При false отключает границу на пине\n */\n hasShadow: PropTypes.bool,\n\n /**\n * Отступ попапа от элемента\n */\n margin: PropTypes.number,\n\n /**\n * Показан или скрыт попап\n */\n opened: PropTypes.bool,\n\n /**\n * Смещение пина от края попапа. Край задаётся в пропе position вторым словом\n */\n pinOffset: PropTypes.number,\n\n /**\n * Сторона пина без учёта границы.\n * Пин представляет собой равносторонний треугольник, высота от попапа\n * до \"носика\" пина будет соответствовать формуле (size* √3)/2\n */\n pinSize: PropTypes.number,\n\n /**\n * смещение попапа относительно родительского элемента\n */\n popupOffset: PropTypes.number,\n\n /**\n * С какой стороны показывать попап и край попапа,\n * на котором будет отображаться пин\n */\n positions: PropTypes.array,\n\n /**\n * Игнорировать ли события hover/click\n */\n ignoreHover: PropTypes.bool,\n };\n\n public static defaultProps = {\n popupOffset: 0,\n hasPin: false,\n hasShadow: false,\n disableAnimations: isTestEnv,\n useWrapper: false,\n ignoreHover: false,\n width: 'auto',\n };\n\n public state: PopupState = { location: this.props.opened ? DUMMY_LOCATION : null };\n private theme!: Theme;\n private layoutEventsToken: Nullable<ReturnType<typeof LayoutEvents.addListener>>;\n private locationUpdateId: Nullable<number> = null;\n private lastPopupElement: Nullable<HTMLElement>;\n private anchorElement: Nullable<HTMLElement> = null;\n private setRootNode!: TSetRootNode;\n private refForTransition = React.createRef<HTMLDivElement>();\n\n public componentDidMount() {\n this.updateLocation();\n this.layoutEventsToken = LayoutEvents.addListener(this.handleLayoutEvent);\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 (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 this.removeEventListeners(this.anchorElement);\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 <ThemeContext.Consumer>\n {(theme) => {\n this.theme = theme;\n return this.renderMain();\n }}\n </ThemeContext.Consumer>\n );\n }\n\n private renderMain() {\n const { location } = this.state;\n const { anchorElement, useWrapper } = this.props;\n\n let anchor: Nullable<React.ReactNode> = null;\n if (isHTMLElement(anchorElement)) {\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: (instance: Nullable<React.ReactInstance>) => {\n this.updateAnchorElement(instance);\n const originalRef = (anchor as React.RefAttributes<any>)?.ref;\n originalRef && callChildRef(originalRef, instance);\n },\n })\n : null;\n\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 with RenderContainer's ref\n // in the case when the anchor is not refable\n\n const canGetAnchorNode = !!anchorWithRef || isHTMLElement(anchorElement);\n\n return (\n <RenderContainer anchor={anchorWithRef || anchor} ref={canGetAnchorNode ? null : this.renderContainerRef}>\n {location && this.renderContent(location)}\n </RenderContainer>\n );\n }\n\n private renderContainerRef = (childInstance: Nullable<React.ReactInstance>) => {\n this.updateAnchorElement(childInstance);\n };\n\n private updateAnchorElement(childInstance: Nullable<React.ReactInstance>) {\n const childDomNode = getRootNode(childInstance);\n const anchorElement = this.anchorElement;\n\n if (childDomNode !== anchorElement) {\n this.removeEventListeners(anchorElement);\n this.anchorElement = childDomNode;\n this.addEventListeners(childDomNode);\n this.setRootNode(childDomNode);\n }\n }\n\n private addEventListeners(element: Nullable<HTMLElement>) {\n if (element && isHTMLElement(element)) {\n element.addEventListener('mouseenter', this.handleMouseEnter);\n element.addEventListener('mouseleave', this.handleMouseLeave);\n element.addEventListener('click', this.handleClick);\n element.addEventListener('focusin', this.handleFocus as EventListener);\n element.addEventListener('focusout', this.handleBlur as EventListener);\n }\n }\n\n private removeEventListeners(element: Nullable<HTMLElement>) {\n if (element && isHTMLElement(element)) {\n element.removeEventListener('mouseenter', this.handleMouseEnter);\n element.removeEventListener('mouseleave', this.handleMouseLeave);\n element.removeEventListener('click', this.handleClick);\n element.removeEventListener('focusin', this.handleFocus as EventListener);\n element.removeEventListener('focusout', this.handleBlur as EventListener);\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 return this.anchorElement ? (this.anchorElement.offsetWidth * parseFloat(width)) / 100 : 0;\n }\n return width;\n };\n\n private renderContent(location: PopupLocation) {\n const { backgroundColor, disableAnimations, maxWidth, hasShadow, ignoreHover, opened, width } = this.props;\n const children = this.renderChildren();\n\n const { direction } = PopupHelper.getPositionObject(location.position);\n const rootStyle: React.CSSProperties = { ...location.coordinates, maxWidth };\n\n const shouldFallbackShadow = isIE11 || isEdge || isSafari;\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}>\n <ZIndex\n wrapperRef={this.refPopupElement}\n priority={'Popup'}\n className={cx({\n [styles.popup(this.theme)]: true,\n [styles.shadow(this.theme)]: hasShadow && !shouldFallbackShadow,\n [styles.shadowFallback(this.theme)]: hasShadow && shouldFallbackShadow,\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 <div className={styles.content(this.theme)} data-tid={'PopupContent'} ref={this.refForTransition}>\n <div\n className={styles.contentInner(this.theme)}\n style={{ backgroundColor, width: this.calculateWidth(width) }}\n data-tid={'PopupContentInner'}\n >\n {children}\n </div>\n </div>\n {this.renderPin(location.position)}\n </ZIndex>\n </CommonWrapper>\n )}\n </Transition>\n );\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 refPopupElement = (element: Nullable<HTMLElement>) => {\n this.lastPopupElement = element;\n };\n\n private renderPin(positionName: string): React.ReactNode {\n /**\n * Box-shadow does not appear under the pin. Borders are used instead.\n * In non-ie browsers drop-shadow filter is used. It is applying\n * shadow to the pin too.\n */\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, hasShadow, backgroundColor, borderColor } = this.props;\n const position = PopupHelper.getPositionObject(positionName);\n\n return (\n this.props.hasPin && (\n <PopupPin\n popupElement={this.lastPopupElement}\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 = raf(this.updateLocation);\n }\n\n private cancelDelayedUpdateLocation() {\n if (this.locationUpdateId) {\n raf.cancel(this.locationUpdateId);\n this.locationUpdateId = null;\n }\n }\n\n private updateLocation = () => {\n const popupElement = this.lastPopupElement;\n\n if (!popupElement) {\n return;\n }\n\n const location = this.getLocation(popupElement, this.state.location);\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 (x == null || y == null) {\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 getLocation(popupElement: HTMLElement, location?: Nullable<PopupLocation>) {\n const { positions, tryPreserveFirstRenderedPosition } = this.props;\n const anchorElement = this.anchorElement;\n\n warning(\n anchorElement && isHTMLElement(anchorElement),\n 'Anchor element is not defined or not instance of HTMLElement',\n );\n\n if (!(anchorElement && isHTMLElement(anchorElement))) {\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 };\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 };\n }\n }\n\n position = positions[0];\n coordinates = this.getCoordinates(anchorRect, popupRect, position);\n return { coordinates, position };\n }\n\n private getPinnedPopupOffset(anchorRect: Rect, position: PositionObject) {\n if (!this.props.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 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.props.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 '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.popupPinOffset) || parseInt(this.theme.popupPinOffsetY);\n case 'left':\n case 'right':\n return pinOffset || parseInt(this.theme.popupPinOffset) || 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"]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
### Таблица переменных
|
|
2
|
-
|
|
3
|
-
Список использующихся переменных для каждого кастомизируемого компонента.
|
|
4
|
-
<br/>
|
|
5
|
-
Таблица фильтруется по названию переменной.
|
|
6
|
-
<br/>
|
|
7
|
-
Значения в колонке `Variable name` кликабельны.
|
|
8
|
-
|
|
9
|
-
```jsx harmony
|
|
10
|
-
import { ThemeShowcase } from '@skbkontur/react-ui/internal/ThemeShowcase/ThemeShowcase';
|
|
11
|
-
|
|
12
|
-
<ThemeShowcase />;
|
|
13
|
-
```
|
|
1
|
+
### Таблица переменных
|
|
2
|
+
|
|
3
|
+
Список использующихся переменных для каждого кастомизируемого компонента.
|
|
4
|
+
<br/>
|
|
5
|
+
Таблица фильтруется по названию переменной.
|
|
6
|
+
<br/>
|
|
7
|
+
Значения в колонке `Variable name` кликабельны.
|
|
8
|
+
|
|
9
|
+
```jsx harmony
|
|
10
|
+
import { ThemeShowcase } from '@skbkontur/react-ui/internal/ThemeShowcase/ThemeShowcase';
|
|
11
|
+
|
|
12
|
+
<ThemeShowcase />;
|
|
13
|
+
```
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
To render rubles
|
|
2
|
-
|
|
3
|
-
```jsx
|
|
4
|
-
<CurrencyLabel value={12356.1} currencySymbol={'₽'} />
|
|
5
|
-
```
|
|
6
|
-
|
|
7
|
-
...or dollars
|
|
8
|
-
|
|
9
|
-
```jsx
|
|
10
|
-
<CurrencyLabel value={12356.1} currencySymbol={'$'} />
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
...or nothing
|
|
14
|
-
|
|
15
|
-
```jsx
|
|
16
|
-
<CurrencyLabel value={12356.1} />
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
Count of fraction digits can be changed
|
|
20
|
-
|
|
21
|
-
```jsx
|
|
22
|
-
<CurrencyLabel value={3562001.1} fractionDigits={3} currencySymbol={'₽'} />
|
|
23
|
-
```
|
|
1
|
+
To render rubles
|
|
2
|
+
|
|
3
|
+
```jsx
|
|
4
|
+
<CurrencyLabel value={12356.1} currencySymbol={'₽'} />
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
...or dollars
|
|
8
|
+
|
|
9
|
+
```jsx
|
|
10
|
+
<CurrencyLabel value={12356.1} currencySymbol={'$'} />
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
...or nothing
|
|
14
|
+
|
|
15
|
+
```jsx
|
|
16
|
+
<CurrencyLabel value={12356.1} />
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Count of fraction digits can be changed
|
|
20
|
+
|
|
21
|
+
```jsx
|
|
22
|
+
<CurrencyLabel value={3562001.1} fractionDigits={3} currencySymbol={'₽'} />
|
|
23
|
+
```
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
Вывод элементов с горизонтальным расположением
|
|
2
|
-
|
|
3
|
-
```jsx harmony
|
|
4
|
-
import { Button } from '@skbkontur/react-ui';
|
|
5
|
-
|
|
6
|
-
<Gapped gap={20}>
|
|
7
|
-
<Button use="primary">Сохранить</Button>
|
|
8
|
-
<Button>Отмена</Button>
|
|
9
|
-
</Gapped>;
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
Вертикальное расположение
|
|
13
|
-
|
|
14
|
-
```jsx harmony
|
|
15
|
-
import { Checkbox } from '@skbkontur/react-ui';
|
|
16
|
-
|
|
17
|
-
<Gapped vertical gap={20}>
|
|
18
|
-
<Checkbox checked>Write todos</Checkbox>
|
|
19
|
-
<Checkbox initialIndeterminate>Work in progress</Checkbox>
|
|
20
|
-
<Checkbox>Make things done</Checkbox>
|
|
21
|
-
</Gapped>;
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
По умолчанию `Gapped` выстраивает элементы в одну строчку, но с помощью свойства `wrap` можно включить перенос элементов на новую строку.
|
|
25
|
-
При этом между строчками будет отступ равный значению свойста `gap`
|
|
26
|
-
В таком случае из-за особенности верстки `Gapped` может перекрывать элементы расположенные сверху-слева.
|
|
27
|
-
|
|
28
|
-
```jsx harmony
|
|
29
|
-
import { Button, Checkbox, Toggle } from '@skbkontur/react-ui';
|
|
30
|
-
|
|
31
|
-
<>
|
|
32
|
-
{"U Can't Touch This! => "}
|
|
33
|
-
<Toggle />
|
|
34
|
-
|
|
35
|
-
<div style={{ paddingTop: '10px', position: 'relative', width: '250px' }}>
|
|
36
|
-
<Gapped wrap gap={50}>
|
|
37
|
-
<Button use="primary">Сохранить</Button>
|
|
38
|
-
<Button>Отмена</Button>
|
|
39
|
-
<Checkbox>Я не робот</Checkbox>
|
|
40
|
-
</Gapped>
|
|
41
|
-
</div>
|
|
42
|
-
</>;
|
|
43
|
-
```
|
|
1
|
+
Вывод элементов с горизонтальным расположением
|
|
2
|
+
|
|
3
|
+
```jsx harmony
|
|
4
|
+
import { Button } from '@skbkontur/react-ui';
|
|
5
|
+
|
|
6
|
+
<Gapped gap={20}>
|
|
7
|
+
<Button use="primary">Сохранить</Button>
|
|
8
|
+
<Button>Отмена</Button>
|
|
9
|
+
</Gapped>;
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Вертикальное расположение
|
|
13
|
+
|
|
14
|
+
```jsx harmony
|
|
15
|
+
import { Checkbox } from '@skbkontur/react-ui';
|
|
16
|
+
|
|
17
|
+
<Gapped vertical gap={20}>
|
|
18
|
+
<Checkbox checked>Write todos</Checkbox>
|
|
19
|
+
<Checkbox initialIndeterminate>Work in progress</Checkbox>
|
|
20
|
+
<Checkbox>Make things done</Checkbox>
|
|
21
|
+
</Gapped>;
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
По умолчанию `Gapped` выстраивает элементы в одну строчку, но с помощью свойства `wrap` можно включить перенос элементов на новую строку.
|
|
25
|
+
При этом между строчками будет отступ равный значению свойста `gap`
|
|
26
|
+
В таком случае из-за особенности верстки `Gapped` может перекрывать элементы расположенные сверху-слева.
|
|
27
|
+
|
|
28
|
+
```jsx harmony
|
|
29
|
+
import { Button, Checkbox, Toggle } from '@skbkontur/react-ui';
|
|
30
|
+
|
|
31
|
+
<>
|
|
32
|
+
{"U Can't Touch This! => "}
|
|
33
|
+
<Toggle />
|
|
34
|
+
|
|
35
|
+
<div style={{ paddingTop: '10px', position: 'relative', width: '250px' }}>
|
|
36
|
+
<Gapped wrap gap={50}>
|
|
37
|
+
<Button use="primary">Сохранить</Button>
|
|
38
|
+
<Button>Отмена</Button>
|
|
39
|
+
<Checkbox>Я не робот</Checkbox>
|
|
40
|
+
</Gapped>
|
|
41
|
+
</div>
|
|
42
|
+
</>;
|
|
43
|
+
```
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
```jsx harmony
|
|
2
|
-
import SearchIcon from '@skbkontur/react-icons/Search';
|
|
3
|
-
|
|
4
|
-
<Input leftIcon={<SearchIcon />} />;
|
|
5
|
-
```
|
|
6
|
-
|
|
7
|
-
Пример с префиксом:
|
|
8
|
-
|
|
9
|
-
```jsx harmony
|
|
10
|
-
import SearchIcon from '@skbkontur/react-icons/Search';
|
|
11
|
-
|
|
12
|
-
<Input width={400} prefix="https://kontur.ru/search?query=" rightIcon={<SearchIcon />} />;
|
|
13
|
-
```
|
|
1
|
+
```jsx harmony
|
|
2
|
+
import SearchIcon from '@skbkontur/react-icons/Search';
|
|
3
|
+
|
|
4
|
+
<Input leftIcon={<SearchIcon />} />;
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
Пример с префиксом:
|
|
8
|
+
|
|
9
|
+
```jsx harmony
|
|
10
|
+
import SearchIcon from '@skbkontur/react-icons/Search';
|
|
11
|
+
|
|
12
|
+
<Input width={400} prefix="https://kontur.ru/search?query=" rightIcon={<SearchIcon />} />;
|
|
13
|
+
```
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
```jsx harmony
|
|
2
|
-
<PasswordInput />
|
|
3
|
-
```
|
|
4
|
-
|
|
5
|
-
Пример с отслеживанием нажатия CapsLock:
|
|
6
|
-
|
|
7
|
-
```jsx harmony
|
|
8
|
-
<PasswordInput detectCapsLock />
|
|
9
|
-
```
|
|
1
|
+
```jsx harmony
|
|
2
|
+
<PasswordInput />
|
|
3
|
+
```
|
|
4
|
+
|
|
5
|
+
Пример с отслеживанием нажатия CapsLock:
|
|
6
|
+
|
|
7
|
+
```jsx harmony
|
|
8
|
+
<PasswordInput detectCapsLock />
|
|
9
|
+
```
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
```jsx harmony
|
|
2
|
-
import { Gapped, Radio } from '@skbkontur/react-ui';
|
|
3
|
-
|
|
4
|
-
let items = ['One', 'Two', 'Three', 'Four'];
|
|
5
|
-
|
|
6
|
-
let simpleRadioGroup = (
|
|
7
|
-
<div>
|
|
8
|
-
<h2>Numbers</h2>
|
|
9
|
-
<RadioGroup name="number-simple" items={items} defaultValue="One" />
|
|
10
|
-
</div>
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
let complexRadioGroup = (
|
|
14
|
-
<div>
|
|
15
|
-
<h2>Numbers</h2>
|
|
16
|
-
<RadioGroup name="number-complex" defaultValue="3">
|
|
17
|
-
<Gapped gap={40}>
|
|
18
|
-
<Gapped vertical gap={0}>
|
|
19
|
-
<b>Odd</b>
|
|
20
|
-
<Radio value="1">One</Radio>
|
|
21
|
-
<Radio value="3">Three</Radio>
|
|
22
|
-
<Radio value="5" disabled>
|
|
23
|
-
Five
|
|
24
|
-
</Radio>
|
|
25
|
-
<Radio value="7">Seven</Radio>
|
|
26
|
-
</Gapped>
|
|
27
|
-
<Gapped vertical gap={0}>
|
|
28
|
-
<b>Even</b>
|
|
29
|
-
<Radio value="2">Two</Radio>
|
|
30
|
-
<Radio value="4">Four</Radio>
|
|
31
|
-
<Radio value="6">Six</Radio>
|
|
32
|
-
<Radio value="8">Eight</Radio>
|
|
33
|
-
</Gapped>
|
|
34
|
-
</Gapped>
|
|
35
|
-
</RadioGroup>
|
|
36
|
-
</div>
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
<div>
|
|
40
|
-
{simpleRadioGroup}
|
|
41
|
-
{complexRadioGroup}
|
|
42
|
-
</div>;
|
|
43
|
-
```
|
|
1
|
+
```jsx harmony
|
|
2
|
+
import { Gapped, Radio } from '@skbkontur/react-ui';
|
|
3
|
+
|
|
4
|
+
let items = ['One', 'Two', 'Three', 'Four'];
|
|
5
|
+
|
|
6
|
+
let simpleRadioGroup = (
|
|
7
|
+
<div>
|
|
8
|
+
<h2>Numbers</h2>
|
|
9
|
+
<RadioGroup name="number-simple" items={items} defaultValue="One" />
|
|
10
|
+
</div>
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
let complexRadioGroup = (
|
|
14
|
+
<div>
|
|
15
|
+
<h2>Numbers</h2>
|
|
16
|
+
<RadioGroup name="number-complex" defaultValue="3">
|
|
17
|
+
<Gapped gap={40}>
|
|
18
|
+
<Gapped vertical gap={0}>
|
|
19
|
+
<b>Odd</b>
|
|
20
|
+
<Radio value="1">One</Radio>
|
|
21
|
+
<Radio value="3">Three</Radio>
|
|
22
|
+
<Radio value="5" disabled>
|
|
23
|
+
Five
|
|
24
|
+
</Radio>
|
|
25
|
+
<Radio value="7">Seven</Radio>
|
|
26
|
+
</Gapped>
|
|
27
|
+
<Gapped vertical gap={0}>
|
|
28
|
+
<b>Even</b>
|
|
29
|
+
<Radio value="2">Two</Radio>
|
|
30
|
+
<Radio value="4">Four</Radio>
|
|
31
|
+
<Radio value="6">Six</Radio>
|
|
32
|
+
<Radio value="8">Eight</Radio>
|
|
33
|
+
</Gapped>
|
|
34
|
+
</Gapped>
|
|
35
|
+
</RadioGroup>
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
<div>
|
|
40
|
+
{simpleRadioGroup}
|
|
41
|
+
{complexRadioGroup}
|
|
42
|
+
</div>;
|
|
43
|
+
```
|
|
@@ -389,12 +389,13 @@ export var Select = (_dec = locale('Select', SelectLocaleHelper), rootNode(_clas
|
|
|
389
389
|
width: "100%"
|
|
390
390
|
})) : null;
|
|
391
391
|
var value = this.getValue();
|
|
392
|
+
var hasFixedWidth = !!this.props.menuWidth && this.props.menuWidth !== 'auto';
|
|
392
393
|
return /*#__PURE__*/React.createElement(DropdownContainer, {
|
|
393
394
|
getParent: this.dropdownContainerGetParent,
|
|
394
395
|
offsetY: -1,
|
|
395
396
|
align: this.props.menuAlign,
|
|
396
397
|
disablePortal: this.props.disablePortal,
|
|
397
|
-
|
|
398
|
+
hasFixedWidth: hasFixedWidth
|
|
398
399
|
}, /*#__PURE__*/React.createElement(Menu, {
|
|
399
400
|
ref: this.refMenu,
|
|
400
401
|
width: this.props.menuWidth,
|