'use strict';

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

var clsx = require('clsx');
var React = require('react');
var typography = require('../common/propsValues/typography.js');
var jsxRuntime = require('react/jsx-runtime');

const DEFAULT_TYPE = typography.Typography.BODY_DEFAULT;
const bodyTypes = new Set([typography.Typography.BODY_DEFAULT, typography.Typography.BODY_DEFAULT_BOLD, typography.Typography.BODY_LARGE, typography.Typography.BODY_LARGE_BOLD]);
const Body = /*#__PURE__*/React.forwardRef(function Body({
  as: Element = 'div',
  type = DEFAULT_TYPE,
  className,
  preserveNewlines,
  ...props
}, reference) {
  const isTypeSupported = bodyTypes.has(type);
  return /*#__PURE__*/jsxRuntime.jsx(Element, {
    ...props,
    // @ts-expect-error TODO: Remove when component could be rewritten with generics
    // See: https://fettblog.eu/typescript-react-generic-forward-refs/
    ref: reference,
    className: clsx.clsx(`np-text-${isTypeSupported ? type : DEFAULT_TYPE}`, preserveNewlines && 'np-text--pre-line', className)
  });
});

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