import * as React from 'react'; import { AnnotationMatcher } from '@nivo/annotations'; import { AxisProps, GridValues } from '@nivo/axes'; import { Box, CartesianMarkerProps, Dimensions, Margin, MotionProps, PropertyAccessor, SvgDefsAndFill, ValueFormat } from '@nivo/core'; import { PartialTheme } from '@nivo/theming'; import { InheritedColorConfig, OrdinalColorScaleConfig } from '@nivo/colors'; import { LegendProps } from '@nivo/legends'; import { ScaleBandSpec, AnyScale, ScaleLinearSpec, ScaleLogSpec, ScaleSymlogSpec, ScaleTimeSpec } from '@nivo/scales'; import { SpringValues } from '@react-spring/web'; export type BoxPlotDatum = Record; export interface BoxPlotSummary { group: string; subGroup: string; groupIndex: number; subGroupIndex: number; n: number; extrema: [number, number]; quantiles: [number, number, number, number, number]; values: [number, number, number, number, number]; mean: number; } export interface BoxPlotSummaryFormatted { n: string; extrema: [string, string]; quantiles: [string, string, string, string, string]; values: [string, string, string, string, string]; mean: string; } export interface ComputedBoxPlotSummary { key: string; group: string; subGroup: string; data: BoxPlotSummary; formatted: BoxPlotSummaryFormatted; x: number; y: number; width: number; height: number; coordinates: { index: number; values: [number, number, number, number, number]; }; bandwidth: number; label: string; layout: 'horizontal' | 'vertical'; color?: string; opacity?: number; fill?: string; } export interface DataProps { data: RawDatum[]; } export type LegendData = { id: string | number; label: string | number; color: string; }; export type LabelFormatter = (label: string | number) => string | number; export type ValueFormatter = (value: number) => string | number; export type BoxPlotLayerId = 'grid' | 'axes' | 'boxPlots' | 'markers' | 'legends' | 'annotations'; export interface BoxPlotCustomLayerProps extends Pick, 'layout' | 'borderRadius' | 'borderWidth' | 'medianWidth' | 'whiskerWidth' | 'whiskerEndSize' | 'isInteractive' | 'padding' | 'innerPadding'>, Dimensions, BoxPlotHandlers { boxPlots: ComputedBoxPlotSummary[]; margin: Margin; innerWidth: number; innerHeight: number; getTooltipLabel: (datum: BoxPlotSummary) => string | number; xScale: AnyScale; yScale: AnyScale; } export type BoxPlotCustomLayer = React.FC>; export type BoxPlotLayer = BoxPlotLayerId | BoxPlotCustomLayer; export interface BoxPlotItemProps extends Pick, 'layout' | 'borderRadius' | 'borderWidth' | 'medianWidth' | 'whiskerWidth' | 'whiskerEndSize' | 'isInteractive' | 'tooltip'>, BoxPlotHandlers { boxPlot: ComputedBoxPlotSummary; animatedProps: SpringValues<{ color: string; borderColor: string; medianColor: string; whiskerColor: string; opacity: number; transform: string; valueInterval: number; valueDistance0: number; valueDistance1: number; valueDistance3: number; valueDistance4: number; }>; isFocusable: boolean; setActiveItem: (datum: ComputedBoxPlotSummary | null) => void; ariaLabel?: BoxPlotSvgProps['boxPlotAriaLabel']; ariaLabelledBy?: BoxPlotSvgProps['boxPlotAriaLabelledBy']; ariaDescribedBy?: BoxPlotSvgProps['boxPlotAriaDescribedBy']; } export type RenderBoxPlotProps = Omit, 'isInteractive' | 'style' | 'tooltip' | 'isFocusable' | 'ariaLabel' | 'ariaLabelledBy' | 'ariaDescribedBy'> & { borderColor: string; labelColor: string; }; export type BoxPlotTooltipProps = Pick; export type BoxPlotHandlers = { onClick?: (datum: ComputedBoxPlotSummary, event: React.MouseEvent) => void; onMouseEnter?: (datum: ComputedBoxPlotSummary, event: React.MouseEvent) => void; onMouseLeave?: (datum: ComputedBoxPlotSummary, event: React.MouseEvent) => void; }; export type BoxPlotCommonProps = { groupBy: PropertyAccessor; subGroupBy?: PropertyAccessor | null; groups: string[] | null; subGroups?: string[] | null; value: string; quantiles: number[]; layout: 'horizontal' | 'vertical'; maxValue: 'auto' | number; minValue: 'auto' | number; margin?: Box; padding: number; innerPadding: number; opacity: number; activeOpacity: number; inactiveOpacity: number; valueScale: ScaleLinearSpec | ScaleLogSpec | ScaleSymlogSpec | ScaleTimeSpec; indexScale: ScaleBandSpec; enableGridX: boolean; gridXValues?: GridValues; enableGridY: boolean; gridYValues?: GridValues; borderColor: InheritedColorConfig; borderRadius: number; borderWidth: number; medianColor: InheritedColorConfig; medianWidth: number; whiskerColor: InheritedColorConfig; whiskerWidth: number; whiskerEndSize: number; isInteractive: boolean; tooltip: React.FC; valueFormat?: ValueFormat; legendLabel?: PropertyAccessor; tooltipLabel: PropertyAccessor; colorBy: 'group' | 'subGroup'; colors: OrdinalColorScaleConfig; theme: PartialTheme & { translation: BoxPlotDatum; }; annotations: AnnotationMatcher[]; legends: LegendProps[]; renderWrapper?: boolean; }; export type BoxPlotSvgProps = Partial> & DataProps & BoxPlotHandlers & SvgDefsAndFill & Dimensions & MotionProps & Partial<{ axisBottom: AxisProps | null; axisLeft: AxisProps | null; axisRight: AxisProps | null; axisTop: AxisProps | null; boxPlotComponent: React.FC>; markers: CartesianMarkerProps[]; layers: BoxPlotLayer[]; role: string; ariaLabel?: React.AriaAttributes['aria-label']; ariaLabelledBy?: React.AriaAttributes['aria-labelledby']; ariaDescribedBy?: React.AriaAttributes['aria-describedby']; isFocusable?: boolean; boxPlotAriaLabel?: (data: ComputedBoxPlotSummary) => React.AriaAttributes['aria-label']; boxPlotAriaLabelledBy?: (data: ComputedBoxPlotSummary) => React.AriaAttributes['aria-labelledby']; boxPlotAriaDescribedBy?: (data: ComputedBoxPlotSummary) => React.AriaAttributes['aria-describedby']; }>; export type BoxPlotAnnotationsProps = { annotations: AnnotationMatcher[]; boxPlots: ComputedBoxPlotSummary[]; }; //# sourceMappingURL=types.d.ts.map