@coreui/react
Version:
UI Components Library for React.js
37 lines (34 loc) • 1.63 kB
JavaScript
import { __rest, __assign } 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';
var CListGroupItem = forwardRef(function (_a, ref) {
var _b;
var children = _a.children, active = _a.active, _c = _a.as, as = _c === void 0 ? 'li' : _c, className = _a.className, disabled = _a.disabled, color = _a.color, rest = __rest(_a, ["children", "active", "as", "className", "disabled", "color"]);
var Component = as === 'a' || as === 'button' ? CLink : as;
rest = __assign(__assign(__assign(__assign({}, ((as === 'a' || as === 'button') && {
active: active,
disabled: disabled,
as: as,
ref: ref,
})), (active && { 'aria-current': true })), (disabled && { 'aria-disabled': true })), rest);
return (React.createElement(Component, __assign({ className: classNames('list-group-item', (_b = {},
_b["list-group-item-".concat(color)] = color,
_b['list-group-item-action'] = as === 'a' || as === 'button',
_b.active = active,
_b.disabled = disabled,
_b), 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