import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import { convertToPercent } from "../utils/rangeConverter.js";
import { formatPercent } from "../utils/percentFormatter.js";
import React from "react";
import { Progress } from "antd";
//#region src/components/pisellPercent/components/ReadOnlyView.tsx
/**
* PisellPercent 只读态视图组件
* 
* 根据 variant 渲染不同形式：
* - text: 纯文本（85.5%）
* - progress: 进度条
* - circle: 环形进度
* 
* @param props 组件 Props
*/
const ReadOnlyView = (props) => {
	const { value, variant = "text", showPercentSymbol = true, precision = 1, range = [0, 100], progressProps, circleProps, emptyText = "-", fontSize, fontWeight, color, textAlign = "left", className, style, "aria-label": ariaLabel } = props;
	if (variant === "progress" || variant === "circle") {
		const percentValue = convertToPercent(value, range);
		if (percentValue === null) return /* @__PURE__ */ React.createElement("span", {
			className: `pisell-percent pisell-percent-read ${className || ""}`,
			style
		}, emptyText);
		if (variant === "progress") return /* @__PURE__ */ React.createElement("div", {
			className: `pisell-percent pisell-percent-progress ${className || ""}`,
			style
		}, /* @__PURE__ */ React.createElement(Progress, _objectSpread2({ percent: percentValue }, progressProps)));
		return /* @__PURE__ */ React.createElement("div", {
			className: `pisell-percent pisell-percent-circle ${className || ""}`,
			style
		}, /* @__PURE__ */ React.createElement(Progress, _objectSpread2({
			type: "circle",
			percent: percentValue
		}, circleProps)));
	}
	const displayValue = formatPercent(value, {
		showPercentSymbol,
		precision,
		range
	});
	const text = displayValue !== null && displayValue !== void 0 ? displayValue : emptyText;
	const combinedStyle = _objectSpread2({
		fontSize,
		fontWeight,
		color,
		textAlign
	}, style);
	return /* @__PURE__ */ React.createElement("span", {
		className: `pisell-percent pisell-percent-read ${className || ""}`,
		style: combinedStyle,
		"aria-label": ariaLabel
	}, text);
};
//#endregion
export { ReadOnlyView as default };
