import { n as __exportAll } from "./chunk-B-1-B7_t.js";
import { t as Input_default } from "./input-CwDp-vE8.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/TelInput.vue?vue&type=script&setup=true&lang.ts
var TelInput_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
	__name: "TelInput",
	props: /* @__PURE__ */ mergeModels({
		modelValue: {},
		id: {},
		name: {},
		label: {},
		hideLabel: { type: Boolean },
		placeholder: {},
		required: { type: Boolean },
		readonly: { type: Boolean },
		disabled: { type: Boolean },
		maxlength: {},
		minlength: {},
		helpText: {},
		errors: { default: () => [] },
		autoFocus: { type: Boolean }
	}, {
		"modelValue": {},
		"modelModifiers": {}
	}),
	emits: ["update:modelValue"],
	setup(__props) {
		/**
		* Props-driven telephone input composition. Composes the shadcn `Input`
		* primitive (with `type="tel"`) and `FieldFrame` chrome.
		*
		* Self-contained — usable directly in any Vue app:
		*
		*   <TelInput v-model="phone" label="Phone" />
		*/
		const props = __props;
		const model = useModel(__props, "modelValue");
		const inputRef = useTemplateRef("inputRef");
		onMounted(() => {
			if (props.autoFocus) inputRef.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(Input_default), {
					ref_key: "inputRef",
					ref: inputRef,
					"model-value": model.value ?? void 0,
					id: __props.id,
					name: __props.name ?? void 0,
					type: "tel",
					placeholder: __props.placeholder ?? "",
					readonly: __props.readonly,
					disabled: __props.disabled,
					required: __props.required,
					maxlength: __props.maxlength,
					minlength: __props.minlength,
					"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 ? "" : String(v))
				}, null, 8, [
					"model-value",
					"id",
					"name",
					"placeholder",
					"readonly",
					"disabled",
					"required",
					"maxlength",
					"minlength",
					"data-element-name",
					"class"
				])]),
				_: 1
			}, 8, [
				"label",
				"required",
				"hide-label",
				"for",
				"help-text",
				"errors"
			]);
		};
	}
});
//#endregion
//#region src/components/compositions/elements/input/TelInput.vue
var TelInput_exports = /* @__PURE__ */ __exportAll({ default: () => TelInput_default });
var TelInput_default = TelInput_vue_vue_type_script_setup_true_lang_default;
//#endregion
export { TelInput_exports as n, TelInput_default as t };

//# sourceMappingURL=TelInput-D4NQJXQM.js.map