@khanacademy/perseus 4.0.1 → 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 (210) hide show
  1. package/CHANGELOG.md +26 -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 +3 -3
  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 +53 -233
  25. package/dist/es/index.js.map +1 -1
  26. package/dist/index.js +53 -233
  27. package/dist/index.js.map +1 -1
  28. package/dist/multi-items/multi-renderer.d.ts +1 -1
  29. package/dist/multi-items/multi-renderer.js.flow +1 -1
  30. package/dist/multi-items/prop-type-builders.d.ts +1 -1
  31. package/dist/multi-items/shape-types.d.ts +1 -1
  32. package/dist/multi-items/shape-types.js.flow +1 -1
  33. package/dist/multi-items/tree-types.d.ts +1 -1
  34. package/dist/multi-items/tree-types.js.flow +1 -1
  35. package/dist/perseus-types.d.ts +0 -1
  36. package/dist/perseus-types.js.flow +0 -1
  37. package/dist/widgets/__stories__/test-keypad-context-wrapper.d.ts +6 -0
  38. package/dist/widgets/__stories__/test-keypad-context-wrapper.js.flow +12 -0
  39. package/dist/widgets/expression.d.ts +2 -2
  40. package/dist/widgets/expression.js.flow +2 -2
  41. package/dist/widgets/interaction/element-container.d.ts +5 -4
  42. package/dist/widgets/interaction/element-container.js.flow +6 -11
  43. package/dist/widgets/label-image/marker.d.ts +4 -4
  44. package/dist/widgets/label-image/marker.js.flow +4 -6
  45. package/dist/widgets/numeric-input.d.ts +0 -2
  46. package/dist/widgets/numeric-input.js.flow +0 -4
  47. package/dist/widgets/radio/base-radio.d.ts +7 -1
  48. package/dist/widgets/radio/base-radio.js.flow +7 -1
  49. package/dist/widgets/radio/choice-icon/choice-icon.d.ts +1 -1
  50. package/dist/widgets/radio/choice-icon/choice-icon.js.flow +1 -1
  51. package/dist/widgets/radio/choice-icon/cross-out-line.d.ts +2 -2
  52. package/dist/widgets/radio/choice-icon/cross-out-line.js.flow +2 -2
  53. package/dist/widgets/radio/focus-ring.d.ts +8 -1
  54. package/dist/widgets/radio/focus-ring.js.flow +8 -1
  55. package/dist/widgets/radio/option-status.d.ts +2 -2
  56. package/dist/widgets/radio/option-status.js.flow +2 -2
  57. package/dist/widgets/video-transcript-link.d.ts +1 -1
  58. package/dist/widgets/video-transcript-link.js.flow +1 -1
  59. package/package.json +4 -4
  60. package/src/__stories__/item-renderer.stories.tsx +2 -6
  61. package/src/__stories__/server-item-renderer.stories.tsx +2 -6
  62. package/src/__testdata__/item-renderer.testdata.ts +1 -1
  63. package/src/__testdata__/renderer.testdata.ts +1 -1
  64. package/src/__tests__/item-renderer.test.tsx +1 -2
  65. package/src/__tests__/renderer-api.test.tsx +1 -5
  66. package/src/__tests__/renderer.test.tsx +1 -1
  67. package/src/components/__stories__/button-group.stories.tsx +2 -6
  68. package/src/components/__stories__/fixed-to-responsive.stories.tsx +14 -16
  69. package/src/components/__stories__/graph.stories.tsx +3 -5
  70. package/src/components/__stories__/graphie.stories.tsx +3 -5
  71. package/src/components/__stories__/hud.stories.tsx +2 -6
  72. package/src/components/__stories__/icon.stories.tsx +1 -1
  73. package/src/components/__stories__/image-loader.stories.tsx +4 -4
  74. package/src/components/__stories__/info-tip.stories.tsx +2 -6
  75. package/src/components/__stories__/inline-icon.stories.tsx +4 -8
  76. package/src/components/__stories__/input-with-examples.stories.tsx +6 -10
  77. package/src/components/__stories__/lint.stories.tsx +12 -12
  78. package/src/components/__stories__/math-input.stories.tsx +4 -8
  79. package/src/components/__stories__/math-output.stories.tsx +3 -5
  80. package/src/components/__stories__/multi-button-group.stories.tsx +2 -6
  81. package/src/components/__stories__/number-input.stories.tsx +6 -8
  82. package/src/components/__stories__/prop-check-box.stories.tsx +9 -9
  83. package/src/components/__stories__/range-input.stories.tsx +4 -6
  84. package/src/components/__stories__/simple-keypad-input.stories.tsx +2 -4
  85. package/src/components/__stories__/sortable.stories.tsx +15 -15
  86. package/src/components/__stories__/stub-tag-editor.stories.tsx +5 -9
  87. package/src/components/__stories__/svg-image.stories.tsx +10 -18
  88. package/src/components/__stories__/tex.stories.tsx +1 -3
  89. package/src/components/__stories__/text-buttons.stories.tsx +10 -22
  90. package/src/components/__stories__/text-input.stories.tsx +4 -10
  91. package/src/components/__stories__/text-list-editor.stories.tsx +1 -3
  92. package/src/components/__stories__/zoomable-tex.stories.tsx +6 -4
  93. package/src/components/__stories__/zoomable.stories.tsx +1 -3
  94. package/src/components/fixed-to-responsive.tsx +0 -1
  95. package/src/components/graph.tsx +0 -4
  96. package/src/components/highlighting/highlightable-content.tsx +4 -7
  97. package/src/components/highlighting/ui/highlight-renderer.tsx +6 -9
  98. package/src/components/highlighting/ui/highlight-set-renderer.tsx +5 -8
  99. package/src/components/highlighting/ui/highlight-tooltip.tsx +2 -2
  100. package/src/components/highlighting/ui/highlighting-ui.tsx +5 -15
  101. package/src/components/highlighting/ui/selection-tracker.tsx +6 -9
  102. package/src/components/highlighting/word-indexer.tsx +2 -6
  103. package/src/components/inline-icon.tsx +2 -2
  104. package/src/components/math-input.tsx +0 -2
  105. package/src/components/number-input.tsx +0 -2
  106. package/src/components/simple-keypad-input.tsx +2 -2
  107. package/src/components/tex-buttons.tsx +2 -2
  108. package/src/components/text-list-editor.tsx +0 -4
  109. package/src/components/visibility-observer/__stories__/visibility-observer.stories.tsx +1 -3
  110. package/src/components/zoomable-tex.tsx +0 -2
  111. package/src/components/zoomable.tsx +0 -4
  112. package/src/definition-context.tsx +0 -1
  113. package/src/error-boundary.tsx +4 -7
  114. package/src/hints-renderer.tsx +1 -1
  115. package/src/interactive2/__tests__/movable-point.test.ts +0 -1
  116. package/src/item-renderer.tsx +0 -5
  117. package/src/mixins/changeable.ts +1 -1
  118. package/src/multi-items/__stories__/multi-renderer.stories.tsx +1 -5
  119. package/src/multi-items/__tests__/items.test.ts +3 -13
  120. package/src/multi-items/__tests__/multi-renderer.test.tsx +3 -4
  121. package/src/multi-items/__tests__/prop-type-builders.test.ts +1 -1
  122. package/src/multi-items/__tests__/trees.test.ts +2 -10
  123. package/src/multi-items/multi-renderer.tsx +7 -10
  124. package/src/multi-items/prop-type-builders.ts +1 -1
  125. package/src/multi-items/shape-types.ts +1 -1
  126. package/src/multi-items/tree-types.ts +1 -1
  127. package/src/perseus-markdown.tsx +0 -2
  128. package/src/perseus-types.ts +1 -4
  129. package/src/renderer.tsx +2 -5
  130. package/src/server-item-renderer.tsx +0 -3
  131. package/src/util/graphie.ts +3 -3
  132. package/src/util/interactive.ts +0 -4
  133. package/src/util/math.ts +0 -3
  134. package/src/widgets/__stories__/categorizer.stories.tsx +1 -1
  135. package/src/widgets/__stories__/cs-program.stories.tsx +1 -1
  136. package/src/widgets/__stories__/definition.stories.tsx +3 -7
  137. package/src/widgets/__stories__/dropdown.stories.tsx +1 -1
  138. package/src/widgets/__stories__/explanation.stories.tsx +2 -2
  139. package/src/widgets/__stories__/expression.stories.tsx +113 -13
  140. package/src/widgets/__stories__/graded-group-set.stories.tsx +1 -1
  141. package/src/widgets/__stories__/graded-group.stories.tsx +1 -1
  142. package/src/widgets/__stories__/grapher.stories.tsx +7 -21
  143. package/src/widgets/__stories__/group.stories.tsx +1 -1
  144. package/src/widgets/__stories__/iframe.stories.tsx +1 -1
  145. package/src/widgets/__stories__/image.stories.tsx +2 -2
  146. package/src/widgets/__stories__/input-number.stories.tsx +3 -12
  147. package/src/widgets/__stories__/interaction.stories.tsx +1 -1
  148. package/src/widgets/__stories__/interactive-graph.stories.tsx +9 -9
  149. package/src/widgets/__stories__/matcher.stories.tsx +1 -1
  150. package/src/widgets/__stories__/matrix.stories.tsx +1 -1
  151. package/src/widgets/__stories__/number-line.stories.tsx +1 -1
  152. package/src/widgets/__stories__/numeric-input.stories.tsx +3 -5
  153. package/src/widgets/__stories__/orderer.stories.tsx +1 -1
  154. package/src/widgets/__stories__/passage-ref.stories.tsx +2 -2
  155. package/src/widgets/__stories__/passage.stories.tsx +3 -9
  156. package/src/widgets/__stories__/radio.stories.tsx +3 -5
  157. package/src/widgets/__stories__/sorter.stories.tsx +1 -1
  158. package/src/widgets/__stories__/{on-screen-keypad.stories.tsx → test-keypad-context-wrapper.tsx} +15 -57
  159. package/src/widgets/__stories__/transformer.stories.tsx +1 -1
  160. package/src/widgets/__stories__/unit.stories.tsx +1 -3
  161. package/src/widgets/__stories__/video-transcript-link.stories.tsx +2 -6
  162. package/src/widgets/__stories__/video.stories.tsx +1 -1
  163. package/src/widgets/__testdata__/expression.testdata.ts +16 -12
  164. package/src/widgets/__testdata__/group.testdata.ts +0 -2
  165. package/src/widgets/__testdata__/numeric-input.testdata.ts +0 -1
  166. package/src/widgets/__testdata__/transformer.testdata.ts +0 -1
  167. package/src/widgets/__tests__/group.test.tsx +0 -2
  168. package/src/widgets/__tests__/radio/focus-ring.test.tsx +0 -1
  169. package/src/widgets/__tests__/radio.test.ts +1 -1
  170. package/src/widgets/expression.tsx +4 -4
  171. package/src/widgets/graded-group-set.tsx +0 -4
  172. package/src/widgets/graded-group.tsx +0 -4
  173. package/src/widgets/grapher/util.tsx +1 -5
  174. package/src/widgets/grapher.tsx +0 -5
  175. package/src/widgets/group.tsx +0 -1
  176. package/src/widgets/interaction/element-container.tsx +7 -8
  177. package/src/widgets/interaction.tsx +0 -1
  178. package/src/widgets/interactive-graph.tsx +3 -62
  179. package/src/widgets/label-image/__stories__/answer-choices.stories.tsx +2 -4
  180. package/src/widgets/label-image/__stories__/marker.stories.tsx +9 -19
  181. package/src/widgets/label-image/marker.tsx +4 -4
  182. package/src/widgets/label-image.tsx +1 -1
  183. package/src/widgets/measurer.tsx +0 -1
  184. package/src/widgets/number-line.tsx +0 -2
  185. package/src/widgets/numeric-input.tsx +0 -3
  186. package/src/widgets/orderer.tsx +0 -3
  187. package/src/widgets/passage/passage-markdown.tsx +3 -3
  188. package/src/widgets/passage-ref-target.tsx +0 -1
  189. package/src/widgets/passage.tsx +1 -1
  190. package/src/widgets/plotter.tsx +0 -1
  191. package/src/widgets/radio/__stories__/base-radio.stories.tsx +13 -21
  192. package/src/widgets/radio/__stories__/choice-icon.stories.tsx +9 -11
  193. package/src/widgets/radio/__stories__/choice-none-above.stories.tsx +1 -1
  194. package/src/widgets/radio/__stories__/choice.stories.tsx +4 -4
  195. package/src/widgets/radio/__stories__/focus-ring.stories.tsx +1 -1
  196. package/src/widgets/radio/__stories__/option-status.stories.tsx +2 -4
  197. package/src/widgets/radio/base-radio.tsx +2 -2
  198. package/src/widgets/radio/choice-icon/choice-icon.tsx +5 -5
  199. package/src/widgets/radio/choice-icon/cross-out-line.tsx +1 -3
  200. package/src/widgets/radio/choice-none-above.tsx +2 -2
  201. package/src/widgets/radio/choice.tsx +1 -3
  202. package/src/widgets/radio/focus-ring.tsx +1 -1
  203. package/src/widgets/radio/option-status.tsx +2 -4
  204. package/src/widgets/radio/widget.tsx +0 -1
  205. package/src/widgets/reaction-diagram.tsx +2 -2
  206. package/src/widgets/transformer.tsx +1 -16
  207. package/src/widgets/video-transcript-link.tsx +1 -1
  208. package/src/widgets.ts +1 -1
  209. package/src/zoom.ts +0 -3
  210. package/tsconfig.tsbuildinfo +1 -1
