import { jsx, jsxs } from "react/jsx-runtime";
import { FieldContainer, FileDropZone, Stack, Button } 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__ */ jsx(
    FieldContainer,
    {
      label,
      useLabelElement: false,
      description,
      labelDescription,
      errors,
      children: /* @__PURE__ */ jsxs("div", { className: "fileInput", children: [
        children !== void 0 && children,
        enableAddingNew && /* @__PURE__ */ jsxs(
          FileDropZone,
          {
            ...getRootProps(),
            isActive: isDragActive,
            isAccepting: isDragAccept,
            isRejecting: isDragReject,
            className: "fileInput-dropZone",
            children: [
              /* @__PURE__ */ jsx("input", { ...getInputProps() }),
              /* @__PURE__ */ jsxs("div", { className: "fileInput-cta", children: [
                /* @__PURE__ */ jsxs(Stack, { wrap: true, justify: "center", horizontal: true, children: [
                  selectProps.fileSelection && /* @__PURE__ */ jsx(SelectFileInput, { ...selectProps, formatMessage }),
                  /* @__PURE__ */ jsx(
                    AddButton,
                    {
                      size: "small",
                      ...addButtonComponentExtraProps,
                      ...addButtonProps,
                      children: formatMessage(addButtonText, "upload.addButton.text")
                    }
                  )
                ] }),
                /* @__PURE__ */ jsx("span", { className: "fileInput-cta-label", children: formatMessage(addButtonSubText, "upload.addButton.subText") })
              ] })
            ]
          }
        )
      ] })
    }
  );
};
export {
  FileInput
};
//# sourceMappingURL=FileInput.js.map
