import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Button, Label } from '@patternfly/react-core';
import FileDetails from '../FileDetails';
import { Spinner } from '@patternfly/react-core';
import { TimesIcon } from '@patternfly/react-icons';
export const FileDetailsLabel = ({ fileName, fileId, isLoading, onClick, onClose, closeButtonAriaLabel, languageTestId, spinnerTestId }) => {
    const handleClose = (event) => {
        onClose && onClose(event, fileName, fileId);
    };
    return (_jsx(Label, Object.assign({ className: "pf-chatbot__file-label" }, (onClose && { onClose: (event) => onClose(event, fileName, fileId) }), { closeBtn: _jsx(Button, { type: "button", variant: "plain", "aria-label": closeButtonAriaLabel !== null && closeButtonAriaLabel !== void 0 ? closeButtonAriaLabel : `Close ${fileName}`, icon: _jsx(TimesIcon, {}), onClick: handleClose }) }, (onClick && { onClick: (event) => onClick(event, fileName, fileId) }), { children: _jsxs("div", { className: "pf-chatbot__file-label-contents", children: [_jsx(FileDetails, { className: isLoading ? 'pf-chatbot__file-label-loading' : undefined, fileName: fileName, languageTestId: languageTestId }), isLoading && _jsx(Spinner, { "data-testid": spinnerTestId, size: "sm" })] }) })));
};
export default FileDetailsLabel;
