@khanacademy/perseus 34.0.0 → 35.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 (66) hide show
  1. package/dist/es/index.js +641 -525
  2. package/dist/es/index.js.map +1 -1
  3. package/dist/es/strings.js +8 -2
  4. package/dist/es/strings.js.map +1 -1
  5. package/dist/index.d.ts +1 -1
  6. package/dist/index.js +573 -447
  7. package/dist/index.js.map +1 -1
  8. package/dist/mixins/widget-prop-denylist.d.ts +0 -1
  9. package/dist/perseus-api.d.ts +4 -5
  10. package/dist/perseus-types.d.ts +6 -18
  11. package/dist/renderer.d.ts +4 -4
  12. package/dist/server-item-renderer.d.ts +4 -9
  13. package/dist/strings.d.ts +3 -0
  14. package/dist/strings.js +8 -2
  15. package/dist/strings.js.map +1 -1
  16. package/dist/types.d.ts +1 -3
  17. package/dist/validation.types.d.ts +111 -0
  18. package/dist/widgets/__shared__/noop-validator.d.ts +2 -2
  19. package/dist/widgets/categorizer/categorizer-validator.d.ts +5 -0
  20. package/dist/widgets/categorizer/categorizer.d.ts +6 -9
  21. package/dist/widgets/cs-program/cs-program.d.ts +4 -9
  22. package/dist/widgets/definition/definition.d.ts +6 -7
  23. package/dist/widgets/dropdown/dropdown-validator.d.ts +2 -2
  24. package/dist/widgets/dropdown/dropdown.d.ts +5 -5
  25. package/dist/widgets/explanation/explanation.d.ts +6 -7
  26. package/dist/widgets/expression/expression-validator.d.ts +2 -2
  27. package/dist/widgets/expression/expression.d.ts +38 -26
  28. package/dist/widgets/expression/expression.types.d.ts +0 -1
  29. package/dist/widgets/graded-group/graded-group.d.ts +2 -2
  30. package/dist/widgets/graded-group-set/graded-group-set.d.ts +2 -2
  31. package/dist/widgets/grapher/grapher.d.ts +6 -7
  32. package/dist/widgets/group/group.d.ts +3 -2
  33. package/dist/widgets/iframe/iframe.d.ts +4 -9
  34. package/dist/widgets/image/image.d.ts +6 -7
  35. package/dist/widgets/input-number/input-number-validator.d.ts +41 -0
  36. package/dist/widgets/input-number/input-number.d.ts +7 -10
  37. package/dist/widgets/interaction/interaction.d.ts +6 -6
  38. package/dist/widgets/interactive-graph.d.ts +9 -12
  39. package/dist/widgets/interactive-graphs/interactive-graph-question-builder.d.ts +15 -7
  40. package/dist/widgets/interactive-graphs/reducer/interactive-graph-action.d.ts +16 -1
  41. package/dist/widgets/interactive-graphs/stateful-mafs-graph.d.ts +5 -2
  42. package/dist/widgets/interactive-graphs/types.d.ts +3 -0
  43. package/dist/widgets/label-image/label-image-validator.d.ts +10 -0
  44. package/dist/widgets/label-image/label-image.d.ts +13 -10
  45. package/dist/widgets/label-image/types.d.ts +0 -4
  46. package/dist/widgets/matcher/matcher.d.ts +4 -4
  47. package/dist/widgets/matrix/matrix.d.ts +5 -5
  48. package/dist/widgets/molecule/molecule.d.ts +4 -3
  49. package/dist/widgets/number-line/number-line.d.ts +5 -3
  50. package/dist/widgets/numeric-input/numeric-input-validator.d.ts +2 -2
  51. package/dist/widgets/numeric-input/numeric-input.d.ts +7 -7
  52. package/dist/widgets/orderer/orderer.d.ts +4 -4
  53. package/dist/widgets/passage/passage.d.ts +6 -7
  54. package/dist/widgets/passage-ref/passage-ref.d.ts +6 -14
  55. package/dist/widgets/passage-ref-target/passage-ref-target.d.ts +4 -3
  56. package/dist/widgets/phet-simulation/phet-simulation.d.ts +2 -2
  57. package/dist/widgets/plotter/plotter.d.ts +5 -5
  58. package/dist/widgets/radio/radio-component.d.ts +6 -13
  59. package/dist/widgets/radio/radio-validator.d.ts +5 -0
  60. package/dist/widgets/sorter/sorter-validator.d.ts +4 -0
  61. package/dist/widgets/sorter/sorter.d.ts +7 -9
  62. package/dist/widgets/table/table.d.ts +5 -5
  63. package/dist/widgets/video/video.d.ts +5 -6
  64. package/package.json +1 -1
  65. package/dist/widgets/dropdown/dropdown.types.d.ts +0 -5
  66. package/dist/widgets/numeric-input/numeric-input.types.d.ts +0 -5
@@ -4,17 +4,12 @@
4
4
  import * as React from "react";
5
5
  import type { PerseusCSProgramWidgetOptions } from "../../perseus-types";
6
6
  import type { PerseusScore, WidgetProps } from "../../types";
7
- type Status = "correct" | "incorrect" | "incomplete";
8
- type UserInput = {
9
- status: Status;
10
- message: string | null;
11
- };
7
+ import type { PerseusCSProgramRubric, PerseusCSProgramUserInput, UserInputStatus } from "../../validation.types";
12
8
  type RenderProps = PerseusCSProgramWidgetOptions & {
13
- status: Status;
9
+ status: UserInputStatus;
14
10
  message: string | null;
15
11
  };
