import _defineProperty from "@babel/runtime/helpers/defineProperty";
import _objectSpread from "@babel/runtime/helpers/objectSpread";

/**
 * Web Icon Component
 *
 */
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import DefaultIcon, { DefaultIconSize, prerenderIcon, prepareIcon } from '../icon/Icon';
import * as primary_icons from '../../../icons/primary_icons';
import * as primary_icons_medium from '../../../icons/primary_icons_medium';

const icons = _objectSpread({}, primary_icons, primary_icons_medium);

export { DefaultIconSize };
export const propTypes = _objectSpread({}, DefaultIcon.propTypes, {
  icon: PropTypes.oneOfType([PropTypes.string, PropTypes.node, PropTypes.func])
});
export const defaultProps = _objectSpread({}, DefaultIcon.defaultProps);
export default class IconPrimary extends PureComponent {
  static enableWebComponent() {
    DefaultIcon.enableWebComponent(IconPrimary.tagName, IconPrimary);
  }

  static getIcon(props) {
    return DefaultIcon.getIcon(props);
  }

  render() {
    const {
      icon,
      size,
      wrapperParams,
      iconParams,
      alt
    } = prepareIcon(this.props);
    const IconContainer = prerenderIcon({
      icon,
      size,
      alt,
      listOfIcons: icons
    });
    if (!IconContainer) return React.createElement(React.Fragment, null);
    return React.createElement("span", wrapperParams, React.createElement(IconContainer, iconParams));
  }

}

_defineProperty(IconPrimary, "tagName", 'dnb-icon-primary');

_defineProperty(IconPrimary, "defaultProps", defaultProps);

IconPrimary.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};