@khanacademy/perseus 4.0.2 → 5.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 (153) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/components/highlighting/highlightable-content.d.ts +4 -4
  3. package/dist/components/highlighting/highlightable-content.js.flow +4 -7
  4. package/dist/components/highlighting/ui/highlight-renderer.d.ts +6 -6
  5. package/dist/components/highlighting/ui/highlight-renderer.js.flow +6 -8
  6. package/dist/components/highlighting/ui/highlight-set-renderer.d.ts +5 -5
  7. package/dist/components/highlighting/ui/highlight-set-renderer.js.flow +5 -8
  8. package/dist/components/highlighting/ui/highlight-tooltip.d.ts +2 -2
  9. package/dist/components/highlighting/ui/highlight-tooltip.js.flow +2 -4
  10. package/dist/components/highlighting/ui/highlighting-ui.d.ts +2 -2
  11. package/dist/components/highlighting/ui/highlighting-ui.js.flow +2 -2
  12. package/dist/components/highlighting/ui/selection-tracker.d.ts +5 -5
  13. package/dist/components/highlighting/ui/selection-tracker.js.flow +5 -7
  14. package/dist/components/highlighting/word-indexer.d.ts +2 -2
  15. package/dist/components/highlighting/word-indexer.js.flow +2 -2
  16. package/dist/components/inline-icon.d.ts +35 -1
  17. package/dist/components/inline-icon.js.flow +11 -1
  18. package/dist/components/simple-keypad-input.d.ts +1 -1
  19. package/dist/components/simple-keypad-input.js.flow +1 -1
  20. package/dist/components/tex-buttons.d.ts +2 -2
  21. package/dist/components/tex-buttons.js.flow +2 -2
  22. package/dist/error-boundary.d.ts +4 -4
  23. package/dist/error-boundary.js.flow +4 -6
  24. package/dist/es/index.js +7 -10
  25. package/dist/es/index.js.map +1 -1
  26. package/dist/index.js +7 -10
  27. package/dist/index.js.map +1 -1
  28. package/dist/perseus-types.d.ts +0 -1
  29. package/dist/perseus-types.js.flow +0 -1
  30. package/dist/widgets/__stories__/test-keypad-context-wrapper.d.ts +2 -2
  31. package/dist/widgets/__stories__/test-keypad-context-wrapper.js.flow +2 -4
  32. package/dist/widgets/expression.d.ts +2 -2
  33. package/dist/widgets/expression.js.flow +2 -2
  34. package/dist/widgets/interaction/element-container.d.ts +5 -4
  35. package/dist/widgets/interaction/element-container.js.flow +6 -11
  36. package/dist/widgets/label-image/marker.d.ts +4 -4
  37. package/dist/widgets/label-image/marker.js.flow +4 -6
  38. package/dist/widgets/numeric-input.d.ts +0 -2
  39. package/dist/widgets/numeric-input.js.flow +0 -4
  40. package/dist/widgets/radio/base-radio.d.ts +7 -1
  41. package/dist/widgets/radio/base-radio.js.flow +7 -1
  42. package/dist/widgets/radio/choice-icon/choice-icon.d.ts +1 -1
  43. package/dist/widgets/radio/choice-icon/choice-icon.js.flow +1 -1
  44. package/dist/widgets/radio/choice-icon/cross-out-line.d.ts +2 -2
  45. package/dist/widgets/radio/choice-icon/cross-out-line.js.flow +2 -2
  46. package/dist/widgets/radio/focus-ring.d.ts +8 -1
  47. package/dist/widgets/radio/focus-ring.js.flow +8 -1
  48. package/dist/widgets/radio/option-status.d.ts +2 -2
  49. package/dist/widgets/radio/option-status.js.flow +2 -2
  50. package/dist/widgets/video-transcript-link.d.ts +1 -1
  51. package/dist/widgets/video-transcript-link.js.flow +1 -1
  52. package/package.json +4 -4
  53. package/src/__stories__/item-renderer.stories.tsx +2 -6
  54. package/src/__stories__/server-item-renderer.stories.tsx +2 -6
  55. package/src/components/__stories__/button-group.stories.tsx +2 -6
  56. package/src/components/__stories__/fixed-to-responsive.stories.tsx +14 -16
  57. package/src/components/__stories__/graph.stories.tsx +3 -5
  58. package/src/components/__stories__/graphie.stories.tsx +3 -5
  59. package/src/components/__stories__/hud.stories.tsx +2 -6
  60. package/src/components/__stories__/icon.stories.tsx +1 -1
  61. package/src/components/__stories__/image-loader.stories.tsx +4 -4
  62. package/src/components/__stories__/info-tip.stories.tsx +2 -6
  63. package/src/components/__stories__/inline-icon.stories.tsx +4 -8
  64. package/src/components/__stories__/input-with-examples.stories.tsx +6 -10
  65. package/src/components/__stories__/lint.stories.tsx +12 -12
  66. package/src/components/__stories__/math-input.stories.tsx +4 -8
  67. package/src/components/__stories__/math-output.stories.tsx +3 -5
  68. package/src/components/__stories__/multi-button-group.stories.tsx +2 -6
  69. package/src/components/__stories__/number-input.stories.tsx +6 -8
  70. package/src/components/__stories__/prop-check-box.stories.tsx +9 -9
  71. package/src/components/__stories__/range-input.stories.tsx +4 -6
  72. package/src/components/__stories__/simple-keypad-input.stories.tsx +2 -4
  73. package/src/components/__stories__/sortable.stories.tsx +15 -15
  74. package/src/components/__stories__/stub-tag-editor.stories.tsx +5 -9
  75. package/src/components/__stories__/svg-image.stories.tsx +10 -18
  76. package/src/components/__stories__/tex.stories.tsx +1 -3
  77. package/src/components/__stories__/text-buttons.stories.tsx +10 -22
  78. package/src/components/__stories__/text-input.stories.tsx +4 -10
  79. package/src/components/__stories__/text-list-editor.stories.tsx +1 -3
  80. package/src/components/__stories__/zoomable-tex.stories.tsx +6 -4
  81. package/src/components/__stories__/zoomable.stories.tsx +1 -3
  82. package/src/components/highlighting/highlightable-content.tsx +4 -7
  83. package/src/components/highlighting/ui/highlight-renderer.tsx +6 -9
  84. package/src/components/highlighting/ui/highlight-set-renderer.tsx +5 -8
  85. package/src/components/highlighting/ui/highlight-tooltip.tsx +2 -2
  86. package/src/components/highlighting/ui/highlighting-ui.tsx +2 -2
  87. package/src/components/highlighting/ui/selection-tracker.tsx +5 -8
  88. package/src/components/highlighting/word-indexer.tsx +2 -2
  89. package/src/components/inline-icon.tsx +2 -2
  90. package/src/components/simple-keypad-input.tsx +2 -2
  91. package/src/components/tex-buttons.tsx +2 -2
  92. package/src/components/visibility-observer/__stories__/visibility-observer.stories.tsx +1 -3
  93. package/src/error-boundary.tsx +4 -7
  94. package/src/multi-items/__stories__/multi-renderer.stories.tsx +1 -1
  95. package/src/multi-items/__tests__/multi-renderer.test.tsx +2 -3
  96. package/src/perseus-types.ts +0 -3
  97. package/src/util/graphie.ts +3 -3
  98. package/src/widgets/__stories__/categorizer.stories.tsx +1 -1
  99. package/src/widgets/__stories__/cs-program.stories.tsx +1 -1
  100. package/src/widgets/__stories__/definition.stories.tsx +3 -7
  101. package/src/widgets/__stories__/dropdown.stories.tsx +1 -1
  102. package/src/widgets/__stories__/explanation.stories.tsx +2 -2
  103. package/src/widgets/__stories__/expression.stories.tsx +5 -11
  104. package/src/widgets/__stories__/graded-group-set.stories.tsx +1 -1
  105. package/src/widgets/__stories__/graded-group.stories.tsx +1 -1
  106. package/src/widgets/__stories__/grapher.stories.tsx +7 -21
  107. package/src/widgets/__stories__/group.stories.tsx +1 -1
  108. package/src/widgets/__stories__/iframe.stories.tsx +1 -1
  109. package/src/widgets/__stories__/image.stories.tsx +1 -1
  110. package/src/widgets/__stories__/input-number.stories.tsx +3 -12
  111. package/src/widgets/__stories__/interaction.stories.tsx +1 -1
  112. package/src/widgets/__stories__/interactive-graph.stories.tsx +9 -9
  113. package/src/widgets/__stories__/matcher.stories.tsx +1 -1
  114. package/src/widgets/__stories__/matrix.stories.tsx +1 -1
  115. package/src/widgets/__stories__/number-line.stories.tsx +1 -1
  116. package/src/widgets/__stories__/numeric-input.stories.tsx +3 -5
  117. package/src/widgets/__stories__/orderer.stories.tsx +1 -1
  118. package/src/widgets/__stories__/passage-ref.stories.tsx +2 -2
  119. package/src/widgets/__stories__/passage.stories.tsx +3 -9
  120. package/src/widgets/__stories__/radio.stories.tsx +3 -5
  121. package/src/widgets/__stories__/sorter.stories.tsx +1 -1
  122. package/src/widgets/__stories__/test-keypad-context-wrapper.tsx +2 -4
  123. package/src/widgets/__stories__/transformer.stories.tsx +1 -1
  124. package/src/widgets/__stories__/unit.stories.tsx +1 -3
  125. package/src/widgets/__stories__/video-transcript-link.stories.tsx +2 -6
  126. package/src/widgets/__stories__/video.stories.tsx +1 -1
  127. package/src/widgets/__testdata__/group.testdata.ts +0 -2
  128. package/src/widgets/__tests__/group.test.tsx +0 -2
  129. package/src/widgets/__tests__/radio/focus-ring.test.tsx +0 -1
  130. package/src/widgets/expression.tsx +3 -3
  131. package/src/widgets/interaction/element-container.tsx +7 -8
  132. package/src/widgets/label-image/__stories__/answer-choices.stories.tsx +2 -4
  133. package/src/widgets/label-image/__stories__/marker.stories.tsx +9 -19
  134. package/src/widgets/label-image/marker.tsx +4 -4
  135. package/src/widgets/numeric-input.tsx +0 -3
  136. package/src/widgets/passage/passage-markdown.tsx +2 -2
  137. package/src/widgets/radio/__stories__/base-radio.stories.tsx +11 -19
  138. package/src/widgets/radio/__stories__/choice-icon.stories.tsx +9 -11
  139. package/src/widgets/radio/__stories__/choice-none-above.stories.tsx +1 -1
  140. package/src/widgets/radio/__stories__/choice.stories.tsx +4 -4
  141. package/src/widgets/radio/__stories__/focus-ring.stories.tsx +1 -1
  142. package/src/widgets/radio/__stories__/option-status.stories.tsx +2 -4
  143. package/src/widgets/radio/base-radio.tsx +1 -1
  144. package/src/widgets/radio/choice-icon/choice-icon.tsx +5 -5
  145. package/src/widgets/radio/choice-icon/cross-out-line.tsx +1 -3
  146. package/src/widgets/radio/choice-none-above.tsx +2 -2
  147. package/src/widgets/radio/choice.tsx +1 -3
  148. package/src/widgets/radio/focus-ring.tsx +1 -1
  149. package/src/widgets/radio/option-status.tsx +2 -4
  150. package/src/widgets/radio/widget.tsx +0 -1
  151. package/src/widgets/reaction-diagram.tsx +2 -2
  152. package/src/widgets/video-transcript-link.tsx +1 -1
  153. package/tsconfig.tsbuildinfo +1 -1
