@khanacademy/math-input 0.0.0-PR443-20230328215601

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 (174) hide show
  1. package/.eslintrc.js +12 -0
  2. package/CHANGELOG.md +104 -0
  3. package/README.md +39 -0
  4. package/dist/es/index.css +587 -0
  5. package/dist/es/index.js +7291 -0
  6. package/dist/es/index.js.map +1 -0
  7. package/dist/index.css +587 -0
  8. package/dist/index.js +7333 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/strings +71 -0
  11. package/index.html +20 -0
  12. package/less/echo.less +56 -0
  13. package/less/main.less +5 -0
  14. package/less/overrides.less +129 -0
  15. package/less/popover.less +22 -0
  16. package/less/tabbar.less +6 -0
  17. package/package.json +64 -0
  18. package/src/actions/index.js +57 -0
  19. package/src/components/__tests__/gesture-state-machine_test.js +437 -0
  20. package/src/components/__tests__/node-manager_test.js +89 -0
  21. package/src/components/__tests__/two-page-keypad_test.js +42 -0
  22. package/src/components/app.js +73 -0
  23. package/src/components/common-style.ts +46 -0
  24. package/src/components/compute-layout-parameters.js +157 -0
  25. package/src/components/corner-decal.js +56 -0
  26. package/src/components/echo-manager.js +160 -0
  27. package/src/components/empty-keypad-button.js +49 -0
  28. package/src/components/expression-keypad.js +323 -0
  29. package/src/components/fraction-keypad.js +176 -0
  30. package/src/components/gesture-manager.js +226 -0
  31. package/src/components/gesture-state-machine.js +283 -0
  32. package/src/components/icon.js +74 -0
  33. package/src/components/iconography/arrow.js +22 -0
  34. package/src/components/iconography/backspace.js +29 -0
  35. package/src/components/iconography/cdot.js +29 -0
  36. package/src/components/iconography/cos.js +30 -0
  37. package/src/components/iconography/cube-root.js +36 -0
  38. package/src/components/iconography/dismiss.js +25 -0
  39. package/src/components/iconography/divide.js +34 -0
  40. package/src/components/iconography/down.js +16 -0
  41. package/src/components/iconography/equal.js +33 -0
  42. package/src/components/iconography/exp-2.js +29 -0
  43. package/src/components/iconography/exp-3.js +29 -0
  44. package/src/components/iconography/exp.js +29 -0
  45. package/src/components/iconography/frac.js +44 -0
  46. package/src/components/iconography/geq.js +33 -0
  47. package/src/components/iconography/gt.js +33 -0
  48. package/src/components/iconography/index.js +45 -0
  49. package/src/components/iconography/jump-into-numerator.js +41 -0
  50. package/src/components/iconography/jump-out-base.js +30 -0
  51. package/src/components/iconography/jump-out-denominator.js +41 -0
  52. package/src/components/iconography/jump-out-exponent.js +30 -0
  53. package/src/components/iconography/jump-out-numerator.js +41 -0
  54. package/src/components/iconography/jump-out-parentheses.js +33 -0
  55. package/src/components/iconography/left-paren.js +33 -0
  56. package/src/components/iconography/left.js +16 -0
  57. package/src/components/iconography/leq.js +33 -0
  58. package/src/components/iconography/ln.js +29 -0
  59. package/src/components/iconography/log-n.js +29 -0
  60. package/src/components/iconography/log.js +29 -0
  61. package/src/components/iconography/lt.js +33 -0
  62. package/src/components/iconography/minus.js +32 -0
  63. package/src/components/iconography/neq.js +33 -0
  64. package/src/components/iconography/parens.js +33 -0
  65. package/src/components/iconography/percent.js +49 -0
  66. package/src/components/iconography/period.js +26 -0
  67. package/src/components/iconography/plus.js +32 -0
  68. package/src/components/iconography/radical.js +36 -0
  69. package/src/components/iconography/right-paren.js +33 -0
  70. package/src/components/iconography/right.js +16 -0
  71. package/src/components/iconography/sin.js +30 -0
  72. package/src/components/iconography/sqrt.js +32 -0
  73. package/src/components/iconography/tan.js +30 -0
  74. package/src/components/iconography/times.js +33 -0
  75. package/src/components/iconography/up.js +16 -0
  76. package/src/components/input/__tests__/context-tracking_test.js +177 -0
  77. package/src/components/input/__tests__/mathquill_test.js +747 -0
  78. package/src/components/input/__tests__/test-math-wrapper.jsx +33 -0
  79. package/src/components/input/cursor-contexts.ts +44 -0
  80. package/src/components/input/cursor-handle.tsx +137 -0
  81. package/src/components/input/drag-listener.js +75 -0
  82. package/src/components/input/math-input.tsx +993 -0
  83. package/src/components/input/math-wrapper.js +959 -0
  84. package/src/components/input/scroll-into-view.js +72 -0
  85. package/src/components/keypad/button-assets.tsx +493 -0
  86. package/src/components/keypad/button.stories.js +29 -0
  87. package/src/components/keypad/button.tsx +106 -0
  88. package/src/components/keypad/index.tsx +65 -0
  89. package/src/components/keypad/keypad-page-items.tsx +91 -0
  90. package/src/components/keypad/keypad-pages.stories.tsx +30 -0
  91. package/src/components/keypad/keypad.stories.tsx +33 -0
  92. package/src/components/keypad/numeric-input-page.tsx +99 -0
  93. package/src/components/keypad/pre-algebra-page.tsx +97 -0
  94. package/src/components/keypad/trigonometry-page.tsx +89 -0
  95. package/src/components/keypad-button.js +362 -0
  96. package/src/components/keypad-container.js +299 -0
  97. package/src/components/keypad.js +154 -0
  98. package/src/components/many-keypad-button.js +44 -0
  99. package/src/components/math-icon.js +65 -0
  100. package/src/components/multi-symbol-grid.js +182 -0
  101. package/src/components/multi-symbol-popover.js +59 -0
  102. package/src/components/navigation-pad.js +139 -0
  103. package/src/components/node-manager.js +129 -0
  104. package/src/components/popover-manager.js +76 -0
  105. package/src/components/popover-state-machine.js +173 -0
  106. package/src/components/prop-types.js +82 -0
  107. package/src/components/provided-keypad.tsx +105 -0
  108. package/src/components/styles.js +38 -0
  109. package/src/components/svg-icon.js +25 -0
  110. package/src/components/tabbar/__tests__/tabbar_test.js +65 -0
  111. package/src/components/tabbar/icons.tsx +64 -0
  112. package/src/components/tabbar/item.tsx +136 -0
  113. package/src/components/tabbar/tabbar.stories.js +60 -0
  114. package/src/components/tabbar/tabbar.tsx +59 -0
  115. package/src/components/tabbar/types.ts +1 -0
  116. package/src/components/text-icon.js +52 -0
  117. package/src/components/touchable-keypad-button.js +146 -0
  118. package/src/components/two-page-keypad.js +99 -0
  119. package/src/components/velocity-tracker.js +76 -0
  120. package/src/components/z-indexes.ts +8 -0
  121. package/src/consts.ts +91 -0
  122. package/src/data/key-configs.ts +349 -0
  123. package/src/data/keys.ts +124 -0
  124. package/src/demo.js +9 -0
  125. package/src/fake-react-native-web/index.ts +11 -0
  126. package/src/fake-react-native-web/text.tsx +54 -0
  127. package/src/fake-react-native-web/view.tsx +89 -0
  128. package/src/index.ts +22 -0
  129. package/src/native-app.js +85 -0
  130. package/src/store/index.ts +534 -0
  131. package/src/utils.ts +14 -0
  132. package/tools/svg-to-react/convert.py +111 -0
  133. package/tools/svg-to-react/icons/math-keypad-icon-0.svg +32 -0
  134. package/tools/svg-to-react/icons/math-keypad-icon-1.svg +32 -0
  135. package/tools/svg-to-react/icons/math-keypad-icon-2.svg +32 -0
  136. package/tools/svg-to-react/icons/math-keypad-icon-3.svg +32 -0
  137. package/tools/svg-to-react/icons/math-keypad-icon-4.svg +32 -0
  138. package/tools/svg-to-react/icons/math-keypad-icon-5.svg +32 -0
  139. package/tools/svg-to-react/icons/math-keypad-icon-6.svg +32 -0
  140. package/tools/svg-to-react/icons/math-keypad-icon-7.svg +32 -0
  141. package/tools/svg-to-react/icons/math-keypad-icon-8.svg +32 -0
  142. package/tools/svg-to-react/icons/math-keypad-icon-9.svg +32 -0
  143. package/tools/svg-to-react/icons/math-keypad-icon-addition.svg +34 -0
  144. package/tools/svg-to-react/icons/math-keypad-icon-cos.svg +38 -0
  145. package/tools/svg-to-react/icons/math-keypad-icon-delete.svg +36 -0
  146. package/tools/svg-to-react/icons/math-keypad-icon-dismiss.svg +36 -0
  147. package/tools/svg-to-react/icons/math-keypad-icon-division.svg +36 -0
  148. package/tools/svg-to-react/icons/math-keypad-icon-equals-not.svg +50 -0
  149. package/tools/svg-to-react/icons/math-keypad-icon-equals.svg +48 -0
  150. package/tools/svg-to-react/icons/math-keypad-icon-exponent-2.svg +38 -0
  151. package/tools/svg-to-react/icons/math-keypad-icon-exponent-3.svg +38 -0
  152. package/tools/svg-to-react/icons/math-keypad-icon-exponent.svg +38 -0
  153. package/tools/svg-to-react/icons/math-keypad-icon-fraction.svg +42 -0
  154. package/tools/svg-to-react/icons/math-keypad-icon-greater-than.svg +46 -0
  155. package/tools/svg-to-react/icons/math-keypad-icon-jump-out-base.svg +44 -0
  156. package/tools/svg-to-react/icons/math-keypad-icon-jump-out-denominator.svg +48 -0
  157. package/tools/svg-to-react/icons/math-keypad-icon-jump-out-exponent.svg +44 -0
  158. package/tools/svg-to-react/icons/math-keypad-icon-jump-out-parentheses.svg +44 -0
  159. package/tools/svg-to-react/icons/math-keypad-icon-less-than.svg +46 -0
  160. package/tools/svg-to-react/icons/math-keypad-icon-log-10.svg +36 -0
  161. package/tools/svg-to-react/icons/math-keypad-icon-log-e.svg +36 -0
  162. package/tools/svg-to-react/icons/math-keypad-icon-log.svg +38 -0
  163. package/tools/svg-to-react/icons/math-keypad-icon-multiplication-cross.svg +40 -0
  164. package/tools/svg-to-react/icons/math-keypad-icon-multiplication-dot.svg +38 -0
  165. package/tools/svg-to-react/icons/math-keypad-icon-percent.svg +42 -0
  166. package/tools/svg-to-react/icons/math-keypad-icon-radical-2.svg +36 -0
  167. package/tools/svg-to-react/icons/math-keypad-icon-radical-3.svg +38 -0
  168. package/tools/svg-to-react/icons/math-keypad-icon-radical.svg +38 -0
  169. package/tools/svg-to-react/icons/math-keypad-icon-radix-character.svg +32 -0
  170. package/tools/svg-to-react/icons/math-keypad-icon-sin.svg +38 -0
  171. package/tools/svg-to-react/icons/math-keypad-icon-subtraction.svg +32 -0
  172. package/tools/svg-to-react/icons/math-keypad-icon-tan.svg +38 -0
  173. package/tools/svg-to-react/symbol_map.py +41 -0
  174. package/tsconfig.json +9 -0
