import { n as __exportAll } from "./chunk-B-1-B7_t.js";
import { t as Textarea_default } from "./textarea-Bi7Nstc4.js";
import { t as FieldFrame_default } from "./field-frame-DhCOWcMP.js";
import { createBlock, createVNode, defineComponent, mergeModels, normalizeClass, onMounted, openBlock, unref, useModel, useTemplateRef, withCtx } from "vue";
//#region src/components/compositions/elements/input/TextareaInput.vue?vue&type=script&setup=true&lang.ts
var TextareaInput_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
	__name: "TextareaInput",
	props: /* @__PURE__ */ mergeModels({
		modelValue: {},
		id: {},
		name: {},
		label: {},
		hideLabel: { type: Boolean },
		placeholder: {},
		required: { type: Boolean },
		readonly: { type: Boolean },
		disabled: { type: Boolean },
		maxlength: {},
		minlength: {},
		rows: { default: 3 },
		helpText: {},
		errors: { default: () => [] },
		autoFocus: { type: Boolean }
	}, {
		"modelValue": {},
		"modelModifiers": {}
	}),
	emits: ["update:modelValue"],
	setup(__props) {
		/**
		* Props-driven textarea input composition. Composes the shadcn
		* `Textarea` primitive and `FieldFrame` chrome.
		*
		* Self-contained — usable directly in any Vue app:
		*
		*   <TextareaInput v-model="bio" label="Bio" :rows="5" />
		*/
		const props = __props;
		const model = useModel(__props, "modelValue");
		const textareaRef = useTemplateRef("textareaRef");
		onMounted(() => {
			if (props.autoFocus) textareaRef.value?.focus();
		});
		return (_ctx, _cache) => {
			return openBlock(), createBlock(unref(FieldFrame_default), {
				label: __props.label,
				required: __props.required,
				"hide-label": __props.hideLabel,
				for: __props.id,
				"help-text": __props.helpText,
				errors: __props.errors
			}, {
				default: withCtx(() => [createVNode(unref(Textarea_default), {
					ref_key: "textareaRef",
					ref: textareaRef,
					"model-value": model.value ?? void 0,
					id: __props.id,
					name: __props.name ?? void 0,
					placeholder: __props.placeholder ?? "",
					readonly: __props.readonly,
					disabled: __props.disabled,
					required: __props.required,
					maxlength: __props.maxlength,
					minlength: __props.minlength,
					rows: __props.rows,
					"data-element-name": __props.name ?? void 0,
					class: normalizeClass(__props.errors.length ? "border-destructive ring-destructive" : ""),
					"onUpdate:modelValue": _cache[0] || (_cache[0] = (v) => model.value = v ?? "")
				}, null, 8, [
					"model-value",
					"id",
					"name",
					"placeholder",
					"readonly",
					"disabled",
					"required",
					"maxlength",
					"minlength",
					"rows",
					"data-element-name",
					"class"
				])]),
				_: 1
			}, 8, [
				"label",
				"required",
				"hide-label",
				"for",
				"help-text",
				"errors"
			]);
		};
	}
});
//#endregion
//#region src/components/compositions/elements/input/TextareaInput.vue
var TextareaInput_exports = /* @__PURE__ */ __exportAll({ default: () => TextareaInput_default });
var TextareaInput_default = TextareaInput_vue_vue_type_script_setup_true_lang_default;
//#endregion
export { TextareaInput_exports as n, TextareaInput_default as t };

//# sourceMappingURL=TextareaInput-Bwg_BXt-.js.map