GoScrobble/web/node_modules/react-bootstrap/esm/ListGroup.js

47 lines
1.9 KiB
JavaScript
Raw Normal View History

2022-04-25 02:47:15 +00:00
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
var _excluded = ["className", "bsPrefix", "variant", "horizontal", "as"];
import classNames from 'classnames';
import React from 'react';
import warning from 'warning';
import { useUncontrolled } from 'uncontrollable';
import { useBootstrapPrefix } from './ThemeProvider';
import AbstractNav from './AbstractNav';
import ListGroupItem from './ListGroupItem';
var defaultProps = {
variant: undefined,
horizontal: undefined
};
var ListGroup = /*#__PURE__*/React.forwardRef(function (props, ref) {
var _useUncontrolled = useUncontrolled(props, {
activeKey: 'onSelect'
}),
className = _useUncontrolled.className,
initialBsPrefix = _useUncontrolled.bsPrefix,
variant = _useUncontrolled.variant,
horizontal = _useUncontrolled.horizontal,
_useUncontrolled$as = _useUncontrolled.as,
as = _useUncontrolled$as === void 0 ? 'div' : _useUncontrolled$as,
controlledProps = _objectWithoutPropertiesLoose(_useUncontrolled, _excluded);
var bsPrefix = useBootstrapPrefix(initialBsPrefix, 'list-group');
var horizontalVariant;
if (horizontal) {
horizontalVariant = horizontal === true ? 'horizontal' : "horizontal-" + horizontal;
} else {
horizontalVariant = null;
}
process.env.NODE_ENV !== "production" ? warning(!(horizontal && variant === 'flush'), '`variant="flush"` and `horizontal` should not be used together.') : void 0;
return /*#__PURE__*/React.createElement(AbstractNav, _extends({
ref: ref
}, controlledProps, {
as: as,
className: classNames(className, bsPrefix, variant && bsPrefix + "-" + variant, horizontalVariant && bsPrefix + "-" + horizontalVariant)
}));
});
ListGroup.defaultProps = defaultProps;
ListGroup.displayName = 'ListGroup';
ListGroup.Item = ListGroupItem;
export default ListGroup;