'use strict';

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

var _lib = require('../../lib');

var _PropTypes = require('../../lib/PropTypes');

exports.default = {
  name: 'SuiImage',
  props: {
    disabled: Boolean,
    hidden: Boolean,
    size: (0, _PropTypes.Enum)(['mini', 'tiny', 'small', 'medium', 'large', 'big', 'huge', 'massive']),
    spaced: (0, _PropTypes.Enum)(['left', 'right'], { type: Boolean }),
    src: {
      type: String,
      required: true
    },
    wrapped: Boolean
  },
  methods: {
    getSpacedClass: function getSpacedClass() {
      if (this.spaced === true) return 'spaced';
      if (this.spaced) return this.spaced + ' spaced';
      return '';
    }
  },
  render: function render() {
    var h = arguments[0];

    var ElementType = (0, _lib.getElementType)(this, 'div');
    var classNames = (0, _lib.classes)('ui', this.size, this.spaced !== true && this.spaced, this.spaced && 'spaced', this.hidden && 'hidden', this.disabled && 'disabled', 'image');

    if (this.wrapped) {
      return h(
        ElementType,
        { 'class': classNames },
        [h(
          'img',
          {
            attrs: { src: this.src }
          },
          []
        )]
      );
    }

    return h(
      'img',
      { 'class': classNames, attrs: { src: this.src }
      },
      []
    );
  }
};