@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @khanacademy/perseus
2
2
 
3
+ ## 5.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 472e20e1: Remove all references to multipleNumberInput (ie. Ask for (one|all) correct solution)
8
+
9
+ ### Patch Changes
10
+
11
+ - 22c5d564: Remove the use of React.FC<> and use types named Props/State in more components
12
+ - Updated dependencies [4c03a43d]
13
+ - Updated dependencies [22c5d564]
14
+ - @khanacademy/math-input@1.0.0
15
+ - @khanacademy/simple-markdown@0.9.3
16
+ - @khanacademy/pure-markdown@0.2.3
17
+
3
18
  ## 4.0.2
4
19
 
5
20
  ### Patch Changes
@@ -1,19 +1,19 @@
1
1
  import * as React from "react";
2
2
  import type { DOMHighlight, DOMHighlightSet, SerializedHighlightSet, DOMRange } from "./types";
3
- type HighlightableContentProps = {
3
+ type Props = {
4
4
  children?: React.ReactElement<any>;
5
5
  editable: boolean;
6
6
  enabled: boolean;
7
7
  onSerializedHighlightsUpdate: (serializedHighlights: SerializedHighlightSet) => unknown;
8
8
  serializedHighlights: SerializedHighlightSet;
9
9
  };
10
- type HighlightableContentState = {
10
+ type State = {
11
11
  wordRanges: ReadonlyArray<DOMRange>;
12
12
  };
13
- declare class HighlightableContent extends React.PureComponent<HighlightableContentProps, HighlightableContentState> {
13
+ declare class HighlightableContent extends React.PureComponent<Props, State> {
14
14
  _container: HTMLElement | null | undefined;
15
15
  _content: HTMLElement | null | undefined;
16
- state: HighlightableContentState;
16
+ state: State;
17
17
  _buildHighlight(highlightRange: DOMRange): DOMHighlight | null | undefined;
18
18
  /**
19
19
  * Take the highlights from props, and deserialize them into DOMHighlights,
@@ -11,7 +11,7 @@ import type {
11
11
  SerializedHighlightSet,
12
12
  DOMRange,
13
13
  } from "./types";
14
- declare type HighlightableContentProps = {|
14
+ declare type Props = {|
15
15
  children?: React.Element<any>,
16
16
  editable: boolean,
17
17
  enabled: boolean,
@@ -20,16 +20,13 @@ declare type HighlightableContentProps = {|
20
20
  ) => mixed,
21
21
  serializedHighlights: SerializedHighlightSet,
22
22
  |};
23
- declare type HighlightableContentState = {|
23
+ declare type State = {|
24
24
  wordRanges: $ReadOnlyArray<DOMRange>,
25
25
  |};
26
- declare class HighlightableContent
27
- extends
28
- React.PureComponent<HighlightableContentProps, HighlightableContentState>
29
- {
26
+ declare class HighlightableContent extends React.PureComponent<Props, State> {
30
27
  _container: HTMLElement | null | void;
31
28
  _content: HTMLElement | null | void;
32
- state: HighlightableContentState;
29
+ state: State;
33
30
  _buildHighlight(highlightRange: DOMRange): DOMHighlight | null | void;
34
31
 
35
32
  /**
@@ -1,23 +1,23 @@
1
1
  import * as React from "react";
2
2
  import type { DOMHighlight, Position, Rect, ZIndexes } from "./types";
3
- type HighlightRendererProps = {
3
+ type Props = {
4
4
  highlight: DOMHighlight;
5
5
  highlightKey: string;
6
6
  offsetParent: Element;
7
7
  zIndexes: ZIndexes;
8
8
  };
9
- type HighlightRendererState = {
9
+ type State = {
10
10
  cachedHighlightRects: ReadonlyArray<Rect>;
11
11
  };
12
- declare class HighlightRenderer extends React.PureComponent<HighlightRendererProps, HighlightRendererState> {
13
- state: HighlightRendererState;
14
- UNSAFE_componentWillReceiveProps(nextProps: HighlightRendererProps): void;
12
+ declare class HighlightRenderer extends React.PureComponent<Props, State> {
13
+ state: State;
14
+ UNSAFE_componentWillReceiveProps(nextProps: Props): void;
15
15
  /**
16
16
  * Compute the set of rectangles that cover the highlighted content, with
17
17
  * coordinates relative to the offset parent. That way, we can use them
18
18
  * for CSS positioning.
19
19
  */
20
- _computeRects(props: HighlightRendererProps): ReadonlyArray<Rect>;
20
+ _computeRects(props: Props): ReadonlyArray<Rect>;
21
21
  /**
22
22
  * Return whether the given mouse position (coordinates relative to this
23
23
  * component's offset parent) is hovering over the given rectangle
@@ -6,27 +6,25 @@
6
6
  */
7
7
  import * as React from "react";
8
8
  import type { DOMHighlight, Position, Rect, ZIndexes } from "./types";
9
- declare type HighlightRendererProps = {|
9
+ declare type Props = {|
10
10
  highlight: DOMHighlight,
11
11
  highlightKey: string,
12
12
  offsetParent: Element,
13
13
  zIndexes: ZIndexes,
14
14
  |};
15
- declare type HighlightRendererState = {|
15
+ declare type State = {|
16
16
  cachedHighlightRects: $ReadOnlyArray<Rect>,
17
17
  |};
18
- declare class HighlightRenderer
19
- extends React.PureComponent<HighlightRendererProps, HighlightRendererState>
20
- {
21
- state: HighlightRendererState;
22
- UNSAFE_componentWillReceiveProps(nextProps: HighlightRendererProps): void;
18
+ declare class HighlightRenderer extends React.PureComponent<Props, State> {
19
+ state: State;
20
+ UNSAFE_componentWillReceiveProps(nextProps: Props): void;
23
21
 
24
22
  /**
25
23
  * Compute the set of rectangles that cover the highlighted content, with
26
24
  * coordinates relative to the offset parent. That way, we can use them
27
25
  * for CSS positioning.
28
26
  */
29
- _computeRects(props: HighlightRendererProps): $ReadOnlyArray<Rect>;
27
+ _computeRects(props: Props): $ReadOnlyArray<Rect>;
30
28
 
31
29
  /**
32
30
  * Return whether the given mouse position (coordinates relative to this
@@ -1,24 +1,24 @@
1
1
  import * as React from "react";
2
2
  import HighlightRenderer from "./highlight-renderer";
3
3
  import type { DOMHighlightSet, Position, ZIndexes } from "./types";
4
- type HighlightSetRendererProps = {
4
+ type Props = {
5
5
  editable: boolean;
6
6
  highlights: DOMHighlightSet;
7
7
  offsetParent: Element;
8
8
  onRemoveHighlight: (highlightKey: string) => unknown;
9
9
  zIndexes: ZIndexes;
10
10
  };
11
- type HighlightSetRendererState = {
11
+ type State = {
12
12
  hoveredHighlightKey: string | null | undefined;
13
13
  hoveringTooltipFor: string | null | undefined;
14
14
  };
15
- declare class HighlightSetRenderer extends React.PureComponent<HighlightSetRendererProps, HighlightSetRendererState> {
16
- state: HighlightSetRendererState;
15
+ declare class HighlightSetRenderer extends React.PureComponent<Props, State> {
16
+ state: State;
17
17
  _highlightRenderers: {
18
18
  [highlightKey: string]: HighlightRenderer;
19
19
  };
20
20
  componentDidMount(): void;
21
- UNSAFE_componentWillReceiveProps(nextProps: HighlightSetRendererProps): void;
21
+ UNSAFE_componentWillReceiveProps(nextProps: Props): void;
22
22
  componentWillUnmount(): void;
23
23
  /**
24
24
  * Given whether we were previously listening to mousemove events, and
@@ -7,27 +7,24 @@
7
7
  import * as React from "react";
8
8
  import HighlightRenderer from "./highlight-renderer";
9
9
  import type { DOMHighlightSet, Position, ZIndexes } from "./types";
10
- declare type HighlightSetRendererProps = {|
10
+ declare type Props = {|
11
11
  editable: boolean,
12
12
  highlights: DOMHighlightSet,
13
13
  offsetParent: Element,
14
14
  onRemoveHighlight: (highlightKey: string) => mixed,
15
15
  zIndexes: ZIndexes,
16
16
  |};
17
- declare type HighlightSetRendererState = {|
17
+ declare type State = {|
18
18
  hoveredHighlightKey: string | null | void,
19
19
  hoveringTooltipFor: string | null | void,
20
20
  |};
21
- declare class HighlightSetRenderer
22
- extends
23
- React.PureComponent<HighlightSetRendererProps, HighlightSetRendererState>
24
- {
25
- state: HighlightSetRendererState;
21
+ declare class HighlightSetRenderer extends React.PureComponent<Props, State> {
22
+ state: State;
26
23
  _highlightRenderers: {
27
24
  [highlightKey: string]: HighlightRenderer,
28
25
  };
29
26
  componentDidMount(): void;
30
- UNSAFE_componentWillReceiveProps(nextProps: HighlightSetRendererProps): void;
27
+ UNSAFE_componentWillReceiveProps(nextProps: Props): void;
31
28
  componentWillUnmount(): void;
32
29
 
33
30
  /**
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import type { Rect } from "./types";
3
- type HighlightTooltipProps = {
3
+ type Props = {
4
4
  label: string;
5
5
  onClick: () => unknown;
6
6
  onMouseEnter?: () => unknown;
@@ -9,7 +9,7 @@ type HighlightTooltipProps = {
9
9
  focusOffset: number;
10
10
  offsetParent: Element;
11
11
  };
12
- declare class HighlightTooltip extends React.PureComponent<HighlightTooltipProps> {
12
+ declare class HighlightTooltip extends React.PureComponent<Props> {
13
13
  _getFocusRect(): Rect | null | undefined;
14
14
  render(): null | React.ReactNode;
15
15
  }
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import * as React from "react";
8
8
  import type { Rect } from "./types";
9
- declare type HighlightTooltipProps = {|
9
+ declare type Props = {|
10
10
  label: string,
11
11
  onClick: () => mixed,
12
12
  onMouseEnter?: () => mixed,
@@ -15,9 +15,7 @@ declare type HighlightTooltipProps = {|
15
15
  focusOffset: number,
16
16
  offsetParent: Element,
17
17
  |};
18
- declare class HighlightTooltip
19
- extends React.PureComponent<HighlightTooltipProps>
20
- {
18
+ declare class HighlightTooltip extends React.PureComponent<Props> {
21
19
  _getFocusRect(): Rect | null | void;
22
20
  render(): null | React.Node;
23
21
  }
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import type { TrackedSelection } from "./selection-tracker";
3
3
  import type { DOMHighlight, DOMHighlightSet, DOMRange, ZIndexes } from "./types";
4
- type HighlightingUIProps = {
4
+ type Props = {
5
5
  buildHighlight: (range: DOMRange) => DOMHighlight | null | undefined;
6
6
  contentNode: Node;
7
7
  editable: boolean;
@@ -11,7 +11,7 @@ type HighlightingUIProps = {
11
11
  onRemoveHighlight: (highlightKey: string) => unknown;
12
12
  zIndexes: ZIndexes;
13
13
  };
14
- declare class HighlightingUI extends React.PureComponent<HighlightingUIProps> {
14
+ declare class HighlightingUI extends React.PureComponent<Props> {
15
15
  _handleAddHighlight(highlightToAdd: DOMHighlight): void;
16
16
  _selectionIsValid(trackedSelection?: TrackedSelection | null): trackedSelection is TrackedSelection;
17
17
  render(): React.ReactNode;
@@ -12,7 +12,7 @@ import type {
12
12
  DOMRange,
13
13
  ZIndexes,
14
14
  } from "./types";
15
- declare type HighlightingUIProps = {|
15
+ declare type Props = {|
16
16
  buildHighlight: (range: DOMRange) => DOMHighlight | null | void,
17
17
  contentNode: Node,
18
18
  editable: boolean,
@@ -22,7 +22,7 @@ declare type HighlightingUIProps = {|
22
22
  onRemoveHighlight: (highlightKey: string) => mixed,
23
23
  zIndexes: ZIndexes,
24
24
  |};
25
- declare class HighlightingUI extends React.PureComponent<HighlightingUIProps> {
25
+ declare class HighlightingUI extends React.PureComponent<Props> {
26
26
  _handleAddHighlight(highlightToAdd: DOMHighlight): void;
27
27
  _selectionIsValid(trackedSelection?: TrackedSelection | null): boolean;
28
28
  render(): React.Node;
@@ -9,19 +9,19 @@ export type TrackedSelection = {
9
9
  focusOffset: number;
10
10
  proposedHighlight: DOMHighlight;
11
11
  };
12
- type SelectionTrackerProps = {
12
+ type Props = {
13
13
  buildHighlight: (domRange: DOMRange) => DOMHighlight | null | undefined;
14
14
  children?: (trackedSelection: TrackedSelection | null | undefined, userIsMouseSelecting: boolean) => React.ReactElement<any>;
15
15
  enabled: boolean;
16
16
  };
17
- type SelectionTrackerState = {
17
+ type State = {
18
18
  mouseState: "down" | "down-and-selecting" | "up";
19
19
  trackedSelection: TrackedSelection | null | undefined;
20
20
  };
21
- declare class SelectionTracker extends React.PureComponent<SelectionTrackerProps, SelectionTrackerState> {
22
- state: SelectionTrackerState;
21
+ declare class SelectionTracker extends React.PureComponent<Props, State> {
22
+ state: State;
23
23
  componentDidMount(): void;
24
- componentDidUpdate(prevProps: SelectionTrackerProps): void;
24
+ componentDidUpdate(prevProps: Props): void;
25
25
  componentWillUnmount(): void;
26
26
  _updateListeners(wasListening: boolean, willListen: boolean): void;
27
27
  /**
@@ -11,7 +11,7 @@ export type TrackedSelection = {|
11
11
  focusOffset: number,
12
12
  proposedHighlight: DOMHighlight,
13
13
  |};
14
- declare type SelectionTrackerProps = {|
14
+ declare type Props = {|
15
15
  buildHighlight: (domRange: DOMRange) => DOMHighlight | null | void,
16
16
  children?: (
17
17
  trackedSelection: TrackedSelection | null | void,
@@ -19,16 +19,14 @@ declare type SelectionTrackerProps = {|
19
19
  ) => React.Element<any>,
20
20
  enabled: boolean,
21
21
  |};
22
- declare type SelectionTrackerState = {|
22
+ declare type State = {|
23
23
  mouseState: "down" | "down-and-selecting" | "up",
24
24
  trackedSelection: TrackedSelection | null | void,
25
25
  |};
26
- declare class SelectionTracker
27
- extends React.PureComponent<SelectionTrackerProps, SelectionTrackerState>
28
- {
29
- state: SelectionTrackerState;
26
+ declare class SelectionTracker extends React.PureComponent<Props, State> {
27
+ state: State;
30
28
  componentDidMount(): void;
31
- componentDidUpdate(prevProps: SelectionTrackerProps): void;
29
+ componentDidUpdate(prevProps: Props): void;
32
30
  componentWillUnmount(): void;
33
31
  _updateListeners(wasListening: boolean, willListen: boolean): void;
34
32
 
@@ -13,11 +13,11 @@
13
13
  */
14
14
  import * as React from "react";
15
15
  import type { DOMRange } from "./types";
16
- type WordIndexerProps = {
16
+ type Props = {
17
17
  children?: React.ReactElement<any>;
18
18
  onWordsUpdate: (wordRanges: ReadonlyArray<DOMRange>) => unknown;
19
19
  };
20
- declare class WordIndexer extends React.PureComponent<WordIndexerProps> {
20
+ declare class WordIndexer extends React.PureComponent<Props> {
21
21
  _container: HTMLElement | null | undefined;
22
22
  componentDidMount(): void;
23
23
  componentDidUpdate(): void;
@@ -6,11 +6,11 @@
6
6
  */
7
7
  import * as React from "react";
8
8
  import type { DOMRange } from "./types";
9
- declare type WordIndexerProps = {|
9
+ declare type Props = {|
10
10
  children?: React.Element<any>,
11
11
  onWordsUpdate: (wordRanges: $ReadOnlyArray<DOMRange>) => mixed,
12
12
  |};
13
- declare class WordIndexer extends React.PureComponent<WordIndexerProps> {
13
+ declare class WordIndexer extends React.PureComponent<Props> {
14
14
  _container: HTMLElement | null | void;
15
15
  componentDidMount(): void;
16
16
  componentDidUpdate(): void;
@@ -1,5 +1,39 @@
1
+ /**
2
+ * A stripped version of Icon.jsx from webapp. Takes an SVG icon and renders it
3
+ * inline like Font Awesome did.
4
+ *
5
+ * If you are looking for an icon that we've used before you should look in
6
+ * webapp's `icon-paths.js` which is a reference file for all the SVG paths
7
+ * that we've used. You'll need to copy the object from that file into
8
+ * whichever file you're using the icon and explicitly pass it in to the
9
+ * <InlineIcon/> React component.
10
+ *
11
+ * We assume that the viewBox is cropped and aligned to (0, 0), but icons can
12
+ * be defined differently. At some point we might want to add these attributes
13
+ * to `icon-paths.js`, but for now this is a fairly safe assumption.
14
+ *
15
+ * Sample usage:
16
+ *
17
+ * const editIcon = {
18
+ * path: "M41.209 53.753l5.39 0l0 5.39l3.136 0l6.468-6.517-8.477-8.526-6.517 6.517l0 3.136zm33.173-34.937q-.882-.882-1.862.049l-19.6 19.6q-.931.98-.049 1.862t1.862-.049l19.6-19.6q.931-.98.049-1.862zm-38.563 45.668l0-16.121l37.632-37.632 16.17 16.121-37.632 37.632l-16.17 0zm43.022-12.397l0 10.633q-.049 6.713-4.753 11.417t-11.368 4.704l-46.599 0q-6.713 0-11.417-4.753t-4.704-11.368l0-46.599q0-6.664 4.753-11.417t11.368-4.704l46.599 0q3.528 0 6.566 1.372.833.392.98 1.323t-.49 1.617l-2.744 2.744q-.784.784-1.96.441t-2.352-.343l-46.599 0q-3.675 0-6.321 2.646t-2.646 6.321l0 46.599q0 3.675 2.646 6.321t6.321 2.646l46.599 0q3.675 0 6.321-2.646t2.646-6.321l0-7.056q0-.735.49-1.225l3.577-3.577q.833-.833 1.96-.392t1.127 1.617zm7.203-51.646q2.254 0 3.773 1.568l8.526 8.526q1.568 1.568 1.568 3.822t-1.568 3.773l-5.145 5.145-16.121-16.121 5.145-5.145q1.568-1.568 3.822-1.568z",
19
+ * width: 100,
20
+ * height: 78.912,
21
+ * };
22
+ * <InlineIcon {...editIcon} />
23
+ *
24
+ */
25
+ import PropTypes from "prop-types";
1
26
  import * as React from "react";
2
- declare const InlineIcon: React.FC<InlineIconProps>;
27
+ declare const InlineIcon: {
28
+ ({ path, width, height, style, title, }: InlineIconProps): React.ReactElement;
29
+ propTypes: {
30
+ path: PropTypes.Validator<string>;
31
+ height: PropTypes.Validator<number>;
32
+ width: PropTypes.Validator<number>;
33
+ style: PropTypes.Requireable<object>;
34
+ title: PropTypes.Requireable<string>;
35
+ };
36
+ };
3
37
  export type InlineIconProps = {
4
38
  path: string;
5
39
  height: number;
@@ -4,8 +4,18 @@
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
+ import PropTypes from "prop-types";
7
8
  import * as React from "react";
8
- declare var InlineIcon: React.StatelessFunctionalComponent<InlineIconProps>;
9
+ declare var InlineIcon: {|
10
+ (x: InlineIconProps): React.Element<any>,
11
+ propTypes: {|
12
+ path: PropTypes.Validator<string>,
13
+ height: PropTypes.Validator<number>,
14
+ width: PropTypes.Validator<number>,
15
+ style: PropTypes.Requireable<{ ... }>,
16
+ title: PropTypes.Requireable<string>,
17
+ |},
18
+ |};
9
19
  export type InlineIconProps = {|
10
20
  path: string,
11
21
  height: number,
@@ -9,9 +9,9 @@
9
9
  */
10
10
  import * as React from "react";
11
11
  export default class SimpleKeypadInput extends React.Component<any> {
12
+ _isMounted: boolean;
12
13
  componentDidMount(): void;
13
14
  componentWillUnmount(): void;
14
- _isMounted: boolean;
15
15
  focus(): void;
16
16
  blur(): void;
17
17
  getValue(): string | number;
@@ -6,9 +6,9 @@
6
6
  */
7
7
  import * as React from "react";
8
8
  declare export default class SimpleKeypadInput extends React.Component<any> {
9
+ _isMounted: boolean;
9
10
  componentDidMount(): void;
10
11
  componentWillUnmount(): void;
11
- _isMounted: boolean;
12
12
  focus(): void;
13
13
  blur(): void;
14
14
  getValue(): string | number;
@@ -6,13 +6,13 @@ type ButtonSets = {
6
6
  };
7
7
  declare const buttonSets: ButtonSets;
8
8
  export type ButtonSetsType = ReadonlyArray<keyof typeof buttonSets>;
9
- type TexButtonProps = {
9
+ type Props = {
10
10
  sets: ButtonSetsType;
11
11
  onInsert: (arg1: Inserter) => void;
12
12
  className?: string;
13
13
  convertDotToTimes?: boolean;
14
14
  };
15
- declare class TexButtons extends React.Component<TexButtonProps> {
15
+ declare class TexButtons extends React.Component<Props> {
16
16
  static buttonSets: typeof buttonSets;
17
17
  static buttonSetsType: any;
18
18
  render(): React.ReactNode;
@@ -12,13 +12,13 @@ declare type ButtonSets = {
12
12
  };
13
13
  declare var buttonSets: ButtonSets;
14
14
  export type ButtonSetsType = $ReadOnlyArray<$Keys<typeof buttonSets>>;
15
- declare type TexButtonProps = {|
15
+ declare type Props = {|
16
16
  sets: ButtonSetsType,
17
17
  onInsert: (arg1: Inserter) => void,
18
18
  className?: string,
19
19
  convertDotToTimes?: boolean,
20
20
  |};
21
- declare class TexButtons extends React.Component<TexButtonProps> {
21
+ declare class TexButtons extends React.Component<Props> {
22
22
  static buttonSets: typeof buttonSets;
23
23
  static buttonSetsType: any;
24
24
  render(): React.Node;
@@ -1,12 +1,12 @@
1
1
  import * as React from "react";
2
- type ErrorBoundaryProps = {
2
+ type Props = {
3
3
  children: React.ReactNode;
4
4
  };
5
- type ErrorBoundaryState = {
5
+ type State = {
6
6
  error: string;
7
7
  };
8
- declare class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
9
- constructor(props: ErrorBoundaryProps);
8
+ declare class ErrorBoundary extends React.Component<Props, State> {
9
+ constructor(props: Props);
10
10
  componentDidCatch(error: Error, info: any): void;
11
11
  render(): React.ReactNode;
12
12
  }
@@ -5,16 +5,14 @@
5
5
  * @flow
6
6
  */
7
7
  import * as React from "react";
8
- declare type ErrorBoundaryProps = {|
8
+ declare type Props = {|
9
9
  children: React.Node,
10
10
  |};
11
- declare type ErrorBoundaryState = {|
11
+ declare type State = {|
12
12
  error: string,
13
13
  |};
14
- declare class ErrorBoundary
15
- extends React.Component<ErrorBoundaryProps, ErrorBoundaryState>
16
- {
17
- constructor(props: ErrorBoundaryProps): this;
14
+ declare class ErrorBoundary extends React.Component<Props, State> {
15
+ constructor(props: Props): this;
18
16
  componentDidCatch(error: Error, info: any): void;
19
17
  render(): React.Node;
20
18
  }
package/dist/es/index.js CHANGED
@@ -2541,6 +2541,8 @@ const insertBraces = value => {
2541
2541
  class Expression extends React.Component {
2542
2542
  constructor(..._args) {
2543
2543
  super(..._args);
2544
+ this._isMounted = false;
2545
+ this.errorTimeout = null;
2544
2546
  this.displayName = "Expression";
2545
2547
  this.state = {
2546
2548
  showErrorTooltip: false,
@@ -2587,8 +2589,6 @@ class Expression extends React.Component {
2587
2589
  clearTimeout(this.errorTimeout);
2588
2590
  this._isMounted = false;
2589
2591
  };
2590
- this._isMounted = false;
2591
- this.errorTimeout = null;
2592
2592
  this.simpleValidate = (rubric, onInputError) => {
2593
2593
  onInputError = onInputError || function () {};
2594
2594
  return Expression.validate(this.getUserInput(), rubric, onInputError);
@@ -9991,7 +9991,7 @@ GraphUtils.createGraphie = function (el) {
9991
9991
  * the function at i
9992
9992
  * @param {[]} rangeArray array of ranges over which the
9993
9993
  * corresponding functions are defined
9994
- * @return {Raphael set}
9994
+ * @return {Set<any>} set of paths
9995
9995
  */
9996
9996
  plotPiecewise: function (fnArray, rangeArray) {
9997
9997
  const paths = raphael$1.set();
@@ -10013,8 +10013,8 @@ GraphUtils.createGraphie = function (el) {
10013
10013
  * return a Raphael set of Raphael circle objects at those
10014
10014
  * coordinates
10015
10015
  *
10016
- * @param {Array of arrays} endpointArray
10017
- * @return {Raphael set}
10016
+ * @param {Array<[number, number]>} endpointArray
10017
+ * @return {Set<any>} set of circles
10018
10018
  */
10019
10019
  plotEndpointCircles: function (endpointArray) {
10020
10020
  const circles = raphael$1.set();
@@ -21796,8 +21796,7 @@ NumericInput.defaultProps = {
21796
21796
  coefficient: false,
21797
21797
  answerForms: [],
21798
21798
  labelText: "",
21799
- linterContext: linterContextDefault,
21800
- multipleNumberInput: false
21799
+ linterContext: linterContextDefault
21801
21800
  };
21802
21801
  const unionAnswerForms = function unionAnswerForms(answerFormsList) {
21803
21802
  // Takes a list of lists of answer forms, and returns a list of the forms
@@ -23754,9 +23753,7 @@ class Radio$1 extends React.Component {
23754
23753
  };
23755
23754
  });
23756
23755
  return /*#__PURE__*/React.createElement(BaseRadio, {
23757
- labelWrap: true
23758
- // @ts-expect-error [FEI-5003] - TS2322 - Type 'boolean | undefined' is not assignable to type 'boolean'.
23759
- ,
23756
+ labelWrap: true,
23760
23757
  multipleSelect: this.props.multipleSelect,
23761
23758
  countChoices: this.props.countChoices,
23762
23759
  numCorrect: this.props.numCorrect,