@react-email/button 0.0.3 → 0.0.5

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.ts CHANGED
@@ -2,6 +2,8 @@ import * as React from 'react';
2
2
 
3
3
  declare type RootProps = React.ComponentPropsWithoutRef<'a'>;
4
4
  interface ButtonProps extends RootProps {
5
+ pX?: number;
6
+ pY?: number;
5
7
  }
6
8
  declare const Button: React.ForwardRefExoticComponent<Readonly<ButtonProps> & React.RefAttributes<HTMLAnchorElement>>;
7
9
 
package/dist/index.js CHANGED
@@ -5,6 +5,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJS = (cb, mod) => function __require() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
8
11
  var __export = (target, all) => {
9
12
  for (var name in all)
10
13
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -23,6 +26,269 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
23
26
  ));
24
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
28
 
29
+ // ../utils/dist/as.js
30
+ var require_as = __commonJS({
31
+ "../utils/dist/as.js"(exports) {
32
+ "use strict";
33
+ exports.__esModule = true;
34
+ }
35
+ });
36
+
37
+ // ../utils/dist/copy-text-to-clipboard.js
38
+ var require_copy_text_to_clipboard = __commonJS({
39
+ "../utils/dist/copy-text-to-clipboard.js"(exports) {
40
+ "use strict";
41
+ var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
42
+ function adopt(value) {
43
+ return value instanceof P ? value : new P(function(resolve) {
44
+ resolve(value);
45
+ });
46
+ }
47
+ return new (P || (P = Promise))(function(resolve, reject) {
48
+ function fulfilled(value) {
49
+ try {
50
+ step(generator.next(value));
51
+ } catch (e) {
52
+ reject(e);
53
+ }
54
+ }
55
+ function rejected(value) {
56
+ try {
57
+ step(generator["throw"](value));
58
+ } catch (e) {
59
+ reject(e);
60
+ }
61
+ }
62
+ function step(result) {
63
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
64
+ }
65
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
66
+ });
67
+ };
68
+ var __generator = exports && exports.__generator || function(thisArg, body) {
69
+ var _ = { label: 0, sent: function() {
70
+ if (t[0] & 1)
71
+ throw t[1];
72
+ return t[1];
73
+ }, trys: [], ops: [] }, f, y, t, g;
74
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
75
+ return this;
76
+ }), g;
77
+ function verb(n) {
78
+ return function(v) {
79
+ return step([n, v]);
80
+ };
81
+ }
82
+ function step(op) {
83
+ if (f)
84
+ throw new TypeError("Generator is already executing.");
85
+ while (_)
86
+ try {
87
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
88
+ return t;
89
+ if (y = 0, t)
90
+ op = [op[0] & 2, t.value];
91
+ switch (op[0]) {
92
+ case 0:
93
+ case 1:
94
+ t = op;
95
+ break;
96
+ case 4:
97
+ _.label++;
98
+ return { value: op[1], done: false };
99
+ case 5:
100
+ _.label++;
101
+ y = op[1];
102
+ op = [0];
103
+ continue;
104
+ case 7:
105
+ op = _.ops.pop();
106
+ _.trys.pop();
107
+ continue;
108
+ default:
109
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
110
+ _ = 0;
111
+ continue;
112
+ }
113
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
114
+ _.label = op[1];
115
+ break;
116
+ }
117
+ if (op[0] === 6 && _.label < t[1]) {
118
+ _.label = t[1];
119
+ t = op;
120
+ break;
121
+ }
122
+ if (t && _.label < t[2]) {
123
+ _.label = t[2];
124
+ _.ops.push(op);
125
+ break;
126
+ }
127
+ if (t[2])
128
+ _.ops.pop();
129
+ _.trys.pop();
130
+ continue;
131
+ }
132
+ op = body.call(thisArg, _);
133
+ } catch (e) {
134
+ op = [6, e];
135
+ y = 0;
136
+ } finally {
137
+ f = t = 0;
138
+ }
139
+ if (op[0] & 5)
140
+ throw op[1];
141
+ return { value: op[0] ? op[1] : void 0, done: true };
142
+ }
143
+ };
144
+ exports.__esModule = true;
145
+ exports.copyTextToClipboard = void 0;
146
+ var copyTextToClipboard = function(text) {
147
+ return __awaiter(void 0, void 0, void 0, function() {
148
+ var _a;
149
+ return __generator(this, function(_b) {
150
+ switch (_b.label) {
151
+ case 0:
152
+ _b.trys.push([0, 2, , 3]);
153
+ return [4, navigator.clipboard.writeText(text)];
154
+ case 1:
155
+ _b.sent();
156
+ return [3, 3];
157
+ case 2:
158
+ _a = _b.sent();
159
+ throw new Error("Not able to copy");
160
+ case 3:
161
+ return [2];
162
+ }
163
+ });
164
+ });
165
+ };
166
+ exports.copyTextToClipboard = copyTextToClipboard;
167
+ }
168
+ });
169
+
170
+ // ../utils/dist/px-to-pt.js
171
+ var require_px_to_pt = __commonJS({
172
+ "../utils/dist/px-to-pt.js"(exports) {
173
+ "use strict";
174
+ exports.__esModule = true;
175
+ exports.pxToPt = void 0;
176
+ var pxToPt2 = function(px) {
177
+ return isNaN(Number(px)) ? null : parseInt(px, 10) * 3 / 4;
178
+ };
179
+ exports.pxToPt = pxToPt2;
180
+ }
181
+ });
182
+
183
+ // ../utils/dist/spaces.js
184
+ var require_spaces = __commonJS({
185
+ "../utils/dist/spaces.js"(exports) {
186
+ "use strict";
187
+ var __assign = exports && exports.__assign || function() {
188
+ __assign = Object.assign || function(t) {
189
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
190
+ s = arguments[i];
191
+ for (var p in s)
192
+ if (Object.prototype.hasOwnProperty.call(s, p))
193
+ t[p] = s[p];
194
+ }
195
+ return t;
196
+ };
197
+ return __assign.apply(this, arguments);
198
+ };
199
+ exports.__esModule = true;
200
+ exports.withMargin = void 0;
201
+ var withMargin = function(props) {
202
+ return [
203
+ withSpace(props.m, ["margin"]),
204
+ withSpace(props.mx, ["marginLeft", "marginRight"]),
205
+ withSpace(props.my, ["marginTop", "marginBottom"]),
206
+ withSpace(props.mt, ["marginTop"]),
207
+ withSpace(props.mr, ["marginRight"]),
208
+ withSpace(props.mb, ["marginBottom"]),
209
+ withSpace(props.ml, ["marginLeft"])
210
+ ].filter(function(s) {
211
+ return Object.keys(s).length;
212
+ })[0];
213
+ };
214
+ exports.withMargin = withMargin;
215
+ var withSpace = function(value, properties) {
216
+ return properties.reduce(function(styles, property) {
217
+ var _a;
218
+ if (value) {
219
+ return __assign(__assign({}, styles), (_a = {}, _a[property] = "".concat(value, "px"), _a));
220
+ }
221
+ return styles;
222
+ }, {});
223
+ };
224
+ }
225
+ });
226
+
227
+ // ../utils/dist/style-to-string.js
228
+ var require_style_to_string = __commonJS({
229
+ "../utils/dist/style-to-string.js"(exports) {
230
+ "use strict";
231
+ exports.__esModule = true;
232
+ exports.styleToString = void 0;
233
+ var styleToString = function(style) {
234
+ return Object.keys(style).reduce(function(acc, key) {
235
+ return acc + key.split(/(?=[A-Z])/).join("-").toLowerCase() + ":" + style[key] + ";";
236
+ }, "");
237
+ };
238
+ exports.styleToString = styleToString;
239
+ }
240
+ });
241
+
242
+ // ../utils/dist/unreachable.js
243
+ var require_unreachable = __commonJS({
244
+ "../utils/dist/unreachable.js"(exports) {
245
+ "use strict";
246
+ exports.__esModule = true;
247
+ exports.unreachable = void 0;
248
+ var unreachable = function(condition, message) {
249
+ if (message === void 0) {
250
+ message = "Entered unreachable code. Received '".concat(condition, "'.");
251
+ }
252
+ throw new TypeError(message);
253
+ };
254
+ exports.unreachable = unreachable;
255
+ }
256
+ });
257
+
258
+ // ../utils/dist/index.js
259
+ var require_dist = __commonJS({
260
+ "../utils/dist/index.js"(exports) {
261
+ "use strict";
262
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
263
+ if (k2 === void 0)
264
+ k2 = k;
265
+ var desc = Object.getOwnPropertyDescriptor(m, k);
266
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
267
+ desc = { enumerable: true, get: function() {
268
+ return m[k];
269
+ } };
270
+ }
271
+ Object.defineProperty(o, k2, desc);
272
+ } : function(o, m, k, k2) {
273
+ if (k2 === void 0)
274
+ k2 = k;
275
+ o[k2] = m[k];
276
+ });
277
+ var __exportStar = exports && exports.__exportStar || function(m, exports2) {
278
+ for (var p in m)
279
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
280
+ __createBinding(exports2, m, p);
281
+ };
282
+ exports.__esModule = true;
283
+ __exportStar(require_as(), exports);
284
+ __exportStar(require_copy_text_to_clipboard(), exports);
285
+ __exportStar(require_px_to_pt(), exports);
286
+ __exportStar(require_spaces(), exports);
287
+ __exportStar(require_style_to_string(), exports);
288
+ __exportStar(require_unreachable(), exports);
289
+ }
290
+ });
291
+
26
292
  // src/index.ts
