🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@react-email/text

Package Overview
Dependencies
Maintainers
3
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-email/text - npm Package Compare versions

Comparing version

to
0.1.1

74

dist/index.js

@@ -68,2 +68,55 @@ "use strict";

var React = __toESM(require("react"));
// src/utils/parse-margins.ts
function parseMargin({
margin,
marginTop,
marginRight,
marginBottom,
marginLeft
}) {
let mt = marginTop;
let mr = marginRight;
let mb = marginBottom;
let ml = marginLeft;
if (typeof margin === "number") {
mt = margin;
mr = margin;
mb = margin;
ml = margin;
} else if (typeof margin === "string") {
const values = margin.split(/\s+/);
switch (values.length) {
case 1:
mt = values[0];
mr = values[0];
mb = values[0];
ml = values[0];
break;
case 2:
mt = values[0];
mb = values[0];
mr = values[1];
ml = values[1];
break;
case 3:
mt = values[0];
mr = values[1];
mb = values[2];
ml = values[1];
break;
case 4:
mt = values[0];
mr = values[1];
mb = values[2];
ml = values[3];
break;
default:
break;
}
}
return { mt, mr, mb, ml };
}
// src/text.tsx
var import_jsx_runtime = require("react/jsx-runtime");

@@ -73,2 +126,10 @@ var Text = React.forwardRef(

var _b = _a, { style } = _b, props = __objRest(_b, ["style"]);
var _a2, _b2;
const margins = parseMargin({
margin: style == null ? void 0 : style.margin,
marginBottom: (_a2 = style == null ? void 0 : style.marginBottom) != null ? _a2 : "16px",
marginTop: (_b2 = style == null ? void 0 : style.marginTop) != null ? _b2 : "16px",
marginLeft: style == null ? void 0 : style.marginLeft,
marginRight: style == null ? void 0 : style.marginRight
});
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(

@@ -78,8 +139,11 @@ "p",

ref,
style: __spreadValues({
style: __spreadProps(__spreadValues({
fontSize: "14px",
lineHeight: "24px",
marginBottom: "16px",
marginTop: "16px"
}, style)
lineHeight: "24px"
}, style), {
marginBottom: margins.mb,
marginTop: margins.mt,
marginLeft: margins.ml,
marginRight: margins.mr
})
})

@@ -86,0 +150,0 @@ );

6

package.json
{
"name": "@react-email/text",
"version": "0.1.0",
"version": "0.1.1",
"description": "A block of text separated by blank spaces",

@@ -42,4 +42,4 @@ "sideEffects": false,

"typescript": "5.1.6",
"@react-email/render": "1.0.5",
"tsconfig": "0.0.0"
"tsconfig": "0.0.0",
"@react-email/render": "1.0.5"
},

@@ -46,0 +46,0 @@ "publishConfig": {

Sorry, the diff of this file is not supported yet