import * as React from "react"; import type { Focusable, Widget, WidgetProps } from "../../types"; import type { NumericInputPromptJSON } from "../../widget-ai-utils/numeric-input/prompt-utils"; import type { PerseusNumericInputAnswerForm, PerseusNumericInputRubric, PerseusNumericInputUserInput, PerseusNumericInputWidgetOptions } from "@khanacademy/perseus-core"; type ExternalProps = WidgetProps; export type NumericInputProps = ExternalProps & { size: NonNullable; rightAlign: NonNullable; apiOptions: NonNullable; coefficient: NonNullable; answerForms: ReadonlyArray; labelText: string; linterContext: NonNullable; }; type DefaultProps = Pick; /** * The NumericInput widget is a numeric input field that supports a variety of * answer forms, including integers, decimals, fractions, and mixed numbers. * * [Jan 2025] We're currenly migrating from class-based components to functional * components. While we cannot fully migrate this component yet, we can start * by using the functional component for the rendering the UI of the widget. */ export declare class NumericInput extends React.Component implements Widget { inputRef: React.RefObject; static defaultProps: DefaultProps; focus: () => boolean; focusInputPath: () => void; blurInputPath: () => void; getInputPaths: () => ReadonlyArray>; /** * Returns the JSON representation of the prompt for this widget. * This is used by the AI to determine the prompt for the widget. */ getPromptJSON(): NumericInputPromptJSON; /** * @deprecated and likely very broken API * [LEMS-3185] do not trust serializedState */ getSerializedState(): { currentValue: string; labelText: string; size: string; coefficient: boolean; rightAlign: boolean; static: boolean; trackInteraction: (extraData?: Empty | undefined) => void; widgetId: string; widgetIndex: number; alignment: string | null | undefined; problemNum: number | null | undefined; apiOptions: Readonly unknown; showAlignmentOptions?: boolean; readOnly?: boolean; editingDisabled?: boolean; answerableCallback?: (arg1: boolean) => unknown; getAnotherHint?: () => unknown; interactionCallback?: (widgetData: { [widgetId: string]: any; }) => void; imagePlaceholder?: React.ReactNode; widgetPlaceholder?: React.ReactNode; baseElements?: { Link: React.ComponentType; }; imagePreloader?: (dimensions: import("../../types").Dimensions) => React.ReactNode; trackInteraction?: (args: { type: string; id: string; correct?: boolean; } & Partial & Partial<{ visible: number; }>) => void; customKeypad?: boolean; nativeKeypadProxy?: (blur: () => void) => import("@khanacademy/math-input").KeypadAPI; isMobile?: boolean; isMobileApp?: boolean; setDrawingAreaAvailable?: (arg1: boolean) => unknown; hintProgressColor?: string; canScrollPage?: boolean; editorChangeDelay?: number; flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale", boolean>; }> & { baseElements: NonNullable; canScrollPage: NonNullable; editorChangeDelay: NonNullable; isArticle: NonNullable; isMobile: NonNullable; isMobileApp: NonNullable; editingDisabled: NonNullable; onFocusChange: NonNullable; readOnly: NonNullable; setDrawingAreaAvailable: NonNullable; showAlignmentOptions: NonNullable; }>; keypadElement?: any; questionCompleted?: boolean; onFocus: (blurPath: import("../..").FocusPath) => void; onBlur: (blurPath: import("../..").FocusPath) => void; findWidgets: (criterion: import("../../types").FilterCriterion) => ReadonlyArray; reviewMode: boolean; showSolutions?: import("@khanacademy/perseus-core").ShowSolutions; handleUserInput: (newUserInput: PerseusNumericInputUserInput, cb?: () => void, silent?: boolean) => void; linterContext: import("@khanacademy/perseus-linter").LinterContextProps; containerSizeClass: import("../../util/sizing-utils").SizeClass; answerForms: ReadonlyArray; }; render(): React.ReactNode; } declare function getStartUserInput(): PerseusNumericInputUserInput; /** * @deprecated and likely a very broken API * [LEMS-3185] do not trust serializedState */ declare function getUserInputFromSerializedState(serializedState: any): PerseusNumericInputUserInput; export declare function findPrecision(value: number): number; export declare function findCommonFractions(value: number): { num: number; denom: number; } | undefined; declare function getCorrectUserInput(options: PerseusNumericInputWidgetOptions): PerseusNumericInputUserInput; declare const _default: { name: string; displayName: string; widget: typeof NumericInput; isLintable: true; getCorrectUserInput: typeof getCorrectUserInput; getOneCorrectAnswerFromRubric(rubric: PerseusNumericInputRubric): string | null | undefined; getStartUserInput: typeof getStartUserInput; getUserInputFromSerializedState: typeof getUserInputFromSerializedState; }; export default _default;