27
293
  var src_exports = {};
28
294
  __export(src_exports, {
@@ -32,19 +298,68 @@ module.exports = __toCommonJS(src_exports);
32
298
 
33
299
  // src/button.tsx
34
300
  var React = __toESM(require("react"));
301
+ var import_utils = __toESM(require_dist());
35
302
  var import_jsx_runtime = require("react/jsx-runtime");
36
303
  var Button = React.forwardRef(
37
- ({ children, style, target = "_blank", ...props }, forwardedRef) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
38
- ref: forwardedRef,
39
- target,
40
- dangerouslySetInnerHTML: {
41
- __html: `<!--[if mso]><i style="letter-spacing: 25px;mso-font-width:-100%;mso-text-raise:30pt" hidden>&nbsp;</i><![endif]--><span>${children}</span><!--[if mso]><i style="letter-spacing: 25px;mso-font-width:-100%" hidden>&nbsp;</i><![endif]-->`
42
- },
43
- style,
44
- ...props
45
- })
304
+ ({ children, style, pX, pY, target = "_blank", ...props }, forwardedRef) => {
305
+ const y = (pY || 0) * 2;
306
+ const textRaise = (0, import_utils.pxToPt)(y.toString());
307
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
308
+ "a",
309
+ {
310
+ ...props,
311
+ ref: forwardedRef,
312
+ target,
313
+ style: buttonStyle({ ...style, pX, pY }),
314
+ children: [
315
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
316
+ "span",
317
+ {
318
+ dangerouslySetInnerHTML: {
319
+ __html: `<!--[if mso]><i style="letter-spacing: ${pX}px;mso-font-width:-100%;mso-text-raise:${textRaise}" hidden>&nbsp;</i><![endif]-->`
320
+ }
321
+ }
322
+ ),
323
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: buttonTextStyle({ ...style, pX, pY }), children }),
324
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
325
+ "span",
326
+ {
327
+ dangerouslySetInnerHTML: {
328
+ __html: `<!--[if mso]><i style="letter-spacing: ${pX}px;mso-font-width:-100%" hidden>&nbsp;</i><![endif]-->`
329
+ }
330
+ }
331
+ )
332
+ ]
333
+ }
334
+ );
335
+ }
46
336
  );
