import React, { Component } from 'react';
import classNames from 'classnames';
import { SoftDescriptionListTitle } from './SoftDescriptionListTitle';
import { SoftDescriptionListDescription } from './SoftDescriptionListDescription';
import { keysOf } from '../common';
const typesToClassNameMap = {
    row: 'softDescriptionList--row',
    column: 'softDescriptionList--column',
    inline: 'softDescriptionList--inline',
};
export const TYPES = keysOf(typesToClassNameMap);
const alignmentsToClassNameMap = {
    center: 'softDescriptionList--center',
    left: '',
};
export const ALIGNMENTS = keysOf(alignmentsToClassNameMap);
const textStylesToClassNameMap = {
    normal: '',
    reverse: 'softDescriptionList--reverse',
};
export const TEXT_STYLES = keysOf(textStylesToClassNameMap);
export class SoftDescriptionList extends Component {
    render() {
        let { align, children, className, compressed, descriptionProps, listItems, textStyle, titleProps, type, ...rest } = this.props;
        const classes = classNames('softDescriptionList', type ? typesToClassNameMap[type] : undefined, align ? alignmentsToClassNameMap[align] : undefined, textStyle ? textStylesToClassNameMap[textStyle] : undefined, {
            'softDescriptionList--compressed': compressed,
        }, className);
        let childrenOrListItems = null;
        if (listItems) {
            childrenOrListItems = listItems.map((item, index) => {
                return [
                    React.createElement(SoftDescriptionListTitle, Object.assign({ key: `title-${index}` }, titleProps), item.title),
                    React.createElement(SoftDescriptionListDescription, Object.assign({ key: `description-${index}` }, descriptionProps), item.description),
                ];
            });
        }
        else {
            childrenOrListItems = children;
        }
        return (React.createElement("dl", Object.assign({ className: classes }, rest), childrenOrListItems));
    }
}
SoftDescriptionList.defaultProps = { align: 'left', compressed: false, textStyle: 'normal', type: 'row' };
//# sourceMappingURL=SoftDescriptionList.js.map