@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.
- package/dist/components/sortable.d.ts +1 -1
- package/dist/components.d.ts +0 -2
- package/dist/es/index.css +2 -2
- package/dist/es/index.css.map +1 -1
- package/dist/es/index.js +88 -98
- package/dist/es/index.js.map +1 -1
- package/dist/es/strings.js +1 -1
- package/dist/es/strings.js.map +1 -1
- package/dist/index.css +2 -2
- package/dist/index.css.map +1 -1
- package/dist/index.js +89 -98
- package/dist/index.js.map +1 -1
- package/dist/question-paragraph.new.d.ts +9 -0
- package/dist/renderer.new.d.ts +1 -1
- package/dist/renderer.old.d.ts +1 -1
- package/dist/strings.d.ts +6 -0
- package/dist/strings.js +1 -1
- package/dist/strings.js.map +1 -1
- package/dist/styles/constants.d.ts +2 -7
- package/dist/util.d.ts +23 -0
- package/dist/widget-ai-utils/input-number/input-number-ai-utils.d.ts +1 -1
- package/dist/widget-ai-utils/numeric-input/prompt-utils.d.ts +1 -1
- package/dist/{widget-container.d.ts → widget-container.new.d.ts} +5 -0
- package/dist/widget-container.old.d.ts +31 -0
- package/dist/widgets/categorizer/categorizer.d.ts +63 -8
- package/dist/widgets/cs-program/cs-program.d.ts +1 -2
- package/dist/widgets/dropdown/dropdown.d.ts +1 -2
- package/dist/widgets/image/image.d.ts +1 -2
- package/dist/widgets/input-number/input-number.d.ts +60 -4
- package/dist/widgets/interaction/interaction.d.ts +2 -2
- package/dist/widgets/matcher/matcher.d.ts +66 -32
- package/dist/widgets/measurer/measurer.d.ts +1 -4
- package/dist/widgets/number-line/number-line.d.ts +1 -4
- package/dist/widgets/numeric-input/index.d.ts +1 -1
- package/dist/widgets/numeric-input/numeric-input.d.ts +76 -53
- package/dist/widgets/numeric-input/utils.d.ts +14 -1
- package/dist/widgets/phet-simulation/phet-simulation.d.ts +2 -0
- package/dist/widgets/table/table.d.ts +17 -56
- package/package.json +12 -11
- package/dist/components/info-tip/index.d.ts +0 -19
- package/dist/components/info-tip/info-tip-base.d.ts +0 -6
- package/dist/components/text-list-editor.d.ts +0 -15
- 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
|
|
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
|
|
5
|
-
*
|
|
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
|
|
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:
|
|
61
|
-
userInput:
|
|
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
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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
|
|
2
|
-
import
|
|
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
|
|
5
|
+
editableHeaders?: boolean;
|
|
8
6
|
Editor: any;
|
|
9
|
-
onChange: (
|
|
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
|
-
|
|
46
|
-
|
|
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
|
-
|
|
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": "
|
|
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.
|
|
46
|
-
"@khanacademy/keypad-context": "3.2.
|
|
47
|
-
"@khanacademy/kmath": "2.4.
|
|
48
|
-
"@khanacademy/math-input": "26.6.
|
|
49
|
-
"@khanacademy/perseus-core": "
|
|
50
|
-
"@khanacademy/perseus-linter": "5.1.
|
|
51
|
-
"@khanacademy/perseus-score": "8.12.
|
|
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.
|
|
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.
|
|
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": "
|
|
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,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;
|