import { jsxs, jsx } from "react/jsx-runtime";
import { AccessorErrors, EmptyMessage, CreateNewEntityButton } from "@contember/react-binding-ui";
import { FieldContainer } from "@contember/ui";
import { memo } from "react";
const RepeaterFieldContainer = memo(
  ({
    accessor,
    addButtonText,
    children,
    createNewEntity,
    addButtonComponent: AddButton = CreateNewEntityButton,
    addButtonComponentExtraProps,
    addButtonProps,
    emptyMessage,
    emptyMessageComponent,
    enableAddingNew = true,
    formatMessage,
    isEmpty,
    label,
    ...rest
  }) => {
    return /* @__PURE__ */ jsxs(
      FieldContainer,
      {
        label,
        ...rest,
        useLabelElement: false,
        footer: enableAddingNew && /* @__PURE__ */ jsx(
          AddButton,
          {
            ...addButtonComponentExtraProps,
            ...addButtonProps,
            createNewEntity,
            children: addButtonText ?? label ?? formatMessage("repeater.addButton.text")
          }
        ),
        children: [
          /* @__PURE__ */ jsx(AccessorErrors, { accessor }),
          isEmpty && /* @__PURE__ */ jsx(EmptyMessage, { component: emptyMessageComponent, children: formatMessage(emptyMessage, "repeater.emptyMessage.text") }),
          isEmpty || children
        ]
      }
    );
  }
);
RepeaterFieldContainer.displayName = "RepeaterFieldContainer";
export {
  RepeaterFieldContainer
};
//# sourceMappingURL=RepeaterFieldContainer.js.map
