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