@khanacademy/perseus 66.4.0 → 66.5.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/es/index.css +3 -3
- package/dist/es/index.css.map +1 -1
- package/dist/es/index.js +7 -7
- package/dist/es/index.js.map +1 -1
- package/dist/index.css +3 -3
- package/dist/index.css.map +1 -1
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/widgets/interactive-graphs/interactive-graph.d.ts +3 -13
- package/dist/widgets/numeric-input/numeric-input.class.d.ts +0 -10
- package/dist/widgets/numeric-input/utils.d.ts +6 -1
- package/dist/widgets/radio/choice-indicator.new.d.ts +10 -4
- package/dist/widgets/radio/choice.new.d.ts +2 -1
- package/dist/widgets/radio/multiple-choice-component.new.d.ts +13 -1
- package/package.json +7 -7
|
@@ -6,7 +6,7 @@ import type { WidgetProps } from "../../types";
|
|
|
6
6
|
import type { InteractiveGraphPromptJSON } from "../../widget-ai-utils/interactive-graph/interactive-graph-ai-utils";
|
|
7
7
|
import type { UnsupportedWidgetPromptJSON } from "../../widget-ai-utils/unsupported-widget";
|
|
8
8
|
import type { QuadraticCoefficient, SineCoefficient, Range } from "@khanacademy/kmath";
|
|
9
|
-
import type { PerseusGraphType, PerseusGraphTypeAngle, PerseusGraphTypePoint, PerseusGraphTypeSegment, PerseusInteractiveGraphWidgetOptions, GraphRange, InteractiveGraphPublicWidgetOptions, LockedFigure, PerseusImageBackground, MarkingsType, PerseusInteractiveGraphUserInput, AxisLabelLocation } from "@khanacademy/perseus-core";
|
|
9
|
+
import type { PerseusGraphType, PerseusGraphTypeAngle, PerseusGraphTypePoint, PerseusGraphTypeSegment, PerseusInteractiveGraphWidgetOptions, GraphRange, InteractiveGraphPublicWidgetOptions, LockedFigure, PerseusImageBackground, MarkingsType, PerseusInteractiveGraphUserInput, AxisLabelLocation, ShowAxisArrows } from "@khanacademy/perseus-core";
|
|
10
10
|
type RenderProps = {
|
|
11
11
|
/**
|
|
12
12
|
* Where the little black axis lines & labels (ticks) should render.
|
|
@@ -87,12 +87,7 @@ type RenderProps = {
|
|
|
87
87
|
/**
|
|
88
88
|
* Whether to show the arrows on the axis.
|
|
89
89
|
*/
|
|
90
|
-
showAxisArrows:
|
|
91
|
-
xMin: boolean;
|
|
92
|
-
xMax: boolean;
|
|
93
|
-
yMin: boolean;
|
|
94
|
-
yMax: boolean;
|
|
95
|
-
};
|
|
90
|
+
showAxisArrows: ShowAxisArrows;
|
|
96
91
|
/**
|
|
97
92
|
* The type of graph
|
|
98
93
|
*/
|
|
@@ -153,12 +148,7 @@ declare class InteractiveGraph extends React.Component<Props, State> {
|
|
|
153
148
|
rulerLabel?: string;
|
|
154
149
|
rulerTicks?: number;
|
|
155
150
|
range: GraphRange;
|
|
156
|
-
showAxisArrows:
|
|
157
|
-
xMin: boolean;
|
|
158
|
-
xMax: boolean;
|
|
159
|
-
yMin: boolean;
|
|
160
|
-
yMax: boolean;
|
|
161
|
-
};
|
|
151
|
+
showAxisArrows: ShowAxisArrows;
|
|
162
152
|
correct?: PerseusGraphType;
|
|
163
153
|
lockedFigures: LockedFigure[];
|
|
164
154
|
fullGraphAriaLabel?: string;
|
|
@@ -13,14 +13,6 @@ export type NumericInputProps = ExternalProps & {
|
|
|
13
13
|
linterContext: NonNullable<ExternalProps["linterContext"]>;
|
|
14
14
|
};
|
|
15
15
|
type DefaultProps = Pick<NumericInputProps, "size" | "rightAlign" | "apiOptions" | "coefficient" | "answerForms" | "labelText" | "linterContext" | "userInput">;
|
|
16
|
-
type RenderProps = {
|
|
17
|
-
answerForms: ReadonlyArray<PerseusNumericInputAnswerForm>;
|
|
18
|
-
labelText?: string;
|
|
19
|
-
size: string;
|
|
20
|
-
coefficient: boolean;
|
|
21
|
-
rightAlign?: boolean;
|
|
22
|
-
static: boolean;
|
|
23
|
-
};
|
|
24
16
|
/**
|
|
25
17
|
* The NumericInput widget is a numeric input field that supports a variety of
|
|
26
18
|
* answer forms, including integers, decimals, fractions, and mixed numbers.
|
|
@@ -47,7 +39,6 @@ export declare class NumericInput extends React.Component<NumericInputProps> imp
|
|
|
47
39
|
*/
|
|
48
40
|
getSerializedState(): {
|
|
49
41
|
currentValue: string;
|
|
50
|
-
answers: import("@khanacademy/perseus-core").PerseusNumericInputAnswer[];
|
|
51
42
|
labelText: string;
|
|
52
43
|
size: string;
|
|
53
44
|
coefficient: boolean;
|
|
@@ -132,7 +123,6 @@ declare const _default: {
|
|
|
132
123
|
name: string;
|
|
133
124
|
displayName: string;
|
|
134
125
|
widget: typeof NumericInput;
|
|
135
|
-
transform: (widgetOptions: PerseusNumericInputWidgetOptions) => RenderProps;
|
|
136
126
|
isLintable: true;
|
|
137
127
|
getOneCorrectAnswerFromRubric(rubric: PerseusNumericInputRubric): string | null | undefined;
|
|
138
128
|
getStartUserInput: typeof getStartUserInput;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PerseusStrings } from "../../strings";
|
|
2
|
-
import type { PerseusNumericInputAnswerForm } from "@khanacademy/perseus-core";
|
|
2
|
+
import type { PerseusNumericInputAnswerForm, PerseusNumericInputWidgetOptions } from "@khanacademy/perseus-core";
|
|
3
3
|
/**
|
|
4
4
|
* The full list of available strings for the numeric input widget,
|
|
5
5
|
* based on whether the Content Creator has specified that the answer must be simplified.
|
|
@@ -23,3 +23,8 @@ export declare const shouldShowExamples: (answerForms: readonly PerseusNumericIn
|
|
|
23
23
|
* `formExamples` forms from above.
|
|
24
24
|
*/
|
|
25
25
|
export declare const unionAnswerForms: (answerFormsList: ReadonlyArray<ReadonlyArray<PerseusNumericInputAnswerForm>>) => ReadonlyArray<PerseusNumericInputAnswerForm>;
|
|
26
|
+
/**
|
|
27
|
+
* Filter out the correct answers and map them to the answer forms
|
|
28
|
+
* so that we can generate the examples for the widget.
|
|
29
|
+
*/
|
|
30
|
+
export declare function normalizeCorrectAnswerForms(answers: PerseusNumericInputWidgetOptions["answers"]): ReadonlyArray<PerseusNumericInputAnswerForm>;
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
export
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface IndicatorContent {
|
|
3
|
+
visible: string;
|
|
4
|
+
screenReader: string;
|
|
5
|
+
labelledBy?: string;
|
|
6
|
+
describedBy?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface IndicatorProps {
|
|
3
9
|
buttonRef: React.Ref<HTMLButtonElement>;
|
|
4
10
|
checked: boolean;
|
|
5
|
-
content:
|
|
11
|
+
content: IndicatorContent;
|
|
6
12
|
shape: "circle" | "square";
|
|
7
13
|
showCorrectness?: "correct" | "wrong";
|
|
8
14
|
updateChecked: (isChecked: boolean) => void;
|
|
9
|
-
}
|
|
15
|
+
}
|
|
10
16
|
declare const Indicator: (props: IndicatorProps) => React.JSX.Element;
|
|
11
17
|
export default Indicator;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import type { IndicatorContent } from "./choice-indicator.new";
|
|
2
3
|
export interface IndicatorProps {
|
|
3
4
|
checked: boolean;
|
|
4
5
|
children: React.ReactNode | React.ReactNode[];
|
|
5
|
-
indicatorContent:
|
|
6
|
+
indicatorContent: IndicatorContent;
|
|
6
7
|
isMultiSelect: boolean;
|
|
7
8
|
showCorrectness?: "correct" | "wrong";
|
|
8
9
|
updateChecked: (isChecked: boolean) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
2
|
import type { ChoiceType } from "./multiple-choice-widget.new";
|
|
3
3
|
/**
|
|
4
4
|
* Props for the MultipleChoiceComponent
|
|
@@ -20,6 +20,18 @@ export interface MultipleChoiceComponentProps {
|
|
|
20
20
|
*
|
|
21
21
|
* Supports both radio button (single select) and checkbox (multiple select) modes.
|
|
22
22
|
*
|
|
23
|
+
* NOTE: This widget does not implement standard radio button or checkbox elements.
|
|
24
|
+
* The key difference is that the single-select (aka radio button) should
|
|
25
|
+
* allow the user to deselect a choice, whereas regular radio buttons
|
|
26
|
+
* can only be deselected by selecting another choice.
|
|
27
|
+
* Another difference is that keyboard navigation with single-select is
|
|
28
|
+
* done with the tab key, whereas regular radio buttons use the arrow keys,
|
|
29
|
+
* and the radio buttons are automatically selected when navigating to them.
|
|
30
|
+
* Since interactions with the single-select version of this widget don't
|
|
31
|
+
* follow the standard radio button behavior, we decided to use toggle
|
|
32
|
+
* button semantics for both versions of the widget,
|
|
33
|
+
* and implement additional ARIA attributes where needed.
|
|
34
|
+
*
|
|
23
35
|
* Created as part of the Radio Revitalization Project (LEMS-2933).
|
|
24
36
|
*/
|
|
25
37
|
declare const MultipleChoiceComponent: ({ choices, countChoices, multipleSelect, numCorrect, onChoiceChange, reviewMode, }: MultipleChoiceComponentProps) => React.ReactElement;
|
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": "66.
|
|
6
|
+
"version": "66.5.0",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
"tiny-invariant": "1.3.1",
|
|
43
43
|
"uuid": "^10.0.0",
|
|
44
44
|
"@khanacademy/kas": "2.1.0",
|
|
45
|
-
"@khanacademy/keypad-context": "3.1.
|
|
46
|
-
"@khanacademy/kmath": "2.1.
|
|
47
|
-
"@khanacademy/math-input": "26.1.
|
|
48
|
-
"@khanacademy/perseus-core": "18.
|
|
49
|
-
"@khanacademy/perseus-linter": "4.2.
|
|
50
|
-
"@khanacademy/perseus-score": "7.6.0",
|
|
45
|
+
"@khanacademy/keypad-context": "3.1.4",
|
|
46
|
+
"@khanacademy/kmath": "2.1.4",
|
|
47
|
+
"@khanacademy/math-input": "26.1.5",
|
|
48
|
+
"@khanacademy/perseus-core": "18.7.0",
|
|
49
|
+
"@khanacademy/perseus-linter": "4.2.4",
|
|
51
50
|
"@khanacademy/perseus-utils": "2.1.0",
|
|
52
51
|
"@khanacademy/pure-markdown": "2.2.0",
|
|
52
|
+
"@khanacademy/perseus-score": "7.6.1",
|
|
53
53
|
"@khanacademy/simple-markdown": "2.1.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|