@ozen-ui/kit
Version:
React component library
24 lines (23 loc) • 1.62 kB
JavaScript
import { __assign, __rest } from "tslib";
import React, { forwardRef, useRef } from 'react';
import { useThemeProps } from '../../../../hooks/useThemeProps';
import { cn } from '../../../../utils/classname';
import { Checkbox } from '../../../CheckboxNext';
import { useListCardItemAsInteractiveModule } from '../../hooks';
import { useListCardItemContext } from '../../ListCardItemContext';
import { ListCardItemTrailingItem } from '../ListCardItemTrailingItem';
import { LIST_CARD_ITEM_SIZE_TO_TRAILING_CHECKBOX_SIZE } from './constants';
export var cnListCardItemTrailingCheckbox = cn('ListCardItemTrailingCheckbox');
export var ListCardItemTrailingCheckbox = forwardRef(function (inProps, ref) {
var props = useThemeProps({
props: inProps,
name: 'ListCardItemTrailingCheckbox',
});
var children = props.children, className = props.className, caption = props.caption, disabled = props.disabled, dataTestid = props["data-testid"], other = __rest(props, ["children", "className", "caption", "disabled", 'data-testid']);
var size = useListCardItemContext().size;
var checkboxRef = useRef(null);
useListCardItemAsInteractiveModule(checkboxRef, !disabled);
return (React.createElement(ListCardItemTrailingItem, { ref: ref, className: cnListCardItemTrailingCheckbox('', [className]), caption: caption, "data-testid": dataTestid },
React.createElement(Checkbox, __assign({}, other, { ref: checkboxRef, size: LIST_CARD_ITEM_SIZE_TO_TRAILING_CHECKBOX_SIZE[size], disabled: disabled }), children)));
});
ListCardItemTrailingCheckbox.displayName = 'ListCardItemTrailingCheckbox';