@react-email/button 0.0.19 → 0.1.0-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +110 -91
- package/dist/index.mjs +107 -88
- package/package.json +3 -5
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
type ButtonProps = Readonly<React.ComponentPropsWithoutRef<
|
|
3
|
+
type ButtonProps = Readonly<React.ComponentPropsWithoutRef<'a'>>;
|
|
4
|
+
declare module 'react' {
|
|
5
|
+
interface CSSProperties {
|
|
6
|
+
msoPaddingAlt?: string | number | undefined;
|
|
7
|
+
msoTextRaise?: string | number | undefined;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
4
10
|
declare const Button: React.ForwardRefExoticComponent<Readonly<Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref">> & React.RefAttributes<HTMLAnchorElement>>;
|
|
5
11
|
|
|
6
12
|
export { Button, type ButtonProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
type ButtonProps = Readonly<React.ComponentPropsWithoutRef<
|
|
3
|
+
type ButtonProps = Readonly<React.ComponentPropsWithoutRef<'a'>>;
|
|
4
|
+
declare module 'react' {
|
|
5
|
+
interface CSSProperties {
|
|
6
|
+
msoPaddingAlt?: string | number | undefined;
|
|
7
|
+
msoTextRaise?: string | number | undefined;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
4
10
|
declare const Button: React.ForwardRefExoticComponent<Readonly<Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref">> & React.RefAttributes<HTMLAnchorElement>>;
|
|
5
11
|
|
|
6
12
|
export { Button, type ButtonProps };
|
package/dist/index.js
CHANGED
|
@@ -57,11 +57,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
57
57
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
58
58
|
|
|
59
59
|
// src/index.ts
|
|
60
|
-
var
|
|
61
|
-
__export(
|
|
60
|
+
var index_exports = {};
|
|
61
|
+
__export(index_exports, {
|
|
62
62
|
Button: () => Button
|
|
63
63
|
});
|
|
64
|
-
module.exports = __toCommonJS(
|
|
64
|
+
module.exports = __toCommonJS(index_exports);
|
|
65
65
|
|
|
66
66
|
// src/button.tsx
|
|
67
67
|
var React = __toESM(require("react"));
|
|
@@ -77,7 +77,7 @@ function convertToPx(value) {
|
|
|
77
77
|
}
|
|
78
78
|
const matches = /^([\d.]+)(px|em|rem|%)$/.exec(value);
|
|
79
79
|
if (matches && matches.length === 3) {
|
|
80
|
-
const numValue = parseFloat(matches[1]);
|
|
80
|
+
const numValue = Number.parseFloat(matches[1]);
|
|
81
81
|
const unit = matches[2];
|
|
82
82
|
switch (unit) {
|
|
83
83
|
case "px":
|
|
@@ -92,67 +92,87 @@ function convertToPx(value) {
|
|
|
92
92
|
default:
|
|
93
93
|
return numValue;
|
|
94
94
|
}
|
|
95
|
-
} else {
|
|
96
|
-
return 0;
|
|
97
95
|
}
|
|
96
|
+
return 0;
|
|
98
97
|
}
|
|
99
|
-
function
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
98
|
+
function parsePaddingValue(value) {
|
|
99
|
+
if (typeof value === "number")
|
|
100
|
+
return {
|
|
101
|
+
paddingTop: value,
|
|
102
|
+
paddingBottom: value,
|
|
103
|
+
paddingLeft: value,
|
|
104
|
+
paddingRight: value
|
|
105
|
+
};
|
|
106
|
+
if (typeof value === "string") {
|
|
107
|
+
const values = value.toString().trim().split(/\s+/);
|
|
108
|
+
if (values.length === 1) {
|
|
109
|
+
return {
|
|
110
|
+
paddingTop: values[0],
|
|
111
|
+
paddingBottom: values[0],
|
|
112
|
+
paddingLeft: values[0],
|
|
113
|
+
paddingRight: values[0]
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
if (values.length === 2) {
|
|
117
|
+
return {
|
|
118
|
+
paddingTop: values[0],
|
|
119
|
+
paddingRight: values[1],
|
|
120
|
+
paddingBottom: values[0],
|
|
121
|
+
paddingLeft: values[1]
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
if (values.length === 3) {
|
|
125
|
+
return {
|
|
126
|
+
paddingTop: values[0],
|
|
127
|
+
paddingRight: values[1],
|
|
128
|
+
paddingBottom: values[2],
|
|
129
|
+
paddingLeft: values[1]
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
if (values.length === 4) {
|
|
133
|
+
return {
|
|
134
|
+
paddingTop: values[0],
|
|
135
|
+
paddingRight: values[1],
|
|
136
|
+
paddingBottom: values[2],
|
|
137
|
+
paddingLeft: values[3]
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return {
|
|
142
|
+
paddingTop: void 0,
|
|
143
|
+
paddingBottom: void 0,
|
|
144
|
+
paddingLeft: void 0,
|
|
145
|
+
paddingRight: void 0
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function parsePadding(properties) {
|
|
149
|
+
let paddingTop;
|
|
150
|
+
let paddingRight;
|
|
151
|
+
let paddingBottom;
|
|
152
|
+
let paddingLeft;
|
|
153
|
+
for (const [key, value] of Object.entries(properties)) {
|
|
154
|
+
if (key === "padding") {
|
|
155
|
+
({ paddingTop, paddingBottom, paddingLeft, paddingRight } = parsePaddingValue(value));
|
|
156
|
+
} else if (key === "paddingTop") {
|
|
157
|
+
paddingTop = value;
|
|
158
|
+
} else if (key === "paddingRight") {
|
|
159
|
+
paddingRight = value;
|
|
160
|
+
} else if (key === "paddingBottom") {
|
|
161
|
+
paddingBottom = value;
|
|
162
|
+
} else if (key === "paddingLeft") {
|
|
163
|
+
paddingLeft = value;
|
|
144
164
|
}
|
|
145
165
|
}
|
|
146
166
|
return {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
167
|
+
paddingTop: paddingTop ? convertToPx(paddingTop) : void 0,
|
|
168
|
+
paddingRight: paddingRight ? convertToPx(paddingRight) : void 0,
|
|
169
|
+
paddingBottom: paddingBottom ? convertToPx(paddingBottom) : void 0,
|
|
170
|
+
paddingLeft: paddingLeft ? convertToPx(paddingLeft) : void 0
|
|
151
171
|
};
|
|
152
172
|
}
|
|
153
173
|
|
|
154
174
|
// src/utils/px-to-pt.ts
|
|
155
|
-
var pxToPt = (px) => typeof px === "number" && !isNaN(Number(px)) ? px * 3 / 4 :
|
|
175
|
+
var pxToPt = (px) => typeof px === "number" && !Number.isNaN(Number(px)) ? px * 3 / 4 : void 0;
|
|
156
176
|
|
|
157
177
|
// src/button.tsx
|
|
158
178
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -164,7 +184,7 @@ function computeFontWidthAndSpaceCount(expectedWidth) {
|
|
|
164
184
|
if (smallestSpaceCount > 0) {
|
|
165
185
|
return expectedWidth / smallestSpaceCount / 2;
|
|
166
186
|
}
|
|
167
|
-
return
|
|
187
|
+
return Number.POSITIVE_INFINITY;
|
|
168
188
|
};
|
|
169
189
|
while (computeRequiredFontWidth() > maxFontWidth) {
|
|
170
190
|
smallestSpaceCount++;
|
|
@@ -174,23 +194,31 @@ function computeFontWidthAndSpaceCount(expectedWidth) {
|
|
|
174
194
|
var Button = React.forwardRef(
|
|
175
195
|
(_a, ref) => {
|
|
176
196
|
var _b = _a, { children, style, target = "_blank" } = _b, props = __objRest(_b, ["children", "style", "target"]);
|
|
177
|
-
|
|
178
|
-
const
|
|
179
|
-
padding: style == null ? void 0 : style.padding,
|
|
180
|
-
paddingLeft: (_a2 = style == null ? void 0 : style.paddingLeft) != null ? _a2 : style == null ? void 0 : style.paddingInline,
|
|
181
|
-
paddingRight: (_b2 = style == null ? void 0 : style.paddingRight) != null ? _b2 : style == null ? void 0 : style.paddingInline,
|
|
182
|
-
paddingTop: (_c = style == null ? void 0 : style.paddingTop) != null ? _c : style == null ? void 0 : style.paddingBlock,
|
|
183
|
-
paddingBottom: (_d = style == null ? void 0 : style.paddingBottom) != null ? _d : style == null ? void 0 : style.paddingBlock
|
|
184
|
-
});
|
|
185
|
-
const y = pt + pb;
|
|
197
|
+
const { paddingTop, paddingRight, paddingBottom, paddingLeft } = parsePadding(style != null ? style : {});
|
|
198
|
+
const y = (paddingTop != null ? paddingTop : 0) + (paddingBottom != null ? paddingBottom : 0);
|
|
186
199
|
const textRaise = pxToPt(y);
|
|
187
|
-
const [plFontWidth, plSpaceCount] = computeFontWidthAndSpaceCount(
|
|
188
|
-
|
|
200
|
+
const [plFontWidth, plSpaceCount] = computeFontWidthAndSpaceCount(
|
|
201
|
+
paddingLeft != null ? paddingLeft : 0
|
|
202
|
+
);
|
|
203
|
+
const [prFontWidth, prSpaceCount] = computeFontWidthAndSpaceCount(
|
|
204
|
+
paddingRight != null ? paddingRight : 0
|
|
205
|
+
);
|
|
189
206
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
190
207
|
"a",
|
|
191
208
|
__spreadProps(__spreadValues({}, props), {
|
|
192
209
|
ref,
|
|
193
|
-
style:
|
|
210
|
+
style: __spreadProps(__spreadValues({
|
|
211
|
+
lineHeight: "100%",
|
|
212
|
+
textDecoration: "none",
|
|
213
|
+
display: "inline-block",
|
|
214
|
+
maxWidth: "100%",
|
|
215
|
+
msoPaddingAlt: "0px"
|
|
216
|
+
}, style), {
|
|
217
|
+
paddingTop,
|
|
218
|
+
paddingRight,
|
|
219
|
+
paddingBottom,
|
|
220
|
+
paddingLeft
|
|
221
|
+
}),
|
|
194
222
|
target,
|
|
195
223
|
children: [
|
|
196
224
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -208,7 +236,19 @@ var Button = React.forwardRef(
|
|
|
208
236
|
}
|
|
209
237
|
}
|
|
210
238
|
),
|
|
211
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
239
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
240
|
+
"span",
|
|
241
|
+
{
|
|
242
|
+
style: {
|
|
243
|
+
maxWidth: "100%",
|
|
244
|
+
display: "inline-block",
|
|
245
|
+
lineHeight: "120%",
|
|
246
|
+
msoPaddingAlt: "0px",
|
|
247
|
+
msoTextRaise: pxToPt(paddingBottom)
|
|
248
|
+
},
|
|
249
|
+
children
|
|
250
|
+
}
|
|
251
|
+
),
|
|
212
252
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
213
253
|
"span",
|
|
214
254
|
{
|
|
@@ -225,27 +265,6 @@ var Button = React.forwardRef(
|
|
|
225
265
|
}
|
|
226
266
|
);
|
|
227
267
|
Button.displayName = "Button";
|
|
228
|
-
var buttonStyle = (style) => {
|
|
229
|
-
const _a = style || {}, { pt, pr, pb, pl } = _a, rest = __objRest(_a, ["pt", "pr", "pb", "pl"]);
|
|
230
|
-
return __spreadProps(__spreadValues({
|
|
231
|
-
lineHeight: "100%",
|
|
232
|
-
textDecoration: "none",
|
|
233
|
-
display: "inline-block",
|
|
234
|
-
maxWidth: "100%",
|
|
235
|
-
msoPaddingAlt: "0px"
|
|
236
|
-
}, rest), {
|
|
237
|
-
padding: `${pt}px ${pr}px ${pb}px ${pl}px`
|
|
238
|
-
});
|
|
239
|
-
};
|
|
240
|
-
var buttonTextStyle = (pb) => {
|
|
241
|
-
return {
|
|
242
|
-
maxWidth: "100%",
|
|
243
|
-
display: "inline-block",
|
|
244
|
-
lineHeight: "120%",
|
|
245
|
-
msoPaddingAlt: "0px",
|
|
246
|
-
msoTextRaise: pxToPt(pb || 0)
|
|
247
|
-
};
|
|
248
|
-
};
|
|
249
268
|
// Annotate the CommonJS export names for ESM import in node:
|
|
250
269
|
0 && (module.exports = {
|
|
251
270
|
Button
|
package/dist/index.mjs
CHANGED
|
@@ -44,7 +44,7 @@ function convertToPx(value) {
|
|
|
44
44
|
}
|
|
45
45
|
const matches = /^([\d.]+)(px|em|rem|%)$/.exec(value);
|
|
46
46
|
if (matches && matches.length === 3) {
|
|
47
|
-
const numValue = parseFloat(matches[1]);
|
|
47
|
+
const numValue = Number.parseFloat(matches[1]);
|
|
48
48
|
const unit = matches[2];
|
|
49
49
|
switch (unit) {
|
|
50
50
|
case "px":
|
|
@@ -59,67 +59,87 @@ function convertToPx(value) {
|
|
|
59
59
|
default:
|
|
60
60
|
return numValue;
|
|
61
61
|
}
|
|
62
|
-
} else {
|
|
63
|
-
return 0;
|
|
64
62
|
}
|
|
63
|
+
return 0;
|
|
65
64
|
}
|
|
66
|
-
function
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
65
|
+
function parsePaddingValue(value) {
|
|
66
|
+
if (typeof value === "number")
|
|
67
|
+
return {
|
|
68
|
+
paddingTop: value,
|
|
69
|
+
paddingBottom: value,
|
|
70
|
+
paddingLeft: value,
|
|
71
|
+
paddingRight: value
|
|
72
|
+
};
|
|
73
|
+
if (typeof value === "string") {
|
|
74
|
+
const values = value.toString().trim().split(/\s+/);
|
|
75
|
+
if (values.length === 1) {
|
|
76
|
+
return {
|
|
77
|
+
paddingTop: values[0],
|
|
78
|
+
paddingBottom: values[0],
|
|
79
|
+
paddingLeft: values[0],
|
|
80
|
+
paddingRight: values[0]
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
if (values.length === 2) {
|
|
84
|
+
return {
|
|
85
|
+
paddingTop: values[0],
|
|
86
|
+
paddingRight: values[1],
|
|
87
|
+
paddingBottom: values[0],
|
|
88
|
+
paddingLeft: values[1]
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
if (values.length === 3) {
|
|
92
|
+
return {
|
|
93
|
+
paddingTop: values[0],
|
|
94
|
+
paddingRight: values[1],
|
|
95
|
+
paddingBottom: values[2],
|
|
96
|
+
paddingLeft: values[1]
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
if (values.length === 4) {
|
|
100
|
+
return {
|
|
101
|
+
paddingTop: values[0],
|
|
102
|
+
paddingRight: values[1],
|
|
103
|
+
paddingBottom: values[2],
|
|
104
|
+
paddingLeft: values[3]
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
paddingTop: void 0,
|
|
110
|
+
paddingBottom: void 0,
|
|
111
|
+
paddingLeft: void 0,
|
|
112
|
+
paddingRight: void 0
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
function parsePadding(properties) {
|
|
116
|
+
let paddingTop;
|
|
117
|
+
let paddingRight;
|
|
118
|
+
let paddingBottom;
|
|
119
|
+
let paddingLeft;
|
|
120
|
+
for (const [key, value] of Object.entries(properties)) {
|
|
121
|
+
if (key === "padding") {
|
|
122
|
+
({ paddingTop, paddingBottom, paddingLeft, paddingRight } = parsePaddingValue(value));
|
|
123
|
+
} else if (key === "paddingTop") {
|
|
124
|
+
paddingTop = value;
|
|
125
|
+
} else if (key === "paddingRight") {
|
|
126
|
+
paddingRight = value;
|
|
127
|
+
} else if (key === "paddingBottom") {
|
|
128
|
+
paddingBottom = value;
|
|
129
|
+
} else if (key === "paddingLeft") {
|
|
130
|
+
paddingLeft = value;
|
|
111
131
|
}
|
|
112
132
|
}
|
|
113
133
|
return {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
134
|
+
paddingTop: paddingTop ? convertToPx(paddingTop) : void 0,
|
|
135
|
+
paddingRight: paddingRight ? convertToPx(paddingRight) : void 0,
|
|
136
|
+
paddingBottom: paddingBottom ? convertToPx(paddingBottom) : void 0,
|
|
137
|
+
paddingLeft: paddingLeft ? convertToPx(paddingLeft) : void 0
|
|
118
138
|
};
|
|
119
139
|
}
|
|
120
140
|
|
|
121
141
|
// src/utils/px-to-pt.ts
|
|
122
|
-
var pxToPt = (px) => typeof px === "number" && !isNaN(Number(px)) ? px * 3 / 4 :
|
|
142
|
+
var pxToPt = (px) => typeof px === "number" && !Number.isNaN(Number(px)) ? px * 3 / 4 : void 0;
|
|
123
143
|
|
|
124
144
|
// src/button.tsx
|
|
125
145
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -131,7 +151,7 @@ function computeFontWidthAndSpaceCount(expectedWidth) {
|
|
|
131
151
|
if (smallestSpaceCount > 0) {
|
|
132
152
|
return expectedWidth / smallestSpaceCount / 2;
|
|
133
153
|
}
|
|
134
|
-
return
|
|
154
|
+
return Number.POSITIVE_INFINITY;
|
|
135
155
|
};
|
|
136
156
|
while (computeRequiredFontWidth() > maxFontWidth) {
|
|
137
157
|
smallestSpaceCount++;
|
|
@@ -141,23 +161,31 @@ function computeFontWidthAndSpaceCount(expectedWidth) {
|
|
|
141
161
|
var Button = React.forwardRef(
|
|
142
162
|
(_a, ref) => {
|
|
143
163
|
var _b = _a, { children, style, target = "_blank" } = _b, props = __objRest(_b, ["children", "style", "target"]);
|
|
144
|
-
|
|
145
|
-
const
|
|
146
|
-
padding: style == null ? void 0 : style.padding,
|
|
147
|
-
paddingLeft: (_a2 = style == null ? void 0 : style.paddingLeft) != null ? _a2 : style == null ? void 0 : style.paddingInline,
|
|
148
|
-
paddingRight: (_b2 = style == null ? void 0 : style.paddingRight) != null ? _b2 : style == null ? void 0 : style.paddingInline,
|
|
149
|
-
paddingTop: (_c = style == null ? void 0 : style.paddingTop) != null ? _c : style == null ? void 0 : style.paddingBlock,
|
|
150
|
-
paddingBottom: (_d = style == null ? void 0 : style.paddingBottom) != null ? _d : style == null ? void 0 : style.paddingBlock
|
|
151
|
-
});
|
|
152
|
-
const y = pt + pb;
|
|
164
|
+
const { paddingTop, paddingRight, paddingBottom, paddingLeft } = parsePadding(style != null ? style : {});
|
|
165
|
+
const y = (paddingTop != null ? paddingTop : 0) + (paddingBottom != null ? paddingBottom : 0);
|
|
153
166
|
const textRaise = pxToPt(y);
|
|
154
|
-
const [plFontWidth, plSpaceCount] = computeFontWidthAndSpaceCount(
|
|
155
|
-
|
|
167
|
+
const [plFontWidth, plSpaceCount] = computeFontWidthAndSpaceCount(
|
|
168
|
+
paddingLeft != null ? paddingLeft : 0
|
|
169
|
+
);
|
|
170
|
+
const [prFontWidth, prSpaceCount] = computeFontWidthAndSpaceCount(
|
|
171
|
+
paddingRight != null ? paddingRight : 0
|
|
172
|
+
);
|
|
156
173
|
return /* @__PURE__ */ jsxs(
|
|
157
174
|
"a",
|
|
158
175
|
__spreadProps(__spreadValues({}, props), {
|
|
159
176
|
ref,
|
|
160
|
-
style:
|
|
177
|
+
style: __spreadProps(__spreadValues({
|
|
178
|
+
lineHeight: "100%",
|
|
179
|
+
textDecoration: "none",
|
|
180
|
+
display: "inline-block",
|
|
181
|
+
maxWidth: "100%",
|
|
182
|
+
msoPaddingAlt: "0px"
|
|
183
|
+
}, style), {
|
|
184
|
+
paddingTop,
|
|
185
|
+
paddingRight,
|
|
186
|
+
paddingBottom,
|
|
187
|
+
paddingLeft
|
|
188
|
+
}),
|
|
161
189
|
target,
|
|
162
190
|
children: [
|
|
163
191
|
/* @__PURE__ */ jsx(
|
|
@@ -175,7 +203,19 @@ var Button = React.forwardRef(
|
|
|
175
203
|
}
|
|
176
204
|
}
|
|
177
205
|
),
|
|
178
|
-
/* @__PURE__ */ jsx(
|
|
206
|
+
/* @__PURE__ */ jsx(
|
|
207
|
+
"span",
|
|
208
|
+
{
|
|
209
|
+
style: {
|
|
210
|
+
maxWidth: "100%",
|
|
211
|
+
display: "inline-block",
|
|
212
|
+
lineHeight: "120%",
|
|
213
|
+
msoPaddingAlt: "0px",
|
|
214
|
+
msoTextRaise: pxToPt(paddingBottom)
|
|
215
|
+
},
|
|
216
|
+
children
|
|
217
|
+
}
|
|
218
|
+
),
|
|
179
219
|
/* @__PURE__ */ jsx(
|
|
180
220
|
"span",
|
|
181
221
|
{
|
|
@@ -192,27 +232,6 @@ var Button = React.forwardRef(
|
|
|
192
232
|
}
|
|
193
233
|
);
|
|
194
234
|
Button.displayName = "Button";
|
|
195
|
-
var buttonStyle = (style) => {
|
|
196
|
-
const _a = style || {}, { pt, pr, pb, pl } = _a, rest = __objRest(_a, ["pt", "pr", "pb", "pl"]);
|
|
197
|
-
return __spreadProps(__spreadValues({
|
|
198
|
-
lineHeight: "100%",
|
|
199
|
-
textDecoration: "none",
|
|
200
|
-
display: "inline-block",
|
|
201
|
-
maxWidth: "100%",
|
|
202
|
-
msoPaddingAlt: "0px"
|
|
203
|
-
}, rest), {
|
|
204
|
-
padding: `${pt}px ${pr}px ${pb}px ${pl}px`
|
|
205
|
-
});
|
|
206
|
-
};
|
|
207
|
-
var buttonTextStyle = (pb) => {
|
|
208
|
-
return {
|
|
209
|
-
maxWidth: "100%",
|
|
210
|
-
display: "inline-block",
|
|
211
|
-
lineHeight: "120%",
|
|
212
|
-
msoPaddingAlt: "0px",
|
|
213
|
-
msoTextRaise: pxToPt(pb || 0)
|
|
214
|
-
};
|
|
215
|
-
};
|
|
216
235
|
export {
|
|
217
236
|
Button
|
|
218
237
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-email/button",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.1.0-canary.0",
|
|
4
4
|
"description": "A link that is styled to look like a button",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -38,9 +38,8 @@
|
|
|
38
38
|
"react": "^18.0 || ^19.0 || ^19.0.0-rc"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"typescript": "5.
|
|
42
|
-
"@react-email/render": "1.0
|
|
43
|
-
"eslint-config-custom": "0.0.0",
|
|
41
|
+
"typescript": "5.8.3",
|
|
42
|
+
"@react-email/render": "1.1.2-canary.0",
|
|
44
43
|
"tsconfig": "0.0.0"
|
|
45
44
|
},
|
|
46
45
|
"publishConfig": {
|
|
@@ -50,7 +49,6 @@
|
|
|
50
49
|
"build": "tsup src/index.ts --format esm,cjs --dts --external react",
|
|
51
50
|
"clean": "rm -rf dist",
|
|
52
51
|
"dev": "tsup src/index.ts --format esm,cjs --dts --external react --watch",
|
|
53
|
-
"lint": "eslint .",
|
|
54
52
|
"test:watch": "vitest",
|
|
55
53
|
"test": "vitest run"
|
|
56
54
|
}
|