@khanacademy/perseus 5.0.0 → 6.1.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 (115) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/dist/components/fixed-to-responsive.d.ts +27 -1
  3. package/dist/components/fixed-to-responsive.js.flow +27 -1
  4. package/dist/components/graph.d.ts +42 -26
  5. package/dist/components/graph.js.flow +42 -28
  6. package/dist/components/graphie.d.ts +34 -22
  7. package/dist/components/graphie.js.flow +37 -24
  8. package/dist/components/hud.d.ts +8 -14
  9. package/dist/components/hud.js.flow +7 -14
  10. package/dist/components/inline-icon.d.ts +9 -19
  11. package/dist/components/inline-icon.js.flow +26 -13
  12. package/dist/components/lint.d.ts +41 -13
  13. package/dist/components/lint.js.flow +42 -13
  14. package/dist/components/math-output.d.ts +15 -11
  15. package/dist/components/math-output.js.flow +15 -11
  16. package/dist/components/sortable.d.ts +17 -9
  17. package/dist/components/sortable.js.flow +22 -9
  18. package/dist/components/svg-image.d.ts +5 -3
  19. package/dist/components/svg-image.js.flow +5 -3
  20. package/dist/components/tooltip.d.ts +45 -4
  21. package/dist/components/tooltip.js.flow +44 -31
  22. package/dist/es/index.css +0 -3
  23. package/dist/es/index.js +478 -649
  24. package/dist/es/index.js.map +1 -1
  25. package/dist/index.css +0 -3
  26. package/dist/index.js +482 -646
  27. package/dist/index.js.map +1 -1
  28. package/dist/perseus-types.d.ts +11 -9
  29. package/dist/perseus-types.js.flow +11 -9
  30. package/dist/renderer.d.ts +2 -2
  31. package/dist/renderer.js.flow +1 -3
  32. package/dist/styles/shared.d.ts +0 -1
  33. package/dist/styles/shared.js.flow +0 -1
  34. package/dist/types.d.ts +0 -10
  35. package/dist/types.js.flow +0 -13
  36. package/dist/util/a11y.d.ts +0 -1
  37. package/dist/util/a11y.js.flow +0 -1
  38. package/dist/util/interactive.d.ts +2 -0
  39. package/dist/util/interactive.js.flow +2 -0
  40. package/dist/util.d.ts +3 -3
  41. package/dist/util.js.flow +4 -3
  42. package/dist/widgets/grapher.d.ts +1 -1
  43. package/dist/widgets/grapher.js.flow +12 -3
  44. package/dist/widgets/matcher.d.ts +7 -3
  45. package/dist/widgets/matcher.js.flow +7 -3
  46. package/dist/widgets/number-line.d.ts +1 -1
  47. package/dist/widgets/number-line.js.flow +1 -1
  48. package/package.json +2 -2
  49. package/src/__tests__/__snapshots__/item-renderer.test.tsx.snap +151 -159
  50. package/src/__tests__/__snapshots__/renderer.test.tsx.snap +358 -394
  51. package/src/__tests__/__snapshots__/server-item-renderer.test.tsx.snap +169 -189
  52. package/src/components/__stories__/lint.stories.tsx +56 -21
  53. package/src/components/__stories__/sortable.stories.tsx +5 -5
  54. package/src/components/__stories__/tooltip.stories.tsx +52 -0
  55. package/src/components/__tests__/__snapshots__/sortable.test.tsx.snap +114 -30
  56. package/src/components/__tests__/__snapshots__/sorter.test.tsx.snap +172 -204
  57. package/src/components/__tests__/sortable.test.tsx +54 -16
  58. package/src/components/__tests__/sorter.test.tsx +12 -9
  59. package/src/components/fixed-to-responsive.tsx +43 -38
  60. package/src/components/graph.tsx +95 -81
  61. package/src/components/graphie.tsx +62 -32
  62. package/src/components/hud.tsx +104 -115
  63. package/src/components/inline-icon.tsx +15 -32
  64. package/src/components/input-with-examples.tsx +4 -4
  65. package/src/components/lint.tsx +47 -41
  66. package/src/components/math-output.tsx +17 -11
  67. package/src/components/simple-keypad-input.tsx +2 -2
  68. package/src/components/sortable.tsx +134 -94
  69. package/src/components/svg-image.tsx +10 -11
  70. package/src/components/tooltip.tsx +189 -171
  71. package/src/interactive2/types.ts +2 -2
  72. package/src/mixins/provide-keypad.tsx +2 -2
  73. package/src/multi-items/__tests__/__snapshots__/multi-renderer.test.tsx.snap +708 -764
  74. package/src/perseus-types.ts +13 -9
  75. package/src/renderer.tsx +11 -22
  76. package/src/types.ts +0 -18
  77. package/src/util/interactive.ts +18 -5
  78. package/src/util/tex.ts +13 -77
  79. package/src/util.ts +3 -4
  80. package/src/widgets/__stories__/test-keypad-context-wrapper.tsx +2 -2
  81. package/src/widgets/__tests__/__snapshots__/categorizer.test.ts.snap +717 -773
  82. package/src/widgets/__tests__/__snapshots__/cs-program.test.ts.snap +28 -36
  83. package/src/widgets/__tests__/__snapshots__/definition.test.ts.snap +52 -60
  84. package/src/widgets/__tests__/__snapshots__/dropdown.test.ts.snap +100 -108
  85. package/src/widgets/__tests__/__snapshots__/explanation.test.ts.snap +212 -260
  86. package/src/widgets/__tests__/__snapshots__/graded-group-set-jipt.test.ts.snap +613 -641
  87. package/src/widgets/__tests__/__snapshots__/graded-group-set.test.ts.snap +249 -261
  88. package/src/widgets/__tests__/__snapshots__/graded-group.test.ts.snap +671 -735
  89. package/src/widgets/__tests__/__snapshots__/grapher.test.ts.snap +2676 -2684
  90. package/src/widgets/__tests__/__snapshots__/group.test.tsx.snap +938 -1002
  91. package/src/widgets/__tests__/__snapshots__/iframe.test.ts.snap +28 -36
  92. package/src/widgets/__tests__/__snapshots__/image.test.ts.snap +227 -255
  93. package/src/widgets/__tests__/__snapshots__/input-number.test.ts.snap +353 -357
  94. package/src/widgets/__tests__/__snapshots__/interaction.test.ts.snap +255 -259
  95. package/src/widgets/__tests__/__snapshots__/interactive-graph.test.ts.snap +2401 -2433
  96. package/src/widgets/__tests__/__snapshots__/matcher.test.tsx.snap +600 -756
  97. package/src/widgets/__tests__/__snapshots__/matrix.test.ts.snap +420 -428
  98. package/src/widgets/__tests__/__snapshots__/number-line.test.ts.snap +762 -770
  99. package/src/widgets/__tests__/__snapshots__/numeric-input.test.ts.snap +373 -393
  100. package/src/widgets/__tests__/__snapshots__/orderer.test.ts.snap +116 -148
  101. package/src/widgets/__tests__/__snapshots__/passage-ref.test.ts.snap +289 -301
  102. package/src/widgets/__tests__/__snapshots__/passage.test.tsx.snap +1679 -1711
  103. package/src/widgets/__tests__/__snapshots__/radio.test.ts.snap +2692 -2960
  104. package/src/widgets/__tests__/__snapshots__/video.test.ts.snap +90 -98
  105. package/src/widgets/__tests__/matcher.test.tsx +33 -9
  106. package/src/widgets/expression.tsx +9 -6
  107. package/src/widgets/grapher.tsx +3 -3
  108. package/src/widgets/image.tsx +2 -2
  109. package/src/widgets/interactive-graph.tsx +5 -5
  110. package/src/widgets/matcher.tsx +43 -24
  111. package/src/widgets/number-line.tsx +1 -1
  112. package/src/widgets/simulator.tsx +4 -6
  113. package/{tsconfig.json → tsconfig-build.json} +6 -6
  114. package/tsconfig-build.tsbuildinfo +1 -0
  115. package/tsconfig.tsbuildinfo +0 -1
