{"version":3,"file":"index.mjs","names":["Font: React.FC<Readonly<FontProps>>"],"sources":["../src/font.tsx"],"sourcesContent":["import type * as React from 'react';\n\ntype FallbackFont =\n  | 'Arial'\n  | 'Helvetica'\n  | 'Verdana'\n  | 'Georgia'\n  | 'Times New Roman'\n  | 'serif'\n  | 'sans-serif'\n  | 'monospace'\n  | 'cursive'\n  | 'fantasy';\n\ntype FontFormat =\n  | 'woff'\n  | 'woff2'\n  | 'truetype'\n  | 'opentype'\n  | 'embedded-opentype'\n  | 'svg';\n\ntype FontWeight = React.CSSProperties['fontWeight'];\ntype FontStyle = React.CSSProperties['fontStyle'];\n\nexport interface FontProps {\n  /** The font you want to use. NOTE: Do not insert multiple fonts here, use fallbackFontFamily for that */\n  fontFamily: string;\n  /** An array is possible, but the order of the array is the priority order */\n  fallbackFontFamily: FallbackFont | FallbackFont[];\n  /** Not all clients support web fonts. For support check: https://www.caniemail.com/features/css-at-font-face/ */\n  webFont?: {\n    url: string;\n    format: FontFormat;\n  };\n  /** Default: 'normal' */\n  fontStyle?: FontStyle;\n  /** Default: 400 */\n  fontWeight?: FontWeight;\n}\n\n/** The component MUST be place inside the <head> tag */\nexport const Font: React.FC<Readonly<FontProps>> = ({\n  fontFamily,\n  fallbackFontFamily,\n  webFont,\n  fontStyle = 'normal',\n  fontWeight = 400,\n}) => {\n  const src = webFont\n    ? `src: url(${webFont.url}) format('${webFont.format}');`\n    : '';\n\n  const style = `\n    @font-face {\n      font-family: '${fontFamily}';\n      font-style: ${fontStyle};\n      font-weight: ${fontWeight};\n      mso-font-alt: '${\n        Array.isArray(fallbackFontFamily)\n          ? fallbackFontFamily[0]\n          : fallbackFontFamily\n      }';\n      ${src}\n    }\n\n    * {\n      font-family: '${fontFamily}', ${\n        Array.isArray(fallbackFontFamily)\n          ? fallbackFontFamily.join(', ')\n          : fallbackFontFamily\n      };\n    }\n  `;\n  return <style dangerouslySetInnerHTML={{ __html: style }} />;\n};\n"],"mappings":";;;;AA0CA,MAAaA,QAAuC,EAClD,YACA,oBACA,SACA,YAAY,UACZ,aAAa,UACT;CACJ,MAAM,MAAM,UACR,YAAY,QAAQ,IAAI,YAAY,QAAQ,OAAO,OACnD;AAuBJ,QAAO,oBAAC,WAAM,yBAAyB,EAAE,QArB3B;;sBAEM,WAAW;oBACb,UAAU;qBACT,WAAW;uBAExB,MAAM,QAAQ,mBAAmB,GAC7B,mBAAmB,KACnB,mBACL;QACC,IAAI;;;;sBAIU,WAAW,KACzB,MAAM,QAAQ,mBAAmB,GAC7B,mBAAmB,KAAK,KAAK,GAC7B,mBACL;;KAGmD,GAAI"}