'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var clsx = require('clsx');
var React = require('react');
require('../common/theme.js');
require('../common/direction.js');
require('../common/propsValues/control.js');
require('../common/propsValues/breakpoint.js');
require('../common/propsValues/size.js');
var typography = require('../common/propsValues/typography.js');
require('../common/propsValues/width.js');
require('../common/propsValues/type.js');
require('../common/propsValues/dateMode.js');
require('../common/propsValues/monthFormat.js');
require('../common/propsValues/position.js');
require('../common/propsValues/layouts.js');
require('../common/propsValues/status.js');
require('../common/propsValues/sentiment.js');
require('../common/propsValues/profileType.js');
require('../common/propsValues/variant.js');
require('../common/propsValues/scroll.js');
require('../common/propsValues/markdownNodeType.js');
require('../common/fileType.js');
require('@transferwise/icons');
require('react-intl');
require('../common/closeButton/CloseButton.messages.js');
var jsxRuntime = require('react/jsx-runtime');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var React__default = /*#__PURE__*/_interopDefault(React);

const DEFAULT_TYPE = typography.Typography.TITLE_GROUP;
const titleTypeMapping = {
  [typography.Typography.TITLE_SCREEN]: 'h1',
  [typography.Typography.TITLE_SECTION]: 'h2',
  [typography.Typography.TITLE_SUBSECTION]: 'h3',
  [typography.Typography.TITLE_BODY]: 'h4',
  [typography.Typography.TITLE_GROUP]: 'h5'
};
const Title = /*#__PURE__*/React__default.default.forwardRef(({
  as,
  type = DEFAULT_TYPE,
  className,
  ...props
}, ref) => {
  const mapping = titleTypeMapping[type];
  const isTypeSupported = mapping !== undefined;
  if (isTypeSupported) {
    const HeaderTag = as ?? mapping;
    return /*#__PURE__*/jsxRuntime.jsx(HeaderTag, {
      ref: ref,
      ...props,
      className: clsx.clsx(`np-text-${type}`, className)
    });
  }
  const HeaderTag = as ?? titleTypeMapping[DEFAULT_TYPE];
  return /*#__PURE__*/jsxRuntime.jsx(HeaderTag, {
    ref: ref,
    ...props,
    className: clsx.clsx(`np-text-${DEFAULT_TYPE}`, className)
  });
});

exports.default = Title;
//# sourceMappingURL=Title.js.map
