import { memo, createElement } from "react";
import { useField } from "@contember/binding";
import { getDiscriminatedBlock } from "../../blocks/getDiscriminatedBlock.js";
import { RepeaterItem } from "../Repeater/RepeaterItem.js";
const SortableBlock = memo((props) => {
  const field = useField(props.discriminationField);
  const selectedBlock = getDiscriminatedBlock(props.normalizedBlocks, field);
  if (!selectedBlock) {
    return null;
  }
  return /* @__PURE__ */ createElement(RepeaterItem, {
    ...props,
    label: selectedBlock.datum.label
  }, selectedBlock.datum.children);
});
SortableBlock.displayName = "SortableBlock";
export { SortableBlock };
//# sourceMappingURL=SortableBlock.js.map
