//#region src/UI/fluent-web-components/utils/formEvents.ts
/**
* Creates a normalized change event from a value.
* Use this to transform Stencil CustomEvent.detail into a form-library-compatible event.
*
* @example
* // For text inputs
* onValueChanged={(e) => onChange?.(createChangeEvent(e.detail, name, 'text'))}
*
* @example
* // For checkboxes
* onValueChanged={(e) => onChange?.(createChangeEvent(e.detail, name, 'checkbox'))}
*/
function createChangeEvent(value, name, type) {
	const isCheckboxType = type === "checkbox" || type === "switch" || type === "radio";
	return {
		target: {
			value,
			name,
			type,
			checked: isCheckboxType ? Boolean(value) : void 0
		},
		currentTarget: {
			value,
			name,
			type,
			checked: isCheckboxType ? Boolean(value) : void 0
		},
		type: "change"
	};
}
/**
* Creates a normalized focus/blur event.
* Use this to transform Stencil focus/blur CustomEvents into form-library-compatible events.
*
* @example
* onInputBlur={() => onBlur?.(createFocusEvent('blur', name))}
*/
function createFocusEvent(type, name) {
	return {
		target: { name },
		type
	};
}
//#endregion
export { createChangeEvent, createFocusEvent };

//# sourceMappingURL=formEvents.mjs.map