import { jsx } from 'react/jsx-runtime';
import { cn } from '../../../../utils/cn.js';

/**
 * HorizontalGrid component for charts
 * Renders horizontal grid lines at specified intervals
 */
const HorizontalGrid = ({ x, y, width, height, lineCount = 5, show = true, color = "currentColor", className, tickPositions, }) => {
    if (!show)
        return null;
    // Generate grid line positions
    const positions = tickPositions ||
        Array.from({ length: lineCount }, (_, i) => {
            if (lineCount <= 1)
                return y;
            return y + (i * height) / (lineCount - 1);
        });
    return (jsx("g", { className: cn("chart-horizontal-grid", className), children: positions.map((lineY, index) => (jsx("line", { x1: x, y1: lineY, x2: x + width, y2: lineY, className: "opacity-80 stroke-[var(--color-border)]", strokeWidth: 1 }, index))) }));
};

export { HorizontalGrid };
