@khanacademy/perseus 82.1.0 → 83.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/components/sortable.d.ts +1 -1
  2. package/dist/components.d.ts +0 -2
  3. package/dist/es/index.css +2 -2
  4. package/dist/es/index.css.map +1 -1
  5. package/dist/es/index.js +88 -98
  6. package/dist/es/index.js.map +1 -1
  7. package/dist/es/strings.js +1 -1
  8. package/dist/es/strings.js.map +1 -1
  9. package/dist/index.css +2 -2
  10. package/dist/index.css.map +1 -1
  11. package/dist/index.js +89 -98
  12. package/dist/index.js.map +1 -1
  13. package/dist/question-paragraph.new.d.ts +9 -0
  14. package/dist/renderer.new.d.ts +1 -1
  15. package/dist/renderer.old.d.ts +1 -1
  16. package/dist/strings.d.ts +6 -0
  17. package/dist/strings.js +1 -1
  18. package/dist/strings.js.map +1 -1
  19. package/dist/styles/constants.d.ts +2 -7
  20. package/dist/util.d.ts +23 -0
  21. package/dist/widget-ai-utils/input-number/input-number-ai-utils.d.ts +1 -1
  22. package/dist/widget-ai-utils/numeric-input/prompt-utils.d.ts +1 -1
  23. package/dist/{widget-container.d.ts → widget-container.new.d.ts} +5 -0
  24. package/dist/widget-container.old.d.ts +31 -0
  25. package/dist/widgets/categorizer/categorizer.d.ts +63 -8
  26. package/dist/widgets/cs-program/cs-program.d.ts +1 -2
  27. package/dist/widgets/dropdown/dropdown.d.ts +1 -2
  28. package/dist/widgets/image/image.d.ts +1 -2
  29. package/dist/widgets/input-number/input-number.d.ts +60 -4
  30. package/dist/widgets/interaction/interaction.d.ts +2 -2
  31. package/dist/widgets/matcher/matcher.d.ts +66 -32
  32. package/dist/widgets/measurer/measurer.d.ts +1 -4
  33. package/dist/widgets/number-line/number-line.d.ts +1 -4
  34. package/dist/widgets/numeric-input/index.d.ts +1 -1
  35. package/dist/widgets/numeric-input/numeric-input.d.ts +76 -53
  36. package/dist/widgets/numeric-input/utils.d.ts +14 -1
  37. package/dist/widgets/phet-simulation/phet-simulation.d.ts +2 -0
  38. package/dist/widgets/table/table.d.ts +17 -56
  39. package/package.json +12 -11
  40. package/dist/components/info-tip/index.d.ts +0 -19
  41. package/dist/components/info-tip/info-tip-base.d.ts +0 -6
  42. package/dist/components/text-list-editor.d.ts +0 -15
  43. package/dist/widgets/numeric-input/numeric-input.class.d.ts +0 -127
@@ -1,11 +1,12 @@
1
1
  import * as React from "react";
2
- import type { Focusable } from "../../types";
2
+ import { getCorrectUserInput, getOneCorrectAnswerFromRubric, getStartUserInput, getUserInputFromSerializedState } from "./utils";
3
+ import type { Widget } from "../../types";
4
+ import type { PerseusNumericInputUserInput, PerseusNumericInputWidgetOptions } from "@khanacademy/perseus-core";
3
5
  /**
4
- * The NumericInputComponent is a child component of the NumericInput class
5
- * component. It is responsible for rendering the UI elements of the Numeric
6
- * Input widget.
6
+ * The NumericInput widget is a numeric input field that supports a variety of
7
+ * answer forms, including integers, decimals, fractions, and mixed numbers.
7
8
  */
