import { n as cn } from "./utils-DXzSsU1e.js";
import { n as Label_default } from "./label-C5K3zowH.js";
import { Fragment, createBlock, createCommentVNode, createElementBlock, createTextVNode, defineComponent, normalizeClass, openBlock, renderList, renderSlot, toDisplayString, unref, withCtx } from "vue";
//#region src/components/ui/field-frame/FieldFrame.vue?vue&type=script&setup=true&lang.ts
var _hoisted_1 = {
	key: 1,
	class: "sr-only",
	"data-testid": "field-frame-label-sr"
};
var _hoisted_2 = {
	key: 2,
	class: "text-sm text-muted-foreground",
	"data-testid": "field-frame-help"
};
var _hoisted_3 = {
	key: 3,
	class: "flex flex-col gap-0.5 text-sm text-destructive",
	role: "alert",
	"data-testid": "field-frame-errors"
};
//#endregion
//#region src/components/ui/field-frame/FieldFrame.vue
var FieldFrame_default = /* @__PURE__ */ defineComponent({
	__name: "FieldFrame",
	props: {
		label: {},
		required: { type: Boolean },
		hideLabel: { type: Boolean },
		for: {},
		helpText: {},
		errors: { default: () => [] },
		class: { type: [
			Boolean,
			null,
			String,
			Object,
			Array
		] }
	},
	setup(__props) {
		/**
		* Shared chrome around an input-bearing composition. Provides the
		* label / required asterisk / helpText / error-list visuals so every
		* input composition doesn't repeat the same boilerplate.
		*
		* Usage from a composition:
		*
		*   <FieldFrame
		*     :label="label"
		*     :required="required"
		*     :help-text="helpText"
		*     :errors="errors"
		*     :for="id"
		*   >
		*     <Input v-model="model" ... />
		*   </FieldFrame>
		*
		* FieldFrame is a normal Vue component — consumers can use it directly
		* for ad-hoc inputs, not just via the JSON-driven engine.
		*/
		const props = __props;
		return (_ctx, _cache) => {
			return openBlock(), createElementBlock("div", {
				class: normalizeClass(unref(cn)("flex flex-col gap-1.5", props.class)),
				"data-testid": "field-frame"
			}, [
				__props.label && !__props.hideLabel ? (openBlock(), createBlock(unref(Label_default), {
					key: 0,
					for: props.for,
					required: __props.required,
					"data-testid": "field-frame-label"
				}, {
					default: withCtx(() => [createTextVNode(toDisplayString(__props.label), 1)]),
					_: 1
				}, 8, ["for", "required"])) : __props.label ? (openBlock(), createElementBlock("span", _hoisted_1, toDisplayString(__props.label), 1)) : createCommentVNode("", true),
				renderSlot(_ctx.$slots, "default"),
				__props.helpText ? (openBlock(), createElementBlock("p", _hoisted_2, toDisplayString(__props.helpText), 1)) : createCommentVNode("", true),
				__props.errors.length ? (openBlock(), createElementBlock("ul", _hoisted_3, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.errors, (err, i) => {
					return openBlock(), createElementBlock("li", { key: i }, toDisplayString(err), 1);
				}), 128))])) : createCommentVNode("", true)
			], 2);
		};
	}
});
//#endregion
export { FieldFrame_default as t };

//# sourceMappingURL=field-frame-DhCOWcMP.js.map