UNPKG

@ozen-ui/kit

Version:

React component library

25 lines (24 loc) 1.5 kB
import { __assign, __rest } from "tslib"; import React, { forwardRef, useRef } from 'react'; import { useThemeProps } from '../../../../hooks/useThemeProps'; import { cn } from '../../../../utils/classname'; import { Radio } from '../../../RadioNext'; import { useListCardItemAsInteractiveModule } from '../../hooks'; import { useListCardItemContext } from '../../ListCardItemContext'; import { ListCardItemLeadingItem } from '../ListCardItemLeadingItem'; import { LIST_CARD_ITEM_SIZE_TO_LEADING_RADIO_SIZE } from './constants'; export var cnListCardItemLeadingRadio = cn('ListCardItemLeadingRadio'); export var ListCardItemLeadingRadio = forwardRef(function (inProps, ref) { var props = useThemeProps({ props: inProps, name: 'ListCardItemLeadingRadio', }); var className = props.className, disabled = props.disabled, dataTestid = props["data-testid"], other = __rest(props, ["className", "disabled", 'data-testid']); var size = useListCardItemContext().size; var radioSize = LIST_CARD_ITEM_SIZE_TO_LEADING_RADIO_SIZE[size]; var radioRef = useRef(null); useListCardItemAsInteractiveModule(radioRef, !disabled); return (React.createElement(ListCardItemLeadingItem, { ref: ref, className: cnListCardItemLeadingRadio('', [className]), "data-testid": dataTestid }, React.createElement(Radio, __assign({}, other, { ref: radioRef, size: radioSize, disabled: disabled })))); }); ListCardItemLeadingRadio.displayName = 'ListCardItemLeadingRadio';