@react-email/button 0.0.17 → 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 +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -2
- package/dist/index.mjs +10 -2
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -3,4 +3,4 @@ import * as React from 'react';
|
|
|
3
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
|
@@ -3,4 +3,4 @@ import * as React from 'react';
|
|
|
3
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
|
@@ -156,12 +156,20 @@ var pxToPt = (px) => typeof px === "number" && !isNaN(Number(px)) ? px * 3 / 4 :
|
|
|
156
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
|
@@ -123,12 +123,20 @@ var pxToPt = (px) => typeof px === "number" && !isNaN(Number(px)) ? px * 3 / 4 :
|
|
|
123
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",
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"typescript": "5.1.6",
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
42
|
+
"eslint-config-custom": "0.0.0",
|
|
43
|
+
"@react-email/render": "1.0.1",
|
|
44
|
+
"tsconfig": "0.0.0"
|
|
45
45
|
},
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|