'use strict';

function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }

var __chunk_3 = require('../chunk-6d243953.js');
var React = require('react');
var React__default = _interopDefault(React);
var PropTypes = _interopDefault(require('prop-types'));
var __chunk_1 = require('../chunk-f817ce38.js');
require('../chunk-2b268ae7.js');

var styles = (function (theme) {
  var typography = theme.typography,
      palette = theme.palette;

  return {
    root: {
      fontStyle: typography.fontStyle,
      fontStretch: typography.fontStretch,
      lineHeight: typography.lineHeight,
      letterSpacing: typography.letterSpacing,
      fontWeight: typography.fontWeight,
      fontSize: typography.fontSize,
      fontFamily: typography.fontFamily,
      margin: 0
    },
    customSize: {
      fontSize: function fontSize(_ref) {
        var size = _ref.size;

        if (typeof size === 'string') {
          if (size === 'sm') return typography.fontSize;
          if (size === 'md') return typography.fontSizeMd;
          if (size === 'lg') return typography.fontSizeLg;
        } else if (typeof size === 'number') {
          return size;
        }
        return typography.fontSize;
      }
    },
    level: function level(_ref2) {
      var _ref2$level = _ref2.level,
          _level = _ref2$level === undefined ? 1 : _ref2$level;

      return __chunk_3._extends({}, typography['h' + _level]);
    },
    align: {
      textAlign: function textAlign(_ref3) {
        var align = _ref3.align;
        return align || 'left';
      }
    },
    underlined: {
      textDecoration: 'underline'
    },
    bold: {
      fontWeight: typography.fontWeightBold
    },
    italic: {
      fontStyle: 'italic'
    },
    strikethrough: {
      textDecoration: 'line-through'
    },
    capitalized: {
      textTransform: 'capitalize'
    },
    uppercase: {
      textTransform: 'uppercase'
    },
    black: {
      color: palette.black
    },
    grey: {
      color: palette.grey90
    },
    white: {
      color: palette.white
    },
    red: {
      color: palette.red
    }
  };
});

var Header = function Header(_ref) {
  var children = _ref.children,
      bold = _ref.bold,
      _ref$color = _ref.color,
      color = _ref$color === undefined ? 'black' : _ref$color,
      _ref$size = _ref.size,
      size = _ref$size === undefined ? 12 : _ref$size,
      className = _ref.className,
      classes = _ref.classes,
      _ref$underlined = _ref.underlined,
      underlined = _ref$underlined === undefined ? false : _ref$underlined,
      _ref$italic = _ref.italic,
      italic = _ref$italic === undefined ? false : _ref$italic,
      _ref$capitalized = _ref.capitalized,
      capitalized = _ref$capitalized === undefined ? false : _ref$capitalized,
      _ref$uppercase = _ref.uppercase,
      uppercase = _ref$uppercase === undefined ? false : _ref$uppercase,
      _ref$strikethrough = _ref.strikethrough,
      strikethrough = _ref$strikethrough === undefined ? false : _ref$strikethrough,
      _ref$level = _ref.level,
      level = _ref$level === undefined ? 1 : _ref$level,
      _ref$align = _ref.align,
      align = _ref$align === undefined ? 'left' : _ref$align,
      rest = __chunk_3.objectWithoutProperties(_ref, ['children', 'bold', 'color', 'size', 'className', 'classes', 'underlined', 'italic', 'capitalized', 'uppercase', 'strikethrough', 'level', 'align']);

  var Component = 'h' + level;
  return React__default.createElement(
    Component,
    __chunk_3._extends({
      className: __chunk_1.classNames(classes.root, classes.level, align && classes.align, bold && classes.bold, color && classes[color], size && classes.customSize, underlined && classes.underlined, italic && classes.italic, capitalized && classes.capitalized, uppercase && classes.uppercase, strikethrough && classes.strikethrough, className)
    }, rest),
    children
  );
};

Header.defaultProps = {};

Header.propTypes = {
  children: PropTypes.string.isRequired,
  bold: PropTypes.bool,
  // size can be "lg/md/sm" or number {12}
  size: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
  className: PropTypes.string,
  classes: PropTypes.object,
  inline: PropTypes.bool,
  color: PropTypes.oneOf(['black', 'grey', 'white', 'red']),
  align: PropTypes.oneOf(['left', 'right', 'center', 'justify', 'initial', 'inherit']),
  underlined: PropTypes.bool,
  italic: PropTypes.bool,
  strikethrough: PropTypes.bool,
  capitalized: PropTypes.bool,
  uppercase: PropTypes.bool,
  level: PropTypes.oneOf([1, 2, 3, 4])
};

var Header$1 = __chunk_1.withNano(styles, {
  observableProps: ['size', 'level', 'align']
})(Header);

module.exports = Header$1;
//# sourceMappingURL=index.js.map
