import { getText } from "../../locales/index.js";
import IconFont from "../iconfont/index.js";
import React, { useCallback } from "react";
import classNames from "classnames";
import "./PisellExport.less";
//#region src/components/pisellExport/PisellExport.tsx
/** 默认导出图标（download-cloud-01） */
const DEFAULT_ICON_TYPE = "pisell2-download-cloud-01";
/**
* PisellExport 导出触发器组件
*
* @description 仅负责 UI 展示与点击回调，不内置导出逻辑；支持 Icon/Button 两种形态与三种尺寸
*/
function PisellExport(props) {
	const { variant = "button", size = "medium", type = "default", disabled = false, label, icon, onExport, className, style } = props;
	const displayLabel = label !== void 0 ? label : getText("pisell-export-button-label");
	const iconNode = icon !== void 0 ? icon : /* @__PURE__ */ React.createElement(IconFont, {
		type: DEFAULT_ICON_TYPE,
		className: "pisell-export-icon",
		style: {
			fontSize: 20,
			width: 20,
			height: 20,
			display: "inline-flex",
			alignItems: "center",
			justifyContent: "center"
		}
	});
	const handleClick = useCallback((e) => {
		if (disabled) return;
		onExport === null || onExport === void 0 || onExport(e);
	}, [disabled, onExport]);
	const rootClass = classNames("pisell-export", `pisell-export--${variant}`, `pisell-export--${size}`, `pisell-export--${type}`, disabled && "pisell-export--disabled", className);
	return /* @__PURE__ */ React.createElement("button", {
		type: "button",
		className: rootClass,
		style,
		disabled,
		onClick: handleClick,
		"aria-label": typeof displayLabel === "string" ? displayLabel : void 0
	}, /* @__PURE__ */ React.createElement("span", { className: "pisell-export-icon-wrap" }, iconNode), variant === "button" && /* @__PURE__ */ React.createElement("span", { className: "pisell-export-label" }, displayLabel));
}
//#endregion
export { PisellExport };
