{"version":3,"file":"utils.mjs","sources":["../../../../src/components/Text/utils.ts"],"sourcesContent":["import { GrafanaTheme2, ThemeTypographyVariantTypes } from '@grafana/data';\n\nimport { TextProps } from './Text';\n\nexport const customWeight = (weight: TextProps['weight'], theme: GrafanaTheme2): number => {\n  switch (weight) {\n    case 'bold':\n      return theme.typography.fontWeightBold;\n    case 'medium':\n      return theme.typography.fontWeightMedium;\n    case 'light':\n      return theme.typography.fontWeightLight;\n    case 'regular':\n    case undefined:\n      return theme.typography.fontWeightRegular;\n  }\n};\n\nexport const customColor = (color: TextProps['color'], theme: GrafanaTheme2): string | undefined => {\n  switch (color) {\n    case 'error':\n      return theme.colors.error.text;\n    case 'success':\n      return theme.colors.success.text;\n    case 'info':\n      return theme.colors.info.text;\n    case 'warning':\n      return theme.colors.warning.text;\n    default:\n      return color ? theme.colors.text[color] : undefined;\n  }\n};\n\nexport const customVariant = (\n  theme: GrafanaTheme2,\n  element: TextProps['element'],\n  variant?: keyof ThemeTypographyVariantTypes\n) => {\n  if (variant) {\n    return theme.typography[variant];\n  }\n  switch (element) {\n    //Span elements does not have a default variant to be able to take the parents style\n    case 'span':\n      return;\n    case 'h1':\n      return theme.typography.h1;\n    case 'h2':\n      return theme.typography.h2;\n    case 'h3':\n      return theme.typography.h3;\n    case 'h4':\n      return theme.typography.h4;\n    case 'h5':\n      return theme.typography.h5;\n    case 'h6':\n      return theme.typography.h6;\n    default:\n      return theme.typography.body;\n  }\n};\n"],"names":[],"mappings":"AAIa,MAAA,YAAA,GAAe,CAAC,MAAA,EAA6B,KAAiC,KAAA;AACzF,EAAA,QAAQ,MAAQ;AAAA,IACd,KAAK,MAAA;AACH,MAAA,OAAO,MAAM,UAAW,CAAA,cAAA;AAAA,IAC1B,KAAK,QAAA;AACH,MAAA,OAAO,MAAM,UAAW,CAAA,gBAAA;AAAA,IAC1B,KAAK,OAAA;AACH,MAAA,OAAO,MAAM,UAAW,CAAA,eAAA;AAAA,IAC1B,KAAK,SAAA;AAAA,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