@khanacademy/math-input 0.7.2 → 1.0.1

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 (183) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/components/compute-layout-parameters.d.ts +38 -0
  3. package/dist/components/compute-layout-parameters.js.flow +49 -0
  4. package/dist/components/corner-decal.d.ts +12 -0
  5. package/dist/components/corner-decal.js.flow +15 -0
  6. package/dist/components/echo-manager.d.ts +26 -0
  7. package/dist/components/echo-manager.js.flow +29 -0
  8. package/dist/components/empty-keypad-button.d.ts +13 -0
  9. package/dist/components/empty-keypad-button.js.flow +23 -0
  10. package/dist/components/expression-keypad.d.ts +22 -0
  11. package/dist/components/expression-keypad.js.flow +32 -0
  12. package/dist/components/fraction-keypad.d.ts +21 -0
  13. package/dist/components/fraction-keypad.js.flow +30 -0
  14. package/dist/components/gesture-manager.d.ts +74 -0
  15. package/dist/components/gesture-manager.js.flow +82 -0
  16. package/dist/components/gesture-state-machine.d.ts +105 -0
  17. package/dist/components/gesture-state-machine.js.flow +118 -0
  18. package/dist/components/icon.d.ts +15 -0
  19. package/dist/components/icon.js.flow +18 -0
  20. package/dist/components/input/__tests__/test-math-wrapper.d.ts +8 -0
  21. package/dist/components/input/__tests__/test-math-wrapper.js.flow +14 -0
  22. package/dist/components/input/cursor-handle.d.ts +1 -1
  23. package/dist/components/input/cursor-handle.js.flow +1 -1
  24. package/dist/components/input/drag-listener.d.ts +13 -0
  25. package/dist/components/input/drag-listener.js.flow +19 -0
  26. package/dist/components/input/math-input.d.ts +5 -4
  27. package/dist/components/input/math-input.js.flow +5 -4
  28. package/dist/components/input/math-wrapper.d.ts +110 -0
  29. package/dist/components/input/math-wrapper.js.flow +125 -0
  30. package/dist/components/input/scroll-into-view.d.ts +11 -0
  31. package/dist/components/input/scroll-into-view.js.flow +20 -0
  32. package/dist/components/keypad/button-assets.d.ts +4 -3
  33. package/dist/components/keypad/button-assets.js.flow +3 -3
  34. package/dist/components/keypad/button.d.ts +1 -2
  35. package/dist/components/keypad/button.js.flow +1 -2
  36. package/dist/components/keypad/index.d.ts +1 -1
  37. package/dist/components/keypad/index.js.flow +1 -3
  38. package/dist/components/keypad/keypad-page-items.d.ts +15 -10
  39. package/dist/components/keypad/keypad-page-items.js.flow +20 -10
  40. package/dist/components/keypad-button.d.ts +52 -0
  41. package/dist/components/keypad-button.js.flow +79 -0
  42. package/dist/components/keypad-container.d.ts +40 -0
  43. package/dist/components/keypad-container.js.flow +58 -0
  44. package/dist/components/keypad.d.ts +31 -0
  45. package/dist/components/keypad.js.flow +40 -0
  46. package/dist/components/many-keypad-button.d.ts +15 -0
  47. package/dist/components/many-keypad-button.js.flow +17 -0
  48. package/dist/components/math-icon.d.ts +16 -0
  49. package/dist/components/math-icon.js.flow +19 -0
  50. package/dist/components/multi-symbol-grid.d.ts +14 -0
  51. package/dist/components/multi-symbol-grid.js.flow +16 -0
  52. package/dist/components/multi-symbol-popover.d.ts +12 -0
  53. package/dist/components/multi-symbol-popover.js.flow +15 -0
  54. package/dist/components/navigation-pad.d.ts +14 -0
  55. package/dist/components/navigation-pad.js.flow +16 -0
  56. package/dist/components/node-manager.d.ts +50 -0
  57. package/dist/components/node-manager.js.flow +62 -0
  58. package/dist/components/popover-manager.d.ts +13 -0
  59. package/dist/components/popover-manager.js.flow +15 -0
  60. package/dist/components/popover-state-machine.d.ts +68 -0
  61. package/dist/components/popover-state-machine.js.flow +77 -0
  62. package/dist/components/provided-keypad.d.ts +8 -10
  63. package/dist/components/provided-keypad.js.flow +8 -10
  64. package/dist/components/styles.d.ts +6 -0
  65. package/dist/components/styles.js.flow +13 -0
  66. package/dist/components/svg-icon.d.ts +12 -0
  67. package/dist/components/svg-icon.js.flow +15 -0
  68. package/dist/components/tabbar/icons.d.ts +3 -2
  69. package/dist/components/tabbar/icons.js.flow +3 -2
  70. package/dist/components/tabbar/item.d.ts +1 -2
  71. package/dist/components/tabbar/item.js.flow +1 -2
  72. package/dist/components/tabbar/tabbar.d.ts +3 -3
  73. package/dist/components/tabbar/tabbar.js.flow +3 -3
  74. package/dist/components/text-icon.d.ts +13 -0
  75. package/dist/components/text-icon.js.flow +16 -0
  76. package/dist/components/touchable-keypad-button.d.ts +30 -0
  77. package/dist/components/touchable-keypad-button.js.flow +35 -0
  78. package/dist/components/two-page-keypad.d.ts +20 -0
  79. package/dist/components/two-page-keypad.js.flow +30 -0
  80. package/dist/components/velocity-tracker.d.ts +48 -0
  81. package/dist/components/velocity-tracker.js.flow +54 -0
  82. package/dist/es/index.css +0 -3
  83. package/dist/es/index.js +933 -1065
  84. package/dist/es/index.js.map +1 -1
  85. package/dist/fake-react-native-web/text.d.ts +2 -1
  86. package/dist/fake-react-native-web/text.js.flow +2 -1
  87. package/dist/fake-react-native-web/view.d.ts +3 -2
  88. package/dist/fake-react-native-web/view.js.flow +3 -2
  89. package/dist/index.css +0 -3
  90. package/dist/index.d.ts +1 -1
  91. package/dist/index.js +977 -1090
  92. package/dist/index.js.flow +1 -4
  93. package/dist/index.js.map +1 -1
  94. package/dist/store/actions.d.ts +64 -0
  95. package/dist/store/actions.js.flow +100 -0
  96. package/dist/store/echo-reducer.d.ts +4 -0
  97. package/dist/store/echo-reducer.js.flow +10 -0
  98. package/dist/store/index.d.ts +10 -1
  99. package/dist/store/index.js.flow +17 -1
  100. package/dist/store/input-reducer.d.ts +4 -0
  101. package/dist/store/input-reducer.js.flow +13 -0
  102. package/dist/store/keypad-reducer.d.ts +4 -0
  103. package/dist/store/keypad-reducer.js.flow +13 -0
  104. package/dist/store/layout-reducer.d.ts +4 -0
  105. package/dist/store/layout-reducer.js.flow +13 -0
  106. package/dist/store/pager-reducer.d.ts +4 -0
  107. package/dist/store/pager-reducer.js.flow +13 -0
  108. package/dist/store/shared.d.ts +6 -0
  109. package/dist/store/shared.js.flow +13 -0
  110. package/dist/store/types.d.ts +58 -0
  111. package/dist/store/types.js.flow +64 -0
  112. package/dist/types.d.ts +63 -0
  113. package/dist/types.js.flow +73 -0
  114. package/less/overrides.less +0 -6
  115. package/package.json +1 -1
  116. package/src/components/__tests__/{gesture-state-machine_test.js → gesture-state-machine.test.ts} +5 -1
  117. package/src/components/__tests__/{two-page-keypad_test.js → two-page-keypad.test.tsx} +0 -2
  118. package/src/components/{corner-decal.js → corner-decal.tsx} +6 -5
  119. package/src/components/{echo-manager.js → echo-manager.tsx} +29 -24
  120. package/src/components/{empty-keypad-button.js → empty-keypad-button.tsx} +17 -10
  121. package/src/components/{expression-keypad.js → expression-keypad.tsx} +27 -25
  122. package/src/components/{fraction-keypad.js → fraction-keypad.tsx} +21 -16
  123. package/src/components/{gesture-manager.js → gesture-manager.ts} +10 -4
  124. package/src/components/{gesture-state-machine.js → gesture-state-machine.ts} +49 -3
  125. package/src/components/{icon.js → icon.tsx} +12 -14
  126. package/src/components/input/cursor-handle.tsx +1 -1
  127. package/src/components/input/{drag-listener.js → drag-listener.ts} +4 -0
  128. package/src/components/input/math-input.tsx +10 -9
  129. package/src/components/input/{math-wrapper.js → math-wrapper.ts} +10 -6
  130. package/src/components/input/{scroll-into-view.js → scroll-into-view.ts} +5 -15
  131. package/src/components/keypad/button-assets.tsx +4 -5
  132. package/src/components/keypad/button.tsx +1 -2
  133. package/src/components/keypad/index.tsx +2 -2
  134. package/src/components/keypad/keypad-page-items.tsx +33 -10
  135. package/src/components/{keypad-button.js → keypad-button.tsx} +42 -37
  136. package/src/components/{keypad-container.js → keypad-container.tsx} +42 -24
  137. package/src/components/{keypad.js → keypad.tsx} +32 -24
  138. package/src/components/{many-keypad-button.js → many-keypad-button.tsx} +8 -6
  139. package/src/components/{math-icon.js → math-icon.tsx} +7 -6
  140. package/src/components/{multi-symbol-grid.js → multi-symbol-grid.tsx} +8 -8
  141. package/src/components/{multi-symbol-popover.js → multi-symbol-popover.tsx} +5 -6
  142. package/src/components/{navigation-pad.js → navigation-pad.tsx} +7 -6
  143. package/src/components/{node-manager.js → node-manager.ts} +16 -4
  144. package/src/components/{popover-manager.js → popover-manager.tsx} +13 -16
  145. package/src/components/{popover-state-machine.js → popover-state-machine.ts} +13 -2
  146. package/src/components/prop-types.js +1 -67
  147. package/src/components/provided-keypad.tsx +16 -23
  148. package/src/components/{svg-icon.js → svg-icon.tsx} +5 -6
  149. package/src/components/tabbar/icons.tsx +4 -2
  150. package/src/components/tabbar/item.tsx +1 -3
  151. package/src/components/tabbar/{tabbar.stories.js → tabbar.stories.tsx} +10 -1
  152. package/src/components/tabbar/tabbar.tsx +3 -3
  153. package/src/components/{text-icon.js → text-icon.tsx} +7 -6
  154. package/src/components/{touchable-keypad-button.js → touchable-keypad-button.tsx} +19 -16
  155. package/src/components/{two-page-keypad.js → two-page-keypad.tsx} +13 -9
  156. package/src/components/{velocity-tracker.js → velocity-tracker.ts} +14 -4
  157. package/src/fake-react-native-web/text.tsx +2 -1
  158. package/src/fake-react-native-web/view.tsx +3 -2
  159. package/src/index.ts +1 -4
  160. package/src/math-input.stories.tsx +67 -0
  161. package/src/store/actions.ts +178 -0
  162. package/src/store/echo-reducer.ts +61 -0
  163. package/src/store/index.ts +39 -449
  164. package/src/store/input-reducer.ts +56 -0
  165. package/src/store/keypad-reducer.ts +59 -0
  166. package/src/store/layout-reducer.ts +134 -0
  167. package/src/store/pager-reducer.ts +125 -0
  168. package/src/store/shared.ts +12 -0
  169. package/src/store/types.ts +82 -0
  170. package/src/types.ts +81 -0
  171. package/tsconfig.tsbuildinfo +1 -1
  172. package/src/actions/index.js +0 -57
  173. package/src/components/app.js +0 -73
  174. package/src/demo.js +0 -9
  175. package/src/native-app.js +0 -85
  176. /package/src/components/__tests__/{node-manager_test.js → node-manager.test.ts} +0 -0
  177. /package/src/components/{compute-layout-parameters.js → compute-layout-parameters.ts} +0 -0
  178. /package/src/components/input/__tests__/{context-tracking_test.js → context-tracking.test.ts} +0 -0
  179. /package/src/components/input/__tests__/{mathquill_test.js → mathquill.test.ts} +0 -0
  180. /package/src/components/input/__tests__/{test-math-wrapper.jsx → test-math-wrapper.ts} +0 -0
  181. /package/src/components/keypad/{button.stories.js → button.stories.tsx} +0 -0
  182. /package/src/components/{styles.js → styles.ts} +0 -0
  183. /package/src/components/tabbar/__tests__/{tabbar_test.js → tabbar.test.tsx} +0 -0