47
337
  Button.displayName = "Button";
338
+ var buttonStyle = (style) => {
339
+ const paddingY = (style == null ? void 0 : style.pY) || 0;
340
+ const paddingX = (style == null ? void 0 : style.pX) || 0;
341
+ return {
342
+ ...style,
343
+ lineHeight: "100%",
344
+ textDecoration: "none",
345
+ display: "inline-block",
346
+ maxWidth: "100%",
347
+ padding: `${paddingY}px ${paddingX}px`
348
+ };
349
+ };
350
+ var buttonTextStyle = (style) => {
351
+ const paddingY = (style == null ? void 0 : style.pY) || 0;
352
+ return {
353
+ ...style,
354
+ maxWidth: "100%",
355
+ display: "inline-block",
356
+ lineHeight: "120%",
357
+ textDecoration: "none",
358
+ textTransform: "none",
359
+ msoPaddingAlt: "0px",
360
+ msoTextRaise: (0, import_utils.pxToPt)(paddingY.toString())
361
+ };
362
+ };
48
363
  // Annotate the CommonJS export names for ESM import in node:
49
364
  0 && (module.exports = {
50
365
  Button
package/dist/index.mjs CHANGED
@@ -1,18 +1,352 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
20
+ mod
21
+ ));
22
+
23
+ // ../utils/dist/as.js
24
+ var require_as = __commonJS({
25
+ "../utils/dist/as.js"(exports) {
26
+ "use strict";
27
+ exports.__esModule = true;
28
+ }
29
+ });
30
+
31
+ // ../utils/dist/copy-text-to-clipboard.js
32
+ var require_copy_text_to_clipboard = __commonJS({
33
+ "../utils/dist/copy-text-to-clipboard.js"(exports) {
34
+ "use strict";
35
+ var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
36
+ function adopt(value) {
37
+ return value instanceof P ? value : new P(function(resolve) {
38
+ resolve(value);
39
+ });
40
+ }
41
+ return new (P || (P = Promise))(function(resolve, reject) {
42
+ function fulfilled(value) {
43
+ try {
44
+ step(generator.next(value));
45
+ } catch (e) {
46
+ reject(e);
47
+ }
48
+ }
49
+ function rejected(value) {
50
+ try {
51
+ step(generator["throw"](value));
52
+ } catch (e) {
53
+ reject(e);
54
+ }
55
+ }
56
+ function step(result) {
57
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
58
+ }
59
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
60
+ });
61
+ };
62
+ var __generator = exports && exports.__generator || function(thisArg, body) {
63
+ var _ = { label: 0, sent: function() {
64
+ if (t[0] & 1)
65
+ throw t[1];
66
+ return t[1];
67
+ }, trys: [], ops: [] }, f, y, t, g;
68
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
69
+ return this;
70
+ }), g;
71
+ function verb(n) {
72
+ return function(v) {
73
+ return step([n, v]);
74
+ };
75
+ }
76
+ function step(op) {
77
+ if (f)
78
+ throw new TypeError("Generator is already executing.");
79
+ while (_)
80
+ try {
81
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
82
+ return t;
83
+ if (y = 0, t)
84
+ op = [op[0] & 2, t.value];
85
+ switch (op[0]) {
86
+ case 0:
87
+ case 1:
88
+ t = op;
89
+ break;
90
+ case 4:
91
+ _.label++;
92
+ return { value: op[1], done: false };
93
+ case 5:
94
+ _.label++;
95
+ y = op[1];
96
+ op = [0];
97
+ continue;
98
+ case 7:
99
+ op = _.ops.pop();
100
+ _.trys.pop();
101
+ continue;
102
+ default:
103
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
104
+ _ = 0;
105
+ continue;
106
+ }
107
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
108
+ _.label = op[1];
109
+ break;
110
+ }
111
+ if (op[0] === 6 && _.label < t[1]) {
112
+ _.label = t[1];
113
+ t = op;
114
+ break;
115
+ }
116
+ if (t && _.label < t[2]) {
117
+ _.label = t[2];
118
+ _.ops.push(op);
119
+ break;
120
+ }
121
+ if (t[2])
122
+ _.ops.pop();
123
+ _.trys.pop();
124
+ continue;
125
+ }
126
+ op = body.call(thisArg, _);
127
+ } catch (e) {
128
+ op = [6, e];
129
+ y = 0;
130
+ } finally {
131
+ f = t = 0;
132
+ }
133
+ if (op[0] & 5)
134
+ throw op[1];
135
+ return { value: op[0] ? op[1] : void 0, done: true };
136
+ }
137
+ };
138
+ exports.__esModule = true;
139
+ exports.copyTextToClipboard = void 0;
140
+ var copyTextToClipboard = function(text) {
141
+ return __awaiter(void 0, void 0, void 0, function() {
142
+ var _a;
143
+ return __generator(this, function(_b) {
144
+ switch (_b.label) {
145
+ case 0:
146
+ _b.trys.push([0, 2, , 3]);
147
+ return [4, navigator.clipboard.writeText(text)];
148
+ case 1:
149
+ _b.sent();
150
+ return [3, 3];
151
+ case 2:
152
+ _a = _b.sent();
153
+ throw new Error("Not able to copy");
154
+ case 3:
155
+ return [2];
156
+ }
157
+ });
158
+ });
159
+ };
160
+ exports.copyTextToClipboard = copyTextToClipboard;
161
+ }
162
+ });
163
+
164
+ // ../utils/dist/px-to-pt.js
165
+ var require_px_to_pt = __commonJS({
166
+ "../utils/dist/px-to-pt.js"(exports) {
167
+ "use strict";
168
+ exports.__esModule = true;
169
+ exports.pxToPt = void 0;
170
+ var pxToPt2 = function(px) {
171
+ return isNaN(Number(px)) ? null : parseInt(px, 10) * 3 / 4;
172
+ };
173
+ exports.pxToPt = pxToPt2;
174
+ }
175
+ });
176
+
177
+ // ../utils/dist/spaces.js
178
+ var require_spaces = __commonJS({
179
+ "../utils/dist/spaces.js"(exports) {
180
+ "use strict";
181
+ var __assign = exports && exports.__assign || function() {
182
+ __assign = Object.assign || function(t) {
183
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
184
+ s = arguments[i];
185
+ for (var p in s)
186
+ if (Object.prototype.hasOwnProperty.call(s, p))
187
+ t[p] = s[p];
188
+ }
189
+ return t;
190
+ };
191
+ return __assign.apply(this, arguments);
192
+ };
193
+ exports.__esModule = true;
194
+ exports.withMargin = void 0;
195
+ var withMargin = function(props) {
196
+ return [
197
+ withSpace(props.m, ["margin"]),
198
+ withSpace(props.mx, ["marginLeft", "marginRight"]),
199
+ withSpace(props.my, ["marginTop", "marginBottom"]),
200
+ withSpace(props.mt, ["marginTop"]),
201
+ withSpace(props.mr, ["marginRight"]),
202
+ withSpace(props.mb, ["marginBottom"]),
203
+ withSpace(props.ml, ["marginLeft"])
204
+ ].filter(function(s) {
205
+ return Object.keys(s).length;
206
+ })[0];
207
+ };
208
+ exports.withMargin = withMargin;
209
+ var withSpace = function(value, properties) {
210
+ return properties.reduce(function(styles, property) {
211
+ var _a;
212
+ if (value) {
213
+ return __assign(__assign({}, styles), (_a = {}, _a[property] = "".concat(value, "px"), _a));
214
+ }
215
+ return styles;
216
+ }, {});
217
+ };
218
+ }
219
+ });
220
+
221
+ // ../utils/dist/style-to-string.js
222
+ var require_style_to_string = __commonJS({
223
+ "../utils/dist/style-to-string.js"(exports) {
224
+ "use strict";
225
+ exports.__esModule = true;
226
+ exports.styleToString = void 0;
227
+ var styleToString = function(style) {
228
+ return Object.keys(style).reduce(function(acc, key) {
229
+ return acc + key.split(/(?=[A-Z])/).join("-").toLowerCase() + ":" + style[key] + ";";
230
+ }, "");
231
+ };
232
+ exports.styleToString = styleToString;
233
+ }
234
+ });
235
+
236
+ // ../utils/dist/unreachable.js
237
+ var require_unreachable = __commonJS({
238
+ "../utils/dist/unreachable.js"(exports) {
239
+ "use strict";
240
+ exports.__esModule = true;
241
+ exports.unreachable = void 0;
242
+ var unreachable = function(condition, message) {
243
+ if (message === void 0) {
244
+ message = "Entered unreachable code. Received '".concat(condition, "'.");
245
+ }
246
+ throw new TypeError(message);
247
+ };
248
+ exports.unreachable = unreachable;
249
+ }
250
+ });
251
+
252
+ // ../utils/dist/index.js
253
+ var require_dist = __commonJS({
254
+ "../utils/dist/index.js"(exports) {
255
+ "use strict";
256
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
257
+ if (k2 === void 0)
258
+ k2 = k;
259
+ var desc = Object.getOwnPropertyDescriptor(m, k);
260
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
261
+ desc = { enumerable: true, get: function() {
262
+ return m[k];
263
+ } };
264
+ }
265
+ Object.defineProperty(o, k2, desc);
266
+ } : function(o, m, k, k2) {
267
+ if (k2 === void 0)
268
+ k2 = k;
269
+ o[k2] = m[k];
270
+ });
271
+ var __exportStar = exports && exports.__exportStar || function(m, exports2) {
272
+ for (var p in m)
273
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
274
+ __createBinding(exports2, m, p);
275
+ };
276
+ exports.__esModule = true;
277
+ __exportStar(require_as(), exports);
278
+ __exportStar(require_copy_text_to_clipboard(), exports);
279
+ __exportStar(require_px_to_pt(), exports);
280
+ __exportStar(require_spaces(), exports);
281
+ __exportStar(require_style_to_string(), exports);
282
+ __exportStar(require_unreachable(), exports);
283
+ }
284
+ });
285
+
1
286
  // src/button.tsx
