@ozen-ui/kit
Version:
React component library
24 lines (23 loc) • 1.68 kB
JavaScript
import { __assign, __rest } from "tslib";
import React, { useRef } from 'react';
import { useMultiRef } from '../../../../hooks/useMultiRef';
import { useThemeProps } from '../../../../hooks/useThemeProps';
import { cn } from '../../../../utils/classname';
import { polymorphicComponentWithRef } from '../../../../utils/polymorphicComponentWithRef';
import { Button } from '../../../ButtonNext';
import { useListCardItemAsInteractiveModule } from '../../hooks';
import { useListCardItemContext } from '../../ListCardItemContext';
import { LIST_CARD_ITEM_CENTER_BUTTON_DEFAULT_VARIANT, LIST_CARD_ITEM_SIZE_TO_CENTER_BUTTON_SIZE, } from './constants';
export var cnListCardItemCenterButton = cn('ListCardItemCenterButton');
export var ListCardItemCenterButton = polymorphicComponentWithRef(function (inProps, ref) {
var props = useThemeProps({
props: inProps,
name: 'ListCardItemCenterButton',
});
var children = props.children, className = props.className, as = props.as, _a = props.variant, variant = _a === void 0 ? LIST_CARD_ITEM_CENTER_BUTTON_DEFAULT_VARIANT : _a, disabled = props.disabled, other = __rest(props, ["children", "className", "as", "variant", "disabled"]);
var size = useListCardItemContext().size;
var innerRef = useRef(null);
useListCardItemAsInteractiveModule(innerRef, !disabled);
return (React.createElement(Button, __assign({}, other, { as: as, ref: useMultiRef([ref, innerRef]), className: cnListCardItemCenterButton('', [className]), size: LIST_CARD_ITEM_SIZE_TO_CENTER_BUTTON_SIZE[size], variant: variant, disabled: disabled }), children));
});
ListCardItemCenterButton.displayName = 'ListCardItemCenterButton';