import { Component, Field } from "@contember/binding";
import { formatString } from "./utils.js";
import { jsx } from "react/jsx-runtime";
import { Link } from "../../routing/binding/Link.js";
const AutoLabel = Component(({
  field,
  createLink
}, env) => {
  const entity = env.getSubTreeNode().entity;
  const humanFieldSchema = entity.fields.get(field);
  const optionLabel = /* @__PURE__ */ jsx(Field, {
    field,
    format: (it) => formatString(humanFieldSchema.type, it)
  });
  return createLink ? /* @__PURE__ */ jsx(Link, {
    to: createLink(entity.name),
    children: optionLabel
  }) : optionLabel;
});
export {
  AutoLabel
};
//# sourceMappingURL=AutoLabel.js.map