8
- export declare const NumericInputComponent: React.ForwardRefExoticComponent<import("@khanacademy/perseus-core").PerseusNumericInputWidgetOptions & {
9
+ export declare const NumericInput: React.ForwardRefExoticComponent<PerseusNumericInputWidgetOptions & {
9
10
  trackInteraction: (extraData?: Empty | undefined) => void;
10
11
  widgetId: string;
11
12
  widgetIndex: number;
@@ -57,53 +58,75 @@ export declare const NumericInputComponent: React.ForwardRefExoticComponent<impo
57
58
  findWidgets: import("../../types").FindWidgetsFunction;
58
59
  reviewMode: boolean;
59
60
  showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
60
- handleUserInput: (newUserInput: import("@khanacademy/perseus-core").PerseusNumericInputUserInput, cb?: () => void, silent?: boolean) => void;
61
- userInput: import("@khanacademy/perseus-core").PerseusNumericInputUserInput;
61
+ handleUserInput: (newUserInput: PerseusNumericInputUserInput, cb?: () => void, silent?: boolean) => void;
62
+ userInput: PerseusNumericInputUserInput;
62
63
  linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
63
64
  containerSizeClass: import("../../util/sizing-utils").SizeClass;
64
- } & {
65
- size: NonNullable<string>;
66
- textAlign: NonNullable<"center" | "left" | "right">;
67
- apiOptions: NonNullable<Readonly<Readonly<{
68
- isArticle?: boolean;
69
- onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
70
- showAlignmentOptions?: boolean;
71
- readOnly?: boolean;
72
- editingDisabled?: boolean;
73
- answerableCallback?: (arg1: boolean) => unknown;
74
- getAnotherHint?: () => unknown;
75
- interactionCallback?: (widgetData: {
76
- [widgetId: string]: any;
77
- }) => void;
78
- imagePlaceholder?: React.ReactNode;
79
- widgetPlaceholder?: React.ReactNode;
80
- baseElements?: {
81
- Link: React.ComponentType<any>;
82
- };
83
- trackInteraction?: (args: {
84
- type: string;
85
- id: string;
86
- correct?: boolean;
87
- } & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
88
- visible: number;
89
- }>) => void;
90
- customKeypad?: boolean;
91
- isMobile?: boolean;
92
- isMobileApp?: boolean;
93
- hintProgressColor?: string;
94
- flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator", boolean>;
95
- }> & {
96
- baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
97
- isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
98
- isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
99
- isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
100
- editingDisabled: NonNullable<import("../..").APIOptions["editingDisabled"]>;
101
- onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
102
- readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
103
- showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
104
- }>>;
105
- coefficient: NonNullable<boolean>;
106
- answerForms: ReadonlyArray<import("@khanacademy/perseus-core").PerseusNumericInputAnswerForm>;
107
- labelText: string;
108
- linterContext: NonNullable<import("@khanacademy/perseus-linter").LinterContextProps>;
109
- } & React.RefAttributes<Focusable>>;
65
+ } & React.RefAttributes<Widget>>;
66
+ declare const _default: {
67
+ name: string;
68
+ displayName: string;
69
+ widget: React.ForwardRefExoticComponent<PerseusNumericInputWidgetOptions & {
70
+ trackInteraction: (extraData?: Empty | undefined) => void;
71
+ widgetId: string;
72
+ widgetIndex: number;
73
+ alignment: string | null | undefined;
74
+ static: boolean | null | undefined;
75
+ graded?: boolean | null;
76
+ problemNum: number | null | undefined;
77
+ apiOptions: Readonly<Readonly<{
78
+ isArticle?: boolean;
79
+ onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
80
+ showAlignmentOptions?: boolean;
81
+ readOnly?: boolean;
82
+ editingDisabled?: boolean;
83
+ answerableCallback?: (arg1: boolean) => unknown;
84
+ getAnotherHint?: () => unknown;
85
+ interactionCallback?: (widgetData: {
86
+ [widgetId: string]: any;
87
+ }) => void;
88
+ imagePlaceholder?: React.ReactNode;
89
+ widgetPlaceholder?: React.ReactNode;
90
+ baseElements?: {
91
+ Link: React.ComponentType<any>;
92
+ };
93
+ trackInteraction?: (args: {
94
+ type: string;
95
+ id: string;
96
+ correct?: boolean;
97
+ } & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
98
+ visible: number;
99
+ }>) => void;
100
+ customKeypad?: boolean;
101
+ isMobile?: boolean;
102
+ isMobileApp?: boolean;
103
+ hintProgressColor?: string;
104
+ flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator", boolean>;
105
+ }> & {
106
+ baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
107
+ isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
108
+ isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
109
+ isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
110
+ editingDisabled: NonNullable<import("../..").APIOptions["editingDisabled"]>;
111
+ onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
112
+ readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
113
+ showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
114
+ }>;
115
+ keypadElement?: any;
116
+ onFocus: (blurPath: import("../..").FocusPath) => void;
117
+ onBlur: (blurPath: import("../..").FocusPath) => void;
118
+ findWidgets: import("../../types").FindWidgetsFunction;
119
+ reviewMode: boolean;
120
+ showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
121
+ handleUserInput: (newUserInput: PerseusNumericInputUserInput, cb?: () => void, silent?: boolean) => void;
122
+ userInput: PerseusNumericInputUserInput;
123
+ linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
124
+ containerSizeClass: import("../../util/sizing-utils").SizeClass;
125
+ } & React.RefAttributes<Widget>>;
126
+ isLintable: true;
127
+ getCorrectUserInput: typeof getCorrectUserInput;
128
+ getOneCorrectAnswerFromRubric: typeof getOneCorrectAnswerFromRubric;
129
+ getStartUserInput: typeof getStartUserInput;
130
+ getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
131
+ };
132
+ export default _default;
@@ -1,5 +1,5 @@
1
1
  import type { PerseusStrings } from "../../strings";
