import { n as __exportAll } from "./chunk-B-1-B7_t.js";
import { a as CardDescription_default, n as CardTitle_default, o as CardContent_default, r as CardHeader_default, s as Card_default } from "./card-X74FuL7B.js";
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, normalizeClass, normalizeStyle, openBlock, renderList, toDisplayString, unref, withCtx } from "vue";
//#region src/components/compositions/cards/InfoCard.vue?vue&type=script&setup=true&lang.ts
var _hoisted_1 = ["data-testid"];
var _hoisted_2 = { class: "flex flex-col gap-1.5" };
var _hoisted_3 = {
	key: 0,
	class: "flex flex-col gap-2",
	"data-testid": "info-card-fields"
};
var _hoisted_4 = { class: "flex items-center gap-1.5 text-sm text-muted-foreground" };
var _hoisted_5 = ["data-testid"];
var _hoisted_6 = { key: 1 };
var _hoisted_7 = {
	key: 1,
	class: "flex flex-col gap-2",
	"data-testid": "info-card-bare"
};
var _hoisted_8 = {
	key: 0,
	class: "flex flex-row items-start gap-3"
};
var _hoisted_9 = ["data-testid"];
var _hoisted_10 = { class: "flex flex-col gap-0.5" };
var _hoisted_11 = {
	key: 0,
	class: "text-base font-semibold"
};
var _hoisted_12 = {
	key: 1,
	class: "text-sm text-muted-foreground"
};
var _hoisted_13 = {
	key: 1,
	class: "flex flex-col gap-2",
	"data-testid": "info-card-fields"
};
var _hoisted_14 = { class: "flex items-center gap-1.5 text-sm text-muted-foreground" };
var _hoisted_15 = ["data-testid"];
var _hoisted_16 = { key: 1 };
var InfoCard_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
	__name: "InfoCard",
	props: {
		title: {},
		subtitle: {},
		showCard: {
			type: Boolean,
			default: true
		},
		icon: {},
		iconColor: {},
		headerImage: {},
		defaultHeaderImage: {},
		headerRatio: {},
		fields: { default: () => [] },
		bodyClassList: {},
		lessPadding: {
			type: Boolean,
			default: false
		},
		item: { default: () => ({}) }
	},
	setup(__props) {
		/**
		* Props-driven `info-card` composition. Renders a read-only summary
		* tile: optional icon header, title, subtitle, and a list of
		* `{ label, value, icon? }` rows resolved from the data model.
		*
		* Self-contained — directly mountable in any Vue app:
		*
		*   <InfoCard
		*     title="Account summary"
		*     icon="user"
		*     :fields="[{ label: 'Name', value: 'user.name' }]"
		*     :item="{ user: { name: 'Jane' } }"
		*   />
		*
		* `field.value` is treated as a dot-path into `item`. When the path
		* resolves to `undefined` / `null` the row still renders so the label
		* remains visible — this matches v2 behaviour for info tiles.
		*/
		const props = __props;
		const showChrome = computed(() => props.showCard !== false);
		const hasHeader = computed(() => Boolean(props.title) || Boolean(props.subtitle) || Boolean(props.icon));
		const fieldList = computed(() => props.fields ?? []);
		const bodyClass = computed(() => {
			const list = props.bodyClassList;
			if (!list) return "";
			return Array.isArray(list) ? list.join(" ") : list;
		});
		function resolvePath(item, path) {
			if (!path) return;
			const segments = path.split(".");
			let cursor = item;
			for (const seg of segments) {
				if (cursor === null || cursor === void 0) return;
				if (typeof cursor !== "object") return;
				cursor = cursor[seg];
			}
			return cursor;
		}
		function fieldClass(field) {
			const list = field.classList;
			if (!list) return "";
			return Array.isArray(list) ? list.join(" ") : list;
		}
		function formatValue(field, raw) {
			if (raw === void 0 || raw === null || raw === "") return "";
			const text = typeof raw === "string" ? raw : String(raw);
			return `${field.prepend ?? ""}${text}${field.append ?? ""}`;
		}
		function valueFor(field) {
			return formatValue(field, resolvePath(props.item, field.value));
		}
		return (_ctx, _cache) => {
			return showChrome.value ? (openBlock(), createBlock(unref(Card_default), {
				key: 0,
				class: "flex flex-col"
			}, {
				default: withCtx(() => [hasHeader.value ? (openBlock(), createBlock(unref(CardHeader_default), {
					key: 0,
					class: "flex flex-row items-start gap-3"
				}, {
					default: withCtx(() => [__props.icon ? (openBlock(), createElementBlock("span", {
						key: 0,
						class: "text-2xl leading-none",
						style: normalizeStyle({ color: __props.iconColor ?? void 0 }),
						"data-testid": `info-card-icon-${__props.icon}`,
						"aria-hidden": "true"
					}, toDisplayString(__props.icon), 13, _hoisted_1)) : createCommentVNode("", true), createElementVNode("div", _hoisted_2, [__props.title ? (openBlock(), createBlock(unref(CardTitle_default), { key: 0 }, {
						default: withCtx(() => [createTextVNode(toDisplayString(__props.title), 1)]),
						_: 1
					})) : createCommentVNode("", true), __props.subtitle ? (openBlock(), createBlock(unref(CardDescription_default), { key: 1 }, {
						default: withCtx(() => [createTextVNode(toDisplayString(__props.subtitle), 1)]),
						_: 1
					})) : createCommentVNode("", true)])]),
					_: 1
				})) : createCommentVNode("", true), createVNode(unref(CardContent_default), { class: normalizeClass([
					bodyClass.value,
					__props.lessPadding ? "p-3" : "",
					hasHeader.value ? "" : "pt-6"
				]) }, {
					default: withCtx(() => [fieldList.value.length ? (openBlock(), createElementBlock("dl", _hoisted_3, [(openBlock(true), createElementBlock(Fragment, null, renderList(fieldList.value, (field, index) => {
						return openBlock(), createElementBlock("div", {
							key: `${field.value}-${index}`,
							class: "flex items-baseline justify-between gap-3",
							"data-testid": "info-card-field"
						}, [createElementVNode("dt", _hoisted_4, [field.icon ? (openBlock(), createElementBlock("span", {
							key: 0,
							class: "text-base leading-none",
							"data-testid": `info-card-field-icon-${field.icon}`,
							"aria-hidden": "true"
						}, toDisplayString(field.icon), 9, _hoisted_5)) : createCommentVNode("", true), field.label ? (openBlock(), createElementBlock("span", _hoisted_6, toDisplayString(field.label), 1)) : createCommentVNode("", true)]), createElementVNode("dd", {
							class: normalizeClass(["text-sm font-medium text-foreground", fieldClass(field)]),
							"data-testid": "info-card-field-value"
						}, toDisplayString(valueFor(field)), 3)]);
					}), 128))])) : createCommentVNode("", true)]),
					_: 1
				}, 8, ["class"])]),
				_: 1
			})) : (openBlock(), createElementBlock("section", _hoisted_7, [hasHeader.value ? (openBlock(), createElementBlock("header", _hoisted_8, [__props.icon ? (openBlock(), createElementBlock("span", {
				key: 0,
				class: "text-2xl leading-none",
				style: normalizeStyle({ color: __props.iconColor ?? void 0 }),
				"data-testid": `info-card-icon-${__props.icon}`,
				"aria-hidden": "true"
			}, toDisplayString(__props.icon), 13, _hoisted_9)) : createCommentVNode("", true), createElementVNode("div", _hoisted_10, [__props.title ? (openBlock(), createElementBlock("h3", _hoisted_11, toDisplayString(__props.title), 1)) : createCommentVNode("", true), __props.subtitle ? (openBlock(), createElementBlock("p", _hoisted_12, toDisplayString(__props.subtitle), 1)) : createCommentVNode("", true)])])) : createCommentVNode("", true), fieldList.value.length ? (openBlock(), createElementBlock("dl", _hoisted_13, [(openBlock(true), createElementBlock(Fragment, null, renderList(fieldList.value, (field, index) => {
				return openBlock(), createElementBlock("div", {
					key: `${field.value}-${index}`,
					class: "flex items-baseline justify-between gap-3",
					"data-testid": "info-card-field"
				}, [createElementVNode("dt", _hoisted_14, [field.icon ? (openBlock(), createElementBlock("span", {
					key: 0,
					class: "text-base leading-none",
					"data-testid": `info-card-field-icon-${field.icon}`,
					"aria-hidden": "true"
				}, toDisplayString(field.icon), 9, _hoisted_15)) : createCommentVNode("", true), field.label ? (openBlock(), createElementBlock("span", _hoisted_16, toDisplayString(field.label), 1)) : createCommentVNode("", true)]), createElementVNode("dd", {
					class: normalizeClass(["text-sm font-medium text-foreground", fieldClass(field)]),
					"data-testid": "info-card-field-value"
				}, toDisplayString(valueFor(field)), 3)]);
			}), 128))])) : createCommentVNode("", true)]));
		};
	}
});
//#endregion
//#region src/components/compositions/cards/InfoCard.vue
var InfoCard_exports = /* @__PURE__ */ __exportAll({ default: () => InfoCard_default });
var InfoCard_default = InfoCard_vue_vue_type_script_setup_true_lang_default;
//#endregion
export { InfoCard_exports as n, InfoCard_default as t };

//# sourceMappingURL=InfoCard-A-wKCoRP.js.map