@ozen-ui/kit
Version:
React component library
24 lines (23 loc) • 1.61 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 { ListCardItemControlItem } from '../ListCardItemControlItem';
import { LIST_CARD_ITEM_SIZE_TO_CONTROL_CHECKBOX_SIZE } from './constants';
export var cnListCardItemControlCheckbox = cn('ListCardItemControlCheckbox');
export var ListCardItemControlCheckbox = forwardRef(function (inProps, ref) {
var props = useThemeProps({
props: inProps,
name: 'ListCardItemControlCheckbox',
});
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(ListCardItemControlItem, { ref: ref, className: cnListCardItemControlCheckbox('', [className]), caption: caption, "data-testid": dataTestId },
React.createElement(Checkbox, __assign({}, other, { ref: checkboxRef, size: LIST_CARD_ITEM_SIZE_TO_CONTROL_CHECKBOX_SIZE[size], disabled: disabled }), children)));
});
ListCardItemControlCheckbox.displayName = 'ListCardItemControlCheckbox';