react-headings 3.1.2 → 3.2.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.ts +1 -1
- package/dist/index.js +6 -6
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ declare type HProps = React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingEl
|
|
|
15
15
|
/**
|
|
16
16
|
* Renders a dynamic HTML heading (h1, h2, etc.) or custom component according to the current level.
|
|
17
17
|
*/
|
|
18
|
-
export declare
|
|
18
|
+
export declare const H: React.ForwardRefExoticComponent<Pick<HProps, "render" | "key" | keyof React.HTMLAttributes<HTMLHeadingElement>> & React.RefAttributes<HTMLHeadingElement>>;
|
|
19
19
|
declare type SectionProps = {
|
|
20
20
|
component: React.ReactNode;
|
|
21
21
|
children?: React.ReactNode;
|
package/dist/index.js
CHANGED
|
@@ -38,18 +38,18 @@ function useLevel() {
|
|
|
38
38
|
return react_1.default.useContext(LevelContext);
|
|
39
39
|
}
|
|
40
40
|
exports.useLevel = useLevel;
|
|
41
|
-
|
|
42
|
-
* Renders a dynamic HTML heading (h1, h2, etc.) or custom component according to the current level.
|
|
43
|
-
*/
|
|
44
|
-
function H(_a) {
|
|
41
|
+
function InternalH(_a, forwardedRef) {
|
|
45
42
|
var render = _a.render, props = __rest(_a, ["render"]);
|
|
46
43
|
var context = useLevel();
|
|
47
44
|
if (render) {
|
|
48
45
|
return render(context);
|
|
49
46
|
}
|
|
50
|
-
return react_1.default.createElement(context.Component, __assign({}, props));
|
|
47
|
+
return react_1.default.createElement(context.Component, __assign({ ref: forwardedRef }, props));
|
|
51
48
|
}
|
|
52
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Renders a dynamic HTML heading (h1, h2, etc.) or custom component according to the current level.
|
|
51
|
+
*/
|
|
52
|
+
exports.H = react_1.default.forwardRef(InternalH);
|
|
53
53
|
/**
|
|
54
54
|
* Renders `component` in the current level and `children` in the next level.
|
|
55
55
|
* @param component A component containing a heading
|