{"version":3,"file":"index.mjs","names":[],"sources":["../src/code-inline.tsx"],"sourcesContent":["import * as React from 'react';\n\ntype RootProps = React.ComponentPropsWithoutRef<'code'> &\n  React.ComponentPropsWithoutRef<'span'>;\n\nexport type CodeInlineProps = Readonly<RootProps>;\n\n/**\n * If you are sending emails for users that have the Orange.fr email client,\n * beware that this component will only work when you have a head containing meta tags.\n */\nexport const CodeInline = React.forwardRef<HTMLSpanElement, CodeInlineProps>(\n  ({ children, ...props }, ref) => {\n    return (\n      <>\n        {/* \n    This style tag is targeted at fixing an issue for the Orange.fr email client\n    See:\n    - https://www.caniemail.com/features/html-code/\n    - https://www.howtotarget.email/#2019-03-26-freenet-2\n\n    On that email client, the head and html elements are removed, making the meta tag a sibling of them\n    allowing us to use a selector on them. Also <style> tags are supported on it.\n    */}\n        <style>{`\n        meta ~ .cino {\n          display: none !important;\n          opacity: 0 !important;\n        }\n\n        meta ~ .cio {\n          display: block !important;\n        }\n      `}</style>\n\n        {/* Does not render on Orange.fr */}\n        <code\n          {...props}\n          className={`${props.className ? props.className : ''} cino`}\n        >\n          {children}\n        </code>\n\n        {/* Renders only on Orange.fr */}\n        <span\n          {...props}\n          className={`${props.className ? props.className : ''} cio`}\n          ref={ref}\n          style={{ display: 'none', ...props.style }}\n        >\n          {children}\n        </span>\n      </>\n    );\n  },\n);\n\nCodeInline.displayName = 'CodeInline';\n"],"mappings":";;;;;;;;AAWA,MAAa,aAAa,MAAM,YAC7B,EAAE,SAAU,GAAG,SAAS,QAAQ;AAC/B,QACE;EAUE,oBAAC,qBAAO;;;;;;;;;UASA;EAGR,oBAAC;GACC,GAAI;GACJ,WAAW,GAAG,MAAM,YAAY,MAAM,YAAY,GAAG;GAEpD;IACI;EAGP,oBAAC;GACC,GAAI;GACJ,WAAW,GAAG,MAAM,YAAY,MAAM,YAAY,GAAG;GAChD;GACL,OAAO;IAAE,SAAS;IAAQ,GAAG,MAAM;IAAO;GAEzC;IACI;KACN;EAGR;AAED,WAAW,cAAc"}