import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import React from "react";
import styled from "styled-components";
import { StyledButton } from "../../CommonUI/Components/Button";
import { UploadIcon } from "../../CommonUI/Icon/UploadIcon";
import { PropertyEditorBoolean } from "../../CommonUI/PropertyEditing/PropertyEditorBoolean";
import { StyledFormHelperText, StyledInputLabel } from "./XCommonStyled";
import { PropertyEditorInteger } from "../../CommonUI/PropertyEditing/PropertyEditorInteger";
import { BaseFileControl } from "./BaseFileControl";
class XFileUploadEditUI extends React.Component {
    render() {
        return (_jsxs(_Fragment, { children: [this.props.editMe.renderBaseDataControlEditor(), _jsx(PropertyEditorBoolean, { editObject: this.props.editMe, propertyName: "showFileName", updateCallback: this.props.editMe.controlUpdate, label: "Show File Name" }, void 0),
                _jsx(PropertyEditorBoolean, { editObject: this.props.editMe, propertyName: "showFileSize", updateCallback: this.props.editMe.controlUpdate, label: "Show File Size" }, void 0),
                _jsx(PropertyEditorBoolean, { editObject: this.props.editMe, propertyName: "showPreview", updateCallback: this.props.editMe.controlUpdate, label: "Show Preview" }, void 0),
                _jsx(PropertyEditorInteger, { editObject: this.props.editMe, propertyName: "filesLimit", updateCallback: this.props.editMe.controlUpdate, label: "Files Limit" }, void 0)] }, void 0));
    }
}
export class XFileUpload extends BaseFileControl {
    render() {
        const issueData = this.getFormContext()
            .getControlContext(this)
            .getRuntimeIssueData();
        const issueText = (issueData === null || issueData === void 0 ? void 0 : issueData.text) || "";
        return (_jsxs(UploadControlRender, Object.assign({ className: "UploadControl-root" }, { children: [this.label && (_jsx(StyledInputLabel, { children: this.label }, void 0)),
                _jsx(StyledButton, Object.assign({ variant: "contained", color: "primary", startIcon: _jsx(UploadIcon, {}, void 0), style: { marginBottom: "30px" }, onClick: this.openLayer, "data-testid": "btn-xFileUpload-upload", ref: this.ref }, { children: "Upload" }), void 0), this.renderLayerContent(), issueText && (_jsx(StyledFormHelperText, Object.assign({ error: Boolean(issueText) }, { children: issueText ? issueText : "" }), void 0))] }), void 0));
    }
    renderEditUI() {
        return _jsx(XFileUploadEditUI, { editMe: this }, void 0);
    }
}
const UploadControlRender = styled.div `
    position: relative;
`;
//# sourceMappingURL=XFileUpload.js.map