@@ -0,0 +1,68 @@
1
+ import type { ActiveNodesObj } from "../types";
2
+ /**
3
+ * A state machine for the popover state. In particular, this class manages the
4
+ * mapping of parent nodes to their children, and translates touch events that
5
+ * traverse various nodes to actions that are conditioned on whether a popover
6
+ * is present.
7
+ */
8
+ type Handlers = {
9
+ onActiveNodesChanged: (activeNodes: ActiveNodesObj) => void;
10
+ onClick: (keyId: string, domNodeId: string, inPopover: boolean) => void;
11
+ };
12
+ declare class PopoverStateMachine {
13
+ handlers: Handlers;
14
+ popovers: Record<string, ReadonlyArray<string>>;
15
+ activePopover: string | null;
16
+ constructor(handlers: any);
17
+ /**
18
+ * Register a popover container as containing a set of children.
19
+ *
20
+ * @param {string} id - the identifier of the popover container
21
+ * @param {string[]} childIds - the identifiers of the nodes contained in
22
+ * the popover container
23
+ */
24
+ registerPopover(id: any, childIds: any): void;
25
+ /**
26
+ * Unregister a popover container.
27
+ *
28
+ * @param {string} id - the identifier of the popover container to
29
+ * unregister
30
+ */
31
+ unregisterPopover(id: any): void;
32
+ /**
33
+ * @returns {boolean} - whether a popover is active and visible
34
+ */
35
+ isPopoverVisible(): boolean;
36
+ /**
37
+ * Blur the active nodes.
38
+ */
39
+ onBlur(): void;
40
+ /**
41
+ * Handle a focus event on the node with the given identifier.
42
+ *
43
+ * @param {string} id - the identifier of the node that was focused
44
+ */
45
+ onFocus(id: any): void;
46
+ /**
47
+ * Handle a long press event on the node with the given identifier.
48
+ *
49
+ * @param {string} id - the identifier of the node that was long-pressed
50
+ */
51
+ onLongPress(id: any): void;
52
+ /**
53
+ * Handle the trigger (click or hold) of the node with the given identifier.
54
+ *
55
+ * @param {string} id - the identifier of the node that was triggered
56
+ */
57
+ onTrigger(id: any): void;
58
+ /**
59
+ * Handle a touch-end event on the node with the given identifier.
60
+ *
61
+ * @param {string} id - the identifier of the node over which the touch
62
+ * ended
63
+ */
64
+ onTouchEnd(id: any): void;
65
+ _isNodeInsidePopover(popover: any, id: any): boolean;
66
+ _defaultNodeForPopover(popover: any): string;
67
+ }
68
+ export default PopoverStateMachine;
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Flowtype definitions for data
3
+ * Generated by Flowgen from a Typescript Definition
4
+ * Flowgen v1.21.0
5
+ * @flow
6
+ */
7
+ import type { ActiveNodesObj } from "../types";
8
+
9
+ /**
10
+ * A state machine for the popover state. In particular, this class manages the
11
+ * mapping of parent nodes to their children, and translates touch events that
12
+ * traverse various nodes to actions that are conditioned on whether a popover
13
+ * is present.
14
+ */
15
+ declare type Handlers = {|
16
+ onActiveNodesChanged: (activeNodes: ActiveNodesObj) => void,
17
+ onClick: (keyId: string, domNodeId: string, inPopover: boolean) => void,
18
+ |};
19
+ declare class PopoverStateMachine {
20
+ handlers: Handlers;
21
+ popovers: { [key: string]: $ReadOnlyArray<string> };
22
+ activePopover: string | null;
23
+ constructor(handlers: any): this;
24
+
25
+ /**
26
+ * Register a popover container as containing a set of children.
27
+ * @param {string} id - the identifier of the popover container
28
+ * @param {string[]} childIds - the identifiers of the nodes contained in
29
+ * the popover container
30
+ */
31
+ registerPopover(id: any, childIds: any): void;
32
+
33
+ /**
34
+ * Unregister a popover container.
35
+ * @param {string} id - the identifier of the popover container to
36
+ * unregister
37
+ */
38
+ unregisterPopover(id: any): void;
39
+
40
+ /**
41
+ * @returns {boolean} - whether a popover is active and visible
42
+ */
43
+ isPopoverVisible(): boolean;
44
+
45
+ /**
46
+ * Blur the active nodes.
47
+ */
48
+ onBlur(): void;
49
+
50
+ /**
51
+ * Handle a focus event on the node with the given identifier.
52
+ * @param {string} id - the identifier of the node that was focused
53
+ */
54
+ onFocus(id: any): void;
55
+
56
+ /**
57
+ * Handle a long press event on the node with the given identifier.
58
+ * @param {string} id - the identifier of the node that was long-pressed
59
+ */
60
+ onLongPress(id: any): void;
61
+
62
+ /**
63
+ * Handle the trigger (click or hold) of the node with the given identifier.
64
+ * @param {string} id - the identifier of the node that was triggered
65
+ */
66
+ onTrigger(id: any): void;
67
+
68
+ /**
69
+ * Handle a touch-end event on the node with the given identifier.
70
+ * @param {string} id - the identifier of the node over which the touch
71
+ * ended
72
+ */
73
+ onTouchEnd(id: any): void;
74
+ _isNodeInsidePopover(popover: any, id: any): boolean;
75
+ _defaultNodeForPopover(popover: any): string;
76
+ }
77
+ declare export default typeof PopoverStateMachine;
@@ -1,22 +1,20 @@
1
1
  import * as React from "react";
