UNPKG

@dnb/eufemia

Version:

DNB Eufemia Design System UI Library

34 lines (33 loc) 1.16 kB
"use client"; import _extends from "@babel/runtime/helpers/esm/extends"; import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties"; const _excluded = ["as", "is", "level", "size", "className"]; import React from 'react'; import classnames from 'classnames'; import E from '../Element'; import { setNextLevel, getHeadingSize } from '../../components/heading/HeadingHelpers'; import { useTheme } from '../../shared'; const H = _ref => { let { as = 'h1', is, level, size, className } = _ref, props = _objectWithoutProperties(_ref, _excluded); const numSiz = parseFloat(String(as || is).substring(1)); if (level === 'use') { setNextLevel(numSiz); } const theme = useTheme(); const targetSize = size === 'auto' && getHeadingSize(theme === null || theme === void 0 ? void 0 : theme.name)[numSiz] || size || 'xx-large'; return React.createElement(E, _extends({ as: as || is, internalClass: classnames(className, targetSize && `dnb-h--${targetSize}`) }, props)); }; H._isHeadingElement = true; H._supportsSpacingProps = true; export default H; //# sourceMappingURL=H.js.map