import { Colors } from '@codecademy/gamut-styles'; import { SelectOptions } from '../../Form/inputs/Select'; import { BarChartContextProps } from '../BarChartProvider'; import { BarChartTranslations } from '../shared/translations'; import { BarChartStyles, BarProps, InferBarType, MaxScaleValue, ScaleTickCount } from '../shared/types'; export interface LabelPosition { value: number; positionPercent: number; } /** * Hook that calculates label positions for a given maxScaleValue and tickCount (scale min is always 0). * Returns an array of { value, positionPercent } objects. */ export declare const useLabelPositions: ({ maxScaleValue, tickCount, }: { maxScaleValue: MaxScaleValue; tickCount: ScaleTickCount; }) => LabelPosition[]; export declare const useBarChartContext: () => BarChartContextProps; export interface UseBarChartOptions { maxScaleValue: MaxScaleValue; scaleInterval?: number; unit?: string; styleConfig?: BarChartStyles; animate?: boolean; barCount?: number; translations: BarChartTranslations; } export declare const useBarChart: ({ maxScaleValue, scaleInterval, unit, styleConfig, animate, barCount, translations, }: UseBarChartOptions) => { maxScaleValue: number; scaleInterval: number; unit: string; styleConfig: { textColor: import("@codecademy/gamut-styles").ColorAlias; seriesOneBarColor: import("@codecademy/gamut-styles").ColorAlias; seriesTwoBarColor: import("@codecademy/gamut-styles").ColorAlias; seriesOneLabel: import("@codecademy/gamut-styles").ColorAlias; seriesTwoLabel: import("@codecademy/gamut-styles").ColorAlias; }; animate: boolean; widestCategoryLabelWidth: number | null; setWidestCategoryLabelWidth: (width: number) => void; widestTotalValueLabelWidth: number | null; setWidestTotalValueLabelWidth: (width: number) => void; isMeasuring: boolean; translations: BarChartTranslations; }; /** * Hook that returns a function to get the highest contrast border color * (white or navy-900) for a given background color. * * Similar to the Background component, this resolves color aliases and * compares contrast ratios to determine the best border color. * * @returns A function that takes a background color and returns either 'white' or 'navy-900' */ export declare const useBarBorderColor: () => (bg: Colors) => "white" | "navy-900"; export declare const useMeasureCategoryLabelWidth: ({ ref, }: { ref: React.RefObject; }) => void; export declare const useMeasureTotalValueLabelWidth: ({ ref, }: { ref: React.RefObject; }) => void; export interface CustomSortOption { label: string; value: string; sortFn: (bars: TBar[]) => TBar[]; } export interface UseBarChartSortOptions { bars: TBarValues; sortFns?: ('alphabetically' | 'numerically' | 'none' | CustomSortOption>)[]; translations: BarChartTranslations; } export interface UseBarChartSortReturn { sortedBars: TBarValues; sortValue: string; onSortChange: (value: string) => void; selectProps: { options: SelectOptions; value: string; onChange: (e: React.ChangeEvent) => void; } | null; } /** * Hook that manages bar sorting state and provides memoized sorted bars. * Supports predefined sort options (via string literals) and custom sort functions. * Only returns selectProps if sortFns is provided. */ export declare const useBarChartSort: ({ bars, sortFns, translations, }: UseBarChartSortOptions) => UseBarChartSortReturn;