"use strict";
var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FileDetailsLabel = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_core_1 = require("@patternfly/react-core");
const FileDetails_1 = __importDefault(require("../FileDetails"));
const react_core_2 = require("@patternfly/react-core");
const react_icons_1 = require("@patternfly/react-icons");
const FileDetailsLabel = (_a) => {
    var { fileName, fileId, isLoading, onClick, onClose, closeButtonAriaLabel, languageTestId, spinnerTestId, fileSize, hasTruncation = true, closeButtonIcon = (0, jsx_runtime_1.jsx)(react_icons_1.TimesIcon, {}) } = _a, props = __rest(_a, ["fileName", "fileId", "isLoading", "onClick", "onClose", "closeButtonAriaLabel", "languageTestId", "spinnerTestId", "fileSize", "hasTruncation", "closeButtonIcon"]);
    const handleClose = (event) => {
        onClose && onClose(event, fileName, fileId);
    };
    return ((0, jsx_runtime_1.jsx)(react_core_1.Label, Object.assign({ className: "pf-chatbot__file-label" }, (onClose && { onClose: (event) => onClose(event, fileName, fileId) }), { closeBtn: (0, jsx_runtime_1.jsx)(react_core_1.Button, { type: "button", variant: "plain", "aria-label": closeButtonAriaLabel !== null && closeButtonAriaLabel !== void 0 ? closeButtonAriaLabel : `Close ${fileName}`, icon: closeButtonIcon, onClick: handleClose }) }, (onClick && { onClick: (event) => onClick(event, fileName, fileId) }), props, { children: (0, jsx_runtime_1.jsxs)("div", { className: "pf-chatbot__file-label-contents", children: [(0, jsx_runtime_1.jsx)(FileDetails_1.default, { className: isLoading ? 'pf-chatbot__file-label-loading' : undefined, fileName: fileName, languageTestId: languageTestId, fileSize: fileSize, hasTruncation: hasTruncation }), isLoading && (0, jsx_runtime_1.jsx)(react_core_2.Spinner, { "data-testid": spinnerTestId, size: "sm" })] }) })));
};
exports.FileDetailsLabel = FileDetailsLabel;
exports.default = exports.FileDetailsLabel;