@@ -19,39 +19,39 @@ export default {
19
19
 
20
20
  type StoryArgs = Record<any, any>;
21
21
 
22
- export const Angle: React.FC<StoryArgs> = (args): React.ReactElement => (
22
+ export const Angle = (args: StoryArgs): React.ReactElement => (
23
23
  <RendererWithDebugUI question={angleQuestion} />
24
24
  );
25
25
 
26
- export const Circle: React.FC<StoryArgs> = (args): React.ReactElement => (
26
+ export const Circle = (args: StoryArgs): React.ReactElement => (
27
27
  <RendererWithDebugUI question={circleQuestion} />
28
28
  );
29
29
 
30
- export const Linear: React.FC<StoryArgs> = (args): React.ReactElement => (
30
+ export const Linear = (args: StoryArgs): React.ReactElement => (
31
31
  <RendererWithDebugUI question={linearQuestion} />
32
32
  );
33
33
 
34
- export const LinearSystem: React.FC<StoryArgs> = (args): React.ReactElement => (
34
+ export const LinearSystem = (args: StoryArgs): React.ReactElement => (
35
35
  <RendererWithDebugUI question={linearSystemQuestion} />
36
36
  );
37
37
 
38
- export const Point: React.FC<StoryArgs> = (args): React.ReactElement => (
38
+ export const Point = (args: StoryArgs): React.ReactElement => (
39
39
  <RendererWithDebugUI question={pointQuestion} />
40
40
  );
41
41
 
42
- export const Polygon: React.FC<StoryArgs> = (args): React.ReactElement => (
42
+ export const Polygon = (args: StoryArgs): React.ReactElement => (
43
43
  <RendererWithDebugUI question={polygonQuestion} />
44
44
  );
45
45
 
46
- export const Ray: React.FC<StoryArgs> = (args): React.ReactElement => (
46
+ export const Ray = (args: StoryArgs): React.ReactElement => (
47
47
  <RendererWithDebugUI question={rayQuestion} />
48
48
  );
49
49
 
50
- export const Segment: React.FC<StoryArgs> = (args): React.ReactElement => (
50
+ export const Segment = (args: StoryArgs): React.ReactElement => (
51
51
  <RendererWithDebugUI question={segmentQuestion} />
52
52
  );
53
53
 
54
- export const Sinusoid: React.FC<StoryArgs> = (args): React.ReactElement => (
54
+ export const Sinusoid = (args: StoryArgs): React.ReactElement => (
55
55
  <RendererWithDebugUI question={sinusoidQuestion} />
56
56
  );
57
57
 
@@ -9,6 +9,6 @@ export default {
9
9
 
10
10
  type StoryArgs = Record<any, any>;
11
11
 
12
- export const Question1: React.FC<StoryArgs> = (args): React.ReactElement => {
12
+ export const Question1 = (args: StoryArgs): React.ReactElement => {
13
13
  return <RendererWithDebugUI question={question1} />;
14
14
  };
@@ -9,6 +9,6 @@ export default {
9
9
 
10
10
  type StoryArgs = Record<any, any>;
11
11
 
12
- export const Question1: React.FC<StoryArgs> = (args): React.ReactElement => {
12
+ export const Question1 = (args: StoryArgs): React.ReactElement => {
13
13
  return <RendererWithDebugUI question={question1} />;
14
14
  };
@@ -9,6 +9,6 @@ export default {
9
9
 
10
10
  type StoryArgs = Record<any, any>;
11
11
 
12
- export const Question1: React.FC<StoryArgs> = (args): React.ReactElement => {
12
+ export const Question1 = (args: StoryArgs): React.ReactElement => {
13
13
  return <RendererWithDebugUI question={question1} />;
14
14
  };
@@ -62,13 +62,13 @@ export const Question1 = (): React.ReactElement => {
62
62
  return <RendererWithDebugUI question={question1} />;
63
63
  };
64
64
 
65
- export const Interactive: React.FC<StoryArgs> = (args): React.ReactElement => {
65
+ export const Interactive = (args: StoryArgs): React.ReactElement => {
66
66
  const props = generateProps(args);
67
67
 
68
68
  return <NumericInput {...props} />;
69
69
  };
70
70
 
71
- export const Sizes: React.FC<StoryArgs> = (args): React.ReactElement => {
71
+ export const Sizes = (args: StoryArgs): React.ReactElement => {
72
72
  const smallProps = generateProps({...args, size: "small"});
73
73
  const normalProps = generateProps({...args, size: "normal"});
74
74
 
@@ -86,9 +86,7 @@ export const Sizes: React.FC<StoryArgs> = (args): React.ReactElement => {
86
86
  );
87
87
  };
88
88
 
89
- export const TextAlignment: React.FC<StoryArgs> = (
90
- args,
91
- ): React.ReactElement => {
89
+ export const TextAlignment = (args: StoryArgs): React.ReactElement => {
92
90
  const leftProps = generateProps({...args, rightAlign: false});
93
91
  const rightProps = generateProps({...args, rightAlign: true});
94
92
 
@@ -9,6 +9,6 @@ export default {
9
9
 
10
10
  type StoryArgs = Record<any, any>;
11
11
 
12
- export const Question1: React.FC<StoryArgs> = (args): React.ReactElement => {
12
+ export const Question1 = (args: StoryArgs): React.ReactElement => {
13
13
  return <RendererWithDebugUI question={question1} />;
14
14
  };
@@ -13,10 +13,10 @@ export default {
13
13
  title: "Perseus/Widgets/PassageRef",
14
14
  } as Story;
15
15
 
16
- export const ShortPassage: React.FC<StoryArgs> = (args): React.ReactElement => {
16
+ export const ShortPassage = (args: StoryArgs): React.ReactElement => {
17
17
  return <RendererWithDebugUI question={question1} />;
18
18
  };
19
19
 
20
- export const LongPassage: React.FC<StoryArgs> = (args): React.ReactElement => {
20
+ export const LongPassage = (args: StoryArgs): React.ReactElement => {
21
21
  return <RendererWithDebugUI question={question2} />;
22
22
  };
@@ -13,20 +13,14 @@ export default {
13
13
 
14
14
  type StoryArgs = Record<any, any>;
15
15
 
16
- export const SimpleQuestion: React.FC<StoryArgs> = (
17
- args,
18
- ): React.ReactElement => {
16
+ export const SimpleQuestion = (args: StoryArgs): React.ReactElement => {
19
17
  return <RendererWithDebugUI question={question1} />;
20
18
  };
21
19
 
22
- export const MultiPassageQuestion: React.FC<StoryArgs> = (
23
- args,
24
- ): React.ReactElement => {
20
+ export const MultiPassageQuestion = (args: StoryArgs): React.ReactElement => {
25
21
  return <RendererWithDebugUI question={question2} />;
26
22
  };
27
23
 
28
- export const SingleNumberedPassage: React.FC<StoryArgs> = (
29
- args,
30
- ): React.ReactElement => {
24
+ export const SingleNumberedPassage = (args: StoryArgs): React.ReactElement => {
31
25
  return <RendererWithDebugUI question={question3} />;
32
26
  };
@@ -55,7 +55,7 @@ const buildApiOptions = (args: StoryArgs): APIOptions => {
55
55
  };
56
56
  };
57
57
 
58
- export const SingleSelect: React.FC<StoryArgs> = (args): React.ReactElement => {
58
+ export const SingleSelect = (args: StoryArgs): React.ReactElement => {
59
59
  return (
60
60
  <RendererWithDebugUI
61
61
  question={applyStoryArgs(questionWithPassage, args)}
@@ -65,9 +65,7 @@ export const SingleSelect: React.FC<StoryArgs> = (args): React.ReactElement => {
65
65
  );
66
66
  };
67
67
 
68
- export const MultiSelectSimple: React.FC<StoryArgs> = (
69
- args,
70
- ): React.ReactElement => {
68
+ export const MultiSelectSimple = (args: StoryArgs): React.ReactElement => {
71
69
  return (
72
70
  <RendererWithDebugUI
73
71
  question={applyStoryArgs(multiChoiceQuestionSimple, args)}
@@ -77,7 +75,7 @@ export const MultiSelectSimple: React.FC<StoryArgs> = (
77
75
  );
78
76
  };
79
77
 
80
- export const MultiSelect: React.FC<StoryArgs> = (args): React.ReactElement => {
78
+ export const MultiSelect = (args: StoryArgs): React.ReactElement => {
81
79
  return (
82
80
  <RendererWithDebugUI
83
81
  question={applyStoryArgs(multiChoiceQuestion, args)}
@@ -9,6 +9,6 @@ export default {
9
9
 
10
10
  type StoryArgs = Record<any, any>;
11
11
 
12
- export const Question1: React.FC<StoryArgs> = (args): React.ReactElement => {
12
+ export const Question1 = (args: StoryArgs): React.ReactElement => {
13
13
  return <RendererWithDebugUI question={question1} />;
14
14
  };
@@ -21,13 +21,11 @@ const Footer = (): React.ReactElement => {
21
21
  );
22
22
  };
23
23
 
24
- type TestKeypadContextWrapperProps = {
24
+ type Props = {
25
25
  children: React.ReactElement;
26
26
  };
27
27
 
28
- const TestKeypadContextWrapper = (
29
- props: TestKeypadContextWrapperProps,
30
- ): React.ReactElement => {
28
+ const TestKeypadContextWrapper = (props: Props): React.ReactElement => {
31
29
  const [keypadElement, setKeypadElement] = React.useState(null);
32
30
  const [renderer, setRenderer] = React.useState(null);
33
31
  const [scrollableElement, setScrollableElement] = React.useState(
@@ -9,6 +9,6 @@ export default {
9
9
 
10
10
  type StoryArgs = Record<any, any>;
11
11
 
12
- export const Question: React.FC<StoryArgs> = (args): React.ReactElement => {
12
+ export const Question = (args: StoryArgs): React.ReactElement => {
13
13
  return <RendererWithDebugUI question={question} />;
14
14
  };
@@ -13,9 +13,7 @@ export default {
13
13
  title: "Perseus/Widgets/Unit",
14
14
  } as Story;
15
15
 
16
- export const NonStaticRender: React.FC<StoryArgs> = (
17
- args,
18
- ): React.ReactElement => {
16
+ export const NonStaticRender = (args: StoryArgs): React.ReactElement => {
19
17
  return (
20
18
  <OldUnitInput
21
19
  apiOptions={{
@@ -12,16 +12,12 @@ export default {
12
12
  title: "Perseus/Components/Video Transcript Link",
13
13
  } as Story;
14
14
 
15
- export const YoutubeVideoLink: React.FC<StoryArgs> = (
16
- args,
17
- ): React.ReactElement => {
15
+ export const YoutubeVideoLink = (args: StoryArgs): React.ReactElement => {
18
16
  return (
19
17
  <VideoTranscriptLink location="https://www.youtube.com/watch?v=YoutubeId" />
20
18
  );
21
19
  };
22
20
 
23
- export const SlugVideoLink: React.FC<StoryArgs> = (
24
- args,
25
- ): React.ReactElement => {
21
+ export const SlugVideoLink = (args: StoryArgs): React.ReactElement => {
26
22
  return <VideoTranscriptLink location="slug-video-id" />;
27
23
  };
@@ -9,6 +9,6 @@ export default {
9
9
 
10
10
  type StoryArgs = Record<any, any>;
11
11
 
12
- export const Question1: React.FC<StoryArgs> = (args): React.ReactElement => {
12
+ export const Question1 = (args: StoryArgs): React.ReactElement => {
13
13
  return <RendererWithDebugUI question={question1} />;
14
14
  };
@@ -93,7 +93,6 @@ export const question1: PerseusRenderer = {
93
93
  ],
94
94
  coefficient: false,
95
95
  labelText: "value rounded to the nearest ten",
96
- multipleNumberInput: false,
97
96
  rightAlign: false,
98
97
  size: "normal",
99
98
  static: false,
@@ -118,7 +117,6 @@ export const question1: PerseusRenderer = {
118
117
  ],
119
118
  coefficient: false,
120
119
  labelText: "value rounded to the nearest hundred",
121
- multipleNumberInput: false,
122
120
  rightAlign: false,
123
121
  size: "normal",
124
122
  static: false,
@@ -279,7 +279,6 @@ describe("group widget", () => {
279
279
  "coefficient": false,
280
280
  "currentValue": "99",
281
281
  "labelText": "value rounded to the nearest ten",
282
- "multipleNumberInput": false,
283
282
  "rightAlign": false,
284
283
  "size": "normal",
285
284
  "static": false,
@@ -288,7 +287,6 @@ describe("group widget", () => {
288
287
  "answerForms": [],
289
288
  "coefficient": false,
290
289
  "labelText": "value rounded to the nearest hundred",
291
- "multipleNumberInput": false,
292
290
  "rightAlign": false,
293
291
  "size": "normal",
294
292
  "static": false,
@@ -10,7 +10,6 @@ describe("choice icon", () => {
10
10
  describe.each([[true], [false]])("multipleSelect: %s", (multipleSelect) => {
11
11
  it("renders with the correct border radius", () => {
12
12
  // Arrange/Act
13
- // @ts-expect-error [FEI-5003] - TS2739 - Type '{ multipleSelect: any; }' is missing the following properties from type 'Props': visible, color
14
13
  render(<FocusRing multipleSelect={multipleSelect} />);
15
14
 
16
15
  const focusRing = screen.getByTestId("focus-ring");
@@ -87,6 +87,9 @@ type OnInputErrorFunctionType = (
87
87
 
88
88
  // The new, MathQuill input expression widget
89
89
  export class Expression extends React.Component<Props, ExpressionState> {
90
+ _isMounted = false;
91
+ errorTimeout: null | number = null;
92
+
90
93
  //#region Previously a class extension
91
94
  /* Content creators input a list of answers which are matched from top to
92
95
  * bottom. The intent is that they can include spcific solutions which should
@@ -334,9 +337,6 @@ export class Expression extends React.Component<Props, ExpressionState> {
334
337
  this._isMounted = false;
335
338
  };
336
339
 
337
- _isMounted = false;
338
- errorTimeout: null | number = null;
339
-
340
340
  simpleValidate: (
341
341
  rubric: Rubric,
342
342
  onInputError: OnInputErrorFunctionType,
@@ -10,7 +10,7 @@ import {
10
10
  iconTrash,
11
11
  } from "../../icon-paths";
12
12
 
13
- type ElementContainerProps = {
13
+ type Props = {
14
14
  children: React.ReactElement<any> | ReadonlyArray<React.ReactElement<any>>;
15
15
  initiallyVisible: boolean;
16
16
  onDelete?: () => void | null | undefined;
@@ -19,12 +19,11 @@ type ElementContainerProps = {
19
19
  title: string | React.ReactElement<any>;
20
20
  };
21
21
 
22
- class ElementContainer extends React.Component<
23
- ElementContainerProps,
24
- {
25
- show: boolean;
26
- }
27
- > {
22
+ type State = {
23
+ show: boolean;
24
+ };
25
+
26
+ class ElementContainer extends React.Component<Props, State> {
28
27
  static defaultProps: {
29
28
  initiallyVisible: boolean;
30
29
  title: string;
@@ -33,7 +32,7 @@ class ElementContainer extends React.Component<
33
32
  title: "More",
34
33
  };
35
34
 
36
- constructor(props: ElementContainerProps) {
35
+ constructor(props: Props) {
37
36
  super(props);
38
37
 
39
38
  this.state = {
@@ -87,12 +87,10 @@ class WithState extends React.Component<
87
87
  }
88
88
  }
89
89
 
90
- export const SingleSelect: React.FC<StoryArgs> = (args): React.ReactElement => {
90
+ export const SingleSelect = (args: StoryArgs): React.ReactElement => {
91
91
  return <WithState />;
92
92
  };
93
93
 
94
- export const MultipleSelect: React.FC<StoryArgs> = (
95
- args,
96
- ): React.ReactElement => {
94
+ export const MultipleSelect = (args: StoryArgs): React.ReactElement => {
97
95
  return <WithState multipleSelect={true} />;
98
96
  };
@@ -31,7 +31,7 @@ const Wrapper = (props) => (
31
31
  // TODO(jeremy): There are a bunch of props that we have to pass to the Marker
32
32
  // that are not used by it, but required because we share a props type.
33
33
 
34
- export const Unfilled: React.FC<StoryArgs> = (args): React.ReactElement => {
34
+ export const Unfilled = (args: StoryArgs): React.ReactElement => {
35
35
  const props = {
36
36
  answers: ["BMW", "Ferrari"],
37
37
  selected: [],
@@ -46,9 +46,7 @@ export const Unfilled: React.FC<StoryArgs> = (args): React.ReactElement => {
46
46
  return <Wrapper {...props} />;
47
47
  };
48
48
 
49
- export const UnfilledPulsate: React.FC<StoryArgs> = (
50
- args,
51
- ): React.ReactElement => {
49
+ export const UnfilledPulsate = (args: StoryArgs): React.ReactElement => {
52
50
  const props = {
53
51
  answers: ["BMW", "Ferrari"],
54
52
  selected: [],
@@ -63,9 +61,7 @@ export const UnfilledPulsate: React.FC<StoryArgs> = (
63
61
  return <Wrapper {...props} />;
64
62
  };
65
63
 
66
- export const UnfilledSelected: React.FC<StoryArgs> = (
67
- args,
68
- ): React.ReactElement => {
64
+ export const UnfilledSelected = (args: StoryArgs): React.ReactElement => {
69
65
  const props = {
70
66
  answers: ["BMW", "Ferrari"],
71
67
  selected: [],
@@ -80,7 +76,7 @@ export const UnfilledSelected: React.FC<StoryArgs> = (
80
76
  return <Wrapper {...props} />;
81
77
  };
82
78
 
83
- export const Filled: React.FC<StoryArgs> = (args): React.ReactElement => {
79
+ export const Filled = (args: StoryArgs): React.ReactElement => {
84
80
  const props = {
85
81
  answers: ["BMW", "Ferrari"],
86
82
  selected: ["Fiat"],
@@ -95,9 +91,7 @@ export const Filled: React.FC<StoryArgs> = (args): React.ReactElement => {
95
91
  return <Wrapper {...props} />;
96
92
  };
97
93
 
98
- export const FilledSelected: React.FC<StoryArgs> = (
99
- args,
100
- ): React.ReactElement => {
94
+ export const FilledSelected = (args: StoryArgs): React.ReactElement => {
101
95
  const props = {
102
96
  answers: ["BMW", "Ferrari"],
103
97
  selected: ["Fiat"],
@@ -112,7 +106,7 @@ export const FilledSelected: React.FC<StoryArgs> = (
112
106
  return <Wrapper {...props} />;
113
107
  };
114
108
 
115
- export const Incorrect: React.FC<StoryArgs> = (args): React.ReactElement => {
109
+ export const Incorrect = (args: StoryArgs): React.ReactElement => {
116
110
  const props = {
117
111
  answers: ["BMW", "Ferrari"],
118
112
  selected: ["Fiat"],
@@ -128,9 +122,7 @@ export const Incorrect: React.FC<StoryArgs> = (args): React.ReactElement => {
128
122
  return <Wrapper {...props} />;
129
123
  };
130
124
 
131
- export const IncorrectSelected: React.FC<StoryArgs> = (
132
- args,
133
- ): React.ReactElement => {
125
+ export const IncorrectSelected = (args: StoryArgs): React.ReactElement => {
134
126
  const props = {
135
127
  answers: ["BMW", "Ferrari"],
136
128
  selected: ["Fiat"],
@@ -146,7 +138,7 @@ export const IncorrectSelected: React.FC<StoryArgs> = (
146
138
  return <Wrapper {...props} />;
147
139
  };
148
140
 
149
- export const Correct: React.FC<StoryArgs> = (args): React.ReactElement => {
141
+ export const Correct = (args: StoryArgs): React.ReactElement => {
150
142
  const props = {
151
143
  answers: ["BMW", "Ferrari"],
152
144
  selected: ["BMW", "Ferrari"],
@@ -162,9 +154,7 @@ export const Correct: React.FC<StoryArgs> = (args): React.ReactElement => {
162
154
  return <Wrapper {...props} />;
163
155
  };
164
156
 
165
- export const CorrectSelected: React.FC<StoryArgs> = (
166
- args,
167
- ): React.ReactElement => {
157
+ export const CorrectSelected = (args: StoryArgs): React.ReactElement => {
168
158
  const props = {
169
159
  answers: ["BMW", "Ferrari"],
170
160
  selected: ["BMW", "Ferrari"],
@@ -13,7 +13,7 @@ import {iconCheck, iconMinus} from "../../icon-paths";
13
13
 
14
14
  import type {InteractiveMarkerType} from "./types";
15
15
 
16
- type MarkerProps = InteractiveMarkerType & {
16
+ type Props = InteractiveMarkerType & {
17
17
  // Whether this marker has been selected by user.
18
18
  showSelected: boolean;
19
19
  // Whether this marker should pulsate to draw user attention.
@@ -23,12 +23,12 @@ type MarkerProps = InteractiveMarkerType & {
23
23
  onKeyDown: (e: KeyboardEvent) => void;
24
24
  };
25
25
 
26
- type MarkerState = {
26
+ type State = {
27
27
  // Whether the marker button has input focus.
28
28
  isFocused: boolean;
29
29
  };
30
30
 
31
- export default class Marker extends React.Component<MarkerProps, MarkerState> {
31
+ export default class Marker extends React.Component<Props, State> {
32
32
  // The marker icon element.
33
33
  _icon: HTMLElement | null | undefined;
34
34
 
@@ -38,7 +38,7 @@ export default class Marker extends React.Component<MarkerProps, MarkerState> {
38
38
  selected: [],
39
39
  };
40
40
 
41
- state: MarkerState = {
41
+ state: State = {
42
42
  isFocused: false,
43
43
  };
44
44
 
@@ -76,7 +76,6 @@ type Props = ExternalProps & {
76
76
  answerForms: NonNullable<ExternalProps["answerForms"]>;
77
77
  labelText: NonNullable<ExternalProps["labelText"]>;
78
78
  linterContext: NonNullable<ExternalProps["linterContext"]>;
79
- multipleNumberInput: NonNullable<ExternalProps["multipleNumberInput"]>;
80
79
  currentValue: string;
81
80
  };
82
81
 
@@ -89,7 +88,6 @@ type DefaultProps = {
89
88
  answerForms: Props["answerForms"];
90
89
  labelText: Props["labelText"];
91
90
  linterContext: Props["linterContext"];
92
- multipleNumberInput: Props["multipleNumberInput"];
93
91
  };
94
92
 
95
93
  type State = {
@@ -110,7 +108,6 @@ export class NumericInput extends React.Component<Props, State> {
110
108
  answerForms: [],
111
109
  labelText: "",
112
110
  linterContext: linterContextDefault,
113
- multipleNumberInput: false,
114
111
  };
115
112
 
116
113
  static getUserInputFromProps(props: Props): UserInput {
@@ -48,7 +48,7 @@ type HighlightNode = {
48
48
  content: string;
49
49
  };
50
50
 
51
- type RefStartProps = {
51
+ type Props = {
52
52
  refContent: React.ReactNode;
53
53
  };
54
54
 
@@ -63,7 +63,7 @@ function getInitialParseState(): ParseState {
63
63
  };
64
64
  }
65
65
 
66
- class RefStart extends React.Component<RefStartProps> {
66
+ class RefStart extends React.Component<Props> {
67
67
  render(): React.ReactNode {
68
68
  return <span style={REF_STYLE}>{i18n.doNotTranslate("_")}</span>;
69
69
  }
@@ -60,27 +60,27 @@ const defaultProps = {
60
60
  isLastUsedWidget: false,
61
61
  } as const;
62
62
 
63
- export const Interactive: React.FC<StoryArgs> = (args): React.ReactElement => {
63
+ export const Interactive = (args: StoryArgs): React.ReactElement => {
64
64
  const overwrittenProps = {...defaultProps, ...args} as const;
65
65
  return <BaseRadio {...overwrittenProps} />;
66
66
  };
67
67
 
68
- export const SingleSelectWithNothingSelected: React.FC<StoryArgs> = (
69
- args,
68
+ export const SingleSelectWithNothingSelected = (
69
+ args: StoryArgs,
70
70
  ): React.ReactElement => {
71
71
  const overwrittenProps = {...defaultProps, multipleSelect: false} as const;
72
72
  return <BaseRadio {...overwrittenProps} />;
73
73
  };
74
74
 
75
- export const MultipleSelectWithNothingSelected: React.FC<StoryArgs> = (
76
- args,
75
+ export const MultipleSelectWithNothingSelected = (
76
+ args: StoryArgs,
77
77
  ): React.ReactElement => {
78
78
  const overwrittenProps = {...defaultProps, multipleSelect: true} as const;
79
79
  return <BaseRadio {...overwrittenProps} />;
80
80
  };
81
81
 
82
- export const MultipleSelectWithCountChoicesLabel: React.FC<StoryArgs> = (
83
- args,
82
+ export const MultipleSelectWithCountChoicesLabel = (
83
+ args: StoryArgs,
84
84
  ): React.ReactElement => {
85
85
  const overwrittenProps = {
86
86
  ...defaultProps,
@@ -91,9 +91,7 @@ export const MultipleSelectWithCountChoicesLabel: React.FC<StoryArgs> = (
91
91
  return <BaseRadio {...overwrittenProps} />;
92
92
  };
93
93
 
94
- export const SingleSelected: React.FC<StoryArgs> = (
95
- args,
96
- ): React.ReactElement => {
94
+ export const SingleSelected = (args: StoryArgs): React.ReactElement => {
97
95
  const choices = Array(4)
98
96
  .fill(null)
99
97
  .map((_, i) => generateChoice({content: `Choice ${i + 1}`}));
@@ -107,9 +105,7 @@ export const SingleSelected: React.FC<StoryArgs> = (
107
105
  return <BaseRadio {...overwrittenProps} />;
108
106
  };
109
107
 
110
- export const MultipleSelected: React.FC<StoryArgs> = (
111
- args,
112
- ): React.ReactElement => {
108
+ export const MultipleSelected = (args: StoryArgs): React.ReactElement => {
113
109
  const choices = Array(4)
114
110
  .fill(null)
115
111
  .map((_, i) => generateChoice({content: `Choice ${i + 1}`}));
@@ -124,9 +120,7 @@ export const MultipleSelected: React.FC<StoryArgs> = (
124
120
  return <BaseRadio {...overwrittenProps} />;
125
121
  };
126
122
 
127
- export const SingleKitchenSink: React.FC<StoryArgs> = (
128
- args,
129
- ): React.ReactElement => {
123
+ export const SingleKitchenSink = (args: StoryArgs): React.ReactElement => {
130
124
  const choices = Array(4)
131
125
  .fill(null)
132
126
  .map((_, i) => {
@@ -162,9 +156,7 @@ export const SingleKitchenSink: React.FC<StoryArgs> = (
162
156
  return <BaseRadio {...overwrittenProps} />;
163
157
  };
164
158
 
165
- export const MultipleKitchenSink: React.FC<StoryArgs> = (
166
- args,
167
- ): React.ReactElement => {
159
+ export const MultipleKitchenSink = (args: StoryArgs): React.ReactElement => {
168
160
  const choices = Array(4)
169
161
  .fill(null)
170
162
  .map((_, i) => {