import { jsxDEV, Fragment } from "react/jsx-dev-runtime";
import { Icon, FieldContainer, Dropdown } from "@contember/ui";
import { memo, useMemo } from "react";
import { AddNewBlockButtonInner } from "./AddNewBlockButtonInner.js";
import { blockRepeaterDictionary } from "./Dictionary.js";
import { useMessageFormatter } from "../../../../i18n/useMessageFormatter.js";
const AddNewBlockButton = memo((props) => {
  const formatter = useMessageFormatter(blockRepeaterDictionary);
  const buttonProps = useMemo(
    () => ({
      children: /* @__PURE__ */ jsxDEV(Fragment, { children: [
        /* @__PURE__ */ jsxDEV(
          Icon,
          {
            blueprintIcon: "add",
            style: {
              marginRight: "0.2em",
              position: "relative",
              top: "-0.071em"
            }
          },
          void 0,
          false,
          {
            fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/BlockRepeater/AddNewBlockButton.tsx",
            lineNumber: 19,
            columnNumber: 6
          },
          globalThis
        ),
        props.children ?? formatter("blockRepeater.addNewBlockButton.addBlock")
      ] }, void 0, true, {
        fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/BlockRepeater/AddNewBlockButton.tsx",
        lineNumber: 18,
        columnNumber: 5
      }, globalThis),
      disabled: props.isMutating,
      distinction: "seamless",
      flow: "block",
      justification: "justifyStart"
    }),
    [formatter, props.isMutating, props.children]
  );
  return /* @__PURE__ */ jsxDEV(FieldContainer, { label: void 0, children: /* @__PURE__ */ jsxDEV(Dropdown, { buttonProps, alignment: "center", children: ({ requestClose, forceUpdate, update }) => /* @__PURE__ */ jsxDEV(
    AddNewBlockButtonInner,
    {
      normalizedBlocks: props.normalizedBlocks,
      createNewEntity: props.createNewEntity,
      isMutating: props.isMutating,
      discriminationField: props.discriminationField,
      requestClose,
      forceUpdate,
      update
    },
    void 0,
    false,
    {
      fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/BlockRepeater/AddNewBlockButton.tsx",
      lineNumber: 42,
      columnNumber: 6
    },
    globalThis
  ) }, void 0, false, {
    fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/BlockRepeater/AddNewBlockButton.tsx",
    lineNumber: 40,
    columnNumber: 4
  }, globalThis) }, void 0, false, {
    fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/BlockRepeater/AddNewBlockButton.tsx",
    lineNumber: 39,
    columnNumber: 3
  }, globalThis);
});
AddNewBlockButton.displayName = "AddNewBlockButton";
export {
  AddNewBlockButton
};
//# sourceMappingURL=AddNewBlockButton.js.map
