import { n as __exportAll } from "./chunk-B-1-B7_t.js";
import { n as Label_default } from "./label-C5K3zowH.js";
import { r as Switch_default } from "./switch-E1QdwZg_.js";
import { t as FieldFrame_default } from "./field-frame-DhCOWcMP.js";
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeModels, openBlock, toDisplayString, unref, useModel, withCtx } from "vue";
//#region src/components/compositions/elements/boolean/SwitchBoolean.vue?vue&type=script&setup=true&lang.ts
var _hoisted_1 = { class: "flex items-center gap-3" };
var _hoisted_2 = {
	key: 0,
	class: "ml-2 text-xs font-normal text-muted-foreground"
};
var _hoisted_3 = {
	key: 1,
	class: "sr-only",
	"data-testid": "field-frame-label-sr"
};
var SwitchBoolean_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
	__name: "SwitchBoolean",
	props: /* @__PURE__ */ mergeModels({
		modelValue: { type: Boolean },
		id: {},
		name: {},
		label: {},
		hideLabel: { type: Boolean },
		required: { type: Boolean },
		readonly: { type: Boolean },
		disabled: { type: Boolean },
		helpText: {},
		errors: { default: () => [] },
		trueLabel: {},
		falseLabel: {}
	}, {
		"modelValue": {
			type: Boolean,
			default: false
		},
		"modelModifiers": {}
	}),
	emits: ["update:modelValue"],
	setup(__props) {
		/**
		* Props-driven switch composition. Wraps the shadcn-vue Switch primitive
		* with `FieldFrame` chrome.
		*
		*   <SwitchBoolean v-model="notifications" label="Notifications" />
		*   <SwitchBoolean
		*     v-model="online"
		*     label="Visibility"
		*     true-label="Online"
		*     false-label="Offline"
		*   />
		*/
		const props = __props;
		const model = useModel(__props, "modelValue");
		const stateLabel = computed(() => model.value ? props.trueLabel ?? "" : props.falseLabel ?? "");
		function onUpdate(checked) {
			model.value = checked;
		}
		return (_ctx, _cache) => {
			return openBlock(), createBlock(unref(FieldFrame_default), {
				"hide-label": true,
				for: __props.id,
				"help-text": __props.helpText,
				errors: __props.errors
			}, {
				default: withCtx(() => [createElementVNode("div", _hoisted_1, [createVNode(unref(Switch_default), {
					id: __props.id,
					name: __props.name,
					disabled: __props.disabled || __props.readonly,
					required: __props.required,
					"model-value": model.value,
					"data-element-name": __props.name ?? void 0,
					"onUpdate:modelValue": onUpdate
				}, null, 8, [
					"id",
					"name",
					"disabled",
					"required",
					"model-value",
					"data-element-name"
				]), !__props.hideLabel && __props.label ? (openBlock(), createBlock(unref(Label_default), {
					key: 0,
					for: __props.id,
					required: __props.required,
					class: "cursor-pointer",
					"data-testid": "field-frame-label"
				}, {
					default: withCtx(() => [createTextVNode(toDisplayString(__props.label) + " ", 1), stateLabel.value ? (openBlock(), createElementBlock("span", _hoisted_2, " (" + toDisplayString(stateLabel.value) + ") ", 1)) : createCommentVNode("", true)]),
					_: 1
				}, 8, ["for", "required"])) : __props.label ? (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(__props.label), 1)) : createCommentVNode("", true)])]),
				_: 1
			}, 8, [
				"for",
				"help-text",
				"errors"
			]);
		};
	}
});
//#endregion
//#region src/components/compositions/elements/boolean/SwitchBoolean.vue
var SwitchBoolean_exports = /* @__PURE__ */ __exportAll({ default: () => SwitchBoolean_default });
var SwitchBoolean_default = SwitchBoolean_vue_vue_type_script_setup_true_lang_default;
//#endregion
export { SwitchBoolean_exports as n, SwitchBoolean_default as t };

//# sourceMappingURL=SwitchBoolean-4dodQkN_.js.map