@@ -4,21 +4,50 @@
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
- import PropTypes from "prop-types";
8
7
  import * as React from "react";
9
- declare type Props = any;
10
- declare type State = any;
8
+
9
+ declare var Severity: {|
10
+ +Error: 1, // 1
11
+ +Warning: 2, // 2
12
+ +Recommendation: 3, // 3
13
+ +OfflineReportingOnly: 4, // 4
14
+ |};
15
+ declare type Props = {|
16
+ children: React.Node,
17
+ inline?: boolean,
18
+ message: string,
19
+ ruleName: string,
20
+ insideTable: boolean,
21
+ blockHighlight?: boolean,
22
+ severity?: $Values<typeof Severity>,
23
+ |};
24
+ declare type State = {|
25
+ tooltipAbove: boolean,
26
+ |};
27
+ /**
28
+ * This component renders "lint" nodes in a markdown parse tree. Lint nodes
29
+ * are inserted into the tree by the Perseus linter (see
30
+ * perseus-linter/src/index).
31
+ *
32
+ * This component serves multiple purposes
33
+ *
34
+ * 1) It renders a small circle in the right margin to indicate that there
35
+ * is lint on (or near) that line.
36
+ *
37
+ * 2) The area around the circle is hoverable: when the mouse moves over it
38
+ * the linty content is highlighted and a tooltip is displayed that explains
39
+ * what the problem is.
40
+ *
41
+ * 3) The hoverable area is also an HTML <a> tag. Clicking on it opens
42
+ * a new tab and links to additional details about the specific lint rule.
43
+ *
44
+ * The CSS required to position the circles in the right margin is tricky
45
+ * and it does not always work perfectly. When lint occurs on a block element
46
+ * that has a right margin (like anything blockquoted) the circle will appear
47
+ * to the left of where it belongs. And if there is more
48
+ */
11
49
  declare class Lint extends React.Component<Props, State> {
12
- _positionTimeout: number | null | void;
13
- static propTypes: {|
14
- children: PropTypes.Requireable<PropTypes.ReactNodeLike>,
15
- inline: PropTypes.Requireable<boolean>,
16
- message: PropTypes.Validator<string>,
17
- ruleName: PropTypes.Validator<string>,
18
- insideTable: PropTypes.Validator<boolean>,
19
- blockHighlight: PropTypes.Requireable<boolean>,
20
- severity: PropTypes.Requireable<number>,
21
- |};
50
+ _positionTimeout: number | void;
22
51
  state: State;
23
52
  componentDidMount(): void;
24
53
  componentWillUnmount(): void;
@@ -1,15 +1,19 @@
1
- import PropTypes from "prop-types";
2
1
  import * as React from "react";
3
- declare class MathOutput extends React.Component<any, any> {
4
- static propTypes: {
5
- value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
6
- className: PropTypes.Requireable<string>;
7
- labelText: PropTypes.Requireable<string>;
8
- onFocus: PropTypes.Requireable<(...args: any[]) => any>;
9
- onBlur: PropTypes.Requireable<(...args: any[]) => any>;
10
- };
11
- static defaultProps: any;
12
- state: any;
2
+ type Props = {
3
+ value: string | number;
4
+ className?: string;
5
+ labelText?: string;
6
+ onFocus: () => void;
7
+ onBlur: () => void;
8
+ };
9
+ type DefaultProps = Pick<Props, "value" | "onFocus" | "onBlur">;
10
+ type State = {
11
+ focused: boolean;
12
+ selectorNamespace: string;
13
+ };
14
+ declare class MathOutput extends React.Component<Props, State> {
15
+ static defaultProps: DefaultProps;
16
+ state: State;
13
17
  _getInputClassName: () => string;
14
18
  _getDisplayValue: (arg1: string | number) => string;
15
19
  render(): React.ReactNode;
@@ -4,18 +4,22 @@
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
- import PropTypes from "prop-types";
8
7
  import * as React from "react";
9
- declare class MathOutput extends React.Component<any, any> {
10
- static propTypes: {|
11
- value: PropTypes.Requireable<$NonMaybeType<string | number | null | void>>,
12
- className: PropTypes.Requireable<string>,
13
- labelText: PropTypes.Requireable<string>,
14
- onFocus: PropTypes.Requireable<(...args: any[]) => any>,
15
- onBlur: PropTypes.Requireable<(...args: any[]) => any>,
16
- |};
17
- static defaultProps: any;
18
- state: any;
8
+ declare type Props = {|
9
+ value: string | number,
10
+ className?: string,
11
+ labelText?: string,
12
+ onFocus: () => void,
13
+ onBlur: () => void,
14
+ |};
15
+ declare type DefaultProps = Pick<Props, "value" | "onFocus" | "onBlur">;
16
+ declare type State = {|
17
+ focused: boolean,
18
+ selectorNamespace: string,
19
+ |};
20
+ declare class MathOutput extends React.Component<Props, State> {
21
+ static defaultProps: DefaultProps;
22
+ state: State;
19
23
  _getInputClassName: () => string;
20
24
  _getDisplayValue: (arg1: string | number) => string;
21
25
  render(): React.Node;
@@ -1,6 +1,16 @@
1
1
  import * as React from "react";
2
+ import { Position } from "../util";
2
3
  import type { LinterContextProps } from "../types";
3
- type SortableLayoutKind = "horizontal" | "vertical";
4
+ export declare enum Layout {
5
+ HORIZONTAL = "horizontal",
6
+ VERTICAL = "vertical"
7
+ }
8
+ declare enum ItemState {
9
+ STATIC = "static",
10
+ DRAGGING = "dragging",
11
+ ANIMATING = "animating",
12
+ DISABLED = "disabled"
13
+ }
4
14
  export type SortableOption = string;
5
15
  type SortableProps = {
6
16
  constraints: {
@@ -8,7 +18,7 @@ type SortableProps = {
8
18
  height: number;
9
19
  } | Record<any, any>;
10
20
  disabled: boolean;
11
- layout: SortableLayoutKind;
21
+ layout: Layout;
12
22
  margin: number;
13
23
  onChange: (arg1: any) => void;
14
24
  onMeasure: (arg1: {
@@ -17,8 +27,8 @@ type SortableProps = {
17
27
  }) => void;
18
28
  padding: boolean;
19
29
  linterContext: LinterContextProps;
20
- waitForKatexLoad: boolean;
21
30
  options: ReadonlyArray<SortableOption>;
31
+ waitForTexRendererToLoad: boolean;
22
32
  };
23
33
  type DefaultProps = {
24
34
  constraints: SortableProps["constraints"];
@@ -29,27 +39,25 @@ type DefaultProps = {
29
39
  onMeasure: SortableProps["onMeasure"];
30
40
  padding: SortableProps["padding"];
31
41
  linterContext: SortableProps["linterContext"];
32
- waitForKatexLoad: SortableProps["waitForKatexLoad"];
42
+ waitForTexRendererToLoad: SortableProps["waitForTexRendererToLoad"];
33
43
  };
34
- type ItemState = "disabled" | "static" | "dragging" | "animating";
35
44
  type SortableItem = {
36
45
  option: SortableOption;
37
46
  key: number;
38
- type: ItemState;
39
- endPosition: any;
47
+ state: ItemState;
48
+ endPosition: Position | Record<string, never>;
40
49
  width: number;
41
50
  height: number;
42
51
  };
43
52
  type SortableState = {
44
53
  items: ReadonlyArray<SortableItem>;
45
- katex: null | any;
54
+ texRendererLoaded: boolean;
46
55
  };
47
56
  declare class Sortable extends React.Component<SortableProps, SortableState> {
48
57
  static defaultProps: DefaultProps;
49
58
  constructor(props: SortableProps);
50
59
  UNSAFE_componentWillReceiveProps(nextProps: SortableProps): void;
51
60
  componentDidUpdate(): void;
52
- componentDidMount(): void;
53
61
  static itemsFromProps(props: {
54
62
  disabled: boolean;
55
63
  options: ReadonlyArray<SortableOption>;
@@ -5,8 +5,20 @@
5
5
  * @flow
6
6
  */
7
7
  import * as React from "react";
8
+ import { Position } from "../util";
8
9
  import type { LinterContextProps } from "../types";
9
- declare type SortableLayoutKind = "horizontal" | "vertical";
10
+
11
+ declare export var Layout: {|
12
+ +HORIZONTAL: "horizontal", // "horizontal"
13
+ +VERTICAL: "vertical", // "vertical"
14
+ |};
15
+
16
+ declare var ItemState: {|
17
+ +STATIC: "static", // "static"
18
+ +DRAGGING: "dragging", // "dragging"
19
+ +ANIMATING: "animating", // "animating"
20
+ +DISABLED: "disabled", // "disabled"
21
+ |};
10
22
  export type SortableOption = string;
11
23
  declare type SortableProps = {|
12
24
  constraints:
@@ -16,7 +28,7 @@ declare type SortableProps = {|
16
28
  |}
17
29
  | { [key: any]: any },
18
30
  disabled: boolean,
19
- layout: SortableLayoutKind,
31
+ layout: $Values<typeof Layout>,
20
32
  margin: number,
21
33
  onChange: (arg1: any) => void,
22
34
  onMeasure: (arg1: {|
@@ -25,8 +37,8 @@ declare type SortableProps = {|
25
37
  |}) => void,
26
38
  padding: boolean,
27
39
  linterContext: LinterContextProps,
28
- waitForKatexLoad: boolean,
29
40
  options: $ReadOnlyArray<SortableOption>,
41
+ waitForTexRendererToLoad: boolean,
30
42
  |};
31
43
  declare type DefaultProps = {|
32
44
  constraints: $PropertyType<SortableProps, "constraints">,
@@ -37,27 +49,28 @@ declare type DefaultProps = {|
37
49
  onMeasure: $PropertyType<SortableProps, "onMeasure">,
38
50
  padding: $PropertyType<SortableProps, "padding">,
39
51
  linterContext: $PropertyType<SortableProps, "linterContext">,
40
- waitForKatexLoad: $PropertyType<SortableProps, "waitForKatexLoad">,
52
+ waitForTexRendererToLoad: $PropertyType<
53
+ SortableProps,
54
+ "waitForTexRendererToLoad"
55
+ >,
41
56
  |};
42
- declare type ItemState = "disabled" | "static" | "dragging" | "animating";
43
57
  declare type SortableItem = {|
44
58
  option: SortableOption,
45
59
  key: number,
46
- type: ItemState,
47
- endPosition: any,
60
+ state: $Values<typeof ItemState>,
61
+ endPosition: Position | { [key: string]: empty },
48
62
  width: number,
49
63
  height: number,
50
64
  |};
51
65
  declare type SortableState = {|
52
66
  items: $ReadOnlyArray<SortableItem>,
53
- katex: null | any,
67
+ texRendererLoaded: boolean,
54
68
  |};
55
69
  declare class Sortable extends React.Component<SortableProps, SortableState> {
56
70
  static defaultProps: DefaultProps;
57
71
  constructor(props: SortableProps): this;
58
72
  UNSAFE_componentWillReceiveProps(nextProps: SortableProps): void;
59
73
  componentDidUpdate(): void;
60
- componentDidMount(): void;
61
74
  static itemsFromProps(props: {|
62
75
  disabled: boolean,
63
76
  options: $ReadOnlyArray<SortableOption>,
@@ -1,12 +1,14 @@
1
1
  import * as React from "react";
2
+ import { Coord } from "../interactive2/types";
3
+ import type { Size } from "../perseus-types";
2
4
  import type { Alignment, Dimensions } from "../types";
3
5
  type Props = {
4
6
  allowFullBleed?: boolean;
5
7
  alt: string;
6
8
  constrainHeight?: boolean;
7
9
  extraGraphie?: {
8
- box: ReadonlyArray<any>;
9
- range: ReadonlyArray<any>;
10
+ box: Size;
11
+ range: [Coord, Coord];
10
12
  labels: ReadonlyArray<any>;
11
13
  };
12
14
  height?: number;
@@ -38,7 +40,7 @@ type State = {
38
40
  labelsRendered: LabelsRenderedMap;
39
41
  labelDataIsLocalized: boolean;
40
42
  labels: ReadonlyArray<Label>;
41
- range: ReadonlyArray<any>;
43
+ range: [Coord, Coord];
42
44
  };
43
45
  declare class SvgImage extends React.Component<Props, State> {
44
46
  _isMounted: boolean;
@@ -5,14 +5,16 @@
5
5
  * @flow
6
6
  */
7
7
  import * as React from "react";
8
+ import { Coord } from "../interactive2/types";
9
+ import type { Size } from "../perseus-types";
8
10
  import type { Alignment, Dimensions } from "../types";
9
11
  declare type Props = {|
10
12
  allowFullBleed?: boolean,
11
13
  alt: string,
12
14
  constrainHeight?: boolean,
13
15
  extraGraphie?: {|
14
- box: $ReadOnlyArray<any>,
15
- range: $ReadOnlyArray<any>,
16
+ box: Size,
17
+ range: [Coord, Coord],
16
18
  labels: $ReadOnlyArray<any>,
17
19
  |},
18
20
  height?: number,
@@ -44,7 +46,7 @@ declare type State = {|
44
46
  labelsRendered: LabelsRenderedMap,
45
47
  labelDataIsLocalized: boolean,
46
48
  labels: $ReadOnlyArray<Label>,
47
- range: $ReadOnlyArray<any>,
49
+ range: [Coord, Coord],
48
50
  |};
49
51
  declare class SvgImage extends React.Component<Props, State> {
50
52
  _isMounted: boolean;
@@ -7,9 +7,9 @@
7
7
  * import Tooltip from "./tooltip";
8
8
  * <Tooltip
9
9
  * className="class-for-tooltip-contents"
10
- * horizontalPosition="left" // one of "left", "right"
11
- * horizontalAlign="left" // one of "left", "right"
12
- * verticalPosition="bottom" // one of "top", "bottom"
10
+ * horizontalPosition={HoriziontalDirection.Left}
11
+ * horizontalAlign={HoriziontalDirection.Left}
12
+ * verticalPosition={VerticalDirection.Top}
13
13
  * arrowSize={10} // arrow size in pixels
14
14
  * borderColor="#ccc" // color of the border for the tooltip
15
15
  * show={true} // whether the tooltip should currently be visible
@@ -28,5 +28,46 @@
28
28
  * className should not specify a border; that is handled by borderColor
29
29
  * so that the arrow and tooltip match
30
30
  */
31
- declare const Tooltip: any;
31
+ import * as React from "react";
32
+ export declare enum HorizontalDirection {
33
+ Left = "left",
34
+ Right = "right"
35
+ }
36
+ export declare enum VerticalDirection {
37
+ Top = "top",
38
+ Bottom = "bottom"
39
+ }
40
+ type Props = {
41
+ show: boolean;
42
+ className: string;
43
+ arrowSize: number;
44
+ borderColor: string;
45
+ verticalPosition: VerticalDirection;
46
+ horizontalPosition: HorizontalDirection;
47
+ horizontalAlign: HorizontalDirection.Left;
48
+ children: React.ReactNode;
49
+ targetContainerStyle: any;
50
+ };
51
+ type DefaultProps = {
52
+ className: Props["className"];
53
+ arrowSize: Props["arrowSize"];
54
+ borderColor: Props["borderColor"];
55
+ verticalPosition: Props["verticalPosition"];
56
+ horizontalPosition: Props["horizontalPosition"];
57
+ horizontalAlign: Props["horizontalAlign"];
58
+ targetContainerStyle: Props["targetContainerStyle"];
59
+ };
60
+ type State = {
61
+ height: number | null;
62
+ };
63
+ declare class Tooltip extends React.Component<Props, State> {
64
+ static defaultProps: DefaultProps;
65
+ state: State;
66
+ componentDidMount(): void;
67
+ UNSAFE_componentWillReceiveProps(): void;
68
+ componentDidUpdate(): void;
69
+ _renderToolTipDiv(isTooltipAbove?: boolean): JSX.Element;
70
+ _updateHeight(): void;
71
+ render(): JSX.Element;
72
+ }
32
73
  export default Tooltip;
@@ -4,35 +4,48 @@
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
- /**
8
- * A generic tooltip library for React.js
9
- *
10
- * This should eventually end up in react-components
11
- *
12
- * Interface: ({a, b} means one of a or b)
13
- * import Tooltip from "./tooltip";
14
- * <Tooltip
15
- * className="class-for-tooltip-contents"
16
- * horizontalPosition="left" // one of "left", "right"
17
- * horizontalAlign="left" // one of "left", "right"
18
- * verticalPosition="bottom" // one of "top", "bottom"
19
- * arrowSize={10} // arrow size in pixels
20
- * borderColor="#ccc" // color of the border for the tooltip
21
- * show={true} // whether the tooltip should currently be visible
22
- * targetContainerStyle={targetContainerStyle}
23
- * >
24
- * <TargetElementOfTheTooltip />
25
- * <TooltipContents1 />
26
- * <TooltipContents2 />
27
- * </Tooltip>
28
- *
29
- * To show/hide the tooltip, the parent component should call the
30
- * .show() and .hide() methods of the tooltip when appropriate.
31
- * (These are usually set up as handlers of events on the target element.)
32
- *
33
- * Notes:
34
- * className should not specify a border; that is handled by borderColor
35
- * so that the arrow and tooltip match
36
- */
37
- declare var Tooltip: any;
7
+ import * as React from "react";
8
+
9
+ declare export var HorizontalDirection: {|
10
+ +Left: "left", // "left"
11
+ +Right: "right", // "right"
12
+ |};
13
+
14
+ declare export var VerticalDirection: {|
15
+ +Top: "top", // "top"
16
+ +Bottom: "bottom", // "bottom"
17
+ |};
18
+ declare type Props = {|
19
+ show: boolean,
20
+ className: string,
21
+ arrowSize: number,
22
+ borderColor: string,
23
+ verticalPosition: $Values<typeof VerticalDirection>,
24
+ horizontalPosition: $Values<typeof HorizontalDirection>,
25
+ horizontalAlign: typeof HorizontalDirection.Left,
26
+ children: React.Node,
27
+ targetContainerStyle: any,
28
+ |};
29
+ declare type DefaultProps = {|
30
+ className: $PropertyType<Props, "className">,
31
+ arrowSize: $PropertyType<Props, "arrowSize">,
32
+ borderColor: $PropertyType<Props, "borderColor">,
33
+ verticalPosition: $PropertyType<Props, "verticalPosition">,
34
+ horizontalPosition: $PropertyType<Props, "horizontalPosition">,
35
+ horizontalAlign: $PropertyType<Props, "horizontalAlign">,
36
+ targetContainerStyle: $PropertyType<Props, "targetContainerStyle">,
37
+ |};
38
+ declare type State = {|
39
+ height: number | null,
40
+ |};
41
+ declare class Tooltip extends React.Component<Props, State> {
42
+ static defaultProps: DefaultProps;
43
+ state: State;
44
+ componentDidMount(): void;
45
+ UNSAFE_componentWillReceiveProps(): void;
46
+ componentDidUpdate(): void;
47
+ _renderToolTipDiv(isTooltipAbove?: boolean): React$Node;
48
+ _updateHeight(): void;
49
+ render(): React$Node;
50
+ }
38
51
  declare export default typeof Tooltip;
package/dist/es/index.css CHANGED
@@ -3606,9 +3606,6 @@ body.mobile .framework-perseus table.perseus-widget-table-of-values.non-markdown
3606
3606
  color: white !important;
3607
3607
  display: inline-block !important;
3608
3608
  }
3609
- .keypad-container .katex {
3610
- color: inherit !important;
3611
- }
3612
3609
  /**
3613
3610
  * Styles for managing the popover animations.
3614
3611
  *