{"version":3,"file":"InlineCodeHighlight.cjs","names":["CodeHighlight","classes"],"sources":["../../src/CodeHighlight/InlineCodeHighlight.tsx"],"sourcesContent":["import {\n  BoxProps,\n  createVarsResolver,\n  ElementProps,\n  factory,\n  Factory,\n  getRadius,\n  getThemeColor,\n  MantineColor,\n  MantineRadius,\n  StylesApiProps,\n  useProps,\n  useStyles,\n} from '@mantine/core';\nimport { CodeHighlight } from './CodeHighlight';\nimport classes from '../CodeHighlight.module.css';\n\nexport type InlineCodeHighlightStylesNames = 'inlineCodeHighlight';\nexport type InlineCodeHighlightCssVariables = {\n  inlineCodeHighlight: '--ch-background' | '--ch-radius';\n};\n\nexport interface InlineCodeHighlightProps\n  extends BoxProps, StylesApiProps<InlineCodeHighlightFactory>, ElementProps<'code'> {\n  /** Code to highlight */\n  code: string;\n\n  /** Language of the code, used to determine syntax highlighting */\n  language?: string;\n\n  /** Controls background color of the code. By default, the value depends on color scheme. */\n  background?: MantineColor;\n\n  /** Key of `theme.radius` or any valid CSS value to set border-radius @default 'sm' */\n  radius?: MantineRadius;\n\n  /** Adds border to the root element @default false */\n  withBorder?: boolean;\n}\n\nexport type InlineCodeHighlightFactory = Factory<{\n  props: InlineCodeHighlightProps;\n  ref: HTMLElement;\n  stylesNames: InlineCodeHighlightStylesNames;\n  vars: InlineCodeHighlightCssVariables;\n}>;\n\nconst varsResolver = createVarsResolver<InlineCodeHighlightFactory>(\n  (theme, { background, radius }) => ({\n    inlineCodeHighlight: {\n      '--ch-background': background ? getThemeColor(background, theme) : undefined,\n      '--ch-radius': typeof radius !== 'undefined' ? getRadius(radius) : undefined,\n    },\n  })\n);\n\nexport const InlineCodeHighlight = factory<InlineCodeHighlightFactory>((_props) => {\n  const props = useProps('InlineCodeHighlight', null, _props);\n  const { classNames, className, style, styles, unstyled, vars, attributes, ref, ...others } =\n    props;\n\n  const getStyles = useStyles<InlineCodeHighlightFactory>({\n    name: 'InlineCodeHighlight',\n    classes,\n    props,\n    className,\n    style,\n    classNames,\n    styles,\n    unstyled,\n    attributes,\n    vars,\n    varsResolver,\n    rootSelector: 'inlineCodeHighlight',\n  });\n\n  return (\n    <CodeHighlight {...others} ref={ref as any} {...getStyles('inlineCodeHighlight')} __inline />\n  );\n});\n\nInlineCodeHighlight.displayName = '@mantine/code-highlight/InlineCodeHighlight';\nInlineCodeHighlight.classes = classes;\nInlineCodeHighlight.varsResolver = varsResolver;\n"],"mappings":";;;;;;AA+CA,MAAM,gBAAA,GAAA,cAAA,qBACH,OAAO,EAAE,YAAY,cAAc,EAClC,qBAAqB;CACnB,mBAAmB,cAAA,GAAA,cAAA,eAA2B,YAAY,KAAK,IAAI,KAAA;CACnE,eAAe,OAAO,WAAW,eAAA,GAAA,cAAA,WAAwB,MAAM,IAAI,KAAA;AACrE,EACF,EACF;AAEA,MAAa,uBAAA,GAAA,cAAA,UAA2D,WAAW;CACjF,MAAM,SAAA,GAAA,cAAA,UAAiB,uBAAuB,MAAM,MAAM;CAC1D,MAAM,EAAE,YAAY,WAAW,OAAO,QAAQ,UAAU,MAAM,YAAY,KAAK,GAAG,WAChF;CAEF,MAAM,aAAA,GAAA,cAAA,WAAkD;EACtD,MAAM;EACN,SAAA,6BAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,cAAc;CAChB,CAAC;CAED,OACE,iBAAA,GAAA,kBAAA,KAACA,sBAAAA,eAAD;EAAe,GAAI;EAAa;EAAY,GAAI,UAAU,qBAAqB;EAAG,UAAA;CAAU,CAAA;AAEhG,CAAC;AAED,oBAAoB,cAAc;AAClC,oBAAoB,UAAUC,6BAAAA;AAC9B,oBAAoB,eAAe"}