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

export default defineComponent({
	name: "GnSteps",
	props: {
		items: { type: Array, required: true },
		vertical: { type: Boolean, default: false }
	},
	setup(props, { attrs }) {
		return () => h("ol", {
			...attrs,
			class: cx("steps", { "steps-vertical": props.vertical }, attrs.class)
		}, props.items.map((item, index) => h("li", {
			class: cx("step", {
				"step-complete": item.status === "complete",
				"step-current": item.status === "current",
				"step-disabled": item.disabled || item.status === "disabled"
			})
		}, [
			h("span", { class: "step-marker" }, item.marker || String(index + 1)),
			h("h3", { class: "step-title" }, item.title),
			item.text && h("p", { class: "step-text" }, item.text)
		])));
	}
});
