@dnb/eufemia
Version:
DNB Eufemia Design System UI Library
44 lines • 1.4 kB
JavaScript
import React from 'react';
import clsx from 'clsx';
import useId from "../../../../shared/helpers/useId.js";
import Heading from "../../../../components/heading/Heading.js";
import HelpButtonInline, { HelpButtonInlineContent } from "../../../../components/help-button/HelpButtonInline.js";
import withComponentMarkers from "../../../../shared/helpers/withComponentMarkers.js";
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
function MainHeading({
level,
...props
}) {
const {
help,
className,
children,
...rest
} = props;
const helpId = useId();
const hasHelp = (help === null || help === void 0 ? void 0 : help.title) || (help === null || help === void 0 ? void 0 : help.content);
return _jsxs(_Fragment, {
children: [_jsxs(Heading, {
className: clsx('dnb-forms-main-heading', className),
level: level || 2,
skipCorrection: true,
size: "large",
...rest,
children: [children, hasHelp && _jsx(HelpButtonInline, {
left: "x-small",
contentId: helpId,
help: help
})]
}), hasHelp && _jsx(HelpButtonInlineContent, {
top: "x-small",
contentId: helpId,
help: help
})]
});
}
withComponentMarkers(MainHeading, {
_supportsSpacingProps: true,
_isHeadingElement: true
});
export default MainHeading;
//# sourceMappingURL=MainHeading.js.map