import { n as __exportAll } from "./chunk-B-1-B7_t.js";
import { n as Button_default } from "./button-B9CnnuTu.js";
import { computed, createBlock, createCommentVNode, createElementBlock, defineComponent, openBlock, resolveDynamicComponent, toDisplayString, unref, withCtx } from "vue";
import * as LucideIcons from "@lucide/vue";
//#region src/components/compositions/elements/action/LinkAction.vue?vue&type=script&setup=true&lang.ts
var _hoisted_1 = { key: 1 };
var LinkAction_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
	__name: "LinkAction",
	props: {
		label: {},
		icon: {},
		href: {},
		target: { default: "_self" },
		emit: {},
		disabled: { type: Boolean },
		id: {},
		name: {}
	},
	emits: ["click", "action"],
	setup(__props, { emit: __emit }) {
		/**
		* Props-driven link composition. Renders a text link using the Button
		* primitive with variant="link". Supports the same href / emit / confirm
		* behaviour as ButtonAction.
		*
		*   <LinkAction label="Open docs" href="https://example.com" target="_blank" />
		*   <LinkAction label="Refresh" emit="refresh" @action="onAction" />
		*/
		const props = __props;
		const emit = __emit;
		const iconLibrary = LucideIcons;
		function resolveIcon(name) {
			if (!name) return;
			return iconLibrary[name.split(/[-_\s]/).filter(Boolean).map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join("")] ?? iconLibrary[name];
		}
		const icon = computed(() => resolveIcon(props.icon));
		const renderAs = computed(() => props.href ? "a" : "button");
		function onClick(event) {
			emit("click", event);
			if (props.href) return;
			event.preventDefault();
			if (props.emit) emit("action", { name: props.emit });
		}
		return (_ctx, _cache) => {
			return openBlock(), createBlock(unref(Button_default), {
				id: __props.id,
				as: renderAs.value,
				variant: "link",
				size: "sm",
				disabled: __props.disabled,
				href: renderAs.value === "a" ? __props.href : void 0,
				target: renderAs.value === "a" ? __props.target : void 0,
				"data-action-name": emit ?? __props.label,
				"data-element-name": __props.name ?? void 0,
				onClick
			}, {
				default: withCtx(() => [icon.value ? (openBlock(), createBlock(resolveDynamicComponent(icon.value), {
					key: 0,
					class: "h-4 w-4"
				})) : createCommentVNode("", true), __props.label ? (openBlock(), createElementBlock("span", _hoisted_1, toDisplayString(__props.label), 1)) : createCommentVNode("", true)]),
				_: 1
			}, 8, [
				"id",
				"as",
				"disabled",
				"href",
				"target",
				"data-action-name",
				"data-element-name"
			]);
		};
	}
});
//#endregion
//#region src/components/compositions/elements/action/LinkAction.vue
var LinkAction_exports = /* @__PURE__ */ __exportAll({ default: () => LinkAction_default });
var LinkAction_default = LinkAction_vue_vue_type_script_setup_true_lang_default;
//#endregion
export { LinkAction_exports as n, LinkAction_default as t };

//# sourceMappingURL=LinkAction-BNIUUDyO.js.map