287
+ var import_utils = __toESM(require_dist());
2
288
  import * as React from "react";
3
- import { jsx } from "react/jsx-runtime";
289
+ import { jsx, jsxs } from "react/jsx-runtime";
4
290
  var Button = React.forwardRef(
5
- ({ children, style, target = "_blank", ...props }, forwardedRef) => /* @__PURE__ */ jsx("a", {
6
- ref: forwardedRef,
7
- target,
8
- dangerouslySetInnerHTML: {
9
- __html: `<!--[if mso]><i style="letter-spacing: 25px;mso-font-width:-100%;mso-text-raise:30pt" hidden>&nbsp;</i><![endif]--><span>${children}</span><!--[if mso]><i style="letter-spacing: 25px;mso-font-width:-100%" hidden>&nbsp;</i><![endif]-->`
10
- },
11
- style,
12
- ...props
13
- })
291
+ ({ children, style, pX, pY, target = "_blank", ...props }, forwardedRef) => {
292
+ const y = (pY || 0) * 2;
293
+ const textRaise = (0, import_utils.pxToPt)(y.toString());
294
+ return /* @__PURE__ */ jsxs(
295
+ "a",
296
+ {
297
+ ...props,
298
+ ref: forwardedRef,
299
+ target,
300
+ style: buttonStyle({ ...style, pX, pY }),
301
+ children: [
302
+ /* @__PURE__ */ jsx(
303
+ "span",
304
+ {
305
+ dangerouslySetInnerHTML: {
306
+ __html: `<!--[if mso]><i style="letter-spacing: ${pX}px;mso-font-width:-100%;mso-text-raise:${textRaise}" hidden>&nbsp;</i><![endif]-->`
307
+ }
308
+ }
309
+ ),
310
+ /* @__PURE__ */ jsx("span", { style: buttonTextStyle({ ...style, pX, pY }), children }),
311
+ /* @__PURE__ */ jsx(
312
+ "span",
313
+ {
314
+ dangerouslySetInnerHTML: {
315
+ __html: `<!--[if mso]><i style="letter-spacing: ${pX}px;mso-font-width:-100%" hidden>&nbsp;</i><![endif]-->`
316
+ }
317
+ }
318
+ )
319
+ ]
320
+ }
321
+ );
322
+ }
14
323
  );
