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 { t as ElementRenderer_default } from "./ElementRenderer-DV1pZRd4.js";
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createTextVNode, createVNode, defineComponent, normalizeClass, normalizeStyle, openBlock, renderList, toDisplayString, unref, withCtx } from "vue";
//#region src/components/compositions/cards/ElementListCard.vue?vue&type=script&setup=true&lang.ts
var _hoisted_1 = {
	key: 0,
	class: "mb-3 flex flex-col gap-0.5"
};
var _hoisted_2 = {
	key: 0,
	class: "text-base font-semibold"
};
var _hoisted_3 = {
	key: 1,
	class: "text-sm text-muted-foreground"
};
var ElementListCard_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
	__name: "ElementListCard",
	props: {
		title: {},
		subtitle: {},
		showCard: {
			type: Boolean,
			default: true
		},
		gutterY: { default: "1rem" },
		gutterX: { default: "1rem" },
		classList: {},
		elements: { default: () => [] },
		item: { default: () => ({}) }
	},
	setup(__props) {
		/**
		* Props-driven `element-list` card. Renders a vertical stack of
		* resolved CardElements via `ElementRenderer`.
		*
		* Self-contained — directly mountable in any Vue app:
		*
		*   <ElementListCard
		*     title="Personal details"
		*     :elements="[firstName, lastName]"
		*     :item="{ first_name: 'Jane' }"
		*   />
		*
		* The JSON-driven engine reaches this composition via `CardRenderer`,
		* which is responsible for resolving the card's `elementList: string[]`
		* IDs against the page-level `elements` map and forwarding the
		* resolved CardElement array as the `elements` prop here.
		*/
		const props = __props;
		const showChrome = computed(() => props.showCard !== false);
		const hasHeader = computed(() => Boolean(props.title) || Boolean(props.subtitle));
		const bodyStyle = computed(() => ({
			rowGap: props.gutterY,
			columnGap: props.gutterX
		}));
		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 }, {
					default: withCtx(() => [__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(["flex flex-col", [hasHeader.value ? "" : "pt-6"]]),
					style: normalizeStyle(bodyStyle.value)
				}, {
					default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.elements, (element) => {
						return openBlock(), createBlock(ElementRenderer_default, {
							key: element.id,
							element,
							item: __props.item
						}, null, 8, ["element", "item"]);
					}), 128))]),
					_: 1
				}, 8, ["class", "style"])]),
				_: 1
			})) : (openBlock(), createElementBlock("section", {
				key: 1,
				class: "flex flex-col",
				style: normalizeStyle(bodyStyle.value),
				"data-testid": "element-list-bare"
			}, [hasHeader.value ? (openBlock(), createElementBlock("header", _hoisted_1, [__props.title ? (openBlock(), createElementBlock("h3", _hoisted_2, toDisplayString(__props.title), 1)) : createCommentVNode("", true), __props.subtitle ? (openBlock(), createElementBlock("p", _hoisted_3, toDisplayString(__props.subtitle), 1)) : createCommentVNode("", true)])) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(__props.elements, (element) => {
				return openBlock(), createBlock(ElementRenderer_default, {
					key: element.id,
					element,
					item: __props.item
				}, null, 8, ["element", "item"]);
			}), 128))], 4));
		};
	}
});
//#endregion
//#region src/components/compositions/cards/ElementListCard.vue
var ElementListCard_exports = /* @__PURE__ */ __exportAll({ default: () => ElementListCard_default });
var ElementListCard_default = ElementListCard_vue_vue_type_script_setup_true_lang_default;
//#endregion
export { ElementListCard_exports as n, ElementListCard_default as t };

//# sourceMappingURL=ElementListCard-CDiWUb_B.js.map