1 line
1.9 KiB
JSON
1 line
1.9 KiB
JSON
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nimport classNames from 'classnames';\nimport React, { useCallback } from 'react';\nimport AbstractNavItem from './AbstractNavItem';\nimport { makeEventKey } from './SelectableContext';\nimport { useBootstrapPrefix } from './ThemeProvider';\nvar defaultProps = {\n variant: null,\n active: false,\n disabled: false\n};\nvar ListGroupItem = React.forwardRef(function (_ref, ref) {\n var bsPrefix = _ref.bsPrefix,\n active = _ref.active,\n disabled = _ref.disabled,\n className = _ref.className,\n variant = _ref.variant,\n action = _ref.action,\n as = _ref.as,\n eventKey = _ref.eventKey,\n onClick = _ref.onClick,\n props = _objectWithoutPropertiesLoose(_ref, [\"bsPrefix\", \"active\", \"disabled\", \"className\", \"variant\", \"action\", \"as\", \"eventKey\", \"onClick\"]);\n\n bsPrefix = useBootstrapPrefix(bsPrefix, 'list-group-item');\n var handleClick = useCallback(function (event) {\n if (disabled) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n if (onClick) onClick(event);\n }, [disabled, onClick]);\n return React.createElement(AbstractNavItem, _extends({\n ref: ref\n }, props, {\n eventKey: makeEventKey(eventKey, props.href) // eslint-disable-next-line\n ,\n as: as || (action ? props.href ? 'a' : 'button' : 'div'),\n onClick: handleClick,\n className: classNames(className, bsPrefix, active && 'active', disabled && 'disabled', variant && bsPrefix + \"-\" + variant, action && bsPrefix + \"-action\")\n }));\n});\nListGroupItem.defaultProps = defaultProps;\nListGroupItem.displayName = 'ListGroupItem';\nexport default ListGroupItem;","map":null,"metadata":{},"sourceType":"module"} |