"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxDevRuntime = require("react/jsx-dev-runtime");
const ui = require("@contember/ui");
const SelectFileInput = require("./selection/SelectFileInput.cjs");
const FileInput = ({
  addButtonComponent: AddButton = ui.Button,
  addButtonComponentExtraProps,
  addButtonProps,
  addButtonSubText,
  addButtonText,
  children,
  description,
  dropzoneState,
  enableAddingNew = true,
  errors,
  formatMessage,
  label,
  labelDescription,
  ...selectProps
}) => {
  const { getRootProps, isDragActive, isDragAccept, isDragReject, getInputProps } = dropzoneState;
  return /* @__PURE__ */ jsxDevRuntime.jsxDEV(
    ui.FieldContainer,
    {
      label,
      useLabelElement: false,
      description,
      labelDescription,
      errors,
      children: /* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: "fileInput", children: [
        children !== void 0 && children,
        enableAddingNew && /* @__PURE__ */ jsxDevRuntime.jsxDEV(
          ui.FileDropZone,
          {
            ...getRootProps(),
            isActive: isDragActive,
            isAccepting: isDragAccept,
            isRejecting: isDragReject,
            className: "fileInput-dropZone",
            children: [
              /* @__PURE__ */ jsxDevRuntime.jsxDEV("input", { ...getInputProps() }, void 0, false, {
                fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/upload/internalComponents/FileInput.tsx",
                lineNumber: 64,
                columnNumber: 7
              }, void 0),
              /* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: "fileInput-cta", children: [
                /* @__PURE__ */ jsxDevRuntime.jsxDEV(ui.Stack, { wrap: true, justify: "center", horizontal: true, children: [
                  selectProps.fileSelection && /* @__PURE__ */ jsxDevRuntime.jsxDEV(SelectFileInput.SelectFileInput, { ...selectProps, formatMessage }, void 0, false, {
                    fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/upload/internalComponents/FileInput.tsx",
                    lineNumber: 68,
                    columnNumber: 10
                  }, void 0),
                  /* @__PURE__ */ jsxDevRuntime.jsxDEV(
                    AddButton,
                    {
                      size: "small",
                      ...addButtonComponentExtraProps,
                      ...addButtonProps,
                      children: formatMessage(addButtonText, "upload.addButton.text")
                    },
                    void 0,
                    false,
                    {
                      fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/upload/internalComponents/FileInput.tsx",
                      lineNumber: 70,
                      columnNumber: 9
                    },
                    void 0
                  )
                ] }, void 0, true, {
                  fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/upload/internalComponents/FileInput.tsx",
                  lineNumber: 66,
                  columnNumber: 8
                }, void 0),
                /* @__PURE__ */ jsxDevRuntime.jsxDEV("span", { className: "fileInput-cta-label", children: formatMessage(addButtonSubText, "upload.addButton.subText") }, void 0, false, {
                  fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/upload/internalComponents/FileInput.tsx",
                  lineNumber: 78,
                  columnNumber: 8
                }, void 0)
              ] }, void 0, true, {
                fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/upload/internalComponents/FileInput.tsx",
                lineNumber: 65,
                columnNumber: 7
              }, void 0)
            ]
          },
          void 0,
          true,
          {
            fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/upload/internalComponents/FileInput.tsx",
            lineNumber: 57,
            columnNumber: 6
          },
          void 0
        )
      ] }, void 0, true, {
        fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/upload/internalComponents/FileInput.tsx",
        lineNumber: 54,
        columnNumber: 4
      }, void 0)
    },
    void 0,
    false,
    {
      fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/upload/internalComponents/FileInput.tsx",
      lineNumber: 47,
      columnNumber: 3
    },
    void 0
  );
};
exports.FileInput = FileInput;
//# sourceMappingURL=FileInput.cjs.map
