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

/**
 * Web FormSummary Component
 *
 */
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import { registerElement, validateDOMAttributes } from '../../shared/component-helper'; // import './style/dnb-form-summary.css' // no good solution to import the style here

import DescriptionList from '../description-list/DescriptionList';
const renderProps = {};
export const propTypes = {
  title: PropTypes.string,
  text: PropTypes.string,
  descriptionListData: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
  descriptionListInfo: PropTypes.string,
  class: PropTypes.string,

  /** React props */
  className: PropTypes.string,
  children: PropTypes.oneOfType([PropTypes.string, PropTypes.node, PropTypes.func]) // Web Component props

};
export const defaultProps = _objectSpread({
  title: null,
  text: null,
  descriptionListData: null,
  descriptionListInfo: null,
  class: null,

  /** React props */
  className: null,
  children: null
}, renderProps);
export default class FormSummary extends PureComponent {
  static enableWebComponent() {
    registerElement(FormSummary.tagName, FormSummary, defaultProps);
  }

  render() {
    const {
      title,
      text,
      descriptionListData,
      descriptionListInfo,
      className,
      class: _className
    } = this.props;
    const params = {
      className: classnames('dnb-form-summary', className, _className) // also used for code markup simulation

    };
    validateDOMAttributes(this.props, params);
    return React.createElement("div", params, React.createElement("div", {
      className: "dnb-belt"
    }, React.createElement("div", {
      className: "dnb-width-limit"
    }, React.createElement("div", {
      className: "dnb-grid dnb-grid--gutters"
    }, React.createElement("div", {
      className: "dnb-grid__cell u-1of3"
    }, React.createElement("div", {
      className: "dnb-form-summary__header"
    }, React.createElement("h2", {
      className: "dnb-form-summary__title typo-light"
    }, title), React.createElement("p", {
      className: "dnb-form-summary__info dnb-typo-book"
    }, text))), React.createElement("div", {
      className: "dnb-grid__cell"
    }, React.createElement("div", {
      className: "dnb-form-summary__list"
    }, React.createElement(DescriptionList, {
      data: descriptionListData,
      info: descriptionListInfo
    })))))));
  }

}

_defineProperty(FormSummary, "tagName", 'dnb-form-summary');

_defineProperty(FormSummary, "defaultProps", defaultProps);

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