import { createElement } from "react";
import { Button, FieldContainer, FileDropZone, Stack } from "@contember/ui";
import { SelectFileInput } from "./selection/SelectFileInput.js";
const FileInput = ({
  addButtonComponent: AddButton = Button,
  addButtonComponentExtraProps,
  addButtonProps,
  addButtonSubText,
  addButtonText,
  children,
  description,
  dropzoneState,
  enableAddingNew = true,
  errors,
  formatMessage,
  label,
  labelDescription,
  ...selectProps
}) => {
  const { getRootProps, isDragActive, isDragAccept, isDragReject, getInputProps } = dropzoneState;
  return /* @__PURE__ */ createElement(FieldContainer, {
    label,
    useLabelElement: false,
    description,
    labelDescription,
    errors
  }, /* @__PURE__ */ createElement("div", {
    className: "fileInput"
  }, children !== void 0 && children, enableAddingNew && /* @__PURE__ */ createElement(FileDropZone, {
    ...getRootProps(),
    isActive: isDragActive,
    isAccepting: isDragAccept,
    isRejecting: isDragReject,
    className: "fileInput-dropZone"
  }, /* @__PURE__ */ createElement("input", {
    ...getInputProps()
  }), /* @__PURE__ */ createElement("div", {
    className: "fileInput-cta"
  }, /* @__PURE__ */ createElement(Stack, {
    wrap: true,
    justify: "center",
    direction: "horizontal"
  }, selectProps.fileSelection && /* @__PURE__ */ createElement(SelectFileInput, {
    ...selectProps,
    formatMessage
  }), /* @__PURE__ */ createElement(AddButton, {
    size: "small",
    ...addButtonComponentExtraProps,
    ...addButtonProps
  }, formatMessage(addButtonText, "upload.addButton.text"))), /* @__PURE__ */ createElement("span", {
    className: "fileInput-cta-label"
  }, formatMessage(addButtonSubText, "upload.addButton.subText"))))));
};
export { FileInput };
//# sourceMappingURL=FileInput.js.map
