@react-email/button 0.0.15 → 0.0.16-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 +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +53 -44
- package/dist/index.mjs +43 -44
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
3
|
type ButtonProps = React.ComponentPropsWithoutRef<"a">;
|
|
4
|
-
declare const Button: React.
|
|
4
|
+
declare const Button: React.ForwardRefExoticComponent<Readonly<Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref">> & React.RefAttributes<HTMLAnchorElement>>;
|
|
5
5
|
|
|
6
6
|
export { Button, ButtonProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
3
|
type ButtonProps = React.ComponentPropsWithoutRef<"a">;
|
|
4
|
-
declare const Button: React.
|
|
4
|
+
declare const Button: React.ForwardRefExoticComponent<Readonly<Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref">> & React.RefAttributes<HTMLAnchorElement>>;
|
|
5
5
|
|
|
6
6
|
export { Button, ButtonProps };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __defProps = Object.defineProperties;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
6
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
7
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
8
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
10
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
11
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
12
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -44,6 +46,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
44
46
|
}
|
|
45
47
|
return to;
|
|
46
48
|
};
|
|
49
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
50
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
51
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
52
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
53
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
54
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
55
|
+
mod
|
|
56
|
+
));
|
|
47
57
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
48
58
|
|
|
49
59
|
// src/index.ts
|
|
@@ -53,6 +63,9 @@ __export(src_exports, {
|
|
|
53
63
|
});
|
|
54
64
|
module.exports = __toCommonJS(src_exports);
|
|
55
65
|
|
|
66
|
+
// src/button.tsx
|
|
67
|
+
var React = __toESM(require("react"));
|
|
68
|
+
|
|
56
69
|
// src/utils/px-to-pt.ts
|
|
57
70
|
var pxToPt = (px) => typeof px === "number" && !isNaN(Number(px)) ? px * 3 / 4 : null;
|
|
58
71
|
|
|
@@ -143,52 +156,48 @@ function parsePadding({
|
|
|
143
156
|
|
|
144
157
|
// src/button.tsx
|
|
145
158
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
146
|
-
var Button = (
|
|
147
|
-
|
|
148
|
-
children,
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
172
|
-
"span",
|
|
173
|
-
{
|
|
174
|
-
dangerouslySetInnerHTML: {
|
|
175
|
-
__html: `<!--[if mso]><i style="letter-spacing: ${pl}px;mso-font-width:-100%;mso-text-raise:${textRaise}" hidden> </i><![endif]-->`
|
|
159
|
+
var Button = React.forwardRef(
|
|
160
|
+
(_a, ref) => {
|
|
161
|
+
var _b = _a, { children, style, target = "_blank" } = _b, props = __objRest(_b, ["children", "style", "target"]);
|
|
162
|
+
const { pt, pr, pb, pl } = parsePadding({
|
|
163
|
+
padding: style == null ? void 0 : style.padding,
|
|
164
|
+
paddingLeft: style == null ? void 0 : style.paddingLeft,
|
|
165
|
+
paddingRight: style == null ? void 0 : style.paddingRight,
|
|
166
|
+
paddingTop: style == null ? void 0 : style.paddingTop,
|
|
167
|
+
paddingBottom: style == null ? void 0 : style.paddingBottom
|
|
168
|
+
});
|
|
169
|
+
const y = pt + pb;
|
|
170
|
+
const textRaise = pxToPt(y);
|
|
171
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
172
|
+
"a",
|
|
173
|
+
__spreadProps(__spreadValues({}, props), {
|
|
174
|
+
ref,
|
|
175
|
+
style: buttonStyle(__spreadProps(__spreadValues({}, style), { pt, pr, pb, pl })),
|
|
176
|
+
target,
|
|
177
|
+
children: [
|
|
178
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
179
|
+
"span",
|
|
180
|
+
{
|
|
181
|
+
dangerouslySetInnerHTML: {
|
|
182
|
+
__html: `<!--[if mso]><i style="letter-spacing: ${pl}px;mso-font-width:-100%;mso-text-raise:${textRaise}" hidden> </i><![endif]-->`
|
|
183
|
+
}
|
|
176
184
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
+
),
|
|
186
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: buttonTextStyle(pb), children }),
|
|
187
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
188
|
+
"span",
|
|
189
|
+
{
|
|
190
|
+
dangerouslySetInnerHTML: {
|
|
191
|
+
__html: `<!--[if mso]><i style="letter-spacing: ${pr}px;mso-font-width:-100%" hidden> </i><![endif]-->`
|
|
192
|
+
}
|
|
185
193
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
194
|
+
)
|
|
195
|
+
]
|
|
196
|
+
})
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
);
|
|
200
|
+
Button.displayName = "Button";
|
|
192
201
|
var buttonStyle = (style) => {
|
|
193
202
|
const _a = style || {}, { pt, pr, pb, pl } = _a, rest = __objRest(_a, ["pt", "pr", "pb", "pl"]);
|
|
194
203
|
return __spreadProps(__spreadValues({
|
package/dist/index.mjs
CHANGED
|
@@ -30,6 +30,9 @@ var __objRest = (source, exclude) => {
|
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
+
// src/button.tsx
|
|
34
|
+
import * as React from "react";
|
|
35
|
+
|
|
33
36
|
// src/utils/px-to-pt.ts
|
|
34
37
|
var pxToPt = (px) => typeof px === "number" && !isNaN(Number(px)) ? px * 3 / 4 : null;
|
|
35
38
|
|
|
@@ -120,52 +123,48 @@ function parsePadding({
|
|
|
120
123
|
|
|
121
124
|
// src/button.tsx
|
|
122
125
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
123
|
-
var Button = (
|
|
124
|
-
|
|
125
|
-
children,
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
/* @__PURE__ */ jsx(
|
|
149
|
-
"span",
|
|
150
|
-
{
|
|
151
|
-
dangerouslySetInnerHTML: {
|
|
152
|
-
__html: `<!--[if mso]><i style="letter-spacing: ${pl}px;mso-font-width:-100%;mso-text-raise:${textRaise}" hidden> </i><![endif]-->`
|
|
126
|
+
var Button = React.forwardRef(
|
|
127
|
+
(_a, ref) => {
|
|
128
|
+
var _b = _a, { children, style, target = "_blank" } = _b, props = __objRest(_b, ["children", "style", "target"]);
|
|
129
|
+
const { pt, pr, pb, pl } = parsePadding({
|
|
130
|
+
padding: style == null ? void 0 : style.padding,
|
|
131
|
+
paddingLeft: style == null ? void 0 : style.paddingLeft,
|
|
132
|
+
paddingRight: style == null ? void 0 : style.paddingRight,
|
|
133
|
+
paddingTop: style == null ? void 0 : style.paddingTop,
|
|
134
|
+
paddingBottom: style == null ? void 0 : style.paddingBottom
|
|
135
|
+
});
|
|
136
|
+
const y = pt + pb;
|
|
137
|
+
const textRaise = pxToPt(y);
|
|
138
|
+
return /* @__PURE__ */ jsxs(
|
|
139
|
+
"a",
|
|
140
|
+
__spreadProps(__spreadValues({}, props), {
|
|
141
|
+
ref,
|
|
142
|
+
style: buttonStyle(__spreadProps(__spreadValues({}, style), { pt, pr, pb, pl })),
|
|
143
|
+
target,
|
|
144
|
+
children: [
|
|
145
|
+
/* @__PURE__ */ jsx(
|
|
146
|
+
"span",
|
|
147
|
+
{
|
|
148
|
+
dangerouslySetInnerHTML: {
|
|
149
|
+
__html: `<!--[if mso]><i style="letter-spacing: ${pl}px;mso-font-width:-100%;mso-text-raise:${textRaise}" hidden> </i><![endif]-->`
|
|
150
|
+
}
|
|
153
151
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
152
|
+
),
|
|
153
|
+
/* @__PURE__ */ jsx("span", { style: buttonTextStyle(pb), children }),
|
|
154
|
+
/* @__PURE__ */ jsx(
|
|
155
|
+
"span",
|
|
156
|
+
{
|
|
157
|
+
dangerouslySetInnerHTML: {
|
|
158
|
+
__html: `<!--[if mso]><i style="letter-spacing: ${pr}px;mso-font-width:-100%" hidden> </i><![endif]-->`
|
|
159
|
+
}
|
|
162
160
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
161
|
+
)
|
|
162
|
+
]
|
|
163
|
+
})
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
);
|
|
167
|
+
Button.displayName = "Button";
|
|
169
168
|
var buttonStyle = (style) => {
|
|
170
169
|
const _a = style || {}, { pt, pr, pb, pl } = _a, rest = __objRest(_a, ["pt", "pr", "pb", "pl"]);
|
|
171
170
|
return __spreadProps(__spreadValues({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-email/button",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16-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",
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"node": ">=18.0.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"react": "^18.
|
|
38
|
+
"react": "^18.0 || ^19.0 || ^19.0.0-rc"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@babel/preset-react": "7.23.3",
|
|
42
42
|
"typescript": "5.1.6",
|
|
43
|
-
"@react-email/render": "0.0.
|
|
43
|
+
"@react-email/render": "0.0.17-canary.0",
|
|
44
44
|
"eslint-config-custom": "0.0.0",
|
|
45
45
|
"tsconfig": "0.0.0"
|
|
46
46
|
},
|