import { getText } from "../../../locales/index.js";
import { useOverflowActions } from "../hooks/useOverflowActions.js";
import { mergeClassNames } from "../utils/classNames.js";
import React from "react";
import { Button, Dropdown } from "antd";
import UpOutlined from "@ant-design/icons/UpOutlined";
//#region src/components/PisellProcedure/components/FooterActions.tsx
/**
* FooterActions 底部操作区组件
* @description 实现底部操作区的左右布局：左侧自定义内容 + 右侧操作按钮（支持溢出收纳）
* 收纳规则：从左到右依次收纳（优先级低的先收纳），保留右侧的主要操作按钮
* @author Pisell Team
*/
const FooterActions = ({ leftSlot, children, className, moreText, gap = 16 }) => {
	const { containerRef, measureRef, moreButtonRef, leftSlotRef, actionItems, visibleActions, hasOverflow, moreMenuItems } = useOverflowActions({
		children,
		gap,
		moreText
	});
	/** 容器类名 */
	const containerCls = mergeClassNames("pisell-procedure-footer__content", className);
	/** 是否有左侧内容 */
	const hasLeftSlot = leftSlot !== void 0 && leftSlot !== null;
	return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
		ref: measureRef,
		style: {
			position: "absolute",
			visibility: "hidden",
			pointerEvents: "none",
			display: "flex",
			gap,
			whiteSpace: "nowrap",
			left: -9999,
			top: -9999
		},
		"aria-hidden": "true"
	}, actionItems.map((item, index) => /* @__PURE__ */ React.createElement("div", {
		key: index,
		"data-measure-item": true,
		style: { flexShrink: 0 }
	}, item))), /* @__PURE__ */ React.createElement("div", {
		ref: moreButtonRef,
		style: {
			position: "absolute",
			visibility: "hidden",
			pointerEvents: "none",
			left: -9999,
			top: -9999
		},
		"aria-hidden": "true"
	}, /* @__PURE__ */ React.createElement(Button, { icon: /* @__PURE__ */ React.createElement(UpOutlined, null) }, moreText)), /* @__PURE__ */ React.createElement("div", {
		ref: containerRef,
		className: containerCls,
		style: { gap }
	}, hasLeftSlot && /* @__PURE__ */ React.createElement("div", {
		ref: leftSlotRef,
		className: "pisell-procedure-footer__left"
	}, leftSlot), /* @__PURE__ */ React.createElement("div", {
		className: "pisell-procedure-footer__actions",
		style: { gap }
	}, hasOverflow && /* @__PURE__ */ React.createElement(Dropdown, { menu: { items: moreMenuItems } }, /* @__PURE__ */ React.createElement(Button, { icon: /* @__PURE__ */ React.createElement(UpOutlined, null) }, moreText || getText("pisell-procedure-footer-more"))), visibleActions)));
};
FooterActions.displayName = "FooterActions";
//#endregion
export { FooterActions as default };