16
- export type Rubric = PerseusCSProgramWidgetOptions;
17
- type Props = WidgetProps<RenderProps, Rubric>;
12
+ type Props = WidgetProps<RenderProps, PerseusCSProgramRubric>;
18
13
  type DefaultProps = {
19
14
  showEditor: Props["showEditor"];
20
15
  showButtons: Props["showButtons"];
@@ -23,7 +18,7 @@ type DefaultProps = {
23
18
  };
24
19
  declare class CSProgram extends React.Component<Props> {
25
20
  static defaultProps: DefaultProps;
26
- static validate(state: UserInput, rubric: any): PerseusScore;
21
+ static validate(state: PerseusCSProgramUserInput, rubric: any): PerseusScore;
27
22
  componentDidMount(): void;
28
23
  componentWillUnmount(): void;
29
24
  handleMessageEvent: (arg1: any) => void;
@@ -1,11 +1,10 @@
1
1
  import * as React from "react";
2
2
  import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import type { PerseusRenderer, PerseusDefinitionWidgetOptions } from "../../perseus-types";
4
- import type { PerseusScore, WidgetProps } from "../../types";
4
+ import type { WidgetProps } from "../../types";
5
+ import type { PerseusDefinitionRubric, PerseusDefinitionUserInput } from "../../validation.types";
5
6
  type RenderProps = PerseusDefinitionWidgetOptions;
6
- type Rubric = PerseusDefinitionWidgetOptions;
7
- type UserInput = Empty;
8
- type DefinitionProps = WidgetProps<RenderProps, Rubric> & {
7
+ type DefinitionProps = WidgetProps<RenderProps, PerseusDefinitionRubric> & {
9
8
  widgets: PerseusRenderer["widgets"];
10
9
  };
11
10
  type DefaultProps = {
@@ -19,9 +18,9 @@ declare class Definition extends React.Component<DefinitionProps> {
19
18
  }>;
20
19
  context: React.ContextType<typeof PerseusI18nContext>;
21
20
  static defaultProps: DefaultProps;
22
- static validate(userInput: UserInput, rubric: Rubric): PerseusScore;
23
- getUserInput: () => UserInput;
24
- simpleValidate: (arg1: Rubric) => PerseusScore;
21
+ static validate(): import("../../types").PerseusScore;
22
+ getUserInput(): PerseusDefinitionUserInput;
23
+ simpleValidate(): import("../../types").PerseusScore;
25
24
  render(): React.ReactNode;
26
25
  }
27
26
  declare const _default: Readonly<{
@@ -1,4 +1,4 @@
1
- import type { Rubric, UserInput } from "./dropdown.types";
2
1
  import type { PerseusScore } from "../../types";
3
- declare function dropdownValidator(userInput: UserInput, rubric: Rubric): PerseusScore;
2
+ import type { PerseusDropdownRubric, PerseusDropdownUserInput } from "../../validation.types";
3
+ declare function dropdownValidator(userInput: PerseusDropdownUserInput, rubric: PerseusDropdownRubric): PerseusScore;
4
4
  export default dropdownValidator;
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
- import type { Rubric, UserInput } from "./dropdown.types";
3
2
  import type { PerseusScore, WidgetProps } from "../../types";
4
- type Props = WidgetProps<RenderProps, Rubric> & {
3
+ import type { PerseusDropdownRubric, PerseusDropdownUserInput } from "../../validation.types";
4
+ type Props = WidgetProps<RenderProps, PerseusDropdownRubric> & {
5
5
  selected: number;
6
6
  };
7
7
  type DefaultProps = {
@@ -12,12 +12,12 @@ type DefaultProps = {
12
12
  };
13
13
  declare class Dropdown extends React.Component<Props> {
14
14
  static defaultProps: DefaultProps;
15
- static validate(userInput: UserInput, rubric: Rubric): PerseusScore;
15
+ static validate(userInput: PerseusDropdownUserInput, rubric: PerseusDropdownRubric): PerseusScore;
16
16
  focus: () => boolean;
17
17
  _handleChangeEvent: (arg1: React.ChangeEvent<HTMLInputElement>) => void;
18
18
  _handleChange: (arg1: number) => void;
19
- getUserInput: () => UserInput;
20
- simpleValidate: (arg1: Rubric) => PerseusScore;
19
+ getUserInput(): PerseusDropdownUserInput;
20
+ simpleValidate(rubric: PerseusDropdownRubric): PerseusScore;
21
21
  render(): React.ReactNode;
22
22
  }
23
23
  type RenderProps = {
@@ -1,11 +1,10 @@
1
1
  import * as React from "react";
2
2
  import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import type { PerseusExplanationWidgetOptions } from "../../perseus-types";
4
- import type { PerseusScore, WidgetProps } from "../../types";
4
+ import type { WidgetProps } from "../../types";
5
+ import type { PerseusExplanationRubric, PerseusExplanationUserInput } from "../../validation.types";
5
6
  type RenderProps = PerseusExplanationWidgetOptions;
6
- type Rubric = PerseusExplanationWidgetOptions;
7
- type UserInput = Empty;
8
- type Props = WidgetProps<RenderProps, PerseusExplanationWidgetOptions>;
7
+ type Props = WidgetProps<RenderProps, PerseusExplanationRubric>;
9
8
  type DefaultProps = {
10
9
  showPrompt: Props["showPrompt"];
11
10
  hidePrompt: Props["hidePrompt"];
@@ -25,13 +24,13 @@ declare class Explanation extends React.Component<Props, State> {
25
24
  state: State;
26
25
  _mounted: boolean;
27
26
  static defaultProps: DefaultProps;
28
- static validate(userInput: UserInput, rubric: Rubric): PerseusScore;
27
+ static validate(): import("../../types").PerseusScore;
29
28
  componentDidMount(): void;
30
29
  componentWillUnmount(): void;
31
30
  change: (arg1: any, arg2: any, arg3: any) => any;
32
31
  _onClick: () => void;
33
- getUserInput: () => Empty;
34
- simpleValidate: (arg1: Rubric) => PerseusScore;
32
+ getUserInput(): PerseusExplanationUserInput;
33
+ simpleValidate(): import("../../types").PerseusScore;
35
34
  render(): React.ReactNode;
36
35
  }
37
36
  declare const _default: Readonly<{
@@ -1,5 +1,5 @@
1
- import type { Rubric, OnInputErrorFunctionType } from "./expression.types";
2
1
  import type { PerseusStrings } from "../../strings";
3
2
  import type { PerseusScore } from "../../types";
4
- declare function expressionValidator(userInput: string, rubric: Rubric, onInputError: OnInputErrorFunctionType | undefined, strings: PerseusStrings, locale: string): PerseusScore;
3
+ import type { PerseusExpressionRubric, PerseusExpressionUserInput } from "../../validation.types";
4
+ declare function expressionValidator(userInput: PerseusExpressionUserInput, rubric: PerseusExpressionRubric, strings: PerseusStrings, locale: string): PerseusScore;
5
5
  export default expressionValidator;
@@ -1,10 +1,10 @@
1
1
  import * as React from "react";
2
2
  import { PerseusI18nContext } from "../../components/i18n-context";
3
- import type { Rubric, OnInputErrorFunctionType } from "./expression.types";
4
3
  import type { DependenciesContext } from "../../dependencies";
5
4
  import type { PerseusExpressionWidgetOptions } from "../../perseus-types";
6
5
  import type { PerseusStrings } from "../../strings";
7
6
  import type { PerseusScore, WidgetProps } from "../../types";
7
+ import type { PerseusExpressionRubric, PerseusExpressionUserInput } from "../../validation.types";
8
8
  import type { Keys as Key, KeypadConfiguration } from "@khanacademy/math-input";
9
9
  type InputPath = ReadonlyArray<string>;
10
10
  type RenderProps = {
@@ -16,7 +16,7 @@ type RenderProps = {
16
16
  ariaLabel: PerseusExpressionWidgetOptions["ariaLabel"];
17
17
  keypadConfiguration: ReturnType<typeof keypadConfigurationForProps>;
18
18
  };
19
- type ExternalProps = WidgetProps<RenderProps, Rubric>;
19
+ type ExternalProps = WidgetProps<RenderProps, PerseusExpressionRubric>;
20
20
  export type Props = ExternalProps & Partial<React.ContextType<typeof DependenciesContext>> & {
21
21
  apiOptions: NonNullable<ExternalProps["apiOptions"]>;
22
22
  buttonSets: NonNullable<ExternalProps["buttonSets"]>;
@@ -52,9 +52,9 @@ export declare class Expression extends React.Component<Props, ExpressionState>
52
52
  context: React.ContextType<typeof PerseusI18nContext>;
53
53
  _textareaId: string;
54
54
  _isMounted: boolean;
55
- static validate(userInput: string, rubric: Rubric, onInputError: OnInputErrorFunctionType | undefined, strings: PerseusStrings, locale: string): PerseusScore;
56
- static getUserInputFromProps(props: Props): string;
57
- static getOneCorrectAnswerFromRubric(rubric: Rubric): string | null | undefined;
55
+ static validate(userInput: PerseusExpressionUserInput, rubric: PerseusExpressionRubric, strings: PerseusStrings, locale: string): PerseusScore;
56
+ static getUserInputFromProps(props: Props): PerseusExpressionUserInput;
57
+ static getOneCorrectAnswerFromRubric(rubric: PerseusExpressionRubric): string | null | undefined;
58
58
  static defaultProps: DefaultProps;
59
59
  displayName: string;
60
60
  state: ExpressionState;
@@ -62,10 +62,10 @@ export declare class Expression extends React.Component<Props, ExpressionState>
62
62
  componentDidUpdate: (prevProps: Props) => void;
63
63
  componentWillUnmount: () => void;
64
64
  _handleMouseDown: () => void;
65
- simpleValidate: (rubric: Rubric & {
65
+ simpleValidate: (rubric: PerseusExpressionRubric & {
66
66
  scoring?: boolean;
67
- }, onInputError: OnInputErrorFunctionType) => PerseusScore;
68
- getUserInput: () => string;
67
+ }) => PerseusScore;
68
+ getUserInput(): PerseusExpressionUserInput;
69
69
  change: (...args: any) => any | undefined;
70
70
  parse: (value: string, props: Props) => any;
71
71
  changeAndTrack: (e: any, cb: () => void) => void;
@@ -102,7 +102,6 @@ declare const _default: Readonly<{
102
102
  problemNum: number | null | undefined;
103
103
  apiOptions: Readonly<Readonly<{
104
104
  isArticle?: boolean | undefined;
105
- onInputError?: ((widgetId: any, value: string, message?: string | null | undefined) => unknown) | undefined;
106
105
  onFocusChange?: ((newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown) | undefined;
107
106
  GroupMetadataEditor?: React.ComponentType<any> | undefined;
108
107
  showAlignmentOptions?: boolean | undefined;
@@ -149,6 +148,10 @@ declare const _default: Readonly<{
149
148
  } & {
150
149
  "interactive-graph-locked-features-labels"?: boolean | undefined;
151
150
  "locked-point-labels"?: boolean | undefined;
151
+ "locked-line-labels"?: boolean | undefined;
152
+ "locked-vector-labels"?: boolean | undefined;
153
+ "locked-ellipse-labels"?: boolean | undefined;
154
+ "locked-function-labels"?: boolean | undefined;
152
155
  }) | undefined;
153
156
  } | undefined;
154
157
  onWidgetStartProps?: ((widgets: import("../../perseus-types").PerseusWidgetsMap) => void) | undefined;
@@ -164,7 +167,6 @@ declare const _default: Readonly<{
164
167
  isArticle: NonNullable<boolean | undefined>;
165
168
  isMobile: NonNullable<boolean | undefined>;
166
169
  onFocusChange: (newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown;
167
- onInputError: (widgetId: any, value: string, message?: string | null | undefined) => unknown;
168
170
  readOnly: NonNullable<boolean | undefined>;
169
171
  setDrawingAreaAvailable: (arg1: boolean) => unknown;
170
172
  showAlignmentOptions: NonNullable<boolean | undefined>;
@@ -183,7 +185,6 @@ declare const _default: Readonly<{
183
185
  } & Partial<import("../../types").PerseusDependenciesV2> & {
184
186
  apiOptions: Readonly<Readonly<{
185
187
  isArticle?: boolean | undefined;
186
- onInputError?: ((widgetId: any, value: string, message?: string | null | undefined) => unknown) | undefined;
187
188
  onFocusChange?: ((newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown) | undefined;
188
189
  GroupMetadataEditor?: React.ComponentType<any> | undefined;
189
190
  showAlignmentOptions?: boolean | undefined;
@@ -230,6 +231,10 @@ declare const _default: Readonly<{
230
231
  } & {
231
232
  "interactive-graph-locked-features-labels"?: boolean | undefined;
232
233
  "locked-point-labels"?: boolean | undefined;
234
+ "locked-line-labels"?: boolean | undefined;
235
+ "locked-vector-labels"?: boolean | undefined;
236
+ "locked-ellipse-labels"?: boolean | undefined;
237
+ "locked-function-labels"?: boolean | undefined;
233
238
  }) | undefined;
234
239
  } | undefined;
235
240
  onWidgetStartProps?: ((widgets: import("../../perseus-types").PerseusWidgetsMap) => void) | undefined;
@@ -245,7 +250,6 @@ declare const _default: Readonly<{
245
250
  isArticle: NonNullable<boolean | undefined>;
246
251
  isMobile: NonNullable<boolean | undefined>;
247
252
  onFocusChange: (newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown;
248
- onInputError: (widgetId: any, value: string, message?: string | null | undefined) => unknown;
249
253
  readOnly: NonNullable<boolean | undefined>;
250
254
  setDrawingAreaAvailable: (arg1: boolean) => unknown;
251
255
  showAlignmentOptions: NonNullable<boolean | undefined>;
@@ -259,12 +263,13 @@ declare const _default: Readonly<{
259
263
  visibleLabel: string | undefined;
260
264
  ariaLabel: string | undefined;
261
265
  value: string;
262
- }, "ariaLabel" | "trackInteraction" | "static" | "onChange" | "analytics" | "problemNum" | "questionCompleted" | "keypadElement" | "alignment" | "buttonsVisible" | "containerSizeClass" | "widgetId" | "findWidgets" | "visibleLabel" | "keypadConfiguration" | "reviewModeRubric" | "isLastUsedWidget"> & {
266
+ }, "ariaLabel" | "trackInteraction" | "static" | "onChange" | "analytics" | "keypadElement" | "containerSizeClass" | "widgetId" | "problemNum" | "questionCompleted" | "findWidgets" | "alignment" | "buttonsVisible" | "visibleLabel" | "keypadConfiguration" | "reviewModeRubric" | "isLastUsedWidget"> & {
263
267
  value?: string | undefined;
264
268
  linterContext?: import("@khanacademy/perseus-linter").LinterContextProps | undefined;
269
+ onFocus?: ((blurPath: import("../../types").FocusPath) => void) | undefined;
270
+ onBlur?: ((blurPath: import("../../types").FocusPath) => void) | undefined;
265
271
  apiOptions?: Readonly<Readonly<{
266
272
  isArticle?: boolean | undefined;
267
- onInputError?: ((widgetId: any, value: string, message?: string | null | undefined) => unknown) | undefined;
268
273
  onFocusChange?: ((newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown) | undefined;
269
274
  GroupMetadataEditor?: React.ComponentType<any> | undefined;
270
275
  showAlignmentOptions?: boolean | undefined;
@@ -311,6 +316,10 @@ declare const _default: Readonly<{
311
316
  } & {
312
317
  "interactive-graph-locked-features-labels"?: boolean | undefined;
313
318
  "locked-point-labels"?: boolean | undefined;
319
+ "locked-line-labels"?: boolean | undefined;
320
+ "locked-vector-labels"?: boolean | undefined;
321
+ "locked-ellipse-labels"?: boolean | undefined;
322
+ "locked-function-labels"?: boolean | undefined;
314
323
  }) | undefined;
315
324
  } | undefined;
316
325
  onWidgetStartProps?: ((widgets: import("../../perseus-types").PerseusWidgetsMap) => void) | undefined;
@@ -326,14 +335,11 @@ declare const _default: Readonly<{
326
335
  isArticle: NonNullable<boolean | undefined>;
327
336
  isMobile: NonNullable<boolean | undefined>;
328
337
  onFocusChange: (newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown;
329
- onInputError: (widgetId: any, value: string, message?: string | null | undefined) => unknown;
330
338
  readOnly: NonNullable<boolean | undefined>;
331
339
  setDrawingAreaAvailable: (arg1: boolean) => unknown;
332
340
  showAlignmentOptions: NonNullable<boolean | undefined>;
333
341
  }> | undefined;
334
342
  buttonSets?: import("../../perseus-types").LegacyButtonSets | undefined;
335
- onFocus?: ((blurPath: import("../../types").FocusPath) => void) | undefined;
336
- onBlur?: ((blurPath: import("../../types").FocusPath) => void) | undefined;
337
343
  functions?: readonly string[] | undefined;
338
344
  times?: boolean | undefined;
339
345
  } & {}, "analytics"> & React.RefAttributes<Expression>>) | undefined;
@@ -344,7 +350,6 @@ declare const _default: Readonly<{
344
350
  problemNum: number | null | undefined;
345
351
  apiOptions: Readonly<Readonly<{
346
352
  isArticle?: boolean | undefined;
347
- onInputError?: ((widgetId: any, value: string, message?: string | null | undefined) => unknown) | undefined;
348
353
  onFocusChange?: ((newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown) | undefined;
349
354
  GroupMetadataEditor?: React.ComponentType<any> | undefined;
350
355
  showAlignmentOptions?: boolean | undefined;
@@ -391,6 +396,10 @@ declare const _default: Readonly<{
391
396
  } & {
392
397
  "interactive-graph-locked-features-labels"?: boolean | undefined;
393
398
  "locked-point-labels"?: boolean | undefined;
399
+ "locked-line-labels"?: boolean | undefined;
400
+ "locked-vector-labels"?: boolean | undefined;
401
+ "locked-ellipse-labels"?: boolean | undefined;
402
+ "locked-function-labels"?: boolean | undefined;
394
403
  }) | undefined;
395
404
  } | undefined;
396
405
  onWidgetStartProps?: ((widgets: import("../../perseus-types").PerseusWidgetsMap) => void) | undefined;
@@ -406,7 +415,6 @@ declare const _default: Readonly<{
406
415
  isArticle: NonNullable<boolean | undefined>;
407
416
  isMobile: NonNullable<boolean | undefined>;
408
417
  onFocusChange: (newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown;
409
- onInputError: (widgetId: any, value: string, message?: string | null | undefined) => unknown;
410
418
  readOnly: NonNullable<boolean | undefined>;
411
419
  setDrawingAreaAvailable: (arg1: boolean) => unknown;
412
420
  showAlignmentOptions: NonNullable<boolean | undefined>;
@@ -425,7 +433,6 @@ declare const _default: Readonly<{
425
433
  } & Partial<import("../../types").PerseusDependenciesV2> & {
426
434
  apiOptions: Readonly<Readonly<{
427
435
  isArticle?: boolean | undefined;
428
- onInputError?: ((widgetId: any, value: string, message?: string | null | undefined) => unknown) | undefined;
429
436
  onFocusChange?: ((newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown) | undefined;
430
437
  GroupMetadataEditor?: React.ComponentType<any> | undefined;
431
438
  showAlignmentOptions?: boolean | undefined;
@@ -472,6 +479,10 @@ declare const _default: Readonly<{
472
479
  } & {
473
480
  "interactive-graph-locked-features-labels"?: boolean | undefined;
474
481
  "locked-point-labels"?: boolean | undefined;
482
+ "locked-line-labels"?: boolean | undefined;
483
+ "locked-vector-labels"?: boolean | undefined;
484
+ "locked-ellipse-labels"?: boolean | undefined;
485
+ "locked-function-labels"?: boolean | undefined;
475
486
  }) | undefined;
476
487
  } | undefined;
477
488
  onWidgetStartProps?: ((widgets: import("../../perseus-types").PerseusWidgetsMap) => void) | undefined;
@@ -487,7 +498,6 @@ declare const _default: Readonly<{
487
498
  isArticle: NonNullable<boolean | undefined>;
488
499
  isMobile: NonNullable<boolean | undefined>;
489
500
  onFocusChange: (newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown;
490
- onInputError: (widgetId: any, value: string, message?: string | null | undefined) => unknown;
491
501
  readOnly: NonNullable<boolean | undefined>;
492
502
  setDrawingAreaAvailable: (arg1: boolean) => unknown;
493
503
  showAlignmentOptions: NonNullable<boolean | undefined>;
@@ -501,12 +511,13 @@ declare const _default: Readonly<{
501
511
  visibleLabel: string | undefined;
502
512
  ariaLabel: string | undefined;
503
513
  value: string;
504
- }, "ariaLabel" | "trackInteraction" | "static" | "onChange" | "analytics" | "problemNum" | "questionCompleted" | "keypadElement" | "alignment" | "buttonsVisible" | "containerSizeClass" | "widgetId" | "findWidgets" | "visibleLabel" | "keypadConfiguration" | "reviewModeRubric" | "isLastUsedWidget"> & {
514
+ }, "ariaLabel" | "trackInteraction" | "static" | "onChange" | "analytics" | "keypadElement" | "containerSizeClass" | "widgetId" | "problemNum" | "questionCompleted" | "findWidgets" | "alignment" | "buttonsVisible" | "visibleLabel" | "keypadConfiguration" | "reviewModeRubric" | "isLastUsedWidget"> & {
505
515
  value?: string | undefined;
506
516
  linterContext?: import("@khanacademy/perseus-linter").LinterContextProps | undefined;
517
+ onFocus?: ((blurPath: import("../../types").FocusPath) => void) | undefined;
518
+ onBlur?: ((blurPath: import("../../types").FocusPath) => void) | undefined;
507
519
  apiOptions?: Readonly<Readonly<{
508
520
  isArticle?: boolean | undefined;
509
- onInputError?: ((widgetId: any, value: string, message?: string | null | undefined) => unknown) | undefined;
510
521
  onFocusChange?: ((newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown) | undefined;
511
522
  GroupMetadataEditor?: React.ComponentType<any> | undefined;
512
523
  showAlignmentOptions?: boolean | undefined;
@@ -553,6 +564,10 @@ declare const _default: Readonly<{
553
564
  } & {
554
565
  "interactive-graph-locked-features-labels"?: boolean | undefined;
555
566
  "locked-point-labels"?: boolean | undefined;
567
+ "locked-line-labels"?: boolean | undefined;
568
+ "locked-vector-labels"?: boolean | undefined;
569
+ "locked-ellipse-labels"?: boolean | undefined;
570
+ "locked-function-labels"?: boolean | undefined;
556
571
  }) | undefined;
557
572
  } | undefined;
558
573
  onWidgetStartProps?: ((widgets: import("../../perseus-types").PerseusWidgetsMap) => void) | undefined;
@@ -568,14 +583,11 @@ declare const _default: Readonly<{
568
583
  isArticle: NonNullable<boolean | undefined>;
569
584
  isMobile: NonNullable<boolean | undefined>;
570
585
  onFocusChange: (newFocusPath: import("../../types").FocusPath, oldFocusPath: import("../../types").FocusPath, keypadHeight?: number | undefined, focusedElement?: HTMLElement | undefined) => unknown;
571
- onInputError: (widgetId: any, value: string, message?: string | null | undefined) => unknown;
572
586
  readOnly: NonNullable<boolean | undefined>;
573
587
  setDrawingAreaAvailable: (arg1: boolean) => unknown;
574
588
  showAlignmentOptions: NonNullable<boolean | undefined>;
575
589
  }> | undefined;
576
590
  buttonSets?: import("../../perseus-types").LegacyButtonSets | undefined;
577
- onFocus?: ((blurPath: import("../../types").FocusPath) => void) | undefined;
578
- onBlur?: ((blurPath: import("../../types").FocusPath) => void) | undefined;
579
591
  functions?: readonly string[] | undefined;
580
592
  times?: boolean | undefined;
581
593
  } & {}, "analytics"> & React.RefAttributes<Expression>>;
@@ -1,3 +1,2 @@
1
1
  import type { PerseusExpressionWidgetOptions } from "../../perseus-types";
2
2
  export type Rubric = PerseusExpressionWidgetOptions;
3
- export type OnInputErrorFunctionType = (arg1?: any, arg2?: any, arg3?: any) => boolean | null | undefined;
@@ -3,15 +3,15 @@ import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import type { ANSWER_BAR_STATES } from "./graded-group-answer-bar";
4
4
  import type { PerseusGradedGroupWidgetOptions } from "../../perseus-types";
5
5
  import type { TrackingGradedGroupExtraArguments, WidgetProps } from "../../types";
6
+ import type { PerseusGradedGroupRubric } from "../../validation.types";
6
7
  declare const GRADING_STATUSES: {
7
8
  readonly ungraded: "ungraded";
8
9
  readonly correct: "correct";
9
10
  readonly incorrect: "incorrect";
10
11
  readonly invalid: "invalid";
11
12
  };
12
- type Rubric = PerseusGradedGroupWidgetOptions;
13
13
  type RenderProps = PerseusGradedGroupWidgetOptions;
14
- type Props = WidgetProps<RenderProps, Rubric, TrackingGradedGroupExtraArguments> & {
14
+ type Props = WidgetProps<RenderProps, PerseusGradedGroupRubric, TrackingGradedGroupExtraArguments> & {
15
15
  inGradedGroupSet?: boolean;
16
16
  onNextQuestion?: () => unknown;
17
17
  };
@@ -3,9 +3,9 @@ import * as Changeable from "../../mixins/changeable";
3
3
  import { GradedGroup } from "../graded-group/graded-group";
4
4
  import type { PerseusGradedGroupSetWidgetOptions } from "../../perseus-types";
5
5
  import type { FocusPath, WidgetProps } from "../../types";
6
+ import type { PerseusGradedGroupSetRubric } from "../../validation.types";
6
7
  type RenderProps = PerseusGradedGroupSetWidgetOptions;
7
- type Rubric = PerseusGradedGroupSetWidgetOptions;
8
- type Props = Changeable.ChangeableProps & WidgetProps<RenderProps, Rubric> & {
8
+ type Props = Changeable.ChangeableProps & WidgetProps<RenderProps, PerseusGradedGroupSetRubric> & {
9
9
  trackInteraction: () => void;
10
10
  };
11
11
  type DefaultProps = {
@@ -4,15 +4,14 @@ import type { Coord } from "../../interactive2/types";
4
4
  import type { PerseusGrapherWidgetOptions } from "../../perseus-types";
5
5
  import type { PerseusScore, WidgetProps } from "../../types";
6
6
  import type { GridDimensions } from "../../util";
7
+ import type { PerseusGrapherRubric, PerseusGrapherUserInput } from "../../validation.types";
7
8
  import type { PropsFor } from "@khanacademy/wonder-blocks-core";
8
- type UserInput = any;
9
9
  type RenderProps = {
10
10
  availableTypes: PerseusGrapherWidgetOptions["availableTypes"];
11
11
  graph: PerseusGrapherWidgetOptions["graph"];
12
12
  plot?: any;
13
13
  };
14
- type Rubric = PerseusGrapherWidgetOptions;
15
- type ExternalProps = WidgetProps<RenderProps, Rubric>;
14
+ type ExternalProps = WidgetProps<RenderProps, PerseusGrapherRubric>;
16
15
  type Props = ExternalProps & {
17
16
  plot: NonNullable<RenderProps["plot"]>;
18
17
  markings: "graph" | "grid" | "none";
@@ -24,8 +23,8 @@ declare class Grapher extends React.Component<Props> {
24
23
  horizHairline: any;
25
24
  vertHairline: any;
26
25
  static defaultProps: DefaultProps;
27
- static validate(state: UserInput, rubric: Rubric): PerseusScore;
28
- static getUserInputFromProps(props: Props): UserInput;
26
+ static validate(state: PerseusGrapherUserInput, rubric: PerseusGrapherRubric): PerseusScore;
27
+ static getUserInputFromProps(props: Props): PerseusGrapherUserInput;
29
28
  handlePlotChanges: (arg1: any) => any;
30
29
  handleActiveTypeChange: (arg1: any) => any;
31
30
  _getGridConfig(options: Props["graph"] & {
@@ -36,8 +35,8 @@ declare class Grapher extends React.Component<Props> {
36
35
  _setupGraphie: (arg1: any, arg2: any) => void;
37
36
  showHairlines: (arg1: Coord) => void;
38
37
  hideHairlines: () => void;
39
- simpleValidate(rubric: Rubric): PerseusScore;
40
- getUserInput(): UserInput;
38
+ simpleValidate(rubric: PerseusGrapherRubric): PerseusScore;
39
+ getUserInput(): PerseusGrapherUserInput;
41
40
  focus(): void;
42
41
  render(): React.ReactNode;
43
42
  }
@@ -3,6 +3,7 @@ import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import Renderer from "../../renderer";
4
4
  import type { PerseusGroupWidgetOptions } from "../../perseus-types";
5
5
  import type { ChangeFn, FocusPath, PerseusScore, WidgetProps } from "../../types";
6
+ import type { UserInput } from "../../validation.types";
6
7
  type Rubric = PerseusGroupWidgetOptions;
7
8
  type RenderProps = PerseusGroupWidgetOptions;
8
9
  type Props = WidgetProps<RenderProps, Rubric>;
@@ -22,10 +23,10 @@ declare class Group extends React.Component<Props> {
22
23
  static defaultProps: DefaultProps;
23
24
  componentDidMount(): void;
24
25
  change: ChangeFn;
25
- getUserInput: () => any;
26
+ getUserInput(): ReadonlyArray<UserInput | null | undefined> | undefined;
26
27
  getSerializedState: () => any;
27
28
  restoreSerializedState: (arg1: any, arg2: any) => null;
28
- simpleValidate: (arg1: Rubric) => PerseusScore | null | undefined;
29
+ simpleValidate(): PerseusScore | null | undefined;
29
30
  getInputPaths: () => ReadonlyArray<FocusPath> | null | undefined;
30
31
  setInputValue: (arg1: FocusPath, arg2: string, arg3: () => unknown) => void;
31
32
  focus: () => boolean | null | undefined;
@@ -9,19 +9,14 @@
9
9
  import * as React from "react";
10
10
  import type { PerseusIFrameWidgetOptions } from "../../perseus-types";
11
11
  import type { WidgetProps } from "../../types";
12
- type Status = "correct" | "incorrect" | "incomplete";
13
- type UserInput = {
14
- status: Status;
15
- message: string | null;
16
- };
12
+ import type { PerseusIFrameRubric, PerseusIFrameUserInput, UserInputStatus } from "../../validation.types";
17
13
  type RenderProps = PerseusIFrameWidgetOptions & {
18
- status: Status;
14
+ status: UserInputStatus;
19
15
  message: string | null;
20
16
  width: string;
21
17
  height: string;
22
18
  };
23
- export type Rubric = PerseusIFrameWidgetOptions;
24
- type Props = WidgetProps<RenderProps, Rubric>;
19
+ type Props = WidgetProps<RenderProps, PerseusIFrameRubric>;
25
20
  type DefaultProps = {
26
21
  status: Props["status"];
27
22
  message: Props["message"];
@@ -32,7 +27,7 @@ declare class Iframe extends React.Component<Props> {
32
27
  static defaultProps: DefaultProps;
33
28
  componentDidMount(): void;
34
29
  componentWillUnmount(): void;
35
- getUserInput(): UserInput;
30
+ getUserInput(): PerseusIFrameUserInput;
36
31
  handleMessageEvent: (arg1: any) => void;
37
32
  change: (...args: ReadonlyArray<unknown>) => any;
38
33
  simpleValidate: (arg1: any) => any;
@@ -1,11 +1,10 @@
1
1
  import * as React from "react";
2
2
  import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import type { PerseusImageWidgetOptions } from "../../perseus-types";
4
- import type { ChangeFn, PerseusScore, WidgetProps } from "../../types";
4
+ import type { ChangeFn, WidgetProps } from "../../types";
5
+ import type { PerseusImageRubric, PerseusImageUserInput } from "../../validation.types";
5
6
  type RenderProps = PerseusImageWidgetOptions;
6
- type Rubric = PerseusImageWidgetOptions;
7
- type UserInput = null;
8
- type ExternalProps = WidgetProps<RenderProps, Rubric>;
7
+ type ExternalProps = WidgetProps<RenderProps, PerseusImageRubric>;
9
8
  type Props = ExternalProps & {
10
9
  alignment: NonNullable<ExternalProps["alignment"]>;
11
10
  title: NonNullable<ExternalProps["title"]>;
@@ -35,10 +34,10 @@ declare class ImageWidget extends React.Component<Props> {
35
34
  }>;
36
35
  context: React.ContextType<typeof PerseusI18nContext>;
37
36
  static defaultProps: DefaultProps;
38
- static validate(userInput: UserInput, rubric: Rubric): PerseusScore;
37
+ static validate(): import("../../types").PerseusScore;
39
38
  change: ChangeFn;
40
- getUserInput: () => UserInput;
41
- simpleValidate: (arg1: Rubric) => PerseusScore;
39
+ getUserInput(): PerseusImageUserInput;
40
+ simpleValidate(): import("../../types").PerseusScore;
42
41
  focus: () => void;
43
42
  render(): React.ReactNode;
44
43
  }
@@ -0,0 +1,41 @@
1
+ import type { PerseusStrings } from "../../strings";
2
+ import type { PerseusInputNumberRubric } from "../../validation.types";
3
+ import type { PerseusScore } from "@khanacademy/perseus";
4
+ export declare const answerTypes: {
5
+ readonly number: {
6
+ readonly name: "Numbers";
7
+ readonly forms: "integer, decimal, proper, improper, mixed";
8
+ };
9
+ readonly decimal: {
10
+ readonly name: "Decimals";
11
+ readonly forms: "decimal";
12
+ };
13
+ readonly integer: {
14
+ readonly name: "Integers";
15
+ readonly forms: "integer";
16
+ };
17
+ readonly rational: {
18
+ readonly name: "Fractions and mixed numbers";
19
+ readonly forms: "integer, proper, improper, mixed";
20
+ };
21
+ readonly improper: {
22
+ readonly name: "Improper numbers (no mixed)";
23
+ readonly forms: "integer, proper, improper";
24
+ };
25
+ readonly mixed: {
26
+ readonly name: "Mixed numbers (no improper)";
27
+ readonly forms: "integer, proper, mixed";
28
+ };
29
+ readonly percent: {
30
+ readonly name: "Numbers or percents";
31
+ readonly forms: "integer, decimal, proper, improper, mixed, percent";
32
+ };
33
+ readonly pi: {
34
+ readonly name: "Numbers with pi";
35
+ readonly forms: "pi";
36
+ };
37
+ };
38
+ declare function inputNumberValidator(state: {
39
+ currentValue: string;
40
+ }, rubric: PerseusInputNumberRubric, strings: PerseusStrings): PerseusScore;
41
+ export default inputNumberValidator;
@@ -2,25 +2,22 @@ import * as React from "react";
2
2
  import { PerseusI18nContext } from "../../components/i18n-context";
3
3
  import type { PerseusInputNumberWidgetOptions } from "../../perseus-types";
4
4
  import type { PerseusStrings } from "../../strings";
5
- import type { APIOptions, Path, PerseusScore, WidgetProps } from "../../types";
6
- type UserInput = {
7
- currentValue: string;
8
- };
5
+ import type { Path, PerseusScore, WidgetProps } from "../../types";
6
+ import type { PerseusInputNumberRubric, PerseusInputNumberUserInput } from "../../validation.types";
9
7
  type RenderProps = {
10
8
  simplify: PerseusInputNumberWidgetOptions["simplify"];
11
9
  size: PerseusInputNumberWidgetOptions["size"];
12
10
  answerType: PerseusInputNumberWidgetOptions["answerType"];
13
11
  rightAlign: PerseusInputNumberWidgetOptions["rightAlign"];
14
12
  };
15
- type Rubric = PerseusInputNumberWidgetOptions;
16
- type ExternalProps = WidgetProps<RenderProps, Rubric>;
13
+ type ExternalProps = WidgetProps<RenderProps, PerseusInputNumberRubric>;
17
14
  type Props = ExternalProps & {
18
15
  apiOptions: NonNullable<ExternalProps["apiOptions"]>;
19
16
  linterContext: NonNullable<ExternalProps["linterContext"]>;
20
17
  rightAlign: NonNullable<ExternalProps["rightAlign"]>;
21
18
  size: NonNullable<ExternalProps["size"]>;
22
19
  currentValue: string;
23
- answerType: NonNullable<Rubric["answerType"]>;
20
+ answerType: NonNullable<PerseusInputNumberRubric["answerType"]>;
24
21
  };
25
22
  type DefaultProps = {
26
23
  answerType: Props["answerType"];
@@ -39,7 +36,7 @@ declare class InputNumber extends React.Component<Props> {
39
36
  static defaultProps: DefaultProps;
40
37
  static validate(state: {
41
38
  currentValue: string;
42
- }, rubric: Rubric, strings: PerseusStrings, onInputError?: APIOptions["onInputError"]): PerseusScore;
39
+ }, rubric: PerseusInputNumberRubric, strings: PerseusStrings): PerseusScore;
43
40
  static getUserInputFromProps(props: Props): {
44
41
  currentValue: string;
45
42
  };
@@ -54,8 +51,8 @@ declare class InputNumber extends React.Component<Props> {
54
51
  getInputPaths: () => ReadonlyArray<Path>;
55
52
  getGrammarTypeForPath: (arg1: Path) => string;
56
53
  setInputValue: (arg1: Path, arg2: string, arg3: () => void) => void;
57
- getUserInput: () => UserInput;
58
- simpleValidate: (rubric: Rubric, onInputError?: APIOptions["onInputError"]) => PerseusScore;
54
+ getUserInput(): PerseusInputNumberUserInput;
55
+ simpleValidate(rubric: PerseusInputNumberRubric): PerseusScore;
59
56
  examples: () => ReadonlyArray<string>;
60
57
  render(): React.ReactNode;
61
58
  }