import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useWatch } from "react-hook-form";
import { twMerge } from "tailwind-merge";
import { calculateUnitPrice } from "../utils/table.js";
import { FormattedNumber } from "./formatted-number.js";
export function UnitPrice(props) {
    const { control } = props;
    const cashAmount = useWatch({ control, name: "cashAmount" });
    const fixedIncomeAmount = useWatch({ control, name: "fixedIncomeAmount" });
    const unitPrice = calculateUnitPrice(cashAmount, fixedIncomeAmount);
    return (_jsxs("div", { className: twMerge("mt-1 w-fit", !props.isViewOnly && "ml-auto"), children: [_jsx("span", { className: "text-gray-600", children: "Unit Price" }), " ", _jsx("span", { className: "text-gray-900", children: _jsx(FormattedNumber, { decimalScale: 6, value: unitPrice }) })] }));
}
//# sourceMappingURL=unit-price.js.map