@coreui/react-pro
Version:
UI Components Library for React.js
36 lines (33 loc) • 1.46 kB
JavaScript
import { __rest } from '../../node_modules/tslib/tslib.es6.js';
import React, { forwardRef } from 'react';
import PropTypes from 'prop-types';
import classNames from '../../_virtual/index.js';
import { CLink } from '../link/CLink.js';
import { colorPropType } from '../../props.js';
const CListGroupItem = forwardRef((_a, ref) => {
var { children, active, as = 'li', className, disabled, color } = _a, rest = __rest(_a, ["children", "active", "as", "className", "disabled", "color"]);
const Component = as === 'a' || as === 'button' ? CLink : as;
rest = Object.assign(Object.assign(Object.assign(Object.assign({}, ((as === 'a' || as === 'button') && {
active,
disabled,
as,
ref: ref,
})), (active && { 'aria-current': true })), (disabled && { 'aria-disabled': true })), rest);
return (React.createElement(Component, Object.assign({ className: classNames('list-group-item', {
[`list-group-item-${color}`]: color,
'list-group-item-action': as === 'a' || as === 'button',
active,
disabled,
}, className) }, rest), children));
});
CListGroupItem.propTypes = {
active: PropTypes.bool,
as: PropTypes.elementType,
children: PropTypes.node,
className: PropTypes.string,
color: colorPropType,
disabled: PropTypes.bool,
};
CListGroupItem.displayName = 'CListGroupItem';
export { CListGroupItem };
//# sourceMappingURL=CListGroupItem.js.map