1 line
7.3 KiB
JSON
1 line
7.3 KiB
JSON
|
{"ast":null,"code":"\"use client\";\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { devUseWarning } from '../_util/warning';\nimport { ConfigContext } from '../config-provider';\nimport AnchorContext from './context';\nconst AnchorLink = props => {\n const {\n href,\n title,\n prefixCls: customizePrefixCls,\n children,\n className,\n target,\n replace\n } = props;\n const context = React.useContext(AnchorContext);\n const {\n registerLink,\n unregisterLink,\n scrollTo,\n onClick,\n activeLink,\n direction\n } = context || {};\n React.useEffect(() => {\n registerLink === null || registerLink === void 0 ? void 0 : registerLink(href);\n return () => {\n unregisterLink === null || unregisterLink === void 0 ? void 0 : unregisterLink(href);\n };\n }, [href]);\n const handleClick = e => {\n onClick === null || onClick === void 0 ? void 0 : onClick(e, {\n title,\n href\n });\n scrollTo === null || scrollTo === void 0 ? void 0 : scrollTo(href);\n if (replace) {\n e.preventDefault();\n window.location.replace(href);\n }\n };\n // =================== Warning =====================\n if (process.env.NODE_ENV !== 'production') {\n const warning = devUseWarning('Anchor.Link');\n process.env.NODE_ENV !== \"production\" ? warning(!children || direction !== 'horizontal', 'usage', '`Anchor.Link children` is not supported when `Anchor` direction is horizontal') : void 0;\n }\n const {\n getPrefixCls\n } = React.useContext(ConfigContext);\n const prefixCls = getPrefixCls('anchor', customizePrefixCls);\n const active = activeLink === href;\n const wrapperClassName = classNames(`${prefixCls}-link`, className, {\n [`${prefixCls}-link-active`]: active\n });\n const titleClassName = classNames(`${prefixCls}-link-title`, {\n [`${prefixCls}-link-title-active`]: active\n });\n return /*#__PURE__*/React.createElement(\"div\", {\n className: wrapperClassName\n }, /*#__PURE__*/React.createElement(\"a\", {\n className: titleClassName,\n href: href,\n title: typeof title === 'string' ? title : '',\n target: target,\n onClick: handleClick\n }, title), direction !== 'horizontal' ? children : null);\n};\nexport default AnchorLink;","map":{"version":3,"names":["React","classNames","devUseWarning","ConfigContext","AnchorContext","AnchorLink","props","href","title","prefixCls","customizePrefixCls","children","className","target","replace","context","useContext","registerLink","unregisterLink","scrollTo","onClick","activeLink","direction","useEffect","handleClick","e","preventDefault","window","location","process","env","NODE_ENV","warning","getPrefixCls","active","wrapperClassName","titleClassName","createElement"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/antd/es/anchor/AnchorLink.js"],"sourcesContent":["\"use client\";\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { devUseWarning } from '../_util/warning';\nimport { ConfigContext } from '../config-provider';\nimport AnchorContext from './context';\nconst AnchorLink = props => {\n const {\n href,\n title,\n prefixCls: customizePrefixCls,\n children,\n className,\n target,\n replace\n } = props;\n const context = React.useContext(AnchorContext);\n const {\n registerLink,\n unregisterLink,\n scrollTo,\n onClick,\n activeLink,\n direction\n } = context || {};\n React.useEffect(() => {\n registerLink === null || registerLink === void 0 ? void 0 : registerLink(href);\n return () => {\n unregisterLink === null || unregisterLink === void 0 ? void 0 : unregisterLink(href);\n };\n }, [href]);\n const handleClick = e => {\n onClick === null || onClick === void 0 ? void 0 : onClick(e, {\n title,\n href\n });\n scrollTo === null || scrollTo === void 0 ? void 0 : scrollTo(href);\n if (replace) {\n e.preventDefault();\n window.location.replace(href);\n }\n };\n // ===================
|