2
- import type { PerseusNumericInputAnswerForm, PerseusNumericInputWidgetOptions } from "@khanacademy/perseus-core";
2
+ import type { PerseusNumericInputAnswerForm, PerseusNumericInputRubric, PerseusNumericInputUserInput, PerseusNumericInputWidgetOptions } from "@khanacademy/perseus-core";
3
3
  /**
4
4
  * Generates the specific set of examples for the current question.
5
5
  * This string is shown as examples to the user in a tooltip.
@@ -21,3 +21,16 @@ export declare const unionAnswerForms: (answerFormsList: ReadonlyArray<ReadonlyA
21
21
  * so that we can generate the examples for the widget.
22
22
  */
23
23
  export declare function normalizeCorrectAnswerForms(answers: PerseusNumericInputWidgetOptions["answers"]): ReadonlyArray<PerseusNumericInputAnswerForm>;
24
+ export declare function getStartUserInput(): PerseusNumericInputUserInput;
25
+ /**
26
+ * @deprecated and likely a very broken API
27
+ * [LEMS-3185] do not trust serializedState
28
+ */
29
+ export declare function getUserInputFromSerializedState(serializedState: any): PerseusNumericInputUserInput;
30
+ export declare function findPrecision(value: number): number;
31
+ export declare function findCommonFractions(value: number): {
32
+ num: number;
33
+ denom: number;
34
+ } | undefined;
35
+ export declare function getCorrectUserInput(options: PerseusNumericInputWidgetOptions): PerseusNumericInputUserInput;
36
+ export declare function getOneCorrectAnswerFromRubric(rubric: PerseusNumericInputRubric): string | null | undefined;
@@ -48,6 +48,8 @@ export declare class PhetSimulation extends React.Component<Props, State> implem
48
48
  * the lack of support for the Fullscreen API.
49
49
  */
50
50
  toggleFullScreen: () => void;
51
+ requestIframeFullscreen: () => void;
52
+ renderCornerButton(url: URL, isMobileApp: boolean | undefined): React.ReactNode;
51
53
  render(): React.ReactNode;
52
54
  }
