@react-email/heading
Advanced tools
Comparing version 0.0.8 to 0.0.9
@@ -1,11 +0,25 @@ | ||
import * as React from 'react'; | ||
import * as React$1 from 'react'; | ||
type As<DefaultTag extends React.ElementType, T1 extends React.ElementType, T2 extends React.ElementType = T1, T3 extends React.ElementType = T1, T4 extends React.ElementType = T1, T5 extends React.ElementType = T1> = (React.ComponentPropsWithRef<DefaultTag> & { | ||
as?: DefaultTag; | ||
}) | (React.ComponentPropsWithRef<T1> & { | ||
as: T1; | ||
}) | (React.ComponentPropsWithRef<T2> & { | ||
as: T2; | ||
}) | (React.ComponentPropsWithRef<T3> & { | ||
as: T3; | ||
}) | (React.ComponentPropsWithRef<T4> & { | ||
as: T4; | ||
}) | (React.ComponentPropsWithRef<T5> & { | ||
as: T5; | ||
}); | ||
interface Margin { | ||
m?: string; | ||
mx?: string; | ||
my?: string; | ||
mt?: string; | ||
mr?: string; | ||
mb?: string; | ||
ml?: string; | ||
m?: number | string; | ||
mx?: number | string; | ||
my?: number | string; | ||
mt?: number | string; | ||
mr?: number | string; | ||
mb?: number | string; | ||
ml?: number | string; | ||
} | ||
@@ -15,28 +29,30 @@ | ||
} | ||
declare const Heading: React.ForwardRefExoticComponent<(Pick<Readonly<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "key" | keyof React.HTMLAttributes<HTMLHeadingElement>> & { | ||
ref?: ((instance: HTMLHeadingElement | null) => void) | React.RefObject<HTMLHeadingElement> | null | undefined; | ||
type HeadingAs = As<"h1", "h2", "h3", "h4", "h5", "h6">; | ||
type HeadingProps = HeadingAs & HeadingOwnProps & Margin; | ||
declare const Heading: React$1.ForwardRefExoticComponent<(Pick<Readonly<Pick<React$1.DetailedHTMLProps<React$1.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "key" | keyof React$1.HTMLAttributes<HTMLHeadingElement>> & { | ||
ref?: ((instance: HTMLHeadingElement | null) => void) | React$1.RefObject<HTMLHeadingElement> | null | undefined; | ||
} & { | ||
as?: "h1" | undefined; | ||
} & HeadingOwnProps & Margin>, "key" | keyof React.HTMLAttributes<HTMLHeadingElement> | "as" | keyof Margin> | Pick<Readonly<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "key" | keyof React.HTMLAttributes<HTMLHeadingElement>> & { | ||
ref?: ((instance: HTMLHeadingElement | null) => void) | React.RefObject<HTMLHeadingElement> | null | undefined; | ||
} & HeadingOwnProps & Margin>, "key" | keyof React$1.HTMLAttributes<HTMLHeadingElement> | "as" | keyof Margin> | Pick<Readonly<Pick<React$1.DetailedHTMLProps<React$1.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "key" | keyof React$1.HTMLAttributes<HTMLHeadingElement>> & { | ||
ref?: ((instance: HTMLHeadingElement | null) => void) | React$1.RefObject<HTMLHeadingElement> | null | undefined; | ||
} & { | ||
as: "h2"; | ||
} & HeadingOwnProps & Margin>, "key" | keyof React.HTMLAttributes<HTMLHeadingElement> | "as" | keyof Margin> | Pick<Readonly<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "key" | keyof React.HTMLAttributes<HTMLHeadingElement>> & { | ||
ref?: ((instance: HTMLHeadingElement | null) => void) | React.RefObject<HTMLHeadingElement> | null | undefined; | ||
} & HeadingOwnProps & Margin>, "key" | keyof React$1.HTMLAttributes<HTMLHeadingElement> | "as" | keyof Margin> | Pick<Readonly<Pick<React$1.DetailedHTMLProps<React$1.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "key" | keyof React$1.HTMLAttributes<HTMLHeadingElement>> & { | ||
ref?: ((instance: HTMLHeadingElement | null) => void) | React$1.RefObject<HTMLHeadingElement> | null | undefined; | ||
} & { | ||
as: "h3"; | ||
} & HeadingOwnProps & Margin>, "key" | keyof React.HTMLAttributes<HTMLHeadingElement> | "as" | keyof Margin> | Pick<Readonly<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "key" | keyof React.HTMLAttributes<HTMLHeadingElement>> & { | ||
ref?: ((instance: HTMLHeadingElement | null) => void) | React.RefObject<HTMLHeadingElement> | null | undefined; | ||
} & HeadingOwnProps & Margin>, "key" | keyof React$1.HTMLAttributes<HTMLHeadingElement> | "as" | keyof Margin> | Pick<Readonly<Pick<React$1.DetailedHTMLProps<React$1.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "key" | keyof React$1.HTMLAttributes<HTMLHeadingElement>> & { | ||
ref?: ((instance: HTMLHeadingElement | null) => void) | React$1.RefObject<HTMLHeadingElement> | null | undefined; | ||
} & { | ||
as: "h4"; | ||
} & HeadingOwnProps & Margin>, "key" | keyof React.HTMLAttributes<HTMLHeadingElement> | "as" | keyof Margin> | Pick<Readonly<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "key" | keyof React.HTMLAttributes<HTMLHeadingElement>> & { | ||
ref?: ((instance: HTMLHeadingElement | null) => void) | React.RefObject<HTMLHeadingElement> | null | undefined; | ||
} & HeadingOwnProps & Margin>, "key" | keyof React$1.HTMLAttributes<HTMLHeadingElement> | "as" | keyof Margin> | Pick<Readonly<Pick<React$1.DetailedHTMLProps<React$1.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "key" | keyof React$1.HTMLAttributes<HTMLHeadingElement>> & { | ||
ref?: ((instance: HTMLHeadingElement | null) => void) | React$1.RefObject<HTMLHeadingElement> | null | undefined; | ||
} & { | ||
as: "h5"; | ||
} & HeadingOwnProps & Margin>, "key" | keyof React.HTMLAttributes<HTMLHeadingElement> | "as" | keyof Margin> | Pick<Readonly<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "key" | keyof React.HTMLAttributes<HTMLHeadingElement>> & { | ||
ref?: ((instance: HTMLHeadingElement | null) => void) | React.RefObject<HTMLHeadingElement> | null | undefined; | ||
} & HeadingOwnProps & Margin>, "key" | keyof React$1.HTMLAttributes<HTMLHeadingElement> | "as" | keyof Margin> | Pick<Readonly<Pick<React$1.DetailedHTMLProps<React$1.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "key" | keyof React$1.HTMLAttributes<HTMLHeadingElement>> & { | ||
ref?: ((instance: HTMLHeadingElement | null) => void) | React$1.RefObject<HTMLHeadingElement> | null | undefined; | ||
} & { | ||
as: "h6"; | ||
} & HeadingOwnProps & Margin>, "key" | keyof React.HTMLAttributes<HTMLHeadingElement> | "as" | keyof Margin>) & React.RefAttributes<HTMLHeadingElement>>; | ||
} & HeadingOwnProps & Margin>, "key" | keyof React$1.HTMLAttributes<HTMLHeadingElement> | "as" | keyof Margin>) & React$1.RefAttributes<HTMLHeadingElement>>; | ||
export { Heading }; | ||
export { Heading, HeadingAs, HeadingProps }; |
"use strict"; | ||
var __create = Object.create; | ||
var __defProp = Object.defineProperty; | ||
var __defProps = Object.defineProperties; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropDescs = Object.getOwnPropertyDescriptors; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __getOwnPropSymbols = Object.getOwnPropertySymbols; | ||
var __getProtoOf = Object.getPrototypeOf; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __propIsEnum = Object.prototype.propertyIsEnumerable; | ||
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; | ||
var __spreadValues = (a, b) => { | ||
for (var prop in b || (b = {})) | ||
if (__hasOwnProp.call(b, prop)) | ||
__defNormalProp(a, prop, b[prop]); | ||
if (__getOwnPropSymbols) | ||
for (var prop of __getOwnPropSymbols(b)) { | ||
if (__propIsEnum.call(b, prop)) | ||
__defNormalProp(a, prop, b[prop]); | ||
} | ||
return a; | ||
}; | ||
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); | ||
var __objRest = (source, exclude) => { | ||
var target = {}; | ||
for (var prop in source) | ||
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) | ||
target[prop] = source[prop]; | ||
if (source != null && __getOwnPropSymbols) | ||
for (var prop of __getOwnPropSymbols(source)) { | ||
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop)) | ||
target[prop] = source[prop]; | ||
} | ||
return target; | ||
}; | ||
var __export = (target, all) => { | ||
@@ -21,2 +50,6 @@ for (var name in all) | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
// If the importer is in node compatibility mode or this is not an ESM | ||
// file that has been converted to a CommonJS file using a Babel- | ||
// compatible transform (i.e. "__esModule" has not been set), then set | ||
// "default" to the CommonJS "module.exports" for node compatibility. | ||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
@@ -39,15 +72,21 @@ mod | ||
// src/utils/spaces.ts | ||
var withMargin = (props) => [ | ||
withSpace(props.m, ["margin"]), | ||
withSpace(props.mx, ["marginLeft", "marginRight"]), | ||
withSpace(props.my, ["marginTop", "marginBottom"]), | ||
withSpace(props.mt, ["marginTop"]), | ||
withSpace(props.mr, ["marginRight"]), | ||
withSpace(props.mb, ["marginBottom"]), | ||
withSpace(props.ml, ["marginLeft"]) | ||
].filter((s) => Object.keys(s).length)[0]; | ||
var withMargin = (props) => { | ||
const nonEmptyStyles = [ | ||
withSpace(props.m, ["margin"]), | ||
withSpace(props.mx, ["marginLeft", "marginRight"]), | ||
withSpace(props.my, ["marginTop", "marginBottom"]), | ||
withSpace(props.mt, ["marginTop"]), | ||
withSpace(props.mr, ["marginRight"]), | ||
withSpace(props.mb, ["marginBottom"]), | ||
withSpace(props.ml, ["marginLeft"]) | ||
].filter((s) => Object.keys(s).length); | ||
const mergedStyles = nonEmptyStyles.reduce((acc, style) => { | ||
return __spreadValues(__spreadValues({}, acc), style); | ||
}, {}); | ||
return mergedStyles; | ||
}; | ||
var withSpace = (value, properties) => { | ||
return properties.reduce((styles, property) => { | ||
if (value) { | ||
return { ...styles, [property]: `${value}px` }; | ||
if (!isNaN(parseFloat(value))) { | ||
return __spreadProps(__spreadValues({}, styles), { [property]: `${value}px` }); | ||
} | ||
@@ -61,12 +100,11 @@ return styles; | ||
var Heading = React.forwardRef( | ||
({ as: Tag = "h1", children, style, m, mx, my, mt, mr, mb, ml, ...props }, forwardedRef) => { | ||
(_a, forwardedRef) => { | ||
var _b = _a, { as: Tag = "h1", children, style, m, mx, my, mt, mr, mb, ml } = _b, props = __objRest(_b, ["as", "children", "style", "m", "mx", "my", "mt", "mr", "mb", "ml"]); | ||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( | ||
import_react_slot.Slot, | ||
{ | ||
...props, | ||
__spreadProps(__spreadValues({}, props), { | ||
ref: forwardedRef, | ||
"data-id": "react-email-heading", | ||
style: { ...withMargin({ m, mx, my, mt, mr, mb, ml }), ...style }, | ||
style: __spreadValues(__spreadValues({}, withMargin({ m, mx, my, mt, mr, mb, ml })), style), | ||
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tag, { children }) | ||
} | ||
}) | ||
); | ||
@@ -73,0 +111,0 @@ } |
{ | ||
"name": "@react-email/heading", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "A block of heading text", | ||
@@ -12,2 +12,14 @@ "sideEffects": false, | ||
], | ||
"exports": { | ||
".": { | ||
"import": { | ||
"types": "./dist/index.d.ts", | ||
"default": "./dist/index.mjs" | ||
}, | ||
"require": { | ||
"types": "./dist/index.d.ts", | ||
"default": "./dist/index.js" | ||
} | ||
} | ||
}, | ||
"license": "MIT", | ||
@@ -37,16 +49,18 @@ "scripts": { | ||
"dependencies": { | ||
"@radix-ui/react-slot": "1.0.0", | ||
"@radix-ui/react-slot": "1.0.2", | ||
"react": "18.2.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/preset-react": "7.18.6", | ||
"@babel/preset-react": "7.22.5", | ||
"@react-email/render": "0.0.6", | ||
"@types/jest": "29.5.3", | ||
"@types/react": "18.0.20", | ||
"@types/react-dom": "18.0.6", | ||
"babel-jest": "28.1.3", | ||
"eslint": "8.23.1", | ||
"eslint": "8.45.0", | ||
"jest": "28.1.3", | ||
"prettier": "2.8.4", | ||
"prettier": "3.0.0", | ||
"ts-jest": "28.0.8", | ||
"tsup": "6.2.3", | ||
"typescript": "4.8.3" | ||
"tsup": "7.1.0", | ||
"typescript": "5.1.6" | ||
}, | ||
@@ -53,0 +67,0 @@ "publishConfig": { |
@@ -48,3 +48,3 @@ ![React Email heading cover](https://react.email/static/covers/heading.png) | ||
| -------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | | ||
| Gmail ✔ | Apple Mail ✔ | Outlook ✔ | Yahoo! Mail ✔ | HEY ✔ | Superhuman ✔ | | ||
| Gmail ✔ | Apple Mail ✔ | Outlook ✔ | Yahoo! Mail ✔ | HEY ✔ | Superhuman ✔ | | ||
@@ -51,0 +51,0 @@ ## License |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
20184
7
245
0
12
+ Added@radix-ui/react-compose-refs@1.0.1(transitive)
+ Added@radix-ui/react-slot@1.0.2(transitive)
- Removed@radix-ui/react-compose-refs@1.0.0(transitive)
- Removed@radix-ui/react-slot@1.0.0(transitive)
Updated@radix-ui/react-slot@1.0.2