flowbite-react
Version:
Official React components built for Flowbite and Tailwind CSS
1 lines • 3.22 kB
Source Map (JSON)
{"version":3,"file":"ListGroupItem.mjs","sources":["../../../../src/components/ListGroup/ListGroupItem.tsx"],"sourcesContent":["import type { ComponentProps, FC, PropsWithChildren } from \"react\";\nimport { twMerge } from \"tailwind-merge\";\nimport { mergeDeep } from \"../../helpers/merge-deep\";\nimport { getTheme } from \"../../theme-store\";\nimport type { DeepPartial } from \"../../types\";\nimport type { FlowbiteBoolean } from \"../Flowbite\";\n\nexport interface FlowbiteListGroupItemTheme {\n base: string;\n link: {\n base: string;\n active: FlowbiteBoolean;\n disabled: FlowbiteBoolean;\n href: FlowbiteBoolean;\n icon: string;\n };\n}\n\nexport interface ListGroupItemProps extends PropsWithChildren {\n active?: boolean;\n disabled?: boolean;\n href?: string;\n icon?: FC<ComponentProps<\"svg\">>;\n onClick?: () => void;\n theme?: DeepPartial<FlowbiteListGroupItemTheme>;\n}\n\nexport const ListGroupItem: FC<ListGroupItemProps & ComponentProps<\"a\"> & ComponentProps<\"button\">> = ({\n active: isActive,\n children,\n className,\n href,\n icon: Icon,\n onClick,\n theme: customTheme = {},\n disabled,\n ...props\n}) => {\n const theme = mergeDeep(getTheme().listGroup.item, customTheme);\n\n const isLink = typeof href !== \"undefined\";\n const Component = isLink ? \"a\" : \"button\";\n\n return (\n <li className={twMerge(theme.base, className)}>\n <Component\n href={href}\n onClick={onClick}\n type={isLink ? undefined : \"button\"}\n disabled={disabled}\n className={twMerge(\n theme.link.active[isActive ? \"on\" : \"off\"],\n theme.link.disabled[disabled ? \"on\" : \"off\"],\n theme.link.base,\n theme.link.href[isLink ? \"on\" : \"off\"],\n )}\n {...props}\n >\n {Icon && <Icon aria-hidden data-testid=\"flowbite-list-group-item-icon\" className={theme.link.icon} />}\n {children}\n </Component>\n </li>\n );\n};\n"],"names":[],"mappings":";;;;;AAKY,MAAC,aAAa,GAAG,CAAC;AAC9B,EAAE,MAAM,EAAE,QAAQ;AAClB,EAA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