@zendesk/retrace
Version:
define and capture Product Operation Traces along with computed metrics with an optional friendly React beacon API
37 lines (36 loc) • 1.57 kB
TypeScript
import * as React from 'react';
import type { BarProps } from '@visx/shape/lib/shapes/Bar';
import type { LineProps } from '@visx/shape/lib/shapes/Line';
import type { AddSVGProps } from '@visx/shape/lib/types';
import type { WithTooltipProvidedProps } from '@visx/tooltip/lib/enhancers/withTooltip';
import type { ScaleBand, ScaleLinear } from '@visx/vendor/d3-scale';
import type { HierarchicalSpanAndAnnotation } from '../types';
interface SharedAnnotationProps {
xScale: ScaleLinear<number, number, never>;
yScale: ScaleBand<string>;
yMax: number;
titleColor?: string;
title?: string;
annotateAt?: 'top';
data: HierarchicalSpanAndAnnotation;
showTooltip: (data: Partial<WithTooltipProvidedProps<HierarchicalSpanAndAnnotation>>) => void;
hideTooltip: () => void;
depth?: number;
hasChildren?: boolean;
isExpanded?: boolean;
onToggleExpansion?: (spanId: string) => void;
isVisible?: boolean;
}
interface InteractiveLineSpanProps extends SharedAnnotationProps, Omit<AddSVGProps<LineProps, SVGLineElement>, 'ref'> {
type: 'line';
onClick: () => void;
scrollContainerRef: React.RefObject<HTMLDivElement>;
}
interface InteractiveBarSpanProps extends SharedAnnotationProps, Omit<AddSVGProps<BarProps, SVGRectElement>, 'ref'> {
type: 'bar';
onClick: () => void;
scrollContainerRef: React.RefObject<HTMLDivElement>;
}
type InteractiveSpanProps = InteractiveLineSpanProps | InteractiveBarSpanProps;
declare const InteractiveSpan: React.FC<InteractiveSpanProps>;
export default InteractiveSpan;