@salutejs/plasma-new-hope 0.95.0-canary.1253.9741700312.0 → 0.95.0-canary.1272.9742620045.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Combobox/Combobox.js +1 -1
- package/cjs/components/Combobox/ui/ComboboxDivider/ComboboxDivider.js +1 -1
- package/cjs/components/Combobox/ui/ComboboxFooter/ComboboxFooter.js +1 -1
- package/cjs/components/Combobox/ui/ComboboxGroup/ComboboxGroup.js +1 -1
- package/cjs/components/Combobox/ui/ComboboxHeader/ComboboxHeader.js +1 -1
- package/cjs/components/DatePicker/RangeDate/RangeDate.css +6 -6
- package/cjs/components/DatePicker/RangeDate/RangeDatePopover/RangeDatePopover.css +6 -6
- package/cjs/components/DatePicker/SingleDate/SingleDate.css +6 -6
- package/cjs/components/Drawer/Drawer.js +1 -1
- package/cjs/components/Drawer/hooks/useDrawer.js +3 -1
- package/cjs/components/Drawer/hooks/useDrawer.js.map +1 -1
- package/cjs/components/Dropdown/Dropdown.js +1 -1
- package/cjs/components/Dropdown/ui/DropdownInner/DropdownInner.js +1 -1
- package/cjs/components/Modal/hooks/useModal.js +3 -1
- package/cjs/components/Modal/hooks/useModal.js.map +1 -1
- package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles.js +1 -1
- package/cjs/components/Popover/Popover.js +9 -3
- package/cjs/components/Popover/Popover.js.map +1 -1
- package/cjs/components/Popup/Popup.js +9 -3
- package/cjs/components/Popup/Popup.js.map +1 -1
- package/cjs/components/Portal/Portal.js +36 -0
- package/cjs/components/Portal/Portal.js.map +1 -0
- package/cjs/components/Range/Range.css +6 -6
- package/cjs/components/Select/Select.js +1 -1
- package/cjs/components/Select/ui/SelectDivider/SelectDivider.js +1 -1
- package/cjs/components/Select/ui/SelectFooter/SelectFooter.js +1 -1
- package/cjs/components/Select/ui/SelectGroup/SelectGroup.js +1 -1
- package/cjs/components/Select/ui/SelectHeader/SelectHeader.js +1 -1
- package/cjs/components/Select/ui/SelectItem/SelectItem.js +1 -1
- package/cjs/components/Select/ui/SelectItem/SelectItem.styles.js +1 -1
- package/cjs/components/Slider/Slider.css +6 -6
- package/cjs/components/Slider/components/Double/Double.css +6 -6
- package/cjs/components/TextField/TextField.styles.js +1 -1
- package/cjs/components/TextField/TextField.styles.js.map +1 -1
- package/cjs/components/TextField/{TextField.styles_9fkr1l.css → TextField.styles_aqmut.css} +2 -2
- package/cjs/index.css +6 -6
- package/cjs/index.js +3 -0
- package/cjs/index.js.map +1 -1
- package/es/components/Combobox/Combobox.js +1 -1
- package/es/components/Combobox/ui/ComboboxDivider/ComboboxDivider.js +1 -1
- package/es/components/Combobox/ui/ComboboxFooter/ComboboxFooter.js +1 -1
- package/es/components/Combobox/ui/ComboboxGroup/ComboboxGroup.js +1 -1
- package/es/components/Combobox/ui/ComboboxHeader/ComboboxHeader.js +1 -1
- package/es/components/DatePicker/RangeDate/RangeDate.css +6 -6
- package/es/components/DatePicker/RangeDate/RangeDatePopover/RangeDatePopover.css +6 -6
- package/es/components/DatePicker/SingleDate/SingleDate.css +6 -6
- package/es/components/Drawer/Drawer.js +1 -1
- package/es/components/Drawer/hooks/useDrawer.js +3 -1
- package/es/components/Drawer/hooks/useDrawer.js.map +1 -1
- package/es/components/Dropdown/Dropdown.js +1 -1
- package/es/components/Dropdown/ui/DropdownInner/DropdownInner.js +1 -1
- package/es/components/Modal/hooks/useModal.js +3 -1
- package/es/components/Modal/hooks/useModal.js.map +1 -1
- package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles.js +1 -1
- package/es/components/Popover/Popover.js +9 -3
- package/es/components/Popover/Popover.js.map +1 -1
- package/es/components/Popup/Popup.js +9 -3
- package/es/components/Popup/Popup.js.map +1 -1
- package/es/components/Portal/Portal.js +31 -0
- package/es/components/Portal/Portal.js.map +1 -0
- package/es/components/Range/Range.css +6 -6
- package/es/components/Select/Select.js +1 -1
- package/es/components/Select/ui/SelectDivider/SelectDivider.js +1 -1
- package/es/components/Select/ui/SelectFooter/SelectFooter.js +1 -1
- package/es/components/Select/ui/SelectGroup/SelectGroup.js +1 -1
- package/es/components/Select/ui/SelectHeader/SelectHeader.js +1 -1
- package/es/components/Select/ui/SelectItem/SelectItem.js +1 -1
- package/es/components/Select/ui/SelectItem/SelectItem.styles.js +1 -1
- package/es/components/Slider/Slider.css +6 -6
- package/es/components/Slider/components/Double/Double.css +6 -6
- package/es/components/TextField/TextField.styles.js +1 -1
- package/es/components/TextField/TextField.styles.js.map +1 -1
- package/es/components/TextField/{TextField.styles_9fkr1l.css → TextField.styles_aqmut.css} +2 -2
- package/es/index.css +6 -6
- package/es/index.js +1 -0
- package/es/index.js.map +1 -1
- package/package.json +2 -2
- package/styled-components/cjs/components/Popover/Popover.js +8 -4
- package/styled-components/cjs/components/Popup/Popup.js +8 -4
- package/styled-components/cjs/components/Portal/Portal.js +37 -0
- package/styled-components/cjs/components/Portal/Portal.template-doc.mdx +66 -0
- package/styled-components/cjs/components/Portal/Portal.types.js +5 -0
- package/styled-components/cjs/components/Portal/index.js +18 -0
- package/styled-components/cjs/components/TextField/TextField.styles.js +2 -2
- package/styled-components/cjs/examples/plasma_b2c/components/Portal/Portal.js +10 -0
- package/styled-components/cjs/examples/plasma_b2c/components/Portal/Portal.stories.tsx +57 -0
- package/styled-components/cjs/examples/plasma_web/components/Portal/Portal.js +10 -0
- package/styled-components/cjs/examples/plasma_web/components/Portal/Portal.stories.tsx +57 -0
- package/styled-components/cjs/index.js +11 -0
- package/styled-components/es/components/Popover/Popover.js +8 -3
- package/styled-components/es/components/Popup/Popup.js +8 -3
- package/styled-components/es/components/Portal/Portal.js +27 -0
- package/styled-components/es/components/Portal/Portal.template-doc.mdx +66 -0
- package/styled-components/es/components/Portal/Portal.types.js +1 -0
- package/styled-components/es/components/Portal/index.js +1 -0
- package/styled-components/es/components/TextField/TextField.styles.js +2 -2
- package/styled-components/es/examples/plasma_b2c/components/Portal/Portal.js +4 -0
- package/styled-components/es/examples/plasma_b2c/components/Portal/Portal.stories.tsx +57 -0
- package/styled-components/es/examples/plasma_web/components/Portal/Portal.js +4 -0
- package/styled-components/es/examples/plasma_web/components/Portal/Portal.stories.tsx +57 -0
- package/styled-components/es/index.js +2 -1
- package/types/components/Popover/Popover.d.ts.map +1 -1
- package/types/components/Popup/Popup.d.ts.map +1 -1
- package/types/components/Portal/Portal.d.ts +13 -0
- package/types/components/Portal/Portal.d.ts.map +1 -0
- package/types/components/Portal/Portal.types.d.ts +18 -0
- package/types/components/Portal/Portal.types.d.ts.map +1 -0
- package/types/components/Portal/index.d.ts +3 -0
- package/types/components/Portal/index.d.ts.map +1 -0
- package/types/components/TextField/TextField.styles.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Portal/Portal.d.ts +3 -0
- package/types/examples/plasma_b2c/components/Portal/Portal.d.ts.map +1 -0
- package/types/examples/plasma_web/components/Portal/Portal.d.ts +3 -0
- package/types/examples/plasma_web/components/Portal/Portal.d.ts.map +1 -0
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Popover.js","sources":["../../../src/components/Popover/Popover.tsx"],"sourcesContent":["import React, { useRef, useCallback, useEffect, useState, forwardRef } from 'react';\nimport type { CSSProperties } from 'react';\nimport ReactDOM from 'react-dom';\nimport { usePopper } from 'react-popper';\nimport { useFocusTrap, useForkRef } from '@salutejs/plasma-core';\n\nimport type { RootProps } from '../../engines/types';\nimport { cx } from '../../utils';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport type { PopoverPlacement, PopoverProps } from './Popover.types';\nimport { StyledArrow, StyledPopover, StyledRoot, StyledWrapper } from './Popover.styles';\nimport { classes } from './Popover.tokens';\n\nexport const ESCAPE_KEYCODE = 27;\nexport const POPOVER_PORTAL_ID = 'plasma-popover-root';\n\n/**\n * Всплывающее окно с возможностью позиционирования\n * и вызова по клику либо ховеру.\n */\nexport const popoverRoot = (Root: RootProps<HTMLDivElement, PopoverProps>) =>\n forwardRef<HTMLDivElement, PopoverProps>(\n (\n {\n target,\n children,\n isOpen,\n trigger = 'click',\n hasArrow,\n frame = 'document',\n className,\n placement = 'auto',\n offset = [0, 0],\n zIndex,\n isFocusTrapped = true,\n closeOnEsc = true,\n preventOverflow = true,\n usePortal = false,\n view,\n onToggle,\n closeOnOverlayClick,\n ...rest\n },\n outerRootRef,\n ) => {\n const rootRef = useRef<HTMLDivElement | null>(null);\n const popoverRef = useRef<HTMLDivElement | null>(null);\n const handleRef = useForkRef<HTMLDivElement>(rootRef, outerRootRef);\n const portalRef = useRef<HTMLElement | null>(null);\n\n const trapRef = useFocusTrap(isOpen && isFocusTrapped);\n\n const popoverForkRef = useForkRef<HTMLDivElement>(popoverRef, trapRef);\n\n const [arrowElement, setArrowElement] = useState<HTMLSpanElement | null>(null);\n\n const [, forceRender] = useState(false);\n\n const isAutoArray = Array.isArray(placement);\n const isAuto = isAutoArray || (placement as PopoverPlacement).startsWith('auto');\n\n const initialStyles = {\n visibility: isOpen ? 'visible' : 'hidden',\n opacity: isOpen ? 1 : 0,\n } as CSSProperties;\n\n const { styles, attributes, forceUpdate } = usePopper(rootRef.current, popoverRef.current, {\n // TODO: #1121\n // eslint-disable-next-line no-nested-ternary\n placement: isAutoArray\n ? placement[0]?.endsWith('start')\n ? 'auto-start'\n : 'auto'\n : (placement as PopoverPlacement),\n modifiers: [\n {\n name: 'preventOverflow',\n options: {\n mainAxis: preventOverflow,\n },\n },\n { name: 'offset', options: { offset: [offset[0], offset[1]] } },\n {\n name: 'flip',\n enabled: isAuto,\n options: {\n allowedAutoPlacements: isAutoArray ? (placement as PopoverPlacement[]) : [],\n },\n },\n {\n name: 'arrow',\n options: {\n element: arrowElement,\n },\n },\n ],\n });\n\n const onEscape = useCallback(\n (event: KeyboardEvent) => {\n if (isOpen && closeOnEsc && event.keyCode === ESCAPE_KEYCODE) {\n onToggle?.(false, event);\n }\n },\n [closeOnEsc, isOpen, onToggle],\n );\n\n const onDocumentClick = useCallback(\n (event: MouseEvent) => {\n if (isOpen && closeOnOverlayClick && onToggle) {\n const targetIsRoot = event.target === rootRef.current;\n const rootHasTarget = rootRef.current?.contains(event.target as Element);\n\n if (!targetIsRoot && !rootHasTarget) {\n onToggle(false, event);\n }\n }\n },\n [closeOnOverlayClick, isOpen, onToggle],\n );\n\n const onClick = useCallback<React.MouseEventHandler>(\n (event) => {\n if (trigger === 'click') {\n const targetIsPopover = event.target === popoverRef.current;\n const rootHasTarget = popoverRef.current?.contains(event.target as Element);\n\n if (!targetIsPopover && !rootHasTarget) {\n onToggle?.(!isOpen, event);\n }\n }\n },\n [trigger, isOpen, onToggle],\n );\n\n const onMouseEnter = useCallback<React.MouseEventHandler>(\n (event) => {\n if (trigger === 'hover') {\n onToggle?.(true, event);\n }\n },\n [trigger, onToggle],\n );\n\n const onMouseLeave = useCallback<React.MouseEventHandler>(\n (event) => {\n if (trigger === 'hover') {\n onToggle?.(false, event);\n }\n },\n [trigger, onToggle],\n );\n\n const onFocus = useCallback<React.FocusEventHandler>(\n (event) => {\n if (trigger === 'hover') {\n onToggle?.(true, event);\n }\n },\n [trigger, onToggle],\n );\n\n const onBlur = useCallback<React.FocusEventHandler>(\n (event) => {\n if (trigger === 'hover') {\n onToggle?.(false, event);\n }\n },\n [trigger, onToggle],\n );\n\n useEffect(() => {\n document.addEventListener('click', onDocumentClick);\n return () => document.removeEventListener('click', onDocumentClick);\n }, [isOpen, onToggle]);\n\n useEffect(() => {\n window.addEventListener('keydown', onEscape);\n return () => window.removeEventListener('keydown', onEscape);\n }, [closeOnEsc, isOpen, onToggle]);\n\n useEffect(() => {\n let portal = document.getElementById(POPOVER_PORTAL_ID);\n\n if (typeof frame !== 'string' && frame && frame.current) {\n portal = frame.current;\n }\n\n if (!usePortal) {\n portal = rootRef.current;\n }\n\n if (!portal) {\n portal = document.createElement('div');\n portal.setAttribute('id', POPOVER_PORTAL_ID);\n\n if (typeof frame === 'string' && frame !== 'document') {\n document.getElementById(frame)?.appendChild(portal);\n } else {\n document.body.appendChild(portal);\n }\n }\n\n portalRef.current = portal;\n\n /**\n * Изменение стейта нужно для того, чтобы Popup\n * отобразился после записи DOM элемента в portalRef.current\n */\n forceRender(true);\n }, []);\n\n useEffect(() => {\n if (!isOpen || !forceUpdate) {\n return;\n }\n\n /*\n * INFO: Метод forceUpdate содержит в себе flushSync и приводит\n * к повторному рендеру компонента, который уже находится в процессе рендера.\n * Данный хак, нужен для того, чтобы это поведение избежать и перенаправить\n * вызов метода в очередь микрозадач.\n */\n Promise.resolve().then(forceUpdate);\n }, [isOpen, children, forceUpdate]);\n\n return (\n <StyledWrapper className={classes.wrapper} onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave}>\n <StyledRoot\n ref={handleRef}\n onClick={onClick}\n onFocus={onFocus}\n onBlur={onBlur}\n className={cx(className, classes.target)}\n >\n {target}\n </StyledRoot>\n {children &&\n portalRef.current &&\n ReactDOM.createPortal(\n <Root view={view} className={className} {...rest}>\n <StyledPopover\n {...attributes.popper}\n className={classes.root}\n ref={popoverForkRef}\n style={{\n ...styles.popper,\n ...{ display: isOpen ? 'block' : 'none' },\n ...initialStyles,\n }}\n zIndex={zIndex}\n >\n {hasArrow && (\n <StyledArrow\n className={classes.arrow}\n ref={setArrowElement}\n style={styles.arrow}\n {...attributes.arrow}\n />\n )}\n {children}\n </StyledPopover>\n </Root>,\n portalRef.current,\n )}\n </StyledWrapper>\n );\n },\n );\n\nexport const popoverConfig = {\n name: 'Popover',\n tag: 'div',\n layout: popoverRoot,\n base: '',\n variations: {\n view: {\n css: viewCSS,\n },\n },\n defaults: {\n view: 'default',\n },\n};\n"],"names":["ESCAPE_KEYCODE","POPOVER_PORTAL_ID","popoverRoot","Root","forwardRef","_ref","outerRootRef","_placement$","target","children","isOpen","_ref$trigger","trigger","hasArrow","_ref$frame","frame","className","_ref$placement","placement","_ref$offset","offset","zIndex","_ref$isFocusTrapped","isFocusTrapped","_ref$closeOnEsc","closeOnEsc","_ref$preventOverflow","preventOverflow","_ref$usePortal","usePortal","view","onToggle","closeOnOverlayClick","rest","_objectWithoutProperties","_excluded","rootRef","useRef","popoverRef","handleRef","useForkRef","portalRef","trapRef","useFocusTrap","popoverForkRef","_useState","useState","_useState2","_slicedToArray","arrowElement","setArrowElement","_useState3","_useState4","forceRender","isAutoArray","Array","isArray","isAuto","startsWith","initialStyles","visibility","opacity","_usePopper","usePopper","current","endsWith","modifiers","name","options","mainAxis","enabled","allowedAutoPlacements","element","styles","attributes","forceUpdate","onEscape","useCallback","event","keyCode","onDocumentClick","_rootRef$current","targetIsRoot","rootHasTarget","contains","onClick","_popoverRef$current","targetIsPopover","onMouseEnter","onMouseLeave","onFocus","onBlur","useEffect","document","addEventListener","removeEventListener","window","portal","getElementById","createElement","setAttribute","_document$getElementB","appendChild","body","Promise","resolve","then","React","StyledWrapper","classes","wrapper","StyledRoot","ref","cx","ReactDOM","createPortal","_extends","StyledPopover","popper","root","style","_objectSpread","display","StyledArrow","arrow","popoverConfig","tag","layout","base","variations","css","viewCSS","defaults"],"mappings":";;;;;;;;;;;AAcO,IAAMA,cAAc,GAAG,GAAE;AACzB,IAAMC,iBAAiB,GAAG,sBAAqB;;AAEtD;AACA;AACA;AACA;IACaC,WAAW,GAAG,SAAdA,WAAWA,CAAIC,IAA6C,EAAA;AAAA,EAAA,oBACrEC,UAAU,CACN,UAAAC,IAAA,EAqBIC,YAAY,EACX;AAAA,IAAA,IAAAC,WAAA,CAAA;AAAA,IAAA,IApBGC,MAAM,GAAAH,IAAA,CAANG,MAAM;MACNC,QAAQ,GAAAJ,IAAA,CAARI,QAAQ;MACRC,MAAM,GAAAL,IAAA,CAANK,MAAM;MAAAC,YAAA,GAAAN,IAAA,CACNO,OAAO;AAAPA,MAAAA,OAAO,GAAAD,YAAA,KAAG,KAAA,CAAA,GAAA,OAAO,GAAAA,YAAA;MACjBE,QAAQ,GAAAR,IAAA,CAARQ,QAAQ;MAAAC,UAAA,GAAAT,IAAA,CACRU,KAAK;AAALA,MAAAA,KAAK,GAAAD,UAA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ACH;AACDC,EAAAA,QAAQ,EAAE;AACNtG,IAAAA,IAAI,EAAE,SAAA;AACV,GAAA;AACJ;;;;"}
|
1
|
+
{"version":3,"file":"Popover.js","sources":["../../../src/components/Popover/Popover.tsx"],"sourcesContent":["import React, { useRef, useCallback, useEffect, useState, forwardRef } from 'react';\nimport type { CSSProperties } from 'react';\nimport { usePopper } from 'react-popper';\nimport { useFocusTrap, useForkRef } from '@salutejs/plasma-core';\n\nimport { component, mergeConfig } from '../../engines';\nimport type { RootProps } from '../../engines/types';\nimport { cx } from '../../utils';\nimport { portalConfig } from '../Portal';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport type { PopoverPlacement, PopoverProps } from './Popover.types';\nimport { StyledArrow, StyledPopover, StyledRoot, StyledWrapper } from './Popover.styles';\nimport { classes } from './Popover.tokens';\n\nexport const ESCAPE_KEYCODE = 27;\nexport const POPOVER_PORTAL_ID = 'plasma-popover-root';\n\nconst mergedPortalConfig = mergeConfig(portalConfig);\nconst Portal = component(mergedPortalConfig);\n\n/**\n * Всплывающее окно с возможностью позиционирования\n * и вызова по клику либо ховеру.\n */\nexport const popoverRoot = (Root: RootProps<HTMLDivElement, PopoverProps>) =>\n forwardRef<HTMLDivElement, PopoverProps>(\n (\n {\n target,\n children,\n isOpen,\n trigger = 'click',\n hasArrow,\n frame = 'document',\n className,\n placement = 'auto',\n offset = [0, 0],\n zIndex,\n isFocusTrapped = true,\n closeOnEsc = true,\n preventOverflow = true,\n usePortal = false,\n view,\n onToggle,\n closeOnOverlayClick,\n ...rest\n },\n outerRootRef,\n ) => {\n const rootRef = useRef<HTMLDivElement | null>(null);\n const popoverRef = useRef<HTMLDivElement | null>(null);\n const handleRef = useForkRef<HTMLDivElement>(rootRef, outerRootRef);\n const portalRef = useRef<HTMLElement | null>(null);\n\n const trapRef = useFocusTrap(isOpen && isFocusTrapped);\n\n const popoverForkRef = useForkRef<HTMLDivElement>(popoverRef, trapRef);\n\n const [arrowElement, setArrowElement] = useState<HTMLSpanElement | null>(null);\n\n const [, forceRender] = useState(false);\n\n const isAutoArray = Array.isArray(placement);\n const isAuto = isAutoArray || (placement as PopoverPlacement).startsWith('auto');\n\n const initialStyles = {\n visibility: isOpen ? 'visible' : 'hidden',\n opacity: isOpen ? 1 : 0,\n } as CSSProperties;\n\n const { styles, attributes, forceUpdate } = usePopper(rootRef.current, popoverRef.current, {\n // TODO: #1121\n // eslint-disable-next-line no-nested-ternary\n placement: isAutoArray\n ? placement[0]?.endsWith('start')\n ? 'auto-start'\n : 'auto'\n : (placement as PopoverPlacement),\n modifiers: [\n {\n name: 'preventOverflow',\n options: {\n mainAxis: preventOverflow,\n },\n },\n { name: 'offset', options: { offset: [offset[0], offset[1]] } },\n {\n name: 'flip',\n enabled: isAuto,\n options: {\n allowedAutoPlacements: isAutoArray ? (placement as PopoverPlacement[]) : [],\n },\n },\n {\n name: 'arrow',\n options: {\n element: arrowElement,\n },\n },\n ],\n });\n\n const onEscape = useCallback(\n (event: KeyboardEvent) => {\n if (isOpen && closeOnEsc && event.keyCode === ESCAPE_KEYCODE) {\n onToggle?.(false, event);\n }\n },\n [closeOnEsc, isOpen, onToggle],\n );\n\n const onDocumentClick = useCallback(\n (event: MouseEvent) => {\n if (isOpen && closeOnOverlayClick && onToggle) {\n const targetIsRoot = event.target === rootRef.current;\n const rootHasTarget = rootRef.current?.contains(event.target as Element);\n\n if (!targetIsRoot && !rootHasTarget) {\n onToggle(false, event);\n }\n }\n },\n [closeOnOverlayClick, isOpen, onToggle],\n );\n\n const onClick = useCallback<React.MouseEventHandler>(\n (event) => {\n if (trigger === 'click') {\n const targetIsPopover = event.target === popoverRef.current;\n const rootHasTarget = popoverRef.current?.contains(event.target as Element);\n\n if (!targetIsPopover && !rootHasTarget) {\n onToggle?.(!isOpen, event);\n }\n }\n },\n [trigger, isOpen, onToggle],\n );\n\n const onMouseEnter = useCallback<React.MouseEventHandler>(\n (event) => {\n if (trigger === 'hover') {\n onToggle?.(true, event);\n }\n },\n [trigger, onToggle],\n );\n\n const onMouseLeave = useCallback<React.MouseEventHandler>(\n (event) => {\n if (trigger === 'hover') {\n onToggle?.(false, event);\n }\n },\n [trigger, onToggle],\n );\n\n const onFocus = useCallback<React.FocusEventHandler>(\n (event) => {\n if (trigger === 'hover') {\n onToggle?.(true, event);\n }\n },\n [trigger, onToggle],\n );\n\n const onBlur = useCallback<React.FocusEventHandler>(\n (event) => {\n if (trigger === 'hover') {\n onToggle?.(false, event);\n }\n },\n [trigger, onToggle],\n );\n\n useEffect(() => {\n document.addEventListener('click', onDocumentClick);\n return () => document.removeEventListener('click', onDocumentClick);\n }, [isOpen, onToggle]);\n\n useEffect(() => {\n window.addEventListener('keydown', onEscape);\n return () => window.removeEventListener('keydown', onEscape);\n }, [closeOnEsc, isOpen, onToggle]);\n\n useEffect(() => {\n let portal = document.getElementById(POPOVER_PORTAL_ID);\n\n if (typeof frame !== 'string' && frame && frame.current) {\n portal = frame.current;\n }\n\n if (!usePortal) {\n portal = rootRef.current;\n }\n\n if (!portal) {\n portal = document.createElement('div');\n portal.setAttribute('id', POPOVER_PORTAL_ID);\n\n if (typeof frame === 'string' && frame !== 'document') {\n document.getElementById(frame)?.appendChild(portal);\n } else {\n document.body.appendChild(portal);\n }\n }\n\n portalRef.current = portal;\n\n /**\n * Изменение стейта нужно для того, чтобы Popup\n * отобразился после записи DOM элемента в portalRef.current\n */\n forceRender(true);\n }, []);\n\n useEffect(() => {\n if (!isOpen || !forceUpdate) {\n return;\n }\n\n /*\n * INFO: Метод forceUpdate содержит в себе flushSync и приводит\n * к повторному рендеру компонента, который уже находится в процессе рендера.\n * Данный хак, нужен для того, чтобы это поведение избежать и перенаправить\n * вызов метода в очередь микрозадач.\n */\n Promise.resolve().then(forceUpdate);\n }, [isOpen, children, forceUpdate]);\n\n return (\n <StyledWrapper className={classes.wrapper} onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave}>\n <StyledRoot\n ref={handleRef}\n onClick={onClick}\n onFocus={onFocus}\n onBlur={onBlur}\n className={cx(className, classes.target)}\n >\n {target}\n </StyledRoot>\n {children && portalRef.current && (\n <Portal container={portalRef.current}>\n <Root view={view} className={className} {...rest}>\n <StyledPopover\n {...attributes.popper}\n className={classes.root}\n ref={popoverForkRef}\n style={{\n ...styles.popper,\n ...{ display: isOpen ? 'block' : 'none' },\n ...initialStyles,\n }}\n zIndex={zIndex}\n >\n {hasArrow && (\n <StyledArrow\n className={classes.arrow}\n ref={setArrowElement}\n style={styles.arrow}\n {...attributes.arrow}\n />\n )}\n {children}\n </StyledPopover>\n </Root>\n </Portal>\n )}\n </StyledWrapper>\n );\n },\n );\n\nexport const popoverConfig = {\n name: 'Popover',\n tag: 'div',\n layout: popoverRoot,\n base: '',\n variations: {\n view: {\n css: viewCSS,\n },\n },\n defaults: {\n view: 'default',\n },\n};\n"],"names":["ESCAPE_KEYCODE","POPOVER_PORTAL_ID","mergedPortalConfig","mergeConfig","portalConfig","Portal","component","popoverRoot","Root","forwardRef","_ref","outerRootRef","_placement$","target","children","isOpen","_ref$trigger","trigger","hasArrow","_ref$frame","frame","className","_ref$placement","placement","_ref$offset","offset","zIndex","_ref$isFocusTrapped","isFocusTrapped","_ref$closeOnEsc","closeOnEsc","_ref$preventOverflow","preventOverflow","_ref$usePortal","usePortal","view","onToggle","closeOnOverlayClick","rest","_objectWithoutProperties","_excluded","rootRef","useRef","popoverRef","handleRef","useForkRef","portalRef","trapRef","useFocusTrap","popoverForkRef","_useState","useState","_useState2","_slicedToArray","arrowElement","setArrowElement","_useState3","_useState4","forceRender","isAutoArray","Array","isArray","isAuto","startsWith","initialStyles","visibility","opacity","_usePopper","usePopper","current","endsWith","modifiers","name","options","mainAxis","enabled","allowedAutoPlacements","element","styles","attributes","forceUpdate","onEscape","useCallback","event","keyCode","onDocumentClick","_rootRef$current","targetIsRoot","rootHasTarget","contains","onClick","_popoverRef$current","targetIsPopover","onMouseEnter","onMouseLeave","onFocus","onBlur","useEffect","document","addEventListener","removeEventListener","window","portal","getElementById","createElement","setAttribute","_document$getElementB","appendChild","body","Promise","resolve","then","React","StyledWrapper","classes","wrapper","StyledRoot","ref","cx","container","_extends","StyledPopover","popper","root","style","_objectSpread","display","StyledArrow","arrow","popoverConfig","tag","layout","base","variations","css","viewCSS","defaults"],"mappings":";;;;;;;;;;;;;AAeO,IAAMA,cAAc,GAAG,GAAE;AACzB,IAAMC,iBAAiB,GAAG,sBAAqB;AAEtD,IAAMC,kBAAkB,gBAAGC,WAAW,CAACC,YAAY,CAAC,CAAA;AACpD,IAAMC,MAAM,gBAAGC,SAAS,CAACJ,kBAAkB,CAAC,CAAA;;AAE5C;AACA;AACA;AACA;IACaK,WAAW,GAAG,SAAdA,WAAWA,CAAIC,IAA6C,EAAA;AAAA,EAAA,oBACrEC,UAAU,CACN,UAAAC,IAAA,EAqBIC,YAAY,EACX;AAAA,IAAA,IAAAC,WAAA,CAAA;AAAA,IAAA,IApBGC,MAAM,GAAAH,IAAA,CAANG,MAAM;MACNC,QAAQ,GAAAJ,IAAA,CAARI,QAAQ;MACRC,MAAM,GAAAL,IAAA,CAANK,MAAM;MAAAC,YAAA,GAAAN,IAAA,CACNO,OAAO;AAAPA,MAAAA,OAAO,GAAAD,YAAA,KAAG,KAAA,CAAA,GAAA,OAAO,GAAAA,YAAA;MACjBE,QAAQ,GAAAR,IAAA,CAARQ,QAAQ;MAAAC,UAAA,GAAAT,IAAA,CACRU,KAAK;AAALA,MAAAA,KAAK,GAAAD,UAAA,KAAG,KAAA,CAAA,GAAA,UAAU,GAAAA,UAAA;MAClBE,SAAS,GAAAX,IAAA,CAATW,SAAS;MAAAC,cAAA,GAAAZ,IAAA,CACTa,SAAS;AAATA,MAAAA,SAAS,GAAAD,cAAA,KAAG,KAAA,CAAA,GAAA,MAAM,GAAAA,cAAA;MAAAE,WAAA,GAAAd,IAAA,CAClBe,MAAM;MAANA,MAAM,GAAAD,WAAA,KAAG,KAAA,CAAA,GAAA,CAAC,CAAC,EAAE,CAAC,CAAC,GAAAA,WA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QAAA,CAAA,EAAA,EACNzC,UAAU,CAAC2C,MAAM,EAAA;MACrBrG,SAAS,EAAE6F,OAAO,CAACS,IAAK;AACxBN,MAAAA,GAAG,EAAEpE,cAAe;MACpB2E,KAAK,EAAAC,cAAA,CAAAA,cAAA,CAAAA,cAAA,CACE/C,EAAAA,EAAAA,MAAM,CAAC4C,MAAM,CACb,EAAA;AAAEI,QAAAA,OAAO,EAAE/G,MAAM,GAAG,OAAO,GAAG,MAAA;OAAQ,CAAA,EACtCiD,aAAa,CAClB;AACFtC,MAAAA,MAAM,EAAEA,MAAAA;KAEPR,CAAAA,EAAAA,QAAQ,iBACL8F,KAAA,CAAAR,aAAA,CAACuB,WAAW,EAAAP,QAAA,CAAA;MACRnG,SAAS,EAAE6F,OAAO,CAACc,KAAM;AACzBX,MAAAA,GAAG,EAAE9D,eAAgB;MACrBqE,KAAK,EAAE9C,MAAM,CAACkD,KAAAA;KACVjD,EAAAA,UAAU,CAACiD,KAAK,CACvB,CACJ,EACAlH,QACU,CACb,CACF,CAED,CAAC,CAAA;AAExB,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAMmH,aAAa,GAAG;AACzBzD,EAAAA,IAAI,EAAE,SAAS;AACf0D,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE5H,WAAW;AACnB6H,EAAAA,IAAI,EAAE,EAAE;AACRC,EAAAA,UAAU,EAAE;AACRlG,IAAAA,IAAI,EAAE;AACFmG,MAAAA,GAAG,EAAEC,IAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNrG,IAAAA,IAAI,EAAE,SAAA;AACV,GAAA;AACJ;;;;"}
|
@@ -1,8 +1,10 @@
|
|
1
1
|
import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
2
2
|
import React, { forwardRef, useRef, useState, useEffect } from 'react';
|
3
|
-
import ReactDOM from 'react-dom';
|
4
3
|
import { safeUseId, useForkRef } from '@salutejs/plasma-core';
|
5
4
|
import { cx } from '../../utils/index.js';
|
5
|
+
import { portalConfig } from '../Portal/Portal.js';
|
6
|
+
import '@linaria/core';
|
7
|
+
import { component, mergeConfig } from '../../engines/common.js';
|
6
8
|
import { POPUP_PORTAL_ID } from './PopupContext.js';
|
7
9
|
import { PopupRoot } from './PopupRoot.js';
|
8
10
|
import { usePopup } from './hooks/usePopup.js';
|
@@ -64,6 +66,8 @@ var handlePosition = function handlePosition(placement, offset) {
|
|
64
66
|
transform: transform
|
65
67
|
};
|
66
68
|
};
|
69
|
+
var mergedPortalConfig = /*#__PURE__*/mergeConfig(portalConfig);
|
70
|
+
var Portal = /*#__PURE__*/component(mergedPortalConfig);
|
67
71
|
|
68
72
|
/**
|
69
73
|
* Базовый копмонент Popup.
|
@@ -136,7 +140,9 @@ var popupRoot = function popupRoot(Root) {
|
|
136
140
|
return null;
|
137
141
|
}
|
138
142
|
var cls = cx(className, animationInfo !== null && animationInfo !== void 0 && animationInfo.endAnimation ? classes.endAnimation : '', animationInfo !== null && animationInfo !== void 0 && animationInfo.endTransition ? classes.endTransition : '');
|
139
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, portalRef.current && /*#__PURE__*/
|
143
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, portalRef.current && /*#__PURE__*/React.createElement(Portal, {
|
144
|
+
container: portalRef.current
|
145
|
+
}, /*#__PURE__*/React.createElement(Root, _extends({
|
140
146
|
className: cls
|
141
147
|
}, rest), overlay, /*#__PURE__*/React.createElement(PopupRoot, {
|
142
148
|
id: innerId,
|
@@ -146,7 +152,7 @@ var popupRoot = function popupRoot(Root) {
|
|
146
152
|
zIndex: zIndex,
|
147
153
|
animationInfo: animationInfo,
|
148
154
|
setVisible: setVisible
|
149
|
-
}, children))
|
155
|
+
}, children))));
|
150
156
|
});
|
151
157
|
};
|
152
158
|
var popupConfig = {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Popup.js","sources":["../../../src/components/Popup/Popup.tsx"],"sourcesContent":["import React, { forwardRef, useEffect, useRef, useState } from 'react';\nimport ReactDOM from 'react-dom';\nimport { useForkRef, safeUseId } from '@salutejs/plasma-core';\n\nimport { RootProps } from '../../engines/types';\nimport { cx } from '../../utils';\n\nimport type { PopupPlacementBasic, PopupPlacement, PopupPositionType, PopupProps } from './Popup.types';\nimport { POPUP_PORTAL_ID } from './PopupContext';\nimport { PopupRoot } from './PopupRoot';\nimport { usePopup } from './hooks';\nimport { classes } from './Popup.tokens';\n\nexport const handlePosition = (\n placement: PopupPlacement,\n offset: [number, number] | [string, string],\n): PopupPositionType => {\n let x = '0rem';\n let y = '0rem';\n\n if (offset) {\n const [_x, _y] = offset;\n x = typeof _x === 'number' ? `${_x}rem` : _x;\n y = typeof _y === 'number' ? `${_y}rem` : _y;\n }\n\n if (!placement || placement === 'center') {\n return {\n left: `calc(50% + ${x})`,\n top: `calc(50% - ${y})`,\n transform: 'translate(-50%, -50%)',\n };\n }\n\n let left;\n let right;\n let top;\n let bottom;\n let transform;\n const placements = placement.split('-') as PopupPlacementBasic[];\n\n placements.forEach((placement: PopupPlacementBasic) => {\n switch (placement) {\n case 'left':\n left = x;\n break;\n case 'right':\n right = x;\n break;\n case 'top':\n top = y;\n break;\n case 'bottom':\n bottom = y;\n break;\n default:\n break;\n }\n });\n\n const isCenteredX = left === undefined && right === undefined;\n const isCenteredY = top === undefined && bottom === undefined;\n\n if (isCenteredX) {\n transform = 'translateX(-50%)';\n }\n\n if (isCenteredY) {\n transform = 'translateY(-50%)';\n }\n\n return {\n left: isCenteredX ? `calc(50% + ${x})` : left,\n right,\n top: isCenteredY ? `calc(50% - ${y})` : top,\n bottom,\n transform,\n };\n};\n\n/**\n * Базовый копмонент Popup.\n */\nexport const popupRoot = (Root: RootProps<HTMLDivElement, PopupProps>) =>\n forwardRef<HTMLDivElement, PopupProps>(\n (\n {\n id,\n isOpen = false,\n placement = 'center',\n offset = [0, 0],\n frame = 'document',\n children,\n overlay,\n role,\n zIndex,\n popupInfo,\n withAnimation = false,\n className,\n ...rest\n },\n outerRootRef,\n ) => {\n const uniqId = safeUseId();\n const innerId = id || uniqId;\n\n const { isVisible, animationInfo, setVisible } = usePopup({\n isOpen,\n id: innerId,\n popupInfo,\n withAnimation,\n });\n\n const portalRef = useRef<HTMLElement | null>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n\n const innerRef = useForkRef<HTMLDivElement>(contentRef, outerRootRef);\n\n const [, forceRender] = useState(false);\n\n useEffect(() => {\n let portal = document.getElementById(POPUP_PORTAL_ID);\n\n if (typeof frame !== 'string' && frame && frame.current) {\n portal = frame.current;\n }\n\n if (!portal) {\n portal = document.createElement('div');\n portal.setAttribute('id', POPUP_PORTAL_ID);\n /**\n * Нужно для того, чтобы во фрейме не происходило скачков контента\n * при анимации через transform, если есть элемент с шириной/высотой в 100% (Overlay)\n */\n portal.style.width = '0';\n\n if (typeof frame === 'string' && frame !== 'document') {\n document.getElementById(frame)?.appendChild(portal);\n } else {\n document.body.appendChild(portal);\n }\n }\n\n portalRef.current = portal;\n\n /**\n * Изменение стейта нужно для того, чтобы Popup\n * отобразился после записи DOM элемента в portalRef.current\n */\n forceRender(true);\n }, []);\n\n if (!isVisible && !isOpen) {\n return null;\n }\n\n const cls = cx(\n className,\n animationInfo?.endAnimation ? classes.endAnimation : '',\n animationInfo?.endTransition ? classes.endTransition : '',\n );\n\n return (\n <>\n {portalRef.current &&\n ReactDOM.createPortal(\n <Root className={cls} {...rest}>\n {overlay}\n <PopupRoot\n id={innerId}\n ref={innerRef}\n position={handlePosition(placement, offset)}\n frame={frame}\n zIndex={zIndex}\n animationInfo={animationInfo}\n setVisible={setVisible}\n >\n {children}\n </PopupRoot>\n </Root>,\n portalRef.current,\n )}\n </>\n );\n },\n );\n\nexport const popupConfig = {\n name: 'Popup',\n tag: 'div',\n layout: popupRoot,\n base: '',\n variations: {},\n defaults: {},\n};\n"],"names":["handlePosition","placement","offset","x","y","_offset","_slicedToArray","_x","_y","concat","left","top","transform","right","bottom","placements","split","forEach","isCenteredX","undefined","isCenteredY","popupRoot","Root","forwardRef","_ref","outerRootRef","id","_ref$isOpen","isOpen","_ref$placement","_ref$offset","_ref$frame","frame","children","overlay","zIndex","popupInfo","_ref$withAnimation","withAnimation","className","rest","_objectWithoutProperties","_excluded","uniqId","safeUseId","innerId","_usePopup","usePopup","isVisible","animationInfo","setVisible","portalRef","useRef","contentRef","innerRef","useForkRef","_useState","useState","_useState2","forceRender","useEffect","portal","document","getElementById","POPUP_PORTAL_ID","current","createElement","setAttribute","style","width","_document$getElementB","appendChild","body","cls","cx","endAnimation","classes","endTransition","React","Fragment","ReactDOM","createPortal","_extends","PopupRoot","ref","position","popupConfig","name","tag","layout","base","variations","defaults"],"mappings":";;;;;;;;;;;AAaO,IAAMA,cAAc,GAAG,SAAjBA,cAAcA,CACvBC,SAAyB,EACzBC,MAA2C,EACvB;EACpB,IAAIC,CAAC,GAAG,MAAM,CAAA;EACd,IAAIC,CAAC,GAAG,MAAM,CAAA;AAEd,EAAA,IAAIF,MAAM,EAAE;AACR,IAAA,IAAAG,OAAA,GAAAC,cAAA,CAAiBJ,MAAM,EAAA,CAAA,CAAA;AAAhBK,MAAAA,EAAE,GAAAF,OAAA,CAAA,CAAA,CAAA;AAAEG,MAAAA,EAAE,GAAAH,OAAA,CAAA,CAAA,CAAA,CAAA;IACbF,CAAC,GAAG,OAAOI,EAAE,KAAK,QAAQ,MAAAE,MAAA,CAAMF,EAAE,EAAA,KAAA,CAAA,GAAQA,EAAE,CAAA;IAC5CH,CAAC,GAAG,OAAOI,EAAE,KAAK,QAAQ,MAAAC,MAAA,CAAMD,EAAE,EAAA,KAAA,CAAA,GAAQA,EAAE,CAAA;AAChD,GAAA;AAEA,EAAA,IAAI,CAACP,SAAS,IAAIA,SAAS,KAAK,QAAQ,EAAE;IACtC,OAAO;AACHS,MAAAA,IAAI,EAAAD,aAAAA,CAAAA,MAAA,CAAgBN,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,EAAAA,SAAS,CAACc,OAAO,iBACde,QAAQ,CAACC,YAAY,eACjBH,KAAA,CAAAZ,aAAA,CAAC5C,IAAI,EAAA4D,QAAA,CAAA;AAAC3C,MAAAA,SAAS,EAAEkC,GAAAA;KAASjC,EAAAA,IAAI,GACzBN,OAAO,eACR4C,KAAA,CAAAZ,aAAA,CAACiB,SAAS,EAAA;AACNzD,MAAAA,EAAE,EAAEmB,OAAQ;AACZuC,MAAAA,GAAG,EAAE9B,QAAS;AACd+B,MAAAA,QAAQ,EAAErF,cAAc,CAACC,SAAS,EAAEC,MAAM,CAAE;AAC5C8B,MAAAA,KAAK,EAAEA,KAAM;AACbG,MAAAA,MAAM,EAAEA,MAAO;AACfc,MAAAA,aAAa,EAAEA,aAAc;AAC7BC,MAAAA,UAAU,EAAEA,UAAAA;KAEXjB,EAAAA,QACM,CACT,CAAC,EACPkB,SAAS,CAACc,OACd,CACN,CAAC,CAAA;AAEX,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAMqB,WAAW,GAAG;AACvBC,EAAAA,IAAI,EAAE,OAAO;AACbC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAEpE,SAAS;AACjBqE,EAAAA,IAAI,EAAE,EAAE;EACRC,UAAU,EAAE,EAAE;AACdC,EAAAA,QAAQ,EAAE,EAAC;AACf;;;;"}
|
1
|
+
{"version":3,"file":"Popup.js","sources":["../../../src/components/Popup/Popup.tsx"],"sourcesContent":["import React, { forwardRef, useEffect, useRef, useState } from 'react';\nimport { useForkRef, safeUseId } from '@salutejs/plasma-core';\n\nimport { RootProps } from '../../engines/types';\nimport { cx } from '../../utils';\nimport { portalConfig } from '../Portal';\nimport { component, mergeConfig } from '../../engines';\n\nimport type { PopupPlacementBasic, PopupPlacement, PopupPositionType, PopupProps } from './Popup.types';\nimport { POPUP_PORTAL_ID } from './PopupContext';\nimport { PopupRoot } from './PopupRoot';\nimport { usePopup } from './hooks';\nimport { classes } from './Popup.tokens';\n\nexport const handlePosition = (\n placement: PopupPlacement,\n offset: [number, number] | [string, string],\n): PopupPositionType => {\n let x = '0rem';\n let y = '0rem';\n\n if (offset) {\n const [_x, _y] = offset;\n x = typeof _x === 'number' ? `${_x}rem` : _x;\n y = typeof _y === 'number' ? `${_y}rem` : _y;\n }\n\n if (!placement || placement === 'center') {\n return {\n left: `calc(50% + ${x})`,\n top: `calc(50% - ${y})`,\n transform: 'translate(-50%, -50%)',\n };\n }\n\n let left;\n let right;\n let top;\n let bottom;\n let transform;\n const placements = placement.split('-') as PopupPlacementBasic[];\n\n placements.forEach((placement: PopupPlacementBasic) => {\n switch (placement) {\n case 'left':\n left = x;\n break;\n case 'right':\n right = x;\n break;\n case 'top':\n top = y;\n break;\n case 'bottom':\n bottom = y;\n break;\n default:\n break;\n }\n });\n\n const isCenteredX = left === undefined && right === undefined;\n const isCenteredY = top === undefined && bottom === undefined;\n\n if (isCenteredX) {\n transform = 'translateX(-50%)';\n }\n\n if (isCenteredY) {\n transform = 'translateY(-50%)';\n }\n\n return {\n left: isCenteredX ? `calc(50% + ${x})` : left,\n right,\n top: isCenteredY ? `calc(50% - ${y})` : top,\n bottom,\n transform,\n };\n};\n\nconst mergedPortalConfig = mergeConfig(portalConfig);\nconst Portal = component(mergedPortalConfig);\n\n/**\n * Базовый копмонент Popup.\n */\nexport const popupRoot = (Root: RootProps<HTMLDivElement, PopupProps>) =>\n forwardRef<HTMLDivElement, PopupProps>(\n (\n {\n id,\n isOpen = false,\n placement = 'center',\n offset = [0, 0],\n frame = 'document',\n children,\n overlay,\n role,\n zIndex,\n popupInfo,\n withAnimation = false,\n className,\n ...rest\n },\n outerRootRef,\n ) => {\n const uniqId = safeUseId();\n const innerId = id || uniqId;\n\n const { isVisible, animationInfo, setVisible } = usePopup({\n isOpen,\n id: innerId,\n popupInfo,\n withAnimation,\n });\n\n const portalRef = useRef<HTMLElement | null>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n\n const innerRef = useForkRef<HTMLDivElement>(contentRef, outerRootRef);\n\n const [, forceRender] = useState(false);\n\n useEffect(() => {\n let portal = document.getElementById(POPUP_PORTAL_ID);\n\n if (typeof frame !== 'string' && frame && frame.current) {\n portal = frame.current;\n }\n\n if (!portal) {\n portal = document.createElement('div');\n portal.setAttribute('id', POPUP_PORTAL_ID);\n /**\n * Нужно для того, чтобы во фрейме не происходило скачков контента\n * при анимации через transform, если есть элемент с шириной/высотой в 100% (Overlay)\n */\n portal.style.width = '0';\n\n if (typeof frame === 'string' && frame !== 'document') {\n document.getElementById(frame)?.appendChild(portal);\n } else {\n document.body.appendChild(portal);\n }\n }\n\n portalRef.current = portal;\n\n /**\n * Изменение стейта нужно для того, чтобы Popup\n * отобразился после записи DOM элемента в portalRef.current\n */\n forceRender(true);\n }, []);\n\n if (!isVisible && !isOpen) {\n return null;\n }\n\n const cls = cx(\n className,\n animationInfo?.endAnimation ? classes.endAnimation : '',\n animationInfo?.endTransition ? classes.endTransition : '',\n );\n\n return (\n <>\n {portalRef.current && (\n <Portal container={portalRef.current}>\n <Root className={cls} {...rest}>\n {overlay}\n <PopupRoot\n id={innerId}\n ref={innerRef}\n position={handlePosition(placement, offset)}\n frame={frame}\n zIndex={zIndex}\n animationInfo={animationInfo}\n setVisible={setVisible}\n >\n {children}\n </PopupRoot>\n </Root>\n </Portal>\n )}\n </>\n );\n },\n );\n\nexport const popupConfig = {\n name: 'Popup',\n tag: 'div',\n layout: popupRoot,\n base: '',\n variations: {},\n defaults: {},\n};\n"],"names":["handlePosition","placement","offset","x","y","_offset","_slicedToArray","_x","_y","concat","left","top","transform","right","bottom","placements","split","forEach","isCenteredX","undefined","isCenteredY","mergedPortalConfig","mergeConfig","portalConfig","Portal","component","popupRoot","Root","forwardRef","_ref","outerRootRef","id","_ref$isOpen","isOpen","_ref$placement","_ref$offset","_ref$frame","frame","children","overlay","zIndex","popupInfo","_ref$withAnimation","withAnimation","className","rest","_objectWithoutProperties","_excluded","uniqId","safeUseId","innerId","_usePopup","usePopup","isVisible","animationInfo","setVisible","portalRef","useRef","contentRef","innerRef","useForkRef","_useState","useState","_useState2","forceRender","useEffect","portal","document","getElementById","POPUP_PORTAL_ID","current","createElement","setAttribute","style","width","_document$getElementB","appendChild","body","cls","cx","endAnimation","classes","endTransition","React","Fragment","container","_extends","PopupRoot","ref","position","popupConfig","name","tag","layout","base","variations","defaults"],"mappings":";;;;;;;;;;;;;AAcO,IAAMA,cAAc,GAAG,SAAjBA,cAAcA,CACvBC,SAAyB,EACzBC,MAA2C,EACvB;EACpB,IAAIC,CAAC,GAAG,MAAM,CAAA;EACd,IAAIC,CAAC,GAAG,MAAM,CAAA;AAEd,EAAA,IAAIF,MAAM,EAAE;AACR,IAAA,IAAAG,OAAA,GAAAC,cAAA,CAAiBJ,MAAM,EAAA,CAAA,CAAA;AAAhBK,MAAAA,EAAE,GAAAF,OAAA,CAAA,CAAA,CAAA;AAAEG,MAAAA,EAAE,GAAAH,OAAA,CAAA,CAAA,CAAA,CAAA;IACbF,CAAC,GAAG,OAAOI,EAAE,KAAK,QAAQ,MAAAE,MAAA,CAAMF,EAAE,EAAA,KAAA,CAAA,GAAQA,EAAE,CAAA;IAC5CH,CAAC,GAAG,OAAOI,EAAE,KAAK,QAAQ,MAAAC,MAAA,CAAMD,EAAE,EAAA,KAAA,CAAA,GAAQA,EAAE,CAAA;AAChD,GAAA;AAEA,EAAA,IAAI,CAACP,SAAS,IAAIA,SAAS,KAAK,QAAQ,EAAE;IACtC,OAAO;AACHS,MAAAA,IAAI,EAAAD,aAAAA,CAAAA,MAAA,CAAgBN,CAAC,EAAG,GAAA,CAAA;AACxBQ,MAAAA,GAAG,EAAAF,aAAAA,CAAAA,MAAA,CAAgBL,CAAC,EAAG,GAAA,CAAA;AACvBQ,MAAAA,SAAS,EAAE,uBAAA;KACd,CAAA;AACL,GAAA;AAEA,EAAA,IAAIF,IAAI,CAAA;AACR,EAAA,IAAIG,KAAK,CAAA;AACT,EAAA,IAAIF,GAAG,CAAA;AACP,EAA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,KAAA,CAAAZ,aAAA,CAAC5C,IAAI,EAAA2D,QAAA,CAAA;AAAC1C,MAAAA,SAAS,EAAEkC,GAAAA;KAASjC,EAAAA,IAAI,GACzBN,OAAO,eACR4C,KAAA,CAAAZ,aAAA,CAACgB,SAAS,EAAA;AACNxD,MAAAA,EAAE,EAAEmB,OAAQ;AACZsC,MAAAA,GAAG,EAAE7B,QAAS;AACd8B,MAAAA,QAAQ,EAAEzF,cAAc,CAACC,SAAS,EAAEC,MAAM,CAAE;AAC5CmC,MAAAA,KAAK,EAAEA,KAAM;AACbG,MAAAA,MAAM,EAAEA,MAAO;AACfc,MAAAA,aAAa,EAAEA,aAAc;AAC7BC,MAAAA,UAAU,EAAEA,UAAAA;AAAW,KAAA,EAEtBjB,QACM,CACT,CACF,CAEd,CAAC,CAAA;AAEX,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAMoD,WAAW,GAAG;AACvBC,EAAAA,IAAI,EAAE,OAAO;AACbC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAEnE,SAAS;AACjBoE,EAAAA,IAAI,EAAE,EAAE;EACRC,UAAU,EAAE,EAAE;AACdC,EAAAA,QAAQ,EAAE,EAAC;AACf;;;;"}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import React, { forwardRef } from 'react';
|
2
|
+
import ReactDOM from 'react-dom';
|
3
|
+
|
4
|
+
/*
|
5
|
+
* Вспомогательный компонент. Используется в Popup, Popover.
|
6
|
+
* Представляет собой ReactDOM.createPortal() в форме компонента.
|
7
|
+
*/
|
8
|
+
var portalRoot = function portalRoot(Root) {
|
9
|
+
return /*#__PURE__*/forwardRef(function (_ref, outerRootRef) {
|
10
|
+
var children = _ref.children,
|
11
|
+
container = _ref.container,
|
12
|
+
_ref$disabled = _ref.disabled,
|
13
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled;
|
14
|
+
var portalContainer = typeof container === 'function' ? container() : container;
|
15
|
+
return /*#__PURE__*/React.createElement(Root, {
|
16
|
+
disabled: disabled,
|
17
|
+
ref: outerRootRef
|
18
|
+
}, disabled && children, !disabled && /*#__PURE__*/ReactDOM.createPortal(children, portalContainer));
|
19
|
+
});
|
20
|
+
};
|
21
|
+
var portalConfig = {
|
22
|
+
name: 'Portal',
|
23
|
+
tag: 'div',
|
24
|
+
layout: portalRoot,
|
25
|
+
base: '',
|
26
|
+
variations: {},
|
27
|
+
defaults: {}
|
28
|
+
};
|
29
|
+
|
30
|
+
export { portalConfig, portalRoot };
|
31
|
+
//# sourceMappingURL=Portal.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Portal.js","sources":["../../../src/components/Portal/Portal.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport ReactDOM from 'react-dom';\n\nimport type { RootProps } from '../../engines/types';\n\nimport { PortalProps } from './Portal.types';\n\n/*\n * Вспомогательный компонент. Используется в Popup, Popover.\n * Представляет собой ReactDOM.createPortal() в форме компонента.\n */\nexport const portalRoot = (Root: RootProps<HTMLDivElement, Omit<PortalProps, 'container'>>) =>\n forwardRef<HTMLDivElement, PortalProps>(({ children, container, disabled = false }, outerRootRef) => {\n const portalContainer = typeof container === 'function' ? container() : container;\n\n return (\n <Root disabled={disabled} ref={outerRootRef}>\n {disabled && children}\n {!disabled && ReactDOM.createPortal(children, portalContainer)}\n </Root>\n );\n });\n\nexport const portalConfig = {\n name: 'Portal',\n tag: 'div',\n layout: portalRoot,\n base: '',\n variations: {},\n defaults: {},\n};\n"],"names":["portalRoot","Root","forwardRef","_ref","outerRootRef","children","container","_ref$disabled","disabled","portalContainer","React","createElement","ref","ReactDOM","createPortal","portalConfig","name","tag","layout","base","variations","defaults"],"mappings":";;;AAOA;AACA;AACA;AACA;IACaA,UAAU,GAAG,SAAbA,UAAUA,CAAIC,IAA+D,EAAA;AAAA,EAAA,oBACtFC,UAAU,CAA8B,UAAAC,IAAA,EAA4CC,YAAY,EAAK;AAAA,IAAA,IAA1DC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;MAAEC,SAAS,GAAAH,IAAA,CAATG,SAAS;MAAAC,aAAA,GAAAJ,IAAA,CAAEK,QAAQ;AAARA,MAAAA,QAAQ,GAAAD,aAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,aAAA,CAAA;IAC5E,IAAME,eAAe,GAAG,OAAOH,SAAS,KAAK,UAAU,GAAGA,SAAS,EAAE,GAAGA,SAAS,CAAA;AAEjF,IAAA,oBACII,KAAA,CAAAC,aAAA,CAACV,IAAI,EAAA;AAACO,MAAAA,QAAQ,EAAEA,QAAS;AAACI,MAAAA,GAAG,EAAER,YAAAA;AAAa,KAAA,EACvCI,QAAQ,IAAIH,QAAQ,EACpB,CAACG,QAAQ,iBAAIK,QAAQ,CAACC,YAAY,CAACT,QAAQ,EAAEI,eAAe,CAC3D,CAAC,CAAA;AAEf,GAAC,CAAC,CAAA;AAAA,EAAA;AAEC,IAAMM,YAAY,GAAG;AACxBC,EAAAA,IAAI,EAAE,QAAQ;AACdC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAElB,UAAU;AAClBmB,EAAAA,IAAI,EAAE,EAAE;EACRC,UAAU,EAAE,EAAE;AACdC,EAAAA,QAAQ,EAAE,EAAC;AACf;;;;"}
|
@@ -18,13 +18,13 @@
|
|
18
18
|
|
19
19
|
.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_iq39zt5__2c88ab3d{color:var(--plasma-textfield-color-readonly);background-color:var(--plasma-textfield-bg-color-readonly);box-shadow:inset 0 0 0 var(--plasma-textfield-border-width) var(--plasma-textfield-border-color-readonly);}.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_iq39zt5__2c88ab3d:hover{background-color:var(--plasma-textfield-bg-color-readonly);}.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_io4bpie__2c88ab3d::-webkit-input-placeholder{color:var(--plasma-textfield__placeholder-color-readonly);}.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_io4bpie__2c88ab3d::-moz-placeholder{color:var(--plasma-textfield__placeholder-color-readonly);}.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_io4bpie__2c88ab3d:-ms-input-placeholder{color:var(--plasma-textfield__placeholder-color-readonly);}.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_io4bpie__2c88ab3d::placeholder{color:var(--plasma-textfield__placeholder-color-readonly);}.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_io4bpie__2c88ab3d{color:var(--plasma-textfield-color-readonly);cursor:default;min-width:unset;}.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_llv9av6__2c88ab3d{color:var(--plasma-textfield__left-helper-color-readonly);}.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_l13qvwoy__2c88ab3d{color:var(--plasma-textfield__label-color-readonly);}
|
20
20
|
|
21
|
-
.
|
22
|
-
.
|
23
|
-
.
|
24
|
-
.
|
21
|
+
.TextField_styles_aqmut_iq39zt5__4a8fddcd{position:relative;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;box-sizing:border-box;}
|
22
|
+
.TextField_styles_aqmut_i1j28rg8__4a8fddcd{-webkit-flex:1;-ms-flex:1;flex:1;overflow:scroll;position:relative;width:100%;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-scrollbar-width:none;-moz-scrollbar-width:none;-ms-scrollbar-width:none;scrollbar-width:none;overscroll-behavior:contain;}.TextField_styles_aqmut_i1j28rg8__4a8fddcd::-webkit-scrollbar{display:none;}.TextField_styles_aqmut_i1j28rg8__4a8fddcd.TextField_styles_aqmut_hasChips__4a8fddcd{height:var(--plasma-textfield__chip-height);border-radius:var(--plasma-textfield__chip-border-radius);}
|
23
|
+
.TextField_styles_aqmut_s13zudoe__4a8fddcd{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;gap:var(--plasma-textfield__chip-gap);margin-right:var(--plasma-textfield__chip-gap);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}
|
24
|
+
.TextField_styles_aqmut_io4bpie__4a8fddcd{box-sizing:border-box;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:0;padding:0;background-color:transparent;outline:none;-webkit-flex:1;-ms-flex:1;flex:1;min-width:60%;}
|
25
25
|
|
26
|
-
.
|
27
|
-
.
|
26
|
+
.TextField_styles_aqmut_s19ry60d__4a8fddcd{margin:var(--plasma-textfield__left-content-margin);}
|
27
|
+
.TextField_styles_aqmut_sbt1ohz__4a8fddcd{margin:var(--plasma-textfield__right-content-margin);}
|
28
28
|
|
29
29
|
|
30
30
|
|
@@ -10,8 +10,8 @@ import { base as base$2 } from './variations/_size/base.js';
|
|
10
10
|
import '@linaria/react';
|
11
11
|
import '@linaria/core';
|
12
12
|
import 'focus-visible';
|
13
|
-
import 'react-dom';
|
14
13
|
import 'react-popper';
|
14
|
+
import 'react-dom';
|
15
15
|
import 'styled-components';
|
16
16
|
import { classes } from './Select.tokens.js';
|
17
17
|
import { SelectTarget } from './ui/SelectTarget/SelectTarget.js';
|
@@ -5,8 +5,8 @@ import '@salutejs/plasma-core';
|
|
5
5
|
import '@linaria/react';
|
6
6
|
import '@linaria/core';
|
7
7
|
import 'focus-visible';
|
8
|
-
import 'react-dom';
|
9
8
|
import 'react-popper';
|
9
|
+
import 'react-dom';
|
10
10
|
import 'styled-components';
|
11
11
|
import { base as base$1 } from './variations/_view/base.js';
|
12
12
|
import { base as base$2 } from './variations/_size/base.js';
|
@@ -5,8 +5,8 @@ import '@linaria/react';
|
|
5
5
|
import { dropdownFooterRoot } from '../../../Dropdown/ui/DropdownFooter/DropdownFooter.js';
|
6
6
|
import '@linaria/core';
|
7
7
|
import 'focus-visible';
|
8
|
-
import 'react-dom';
|
9
8
|
import 'react-popper';
|
9
|
+
import 'react-dom';
|
10
10
|
import 'styled-components';
|
11
11
|
import { base as base$1 } from './variations/_view/base.js';
|
12
12
|
import { base as base$2 } from './variations/_size/base.js';
|
@@ -5,8 +5,8 @@ import '@linaria/react';
|
|
5
5
|
import { dropdownGroupRoot } from '../../../Dropdown/ui/DropdownGroup/DropdownGroup.js';
|
6
6
|
import '@linaria/core';
|
7
7
|
import 'focus-visible';
|
8
|
-
import 'react-dom';
|
9
8
|
import 'react-popper';
|
9
|
+
import 'react-dom';
|
10
10
|
import 'styled-components';
|
11
11
|
import { base as base$1 } from './variations/_view/base.js';
|
12
12
|
import { base as base$2 } from './variations/_size/base.js';
|
@@ -5,8 +5,8 @@ import '@linaria/react';
|
|
5
5
|
import { dropdownHeaderRoot } from '../../../Dropdown/ui/DropdownHeader/DropdownHeader.js';
|
6
6
|
import '@linaria/core';
|
7
7
|
import 'focus-visible';
|
8
|
-
import 'react-dom';
|
9
8
|
import 'react-popper';
|
9
|
+
import 'react-dom';
|
10
10
|
import 'styled-components';
|
11
11
|
import { base as base$1 } from './variations/_view/base.js';
|
12
12
|
import { base as base$2 } from './variations/_size/base.js';
|
@@ -4,8 +4,8 @@ import '@salutejs/plasma-core';
|
|
4
4
|
import '@linaria/react';
|
5
5
|
import '@linaria/core';
|
6
6
|
import 'focus-visible';
|
7
|
-
import 'react-dom';
|
8
7
|
import 'react-popper';
|
8
|
+
import 'react-dom';
|
9
9
|
import { dropdownItemOldRoot } from '../../../Dropdown/ui/DropdownItemOld/DropdownItemOld.js';
|
10
10
|
import { base as base$1 } from './variations/_view/base.js';
|
11
11
|
import { base as base$2 } from './variations/_size/base.js';
|
@@ -27,13 +27,13 @@
|
|
27
27
|
|
28
28
|
.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_iq39zt5__2c88ab3d{color:var(--plasma-textfield-color-readonly);background-color:var(--plasma-textfield-bg-color-readonly);box-shadow:inset 0 0 0 var(--plasma-textfield-border-width) var(--plasma-textfield-border-color-readonly);}.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_iq39zt5__2c88ab3d:hover{background-color:var(--plasma-textfield-bg-color-readonly);}.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_io4bpie__2c88ab3d::-webkit-input-placeholder{color:var(--plasma-textfield__placeholder-color-readonly);}.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_io4bpie__2c88ab3d::-moz-placeholder{color:var(--plasma-textfield__placeholder-color-readonly);}.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_io4bpie__2c88ab3d:-ms-input-placeholder{color:var(--plasma-textfield__placeholder-color-readonly);}.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_io4bpie__2c88ab3d::placeholder{color:var(--plasma-textfield__placeholder-color-readonly);}.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_io4bpie__2c88ab3d{color:var(--plasma-textfield-color-readonly);cursor:default;min-width:unset;}.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_llv9av6__2c88ab3d{color:var(--plasma-textfield__left-helper-color-readonly);}.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_l13qvwoy__2c88ab3d{color:var(--plasma-textfield__label-color-readonly);}
|
29
29
|
|
30
|
-
.
|
31
|
-
.
|
32
|
-
.
|
33
|
-
.
|
30
|
+
.TextField_styles_aqmut_iq39zt5__4a8fddcd{position:relative;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;box-sizing:border-box;}
|
31
|
+
.TextField_styles_aqmut_i1j28rg8__4a8fddcd{-webkit-flex:1;-ms-flex:1;flex:1;overflow:scroll;position:relative;width:100%;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-scrollbar-width:none;-moz-scrollbar-width:none;-ms-scrollbar-width:none;scrollbar-width:none;overscroll-behavior:contain;}.TextField_styles_aqmut_i1j28rg8__4a8fddcd::-webkit-scrollbar{display:none;}.TextField_styles_aqmut_i1j28rg8__4a8fddcd.TextField_styles_aqmut_hasChips__4a8fddcd{height:var(--plasma-textfield__chip-height);border-radius:var(--plasma-textfield__chip-border-radius);}
|
32
|
+
.TextField_styles_aqmut_s13zudoe__4a8fddcd{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;gap:var(--plasma-textfield__chip-gap);margin-right:var(--plasma-textfield__chip-gap);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}
|
33
|
+
.TextField_styles_aqmut_io4bpie__4a8fddcd{box-sizing:border-box;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:0;padding:0;background-color:transparent;outline:none;-webkit-flex:1;-ms-flex:1;flex:1;min-width:60%;}
|
34
34
|
|
35
|
-
.
|
36
|
-
.
|
35
|
+
.TextField_styles_aqmut_s19ry60d__4a8fddcd{margin:var(--plasma-textfield__left-content-margin);}
|
36
|
+
.TextField_styles_aqmut_sbt1ohz__4a8fddcd{margin:var(--plasma-textfield__right-content-margin);}
|
37
37
|
|
38
38
|
|
39
39
|
|
@@ -20,13 +20,13 @@
|
|
20
20
|
|
21
21
|
.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_iq39zt5__2c88ab3d{color:var(--plasma-textfield-color-readonly);background-color:var(--plasma-textfield-bg-color-readonly);box-shadow:inset 0 0 0 var(--plasma-textfield-border-width) var(--plasma-textfield-border-color-readonly);}.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_iq39zt5__2c88ab3d:hover{background-color:var(--plasma-textfield-bg-color-readonly);}.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_io4bpie__2c88ab3d::-webkit-input-placeholder{color:var(--plasma-textfield__placeholder-color-readonly);}.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_io4bpie__2c88ab3d::-moz-placeholder{color:var(--plasma-textfield__placeholder-color-readonly);}.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_io4bpie__2c88ab3d:-ms-input-placeholder{color:var(--plasma-textfield__placeholder-color-readonly);}.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_io4bpie__2c88ab3d::placeholder{color:var(--plasma-textfield__placeholder-color-readonly);}.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_io4bpie__2c88ab3d{color:var(--plasma-textfield-color-readonly);cursor:default;min-width:unset;}.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_llv9av6__2c88ab3d{color:var(--plasma-textfield__left-helper-color-readonly);}.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_l13qvwoy__2c88ab3d{color:var(--plasma-textfield__label-color-readonly);}
|
22
22
|
|
23
|
-
.
|
24
|
-
.
|
25
|
-
.
|
26
|
-
.
|
23
|
+
.TextField_styles_aqmut_iq39zt5__4a8fddcd{position:relative;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;box-sizing:border-box;}
|
24
|
+
.TextField_styles_aqmut_i1j28rg8__4a8fddcd{-webkit-flex:1;-ms-flex:1;flex:1;overflow:scroll;position:relative;width:100%;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-scrollbar-width:none;-moz-scrollbar-width:none;-ms-scrollbar-width:none;scrollbar-width:none;overscroll-behavior:contain;}.TextField_styles_aqmut_i1j28rg8__4a8fddcd::-webkit-scrollbar{display:none;}.TextField_styles_aqmut_i1j28rg8__4a8fddcd.TextField_styles_aqmut_hasChips__4a8fddcd{height:var(--plasma-textfield__chip-height);border-radius:var(--plasma-textfield__chip-border-radius);}
|
25
|
+
.TextField_styles_aqmut_s13zudoe__4a8fddcd{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;gap:var(--plasma-textfield__chip-gap);margin-right:var(--plasma-textfield__chip-gap);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}
|
26
|
+
.TextField_styles_aqmut_io4bpie__4a8fddcd{box-sizing:border-box;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:0;padding:0;background-color:transparent;outline:none;-webkit-flex:1;-ms-flex:1;flex:1;min-width:60%;}
|
27
27
|
|
28
|
-
.
|
29
|
-
.
|
28
|
+
.TextField_styles_aqmut_s19ry60d__4a8fddcd{margin:var(--plasma-textfield__left-content-margin);}
|
29
|
+
.TextField_styles_aqmut_sbt1ohz__4a8fddcd{margin:var(--plasma-textfield__right-content-margin);}
|
30
30
|
|
31
31
|
|
32
32
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"TextField.styles.js","sources":["../../../src/components/TextField/TextField.styles.ts"],"sourcesContent":["import { styled } from '@linaria/react';\n\nimport { classes, tokens } from './TextField.tokens';\n\nexport const InputWrapper = styled.div`\n position: relative;\n display: flex;\n align-items: center;\n box-sizing: border-box;\n`;\n\nexport const InputLabelWrapper = styled.div`\n flex: 1;\n overflow: scroll;\n position: relative;\n width: 100%;\n display: inline-flex;\n align-items: center;\n\n ::-webkit-scrollbar {\n display: none;\n }\n\n scrollbar-width: none;\n\n overscroll-behavior: contain;\n\n &.${String(classes.hasChips)} {\n height: var(${tokens.chipHeight});\n border-radius: var(${tokens.chipBorderRadius});\n }\n`;\n\nexport const StyledChips = styled.div`\n display: flex;\n gap: var(${tokens.chipGap});\n margin-right: var(${tokens.chipGap});\n user-select: none;\n`;\n\nexport const Input = styled.input`\n box-sizing: border-box;\n appearance: none;\n border: 0;\n padding: 0;\n background-color: transparent;\n outline: none;\n flex: 1;\n min-width: 60%;\n`;\n\nexport const Label = styled.label``;\n\nexport const StyledContentLeft = styled.div`\n margin: var(${tokens.leftContentMargin});\n
|
1
|
+
{"version":3,"file":"TextField.styles.js","sources":["../../../src/components/TextField/TextField.styles.ts"],"sourcesContent":["import { styled } from '@linaria/react';\n\nimport { classes, tokens } from './TextField.tokens';\n\nexport const InputWrapper = styled.div`\n position: relative;\n display: flex;\n align-items: center;\n box-sizing: border-box;\n`;\n\nexport const InputLabelWrapper = styled.div`\n flex: 1;\n overflow: scroll;\n position: relative;\n width: 100%;\n display: inline-flex;\n align-items: center;\n\n ::-webkit-scrollbar {\n display: none;\n }\n\n scrollbar-width: none;\n\n overscroll-behavior: contain;\n\n &.${String(classes.hasChips)} {\n height: var(${tokens.chipHeight});\n border-radius: var(${tokens.chipBorderRadius});\n }\n`;\n\nexport const StyledChips = styled.div`\n display: flex;\n gap: var(${tokens.chipGap});\n margin-right: var(${tokens.chipGap});\n user-select: none;\n`;\n\nexport const Input = styled.input`\n box-sizing: border-box;\n appearance: none;\n border: 0;\n padding: 0;\n background-color: transparent;\n outline: none;\n flex: 1;\n min-width: 60%;\n`;\n\nexport const Label = styled.label``;\n\nexport const StyledContentLeft = styled.div`\n margin: var(${tokens.leftContentMargin});\n`;\n\nexport const StyledContentRight = styled.div`\n margin: var(${tokens.rightContentMargin});\n`;\n\nexport const LeftHelper = styled.div``;\n\nexport const StyledTextBefore = styled.div``;\n\nexport const StyledTextAfter = styled.div``;\n"],"names":["InputWrapper","styled","name","class","propsAsIs","InputLabelWrapper","StyledChips","Input","Label","StyledContentLeft","StyledContentRight","LeftHelper","StyledTextBefore","StyledTextAfter"],"mappings":";;AAIO,IAAMA,YAAY,gBAAGC,MAAM,CAAA,KAAA,CAAA,CAAA;AAAAC,EAAAA,IAAA,EAAA,cAAA;AAAAC,EAAAA,OAAAA,EAAA,SAAA;AAAAC,EAAAA,SAAA,EAAA,KAAA;AAAA,CAKjC,EAAA;AAEM,IAAMC,iBAAiB,gBAAGJ,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B,gBAAGX,MAAM,CAAA,KAAA,CAAA,CAAA;AAAAC,EAAAA,IAAA,EAAA,kBAAA;AAAAC,EAAAA,OAAAA,EAAA,SAAA;AAAAC,EAAAA,SAAA,EAAA,KAAA;AAAA,CAAM,EAAA;AAErC,IAAMS,eAAe,gBAAGZ,MAAM,CAAA,KAAA,CAAA,CAAA;AAAAC,EAAAA,IAAA,EAAA,iBAAA;AAAAC,EAAAA,OAAAA,EAAA,SAAA;AAAAC,EAAAA,SAAA,EAAA,KAAA;AAAA,CAAM;;;;"}
|
@@ -3,8 +3,8 @@
|
|
3
3
|
.s13zudoe{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;gap:var(--plasma-textfield__chip-gap);margin-right:var(--plasma-textfield__chip-gap);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}
|
4
4
|
.io4bpie{box-sizing:border-box;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:0;padding:0;background-color:transparent;outline:none;-webkit-flex:1;-ms-flex:1;flex:1;min-width:60%;}
|
5
5
|
|
6
|
-
.s19ry60d{margin:var(--plasma-textfield__left-content-margin);
|
7
|
-
.sbt1ohz{margin:var(--plasma-textfield__right-content-margin);
|
6
|
+
.s19ry60d{margin:var(--plasma-textfield__left-content-margin);}
|
7
|
+
.sbt1ohz{margin:var(--plasma-textfield__right-content-margin);}
|
8
8
|
|
9
9
|
|
10
10
|
|
package/es/index.css
CHANGED
@@ -128,13 +128,13 @@
|
|
128
128
|
|
129
129
|
.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_iq39zt5__2c88ab3d{color:var(--plasma-textfield-color-readonly);background-color:var(--plasma-textfield-bg-color-readonly);box-shadow:inset 0 0 0 var(--plasma-textfield-border-width) var(--plasma-textfield-border-color-readonly);}.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_iq39zt5__2c88ab3d:hover{background-color:var(--plasma-textfield-bg-color-readonly);}.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_io4bpie__2c88ab3d::-webkit-input-placeholder{color:var(--plasma-textfield__placeholder-color-readonly);}.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_io4bpie__2c88ab3d::-moz-placeholder{color:var(--plasma-textfield__placeholder-color-readonly);}.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_io4bpie__2c88ab3d:-ms-input-placeholder{color:var(--plasma-textfield__placeholder-color-readonly);}.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_io4bpie__2c88ab3d::placeholder{color:var(--plasma-textfield__placeholder-color-readonly);}.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_io4bpie__2c88ab3d{color:var(--plasma-textfield-color-readonly);cursor:default;min-width:unset;}.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_llv9av6__2c88ab3d{color:var(--plasma-textfield__left-helper-color-readonly);}.base_1vu13zn_b1w985rt__2c88ab3d[readonly] .base_1vu13zn_l13qvwoy__2c88ab3d{color:var(--plasma-textfield__label-color-readonly);}
|
130
130
|
|
131
|
-
.
|
132
|
-
.
|
133
|
-
.
|
134
|
-
.
|
131
|
+
.TextField_styles_aqmut_iq39zt5__4a8fddcd{position:relative;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;box-sizing:border-box;}
|
132
|
+
.TextField_styles_aqmut_i1j28rg8__4a8fddcd{-webkit-flex:1;-ms-flex:1;flex:1;overflow:scroll;position:relative;width:100%;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-scrollbar-width:none;-moz-scrollbar-width:none;-ms-scrollbar-width:none;scrollbar-width:none;overscroll-behavior:contain;}.TextField_styles_aqmut_i1j28rg8__4a8fddcd::-webkit-scrollbar{display:none;}.TextField_styles_aqmut_i1j28rg8__4a8fddcd.TextField_styles_aqmut_hasChips__4a8fddcd{height:var(--plasma-textfield__chip-height);border-radius:var(--plasma-textfield__chip-border-radius);}
|
133
|
+
.TextField_styles_aqmut_s13zudoe__4a8fddcd{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;gap:var(--plasma-textfield__chip-gap);margin-right:var(--plasma-textfield__chip-gap);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}
|
134
|
+
.TextField_styles_aqmut_io4bpie__4a8fddcd{box-sizing:border-box;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:0;padding:0;background-color:transparent;outline:none;-webkit-flex:1;-ms-flex:1;flex:1;min-width:60%;}
|
135
135
|
|
136
|
-
.
|
137
|
-
.
|
136
|
+
.TextField_styles_aqmut_s19ry60d__4a8fddcd{margin:var(--plasma-textfield__left-content-margin);}
|
137
|
+
.TextField_styles_aqmut_sbt1ohz__4a8fddcd{margin:var(--plasma-textfield__right-content-margin);}
|
138
138
|
|
139
139
|
|
140
140
|
|
package/es/index.js
CHANGED
@@ -183,6 +183,7 @@ export { classes as accordionClasses, tokens as accordionTokens } from './compon
|
|
183
183
|
export { datePickerConfig, datePickerRoot } from './components/DatePicker/SingleDate/SingleDate.js';
|
184
184
|
export { datePickerRangeConfig, datePickerRangeRoot } from './components/DatePicker/RangeDate/RangeDate.js';
|
185
185
|
export { classes as datePickerClasses, tokens as datePickerTokens } from './components/DatePicker/DatePicker.tokens.js';
|
186
|
+
export { portalConfig, portalRoot } from './components/Portal/Portal.js';
|
186
187
|
export { component, mergeConfig } from './engines/common.js';
|
187
188
|
export { canUseDOM } from './utils/canUseDOM.js';
|
188
189
|
export { extractTextFrom } from './utils/extractTextFrom.js';
|
package/es/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@salutejs/plasma-new-hope",
|
3
|
-
"version": "0.95.0-canary.
|
3
|
+
"version": "0.95.0-canary.1272.9742620045.0",
|
4
4
|
"description": "Salute Design System blueprint",
|
5
5
|
"main": "cjs/index.js",
|
6
6
|
"module": "es/index.js",
|
@@ -106,5 +106,5 @@
|
|
106
106
|
"react-popper": "2.3.0",
|
107
107
|
"storeon": "3.1.5"
|
108
108
|
},
|
109
|
-
"gitHead": "
|
109
|
+
"gitHead": "a7a70560a63a2496b163fcfecc3d23011039ac0f"
|
110
110
|
}
|
@@ -6,15 +6,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
});
|
7
7
|
exports.popoverRoot = exports.popoverConfig = exports.POPOVER_PORTAL_ID = exports.ESCAPE_KEYCODE = void 0;
|
8
8
|
var _react = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("react"));
|
9
|
-
var _reactDom = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require("react-dom"));
|
10
9
|
var _reactPopper = /*#__PURE__*/require("react-popper");
|
11
10
|
var _plasmaCore = /*#__PURE__*/require("@salutejs/plasma-core");
|
11
|
+
var _engines = /*#__PURE__*/require("../../engines");
|
12
12
|
var _utils = /*#__PURE__*/require("../../utils");
|
13
|
+
var _Portal = /*#__PURE__*/require("../Portal");
|
13
14
|
var _base = /*#__PURE__*/require("./variations/_view/base");
|
14
15
|
var _Popover = /*#__PURE__*/require("./Popover.styles");
|
15
16
|
var _Popover2 = /*#__PURE__*/require("./Popover.tokens");
|
16
17
|
var _excluded = ["target", "children", "isOpen", "trigger", "hasArrow", "frame", "className", "placement", "offset", "zIndex", "isFocusTrapped", "closeOnEsc", "preventOverflow", "usePortal", "view", "onToggle", "closeOnOverlayClick"];
|
17
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
18
18
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
19
19
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
20
20
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
@@ -33,6 +33,8 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
33
33
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
34
34
|
var ESCAPE_KEYCODE = exports.ESCAPE_KEYCODE = 27;
|
35
35
|
var POPOVER_PORTAL_ID = exports.POPOVER_PORTAL_ID = 'plasma-popover-root';
|
36
|
+
var mergedPortalConfig = /*#__PURE__*/(0, _engines.mergeConfig)(_Portal.portalConfig);
|
37
|
+
var Portal = /*#__PURE__*/(0, _engines.component)(mergedPortalConfig);
|
36
38
|
|
37
39
|
/**
|
38
40
|
* Всплывающее окно с возможностью позиционирования
|
@@ -222,7 +224,9 @@ var popoverRoot = exports.popoverRoot = function popoverRoot(Root) {
|
|
222
224
|
onFocus: onFocus,
|
223
225
|
onBlur: onBlur,
|
224
226
|
className: (0, _utils.cx)(className, _Popover2.classes.target)
|
225
|
-
}, target), children && portalRef.current && /*#__PURE__*/
|
227
|
+
}, target), children && portalRef.current && /*#__PURE__*/_react["default"].createElement(Portal, {
|
228
|
+
container: portalRef.current
|
229
|
+
}, /*#__PURE__*/_react["default"].createElement(Root, _extends({
|
226
230
|
view: view,
|
227
231
|
className: className
|
228
232
|
}, rest), /*#__PURE__*/_react["default"].createElement(_Popover.StyledPopover, _extends({}, attributes.popper, {
|
@@ -236,7 +240,7 @@ var popoverRoot = exports.popoverRoot = function popoverRoot(Root) {
|
|
236
240
|
className: _Popover2.classes.arrow,
|
237
241
|
ref: setArrowElement,
|
238
242
|
style: styles.arrow
|
239
|
-
}, attributes.arrow)), children))
|
243
|
+
}, attributes.arrow)), children))));
|
240
244
|
});
|
241
245
|
};
|
242
246
|
var popoverConfig = exports.popoverConfig = {
|