2
2
  import ReactDOM from "react-dom";
3
- import type { CSSProperties } from "aphrodite";
3
+ import type { Cursor, KeypadConfiguration, KeyHandler } from "../types";
4
+ import type { StyleType } from "@khanacademy/wonder-blocks-core";
4
5
  type Props = {
5
6
  onElementMounted?: (arg1: any) => void;
6
- onDismiss?: () => unknown;
7
- style?: CSSProperties;
7
+ onDismiss?: () => void;
8
+ style?: StyleType;
8
9
  };
9
10
  declare class ProvidedKeypad extends React.Component<Props> {
10
- mounted: boolean;
11
11
  store: any;
12
- UNSAFE_componentWillMount(): void;
13
- componentDidMount(): void;
14
- componentWillUnmount(): void;
12
+ constructor(props: any);
15
13
  activate: () => void;
16
14
  dismiss: () => void;
17
- configure: () => void;
18
- setCursor: () => void;
19
- setKeyHandler: (keyHandler: any) => void;
15
+ configure: (configuration: KeypadConfiguration, cb: () => void) => void;
16
+ setCursor: (cursor: Cursor) => void;
17
+ setKeyHandler: (keyHandler: KeyHandler) => void;
20
18
  getDOMNode: () => ReturnType<typeof ReactDOM.findDOMNode>;
21
19
  render(): React.ReactNode;
22
20
  }
