import { n as __exportAll } from "./chunk-B-1-B7_t.js";
import { n as Label_default } from "./label-C5K3zowH.js";
import { n as RadioGroup_default, t as RadioGroupItem_default } from "./radio-group-CGiUFEWB.js";
import { t as FieldFrame_default } from "./field-frame-DhCOWcMP.js";
import { computed, createBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeModels, normalizeClass, openBlock, toDisplayString, unref, useModel, withCtx } from "vue";
//#region src/components/compositions/elements/boolean/RadioBoolean.vue?vue&type=script&setup=true&lang.ts
var _hoisted_1 = { class: "flex items-center gap-2" };
var _hoisted_2 = { class: "flex items-center gap-2" };
var RadioBoolean_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
	__name: "RadioBoolean",
	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: { default: "Yes" },
		falseLabel: { default: "No" },
		inline: { type: Boolean }
	}, {
		"modelValue": {
			type: Boolean,
			default: false
		},
		"modelModifiers": {}
	}),
	emits: ["update:modelValue"],
	setup(__props) {
		/**
		* Props-driven radio composition for boolean values. Renders a
		* RadioGroup with two items: "true" and "false". Labels default to
		* "Yes" / "No" but can be customised via `trueLabel` / `falseLabel`.
		*
		*   <RadioBoolean v-model="agreed" label="Agree?" />
		*   <RadioBoolean
		*     v-model="agreed"
		*     label="Agree?"
		*     true-label="Of course"
		*     false-label="Never"
		*     inline
		*   />
		*/
		const props = __props;
		const model = useModel(__props, "modelValue");
		const stringValue = computed(() => model.value ? "true" : "false");
		const trueId = computed(() => `${props.id ?? "radio-bool"}-true`);
		const falseId = computed(() => `${props.id ?? "radio-bool"}-false`);
		function onUpdate(next) {
			model.value = (Array.isArray(next) ? next[0] : next) === "true";
		}
		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(RadioGroup_default), {
					"model-value": stringValue.value,
					name: __props.name,
					disabled: __props.disabled || __props.readonly,
					required: __props.required,
					"data-element-name": __props.name ?? void 0,
					class: normalizeClass(__props.inline ? "flex flex-row gap-4" : "grid gap-2"),
					"onUpdate:modelValue": onUpdate
				}, {
					default: withCtx(() => [createElementVNode("div", _hoisted_1, [createVNode(unref(RadioGroupItem_default), {
						id: trueId.value,
						value: "true"
					}, null, 8, ["id"]), createVNode(unref(Label_default), {
						for: trueId.value,
						class: "cursor-pointer"
					}, {
						default: withCtx(() => [createTextVNode(toDisplayString(__props.trueLabel), 1)]),
						_: 1
					}, 8, ["for"])]), createElementVNode("div", _hoisted_2, [createVNode(unref(RadioGroupItem_default), {
						id: falseId.value,
						value: "false"
					}, null, 8, ["id"]), createVNode(unref(Label_default), {
						for: falseId.value,
						class: "cursor-pointer"
					}, {
						default: withCtx(() => [createTextVNode(toDisplayString(__props.falseLabel), 1)]),
						_: 1
					}, 8, ["for"])])]),
					_: 1
				}, 8, [
					"model-value",
					"name",
					"disabled",
					"required",
					"data-element-name",
					"class"
				])]),
				_: 1
			}, 8, [
				"label",
				"required",
				"hide-label",
				"for",
				"help-text",
				"errors"
			]);
		};
	}
});
//#endregion
//#region src/components/compositions/elements/boolean/RadioBoolean.vue
var RadioBoolean_exports = /* @__PURE__ */ __exportAll({ default: () => RadioBoolean_default });
var RadioBoolean_default = RadioBoolean_vue_vue_type_script_setup_true_lang_default;
//#endregion
export { RadioBoolean_exports as n, RadioBoolean_default as t };

//# sourceMappingURL=RadioBoolean-DUpyj3e3.js.map