UNPKG

@ozen-ui/kit

Version:

React component library

24 lines (23 loc) 1.25 kB
import { __assign, __rest } from "tslib"; import React, { forwardRef } from 'react'; import { useThemeProps } from '../../../../hooks/useThemeProps'; import { cn } from '../../../../utils/classname'; import { renderContent } from '../../../../utils/renderContent'; import { useListCardItemContext } from '../../ListCardItemContext'; import { ListCardItemLeadingItem } from '../ListCardItemLeadingItem'; import { LIST_CARD_ITEM_SIZE_TO_LEADING_ICON_SIZE } from './constants'; export var cnListCardItemLeadingIcon = cn('ListCardItemLeadingIcon'); export var ListCardItemLeadingIcon = forwardRef(function (inProps, ref) { var props = useThemeProps({ props: inProps, name: 'ListCardItemLeadingIcon', }); var icon = props.icon, className = props.className, other = __rest(props, ["icon", "className"]); var size = useListCardItemContext().size; var renderedIcon = renderContent({ content: icon, props: { size: LIST_CARD_ITEM_SIZE_TO_LEADING_ICON_SIZE[size] }, }); return (React.createElement(ListCardItemLeadingItem, __assign({}, other, { ref: ref, className: cnListCardItemLeadingIcon('', [className]) }), renderedIcon)); }); ListCardItemLeadingIcon.displayName = 'ListCardItemLeadingIcon';