@react-email/button 0.0.17-canary.1 → 0.0.18-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 +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +13 -5
- package/dist/index.mjs +13 -5
- package/package.json +2 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
type ButtonProps = React.ComponentPropsWithoutRef<"a"
|
|
3
|
+
type ButtonProps = Readonly<React.ComponentPropsWithoutRef<"a">>;
|
|
4
4
|
declare const Button: React.ForwardRefExoticComponent<Readonly<Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref">> & React.RefAttributes<HTMLAnchorElement>>;
|
|
5
5
|
|
|
6
|
-
export { Button, ButtonProps };
|
|
6
|
+
export { Button, type ButtonProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
type ButtonProps = React.ComponentPropsWithoutRef<"a"
|
|
3
|
+
type ButtonProps = Readonly<React.ComponentPropsWithoutRef<"a">>;
|
|
4
4
|
declare const Button: React.ForwardRefExoticComponent<Readonly<Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref">> & React.RefAttributes<HTMLAnchorElement>>;
|
|
5
5
|
|
|
6
|
-
export { Button, ButtonProps };
|
|
6
|
+
export { Button, type ButtonProps };
|
package/dist/index.js
CHANGED
|
@@ -66,9 +66,6 @@ module.exports = __toCommonJS(src_exports);
|
|
|
66
66
|
// src/button.tsx
|
|
67
67
|
var React = __toESM(require("react"));
|
|
68
68
|
|
|
69
|
-
// src/utils/px-to-pt.ts
|
|
70
|
-
var pxToPt = (px) => typeof px === "number" && !isNaN(Number(px)) ? px * 3 / 4 : null;
|
|
71
|
-
|
|
72
69
|
// src/utils/parse-padding.ts
|
|
73
70
|
function convertToPx(value) {
|
|
74
71
|
let px = 0;
|
|
@@ -154,14 +151,25 @@ function parsePadding({
|
|
|
154
151
|
};
|
|
155
152
|
}
|
|
156
153
|
|
|
154
|
+
// src/utils/px-to-pt.ts
|
|
155
|
+
var pxToPt = (px) => typeof px === "number" && !isNaN(Number(px)) ? px * 3 / 4 : null;
|
|
156
|
+
|
|
157
157
|
// src/button.tsx
|
|
158
158
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
159
|
+
var maxFontWidth = 5;
|
|
159
160
|
function computeFontWidthAndSpaceCount(expectedWidth) {
|
|
161
|
+
if (expectedWidth === 0) return [0, 0];
|
|
160
162
|
let smallestSpaceCount = 0;
|
|
161
|
-
|
|
163
|
+
const computeRequiredFontWidth = () => {
|
|
164
|
+
if (smallestSpaceCount > 0) {
|
|
165
|
+
return expectedWidth / smallestSpaceCount / 2;
|
|
166
|
+
}
|
|
167
|
+
return Infinity;
|
|
168
|
+
};
|
|
169
|
+
while (computeRequiredFontWidth() > maxFontWidth) {
|
|
162
170
|
smallestSpaceCount++;
|
|
163
171
|
}
|
|
164
|
-
return [
|
|
172
|
+
return [computeRequiredFontWidth(), smallestSpaceCount];
|
|
165
173
|
}
|
|
166
174
|
var Button = React.forwardRef(
|
|
167
175
|
(_a, ref) => {
|
package/dist/index.mjs
CHANGED
|
@@ -33,9 +33,6 @@ var __objRest = (source, exclude) => {
|
|
|
33
33
|
// src/button.tsx
|
|
34
34
|
import * as React from "react";
|
|
35
35
|
|
|
36
|
-
// src/utils/px-to-pt.ts
|
|
37
|
-
var pxToPt = (px) => typeof px === "number" && !isNaN(Number(px)) ? px * 3 / 4 : null;
|
|
38
|
-
|
|
39
36
|
// src/utils/parse-padding.ts
|
|
40
37
|
function convertToPx(value) {
|
|
41
38
|
let px = 0;
|
|
@@ -121,14 +118,25 @@ function parsePadding({
|
|
|
121
118
|
};
|
|
122
119
|
}
|
|
123
120
|
|
|
121
|
+
// src/utils/px-to-pt.ts
|
|
122
|
+
var pxToPt = (px) => typeof px === "number" && !isNaN(Number(px)) ? px * 3 / 4 : null;
|
|
123
|
+
|
|
124
124
|
// src/button.tsx
|
|
125
125
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
126
|
+
var maxFontWidth = 5;
|
|
126
127
|
function computeFontWidthAndSpaceCount(expectedWidth) {
|
|
128
|
+
if (expectedWidth === 0) return [0, 0];
|
|
127
129
|
let smallestSpaceCount = 0;
|
|
128
|
-
|
|
130
|
+
const computeRequiredFontWidth = () => {
|
|
131
|
+
if (smallestSpaceCount > 0) {
|
|
132
|
+
return expectedWidth / smallestSpaceCount / 2;
|
|
133
|
+
}
|
|
134
|
+
return Infinity;
|
|
135
|
+
};
|
|
136
|
+
while (computeRequiredFontWidth() > maxFontWidth) {
|
|
129
137
|
smallestSpaceCount++;
|
|
130
138
|
}
|
|
131
|
-
return [
|
|
139
|
+
return [computeRequiredFontWidth(), smallestSpaceCount];
|
|
132
140
|
}
|
|
133
141
|
var Button = React.forwardRef(
|
|
134
142
|
(_a, ref) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-email/button",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18-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,10 +38,9 @@
|
|
|
38
38
|
"react": "^18.0 || ^19.0 || ^19.0.0-rc"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@babel/preset-react": "7.23.3",
|
|
42
41
|
"typescript": "5.1.6",
|
|
43
|
-
"@react-email/render": "0.0.18-canary.0",
|
|
44
42
|
"eslint-config-custom": "0.0.0",
|
|
43
|
+
"@react-email/render": "1.0.1",
|
|
45
44
|
"tsconfig": "0.0.0"
|
|
46
45
|
},
|
|
47
46
|
"publishConfig": {
|