import React from 'react';
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 (React.createElement(Label, Object.assign({ className: "pf-chatbot__file-label" }, (onClose && { onClose: (event) => onClose(event, fileName, fileId) }), { closeBtn: React.createElement(Button, { type: "button", variant: "plain", "aria-label": closeButtonAriaLabel !== null && closeButtonAriaLabel !== void 0 ? closeButtonAriaLabel : `Close ${fileName}`, icon: React.createElement(TimesIcon, null), onClick: handleClose }) }, (onClick && { onClick: (event) => onClick(event, fileName, fileId) })),
        React.createElement("div", { className: "pf-chatbot__file-label-contents" },
            React.createElement(FileDetails, { className: isLoading ? 'pf-chatbot__file-label-loading' : undefined, fileName: fileName, languageTestId: languageTestId }),
            isLoading && React.createElement(Spinner, { "data-testid": spinnerTestId, size: "sm" }))));
};
export default FileDetailsLabel;