@@ -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
 
@@ -11,7 +11,7 @@ import {Popover, PopoverContentCore} from "@khanacademy/wonder-blocks-popover";
11
11
  import {StyleSheet, css} from "aphrodite";
12
12
  import classNames from "classnames";
13
13
  import * as React from "react";
14
- import ReactDOM from "react-dom";
14
+ import * as ReactDOM from "react-dom";
15
15
 
16
16
  import AssetContext from "../asset-context";
17
17
  import SvgImage from "../components/svg-image";
@@ -79,7 +79,6 @@ const Measurer: any = createReactClass({
79
79
  left: image.left,
80
80
  }}
81
81
  >
82
- {/* $FlowFixMe[prop-missing]: alt prop is missing */}
83
82
  {/* @ts-expect-error [FEI-5003] - TS2741 - Property 'alt' is missing in type '{ src: any; }' but required in type 'Pick<Readonly<Props> & Readonly<{ children?: ReactNode; }>, "children" | "height" | "width" | "title" | "alt" | "trackInteraction" | "preloader" | "allowFullBleed" | "extraGraphie" | "overrideAriaHidden">'. */}
84
83
  <SvgImage src={image.url} />
85
84
  </div>
@@ -160,7 +160,6 @@ const TickMarks: any = Graphie.createSimpleClass((graphie, props) => {
160
160
  color: KhanColors.BLUE_D,
161
161
  }
162
162
  : {},
163
- // $FlowFixMe[incompatible-call]
164
163
  () => _label(graphie, props.labelStyle, leftLabel, leftLabel, base),
165
164
  ),
