"use client"; import { cn } from "@/lib/utils"; import { VolumeProfileContext, useVolumeProfileModel, type VolumeProfileProps, } from "./volume-profile/context"; import { VolumeProfilePlot } from "./volume-profile/plot"; import { VolumeProfileSummary } from "./volume-profile/summary"; import { VolumeProfileTooltip } from "./volume-profile/tooltip"; /** Compose Plot, Tooltip and Summary, or omit children for the complete chart. */ export function VolumeProfile({ data, label, unit, formatPrice, formatVolume, valueArea, color, pocColor, activeId, defaultActiveId, onActiveChange, className, children, ...props }: VolumeProfileProps) { const model = useVolumeProfileModel({ data, label, unit, formatPrice, formatVolume, valueArea, color, pocColor, activeId, defaultActiveId, onActiveChange, }); return (
{children === undefined ? ( <> ) : ( children )}
{model.rows.map((row) => ( ))}
{model.label} data
Price range Volume ({model.unit}) Share Level
{model.formatPrice(row.priceLow)} to {model.formatPrice(row.priceHigh)} {model.formatVolume(row.volume)} {(row.share * 100).toFixed(1)}% {row.isPoc ? "Point of control" : row.inValueArea ? "Inside value area" : model.valueArea ? "Outside value area" : "—"}
); } export { useVolumeProfile } from "./volume-profile/context"; export type { VolumeProfileProps } from "./volume-profile/context"; export type { VolumeProfileBin, VolumeProfileRow } from "./volume-profile/model"; export { VolumeProfilePlot } from "./volume-profile/plot"; export type { VolumeProfilePlotProps } from "./volume-profile/plot"; export { VolumeProfileSummary } from "./volume-profile/summary"; export { VolumeProfileTooltip } from "./volume-profile/tooltip"; export type { VolumeProfileTooltipProps } from "./volume-profile/tooltip";