53
55
  declare const _default: {
@@ -1,49 +1,22 @@
1
- import * as React from "react";
2
- import ReactDOM from "react-dom";
3
- import { PerseusI18nContext } from "../../components/i18n-context";
4
- import type { FocusPath, Widget, WidgetProps } from "../../types";
1
+ import React from "react";
2
+ import type { FocusPath, Widget } from "../../types";
5
3
  import type { PerseusTableWidgetOptions, PerseusTableUserInput } from "@khanacademy/perseus-core";
6
4
  type EditorProps = {
7
- editableHeaders: boolean;
5
+ editableHeaders?: boolean;
8
6
  Editor: any;
9
- onChange: (headers: PerseusTableWidgetOptions["headers"]) => void;
10
- };
11
- type Props = WidgetProps<PerseusTableWidgetOptions, PerseusTableUserInput> & EditorProps;
12
- type DefaultProps = {
13
- apiOptions: Props["apiOptions"];
14
- headers: Props["headers"];
15
- editableHeaders: Props["editableHeaders"];
16
- rows: Props["rows"];
17
- columns: Props["columns"];
18
- linterContext: Props["linterContext"];
19
- };
20
- declare class Table extends React.Component<Props> implements Widget {
21
- static contextType: React.Context<import("../../components/i18n-context").I18nContextType>;
22
- context: React.ContextType<typeof PerseusI18nContext>;
23
- headerRefs: Record<string, any>;
24
- answerRefs: Record<string, any>;
25
- static defaultProps: DefaultProps;
26
- _getRows(): number;
27
- _getColumns(): number;
28
- _getAnswersClone(): PerseusTableUserInput;
29
- onValueChange(row: number, column: number, eventOrValue: any): void;
30
- onHeaderChange(index: number, e: any): void;
31
- _handleFocus(inputPath: any): void;
32
- _handleBlur(inputPath: any): void;
33
- focus(): boolean;
34
- focusInputPath(path: FocusPath): void;
35
- blurInputPath(path: FocusPath): void;
36
- getDOMNodeForPath(path: FocusPath): ReturnType<typeof ReactDOM.findDOMNode>;
37
- getInputPaths(): string[][];
38
- /**
39
- * @deprecated and likely very broken API
40
- * [LEMS-3185] do not trust serializedState
41
- */
42
- getSerializedState(): {
43
- answers: PerseusTableUserInput;
7
+ onChange: (value: {
44
8
  headers: string[];
45
- rows: number;
46
- columns: number;
9
+ }) => void;
10
+ };
11
+ declare function getStartUserInput(options: PerseusTableWidgetOptions): PerseusTableUserInput;
12
+ /**
13
+ * @deprecated - do not use in new code.
14
+ */
15
+ declare function getUserInputFromSerializedState(serializedState: any): PerseusTableUserInput;
16
+ declare const _default: {
17
+ name: string;
18
+ displayName: string;
19
+ widget: React.ForwardRefExoticComponent<PerseusTableWidgetOptions & {
47
20
  trackInteraction: (extraData?: Empty | undefined) => void;
48
21
  widgetId: string;
49
22
  widgetIndex: number;
@@ -96,22 +69,10 @@ declare class Table extends React.Component<Props> implements Widget {
96
69
  reviewMode: boolean;
97
70
  showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
98
71
  handleUserInput: (newUserInput: PerseusTableUserInput, cb?: () => void, silent?: boolean) => void;
72
+ userInput: PerseusTableUserInput;
99
73
  linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
100
74
  containerSizeClass: import("../../util/sizing-utils").SizeClass;
101
- Editor: any;
102
- onChange: (headers: PerseusTableWidgetOptions["headers"]) => void;
103
- };
104
- render(): React.ReactNode;
105
- }
106
- declare function getStartUserInput(options: PerseusTableWidgetOptions): PerseusTableUserInput;
107
- /**
108
- * @deprecated - do not use in new code.
109
- */
110
- declare function getUserInputFromSerializedState(serializedState: any): PerseusTableUserInput;
111
- declare const _default: {
112
- name: string;
113
- displayName: string;
114
- widget: typeof Table;
75
+ } & EditorProps & React.RefAttributes<Widget>>;
115
76
  hidden: true;
116
77
  isLintable: true;
117
78
  getStartUserInput: typeof getStartUserInput;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Core Perseus API (includes renderers and widgets)",
4
4
  "author": "Khan Academy",
5
5
  "license": "MIT",
6
- "version": "82.1.0",
6
+ "version": "83.0.0",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -37,18 +37,19 @@
37
37
  "dist"
38
38
  ],
39
39
  "dependencies": {
40
+ "@dnd-kit/react": "^0.5.0",
40
41
  "@use-gesture/react": "^10.2.27",
41
42
  "gifuct-js": "^2.1.2",
42
43
  "mafs": "0.19.0",
43
44
  "tiny-invariant": "1.3.1",
44
45
  "uuid": "^10.0.0",
45
- "@khanacademy/kas": "2.2.3",
46
- "@khanacademy/keypad-context": "3.2.77",
47
- "@khanacademy/kmath": "2.4.36",
48
- "@khanacademy/math-input": "26.6.6",
49
- "@khanacademy/perseus-core": "33.0.1",
50
- "@khanacademy/perseus-linter": "5.1.17",
51
- "@khanacademy/perseus-score": "8.12.9",
46
+ "@khanacademy/kas": "2.2.5",
47
+ "@khanacademy/keypad-context": "3.2.79",
48
+ "@khanacademy/kmath": "2.4.38",
49
+ "@khanacademy/math-input": "26.6.8",
50
+ "@khanacademy/perseus-core": "34.0.1",
51
+ "@khanacademy/perseus-linter": "5.1.19",
52
+ "@khanacademy/perseus-score": "8.12.11",
52
53
  "@khanacademy/perseus-utils": "2.1.5",
53
54
  "@khanacademy/pure-markdown": "2.3.1",
54
55
  "@khanacademy/simple-markdown": "3.0.0"
@@ -59,7 +60,7 @@
59
60
  "@khanacademy/wonder-blocks-button": "11.7.6",
60
61
  "@khanacademy/wonder-blocks-clickable": "8.2.8",
61
62
  "@khanacademy/wonder-blocks-core": "12.4.4",
62
- "@khanacademy/wonder-blocks-data": "15.0.2",
63
+ "@khanacademy/wonder-blocks-data": "15.0.3",
63
64
  "@khanacademy/wonder-blocks-dropdown": "10.11.7",
64
65
  "@khanacademy/wonder-blocks-form": "7.6.9",
65
66
  "@khanacademy/wonder-blocks-icon": "5.3.22",
@@ -96,7 +97,7 @@
96
97
  "@khanacademy/wonder-blocks-button": "^11.7.6",
97
98
  "@khanacademy/wonder-blocks-clickable": "^8.2.8",
98
99
  "@khanacademy/wonder-blocks-core": "^12.4.4",
99
- "@khanacademy/wonder-blocks-data": "^15.0.2",
100
+ "@khanacademy/wonder-blocks-data": "^15.0.3",
100
101
  "@khanacademy/wonder-blocks-dropdown": "^10.11.7",
101
102
  "@khanacademy/wonder-blocks-form": "^7.6.9",
102
103
  "@khanacademy/wonder-blocks-icon": "^5.3.22",
@@ -127,7 +128,7 @@
127
128
  },
128
129
  "keywords": [],
129
130
  "khan": {
130
- "catalogHash": "ad217163f04bf0b2"
131
+ "catalogHash": "3f4a3330f0a56ab9"
131
132
  },
132
133
  "scripts": {}
133
134
  }
@@ -1,19 +0,0 @@
1
- /**
2
- * A wrapper around info-tip/info-tip.jsx that can be rendered on the
3
- * server without causing a checksum mismatch on the client.
4
- * (RCSS generates classnames with a randomSuffix, which ensures that any
5
- * two sets of generated classnames will not match.)
6
- */
7
- import * as React from "react";
8
- import InfoTipBase from "./info-tip-base";
9
- import type { PropsFor } from "@khanacademy/wonder-blocks-core";
10
- type Props = PropsFor<typeof InfoTipBase>;
11
- type State = {
12
- didMount: boolean;
13
- };
14
- declare class InfoTip extends React.Component<Props, State> {
15
- state: State;
16
- componentDidMount(): void;
17
- render(): React.ReactNode;
18
- }
19
- export default InfoTip;
@@ -1,6 +0,0 @@
1
- import * as React from "react";
2
- type Props = {
3
- children: React.ReactNode;
4
- };
5
- declare const InfoTipBase: (props: Props) => React.JSX.Element;
6
- export default InfoTipBase;
@@ -1,15 +0,0 @@
1
- import * as React from "react";
2
- declare class TextListEditor extends React.Component<any, any> {
3
- static propTypes: {
4
- options: any;
5
- layout: any;
6
- onChange: any;
7
- };
8
- static defaultProps: any;
9
- state: any;
10
- UNSAFE_componentWillReceiveProps(nextProps: any): void;
11
- onChange: (arg1: number, arg2: React.ChangeEvent<HTMLInputElement>) => void;
12
- onKeyDown: (arg1: number, arg2: React.KeyboardEvent) => void;
13
- render(): React.ReactNode;
14
- }
15
- export default TextListEditor;
@@ -1,127 +0,0 @@
1
- import * as React from "react";
2
- import type { Focusable, Widget, WidgetProps } from "../../types";
3
- import type { NumericInputPromptJSON } from "../../widget-ai-utils/numeric-input/prompt-utils";
4
- import type { PerseusNumericInputAnswerForm, PerseusNumericInputRubric, PerseusNumericInputUserInput, PerseusNumericInputWidgetOptions } from "@khanacademy/perseus-core";
5
- type ExternalProps = WidgetProps<PerseusNumericInputWidgetOptions, PerseusNumericInputUserInput>;
6
- export type NumericInputProps = ExternalProps & {
7
- size: NonNullable<ExternalProps["size"]>;
8
- textAlign: NonNullable<ExternalProps["textAlign"]>;
9
- apiOptions: NonNullable<ExternalProps["apiOptions"]>;
10
- coefficient: NonNullable<ExternalProps["coefficient"]>;
11
- answerForms: ReadonlyArray<PerseusNumericInputAnswerForm>;
12
- labelText: string;
13
- linterContext: NonNullable<ExternalProps["linterContext"]>;
14
- };
15
- type DefaultProps = Pick<NumericInputProps, "size" | "apiOptions" | "coefficient" | "answerForms" | "labelText" | "linterContext" | "userInput">;
16
- /**
17
- * The NumericInput widget is a numeric input field that supports a variety of
18
- * answer forms, including integers, decimals, fractions, and mixed numbers.
19
- *
20
- * [Jan 2025] We're currenly migrating from class-based components to functional
21
- * components. While we cannot fully migrate this component yet, we can start
22
- * by using the functional component for the rendering the UI of the widget.
23
- */
24
- export declare class NumericInput extends React.Component<NumericInputProps> implements Widget {
25
- inputRef: React.RefObject<Focusable>;
26
- static defaultProps: DefaultProps;
27
- focus: () => boolean;
28
- blur: () => void;
29
- focusInputPath: () => void;
30
- blurInputPath: () => void;
31
- getInputPaths: () => ReadonlyArray<ReadonlyArray<string>>;
32
- /**
33
- * Returns the JSON representation of the prompt for this widget.
34
- * This is used by the AI to determine the prompt for the widget.
35
- */
36
- getPromptJSON(): NumericInputPromptJSON;
37
- /**
38
- * @deprecated and likely very broken API
39
- * [LEMS-3185] do not trust serializedState
40
- */
41
- getSerializedState(): {
42
- currentValue: string;
43
- labelText: string;
44
- size: string;
45
- coefficient: boolean;
46
- textAlign: "left" | "right" | "center";
47
- trackInteraction: (extraData?: Empty | undefined) => void;
48
- widgetId: string;
49
- widgetIndex: number;
50
- alignment: string | null | undefined;
51
- static: boolean | null | undefined;
52
- graded?: boolean | null;
53
- problemNum: number | null | undefined;
54
- apiOptions: Readonly<Readonly<{
55
- isArticle?: boolean;
56
- onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
57
- showAlignmentOptions?: boolean;
58
- readOnly?: boolean;
59
- editingDisabled?: boolean;
60
- answerableCallback?: (arg1: boolean) => unknown;
61
- getAnotherHint?: () => unknown;
62
- interactionCallback?: (widgetData: {
63
- [widgetId: string]: any;
64
- }) => void;
65
- imagePlaceholder?: React.ReactNode;
66
- widgetPlaceholder?: React.ReactNode;
67
- baseElements?: {
68
- Link: React.ComponentType<any>;
69
- };
70
- trackInteraction?: (args: {
71
- type: string;
72
- id: string;
73
- correct?: boolean;
74
- } & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
75
- visible: number;
76
- }>) => void;
77
- customKeypad?: boolean;
78
- isMobile?: boolean;
79
- isMobileApp?: boolean;
80
- hintProgressColor?: string;
81
- flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator", boolean>;
82
- }> & {
83
- baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
84
- isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
85
- isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
86
- isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
87
- editingDisabled: NonNullable<import("../..").APIOptions["editingDisabled"]>;
88
- onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
89
- readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
90
- showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
91
- }>;
92
- keypadElement?: any;
93
- onFocus: (blurPath: import("../..").FocusPath) => void;
94
- onBlur: (blurPath: import("../..").FocusPath) => void;
95
- findWidgets: import("../../types").FindWidgetsFunction;
96
- reviewMode: boolean;
97
- showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
98
- handleUserInput: (newUserInput: PerseusNumericInputUserInput, cb?: () => void, silent?: boolean) => void;
99
- linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
100
- containerSizeClass: import("../../util/sizing-utils").SizeClass;
101
- answerForms: ReadonlyArray<PerseusNumericInputAnswerForm>;
102
- };
103
- render(): React.ReactNode;
104
- }
105
- declare function getStartUserInput(): PerseusNumericInputUserInput;
106
- /**
107
- * @deprecated and likely a very broken API
108
- * [LEMS-3185] do not trust serializedState
109
- */
110
- declare function getUserInputFromSerializedState(serializedState: any): PerseusNumericInputUserInput;
111
- export declare function findPrecision(value: number): number;
112
- export declare function findCommonFractions(value: number): {
113
- num: number;
114
- denom: number;
115
- } | undefined;
116
- declare function getCorrectUserInput(options: PerseusNumericInputWidgetOptions): PerseusNumericInputUserInput;
117
- declare const _default: {
118
- name: string;
119
- displayName: string;
120
- widget: typeof NumericInput;
121
- isLintable: true;
122
- getCorrectUserInput: typeof getCorrectUserInput;
123
- getOneCorrectAnswerFromRubric(rubric: PerseusNumericInputRubric): string | null | undefined;
124
- getStartUserInput: typeof getStartUserInput;
125
- getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
126
- };
127
- export default _default;