"use client"; import { useId } from "react"; export interface DashTailStrokeProps { /** SVG path `d` for the full series (single curved path). */ pathD: string | null; /** Total length of `pathD` in user units. */ pathLength: number; /** Path length at which the dashed tail begins. */ dashStartLength: number; /** X coordinate (chart inner space) where the tail clip begins. */ dashStartX: number; innerWidth: number; innerHeight: number; /** Stroke paint — solid color or gradient url. */ stroke: string; strokeWidth: number; dashArray: string; } export function DashTailStroke({ pathD, pathLength, dashStartLength, dashStartX, innerWidth, innerHeight, stroke, strokeWidth, dashArray, }: DashTailStrokeProps) { const clipPathId = useId().replace(/:/g, ""); if (!pathD || pathLength <= 0 || dashStartLength >= pathLength) { return null; } const pad = strokeWidth * 2; const tailWidth = Math.max(0, innerWidth - dashStartX + pad); return ( <> {/* Solid head — same curved path, gradient/fade preserved */} {/* Dashed tail — clipped to x ≥ dashStartX so dashes follow the curve */} ); }