Heading.js 555 B

1234567891011121314151617
  1. /*!
  2. * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  3. * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
  4. * v1.0.0-beta.97
  5. */
  6. import { h } from '@stencil/core/internal/client/index.js';
  7. function constrainHeadingLevel(level) {
  8. return Math.min(Math.max(Math.ceil(level), 1), 6);
  9. }
  10. const Heading = (props, children) => {
  11. const HeadingTag = `h${props.level}`;
  12. delete props.level;
  13. return h(HeadingTag, { ...props }, children);
  14. };
  15. export { Heading as H, constrainHeadingLevel as c };