1 | import classNames from 'classnames';
|
2 | import * as React from 'react';
|
3 | import warning from 'warning';
|
4 | import { useUncontrolled } from 'uncontrollable';
|
5 | import BaseNav from '@restart/ui/Nav';
|
6 | import { useBootstrapPrefix } from './ThemeProvider';
|
7 | import ListGroupItem from './ListGroupItem';
|
8 | import { jsx as _jsx } from "react/jsx-runtime";
|
9 | const ListGroup = React.forwardRef((props, ref) => {
|
10 | const {
|
11 | className,
|
12 | bsPrefix: initialBsPrefix,
|
13 | variant,
|
14 | horizontal,
|
15 | numbered,
|
16 |
|
17 | as = 'div',
|
18 | ...controlledProps
|
19 | } = useUncontrolled(props, {
|
20 | activeKey: 'onSelect'
|
21 | });
|
22 | const bsPrefix = useBootstrapPrefix(initialBsPrefix, 'list-group');
|
23 | let horizontalVariant;
|
24 |
|
25 | if (horizontal) {
|
26 | horizontalVariant = horizontal === true ? 'horizontal' : `horizontal-${horizontal}`;
|
27 | }
|
28 |
|
29 | process.env.NODE_ENV !== "production" ? warning(!(horizontal && variant === 'flush'), '`variant="flush"` and `horizontal` should not be used together.') : void 0;
|
30 | return _jsx(BaseNav, {
|
31 | ref: ref,
|
32 | ...controlledProps,
|
33 | as: as,
|
34 | className: classNames(className, bsPrefix, variant && `${bsPrefix}-${variant}`, horizontalVariant && `${bsPrefix}-${horizontalVariant}`, numbered && `${bsPrefix}-numbered`)
|
35 | });
|
36 | });
|
37 | ListGroup.displayName = 'ListGroup';
|
38 | export default Object.assign(ListGroup, {
|
39 | Item: ListGroupItem
|
40 | }); |
\ | No newline at end of file |