@khanacademy/perseus 66.3.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.
Files changed (35) hide show
  1. package/dist/es/index.css +3 -3
  2. package/dist/es/index.css.map +1 -1
  3. package/dist/es/index.js +25 -25
  4. package/dist/es/index.js.map +1 -1
  5. package/dist/index.css +3 -3
  6. package/dist/index.css.map +1 -1
  7. package/dist/index.js +25 -25
  8. package/dist/index.js.map +1 -1
  9. package/dist/widget-ai-utils/matrix/matrix-ai-utils.d.ts +1 -1
  10. package/dist/widgets/categorizer/categorizer.d.ts +2 -6
  11. package/dist/widgets/dropdown/dropdown.d.ts +10 -10
  12. package/dist/widgets/expression/expression.d.ts +14 -21
  13. package/dist/widgets/graded-group/graded-group.d.ts +1 -2
  14. package/dist/widgets/graded-group-set/graded-group-set.d.ts +1 -2
  15. package/dist/widgets/grapher/grapher.d.ts +2 -34
  16. package/dist/widgets/group/group.d.ts +1 -2
  17. package/dist/widgets/image/image.d.ts +1 -2
  18. package/dist/widgets/input-number/input-number.d.ts +1 -4
  19. package/dist/widgets/interactive-graphs/interactive-graph-question-builder.d.ts +7 -0
  20. package/dist/widgets/interactive-graphs/interactive-graph.d.ts +7 -2
  21. package/dist/widgets/interactive-graphs/mafs-graph.d.ts +1 -0
  22. package/dist/widgets/interactive-graphs/reducer/use-graph-config.d.ts +2 -1
  23. package/dist/widgets/interactive-graphs/stateful-mafs-graph.d.ts +1 -0
  24. package/dist/widgets/matrix/matrix.d.ts +1 -11
  25. package/dist/widgets/numeric-input/numeric-input.class.d.ts +0 -10
  26. package/dist/widgets/numeric-input/utils.d.ts +6 -1
  27. package/dist/widgets/passage/passage.d.ts +1 -8
  28. package/dist/widgets/passage-ref/passage-ref.d.ts +0 -5
  29. package/dist/widgets/passage-ref-target/passage-ref-target.d.ts +0 -1
  30. package/dist/widgets/plotter/plotter.d.ts +0 -1
  31. package/dist/widgets/radio/choice-indicator.new.d.ts +10 -4
  32. package/dist/widgets/radio/choice.new.d.ts +2 -1
  33. package/dist/widgets/radio/multiple-choice-component.new.d.ts +13 -1
  34. package/dist/widgets/video/video.d.ts +1 -2
  35. package/package.json +7 -7
@@ -7,7 +7,7 @@ export type MatrixPromptJSON = {
7
7
  width: number;
8
8
  };
9
9
  userInput: {
10
- answerRows: ReadonlyArray<ReadonlyArray<number>>;
10
+ answerRows: ReadonlyArray<ReadonlyArray<string>>;
11
11
  };
12
12
  };
13
13
  export declare const getPromptJSON: (renderProps: React.ComponentProps<typeof matrix.widget>) => MatrixPromptJSON;
@@ -2,7 +2,7 @@ import * as React from "react";
2
2
  import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import type { Widget, WidgetProps } from "../../types";
4
4
  import type { CategorizerPromptJSON } from "../../widget-ai-utils/categorizer/categorizer-ai-utils";
5
- import type { PerseusCategorizerWidgetOptions, PerseusCategorizerUserInput, CategorizerPublicWidgetOptions } from "@khanacademy/perseus-core";
5
+ import type { PerseusCategorizerWidgetOptions, PerseusCategorizerUserInput } from "@khanacademy/perseus-core";
6
6
  type Props = WidgetProps<RenderProps, PerseusCategorizerUserInput>;
