import { getPisellComponentsThemeConfig } from "../../theme/pisell-components.js";
import ReadOnlyView from "./components/ReadOnlyView.js";
import EditView from "./components/EditView.js";
import DisabledView from "./components/DisabledView.js";
import React from "react";
import { getDisplayState } from "@pisell/utils";
import { ConfigProvider } from "antd";
import "./PisellCurrency.less";
//#region src/components/pisellCurrency/PisellCurrency.tsx
/**
* PisellCurrency 货币组件
* 
* 基于 PisellNumber 派生，专门处理货币数据。
* 默认启用千分位和2位小数，符合财务规范。
* 
* @param props 组件 Props
* 
* @example
* // 受控模式
* const [price, setPrice] = useState(0);
* <PisellCurrency 
*   value={price}
*   onChange={setPrice}
*   currencySymbol="¥"
* />
* 
* @example
* // 非受控模式
* <PisellCurrency 
*   defaultValue={100}
*   currencySymbol="$"
* />
* 
* @example
* // 只读态
* <PisellCurrency 
*   mode="read"
*   value={1234.56}
*   currencySymbol="¥"
* />
* // 显示: ¥1,234.56
*/
const PisellCurrency = (props) => {
	const { mode = "edit", disabled = false } = props;
	const displayState = getDisplayState(mode, disabled);
	const render = () => {
		switch (displayState) {
			case "read": return /* @__PURE__ */ React.createElement(ReadOnlyView, props);
			case "edit": return /* @__PURE__ */ React.createElement(EditView, props);
			case "disabled": return /* @__PURE__ */ React.createElement(DisabledView, props);
			default: return null;
		}
	};
	const theme = getPisellComponentsThemeConfig();
	return /* @__PURE__ */ React.createElement(ConfigProvider, { theme }, render());
};
const MemoizedPisellCurrency = React.memo(PisellCurrency, (prevProps, nextProps) => {
	return prevProps.value === nextProps.value && prevProps.mode === nextProps.mode && prevProps.disabled === nextProps.disabled && prevProps.currencySymbol === nextProps.currencySymbol && prevProps.symbolPosition === nextProps.symbolPosition;
});
//#endregion
export { MemoizedPisellCurrency as default };
