1 line
27 KiB
JSON
1 line
27 KiB
JSON
|
{"ast":null,"code":"\"use client\";\n\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport * as React from 'react';\nimport CheckCircleFilled from \"@ant-design/icons/es/icons/CheckCircleFilled\";\nimport CloseCircleFilled from \"@ant-design/icons/es/icons/CloseCircleFilled\";\nimport CloseOutlined from \"@ant-design/icons/es/icons/CloseOutlined\";\nimport ExclamationCircleFilled from \"@ant-design/icons/es/icons/ExclamationCircleFilled\";\nimport InfoCircleFilled from \"@ant-design/icons/es/icons/InfoCircleFilled\";\nimport classNames from 'classnames';\nimport CSSMotion from 'rc-motion';\nimport pickAttrs from \"rc-util/es/pickAttrs\";\nimport { composeRef } from \"rc-util/es/ref\";\nimport { replaceElement } from '../_util/reactNode';\nimport { devUseWarning } from '../_util/warning';\nimport { ConfigContext } from '../config-provider';\nimport useStyle from './style';\nconst iconMapFilled = {\n success: CheckCircleFilled,\n info: InfoCircleFilled,\n error: CloseCircleFilled,\n warning: ExclamationCircleFilled\n};\nconst IconNode = props => {\n const {\n icon,\n prefixCls,\n type\n } = props;\n const iconType = iconMapFilled[type] || null;\n if (icon) {\n return replaceElement(icon, /*#__PURE__*/React.createElement(\"span\", {\n className: `${prefixCls}-icon`\n }, icon), () => ({\n className: classNames(`${prefixCls}-icon`, {\n [icon.props.className]: icon.props.className\n })\n }));\n }\n return /*#__PURE__*/React.createElement(iconType, {\n className: `${prefixCls}-icon`\n });\n};\nconst CloseIconNode = props => {\n const {\n isClosable,\n prefixCls,\n closeIcon,\n handleClose,\n ariaProps\n } = props;\n const mergedCloseIcon = closeIcon === true || closeIcon === undefined ? /*#__PURE__*/React.createElement(CloseOutlined, null) : closeIcon;\n return isClosable ? ( /*#__PURE__*/React.createElement(\"button\", Object.assign({\n type: \"button\",\n onClick: handleClose,\n className: `${prefixCls}-close-icon`,\n tabIndex: 0\n }, ariaProps), mergedCloseIcon)) : null;\n};\nconst Alert = /*#__PURE__*/React.forwardRef((props, ref) => {\n const {\n description,\n prefixCls: customizePrefixCls,\n message,\n banner,\n className,\n rootClassName,\n style,\n onMouseEnter,\n onMouseLeave,\n onClick,\n afterClose,\n showIcon,\n closable,\n closeText,\n closeIcon,\n action,\n id\n } = props,\n otherProps = __rest(props, [\"description\", \"prefixCls\", \"message\", \"banner\", \"className\", \"rootClassName\", \"style\", \"onMouseEnter\", \"onMouseLeave\", \"onClick\", \"afterClose\", \"showIcon\", \"closable\", \"closeText\", \"closeIcon\", \"action\", \"id\"]);\n const [closed, setClosed] = React.useState(false);\n if (process.env.NODE_ENV !== 'production') {\n const warning = devUseWarning('Alert');\n warning.deprecated(!closeText, 'closeText', 'closable.closeIcon');\n }\n const internalRef = React.useRef(null);\n React.useImperativeHandle(ref, () => ({\n nativeElement: internalRef.current\n }));\n const {\n getPrefixCls,\n direction,\n alert\n } = React.useContext(ConfigContext);\n const prefixCls = getPrefixCls('alert', customizePrefixCls);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);\n const handleClose = e => {\n var _a;\n setClosed(true);\n (_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props, e);\n };\n const type = React.useMemo(() => {\n if (props.type !== undefined) {\n return props.type;\n }\n // banner mode defaults to 'warning'\n return banner ? 'warning' :
|