import { defineComponent, h } from "vue";
import { cx } from "../utils.js";

export default defineComponent({
	name: "GnDefinitionList",
	props: {
		items: { type: Array, default: () => [] }
	},
	setup(props, { attrs, slots }) {
		return () => h("dl", { ...attrs, class: cx("list list-definition", attrs.class) }, props.items.map(item => h("div", {
			class: "list-row"
		}, [
			h("dt", { class: "list-term" }, item.term || item.label),
			h("dd", { class: "list-desc" }, slots[item.key]?.({ item }) || item.description || item.value)
		])));
	}
});
