import { Icon, FieldContainer, Dropdown } from "@contember/ui";
import { memo, useMemo } from "react";
import { AddNewBlockButtonInner } from "./AddNewBlockButtonInner.js";
import { blockRepeaterDictionary } from "./Dictionary.js";
import { jsxDEV, Fragment } from "react/jsx-dev-runtime";
import { useMessageFormatter } from "../../../../i18n/useMessageFormatter.js";
var _jsxFileName = "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/BlockRepeater/AddNewBlockButton.tsx";
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: _jsxFileName,
        lineNumber: 16,
        columnNumber: 6
      }, void 0), props.children ?? formatter("blockRepeater.addNewBlockButton.addBlock")]
    }, void 0, true),
    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: _jsxFileName,
        lineNumber: 39,
        columnNumber: 6
      }, void 0)
    }, void 0, false, {
      fileName: _jsxFileName,
      lineNumber: 37,
      columnNumber: 4
    }, void 0)
  }, void 0, false, {
    fileName: _jsxFileName,
    lineNumber: 36,
    columnNumber: 3
  }, void 0);
});
AddNewBlockButton.displayName = "AddNewBlockButton";
export {
  AddNewBlockButton
};
//# sourceMappingURL=AddNewBlockButton.js.map
