PromoCursed/node_modules/.cache/babel-loader/a60088ad60d714cc5f63316f8d91fcd0fd41369a2ac5113ac5d83b068c5b4808.json

1 line
20 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport classNames from 'classnames';\nimport CSSMotion from 'rc-motion';\nimport ResizeObserver from 'rc-resize-observer';\nimport useLayoutEffect from \"rc-util/es/hooks/useLayoutEffect\";\nimport { composeRef } from \"rc-util/es/ref\";\nimport * as React from 'react';\nimport Arrow from \"./Arrow\";\nimport Mask from \"./Mask\";\nimport PopupContent from \"./PopupContent\";\nvar Popup = /*#__PURE__*/React.forwardRef(function (props, ref) {\n var popup = props.popup,\n className = props.className,\n prefixCls = props.prefixCls,\n style = props.style,\n target = props.target,\n _onVisibleChanged = props.onVisibleChanged,\n open = props.open,\n keepDom = props.keepDom,\n fresh = props.fresh,\n onClick = props.onClick,\n mask = props.mask,\n arrow = props.arrow,\n arrowPos = props.arrowPos,\n align = props.align,\n motion = props.motion,\n maskMotion = props.maskMotion,\n forceRender = props.forceRender,\n getPopupContainer = props.getPopupContainer,\n autoDestroy = props.autoDestroy,\n Portal = props.portal,\n zIndex = props.zIndex,\n onMouseEnter = props.onMouseEnter,\n onMouseLeave = props.onMouseLeave,\n onPointerEnter = props.onPointerEnter,\n ready = props.ready,\n offsetX = props.offsetX,\n offsetY = props.offsetY,\n offsetR = props.offsetR,\n offsetB = props.offsetB,\n onAlign = props.onAlign,\n onPrepare = props.onPrepare,\n stretch = props.stretch,\n targetWidth = props.targetWidth,\n targetHeight = props.targetHeight;\n var childNode = typeof popup === 'function' ? popup() : popup;\n\n // We can not remove holder only when motion finished.\n var isNodeVisible = open || keepDom;\n\n // ======================= Container ========================\n var getPopupContainerNeedParams = (getPopupContainer === null || getPopupContainer === void 0 ? void 0 : getPopupContainer.length) > 0;\n var _React$useState = React.useState(!getPopupContainer || !getPopupContainerNeedParams),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n show = _React$useState2[0],\n setShow = _React$useState2[1];\n\n // Delay to show since `getPopupContainer` need target element\n useLayoutEffect(function () {\n if (!show && getPopupContainerNeedParams && target) {\n setShow(true);\n }\n }, [show, getPopupContainerNeedParams, target]);\n\n // ========================= Render =========================\n if (!show) {\n return null;\n }\n\n // >>>>> Offset\n var AUTO = 'auto';\n var offsetStyle = {\n left: '-1000vw',\n top: '-1000vh',\n right: AUTO,\n bottom: AUTO\n };\n\n // Set align style\n if (ready || !open) {\n var _experimental;\n var points = align.points;\n var dynamicInset = align.dynamicInset || ((_experimental = align._experimental) === null || _experimental === void 0 ? void 0 : _experimental.dynamicInset);\n var alignRight = dynamicInset && points[0][1] === 'r';\n var alignBottom = dynamicInset && points[0][0] === 'b';\n if (alignRight) {\n offsetStyle.right = offsetR;\n offsetStyle.left = AUTO;\n } else {\n offsetStyle.left = offsetX;\n offsetStyle.right = AUTO;\n }\n if (alignBottom) {\n offsetStyle.bottom = offsetB;\n offsetStyle.top = AUTO;\n } else {\n offsetStyle.top = offsetY;\n offsetStyle.bottom = AUTO;\n }\n }\n\n // >>>>> Misc\n var miscStyle = {};\n if (stretch) {\n if (stretch.includes('height') && targetHeight) {\n miscStyle.height = targetHeight;\n } else if (stretch.includes('minHeight') && targetHeight) {\n miscStyle.minHeight = targetHeight;\n }\n if (stretch.includes('width') && targetWidth) {\n miscStyle.width = targetWidth;\n } else if (stretch.includes('minWidth') && targetWidth) {\n miscStyle.minWidth = targetWidth;\n