import style_default from "./style/index.js";
import { computed, createVNode, defineComponent, mergeProps, useAttrs, useSlots } from "vue";
import { Tooltip } from "antdv-next";
import { CloseCircleOutlined, LoadingOutlined } from "@antdv-next/icons";
//#region components/actions/ActionsItem.tsx
var ACTIONS_ITEM_STATUS = /* @__PURE__ */ function(ACTIONS_ITEM_STATUS) {
	ACTIONS_ITEM_STATUS["LOADING"] = "loading";
	ACTIONS_ITEM_STATUS["ERROR"] = "error";
	ACTIONS_ITEM_STATUS["RUNNING"] = "running";
	ACTIONS_ITEM_STATUS["DEFAULT"] = "default";
	return ACTIONS_ITEM_STATUS;
}({});
var XActionsItem = /* @__PURE__ */ defineComponent({
	name: "AxActionsItem",
	inheritAttrs: false,
	props: {
		status: {
			type: String,
			default: ACTIONS_ITEM_STATUS.DEFAULT
		},
		defaultIcon: {
			type: [
				String,
				Number,
				Object,
				Array,
				Function
			],
			required: true
		},
		label: {
			type: String,
			default: void 0
		},
		runningIcon: {
			type: [
				String,
				Number,
				Object,
				Array,
				Function
			],
			default: void 0
		},
		prefixCls: {
			type: String,
			default: "antd-actions"
		},
		rootClass: {
			type: String,
			default: ""
		},
		class: {
			type: [
				String,
				Array,
				Object
			],
			default: void 0
		},
		style: {
			type: [
				String,
				Object,
				Array
			],
			default: void 0
		},
		classes: {
			type: Object,
			default: () => ({})
		},
		styles: {
			type: Object,
			default: () => ({})
		}
	},
	setup(props) {
		const attrs = useAttrs();
		const slots = useSlots();
		const [hashId, cssVarCls] = style_default(computed(() => props.prefixCls));
		const itemCls = `${props.prefixCls}-button-item`;
		const domAttrs = computed(() => {
			const { class: _class, style: _style, ...rest } = attrs;
			return rest;
		});
		const defaultIconSlot = computed(() => slots.defaultIcon ?? slots["default-icon"]);
		const runningIconSlot = computed(() => slots.runningIcon ?? slots["running-icon"]);
		const statusIcon = computed(() => {
			const defaultIconNode = defaultIconSlot.value?.() ?? props.defaultIcon;
			const runningIconNode = runningIconSlot.value?.() ?? props.runningIcon;
			return {
				[ACTIONS_ITEM_STATUS.LOADING]: createVNode(LoadingOutlined, null, null),
				[ACTIONS_ITEM_STATUS.ERROR]: createVNode(CloseCircleOutlined, null, null),
				[ACTIONS_ITEM_STATUS.RUNNING]: runningIconNode,
				[ACTIONS_ITEM_STATUS.DEFAULT]: defaultIconNode
			}[props.status] ?? defaultIconNode;
		});
		return () => createVNode(Tooltip, { "title": props.label }, { default: () => [createVNode("div", mergeProps(domAttrs.value, {
			"class": [
				itemCls,
				props.prefixCls,
				`${props.prefixCls}-item`,
				hashId.value,
				cssVarCls.value,
				props.rootClass,
				props.classes?.root,
				props.classes?.[props.status],
				attrs.class,
				props.class
			],
			"style": [
				props.styles?.root,
				props.styles?.[props.status],
				attrs.style,
				props.style
			]
		}), [statusIcon.value])] });
	}
});
//#endregion
export { ACTIONS_ITEM_STATUS, XActionsItem, XActionsItem as default };
