UNPKG

@ozen-ui/kit

Version:

React component library

21 lines (20 loc) 1.33 kB
import { __assign, __rest } from "tslib"; import React, { forwardRef } from 'react'; import { useThemeProps } from '../../../../hooks/useThemeProps'; import { cn } from '../../../../utils/classname'; import { Badge } from '../../../Badge'; import { useListCardItemContext } from '../../ListCardItemContext'; import { ListCardItemTrailingItem } from '../ListCardItemTrailingItem'; import { LIST_CARD_ITEM_SIZE_TO_TRAILING_BADGE_SIZE } from './constants'; export var cnListCardItemTrailingBadge = cn('ListCardItemTrailingBadge'); export var ListCardItemTrailingBadge = forwardRef(function (inProps, ref) { var props = useThemeProps({ props: inProps, name: 'ListCardItemTrailingBadge', }); var children = props.children, className = props.className, caption = props.caption, dataTestid = props["data-testid"], other = __rest(props, ["children", "className", "caption", 'data-testid']); var size = useListCardItemContext().size; return (React.createElement(ListCardItemTrailingItem, { ref: ref, className: cnListCardItemTrailingBadge('', [className]), caption: caption, "data-testid": dataTestid }, React.createElement(Badge, __assign({}, other, { size: LIST_CARD_ITEM_SIZE_TO_TRAILING_BADGE_SIZE[size] }), children))); }); ListCardItemTrailingBadge.displayName = 'ListCardItemTrailingBadge';