1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = void 0;
|
7 | var _react = _interopRequireDefault(require("react"));
|
8 | var _propTypes = _interopRequireDefault(require("prop-types"));
|
9 | var _classnames = _interopRequireDefault(require("classnames"));
|
10 | var _utils = require("./utils");
|
11 | const _excluded = ["className", "cssModule", "tag", "flush", "horizontal", "numbered"];
|
12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13 | function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
14 | 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; }
|
15 | 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; }
|
16 | const propTypes = {
|
17 |
|
18 | className: _propTypes.default.string,
|
19 |
|
20 | cssModule: _propTypes.default.object,
|
21 |
|
22 | flush: _propTypes.default.bool,
|
23 |
|
24 | horizontal: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.string]),
|
25 |
|
26 | numbered: _propTypes.default.bool,
|
27 |
|
28 | tag: _utils.tagPropType
|
29 | };
|
30 | const getHorizontalClass = horizontal => {
|
31 | if (horizontal === false) {
|
32 | return false;
|
33 | }
|
34 | if (horizontal === true || horizontal === 'xs') {
|
35 | return 'list-group-horizontal';
|
36 | }
|
37 | return `list-group-horizontal-${horizontal}`;
|
38 | };
|
39 | function ListGroup(props) {
|
40 | const {
|
41 | className,
|
42 | cssModule,
|
43 | tag: Tag = 'ul',
|
44 | flush,
|
45 | horizontal = false,
|
46 | numbered = false
|
47 | } = props,
|
48 | attributes = _objectWithoutProperties(props, _excluded);
|
49 | const classes = (0, _utils.mapToCssModules)((0, _classnames.default)(className, 'list-group',
|
50 |
|
51 |
|
52 | flush ? 'list-group-flush' : getHorizontalClass(horizontal), {
|
53 | 'list-group-numbered': numbered
|
54 | }), cssModule);
|
55 | return _react.default.createElement(Tag, _extends({}, attributes, {
|
56 | className: classes
|
57 | }));
|
58 | }
|
59 | ListGroup.propTypes = propTypes;
|
60 | var _default = ListGroup;
|
61 | exports.default = _default; |
\ | No newline at end of file |