@@ -6,23 +6,21 @@
6
6
  */
7
7
  import * as React from "react";
8
8
  import ReactDOM from "react-dom";
9
- import type { CSSProperties } from "aphrodite";
9
+ import type { Cursor, KeypadConfiguration, KeyHandler } from "../types";
10
+ import type { StyleType } from "@khanacademy/wonder-blocks-core";
10
11
  declare type Props = {|
11
12
  onElementMounted?: (arg1: any) => void,
12
- onDismiss?: () => mixed,
13
- style?: CSSProperties,
13
+ onDismiss?: () => void,
14
+ style?: StyleType,
14
15
  |};
15
16
  declare class ProvidedKeypad extends React.Component<Props> {
16
- mounted: boolean;
17
17
  store: any;
18
- UNSAFE_componentWillMount(): void;
19
- componentDidMount(): void;
20
- componentWillUnmount(): void;
18
+ constructor(props: any): this;
21
19
  activate: () => void;
22
20
  dismiss: () => void;
23
- configure: () => void;
24
- setCursor: () => void;
25
- setKeyHandler: (keyHandler: any) => void;
21
+ configure: (configuration: KeypadConfiguration, cb: () => void) => void;
22
+ setCursor: (cursor: Cursor) => void;
23
+ setKeyHandler: (keyHandler: KeyHandler) => void;
26
24
  getDOMNode: () => $Call<
27
25
  <R>((...args: any[]) => R) => R,
28
26
  typeof ReactDOM.findDOMNode
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Common styles shared across components.
3
+ */
4
+ /// <reference path="../../types/aphrodite.d.ts" />
5
+ declare const _default: import("aphrodite").StyleDeclaration;
6
+ export default _default;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Flowtype definitions for data
3
+ * Generated by Flowgen from a Typescript Definition
4
+ * Flowgen v1.21.0
5
+ * @flow
6
+ */
7
+ import * as $Flowgen$Import$aphrodite from "aphrodite";
8
+
9
+ /**
10
+ * Common styles shared across components.
11
+ */
12
+ declare var _default: $Flowgen$Import$aphrodite.StyleDeclaration;
13
+ declare export default typeof _default;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * A component that renders a single SVG icon.
3
+ */
4
+ import * as React from "react";
5
+ type Props = {
6
+ color: string;
7
+ name: string;
8
+ };
9
+ declare class SvgIcon extends React.Component<Props> {
10
+ render(): JSX.Element;
11
+ }
12
+ export default SvgIcon;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Flowtype definitions for data
3
+ * Generated by Flowgen from a Typescript Definition
4
+ * Flowgen v1.21.0
5
+ * @flow
6
+ */
7
+ import * as React from "react";
8
+ declare type Props = {|
9
+ color: string,
10
+ name: string,
11
+ |};
12
+ declare class SvgIcon extends React.Component<Props> {
13
+ render(): React$Node;
14
+ }
15
+ declare export default typeof SvgIcon;
@@ -1,7 +1,8 @@
1
1
  import * as React from "react";
2
2
  import type { TabbarItemType } from "./types";
3
- declare const IconAsset: React.FC<{
3
+ type Props = {
4
4
  tintColor: string;
5
5
  type: TabbarItemType;
6
- }>;
6
+ };
7
+ declare const IconAsset: ({ tintColor, type }: Props) => React.ReactElement;
7
8
  export default IconAsset;
@@ -6,8 +6,9 @@
6
6
  */
7
7
  import * as React from "react";
8
8
  import type { TabbarItemType } from "./types";
9
- declare var IconAsset: React.StatelessFunctionalComponent<{|
9
+ declare type Props = {|
10
10
  tintColor: string,
11
11
  type: TabbarItemType,
12
- |}>;
12
+ |};
13
+ declare var IconAsset: (x: Props) => React.Element<any>;
13
14
  declare export default typeof IconAsset;
@@ -6,8 +6,7 @@ type Props = {
6
6
  itemState: ItemState;
7
7
  itemType: TabbarItemType;
8
8
  };
9
- type State = Record<any, any>;
10
- declare class TabbarItem extends React.Component<Props, State> {
9
+ declare class TabbarItem extends React.Component<Props> {
11
10
  render(): React.ReactNode;
12
11
  }
13
12
  export declare const TabbarItemForTesting: typeof TabbarItem;
@@ -12,8 +12,7 @@ declare type Props = {|
12
12
  itemState: ItemState,
13
13
  itemType: TabbarItemType,
14
14
  |};
15
- declare type State = { [key: any]: any };
16
- declare class TabbarItem extends React.Component<Props, State> {
15
+ declare class TabbarItem extends React.Component<Props> {
17
16
  render(): React.Node;
18
17
  }
19
18
  declare export var TabbarItemForTesting: typeof TabbarItem;
@@ -3,11 +3,11 @@ import type { TabbarItemType } from "./types";
3
3
  type TabbarState = {
4
4
  selectedItem: number;
5
5
  };
6
- type TabbarProps = {
7
- items: Array<TabbarItemType>;
6
+ type Props = {
7
+ items: ReadonlyArray<TabbarItemType>;
8
8
  onSelect: (item: TabbarItemType) => void;
9
9
  };
10
- declare class Tabbar extends React.Component<TabbarProps, TabbarState> {
10
+ declare class Tabbar extends React.Component<Props, TabbarState> {
11
11
  state: TabbarState;
12
12
  render(): React.ReactNode;
13
13
  }
@@ -9,11 +9,11 @@ import type { TabbarItemType } from "./types";
9
9
  declare type TabbarState = {|
10
10
  selectedItem: number,
11
11
  |};
12
- declare type TabbarProps = {|
13
- items: Array<TabbarItemType>,
12
+ declare type Props = {|
13
+ items: $ReadOnlyArray<TabbarItemType>,
14
14
  onSelect: (item: TabbarItemType) => void,
15
15
  |};
16
- declare class Tabbar extends React.Component<TabbarProps, TabbarState> {
16
+ declare class Tabbar extends React.Component<Props, TabbarState> {
17
17
  state: TabbarState;
18
18
  render(): React.Node;
19
19
  }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * A component that renders a text-based icon.
3
+ */
4
+ import * as React from "react";
5
+ import type { StyleType } from "@khanacademy/wonder-blocks-core";
6
+ type Props = {
7
+ character: string;
8
+ style?: StyleType;
9
+ };
10
+ declare class TextIcon extends React.Component<Props> {
11
+ render(): JSX.Element;
12
+ }
13
+ export default TextIcon;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Flowtype definitions for data
3
+ * Generated by Flowgen from a Typescript Definition
4
+ * Flowgen v1.21.0
5
+ * @flow
6
+ */
7
+ import * as React from "react";
8
+ import type { StyleType } from "@khanacademy/wonder-blocks-core";
9
+ declare type Props = {|
10
+ character: string,
11
+ style?: StyleType,
12
+ |};
13
+ declare class TextIcon extends React.Component<Props> {
14
+ render(): React$Node;
15
+ }
16
+ declare export default typeof TextIcon;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * A touchable wrapper around the base KeypadButton component. This button is
3
+ * responsible for keeping our button ID system (which will be used to handle
4
+ * touch events globally) opaque to the KeypadButton.
5
+ */
6
+ import * as React from "react";
7
+ import { KeyType } from "../consts";
8
+ import GestureManager from "./gesture-manager";
9
+ import type { Key } from "../data/keys";
10
+ import type { Border, Icon } from "../types";
11
+ import type { StyleType } from "@khanacademy/wonder-blocks-core";
12
+ type Props = {
13
+ borders: Border;
14
+ childKeyIds: ReadonlyArray<Key>;
15
+ disabled: boolean;
16
+ focused: boolean;
17
+ gestureManager: GestureManager;
18
+ id: Key;
19
+ popoverEnabled: boolean;
20
+ style: StyleType;
21
+ type: KeyType;
22
+ icon: Icon;
23
+ };
24
+ declare class TouchableKeypadButton extends React.Component<Props> {
25
+ shouldComponentUpdate(newProps: any): boolean;
26
+ componentWillUnmount(): void;
27
+ render(): JSX.Element;
28
+ }
29
+ declare const _default: import("react-redux").ConnectedComponent<typeof TouchableKeypadButton, any>;
30
+ export default _default;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Flowtype definitions for data
3
+ * Generated by Flowgen from a Typescript Definition
4
+ * Flowgen v1.21.0
5
+ * @flow
6
+ */
7
+ import * as $Flowgen$Import$react_2d_redux from "react-redux";
8
+ import * as React from "react";
9
+ import { KeyType } from "../consts";
10
+ import GestureManager from "./gesture-manager";
11
+ import type { Key } from "../data/keys";
12
+ import type { Border, Icon } from "../types";
13
+ import type { StyleType } from "@khanacademy/wonder-blocks-core";
14
+ declare type Props = {|
15
+ borders: Border,
16
+ childKeyIds: $ReadOnlyArray<Key>,
17
+ disabled: boolean,
18
+ focused: boolean,
19
+ gestureManager: GestureManager,
20
+ id: Key,
21
+ popoverEnabled: boolean,
22
+ style: StyleType,
23
+ type: KeyType,
24
+ icon: Icon,
25
+ |};
26
+ declare class TouchableKeypadButton extends React.Component<Props> {
27
+ shouldComponentUpdate(newProps: any): boolean;
28
+ componentWillUnmount(): void;
29
+ render(): React$Node;
30
+ }
31
+ declare var _default: $Flowgen$Import$react_2d_redux.ConnectedComponent<
32
+ typeof TouchableKeypadButton,
33
+ any
34
+ >;
35
+ declare export default typeof _default;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * A keypad with two pages of keys.
3
+ */
4
+ import * as React from "react";
5
+ interface ReduxProps {
6
+ paginationEnabled: boolean;
7
+ }
8
+ interface Props extends ReduxProps {
9
+ currentPage: number;
10
+ leftPage: React.ReactNode;
11
+ rightPage: React.ReactNode;
12
+ }
13
+ declare class TwoPageKeypad extends React.Component<Props> {
14
+ state: {
15
+ selectedPage: string;
16
+ };
17
+ render(): JSX.Element;
18
+ }
19
+ declare const _default: import("react-redux").ConnectedComponent<typeof TwoPageKeypad, import("react-redux").Omit<React.ClassAttributes<TwoPageKeypad> & Props, "paginationEnabled">>;
20
+ export default _default;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Flowtype definitions for data
3
+ * Generated by Flowgen from a Typescript Definition
4
+ * Flowgen v1.21.0
5
+ * @flow
6
+ */
7
+ import * as $Flowgen$Import$react_2d_redux from "react-redux";
8
+ import * as React from "react";
9
+ declare interface ReduxProps {
10
+ paginationEnabled: boolean;
11
+ }
12
+ declare type Props = {
13
+ currentPage: number,
14
+ leftPage: React.Node,
15
+ rightPage: React.Node,
16
+ } & ReduxProps;
17
+ declare class TwoPageKeypad extends React.Component<Props> {
18
+ state: {|
19
+ selectedPage: string,
20
+ |};
21
+ render(): React$Node;
22
+ }
23
+ declare var _default: $Flowgen$Import$react_2d_redux.ConnectedComponent<
24
+ typeof TwoPageKeypad,
25
+ $Flowgen$Import$react_2d_redux.Omit<
26
+ {| ...React.ClassAttributes<TwoPageKeypad>, ...Props |},
27
+ "paginationEnabled"
28
+ >
29
+ >;
30
+ declare export default typeof _default;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * A system for tracking gesture velocity in a single dimension.
3
+ *
4
+ * Velocity is computed by smoothing linearly over the gestures that have
5
+ * occurred in the last 100 milliseconds.
6
+ */
7
+ type Event = {
8
+ x: number;
9
+ t: number;
10
+ };
11
+ declare class VelocityTracker {
12
+ options: {
13
+ velocityTimeout: number;
14
+ };
15
+ _events: Array<Event>;
16
+ constructor(options?: any);
17
+ /**
18
+ * Pushes an event with the given displacement onto the event buffer,
19
+ * associating it with a timestamp. Note that, as this method computes the
20
+ * timestamp for the event at calltime, it should be called immediately
21
+ * after the event occurs.
22
+ *
23
+ * @param {number} x - the cumulative displacement of the event
24
+ */
25
+ push(x: number): void;
26
+ /**
27
+ * Compute the velocity with respect to the events that have been tracked
28
+ * by the system. Velocity is computed by smoothing linearly over recent
29
+ * displacement values.
30
+ *
31
+ * Note that, for performance reasons, a call to `getVelocity` will clear
32
+ * out the event buffer. As such, repeated calls will not return the same
33
+ * value (in particular, a second call in quick succession will return 0).
34
+ *
35
+ * @returns {number} the velocity associated with the tracker
36
+ */
37
+ getVelocity(): number;
38
+ /**
39
+ * Filter the tracked events to exclude any events that occurred too far in
40
+ * the past, and reset the event buffer.
41
+ *
42
+ * @returns {number[]} an array of displacements corresponding to events
43
+ * that occurred in the past `velocityTimeout`
44
+ * milliseconds
45
+ */
46
+ _getEvents(): ReadonlyArray<Event>;
47
+ }
48
+ export default VelocityTracker;
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Flowtype definitions for data
3
+ * Generated by Flowgen from a Typescript Definition
4
+ * Flowgen v1.21.0
5
+ * @flow
6
+ */
7
+ /**
8
+ * A system for tracking gesture velocity in a single dimension.
9
+ *
10
+ * Velocity is computed by smoothing linearly over the gestures that have
11
+ * occurred in the last 100 milliseconds.
12
+ */
13
+ declare type Event = {|
14
+ x: number,
15
+ t: number,
16
+ |};
17
+ declare class VelocityTracker {
18
+ options: {|
19
+ velocityTimeout: number,
20
+ |};
21
+ _events: Array<Event>;
22
+ constructor(options?: any): this;
23
+
24
+ /**
25
+ * Pushes an event with the given displacement onto the event buffer,
26
+ * associating it with a timestamp. Note that, as this method computes the
27
+ * timestamp for the event at calltime, it should be called immediately
28
+ * after the event occurs.
29
+ * @param {number} x - the cumulative displacement of the event
30
+ */
31
+ push(x: number): void;
32
+
33
+ /**
34
+ * Compute the velocity with respect to the events that have been tracked
35
+ * by the system. Velocity is computed by smoothing linearly over recent
36
+ * displacement values.
37
+ *
38
+ * Note that, for performance reasons, a call to `getVelocity` will clear
39
+ * out the event buffer. As such, repeated calls will not return the same
40
+ * value (in particular, a second call in quick succession will return 0).
41
+ * @returns {number} the velocity associated with the tracker
42
+ */
43
+ getVelocity(): number;
44
+
45
+ /**
46
+ * Filter the tracked events to exclude any events that occurred too far in
47
+ * the past, and reset the event buffer.
48
+ * @returns {number[]} an array of displacements corresponding to events
49
+ * that occurred in the past `velocityTimeout`
50
+ * milliseconds
51
+ */
52
+ _getEvents(): $ReadOnlyArray<Event>;
53
+ }
54
+ declare export default typeof VelocityTracker;
package/dist/es/index.css CHANGED
@@ -122,9 +122,6 @@
122
122
  color: white !important;
123
123
  display: inline-block !important;
124
124
  }
125
- .keypad-container .katex {
126
- color: inherit !important;
127
- }
128
125
  /**
129
126
  * Styles for managing the popover animations.
130
127
  *