import { useMutationState } from "@contember/binding";
import { useClassNamePrefix, Button, Icon } from "@contember/ui";
import { memo } from "react";
import { jsxDEV } from "react/jsx-dev-runtime";
var _jsxFileName = "/__w/interface/interface/packages/admin/src/components/bindingFacade/collections/helpers/CreateNewEntityButton.tsx";
const defaultIconProps = {
  blueprintIcon: "add",
  style: {
    marginRight: "0.2em",
    position: "relative",
    top: "0.05em"
  }
};
const CreateNewEntityButton = memo(({
  createNewEntity,
  iconProps,
  children = "Add",
  ...buttonProps
}) => {
  const isMutating = useMutationState();
  const prefix = useClassNamePrefix();
  return /* @__PURE__ */ jsxDEV(
    Button,
    {
      onClick: () => createNewEntity(),
      disabled: isMutating,
      loading: isMutating,
      className: `${prefix}new-entity-button`,
      distinction: "seamless",
      justification: "justifyStart",
      ...buttonProps,
      children: [/* @__PURE__ */ jsxDEV(Icon, {
        ...defaultIconProps,
        ...iconProps
      }, void 0, false, {
        fileName: _jsxFileName,
        lineNumber: 49,
        columnNumber: 5
      }, void 0), children]
    },
    void 0,
    true,
    {
      fileName: _jsxFileName,
      lineNumber: 39,
      columnNumber: 4
    },
    void 0
  );
});
export {
  CreateNewEntityButton
};
//# sourceMappingURL=CreateNewEntityButton.js.map
