1 | import _extends from "@babel/runtime/helpers/esm/extends";
|
2 | import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
3 | import React from 'react';
|
4 | import PropTypes from 'prop-types';
|
5 | import classNames from 'classnames';
|
6 | import { mapToCssModules, tagPropType } from './utils';
|
7 | var propTypes = {
|
8 | tag: tagPropType,
|
9 | flush: PropTypes.bool,
|
10 | className: PropTypes.string,
|
11 | cssModule: PropTypes.object,
|
12 | horizontal: PropTypes.oneOfType([PropTypes.bool, PropTypes.string])
|
13 | };
|
14 | var defaultProps = {
|
15 | tag: 'ul',
|
16 | horizontal: false
|
17 | };
|
18 |
|
19 | var getHorizontalClass = function getHorizontalClass(horizontal) {
|
20 | if (horizontal === false) {
|
21 | return false;
|
22 | } else if (horizontal === true || horizontal === "xs") {
|
23 | return "list-group-horizontal";
|
24 | }
|
25 |
|
26 | return "list-group-horizontal-" + horizontal;
|
27 | };
|
28 |
|
29 | var ListGroup = function ListGroup(props) {
|
30 | var className = props.className,
|
31 | cssModule = props.cssModule,
|
32 | Tag = props.tag,
|
33 | flush = props.flush,
|
34 | horizontal = props.horizontal,
|
35 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "tag", "flush", "horizontal"]);
|
36 |
|
37 | var classes = mapToCssModules(classNames(className, 'list-group',
|
38 |
|
39 | flush ? 'list-group-flush' : getHorizontalClass(horizontal)), cssModule);
|
40 | return React.createElement(Tag, _extends({}, attributes, {
|
41 | className: classes
|
42 | }));
|
43 | };
|
44 |
|
45 | ListGroup.propTypes = propTypes;
|
46 | ListGroup.defaultProps = defaultProps;
|
47 | export default ListGroup; |
\ | No newline at end of file |