UNPKG

@mantine/core

Version:

React components library focused on usability, accessibility and developer experience

1 lines 2.01 kB
{"version":3,"file":"Anchor.cjs","names":["polymorphicFactory","useProps","Text","classes"],"sources":["../../../src/components/Anchor/Anchor.tsx"],"sourcesContent":["import cx from 'clsx';\nimport { polymorphicFactory, PolymorphicFactory, useProps } from '../../core';\nimport { Text, TextCssVariables, TextProps, TextStylesNames, TextVariant } from '../Text';\nimport classes from './Anchor.module.css';\n\nexport type AnchorStylesNames = TextStylesNames;\nexport type AnchorVariant = TextVariant;\nexport type AnchorCssVariables = TextCssVariables;\n\nexport interface AnchorProps extends Omit<TextProps, 'span'> {\n /** Defines when `text-decoration: underline` styles are applied. @default hover */\n underline?: 'always' | 'hover' | 'not-hover' | 'never';\n}\n\nexport type AnchorFactory = PolymorphicFactory<{\n props: AnchorProps;\n defaultComponent: 'a';\n defaultRef: HTMLAnchorElement;\n stylesNames: AnchorStylesNames;\n vars: AnchorCssVariables;\n variant: AnchorVariant;\n}>;\n\nconst defaultProps = {\n underline: 'hover',\n} satisfies Partial<AnchorProps>;\n\nexport const Anchor = polymorphicFactory<AnchorFactory>((props) => {\n const { underline, className, unstyled, mod, ...others } = useProps(\n 'Anchor',\n defaultProps,\n props\n );\n\n return (\n <Text\n component=\"a\"\n className={cx({ [classes.root]: !unstyled }, className)}\n {...others}\n mod={[{ underline }, mod]}\n __staticSelector=\"Anchor\"\n unstyled={unstyled}\n />\n );\n});\n\nAnchor.classes = classes;\nAnchor.displayName = '@mantine/core/Anchor';\n"],"mappings":";;;;;;;;;;AAuBA,MAAM,eAAe,EACnB,WAAW,SACZ;AAED,MAAa,SAASA,4BAAAA,oBAAmC,UAAU;CACjE,MAAM,EAAE,WAAW,WAAW,UAAU,KAAK,GAAG,WAAWC,kBAAAA,SACzD,UACA,cACA,MACD;AAED,QACE,iBAAA,GAAA,kBAAA,KAACC,aAAAA,MAAD;EACE,WAAU;EACV,YAAA,GAAA,KAAA,SAAc,GAAGC,sBAAAA,QAAQ,OAAO,CAAC,UAAU,EAAE,UAAU;EACvD,GAAI;EACJ,KAAK,CAAC,EAAE,WAAW,EAAE,IAAI;EACzB,kBAAiB;EACP;EACV,CAAA;EAEJ;AAEF,OAAO,UAAUA,sBAAAA;AACjB,OAAO,cAAc"}