166
165
  );
@@ -173,7 +172,6 @@ const TickMarks: any = Graphie.createSimpleClass((graphie, props) => {
173
172
  }
174
173
  : {},
175
174
  () =>
176
- // $FlowFixMe[incompatible-call]
177
175
  _label(graphie, props.labelStyle, rightLabel, rightLabel, base),
178
176
  ),
179
177
  );
@@ -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 {
@@ -502,10 +502,7 @@ class Orderer extends React.Component<OrdererProps, OrdererState> {
502
502
  current: list,
503
503
  dragging: true,
504
504
  placeholderIndex: placeholderIndex,
505
- // $FlowFixMe[prop-missing]
506
- // $FlowFixMe[incompatible-use]
507
505
  dragKey: opt.key,
508
- // $FlowFixMe[incompatible-use]
509
506
  dragContent: opt.content,
510
507
  // @ts-expect-error [FEI-5003] - TS2339 - Property 'width' does not exist on type 'JQueryStatic'.
511
508
  dragWidth: $draggable.width(),
@@ -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
  }
@@ -150,7 +150,7 @@ const rules = {
150
150
 
151
151
  // A "magic" capture that matches the opening {{
152
152
  // but captures the full ref text internally :D
153
- // unfortunately the "magic" makes Flow upset,
153
+ // unfortunately the "magic" makes TypeScript upset,
154
154
  // so there's this questionable workaround
155
155
  capture[1] = source.slice(2, closeIndex);
156
156
  return capture;
@@ -47,7 +47,6 @@ class PassageRefTarget extends React.Component<any> {
47
47
 
48
48
  render(): React.ReactNode {
49
49
  return (
50
- // $FlowFixMe[prop-missing]: inline doesn't exist in Renderer's declared props
51
50
  <Renderer
52
51
  content={this.props.content}
53
52
  // @ts-expect-error [FEI-5003] - TS2322 - Type '{ content: any; inline: boolean; apiOptions: any; linterContext: any; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Renderer> & Pick<Readonly<Props> & Readonly<{ children?: ReactNode; }>, "children" | ... 3 more ... | "legacyPerseusLint"> & InexactPartial<...> & InexactPartial<...>'.
@@ -3,7 +3,7 @@ import * as i18n from "@khanacademy/wonder-blocks-i18n";
3
3
  import {StyleSheet, css} from "aphrodite";
4
4
  import $ from "jquery";
5
5
  import * as React from "react";
6
- import ReactDOM from "react-dom";
6
+ import * as ReactDOM from "react-dom";
7
7
  import _ from "underscore";
8
8
 
9
9
  import HighlightableContent from "../components/highlighting/highlightable-content";
@@ -927,7 +927,6 @@ class Plotter extends React.Component<any, any> {
927
927
  if (i > 0) {
928
928
  c.graph.lines[i] = Interactive2.addMovableLine(graphie, {
929
929
  points: [c.graph.points[i - 1], c.graph.points[i]],
930
- // $FlowFixMe[prop-missing]
931
930
  // @ts-expect-error [FEI-5003] - TS2339 - Property 'constraints' does not exist on type '(graphie: any, movable: any, options: any) => void'.
932
931
  constraints: Interactive2.MovablePoint.constraints.fixed(),
933
932
  normalStyle: {
@@ -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) => {
@@ -146,7 +140,7 @@ export const SingleKitchenSink: React.FC<StoryArgs> = (
146
140
 
147
141
  const rubricChoices = choices.map(({correct}) => ({
148
142
  // note(matthew): reviewModeRubric.choices requires content,
149
- // but I don't see how it's getting used and Flow gets mad
143
+ // but I don't see how it's getting used and TypeScript gets mad
150
144
  // when I use choice.content because it's not a string.
151
145
  // reviewModeRubric could probably use a look over.
152
146
  content: "",
@@ -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) => {
@@ -186,7 +178,7 @@ export const MultipleKitchenSink: React.FC<StoryArgs> = (
186
178
 
187
179
  const rubricChoices = choices.map((c) => ({
188
180
  // note(matthew): reviewModeRubric.choices requires content,
189
- // but I don't see how it's getting used and Flow gets mad
181
+ // but I don't see how it's getting used and TypeScript gets mad
190
182
  // when I use choice.content because it's not a string.
191
183
  // reviewModeRubric could probably use a look over.
192
184
  content: "",
@@ -40,13 +40,11 @@ export default {
40
40
  args: defaultProps,
41
41
  };
42
42
 
43
- const Panel: React.FC<{
44
- children: React.ReactNode;
45
- }> = (props): React.ReactElement => {
43
+ const Panel = (props: {children: React.ReactNode}): React.ReactElement => {
46
44
  return <div style={{padding: "10px"}}>{props.children}</div>;
47
45
  };
48
46
 
49
- export const Interactive: React.FC<StoryArgs> = (args): React.ReactElement => {
47
+ export const Interactive = (args: StoryArgs): React.ReactElement => {
50
48
  return (
51
49
  <Panel>
52
50
  <ChoiceIcon {...args} />
@@ -54,7 +52,7 @@ export const Interactive: React.FC<StoryArgs> = (args): React.ReactElement => {
54
52
  );
55
53
  };
56
54
 
57
- export const Default: React.FC<StoryArgs> = (args): React.ReactElement => {
55
+ export const Default = (args: StoryArgs): React.ReactElement => {
58
56
  return (
59
57
  <Panel>
60
58
  <ChoiceIcon {...defaultProps} />
@@ -63,7 +61,7 @@ export const Default: React.FC<StoryArgs> = (args): React.ReactElement => {
63
61
  );
64
62
  };
65
63
 
66
- export const Focused: React.FC<StoryArgs> = (args): React.ReactElement => {
64
+ export const Focused = (args: StoryArgs): React.ReactElement => {
67
65
  return (
68
66
  <Panel>
69
67
  <ChoiceIcon {...defaultProps} focused={true} />
@@ -76,7 +74,7 @@ export const Focused: React.FC<StoryArgs> = (args): React.ReactElement => {
76
74
  );
77
75
  };
78
76
 
79
- export const Checked: React.FC<StoryArgs> = (args): React.ReactElement => {
77
+ export const Checked = (args: StoryArgs): React.ReactElement => {
80
78
  return (
81
79
  <Panel>
82
80
  <ChoiceIcon {...defaultProps} checked={true} />
@@ -89,7 +87,7 @@ export const Checked: React.FC<StoryArgs> = (args): React.ReactElement => {
89
87
  );
90
88
  };
91
89
 
92
- export const CrossedOut: React.FC<StoryArgs> = (args): React.ReactElement => {
90
+ export const CrossedOut = (args: StoryArgs): React.ReactElement => {
93
91
  return (
94
92
  <Panel>
95
93
  <ChoiceIcon {...defaultProps} crossedOut={true} />
@@ -102,7 +100,7 @@ export const CrossedOut: React.FC<StoryArgs> = (args): React.ReactElement => {
102
100
  );
103
101
  };
104
102
 
105
- export const Correct: React.FC<StoryArgs> = (args): React.ReactElement => {
103
+ export const Correct = (args: StoryArgs): React.ReactElement => {
106
104
  return (
107
105
  <Panel>
108
106
  <ChoiceIcon
@@ -124,7 +122,7 @@ export const Correct: React.FC<StoryArgs> = (args): React.ReactElement => {
124
122
  );
125
123
  };
126
124
 
127
- export const Incorrect: React.FC<StoryArgs> = (args): React.ReactElement => {
125
+ export const Incorrect = (args: StoryArgs): React.ReactElement => {
128
126
  return (
129
127
  <Panel>
130
128
  <ChoiceIcon
@@ -146,7 +144,7 @@ export const Incorrect: React.FC<StoryArgs> = (args): React.ReactElement => {
146
144
  );
147
145
  };
148
146
 
149
- export const AllPositions: React.FC<StoryArgs> = (args): React.ReactElement => {
147
+ export const AllPositions = (args: StoryArgs): React.ReactElement => {
150
148
  // @ts-expect-error [FEI-5003] - TS2554 - Expected 1-3 arguments, but got 0.
151
149
  const allLetters = Array(26).fill();
152
150
  return (
@@ -34,7 +34,7 @@ const ChoiceDefaults = {
34
34
  onChange: action("changed"),
35
35
  } as const;
36
36
 
37
- export const Example: React.FC<StoryArgs> = (args): React.ReactElement => {
37
+ export const Example = (args: StoryArgs): React.ReactElement => {
38
38
  const combineProps = {...ChoiceDefaults, ...args} as const;
39
39
  return <ChoiceNoneAbove {...combineProps} />;
40
40
  };
@@ -45,11 +45,11 @@ export default {
45
45
  args: defaultProps,
46
46
  } as Story;
47
47
 
48
- export const Interactive: React.FC<StoryArgs> = (args): React.ReactElement => {
48
+ export const Interactive = (args: StoryArgs): React.ReactElement => {
49
49
  return <Choice {...args} />;
50
50
  };
51
51
 
52
- export const Checked: React.FC<StoryArgs> = (args): React.ReactElement => {
52
+ export const Checked = (args: StoryArgs): React.ReactElement => {
53
53
  const sharedProps = {
54
54
  ...defaultProps,
55
55
  checked: true,
@@ -73,7 +73,7 @@ export const Checked: React.FC<StoryArgs> = (args): React.ReactElement => {
73
73
  );
74
74
  };
75
75
 
76
- export const ReviewMode: React.FC<StoryArgs> = (args): React.ReactElement => {
76
+ export const ReviewMode = (args: StoryArgs): React.ReactElement => {
77
77
  const sharedProps = {
78
78
  ...defaultProps,
79
79
  showCorrectness: true,
@@ -108,7 +108,7 @@ export const ReviewMode: React.FC<StoryArgs> = (args): React.ReactElement => {
108
108
  );
109
109
  };
110
110
 
111
- export const Rationale: React.FC<StoryArgs> = (args): React.ReactElement => {
111
+ export const Rationale = (args: StoryArgs): React.ReactElement => {
112
112
  const sharedProps = {
113
113
  ...defaultProps,
114
114
  checked: true,
@@ -25,7 +25,7 @@ export default {
25
25
  },
26
26
  } as Story;
27
27
 
28
- export const Interactive: React.FC<StoryArgs> = (args): React.ReactElement => {
28
+ export const Interactive = (args: StoryArgs): React.ReactElement => {
29
29
  // faux choice is just for demonstration
30
30
  const fauxChoiceStyles = {
31
31
  height: "20px",
@@ -26,13 +26,11 @@ export default {
26
26
  },
27
27
  } as Story;
28
28
 
29
- export const Interactive: React.FC<StoryArgs> = (args): React.ReactElement => {
29
+ export const Interactive = (args: StoryArgs): React.ReactElement => {
30
30
  return <OptionStatus {...args} />;
31
31
  };
32
32
 
33
- export const AllPossibleOutputs: React.FC<StoryArgs> = (
34
- args,
35
- ): React.ReactElement => {
33
+ export const AllPossibleOutputs = (args: StoryArgs): React.ReactElement => {
36
34
  return (
37
35
  <>
38
36
  <div>
@@ -86,7 +86,7 @@ function getInstructionsText(
86
86
  return i18n._("Choose 1 answer:");
87
87
  }
88
88
 
89
- const BaseRadio: React.FC<Props> = function (props): React.ReactElement {
89
+ const BaseRadio = function (props: Props): React.ReactElement {
90
90
  const {
91
91
  apiOptions,
92
92
  reviewModeRubric,
@@ -325,7 +325,7 @@ const BaseRadio: React.FC<Props> = function (props): React.ReactElement {
325
325
 
326
326
  let correctnessClass;
327
327
  // reviewMode is only true if there's a rubric
328
- // but Flow doesn't understand that
328
+ // but TypeScript doesn't understand that
329
329
  if (reviewMode && reviewModeRubric) {
330
330
  correctnessClass = reviewModeRubric.choices[i].correct
331
331
  ? ApiClassNames.CORRECT
@@ -27,11 +27,13 @@ type ChoiceIconProps = {
27
27
  previouslyAnswered: boolean;
28
28
  };
29
29
 
30
- function ChoiceInner(props: {
30
+ type ChoiceInnerProps = {
31
31
  pos: number;
32
32
  showCorrectness: boolean;
33
33
  correct: boolean | null | undefined;
34
- }) {
34
+ };
35
+
36
+ function ChoiceInner(props: ChoiceInnerProps) {
35
37
  const {pos, showCorrectness, correct} = props;
36
38
  const letter = getChoiceLetter(pos);
37
39
 
@@ -96,9 +98,7 @@ function getDynamicStyles(
96
98
  return {backgroundColor, borderColor, color, borderRadius};
97
99
  }
98
100
 
99
- const ChoiceIcon: React.FC<ChoiceIconProps> = function (
100
- props,
101
- ): React.ReactElement {
101
+ const ChoiceIcon = function (props: ChoiceIconProps): React.ReactElement {
102
102
  const {
103
103
  checked,
104
104
  crossedOut,
@@ -14,9 +14,7 @@ const CROSS_OUT_LINE_SIZE = CHOICE_ICON_SIZE + CROSS_OUT_LINE_PADDING * 2;
14
14
  * The "cross-out line" that appears over the icon when the choice has been
15
15
  * `crossedOut`.
16
16
  */
17
- const CrossOutLine: React.FC<{
18
- color: string;
19
- }> = function (props): React.ReactElement {
17
+ const CrossOutLine = function (props: {color: string}): React.ReactElement {
20
18
  return (
21
19
  <svg
22
20
  width={CROSS_OUT_LINE_SIZE}
@@ -17,8 +17,8 @@ type WithForwardRef = {
17
17
 
18
18
  type PropsWithForwardRef = Props & WithForwardRef;
19
19
 
20
- const ChoiceNoneAbove: React.FC<PropsWithForwardRef> = function (
21
- props,
20
+ const ChoiceNoneAbove = function (
21
+ props: PropsWithForwardRef,
22
22
  ): React.ReactElement {
23
23
  const {showContent, content, forwardedRef, ...rest} = props;
24
24
 
@@ -78,9 +78,7 @@ function uniqueId() {
78
78
  return `choice-${id++}`;
79
79
  }
80
80
 
81
- const Choice: React.FC<ChoicePropsWithForwardRef> = function (
82
- props,
83
- ): React.ReactElement {
81
+ const Choice = function (props: ChoicePropsWithForwardRef): React.ReactElement {
84
82
  const {
85
83
  disabled = false,
86
84
  checked = false,
@@ -18,7 +18,7 @@ type Props = {
18
18
  multipleSelect: boolean;
19
19
  };
20
20
 
21
- const FocusRing: React.FC<Props> = function (props): React.ReactElement {
21
+ const FocusRing = function (props: Props): React.ReactElement {
22
22
  const {visible, color, children, multipleSelect} = props;
23
23
 
24
24
  const borderColor = visible ? color : "transparent";
@@ -11,7 +11,7 @@ import * as i18n from "@khanacademy/wonder-blocks-i18n";
11
11
  import {StyleSheet, css} from "aphrodite";
12
12
  import * as React from "react";
13
13
 
14
- type OptionStatusProps = {
14
+ type Props = {
15
15
  // Was this option the correct answer?
16
16
  correct: boolean;
17
17
  // Did the user select this option as the answer?
@@ -47,9 +47,7 @@ function renderText(
47
47
  return i18n._("Incorrect");
48
48
  }
49
49
 
50
- const OptionStatus: React.FC<OptionStatusProps> = function (
51
- props,
52
- ): React.ReactElement {
50
+ const OptionStatus = function (props: Props): React.ReactElement {
53
51
  const {checked, correct, crossedOut, previouslyAnswered, reviewMode} =
54
52
  props;
55
53
 
@@ -502,7 +502,6 @@ class Radio extends React.Component<Props> {
502
502
  return (
503
503
  <BaseRadio
504
504
  labelWrap={true}
505
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'boolean | undefined' is not assignable to type 'boolean'.
506
505
  multipleSelect={this.props.multipleSelect}
507
506
  countChoices={this.props.countChoices}
508
507
  numCorrect={this.props.numCorrect}
@@ -7,6 +7,8 @@ import {Molecule} from "./molecule";
7
7
  import type {WidgetExports} from "../types";
8
8
 
9
9
  class Separator extends React.Component<any> {
10
+ arrowLength = 100;
11
+
10
12
  static propTypes = {
11
13
  // TODO(colin): figure out and add shape.
12
14
  data: PropTypes.any,
@@ -21,8 +23,6 @@ class Separator extends React.Component<any> {
21
23
  this.drawArrow();
22
24
  }
23
25
 
24
- arrowLength = 100;
25
-
26
26
  drawArrow = () => {
27
27
  // eslint-disable-next-line react/no-string-refs
28
28
  const canvas = this.refs["arrowCanvas" + this.props.index];