@ozen-ui/kit
Version:
React component library
25 lines (24 loc) • 1.55 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 { ListCardItemLeadingItem } from '../ListCardItemLeadingItem';
import { LIST_CARD_ITEM_SIZE_TO_LEADING_CHECKBOX_SIZE } from './constants';
export var cnListCardItemLeadingCheckbox = cn('ListCardItemLeadingCheckbox');
export var ListCardItemLeadingCheckbox = forwardRef(function (inProps, ref) {
var props = useThemeProps({
props: inProps,
name: 'ListCardItemLeadingCheckbox',
});
var className = props.className, dataTestid = props["data-testid"], disabled = props.disabled, other = __rest(props, ["className", 'data-testid', "disabled"]);
var size = useListCardItemContext().size;
var checkboxSize = LIST_CARD_ITEM_SIZE_TO_LEADING_CHECKBOX_SIZE[size];
var checkboxRef = useRef(null);
useListCardItemAsInteractiveModule(checkboxRef, !disabled);
return (React.createElement(ListCardItemLeadingItem, { ref: ref, className: cnListCardItemLeadingCheckbox('', [className]), "data-testid": dataTestid },
React.createElement(Checkbox, __assign({}, other, { ref: checkboxRef, size: checkboxSize, disabled: disabled }))));
});
ListCardItemLeadingCheckbox.displayName = 'ListCardItemLeadingCheckbox';