import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Chevron } from '../../Chevron';
import { ContentState } from '../../ContentState';
import { Tooltip } from '../../Tooltip';
import { getInertProps } from '../../utils/getInertProps';
import { ActionsWrapper, Wrapper } from './styles';
import { useLogic } from './useLogic';
export const InfiniteTreeListItem = (props) => {
    const { itemSkeleton, item, handleClick, isDisabledByActions, tooltipProps, isChevronActive, } = useLogic(props);
    const { isDisabled, className, onRetry = () => undefined, actions, errorMsg, isError, isLoading, children, } = props;
    return (_jsx(ContentState, { isLoading: isLoading, loadingContent: _jsx(Wrapper, { "$isLoading": true, children: itemSkeleton }), isError: isError, errorState: {
            onRetry,
            errorList: [errorMsg || ''],
        }, children: _jsx(Tooltip, { ...tooltipProps, children: _jsxs(Wrapper, { onClick: handleClick, className: className, "$isDisabled": isDisabled || isDisabledByActions, "$isLoading": isLoading, "$hasNested": item.meta.hasNested, ...getInertProps(isDisabled || isDisabledByActions), children: [item.meta.hasNested && _jsx(Chevron, { isActive: isChevronActive }), children, actions && _jsx(ActionsWrapper, { children: actions })] }, `infinite-tree-list-item-${item.id}`) }) }));
};
