{"version":3,"file":"Text.mjs","sources":["../../../../src/beta/components/Text.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { PolymorphicComponentProps } from '@entur/utils';\n\nimport {\n  getSemanticTypeFromTextVariant,\n  getSpacingClasses,\n} from '../utils/utils';\n\nimport {\n  TypographySize,\n  TypographySpacing,\n  TypographyTextVariant,\n  TypographyWeight,\n} from '../types';\n\nimport './text.scss';\n\ntype TextBaseProps = {\n  /** Visuell tekststørrelse (typografi-token) */\n  size?: TypographySize;\n  /** Fontvekt */\n  weight?: TypographyWeight;\n  /** Variant (kan brukes til spesielle typer tekst som for eksempel caption) */\n  variant?: TypographyTextVariant;\n  /** Innhold */\n  children: React.ReactNode;\n  /** Spacing around the component */\n  spacing?: TypographySpacing;\n  /** Ekstra klassenavn */\n  className?: string;\n};\n\nexport type TextProps<C extends React.ElementType> = PolymorphicComponentProps<\n  C,\n  TextBaseProps\n>;\n\nconst TypographyText = <C extends React.ElementType = 'p'>({\n  children,\n  as,\n  size,\n  variant,\n  weight,\n  spacing,\n  className,\n  ...rest\n}: TextProps<C>) => {\n  const BodyElement = as || getSemanticTypeFromTextVariant(variant);\n\n  return (\n    <BodyElement\n      className={classNames(\n        'eds-text',\n        variant && `eds-text--${variant}`,\n        size && `eds-text--${size}`,\n        weight && `eds-text--weight-${weight}`,\n        getSpacingClasses(spacing, 'eds-text'),\n        className,\n      )}\n      {...rest}\n    >\n      {children}\n    </BodyElement>\n  );\n};\n\n// Export as Text to avoid DOM conflicts\nexport const Text = TypographyText;\n"],"names":[],"mappings":";;;;AAwCA,MAAM,iBAAiB,CAAoC;AAAA,EACzD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAoB;AAClB,QAAM,cAAc,MAAM,+BAA+B,OAAO;AAEhE,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA,WAAW,aAAa,OAAO;AAAA,QAC/B,QAAQ,aAAa,IAAI;AAAA,QACzB,UAAU,oBAAoB,MAAM;AAAA,QACpC,kBAAkB,SAAS,UAAU;AAAA,QACrC;AAAA,MAAA;AAAA,MAED,GAAG;AAAA,MAEH;AAAA,IAAA;AAAA,EAAA;AAGP;AAGO,MAAM,OAAO;"}