import { n as __exportAll } from "./chunk-B-1-B7_t.js";
import { i as Alert_default, n as AlertTitle_default, r as AlertDescription_default } from "./alert-O-GNDZbg.js";
import { computed, createBlock, createCommentVNode, createTextVNode, defineComponent, normalizeClass, openBlock, ref, resolveDynamicComponent, toDisplayString, unref, watch, withCtx } from "vue";
import { Info } from "@lucide/vue";
//#region src/components/compositions/elements/display/BannerDisplay.vue?vue&type=script&setup=true&lang.ts
var BannerDisplay_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
	__name: "BannerDisplay",
	props: {
		value: {},
		title: {},
		variant: { default: "default" },
		icon: {},
		classList: {}
	},
	setup(__props) {
		/**
		* Props-driven banner display.
		*
		* Wraps the Alert primitive: `title` is the alert title and `value`
		* is the description. `variant` selects the colour scheme and `icon`
		* is a lucide icon name (PascalCase or kebab-case). The library is
		* lazy-imported so we only pay for it when an icon is requested.
		*/
		const props = __props;
		const content = computed(() => {
			if (props.value === void 0 || props.value === null) return "";
			return String(props.value);
		});
		const rootClass = computed(() => {
			const cl = props.classList;
			if (!cl) return "";
			return Array.isArray(cl) ? cl.join(" ") : cl;
		});
		function toPascalCase(input) {
			return input.replace(/[-_\s]+(.)?/g, (_, ch) => ch ? ch.toUpperCase() : "").replace(/^(.)/, (m) => m.toUpperCase());
		}
		const ResolvedIcon = ref(null);
		async function loadIcon(name) {
			if (!name) {
				ResolvedIcon.value = null;
				return;
			}
			ResolvedIcon.value = (await import("@lucide/vue"))[toPascalCase(name)] ?? null;
		}
		watch(() => props.icon, (next) => {
			loadIcon(next);
		}, { immediate: true });
		return (_ctx, _cache) => {
			return openBlock(), createBlock(unref(Alert_default), {
				variant: __props.variant,
				class: normalizeClass(rootClass.value),
				"data-testid": "banner-display"
			}, {
				default: withCtx(() => [
					__props.icon && ResolvedIcon.value ? (openBlock(), createBlock(resolveDynamicComponent(ResolvedIcon.value), { key: 0 })) : !__props.icon ? (openBlock(), createBlock(unref(Info), { key: 1 })) : createCommentVNode("", true),
					__props.title ? (openBlock(), createBlock(unref(AlertTitle_default), { key: 2 }, {
						default: withCtx(() => [createTextVNode(toDisplayString(__props.title), 1)]),
						_: 1
					})) : createCommentVNode("", true),
					content.value ? (openBlock(), createBlock(unref(AlertDescription_default), { key: 3 }, {
						default: withCtx(() => [createTextVNode(toDisplayString(content.value), 1)]),
						_: 1
					})) : createCommentVNode("", true)
				]),
				_: 1
			}, 8, ["variant", "class"]);
		};
	}
});
//#endregion
//#region src/components/compositions/elements/display/BannerDisplay.vue
var BannerDisplay_exports = /* @__PURE__ */ __exportAll({ default: () => BannerDisplay_default });
var BannerDisplay_default = BannerDisplay_vue_vue_type_script_setup_true_lang_default;
//#endregion
export { BannerDisplay_exports as n, BannerDisplay_default as t };

//# sourceMappingURL=BannerDisplay-DOlnE6P2.js.map