const require_runtime = require("../../_virtual/_rolldown/runtime.js");
const require_objectSpread2 = require("../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
const require_pisell_components = require("../../theme/pisell-components.js");
let react = require("react");
react = require_runtime.__toESM(react);
let _pisell_utils = require("@pisell/utils");
let antd = require("antd");
require("./PisellRating.less");
//#region src/components/pisellRating/PisellRating.tsx
/**
* PisellRating 评分组件
* 
* 基于 Ant Design Rate 组件开发，提供直观的星级评分交互。
* 支持只读、编辑、禁用三种状态。
* 
* @param props 组件 Props
* 
* @example
* // 基础使用
* const [rating, setRating] = useState(0);
* <PisellRating value={rating} onChange={setRating} />
* 
* @example
* // 只读态
* <PisellRating mode="read" value={4.5} allowHalf />
* 
* @example
* // 带评分描述
* <PisellRating
*   value={rating}
*   onChange={setRating}
*   tooltips={['很差', '差', '一般', '好', '很好']}
* />
*/
const PisellRating = (props) => {
	const { mode = "edit", disabled = false, value, defaultValue, onChange, count, max = count !== null && count !== void 0 ? count : 5, allowHalf = false, allowClear = true, character, tooltips, showValue = false, showCount = false, reviewCount, size = 20, color = "#fadb14", unselectedColor = "#d9d9d9", onHoverChange, onFocus, onBlur, className, style, "aria-label": ariaLabel, id } = props;
	const displayState = (0, _pisell_utils.getDisplayState)(mode, disabled);
	const isReadOnly = displayState === "read";
	const isDisabled = displayState === "disabled";
	const rateStyle = require_objectSpread2._objectSpread2({
		fontSize: size,
		color
	}, style);
	const theme = require_pisell_components.getPisellComponentsThemeConfig();
	return /* @__PURE__ */ react.default.createElement(antd.ConfigProvider, { theme }, /* @__PURE__ */ react.default.createElement("div", {
		className: `pisell-rating pisell-rating-${displayState} ${className || ""}`,
		id
	}, /* @__PURE__ */ react.default.createElement(antd.Rate, {
		value,
		defaultValue,
		onChange,
		onHoverChange,
		onFocus,
		onBlur,
		count: max,
		allowHalf,
		allowClear,
		character,
		tooltips,
		disabled: isReadOnly || isDisabled,
		style: rateStyle,
		"aria-label": ariaLabel
	}), showValue && value !== void 0 && /* @__PURE__ */ react.default.createElement("span", {
		className: "pisell-rating-value",
		style: { marginLeft: 8 }
	}, value.toFixed(allowHalf ? 1 : 0)), showCount && reviewCount !== void 0 && /* @__PURE__ */ react.default.createElement("span", {
		className: "pisell-rating-count",
		style: {
			marginLeft: 8,
			color: "#999"
		}
	}, "(", reviewCount, " 人评价)")));
};
var PisellRating_default = react.default.memo(PisellRating, (prevProps, nextProps) => {
	return prevProps.value === nextProps.value && prevProps.mode === nextProps.mode && prevProps.disabled === nextProps.disabled;
});
//#endregion
exports.default = PisellRating_default;
