import { FieldContainer, Stack } from "@contember/ui";
import { memo } from "react";
import { jsxDEV } from "react/jsx-dev-runtime";
import { AccessorErrors } from "../../errors/AccessorErrors.js";
import { EmptyMessage } from "../helpers/EmptyMessage.js";
import { CreateNewEntityButton } from "../helpers/CreateNewEntityButton.js";
var _jsxFileName = "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/Repeater/RepeaterFieldContainer.tsx";
const RepeaterFieldContainer = memo(({
  accessor,
  addButtonText,
  children,
  createNewEntity,
  addButtonComponent: AddButton = CreateNewEntityButton,
  addButtonComponentExtraProps,
  addButtonProps,
  emptyMessage,
  emptyMessageComponent,
  enableAddingNew = true,
  formatMessage,
  isEmpty,
  label
}) => {
  return /* @__PURE__ */ jsxDEV(FieldContainer, {
    label,
    useLabelElement: false,
    children: /* @__PURE__ */ jsxDEV(Stack, {
      direction: "vertical",
      gap: "small",
      children: [/* @__PURE__ */ jsxDEV(AccessorErrors, {
        accessor
      }, void 0, false, {
        fileName: _jsxFileName,
        lineNumber: 57,
        columnNumber: 5
      }, void 0), isEmpty && /* @__PURE__ */ jsxDEV(EmptyMessage, {
        component: emptyMessageComponent,
        children: formatMessage(emptyMessage, "repeater.emptyMessage.text")
      }, void 0, false, {
        fileName: _jsxFileName,
        lineNumber: 59,
        columnNumber: 6
      }, void 0), isEmpty || children, enableAddingNew && /* @__PURE__ */ jsxDEV(AddButton, {
        ...addButtonComponentExtraProps,
        ...addButtonProps,
        createNewEntity,
        children: addButtonText ?? label ?? formatMessage("repeater.addButton.text")
      }, void 0, false, {
        fileName: _jsxFileName,
        lineNumber: 63,
        columnNumber: 6
      }, void 0)]
    }, void 0, true, {
      fileName: _jsxFileName,
      lineNumber: 53,
      columnNumber: 4
    }, void 0)
  }, void 0, false, {
    fileName: _jsxFileName,
    lineNumber: 52,
    columnNumber: 10
  }, void 0);
});
RepeaterFieldContainer.displayName = "RepeaterFieldContainer";
export {
  RepeaterFieldContainer
};
//# sourceMappingURL=RepeaterFieldContainer.js.map