@@ -0,0 +1,106 @@
1
+ import Clickable from "@khanacademy/wonder-blocks-clickable";
2
+ import Color from "@khanacademy/wonder-blocks-color";
3
+ import {View} from "@khanacademy/wonder-blocks-core";
4
+ import {StyleSheet} from "aphrodite";
5
+ import * as React from "react";
6
+
7
+ import type {StyleType} from "@khanacademy/wonder-blocks-core";
8
+ // @ts-expect-error [FEI-5003] - TS2305 - Module '"react"' has no exported member 'Node'.
9
+ import type {Node} from "React";
10
+
11
+ const styles = StyleSheet.create({
12
+ base: {
13
+ display: "flex",
14
+ justifyContent: "center",
15
+ alignItems: "center",
16
+ boxShadow: "0px 1px 0px rgba(33, 36, 44, 0.32)",
17
+ boxSizing: "border-box",
18
+ background: Color.white,
19
+ borderRadius: 4,
20
+ border: `1px solid transparent`,
21
+ flex: 1,
22
+ minHeight: 42,
23
+ minWidth: 42,
24
+ padding: 1,
25
+ },
26
+ hovered: {
27
+ border: `1px solid ${Color.blue}`,
28
+ padding: 1,
29
+ boxShadow: "none",
30
+ },
31
+ focused: {
32
+ border: `2px solid ${Color.blue}`,
33
+ padding: 0,
34
+ boxShadow: "none",
35
+ },
36
+ pressed: {
37
+ border: "2px solid #1B50B3",
38
+ padding: 0,
39
+ background: `linear-gradient(0deg, rgba(24, 101, 242, 0.32), rgba(24, 101, 242, 0.32)), ${Color.white}`,
40
+ boxShadow: "none",
41
+ },
42
+ outerBoxBase: {
43
+ padding: 1,
44
+ height: "100%",
45
+ width: "100%",
46
+ boxSizing: "border-box",
47
+ borderRadius: 7,
48
+ border: "2px solid transparent",
49
+ },
50
+ outerBoxHover: {
51
+ border: `2px solid ${Color.blue}`,
52
+ },
53
+ outerBoxPressed: {
54
+ border: "2px solid #1B50B3",
55
+ },
56
+ clickable: {
57
+ width: "100%",
58
+ height: "100%",
59
+ boxSizing: "border-box",
60
+ },
61
+ });
62
+
63
+ type Props = {
64
+ onPress: () => void;
65
+ children: Node;
66
+ style?: StyleType;
67
+ tintColor?: string;
68
+ };
69
+
70
+ type State = Record<any, any>;
71
+ export default class Button extends React.Component<Props, State> {
72
+ render(): React.ReactElement {
73
+ const {onPress, children, style, tintColor} = this.props;
74
+ return (
75
+ <View style={style}>
76
+ <Clickable onClick={onPress} style={styles.clickable}>
77
+ {({hovered, focused, pressed}) => {
78
+ return (
79
+ <View
80
+ style={[
81
+ styles.outerBoxBase,
82
+ hovered && styles.outerBoxHover,
83
+ pressed && styles.outerBoxPressed,
84
+ ]}
85
+ >
86
+ <View
87
+ style={[
88
+ styles.base,
89
+ tintColor != null
90
+ ? {background: tintColor}
91
+ : undefined,
92
+ hovered && styles.hovered,
93
+ focused && styles.focused,
94
+ pressed && styles.pressed,
95
+ ]}
96
+ >
97
+ {children}
98
+ </View>
99
+ </View>
100
+ );
101
+ }}
102
+ </Clickable>
103
+ </View>
104
+ );
105
+ }
106
+ }
@@ -0,0 +1,65 @@
1
+ import {View} from "@khanacademy/wonder-blocks-core";
2
+ import * as React from "react";
3
+
4
+ import Tabbar from "../tabbar/tabbar";
5
+
6
+ import NumericInputPage from "./numeric-input-page";
7
+ import PreAlgebraPage from "./pre-algebra-page";
8
+ import TrigonometryPage from "./trigonometry-page";
9
+
10
+ import type {TabbarItemType} from "../tabbar/types";
11
+
12
+ type Props = {
13
+ onClickKey: (keyConfig: string) => void;
14
+ preAlgebra: boolean;
15
+ trigonometry: boolean;
16
+ };
17
+ type State = {
18
+ selectedPage: TabbarItemType;
19
+ };
20
+
21
+ const allPages: React.FC<Props> = function (props): React.ReactElement {
22
+ const pages: Array<TabbarItemType> = ["Numbers"];
23
+
24
+ if (props.preAlgebra) {
25
+ pages.push("Operators");
26
+ }
27
+ if (props.trigonometry) {
28
+ pages.push("Geometry");
29
+ }
30
+ // @ts-expect-error [FEI-5003] - TS2739 - Type 'TabbarItemType[]' is missing the following properties from type 'ReactElement<any, string | JSXElementConstructor<any>>': type, props, key
31
+ return pages;
32
+ };
33
+
34
+ export default class PreAlgebraKeypad extends React.Component<Props, State> {
35
+ state: State = {
36
+ selectedPage: "Numbers",
37
+ };
38
+ render(): React.ReactElement {
39
+ const {selectedPage} = this.state;
40
+ const {onClickKey} = this.props;
41
+
42
+ const availablePages = allPages(this.props);
43
+
44
+ return (
45
+ <View>
46
+ <Tabbar
47
+ // @ts-expect-error [FEI-5003] - TS2769 - No overload matches this call.
48
+ items={availablePages}
49
+ onSelect={(tabbarItem: TabbarItemType) => {
50
+ this.setState({selectedPage: tabbarItem});
51
+ }}
52
+ />
53
+ {selectedPage === "Numbers" && (
54
+ <NumericInputPage onClickKey={onClickKey} />
55
+ )}
56
+ {selectedPage === "Operators" && (
57
+ <PreAlgebraPage onClickKey={onClickKey} />
58
+ )}
59
+ {selectedPage === "Geometry" && (
60
+ <TrigonometryPage onClickKey={onClickKey} />
61
+ )}
62
+ </View>
63
+ );
64
+ }
65
+ }
@@ -0,0 +1,91 @@
1
+ import {View} from "@khanacademy/wonder-blocks-core";
2
+ import * as React from "react";
3
+
4
+ import Button from "./button";
5
+ import ButtonAsset from "./button-assets";
6
+
7
+ import type {KeyConfig} from "../../data/key-configs";
8
+ import type {StyleType} from "@khanacademy/wonder-blocks-core";
9
+ // @ts-expect-error [FEI-5003] - TS2305 - Module '"react"' has no exported member 'Node'.
10
+ import type {Node} from "React";
11
+
12
+ export const KeypadPageContainer: React.FC<{
13
+ children: Node;
14
+ }> = ({children}): React.ReactElement => (
15
+ <View
16
+ style={{
17
+ backgroundColor: "#DBDCDD",
18
+ width: "100%",
19
+ height: 192,
20
+
21
+ display: "grid",
22
+ gridTemplateColumns: "repeat(6, 1fr)",
23
+ gridTemplateRows: "repeat(4, 1fr)",
24
+ }}
25
+ >
26
+ {children}
27
+ </View>
28
+ );
29
+
30
+ export const KeypadButton: React.FC<{
31
+ keyConfig: KeyConfig;
32
+ tintColor?: string;
33
+ style?: StyleType;
34
+ onClickKey: (keyConfig: string) => void;
35
+ }> = ({keyConfig, onClickKey, tintColor, style}): React.ReactElement => (
36
+ <Button
37
+ onPress={() => onClickKey(keyConfig.id)}
38
+ tintColor={tintColor}
39
+ style={style}
40
+ >
41
+ <ButtonAsset id={keyConfig.id} />
42
+ </Button>
43
+ );
44
+
45
+ export const SecondaryKeypadButton: React.FC<{
46
+ keyConfig: KeyConfig;
47
+ style?: any;
48
+ onClickKey: (keyConfig: string) => void;
49
+ }> = ({keyConfig, onClickKey, style}): React.ReactElement => (
50
+ <KeypadButton
51
+ keyConfig={keyConfig}
52
+ onClickKey={onClickKey}
53
+ style={style}
54
+ tintColor={"#F6F6F7"}
55
+ />
56
+ );
57
+
58
+ export const KeypadActionButton: React.FC<{
59
+ keyConfig: KeyConfig;
60
+ style?: any;
61
+ onClickKey: (keyConfig: string) => void;
62
+ }> = ({keyConfig, onClickKey, style}): React.ReactElement => (
63
+ <KeypadButton
64
+ keyConfig={keyConfig}
65
+ onClickKey={onClickKey}
66
+ style={style}
67
+ tintColor={"#DBDCDD"}
68
+ />
69
+ );
70
+
71
+ export const PlaceHolderButton = (): React.ReactElement => (
72
+ <View
73
+ style={{
74
+ height: "100%",
75
+ width: "100%",
76
+ boxSizing: "border-box",
77
+ borderRadius: 7,
78
+ border: "4px solid transparent",
79
+ }}
80
+ >
81
+ <View
82
+ style={{
83
+ background: "rgba(33, 36, 44, 0.04)",
84
+ width: "100%",
85
+ height: "100%",
86
+ borderRadius: 4,
87
+ border: `1px solid transparent`,
88
+ }}
89
+ />
90
+ </View>
91
+ );
@@ -0,0 +1,30 @@
1
+ import {action} from "@storybook/addon-actions";
2
+ import {withKnobs} from "@storybook/addon-knobs";
3
+ import * as React from "react";
4
+
5
+ import NumericInputPage from "./numeric-input-page";
6
+ import PrealgebraInputPage from "./pre-algebra-page";
7
+ import TrigonometryInputPage from "./trigonometry-page";
8
+
9
+ export default {
10
+ title: "Keypad pages",
11
+ decorators: [withKnobs],
12
+ parameters: {
13
+ backgrounds: {
14
+ values: [{name: "light background", value: "white", default: true}],
15
+ },
16
+ viewport: {defaultViewport: "iphone6"},
17
+ },
18
+ };
19
+
20
+ export const NumericInput = (): React.ReactElement => (
21
+ <NumericInputPage onClickKey={action("onClickKey")} />
22
+ );
23
+
24
+ export const PreAlgebraInput = (): React.ReactElement => (
25
+ <PrealgebraInputPage onClickKey={action("onClickKey")} />
26
+ );
27
+
28
+ export const TrigonometryInput = (): React.ReactElement => (
29
+ <TrigonometryInputPage onClickKey={action("onClickKey")} />
30
+ );
@@ -0,0 +1,33 @@
1
+ import {action} from "@storybook/addon-actions";
2
+ import {withKnobs} from "@storybook/addon-knobs";
3
+ import {INITIAL_VIEWPORTS} from "@storybook/addon-viewport";
4
+ import * as React from "react";
5
+
6
+ import Keypad from "./index";
7
+
8
+ export default {
9
+ title: "Full Keypad",
10
+ decorators: [withKnobs],
11
+ parameters: {
12
+ backgrounds: {
13
+ values: [{name: "light background", value: "white", default: true}],
14
+ },
15
+ viewport: {defaultViewport: "iphone6", viewports: INITIAL_VIEWPORTS},
16
+ },
17
+ };
18
+
19
+ export const PreAlgebra = (): React.ReactElement => (
20
+ <Keypad
21
+ onClickKey={action("onClickKey")}
22
+ preAlgebra={true}
23
+ trigonometry={false}
24
+ />
25
+ );
26
+
27
+ export const Trigonometry = (): React.ReactElement => (
28
+ <Keypad
29
+ onClickKey={action("onClickKey")}
30
+ preAlgebra={true}
31
+ trigonometry={true}
32
+ />
33
+ );
@@ -0,0 +1,99 @@
1
+ import * as React from "react";
2
+
3
+ import Keys from "../../data/key-configs";
4
+
5
+ import {
6
+ KeypadPageContainer,
7
+ KeypadButton,
8
+ SecondaryKeypadButton,
9
+ KeypadActionButton,
10
+ } from "./keypad-page-items";
11
+
12
+ type Props = {
13
+ onClickKey: (keyConfig: string) => void;
14
+ };
15
+
16
+ export default class NumericInputPage extends React.Component<Props> {
17
+ render(): React.ReactElement {
18
+ const {onClickKey} = this.props;
19
+ return (
20
+ <KeypadPageContainer>
21
+ {/* Row 1 */}
22
+ <KeypadButton keyConfig={Keys.NUM_7} onClickKey={onClickKey} />
23
+ <KeypadButton keyConfig={Keys.NUM_8} onClickKey={onClickKey} />
24
+ <KeypadButton keyConfig={Keys.NUM_9} onClickKey={onClickKey} />
25
+ <SecondaryKeypadButton
26
+ keyConfig={Keys.TIMES}
27
+ onClickKey={onClickKey}
28
+ />
29
+ <SecondaryKeypadButton
30
+ keyConfig={Keys.LEFT_PAREN}
31
+ onClickKey={onClickKey}
32
+ />
33
+ <SecondaryKeypadButton
34
+ keyConfig={Keys.RIGHT_PAREN}
35
+ onClickKey={onClickKey}
36
+ />
37
+
38
+ {/* Row 2 */}
39
+ <KeypadButton keyConfig={Keys.NUM_4} onClickKey={onClickKey} />
40
+ <KeypadButton keyConfig={Keys.NUM_5} onClickKey={onClickKey} />
41
+ <KeypadButton keyConfig={Keys.NUM_6} onClickKey={onClickKey} />
42
+
43
+ <SecondaryKeypadButton
44
+ keyConfig={Keys.MINUS}
45
+ onClickKey={onClickKey}
46
+ />
47
+
48
+ <SecondaryKeypadButton
49
+ keyConfig={Keys.FRAC_INCLUSIVE}
50
+ onClickKey={onClickKey}
51
+ style={{
52
+ gridColumn: "5 / 7",
53
+ }}
54
+ />
55
+ {/* Row 3 */}
56
+ <KeypadButton keyConfig={Keys.NUM_1} onClickKey={onClickKey} />
57
+ <KeypadButton keyConfig={Keys.NUM_2} onClickKey={onClickKey} />
58
+ <KeypadButton keyConfig={Keys.NUM_3} onClickKey={onClickKey} />
59
+
60
+ <SecondaryKeypadButton
61
+ keyConfig={Keys.PLUS}
62
+ style={{
63
+ gridColumn: "4",
64
+ gridRowStart: "3",
65
+ gridRowEnd: "5",
66
+ }}
67
+ onClickKey={onClickKey}
68
+ />
69
+
70
+ <KeypadActionButton
71
+ keyConfig={Keys.BACKSPACE}
72
+ style={{
73
+ gridColumn: "6",
74
+ }}
75
+ onClickKey={onClickKey}
76
+ />
77
+
78
+ {/* Row 4 */}
79
+ <KeypadButton keyConfig={Keys.NUM_0} onClickKey={onClickKey} />
80
+ <KeypadButton
81
+ keyConfig={Keys.DECIMAL}
82
+ onClickKey={onClickKey}
83
+ />
84
+ <KeypadButton
85
+ keyConfig={Keys.NEGATIVE}
86
+ onClickKey={onClickKey}
87
+ />
88
+
89
+ <KeypadActionButton
90
+ keyConfig={Keys.DISMISS}
91
+ style={{
92
+ gridColumn: "6",
93
+ }}
94
+ onClickKey={onClickKey}
95
+ />
96
+ </KeypadPageContainer>
97
+ );
98
+ }
99
+ }
@@ -0,0 +1,97 @@
1
+ import * as React from "react";
2
+
3
+ import Keys from "../../data/key-configs";
4
+
5
+ import {
6
+ KeypadPageContainer,
7
+ SecondaryKeypadButton,
8
+ KeypadActionButton,
9
+ PlaceHolderButton,
10
+ } from "./keypad-page-items";
11
+
12
+ type Props = {
13
+ onClickKey: (keyConfig: string) => void;
14
+ };
15
+
16
+ export default class PreAlgebraPage extends React.Component<Props> {
17
+ render(): React.ReactElement {
18
+ const {onClickKey} = this.props;
19
+ return (
20
+ <KeypadPageContainer>
21
+ {/* Row 1 */}
22
+ <SecondaryKeypadButton
23
+ keyConfig={Keys.EXP_2}
24
+ onClickKey={onClickKey}
25
+ />
26
+ <SecondaryKeypadButton
27
+ keyConfig={Keys.EXP}
28
+ onClickKey={onClickKey}
29
+ />
30
+ <SecondaryKeypadButton
31
+ keyConfig={Keys.SQRT}
32
+ onClickKey={onClickKey}
33
+ />
34
+ <SecondaryKeypadButton
35
+ keyConfig={Keys.RADICAL}
36
+ onClickKey={onClickKey}
37
+ />
38
+
39
+ <SecondaryKeypadButton
40
+ keyConfig={Keys.LEFT_PAREN}
41
+ onClickKey={onClickKey}
42
+ />
43
+ <SecondaryKeypadButton
44
+ keyConfig={Keys.RIGHT_PAREN}
45
+ onClickKey={onClickKey}
46
+ />
47
+ {/* Row 2 */}
48
+ <PlaceHolderButton />
49
+ <PlaceHolderButton />
50
+ <PlaceHolderButton />
51
+ <SecondaryKeypadButton
52
+ keyConfig={Keys.X}
53
+ onClickKey={onClickKey}
54
+ style={{
55
+ gridColumn: 5,
56
+ }}
57
+ />
58
+ <SecondaryKeypadButton
59
+ keyConfig={Keys.FRAC_INCLUSIVE}
60
+ onClickKey={onClickKey}
61
+ style={{
62
+ gridColumn: 6,
63
+ }}
64
+ />
65
+ {/* Row 3 */}
66
+ <PlaceHolderButton />
67
+ <PlaceHolderButton />
68
+ <PlaceHolderButton />
69
+ <SecondaryKeypadButton
70
+ keyConfig={Keys.PI}
71
+ onClickKey={onClickKey}
72
+ style={{
73
+ gridColumn: 5,
74
+ }}
75
+ />
76
+ <KeypadActionButton
77
+ keyConfig={Keys.BACKSPACE}
78
+ style={{
79
+ gridColumn: 6,
80
+ }}
81
+ onClickKey={onClickKey}
82
+ />
83
+ {/* Row 4 */}
84
+ <PlaceHolderButton />
85
+ <PlaceHolderButton />
86
+ <PlaceHolderButton />
87
+ <KeypadActionButton
88
+ keyConfig={Keys.DISMISS}
89
+ style={{
90
+ gridColumn: "6",
91
+ }}
92
+ onClickKey={onClickKey}
93
+ />
94
+ </KeypadPageContainer>
95
+ );
96
+ }
97
+ }
@@ -0,0 +1,89 @@
1
+ import * as React from "react";
2
+
3
+ import Keys from "../../data/key-configs";
4
+
5
+ import {
6
+ KeypadPageContainer,
7
+ SecondaryKeypadButton,
8
+ KeypadActionButton,
9
+ } from "./keypad-page-items";
10
+
11
+ type Props = {
12
+ onClickKey: (keyConfig: string) => void;
13
+ };
14
+
15
+ export default class TrigonometryInputPage extends React.Component<Props> {
16
+ render(): React.ReactElement {
17
+ const {onClickKey} = this.props;
18
+ return (
19
+ <KeypadPageContainer>
20
+ {/* Row 1 */}
21
+ <SecondaryKeypadButton
22
+ keyConfig={Keys.SIN}
23
+ onClickKey={onClickKey}
24
+ />
25
+ <SecondaryKeypadButton
26
+ keyConfig={Keys.COS}
27
+ onClickKey={onClickKey}
28
+ />
29
+ <SecondaryKeypadButton
30
+ keyConfig={Keys.TAN}
31
+ onClickKey={onClickKey}
32
+ />
33
+
34
+ <SecondaryKeypadButton
35
+ keyConfig={Keys.LEFT_PAREN}
36
+ onClickKey={onClickKey}
37
+ style={{
38
+ gridColumn: 5,
39
+ }}
40
+ />
41
+ <SecondaryKeypadButton
42
+ keyConfig={Keys.RIGHT_PAREN}
43
+ onClickKey={onClickKey}
44
+ style={{
45
+ gridColumn: 6,
46
+ }}
47
+ />
48
+ {/* Row 2 */}
49
+ <SecondaryKeypadButton
50
+ keyConfig={Keys.X}
51
+ onClickKey={onClickKey}
52
+ style={{
53
+ gridColumn: 5,
54
+ }}
55
+ />
56
+ <SecondaryKeypadButton
57
+ keyConfig={Keys.FRAC_INCLUSIVE}
58
+ onClickKey={onClickKey}
59
+ style={{
60
+ gridColumn: 6,
61
+ }}
62
+ />
63
+ {/* Row 3 */}
64
+ <SecondaryKeypadButton
65
+ keyConfig={Keys.PI}
66
+ onClickKey={onClickKey}
67
+ style={{
68
+ gridColumn: 5,
69
+ }}
70
+ />
71
+ <KeypadActionButton
72
+ keyConfig={Keys.BACKSPACE}
73
+ style={{
74
+ gridColumn: "6",
75
+ }}
76
+ onClickKey={onClickKey}
77
+ />
78
+ {/* Row 4 */}
79
+ <KeypadActionButton
80
+ keyConfig={Keys.DISMISS}
81
+ style={{
82
+ gridColumn: "6",
83
+ }}
84
+ onClickKey={onClickKey}
85
+ />
86
+ </KeypadPageContainer>
87
+ );
88
+ }
89
+ }