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

export default defineComponent({
	name: "GnAlert",
	props: {
		variant: { type: String, default: "primary" },
		role: { type: String, default: "status" }
	},
	setup(props, { attrs, slots }) {
		return () => {
			const variant = normalizeVariant(props.variant);

			return h("div", {
				...attrs,
				role: props.role,
				class: cx("alert", `alert-${variant}`, attrs.class)
			}, slots.default?.());
		};
	}
});
