{"version":3,"file":"Typography.mjs","names":[],"sources":["../../../src/typography/Typography.tsx"],"sourcesContent":["/*!\n *\n *  Copyright (c) \"Neo4j\"\n *  Neo4j Sweden AB [http://neo4j.com]\n *\n *  This file is part of Neo4j.\n *\n *  Neo4j is free software: you can redistribute it and/or modify\n *  it under the terms of the GNU General Public License as published by\n *  the Free Software Foundation, either version 3 of the License, or\n *  (at your option) any later version.\n *\n *  This program is distributed in the hope that it will be useful,\n *  but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\nimport { type tokens } from '@neo4j-ndl/base';\nimport classNames from 'classnames';\n\nimport { type PolymorphicCommonProps } from '../_common/types';\n\nexport type TypographyVariants = keyof typeof tokens.typography;\n\ntype TypographyProps = {\n  /** The typography variant to use for the text. */\n  variant: TypographyVariants;\n  /** Content displayed inside the component */\n  children?: React.ReactNode;\n};\n\n/**\n * @remarks\n * Renders the public `ndl-typography-<variant>` class from `@neo4j-ndl/base`\n * (for example `ndl-typography-body-medium`). The same classes can be applied\n * to any element directly when the component cannot be used.\n */\nexport const Typography = <T extends React.ElementType = 'span'>(\n  props: PolymorphicCommonProps<T, TypographyProps>,\n): React.ReactElement | null => {\n  const {\n    as,\n    className = '',\n    children,\n    variant,\n    htmlAttributes,\n    ref,\n    ...restProps\n  } = props;\n\n  const classes = classNames(`ndl-typography-${variant}`, className);\n  const Component = as ?? 'span';\n\n  return (\n    <Component className={classes} ref={ref} {...restProps} {...htmlAttributes}>\n      {children}\n    </Component>\n  );\n};\n"],"mappings":";;;;;;CA4CI;CACA;CACA;CACA;CACA;CACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AATJ,MAAa,cACX,UAC8B;CAC9B,MAAM,EACJ,IACA,YAAY,IACZ,UACA,SACA,gBACA,QAAA,OACG,YAAA,yBACD,OAAA,SAAA;CAEJ,MAAM,UAAU,WAAW,kBAAkB,WAAW,SAAS;CAGjE,OACE,oBAHgB,OAAA,QAAA,OAAA,KAAA,IAAA,KAAM,QAAA,eAAA,eAAA,eAAA;EAGX,WAAW;EAAc;CAAS,GAAA,SAAA,GAAe,cAAA,GAAA,CAAA,GAAA,EACzD,SAAA,CACQ,CAAA;AAEf"}