7
7
  type DefaultProps = {
8
8
  items: Props["items"];
@@ -39,19 +39,15 @@ type RenderProps = {
39
39
  declare function getUserInputFromSerializedState(serializedState: any): PerseusCategorizerUserInput;
40
40
  /**
41
41
  * you need this along with _getAllWidgetsStartProps
42
- * to generate userInput for static widgets since staticTransform
43
- * used to populate correct input and now can't
42
+ * to generate userInput for static widgets
44
43
  */
45
44
  declare function getCorrectUserInput(options: PerseusCategorizerWidgetOptions): PerseusCategorizerUserInput;
46
45
  declare function getStartUserInput(): PerseusCategorizerUserInput;
47
- declare function transform(widgetOptions: CategorizerPublicWidgetOptions): RenderProps;
48
46
  declare const _default: {
49
47
  name: string;
50
48
  displayName: string;
51
49
  hidden: true;
52
50
  widget: typeof Categorizer;
53
- transform: typeof transform;
54
- staticTransform: typeof transform;
55
51
  getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
56
52
  getCorrectUserInput: typeof getCorrectUserInput;
57
53
  getStartUserInput: typeof getStartUserInput;
@@ -2,14 +2,8 @@ import * as React from "react";
2
2
  import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import type { Widget, WidgetProps } from "../../types";
4
4
  import type { DropdownPromptJSON } from "../../widget-ai-utils/dropdown/dropdown-ai-utils";
5
- import type { DropdownPublicWidgetOptions, PerseusDropdownWidgetOptions, PerseusDropdownUserInput } from "@khanacademy/perseus-core";
6
- type RenderProps = {
7
- placeholder: PerseusDropdownWidgetOptions["placeholder"];
8
- visibleLabel: PerseusDropdownWidgetOptions["visibleLabel"];
9
- ariaLabel: PerseusDropdownWidgetOptions["ariaLabel"];
10
- choices: ReadonlyArray<string>;
11
- };
12
- type Props = WidgetProps<RenderProps, PerseusDropdownUserInput>;
5
+ import type { PerseusDropdownWidgetOptions, PerseusDropdownUserInput } from "@khanacademy/perseus-core";
6
+ type Props = WidgetProps<PerseusDropdownWidgetOptions, PerseusDropdownUserInput>;
13
7
  type DefaultProps = {
14
8
  choices: Props["choices"];
15
9
  placeholder: Props["placeholder"];
@@ -29,9 +23,16 @@ declare class Dropdown extends React.Component<Props> implements Widget {
29
23
  * [LEMS-3185] do not trust serializedState/restoreSerializedState
30
24
  */
31
25
  getSerializedState(): any;
26
+ /**
27
+ * @deprecated and likely very broken API
28
+ * [LEMS-3185] do not trust serializedState/restoreSerializedState
29
+ */
30
+ restoreSerializedState(state: any): {
31
+ state: any;
32
+ choices: any;
33
+ };
32
34
  render(): React.ReactNode;
33
35
  }
34
- declare function transform(widgetOptions: DropdownPublicWidgetOptions): RenderProps;
35
36
  /**
36
37
  * @deprecated and likely a very broken API
37
38
  * [LEMS-3185] do not trust serializedState/restoreSerializedState
@@ -42,7 +43,6 @@ declare const _default: {
42
43
  name: string;
43
44
  displayName: string;
44
45
  widget: typeof Dropdown;
45
- transform: typeof transform;
46
46
  getStartUserInput: typeof getStartUserInput;
47
47
  getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
48
48
  };
@@ -3,18 +3,9 @@ import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import type { DependenciesContext } from "../../dependencies";
4
4
  import type { WidgetProps, Widget } from "../../types";
5
5
  import type { ExpressionPromptJSON } from "../../widget-ai-utils/expression/expression-ai-utils";
6
- import type { PerseusExpressionWidgetOptions, ExpressionPublicWidgetOptions, KeypadConfiguration, KeypadKey, PerseusExpressionRubric, PerseusExpressionUserInput } from "@khanacademy/perseus-core";
6
+ import type { PerseusExpressionWidgetOptions, KeypadConfiguration, KeypadKey, PerseusExpressionRubric, PerseusExpressionUserInput } from "@khanacademy/perseus-core";
7
7
  type InputPath = ReadonlyArray<string>;
8
- type RenderProps = {
9
- buttonSets: PerseusExpressionWidgetOptions["buttonSets"];
10
- buttonsVisible?: PerseusExpressionWidgetOptions["buttonsVisible"];
11
- functions: PerseusExpressionWidgetOptions["functions"];
12
- times: PerseusExpressionWidgetOptions["times"];
13
- visibleLabel: PerseusExpressionWidgetOptions["visibleLabel"];
14
- ariaLabel: PerseusExpressionWidgetOptions["ariaLabel"];
15
- keypadConfiguration: KeypadConfiguration;
16
- };
17
- type ExternalProps = WidgetProps<RenderProps, PerseusExpressionUserInput>;
8
+ type ExternalProps = WidgetProps<PerseusExpressionWidgetOptions, PerseusExpressionUserInput>;
18
9
  type Props = ExternalProps & Partial<React.ContextType<typeof DependenciesContext>> & {
19
10
  apiOptions: NonNullable<ExternalProps["apiOptions"]>;
20
11
  buttonSets: NonNullable<ExternalProps["buttonSets"]>;
@@ -55,19 +46,21 @@ export declare class Expression extends React.Component<Props> implements Widget
55
46
  blurInputPath(inputPath: InputPath): void;
56
47
  insert(keyPressed: KeypadKey): void;
57
48
  getInputPaths: () => ReadonlyArray<ReadonlyArray<any>>;
49
+ getKeypadConfiguration(): KeypadConfiguration;
58
50
  /**
59
51
  * @deprecated and likely very broken API
60
52
  * [LEMS-3185] do not trust serializedState/restoreSerializedState
61
53
  */
62
54
  getSerializedState(): {
63
55
  value: string;
64
- buttonSets: PerseusExpressionWidgetOptions["buttonSets"];
65
- buttonsVisible?: PerseusExpressionWidgetOptions["buttonsVisible"];
66
- functions: PerseusExpressionWidgetOptions["functions"];
67
- times: PerseusExpressionWidgetOptions["times"];
68
- visibleLabel: PerseusExpressionWidgetOptions["visibleLabel"];
69
- ariaLabel: PerseusExpressionWidgetOptions["ariaLabel"];
70
56
  keypadConfiguration: KeypadConfiguration;
57
+ buttonSets: import("@khanacademy/perseus-core").LegacyButtonSets;
58
+ functions: string[];
59
+ times: boolean;
60
+ extraKeys?: KeypadKey[];
61
+ visibleLabel: string;
62
+ ariaLabel: string;
63
+ buttonsVisible?: "always" | "never" | "focused";
71
64
  reviewModeRubric?: Empty | null | undefined;
72
65
  trackInteraction: (extraData?: Empty | undefined) => void;
73
66
  widgetId: string;
@@ -149,10 +142,11 @@ export declare class Expression extends React.Component<Props> implements Widget
149
142
  */
150
143
  declare function getUserInputFromSerializedState(serializedState: any): PerseusExpressionUserInput;
151
144
  declare function getStartUserInput(): PerseusExpressionUserInput;
145
+ declare function getOneCorrectAnswerFromRubric(rubric: PerseusExpressionRubric): string | null | undefined;
152
146
  declare const _default: {
153
147
  name: string;
154
148
  displayName: string;
155
- widget: React.ForwardRefExoticComponent<Omit<Pick<RenderProps & import("../../types").UniversalWidgetProps<Empty, string, Empty> & Partial<import("../..").PerseusDependenciesV2> & {
149
+ widget: React.ForwardRefExoticComponent<Omit<Pick<PerseusExpressionWidgetOptions & import("../../types").UniversalWidgetProps<Empty, string, Empty> & Partial<import("../..").PerseusDependenciesV2> & {
156
150
  apiOptions: NonNullable<ExternalProps["apiOptions"]>;
157
151
  buttonSets: NonNullable<ExternalProps["buttonSets"]>;
158
152
  functions: NonNullable<ExternalProps["functions"]>;
@@ -162,7 +156,7 @@ declare const _default: {
162
156
  times: NonNullable<ExternalProps["times"]>;
163
157
  visibleLabel: PerseusExpressionWidgetOptions["visibleLabel"];
164
158
  ariaLabel: PerseusExpressionWidgetOptions["ariaLabel"];
165
- }, "static" | "onChange" | "ariaLabel" | "buttonsVisible" | "trackInteraction" | "containerSizeClass" | "widgetId" | "problemNum" | "questionCompleted" | "findWidgets" | "keypadElement" | "isLastUsedWidget" | "handleUserInput" | "showSolutions" | "reviewMode" | "reviewModeRubric" | keyof import("../..").PerseusDependenciesV2 | "alignment" | "visibleLabel" | "keypadConfiguration"> & {
159
+ }, "static" | "onChange" | "ariaLabel" | "extraKeys" | "buttonsVisible" | "trackInteraction" | "containerSizeClass" | "widgetId" | "problemNum" | "questionCompleted" | "findWidgets" | "keypadElement" | "isLastUsedWidget" | "handleUserInput" | "showSolutions" | "reviewMode" | "reviewModeRubric" | keyof import("../..").PerseusDependenciesV2 | "alignment" | "visibleLabel" | "answerForms"> & {
166
160
  buttonSets?: import("@khanacademy/perseus-core").LegacyButtonSets | undefined;
167
161
  onFocus?: ((blurPath: import("../..").FocusPath) => void) | undefined;
168
162
  onBlur?: ((blurPath: import("../..").FocusPath) => void) | undefined;
@@ -219,10 +213,9 @@ declare const _default: {
219
213
  functions?: string[] | undefined;
220
214
  times?: boolean | undefined;
221
215
  } & {}, keyof import("../..").PerseusDependenciesV2> & React.RefAttributes<Expression>>;
222
- transform: (widgetOptions: PerseusExpressionWidgetOptions | ExpressionPublicWidgetOptions) => RenderProps;
223
216
  version: import("@khanacademy/perseus-core").Version | undefined;
224
217
  isLintable: true;
225
- getOneCorrectAnswerFromRubric(rubric: PerseusExpressionRubric): string | null | undefined;
218
+ getOneCorrectAnswerFromRubric: typeof getOneCorrectAnswerFromRubric;
226
219
  getStartUserInput: typeof getStartUserInput;
227
220
  getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
228
221
  };
@@ -11,8 +11,7 @@ declare const GRADING_STATUSES: {
11
11
  readonly incorrect: "incorrect";
12
12
  readonly invalid: "invalid";
13
13
  };
14
- type RenderProps = PerseusGradedGroupWidgetOptions;
15
- type Props = WidgetProps<RenderProps, Empty, TrackingGradedGroupExtraArguments> & {
14
+ type Props = WidgetProps<PerseusGradedGroupWidgetOptions, Empty, TrackingGradedGroupExtraArguments> & {
16
15
  inGradedGroupSet?: boolean;
17
16
  onNextQuestion?: () => unknown;
18
17
  };
@@ -3,8 +3,7 @@ import { GradedGroup } from "../graded-group/graded-group";
3
3
  import type { FocusPath, Widget, WidgetProps } from "../../types";
4
4
  import type { GradedGroupSetPromptJSON } from "../../widget-ai-utils/graded-group-set/graded-group-set-ai-utils";
5
5
  import type { PerseusGradedGroupSetWidgetOptions } from "@khanacademy/perseus-core";
6
- type RenderProps = PerseusGradedGroupSetWidgetOptions;
7
- type Props = WidgetProps<RenderProps> & {
6
+ type Props = WidgetProps<PerseusGradedGroupSetWidgetOptions> & {
8
7
  trackInteraction: () => void;
9
8
  };
10
9
  type DefaultProps = {
@@ -6,8 +6,7 @@ import type { GridDimensions } from "../../util";
6
6
  import type { GrapherPromptJSON } from "../../widget-ai-utils/grapher/grapher-ai-utils";
7
7
  import type { PerseusGrapherWidgetOptions, PerseusGrapherUserInput, GrapherPublicWidgetOptions } from "@khanacademy/perseus-core";
8
8
  import type { PropsFor } from "@khanacademy/wonder-blocks-core";
9
- type RenderProps = Pick<GrapherPublicWidgetOptions, "availableTypes" | "graph">;
10
- type Props = WidgetProps<RenderProps, PerseusGrapherUserInput>;
9
+ type Props = WidgetProps<PerseusGrapherWidgetOptions, PerseusGrapherUserInput>;
11
10
  declare class Grapher extends React.Component<Props> implements Widget {
12
11
  horizHairline: any;
13
12
  vertHairline: any;
@@ -28,6 +27,7 @@ declare class Grapher extends React.Component<Props> implements Widget {
28
27
  */
29
28
  getSerializedState(): {
30
29
  plot: import("@khanacademy/perseus-core").GrapherAnswerTypes;
30
+ availableTypes: Array<"absolute_value" | "exponential" | "linear" | "logarithm" | "quadratic" | "sinusoid" | "tangent">;
31
31
  graph: {
32
32
  backgroundImage: {
33
33
  bottom?: number;
@@ -52,7 +52,6 @@ declare class Grapher extends React.Component<Props> implements Widget {
52
52
  step: [number, number];
53
53
  valid?: boolean | string;
54
54
  };
55
- availableTypes: Array<"absolute_value" | "exponential" | "linear" | "logarithm" | "quadratic" | "sinusoid" | "tangent">;
56
55
  reviewModeRubric?: Empty | null | undefined;
57
56
  trackInteraction: (extraData?: Empty | undefined) => void;
58
57
  widgetId: string;
@@ -122,35 +121,6 @@ declare class Grapher extends React.Component<Props> implements Widget {
122
121
  };
123
122
  render(): React.ReactNode;
124
123
  }
125
- declare function transform(options: GrapherPublicWidgetOptions): RenderProps;
126
- declare function staticTransform(options: PerseusGrapherWidgetOptions): {
127
- availableTypes: ("linear" | "quadratic" | "sinusoid" | "tangent" | "exponential" | "logarithm" | "absolute_value")[];
128
- plot: import("@khanacademy/perseus-core").GrapherAnswerTypes;
129
- graph: {
130
- backgroundImage: {
131
- bottom?: number;
132
- height?: number;
133
- left?: number;
134
- scale?: number;
135
- url?: string | null | undefined;
136
- width?: number;
137
- };
138
- box?: [number, number];
139
- editableSettings?: Array<"graph" | "snap" | "image" | "measure">;
140
- gridStep?: [number, number];
141
- labels: [string, string];
142
- markings: import("@khanacademy/perseus-core").MarkingsType;
143
- range: import("@khanacademy/perseus-core").GraphRange;
144
- rulerLabel: "";
145
- rulerTicks: number;
146
- showProtractor?: boolean;
147
- showRuler?: boolean;
148
- showTooltips?: boolean;
149
- snapStep?: [number, number];
150
- step: [number, number];
151
- valid?: boolean | string;
152
- };
153
- };
154
124
  /**
155
125
  * @deprecated and likely a very broken API
156
126
  * [LEMS-3185] do not trust serializedState/restoreSerializedState
@@ -163,8 +133,6 @@ declare const _default: {
163
133
  displayName: string;
164
134
  hidden: true;
165
135
  widget: typeof Grapher;
166
- transform: typeof transform;
167
- staticTransform: typeof staticTransform;
168
136
  getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
169
137
  getStartUserInput: typeof getStartUserInput;
170
138
  getCorrectUserInput: typeof getCorrectUserInput;
@@ -12,8 +12,7 @@ import Renderer from "../../renderer";
12
12
  import type { ChangeFn, FocusPath, Widget, WidgetProps } from "../../types";
13
13
  import type { GroupPromptJSON } from "../../widget-ai-utils/group/group-ai-utils";
14
14
  import type { PerseusGroupUserInput, PerseusGroupWidgetOptions, PerseusRenderer } from "@khanacademy/perseus-core";
15
- type RenderProps = PerseusGroupWidgetOptions;
16
- type Props = WidgetProps<RenderProps, PerseusGroupUserInput>;
15
+ type Props = WidgetProps<PerseusGroupWidgetOptions, PerseusGroupUserInput>;
17
16
  type DefaultProps = {
18
17
  content: Props["content"];
19
18
  widgets: Props["widgets"];
@@ -3,8 +3,7 @@ import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import type { WidgetProps, Widget } from "../../types";
4
4
  import type { ImagePromptJSON } from "../../widget-ai-utils/image/image-ai-utils";
5
5
  import type { PerseusImageWidgetOptions } from "@khanacademy/perseus-core";
6
- type RenderProps = PerseusImageWidgetOptions;
7
- type ExternalProps = WidgetProps<RenderProps>;
6
+ type ExternalProps = WidgetProps<PerseusImageWidgetOptions>;
8
7
  type Props = ExternalProps & {
9
8
  alignment: NonNullable<ExternalProps["alignment"]>;
10
9
  title: NonNullable<ExternalProps["title"]>;
@@ -3,8 +3,7 @@ import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import type { Path, Widget, WidgetProps } from "../../types";
4
4
  import type { InputNumberPromptJSON } from "../../widget-ai-utils/input-number/input-number-ai-utils";
5
5
  import type { PerseusInputNumberWidgetOptions, PerseusInputNumberUserInput } from "@khanacademy/perseus-core";
6
- type RenderProps = Pick<PerseusInputNumberWidgetOptions, "simplify" | "size" | "answerType" | "rightAlign">;
7
- type ExternalProps = WidgetProps<RenderProps, PerseusInputNumberUserInput>;
6
+ type ExternalProps = WidgetProps<PerseusInputNumberWidgetOptions, PerseusInputNumberUserInput>;
8
7
  type Props = ExternalProps & {
9
8
  apiOptions: NonNullable<ExternalProps["apiOptions"]>;
10
9
  linterContext: NonNullable<ExternalProps["linterContext"]>;
@@ -34,7 +33,6 @@ declare class InputNumber extends React.Component<Props> implements Widget {
34
33
  getSerializedState(): any;
35
34
  render(): React.ReactNode;
36
35
  }
37
- declare function transform(widgetOptions: PerseusInputNumberWidgetOptions): RenderProps;
38
36
  declare function getOneCorrectAnswerFromRubric(rubric: any): string | undefined;
39
37
  /**
40
38
  * @deprecated and likely a very broken API
@@ -48,7 +46,6 @@ declare const _default: {
48
46
  hidden: true;
49
47
  widget: typeof InputNumber;
50
48
  isLintable: true;
51
- transform: typeof transform;
52
49
  getOneCorrectAnswerFromRubric: typeof getOneCorrectAnswerFromRubric;
53
50
  getStartUserInput: typeof getStartUserInput;
54
51
  getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
@@ -28,6 +28,7 @@ declare class InteractiveGraphQuestionBuilder {
28
28
  private markings;
29
29
  private xRange;
30
30
  private yRange;
31
+ private showAxisArrows;
31
32
  private snapStep;
32
33
  private tickStep;
33
34
  private showProtractor;
@@ -55,6 +56,12 @@ declare class InteractiveGraphQuestionBuilder {
55
56
  withMarkings(markings: MarkingsType): InteractiveGraphQuestionBuilder;
56
57
  withXRange(min: number, max: number): InteractiveGraphQuestionBuilder;
57
58
  withYRange(min: number, max: number): InteractiveGraphQuestionBuilder;
59
+ withShowAxisArrows({ xMin, xMax, yMin, yMax, }: {
60
+ xMin?: boolean;
61
+ xMax?: boolean;
62
+ yMin?: boolean;
63
+ yMax?: boolean;
64
+ }): InteractiveGraphQuestionBuilder;
58
65
  withSnapStep(x: number, y: number): InteractiveGraphQuestionBuilder;
59
66
  withTickStep(x: number, y: number): InteractiveGraphQuestionBuilder;
60
67
  withProtractor(): InteractiveGraphQuestionBuilder;
@@ -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.
@@ -84,6 +84,10 @@ type RenderProps = {
84
84
  * NOTE(kevinb): perseus_data.go defines this as Array<Array<number>>
85
85
  */
86
86
  range: GraphRange;
87
+ /**
88
+ * Whether to show the arrows on the axis.
89
+ */
90
+ showAxisArrows: ShowAxisArrows;
87
91
  /**
88
92
  * The type of graph
89
93
  */
@@ -112,6 +116,7 @@ type DefaultProps = {
112
116
  labels: string[];
113
117
  labelLocation: Props["labelLocation"];
114
118
  range: Props["range"];
119
+ showAxisArrows: Props["showAxisArrows"];
115
120
  step: Props["step"];
116
121
  backgroundImage: Props["backgroundImage"];
117
122
  markings: Props["markings"];
@@ -143,6 +148,7 @@ declare class InteractiveGraph extends React.Component<Props, State> {
143
148
  rulerLabel?: string;
144
149
  rulerTicks?: number;
145
150
  range: GraphRange;
151
+ showAxisArrows: ShowAxisArrows;
146
152
  correct?: PerseusGraphType;
147
153
  lockedFigures: LockedFigure[];
148
154
  fullGraphAriaLabel?: string;
@@ -275,7 +281,6 @@ declare const _default: {
275
281
  name: string;
276
282
  displayName: string;
277
283
  widget: typeof InteractiveGraph;
278
- staticTransform: <T>(value: T) => T;
279
284
  getStartUserInput: typeof getStartUserInput;
280
285
  getCorrectUserInput: typeof getCorrectUserInput;
281
286
  getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
@@ -15,6 +15,7 @@ export type MafsGraphProps = {
15
15
  showProtractor: boolean;
16
16
  labels: ReadonlyArray<string>;
17
17
  labelLocation?: InteractiveGraphProps["labelLocation"];
18
+ showAxisArrows: InteractiveGraphProps["showAxisArrows"];
18
19
  fullGraphAriaLabel?: InteractiveGraphProps["fullGraphAriaLabel"];
19
20
  fullGraphAriaDescription?: InteractiveGraphProps["fullGraphAriaDescription"];
20
21
  state: InteractiveGraphState;
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import type { AxisLabelLocation, MarkingsType } from "@khanacademy/perseus-core";
2
+ import type { AxisLabelLocation, ShowAxisArrows, MarkingsType } from "@khanacademy/perseus-core";
3
3
  import type { Interval, vec } from "mafs";
4
4
  export type GraphConfig = {
5
5
  range: [Interval, Interval];
@@ -15,6 +15,7 @@ export type GraphConfig = {
15
15
  labelLocation?: AxisLabelLocation;
16
16
  disableKeyboardInteraction?: boolean;
17
17
  interactiveColor?: string;
18
+ showAxisArrows: ShowAxisArrows;
18
19
  };
19
20
  export declare const GraphConfigContext: React.Context<GraphConfig>;
20
21
  export default function useGraphConfig(): GraphConfig;
@@ -25,6 +25,7 @@ export type StatefulMafsGraphProps = {
25
25
  fullGraphAriaDescription?: InteractiveGraphProps["fullGraphAriaDescription"];
26
26
  readOnly: boolean;
27
27
  static: InteractiveGraphProps["static"];
28
+ showAxisArrows: InteractiveGraphProps["showAxisArrows"];
28
29
  };
29
30
  export type StatefulMafsGraphType = {
30
31
  getUserInput: () => PerseusInteractiveGraphUserInput;
@@ -3,8 +3,7 @@ import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import type { FocusPath, Widget, WidgetProps } from "../../types";
4
4
  import type { MatrixPromptJSON } from "../../widget-ai-utils/matrix/matrix-ai-utils";
5
5
  import type { MatrixPublicWidgetOptions, PerseusMatrixUserInput, PerseusMatrixWidgetOptions } from "@khanacademy/perseus-core";
6
- type RenderProps = Pick<PerseusMatrixWidgetOptions, "matrixBoardSize" | "prefix" | "suffix">;
7
- type Props = WidgetProps<RenderProps, PerseusMatrixUserInput> & {
6
+ type Props = WidgetProps<MatrixPublicWidgetOptions, PerseusMatrixUserInput> & {
8
7
  cursorPosition: ReadonlyArray<number>;
9
8
  onChange: (nextProps: {
10
9
  cursorPosition?: ReadonlyArray<number>;
@@ -46,13 +45,6 @@ declare class Matrix extends React.Component<Props, State> implements Widget {
46
45
  getSerializedState(): any;
47
46
  render(): React.ReactNode;
48
47
  }
49
- /**
50
- * TODO: I don't really think we need this. The default for a transform
51
- * is an identity function and all this is doing is taking a selection from
52
- * widget options; it's probably fine to pass all widget options down.
53
- * @deprecated [LEMS-3199]
54
- */
55
- declare function transform(widgetOptions: MatrixPublicWidgetOptions): RenderProps;
56
48
  declare function getStartUserInput(): PerseusMatrixUserInput;
57
49
  declare function getCorrectUserInput(options: PerseusMatrixWidgetOptions): PerseusMatrixUserInput;
58
50
  /**
@@ -65,8 +57,6 @@ declare const _default: {
65
57
  displayName: string;
66
58
  hidden: true;
67
59
  widget: typeof Matrix;
68
- transform: typeof transform;
69
- staticTransform: typeof transform;
70
60
  isLintable: true;
71
61
  getStartUserInput: typeof getStartUserInput;
72
62
  getCorrectUserInput: typeof getCorrectUserInput;
@@ -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>;
@@ -12,14 +12,8 @@ export declare class LineHeightMeasurer extends React.Component<Record<any, any>
12
12
  measureLineHeight(): number;
13
13
  render(): React.ReactNode;
14
14
  }
15
- type RenderProps = {
16
- passageTitle: PerseusPassageWidgetOptions["passageTitle"];
17
- passageText: PerseusPassageWidgetOptions["passageText"];
18
- footnotes: PerseusPassageWidgetOptions["footnotes"];
19
- showLineNumbers: PerseusPassageWidgetOptions["showLineNumbers"];
20
- };
21
15
  type FindWidgetsCallback = (id: string, widgetInfo: PerseusWidget) => boolean;
22
- type PassageProps = ChangeableProps & WidgetProps<RenderProps> & {
16
+ type PassageProps = ChangeableProps & WidgetProps<PerseusPassageWidgetOptions> & {
23
17
  findWidgets: (arg1: FindWidgetsCallback) => ReadonlyArray<Passage>;
24
18
  highlights: SerializedHighlightSet;
25
19
  };
@@ -103,7 +97,6 @@ declare const _default: {
103
97
  displayName: string;
104
98
  hidden: true;
105
99
  widget: typeof Passage;
106
- transform: (editorProps: any) => RenderProps;
107
100
  isLintable: true;
108
101
  };
109
102
  export default _default;
@@ -41,11 +41,6 @@ declare const _default: {
41
41
  displayName: string;
42
42
  hidden: true;
43
43
  widget: typeof PassageRef;
44
- transform: (widgetOptions: PerseusPassageRefWidgetOptions) => {
45
- passageNumber: number;
46
- referenceNumber: number;
47
- summaryText: string | undefined;
48
- };
49
44
  version: import("@khanacademy/perseus-core").Version | undefined;
50
45
  };
51
46
  export default _default;
@@ -24,7 +24,6 @@ declare const _default: {
24
24
  displayName: string;
25
25
  widget: typeof PassageRefTarget;
26
26
  hidden: true;
27
- transform: (editorProps: any) => any;
28
27
  isLintable: true;
29
28
  };
30
29
  export default _default;
@@ -172,7 +172,6 @@ declare const _default: {
172
172
  hidden: true;
173
173
  widget: typeof Plotter;
174
174
  getCorrectUserInput: typeof getCorrectUserInput;
175
- staticTransform: <T>(value: T) => T;
176
175
  getStartUserInput: typeof getStartUserInput;
177
176
  getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
178
177
  };
@@ -1,11 +1,17 @@
1
- import * as React from "react";
2
- export type IndicatorProps = {
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: string;
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: string;
6
+ indicatorContent: IndicatorContent;
6
7
  isMultiSelect: boolean;
7
8
  showCorrectness?: "correct" | "wrong";
8
9
  updateChecked: (isChecked: boolean) => void;
@@ -1,4 +1,4 @@
1
- import * as React from "react";
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;
@@ -6,8 +6,7 @@ import { PerseusI18nContext } from "../../components/i18n-context";
6
6
  import type { Widget, WidgetProps } from "../../types";
7
7
  import type { UnsupportedWidgetPromptJSON } from "../../widget-ai-utils/unsupported-widget";
8
8
  import type { PerseusVideoWidgetOptions } from "@khanacademy/perseus-core";
9
- type RenderProps = PerseusVideoWidgetOptions;
10
- type Props = WidgetProps<RenderProps> & {
9
+ type Props = WidgetProps<PerseusVideoWidgetOptions> & {
11
10
  alignment: string;
12
11
  };
13
12
  /**