PromoCursed/node_modules/.cache/babel-loader/8f65a1ca4f1a62ae697a079a5be64ce9ef8a3d6a5f1e84418577a9bff002eb68.json

1 line
23 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 contains from \"rc-util/es/Dom/contains\";\nimport useId from \"rc-util/es/hooks/useId\";\nimport KeyCode from \"rc-util/es/KeyCode\";\nimport pickAttrs from \"rc-util/es/pickAttrs\";\nimport * as React from 'react';\nimport { useEffect, useRef } from 'react';\nimport { getMotionName } from \"../util\";\nimport Content from \"./Content\";\nimport Mask from \"./Mask\";\nimport { warning } from \"rc-util/es/warning\";\nvar Dialog = function Dialog(props) {\n var _props$prefixCls = props.prefixCls,\n prefixCls = _props$prefixCls === void 0 ? 'rc-dialog' : _props$prefixCls,\n zIndex = props.zIndex,\n _props$visible = props.visible,\n visible = _props$visible === void 0 ? false : _props$visible,\n _props$keyboard = props.keyboard,\n keyboard = _props$keyboard === void 0 ? true : _props$keyboard,\n _props$focusTriggerAf = props.focusTriggerAfterClose,\n focusTriggerAfterClose = _props$focusTriggerAf === void 0 ? true : _props$focusTriggerAf,\n wrapStyle = props.wrapStyle,\n wrapClassName = props.wrapClassName,\n wrapProps = props.wrapProps,\n onClose = props.onClose,\n afterOpenChange = props.afterOpenChange,\n afterClose = props.afterClose,\n transitionName = props.transitionName,\n animation = props.animation,\n _props$closable = props.closable,\n closable = _props$closable === void 0 ? true : _props$closable,\n _props$mask = props.mask,\n mask = _props$mask === void 0 ? true : _props$mask,\n maskTransitionName = props.maskTransitionName,\n maskAnimation = props.maskAnimation,\n _props$maskClosable = props.maskClosable,\n maskClosable = _props$maskClosable === void 0 ? true : _props$maskClosable,\n maskStyle = props.maskStyle,\n maskProps = props.maskProps,\n rootClassName = props.rootClassName,\n modalClassNames = props.classNames,\n modalStyles = props.styles;\n if (process.env.NODE_ENV !== 'production') {\n ['wrapStyle', 'bodyStyle', 'maskStyle'].forEach(function (prop) {\n // (prop in props) && console.error(`Warning: ${prop} is deprecated, please use styles instead.`)\n warning(!(prop in props), \"\".concat(prop, \" is deprecated, please use styles instead.\"));\n });\n if ('wrapClassName' in props) {\n warning(false, \"wrapClassName is deprecated, please use classNames instead.\");\n }\n }\n var lastOutSideActiveElementRef = useRef();\n var wrapperRef = useRef();\n var contentRef = useRef();\n var _React$useState = React.useState(visible),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n animatedVisible = _React$useState2[0],\n setAnimatedVisible = _React$useState2[1];\n\n // ========================== Init ==========================\n var ariaId = useId();\n function saveLastOutSideActiveElementRef() {\n if (!contains(wrapperRef.current, document.activeElement)) {\n lastOutSideActiveElementRef.current = document.activeElement;\n }\n }\n function focusDialogContent() {\n if (!contains(wrapperRef.current, document.activeElement)) {\n var _contentRef$current;\n (_contentRef$current = contentRef.current) === null || _contentRef$current === void 0 || _contentRef$current.focus();\n }\n }\n\n // ========================= Events =========================\n function onDialogVisibleChanged(newVisible) {\n // Try to focus\n if (newVisible) {\n focusDialogContent();\n } else {\n // Clean up scroll bar & focus back\n setAnimatedVisible(false);\n if (mask && lastOutSideActiveElementRef.current && focusTriggerAfterClose) {\n try {\n lastOutSideActiveElementRef.current.focus({\n preventScroll: true\n });\n } catch (e) {\n // Do nothing\n }\n lastOutSideActiveElementRef.current = null;\n }\n\n