import "core-js/modules/es6.object.assign";
import "core-js/modules/web.dom.iterable";
import "core-js/modules/es6.array.iterator";
import "core-js/modules/es6.object.keys";

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); }

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { EuiDescriptionListTitle } from './description_list_title';
import { EuiDescriptionListDescription } from './description_list_description';
var typesToClassNameMap = {
  row: 'euiDescriptionList--row',
  column: 'euiDescriptionList--column',
  inline: 'euiDescriptionList--inline'
};
export var TYPES = Object.keys(typesToClassNameMap);
var alignmentsToClassNameMap = {
  center: 'euiDescriptionList--center',
  left: ''
};
export var ALIGNMENTS = Object.keys(alignmentsToClassNameMap);
var textStylesToClassNameMap = {
  normal: '',
  reverse: 'euiDescriptionList--reverse'
};
export var TEXT_STYLES = Object.keys(textStylesToClassNameMap);
export var EuiDescriptionList = function EuiDescriptionList(_ref) {
  var children = _ref.children,
      className = _ref.className,
      listItems = _ref.listItems,
      align = _ref.align,
      compressed = _ref.compressed,
      textStyle = _ref.textStyle,
      type = _ref.type,
      rest = _objectWithoutProperties(_ref, ["children", "className", "listItems", "align", "compressed", "textStyle", "type"]);

  var classes = classNames('euiDescriptionList', typesToClassNameMap[type], alignmentsToClassNameMap[align], textStylesToClassNameMap[textStyle], {
    'euiDescriptionList--compressed': compressed
  }, className);
  var childrenOrListItems = null;

  if (listItems) {
    childrenOrListItems = listItems.map(function (item, index) {
      return [React.createElement(EuiDescriptionListTitle, {
        key: "title-".concat(index)
      }, item.title), React.createElement(EuiDescriptionListDescription, {
        key: "description-".concat(index)
      }, item.description)];
    });
  } else {
    childrenOrListItems = children;
  }

  return React.createElement("dl", _extends({
    className: classes
  }, rest), childrenOrListItems);
};
EuiDescriptionList.propTypes = {
  listItems: PropTypes.arrayOf(PropTypes.shape({
    title: PropTypes.node,
    description: PropTypes.node
  })),
  children: PropTypes.node,
  className: PropTypes.string,

  /**
   * Text alignment
   */
  align: PropTypes.oneOf(ALIGNMENTS),

  /**
   * Smaller text and condensed spacing
   */
  compressed: PropTypes.bool,

  /**
   * How should the content be styled, by default
   * this will emphasize the title
   */
  textStyle: PropTypes.oneOf(TEXT_STYLES),

  /**
   * How each item should be layed out
   */
  type: PropTypes.oneOf(TYPES)
};
EuiDescriptionList.defaultProps = {
  align: 'left',
  compressed: false,
  textStyle: 'normal',
  type: 'row'
};
EuiDescriptionList.__docgenInfo = {
  "description": "",
  "methods": [],
  "displayName": "EuiDescriptionList",
  "props": {
    "align": {
      "defaultValue": {
        "value": "'left'",
        "computed": false
      },
      "type": {
        "name": "enum",
        "value": [{
          "value": "\"center\"",
          "computed": false
        }, {
          "value": "\"left\"",
          "computed": false
        }]
      },
      "required": false,
      "description": "Text alignment"
    },
    "compressed": {
      "defaultValue": {
        "value": "false",
        "computed": false
      },
      "type": {
        "name": "bool"
      },
      "required": false,
      "description": "Smaller text and condensed spacing"
    },
    "textStyle": {
      "defaultValue": {
        "value": "'normal'",
        "computed": false
      },
      "type": {
        "name": "enum",
        "value": [{
          "value": "\"normal\"",
          "computed": false
        }, {
          "value": "\"reverse\"",
          "computed": false
        }]
      },
      "required": false,
      "description": "How should the content be styled, by default\nthis will emphasize the title"
    },
    "type": {
      "defaultValue": {
        "value": "'row'",
        "computed": false
      },
      "type": {
        "name": "enum",
        "value": [{
          "value": "\"row\"",
          "computed": false
        }, {
          "value": "\"column\"",
          "computed": false
        }, {
          "value": "\"inline\"",
          "computed": false
        }]
      },
      "required": false,
      "description": "How each item should be layed out"
    },
    "listItems": {
      "type": {
        "name": "arrayOf",
        "value": {
          "name": "shape",
          "value": {
            "title": {
              "name": "node",
              "required": false
            },
            "description": {
              "name": "node",
              "required": false
            }
          }
        }
      },
      "required": false,
      "description": ""
    },
    "children": {
      "type": {
        "name": "node"
      },
      "required": false,
      "description": ""
    },
    "className": {
      "type": {
        "name": "string"
      },
      "required": false,
      "description": ""
    }
  }
};