function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

import * as React from 'react';
import { createUseStyles } from '@fluent-ui/styles';
import { styles } from './Typography.styled';
import { TypographyPropTypes } from './Typography.type';
import Box from '../Box';
import classNames from 'classnames';
export const defaultVariantMapping = {
  h1: 'h1',
  h2: 'h2',
  h3: 'h3',
  h4: 'h4',
  h5: 'h5',
  h6: 'h6',
  subtitle1: 'h6',
  subtitle2: 'h6',
  body1: 'p',
  body2: 'p'
};
export const name = 'Typography';
const useStyles = createUseStyles(styles, {
  name
});
const Typography = React.forwardRef((props, ref) => {
  const {
    as,
    className: classNameProp,
    variant = 'body1',
    variantMapping = defaultVariantMapping,
    gutterTop = false,
    gutterBottom = false,
    noWrap = false,
    ...rest
  } = props;
  const classes = useStyles(props);
  const className = classNames(classes.root, classes.variants, {
    [classes.gutterTop]: gutterTop,
    [classes.gutterBottom]: gutterBottom,
    [classes.noWrap]: noWrap
  }, classNameProp);
  const component = as || variantMapping[variant] || defaultVariantMapping[variant] || 'span';
  return React.createElement(Box, _extends({
    className: className,
    ref: ref,
    as: component
  }, rest));
});
Typography.displayName = `F${name}`;
Typography.propTypes = TypographyPropTypes;
Typography.defaultProps = {
  variant: 'body1',
  variantMapping: defaultVariantMapping,
  gutterTop: false,
  gutterBottom: false,
  noWrap: false
};
export default Typography;