@react-email/preview
Advanced tools
Comparing version
import * as react_jsx_runtime from 'react/jsx-runtime'; | ||
import * as React from 'react'; | ||
type RootProps = React.ComponentPropsWithoutRef<"div">; | ||
interface PreviewProps extends RootProps { | ||
type PreviewProps = Readonly<React.ComponentPropsWithoutRef<"div"> & { | ||
children: string | string[]; | ||
} | ||
declare const Preview: React.ForwardRefExoticComponent<Readonly<PreviewProps> & React.RefAttributes<HTMLDivElement>>; | ||
}>; | ||
declare const Preview: React.ForwardRefExoticComponent<Readonly<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & { | ||
children: string | string[]; | ||
}> & React.RefAttributes<HTMLDivElement>>; | ||
declare const renderWhiteSpace: (text: string) => react_jsx_runtime.JSX.Element | null; | ||
export { Preview, PreviewProps, renderWhiteSpace }; |
@@ -71,27 +71,29 @@ "use strict"; | ||
var PREVIEW_MAX_LENGTH = 150; | ||
var Preview = React.forwardRef((_a, ref) => { | ||
var _b = _a, { children = "" } = _b, props = __objRest(_b, ["children"]); | ||
let text = Array.isArray(children) ? children.join("") : children; | ||
text = text.substr(0, PREVIEW_MAX_LENGTH); | ||
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)( | ||
"div", | ||
__spreadProps(__spreadValues({ | ||
style: { | ||
display: "none", | ||
overflow: "hidden", | ||
lineHeight: "1px", | ||
opacity: 0, | ||
maxHeight: 0, | ||
maxWidth: 0 | ||
} | ||
}, props), { | ||
ref, | ||
children: [ | ||
text, | ||
renderWhiteSpace(text) | ||
] | ||
}) | ||
); | ||
}); | ||
var Preview = React.forwardRef( | ||
(_a, ref) => { | ||
var _b = _a, { children = "" } = _b, props = __objRest(_b, ["children"]); | ||
const text = (Array.isArray(children) ? children.join("") : children).substring(0, PREVIEW_MAX_LENGTH); | ||
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)( | ||
"div", | ||
__spreadProps(__spreadValues({ | ||
style: { | ||
display: "none", | ||
overflow: "hidden", | ||
lineHeight: "1px", | ||
opacity: 0, | ||
maxHeight: 0, | ||
maxWidth: 0 | ||
} | ||
}, props), { | ||
ref, | ||
children: [ | ||
text, | ||
renderWhiteSpace(text) | ||
] | ||
}) | ||
); | ||
} | ||
); | ||
Preview.displayName = "Preview"; | ||
var whiteSpaceCodes = "\xA0\u200C\u200B\u200D\u200E\u200F\uFEFF"; | ||
var renderWhiteSpace = (text) => { | ||
@@ -101,3 +103,2 @@ if (text.length >= PREVIEW_MAX_LENGTH) { | ||
} | ||
const whiteSpaceCodes = "\xA0\u200C\u200B\u200D\u200E\u200F\uFEFF"; | ||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: whiteSpaceCodes.repeat(PREVIEW_MAX_LENGTH - text.length) }); | ||
@@ -104,0 +105,0 @@ }; |
{ | ||
"name": "@react-email/preview", | ||
"version": "0.0.11-canary.0", | ||
"version": "0.0.11", | ||
"description": "A preview text that will be displayed in the inbox of the recipient", | ||
@@ -41,7 +41,6 @@ "sideEffects": false, | ||
"devDependencies": { | ||
"@babel/preset-react": "7.23.3", | ||
"typescript": "5.1.6", | ||
"@react-email/render": "0.0.18-canary.0", | ||
"tsconfig": "0.0.0", | ||
"eslint-config-custom": "0.0.0" | ||
"eslint-config-custom": "0.0.0", | ||
"@react-email/render": "1.0.0", | ||
"tsconfig": "0.0.0" | ||
}, | ||
@@ -48,0 +47,0 @@ "publishConfig": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
12819
1.57%4
-20%188
1.62%