15
324
  Button.displayName = "Button";
325
+ var buttonStyle = (style) => {
326
+ const paddingY = (style == null ? void 0 : style.pY) || 0;
327
+ const paddingX = (style == null ? void 0 : style.pX) || 0;
328
+ return {
329
+ ...style,
330
+ lineHeight: "100%",
331
+ textDecoration: "none",
332
+ display: "inline-block",
333
+ maxWidth: "100%",
334
+ padding: `${paddingY}px ${paddingX}px`
335
+ };
336
+ };
337
+ var buttonTextStyle = (style) => {
338
+ const paddingY = (style == null ? void 0 : style.pY) || 0;
339
+ return {
340
+ ...style,
341
+ maxWidth: "100%",
342
+ display: "inline-block",
343
+ lineHeight: "120%",
344
+ textDecoration: "none",
345
+ textTransform: "none",
346
+ msoPaddingAlt: "0px",
347
+ msoTextRaise: (0, import_utils.pxToPt)(paddingY.toString())
348
+ };
349
+ };
16
350
  export {
17
351
  Button
18
352
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@react-email/button",
3
- "version": "0.0.3",
4
- "description": "A React button component to help build emails",
3
+ "version": "0.0.5",
4
+ "description": "A link that is styled to look like a button",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.mjs",
@@ -13,12 +13,24 @@
13
13
  "scripts": {
14
14
  "build": "tsup src/index.ts --format esm,cjs --dts --external react",
15
15
  "dev": "tsup src/index.ts --format esm,cjs --dts --external react --watch",
16
- "lint": "TIMING=1 eslint src/**/*.ts* --fix",
16
+ "lint": "eslint",
17
17
  "clean": "rm -rf dist",
18
18
  "test": "jest",
19
19
  "test:watch": "jest --watch",
20
- "format:check": "prettier --check \"**/*.{ts,tsx,md}\"",
21
- "format": "prettier --write \"**/*.{ts,tsx,md}\""
20
+ "format:check": "prettier --ignore-path ./../../.prettierignore --check \"**/*.{ts,tsx,md}\"",
21
+ "format": "prettier --ignore-path ./../../.prettierignore --write \"**/*.{ts,tsx,md}\""
22
+ },
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "https://github.com/zenorocha/react-email.git",
26
+ "directory": "packages/button"
27
+ },
28
+ "keywords": [
29
+ "react",
30
+ "email"
31
+ ],
32
+ "engines": {
33
+ "node": ">=18.0.0"
22
34
  },
