@esri/calcite-components
Version:
Web Components for Esri's Calcite Design System.
18 lines (17 loc) • 750 B
JavaScript
/*! All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://github.com/Esri/calcite-design-system/blob/dev/LICENSE.md for details.
v3.2.1 */
import { keyed } from "lit-html/directives/keyed.js";
import { unsafeStatic, literal, html } from "lit-html/static.js";
import { safeClassMap } from "@arcgis/lumina";
function constrainHeadingLevel(level) {
return Math.min(Math.max(Math.ceil(level), 1), 6);
}
const Heading = ({ children, ...props }) => {
const DynamicHtmlTag = props.level ? unsafeStatic(`h${props.level}`) : literal`div`;
return keyed(props.key, html`<${DynamicHtmlTag} class=${safeClassMap(props.class)}>${children}</${DynamicHtmlTag}>`);
};
export {
Heading as H,
constrainHeadingLevel as c
};