23
35
  "dependencies": {
24
36
  "react": "18.2.0"
@@ -40,4 +52,4 @@
40
52
  "publishConfig": {
41
53
  "access": "public"
42
54
  }
43
- }
55
+ }
package/readme.md CHANGED
@@ -1,7 +1,7 @@
1
- ![React Email button cover](https://react.email/static/images/readme/covers/button.png)
1
+ ![React Email button cover](https://react.email/static/covers/button.png)
2
2
 
3
3
  <div align="center"><strong>@react-email/button</strong></div>
4
- <div align="center">A React button component to help build emails.</div>
4
+ <div align="center">A link that is styled to look like a button.</div>
5
5
  <br />
6
6
  <div align="center">
7
7
  <a href="https://react.email">Website</a>
@@ -54,9 +54,9 @@ const Email = () => {
54
54
 
55
55
  This component was tested using the most popular email clients.
56
56
 
57
- | <img src="https://react.email/static/images/readme/icons/gmail.svg" width="48px" height="48px" alt="Gmail logo"> | <img src="https://react.email/static/images/readme/icons/apple-mail.svg" width="48px" height="48px" alt="Apple Mail"> | <img src="https://react.email/static/images/readme/icons/outlook.svg" width="48px" height="48px" alt="Outlook logo"> | <img src="https://react.email/static/images/readme/icons/yahoo-mail.svg" width="48px" height="48px" alt="Yahoo! Mail logo"> | <img src="https://react.email/static/images/readme/icons/hey.svg" width="48px" height="48px" alt="HEY logo"> | <img src="https://react.email/static/images/readme/icons/superhuman.svg" width="48px" height="48px" alt="Superhuman logo"> |
58
- | --------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
59
- | Gmail ✔ | Apple Mail ✔ | Outlook ✔ | Yahoo! Mail ✔ | HEY ✔ | Superhuman ✔ |
57
+ | <img src="https://react.email/static/icons/gmail.svg" width="48px" height="48px" alt="Gmail logo"> | <img src="https://react.email/static/icons/apple-mail.svg" width="48px" height="48px" alt="Apple Mail"> | <img src="https://react.email/static/icons/outlook.svg" width="48px" height="48px" alt="Outlook logo"> | <img src="https://react.email/static/icons/yahoo-mail.svg" width="48px" height="48px" alt="Yahoo! Mail logo"> | <img src="https://react.email/static/icons/hey.svg" width="48px" height="48px" alt="HEY logo"> | <img src="https://react.email/static/icons/superhuman.svg" width="48px" height="48px" alt="Superhuman logo"> |
58
+ | -------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
59
+ | Gmail ✔ | Apple Mail ✔ | Outlook ✔ | Yahoo! Mail ✔ | HEY ✔ | Superhuman ✔ |
60
60
 
61
61
  ## License
62
62