@khanacademy/math-input 2.0.0 → 4.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.
- package/CHANGELOG.md +55 -0
- package/dist/components/input/__tests__/test-math-wrapper.d.ts +1 -1
- package/dist/components/input/__tests__/test-math-wrapper.js.flow +1 -1
- package/dist/components/input/key-handlers/handle-arrow.d.ts +3 -0
- package/dist/components/input/key-handlers/handle-arrow.js.flow +12 -0
- package/dist/components/input/key-handlers/handle-backspace.d.ts +7 -0
- package/dist/components/input/key-handlers/handle-backspace.js.flow +14 -0
- package/dist/components/input/key-handlers/handle-exponent.d.ts +3 -0
- package/dist/components/input/key-handlers/handle-exponent.js.flow +12 -0
- package/dist/components/input/key-handlers/handle-jump-out.d.ts +7 -0
- package/dist/components/input/key-handlers/handle-jump-out.js.flow +14 -0
- package/dist/components/input/math-input.d.ts +1 -1
- package/dist/components/input/math-input.js.flow +1 -1
- package/dist/components/input/math-wrapper.d.ts +7 -78
- package/dist/components/input/math-wrapper.js.flow +16 -78
- package/dist/components/input/mathquill-helpers.d.ts +46 -0
- package/dist/components/input/mathquill-helpers.js.flow +56 -0
- package/dist/components/input/mathquill-instance.d.ts +3 -0
- package/dist/components/input/mathquill-instance.js.flow +9 -0
- package/dist/components/input/mathquill-types.d.ts +25 -0
- package/dist/components/input/mathquill-types.js.flow +34 -0
- package/dist/components/key-translator.d.ts +4 -0
- package/dist/components/key-translator.js.flow +10 -0
- package/dist/components/keypad/button-assets.d.ts +2 -2
- package/dist/components/keypad/button-assets.js.flow +2 -2
- package/dist/components/keypad/button.d.ts +1 -2
- package/dist/components/keypad/button.js.flow +1 -1
- package/dist/components/keypad/{pre-algebra-page.d.ts → geometry-page/index.d.ts} +1 -1
- package/dist/components/keypad/{pre-algebra-page.js.flow → geometry-page/index.js.flow} +1 -1
- package/dist/components/keypad/index.d.ts +5 -4
- package/dist/components/keypad/index.js.flow +9 -4
- package/dist/components/keypad/keypad-page-items.d.ts +9 -3
- package/dist/components/keypad/keypad-page-items.js.flow +9 -3
- package/dist/components/keypad/{numeric-input-page.d.ts → numbers-page/index.d.ts} +3 -2
- package/dist/components/keypad/numbers-page/index.js.flow +17 -0
- package/dist/components/keypad/numbers-page/types.d.ts +4 -0
- package/dist/components/keypad/numbers-page/types.js.flow +10 -0
- package/dist/components/keypad/operators-page/advanced-relations-buttons.d.ts +7 -0
- package/dist/components/keypad/{numeric-input-page.js.flow → operators-page/advanced-relations-buttons.js.flow} +3 -4
- package/dist/components/keypad/operators-page/basic-relations-buttons.d.ts +7 -0
- package/dist/components/keypad/{trigonometry-page.js.flow → operators-page/basic-relations-buttons.js.flow} +3 -6
- package/dist/components/keypad/operators-page/index.d.ts +9 -0
- package/dist/components/keypad/operators-page/index.js.flow +17 -0
- package/dist/components/keypad/operators-page/logarithms-buttons.d.ts +7 -0
- package/dist/components/keypad/operators-page/logarithms-buttons.js.flow +12 -0
- package/dist/components/keypad/operators-page/pre-algebra-buttons.d.ts +7 -0
- package/dist/components/keypad/operators-page/pre-algebra-buttons.js.flow +12 -0
- package/dist/components/keypad/operators-page/types.d.ts +6 -0
- package/dist/components/keypad/operators-page/types.js.flow +12 -0
- package/dist/components/{compute-layout-parameters.d.ts → keypad-legacy/compute-layout-parameters.d.ts} +1 -1
- package/dist/components/{compute-layout-parameters.js.flow → keypad-legacy/compute-layout-parameters.js.flow} +1 -1
- package/dist/components/{echo-manager.d.ts → keypad-legacy/echo-manager.d.ts} +2 -11
- package/dist/components/{echo-manager.js.flow → keypad-legacy/echo-manager.js.flow} +2 -11
- package/dist/components/{expression-keypad.d.ts → keypad-legacy/expression-keypad.d.ts} +3 -4
- package/dist/components/{expression-keypad.js.flow → keypad-legacy/expression-keypad.js.flow} +3 -4
- package/dist/components/{fraction-keypad.d.ts → keypad-legacy/fraction-keypad.d.ts} +2 -2
- package/dist/components/{fraction-keypad.js.flow → keypad-legacy/fraction-keypad.js.flow} +2 -2
- package/dist/components/{gesture-manager.d.ts → keypad-legacy/gesture-manager.d.ts} +22 -10
- package/dist/components/{gesture-manager.js.flow → keypad-legacy/gesture-manager.js.flow} +28 -13
- package/dist/components/{gesture-state-machine.d.ts → keypad-legacy/gesture-state-machine.d.ts} +9 -9
- package/dist/components/{gesture-state-machine.js.flow → keypad-legacy/gesture-state-machine.js.flow} +10 -10
- package/dist/components/{icon.d.ts → keypad-legacy/icon.d.ts} +1 -1
- package/dist/components/{icon.js.flow → keypad-legacy/icon.js.flow} +1 -1
- package/dist/components/{keypad-button.d.ts → keypad-legacy/keypad-button.d.ts} +6 -6
- package/dist/components/{keypad-button.js.flow → keypad-legacy/keypad-button.js.flow} +7 -7
- package/dist/components/{keypad-container.d.ts → keypad-legacy/keypad-container.d.ts} +2 -2
- package/dist/components/{keypad-container.js.flow → keypad-legacy/keypad-container.js.flow} +3 -3
- package/dist/components/{keypad.d.ts → keypad-legacy/keypad.d.ts} +3 -3
- package/dist/components/{keypad.js.flow → keypad-legacy/keypad.js.flow} +3 -3
- package/dist/components/{multi-symbol-grid.d.ts → keypad-legacy/multi-symbol-grid.d.ts} +1 -1
- package/dist/components/{multi-symbol-grid.js.flow → keypad-legacy/multi-symbol-grid.js.flow} +1 -1
- package/dist/components/{multi-symbol-popover.d.ts → keypad-legacy/multi-symbol-popover.d.ts} +1 -1
- package/dist/components/{multi-symbol-popover.js.flow → keypad-legacy/multi-symbol-popover.js.flow} +1 -1
- package/dist/components/{node-manager.d.ts → keypad-legacy/node-manager.d.ts} +3 -4
- package/dist/components/{node-manager.js.flow → keypad-legacy/node-manager.js.flow} +3 -5
- package/dist/components/{popover-manager.d.ts → keypad-legacy/popover-manager.d.ts} +1 -1
- package/dist/components/{popover-manager.js.flow → keypad-legacy/popover-manager.js.flow} +1 -1
- package/dist/components/{popover-state-machine.d.ts → keypad-legacy/popover-state-machine.d.ts} +1 -1
- package/dist/components/{popover-state-machine.js.flow → keypad-legacy/popover-state-machine.js.flow} +1 -1
- package/dist/components/{provided-keypad.d.ts → keypad-legacy/provided-keypad.d.ts} +1 -1
- package/dist/components/{provided-keypad.js.flow → keypad-legacy/provided-keypad.js.flow} +1 -1
- package/dist/{store → components/keypad-legacy/store}/actions.d.ts +6 -17
- package/dist/{store → components/keypad-legacy/store}/actions.js.flow +7 -22
- package/dist/{store → components/keypad-legacy/store}/index.d.ts +0 -1
- package/dist/{store → components/keypad-legacy/store}/index.js.flow +0 -1
- package/dist/components/keypad-legacy/store/shared.d.ts +7 -0
- package/dist/components/keypad-legacy/store/shared.js.flow +14 -0
- package/dist/{store → components/keypad-legacy/store}/types.d.ts +5 -15
- package/dist/{store → components/keypad-legacy/store}/types.js.flow +5 -15
- package/dist/components/keypad-legacy/touchable-keypad-button.d.ts +37 -0
- package/dist/components/keypad-legacy/touchable-keypad-button.js.flow +59 -0
- package/dist/components/{two-page-keypad.d.ts → keypad-legacy/two-page-keypad.d.ts} +0 -1
- package/dist/components/{two-page-keypad.js.flow → keypad-legacy/two-page-keypad.js.flow} +0 -1
- package/dist/data/key-configs.d.ts +4 -5
- package/dist/data/key-configs.js.flow +3 -6
- package/dist/data/keys.d.ts +2 -56
- package/dist/data/keys.js.flow +116 -57
- package/dist/enums.d.ts +2 -9
- package/dist/enums.js.flow +2 -11
- package/dist/es/index.js +6393 -5116
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.js +6868 -5330
- package/dist/index.js.flow +6 -3
- package/dist/index.js.map +1 -1
- package/dist/strings.js +26 -10
- package/dist/types.d.ts +19 -17
- package/dist/types.js.flow +28 -23
- package/package.json +1 -1
- package/src/components/input/__tests__/context-tracking.test.ts +43 -44
- package/src/components/input/__tests__/mathquill.test.ts +133 -135
- package/src/components/input/key-handlers/handle-arrow.ts +70 -0
- package/src/components/input/key-handlers/handle-backspace.ts +275 -0
- package/src/components/input/key-handlers/handle-exponent.ts +52 -0
- package/src/components/input/key-handlers/handle-jump-out.ts +103 -0
- package/src/components/input/math-input.tsx +12 -13
- package/src/components/input/math-wrapper.ts +88 -837
- package/src/components/input/mathquill-helpers.ts +268 -0
- package/src/components/input/mathquill-instance.ts +5 -0
- package/src/components/input/mathquill-types.ts +55 -0
- package/src/components/key-translator.ts +209 -0
- package/src/components/keypad/button-assets.tsx +452 -116
- package/src/components/keypad/button.stories.tsx +61 -13
- package/src/components/keypad/button.tsx +1 -1
- package/src/components/keypad/{trigonometry-page.tsx → geometry-page/index.tsx} +4 -5
- package/src/components/keypad/index.tsx +19 -14
- package/src/components/keypad/keypad-mathquill.stories.tsx +69 -0
- package/src/components/keypad/keypad-page-items.tsx +36 -22
- package/src/components/keypad/keypad-pages.stories.tsx +5 -5
- package/src/components/keypad/keypad.stories.tsx +75 -17
- package/src/components/keypad/{numeric-input-page.tsx → numbers-page/index.tsx} +47 -11
- package/src/components/keypad/numbers-page/types.ts +4 -0
- package/src/components/keypad/operators-page/advanced-relations-buttons.tsx +32 -0
- package/src/components/keypad/operators-page/basic-relations-buttons.tsx +32 -0
- package/src/components/keypad/{pre-algebra-page.tsx → operators-page/index.tsx} +26 -30
- package/src/components/keypad/operators-page/logarithms-buttons.tsx +32 -0
- package/src/components/keypad/operators-page/pre-algebra-buttons.tsx +36 -0
- package/src/components/keypad/operators-page/types.ts +6 -0
- package/src/components/{__tests__ → keypad-legacy/__tests__}/two-page-keypad.test.tsx +0 -2
- package/src/components/{compute-layout-parameters.ts → keypad-legacy/compute-layout-parameters.ts} +2 -3
- package/src/components/{corner-decal.tsx → keypad-legacy/corner-decal.tsx} +2 -3
- package/src/components/{echo-manager.tsx → keypad-legacy/echo-manager.tsx} +8 -21
- package/src/components/{empty-keypad-button.tsx → keypad-legacy/empty-keypad-button.tsx} +8 -6
- package/src/components/{expression-keypad.tsx → keypad-legacy/expression-keypad.tsx} +8 -17
- package/src/components/{fraction-keypad.tsx → keypad-legacy/fraction-keypad.tsx} +6 -6
- package/src/components/{gesture-manager.ts → keypad-legacy/gesture-manager.ts} +34 -11
- package/src/components/{gesture-state-machine.ts → keypad-legacy/gesture-state-machine.ts} +14 -14
- package/src/components/{icon.tsx → keypad-legacy/icon.tsx} +3 -3
- package/src/components/{keypad-button.tsx → keypad-legacy/keypad-button.tsx} +26 -26
- package/src/components/{keypad-container.tsx → keypad-legacy/keypad-container.tsx} +6 -6
- package/src/components/{keypad.tsx → keypad-legacy/keypad.tsx} +5 -5
- package/src/components/{many-keypad-button.tsx → keypad-legacy/many-keypad-button.tsx} +13 -6
- package/src/components/{math-icon.tsx → keypad-legacy/math-icon.tsx} +2 -2
- package/src/components/{multi-symbol-grid.tsx → keypad-legacy/multi-symbol-grid.tsx} +4 -4
- package/src/components/{multi-symbol-popover.tsx → keypad-legacy/multi-symbol-popover.tsx} +3 -4
- package/src/components/{navigation-pad.tsx → keypad-legacy/navigation-pad.tsx} +5 -5
- package/src/components/{node-manager.ts → keypad-legacy/node-manager.ts} +2 -10
- package/src/components/{popover-manager.tsx → keypad-legacy/popover-manager.tsx} +2 -2
- package/src/components/{popover-state-machine.ts → keypad-legacy/popover-state-machine.ts} +1 -1
- package/src/components/{provided-keypad.tsx → keypad-legacy/provided-keypad.tsx} +4 -5
- package/src/{store → components/keypad-legacy/store}/actions.ts +7 -36
- package/src/{store → components/keypad-legacy/store}/echo-reducer.ts +3 -7
- package/src/{store → components/keypad-legacy/store}/index.ts +7 -20
- package/src/{store → components/keypad-legacy/store}/input-reducer.ts +4 -5
- package/src/{store → components/keypad-legacy/store}/keypad-reducer.ts +3 -4
- package/src/{store → components/keypad-legacy/store}/layout-reducer.ts +3 -3
- package/src/{store → components/keypad-legacy/store}/shared.ts +3 -3
- package/src/{store → components/keypad-legacy/store}/types.ts +15 -19
- package/src/components/{styles.ts → keypad-legacy/styles.ts} +1 -1
- package/src/components/{text-icon.tsx → keypad-legacy/text-icon.tsx} +2 -2
- package/src/components/{touchable-keypad-button.tsx → keypad-legacy/touchable-keypad-button.tsx} +35 -21
- package/src/components/{two-page-keypad.tsx → keypad-legacy/two-page-keypad.tsx} +5 -6
- package/src/components/tabbar/icons.tsx +0 -2
- package/src/data/key-configs.ts +751 -309
- package/src/data/keys.ts +118 -70
- package/src/enums.ts +10 -9
- package/src/index.ts +6 -3
- package/src/math-input.stories.tsx +3 -3
- package/src/types.ts +21 -16
- package/tsconfig-build.tsbuildinfo +1 -1
- package/dist/components/keypad/trigonometry-page.d.ts +0 -8
- package/dist/components/touchable-keypad-button.d.ts +0 -30
- package/dist/components/touchable-keypad-button.js.flow +0 -35
- package/dist/components/velocity-tracker.d.ts +0 -48
- package/dist/components/velocity-tracker.js.flow +0 -54
- package/dist/store/pager-reducer.d.ts +0 -4
- package/dist/store/pager-reducer.js.flow +0 -13
- package/dist/store/shared.d.ts +0 -7
- package/dist/store/shared.js.flow +0 -14
- package/src/components/velocity-tracker.ts +0 -86
- package/src/store/pager-reducer.ts +0 -125
- /package/dist/components/{corner-decal.d.ts → keypad-legacy/corner-decal.d.ts} +0 -0
- /package/dist/components/{corner-decal.js.flow → keypad-legacy/corner-decal.js.flow} +0 -0
- /package/dist/components/{empty-keypad-button.d.ts → keypad-legacy/empty-keypad-button.d.ts} +0 -0
- /package/dist/components/{empty-keypad-button.js.flow → keypad-legacy/empty-keypad-button.js.flow} +0 -0
- /package/dist/components/{many-keypad-button.d.ts → keypad-legacy/many-keypad-button.d.ts} +0 -0
- /package/dist/components/{many-keypad-button.js.flow → keypad-legacy/many-keypad-button.js.flow} +0 -0
- /package/dist/components/{math-icon.d.ts → keypad-legacy/math-icon.d.ts} +0 -0
- /package/dist/components/{math-icon.js.flow → keypad-legacy/math-icon.js.flow} +0 -0
- /package/dist/components/{navigation-pad.d.ts → keypad-legacy/navigation-pad.d.ts} +0 -0
- /package/dist/components/{navigation-pad.js.flow → keypad-legacy/navigation-pad.js.flow} +0 -0
- /package/dist/{store → components/keypad-legacy/store}/echo-reducer.d.ts +0 -0
- /package/dist/{store → components/keypad-legacy/store}/echo-reducer.js.flow +0 -0
- /package/dist/{store → components/keypad-legacy/store}/input-reducer.d.ts +0 -0
- /package/dist/{store → components/keypad-legacy/store}/input-reducer.js.flow +0 -0
- /package/dist/{store → components/keypad-legacy/store}/keypad-reducer.d.ts +0 -0
- /package/dist/{store → components/keypad-legacy/store}/keypad-reducer.js.flow +0 -0
- /package/dist/{store → components/keypad-legacy/store}/layout-reducer.d.ts +0 -0
- /package/dist/{store → components/keypad-legacy/store}/layout-reducer.js.flow +0 -0
- /package/dist/components/{styles.d.ts → keypad-legacy/styles.d.ts} +0 -0
- /package/dist/components/{styles.js.flow → keypad-legacy/styles.js.flow} +0 -0
- /package/dist/components/{svg-icon.d.ts → keypad-legacy/svg-icon.d.ts} +0 -0
- /package/dist/components/{svg-icon.js.flow → keypad-legacy/svg-icon.js.flow} +0 -0
- /package/dist/components/{text-icon.d.ts → keypad-legacy/text-icon.d.ts} +0 -0
- /package/dist/components/{text-icon.js.flow → keypad-legacy/text-icon.js.flow} +0 -0
- /package/dist/components/{z-indexes.d.ts → keypad-legacy/z-indexes.d.ts} +0 -0
- /package/dist/components/{z-indexes.js.flow → keypad-legacy/z-indexes.js.flow} +0 -0
- /package/src/components/{__tests__ → keypad-legacy/__tests__}/gesture-state-machine.test.ts +0 -0
- /package/src/components/{__tests__ → keypad-legacy/__tests__}/node-manager.test.ts +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/arrow.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/backspace.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/cdot.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/cos.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/cube-root.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/dismiss.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/divide.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/down.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/equal.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/exp-2.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/exp-3.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/exp.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/frac.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/geq.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/gt.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/index.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/jump-into-numerator.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/jump-out-base.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/jump-out-denominator.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/jump-out-exponent.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/jump-out-numerator.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/jump-out-parentheses.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/left-paren.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/left.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/leq.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/ln.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/log-n.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/log.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/lt.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/minus.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/neq.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/parens.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/percent.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/period.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/plus.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/radical.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/right-paren.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/right.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/sin.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/sqrt.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/tan.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/times.js +0 -0
- /package/src/components/{iconography → keypad-legacy/iconography}/up.js +0 -0
- /package/src/components/{svg-icon.tsx → keypad-legacy/svg-icon.tsx} +0 -0
- /package/src/components/{z-indexes.ts → keypad-legacy/z-indexes.ts} +0 -0
|
@@ -1,29 +1,77 @@
|
|
|
1
1
|
import {action} from "@storybook/addon-actions";
|
|
2
|
-
import {
|
|
2
|
+
import {ComponentStory} from "@storybook/react";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import KeyConfigs from "../../data/key-configs";
|
|
6
|
+
|
|
7
|
+
import {KeypadButton, KeypadButtonProps} from "./keypad-page-items";
|
|
6
8
|
|
|
7
9
|
export default {
|
|
8
10
|
title: "Keypad Button",
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
args: {
|
|
12
|
+
keyConfig: KeyConfigs["PLUS"],
|
|
13
|
+
tintColor: "#F6F6F7",
|
|
14
|
+
},
|
|
15
|
+
argTypes: {
|
|
16
|
+
keyConfig: {
|
|
17
|
+
control: "select",
|
|
18
|
+
options: {...KeyConfigs},
|
|
19
|
+
},
|
|
20
|
+
tintColor: {
|
|
21
|
+
control: "color",
|
|
15
22
|
},
|
|
16
23
|
},
|
|
17
24
|
};
|
|
18
25
|
|
|
19
|
-
|
|
26
|
+
const Template: ComponentStory<typeof KeypadButton> = ({
|
|
27
|
+
...args
|
|
28
|
+
}: KeypadButtonProps): React.ReactElement => (
|
|
29
|
+
<div
|
|
30
|
+
style={{
|
|
31
|
+
width: 200,
|
|
32
|
+
height: 200,
|
|
33
|
+
backgroundColor: "#DBDCDD",
|
|
34
|
+
display: "flex",
|
|
35
|
+
}}
|
|
36
|
+
>
|
|
37
|
+
<div
|
|
38
|
+
style={{
|
|
39
|
+
width: 58,
|
|
40
|
+
margin: "auto",
|
|
41
|
+
}}
|
|
42
|
+
>
|
|
43
|
+
<KeypadButton {...args} onClickKey={action("pressed")} />
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
export const Default = Template.bind({});
|
|
48
|
+
|
|
49
|
+
export const AllButtons: ComponentStory<typeof KeypadButton> = ({
|
|
50
|
+
...args
|
|
51
|
+
}: KeypadButtonProps): React.ReactElement => (
|
|
20
52
|
<div
|
|
21
53
|
style={{
|
|
22
|
-
|
|
54
|
+
backgroundColor: "#DBDCDD",
|
|
55
|
+
display: "grid",
|
|
56
|
+
gridTemplateColumns: "repeat(6, 1fr)",
|
|
57
|
+
gap: "25px",
|
|
23
58
|
}}
|
|
24
59
|
>
|
|
25
|
-
|
|
26
|
-
<
|
|
27
|
-
|
|
60
|
+
{Object.keys(KeyConfigs).map((key) => (
|
|
61
|
+
<div
|
|
62
|
+
key={key}
|
|
63
|
+
style={{
|
|
64
|
+
width: 58,
|
|
65
|
+
margin: "auto",
|
|
66
|
+
overflowWrap: "break-word",
|
|
67
|
+
}}
|
|
68
|
+
>
|
|
69
|
+
{key}
|
|
70
|
+
<KeypadButton
|
|
71
|
+
keyConfig={KeyConfigs[key]}
|
|
72
|
+
onClickKey={action("pressed")}
|
|
73
|
+
/>
|
|
74
|
+
</div>
|
|
75
|
+
))}
|
|
28
76
|
</div>
|
|
29
77
|
);
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
|
|
3
|
-
import Keys from "
|
|
4
|
-
|
|
3
|
+
import Keys from "../../../data/key-configs";
|
|
5
4
|
import {
|
|
6
5
|
KeypadPageContainer,
|
|
7
6
|
SecondaryKeypadButton,
|
|
8
7
|
KeypadActionButton,
|
|
9
|
-
} from "
|
|
8
|
+
} from "../keypad-page-items";
|
|
10
9
|
|
|
11
10
|
type Props = {
|
|
12
11
|
onClickKey: (keyConfig: string) => void;
|
|
13
12
|
};
|
|
14
13
|
|
|
15
|
-
export default class
|
|
14
|
+
export default class GeometryPage extends React.Component<Props> {
|
|
16
15
|
render(): React.ReactNode {
|
|
17
16
|
const {onClickKey} = this.props;
|
|
18
17
|
return (
|
|
@@ -47,7 +46,7 @@ export default class TrigonometryInputPage extends React.Component<Props> {
|
|
|
47
46
|
/>
|
|
48
47
|
{/* Row 2 */}
|
|
49
48
|
<SecondaryKeypadButton
|
|
50
|
-
keyConfig={Keys.
|
|
49
|
+
keyConfig={Keys.x}
|
|
51
50
|
onClickKey={onClickKey}
|
|
52
51
|
style={{
|
|
53
52
|
gridColumn: 5,
|
|
@@ -3,17 +3,19 @@ import * as React from "react";
|
|
|
3
3
|
|
|
4
4
|
import Tabbar from "../tabbar/tabbar";
|
|
5
5
|
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
6
|
+
import GeometryPage from "./geometry-page";
|
|
7
|
+
import NumbersPage from "./numbers-page";
|
|
8
|
+
import {NumbersPageOptions} from "./numbers-page/types";
|
|
9
|
+
import OperatorsPage from "./operators-page";
|
|
10
|
+
import {OperatorsButtonSets} from "./operators-page/types";
|
|
9
11
|
|
|
10
12
|
import type {TabbarItemType} from "../tabbar/types";
|
|
11
13
|
|
|
12
|
-
type Props = {
|
|
14
|
+
export type Props = {
|
|
13
15
|
onClickKey: (keyConfig: string) => void;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
trigonometry?: boolean;
|
|
17
|
+
} & OperatorsButtonSets &
|
|
18
|
+
NumbersPageOptions;
|
|
17
19
|
type State = {
|
|
18
20
|
selectedPage: TabbarItemType;
|
|
19
21
|
};
|
|
@@ -21,7 +23,13 @@ type State = {
|
|
|
21
23
|
const allPages = function (props: Props): React.ReactElement {
|
|
22
24
|
const pages: Array<TabbarItemType> = ["Numbers"];
|
|
23
25
|
|
|
24
|
-
if (
|
|
26
|
+
if (
|
|
27
|
+
// OperatorsButtonSets
|
|
28
|
+
props.preAlgebra ||
|
|
29
|
+
props.logarithms ||
|
|
30
|
+
props.basicRelations ||
|
|
31
|
+
props.advancedRelations
|
|
32
|
+
) {
|
|
25
33
|
pages.push("Operators");
|
|
26
34
|
}
|
|
27
35
|
if (props.trigonometry) {
|
|
@@ -37,7 +45,6 @@ export default class Keypad extends React.Component<Props, State> {
|
|
|
37
45
|
};
|
|
38
46
|
render(): React.ReactNode {
|
|
39
47
|
const {selectedPage} = this.state;
|
|
40
|
-
const {onClickKey} = this.props;
|
|
41
48
|
|
|
42
49
|
const availablePages = allPages(this.props);
|
|
43
50
|
|
|
@@ -50,14 +57,12 @@ export default class Keypad extends React.Component<Props, State> {
|
|
|
50
57
|
this.setState({selectedPage: tabbarItem});
|
|
51
58
|
}}
|
|
52
59
|
/>
|
|
53
|
-
{selectedPage === "Numbers" &&
|
|
54
|
-
<NumericInputPage onClickKey={onClickKey} />
|
|
55
|
-
)}
|
|
60
|
+
{selectedPage === "Numbers" && <NumbersPage {...this.props} />}
|
|
56
61
|
{selectedPage === "Operators" && (
|
|
57
|
-
<
|
|
62
|
+
<OperatorsPage {...this.props} />
|
|
58
63
|
)}
|
|
59
64
|
{selectedPage === "Geometry" && (
|
|
60
|
-
<
|
|
65
|
+
<GeometryPage {...this.props} />
|
|
61
66
|
)}
|
|
62
67
|
</View>
|
|
63
68
|
);
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import MathQuill from "mathquill";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
import Key from "../../data/keys";
|
|
5
|
+
import keyTranslator from "../key-translator";
|
|
6
|
+
|
|
7
|
+
import Keypad from "./index";
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: "v2 Keypad With Mathquill",
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const mathQuillConfig = {
|
|
14
|
+
autoCommands: "pi theta phi sqrt nthroot",
|
|
15
|
+
charsThatBreakOutOfSupSub: "+-*/=<>≠≤≥",
|
|
16
|
+
supSubsRequireOperand: true,
|
|
17
|
+
spaceBehavesLikeTab: true,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export function V2KeypadWithMathquill() {
|
|
21
|
+
const mathquillWrapperRef = React.useRef<HTMLDivElement>(null);
|
|
22
|
+
const [mathQuill, setMathQuill] = React.useState<MathQuill>();
|
|
23
|
+
|
|
24
|
+
React.useEffect(() => {
|
|
25
|
+
if (!mathQuill && mathquillWrapperRef.current) {
|
|
26
|
+
const MQ = MathQuill.getInterface(2);
|
|
27
|
+
const mathQuillInstance = MQ.MathField(
|
|
28
|
+
mathquillWrapperRef.current,
|
|
29
|
+
mathQuillConfig,
|
|
30
|
+
);
|
|
31
|
+
setMathQuill(mathQuillInstance);
|
|
32
|
+
}
|
|
33
|
+
}, [mathQuill]);
|
|
34
|
+
|
|
35
|
+
function handleClickKey(key: Key) {
|
|
36
|
+
if (!mathQuill) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const mathQuillCallback = keyTranslator[key];
|
|
41
|
+
if (mathQuillCallback) {
|
|
42
|
+
mathQuillCallback(mathQuill, key);
|
|
43
|
+
} else {
|
|
44
|
+
// eslint-disable-next-line no-console
|
|
45
|
+
console.warn(`No translation to Mathquill for: ${key}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<div style={{maxWidth: "400px", margin: "2em"}}>
|
|
51
|
+
<div
|
|
52
|
+
ref={mathquillWrapperRef}
|
|
53
|
+
style={{width: "100%", marginBottom: "1em"}}
|
|
54
|
+
/>
|
|
55
|
+
<div>
|
|
56
|
+
<Keypad
|
|
57
|
+
onClickKey={handleClickKey}
|
|
58
|
+
advancedRelations
|
|
59
|
+
basicRelations
|
|
60
|
+
divisionKey
|
|
61
|
+
logarithms
|
|
62
|
+
multiplicationDot
|
|
63
|
+
preAlgebra
|
|
64
|
+
trigonometry
|
|
65
|
+
/>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {View} from "@khanacademy/wonder-blocks-core";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
|
|
4
|
+
import {KeyConfig} from "../../types";
|
|
5
|
+
|
|
4
6
|
import Button from "./button";
|
|
5
7
|
import ButtonAsset from "./button-assets";
|
|
6
8
|
|
|
7
|
-
import type {KeyConfig} from "../../data/key-configs";
|
|
8
9
|
import type {StyleType} from "@khanacademy/wonder-blocks-core";
|
|
9
10
|
|
|
10
11
|
type KeypadPageContainerProps = {
|
|
@@ -29,7 +30,7 @@ export const KeypadPageContainer = ({
|
|
|
29
30
|
</View>
|
|
30
31
|
);
|
|
31
32
|
|
|
32
|
-
type KeypadButtonProps = {
|
|
33
|
+
export type KeypadButtonProps = {
|
|
33
34
|
keyConfig: KeyConfig;
|
|
34
35
|
tintColor?: string;
|
|
35
36
|
style?: StyleType;
|
|
@@ -89,24 +90,37 @@ export const KeypadActionButton = ({
|
|
|
89
90
|
/>
|
|
90
91
|
);
|
|
91
92
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
>
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
93
|
+
/**
|
|
94
|
+
* A placeholder button for the keypad. Optional count prop to render multiple
|
|
95
|
+
* buttons. Defaults to 1.
|
|
96
|
+
*/
|
|
97
|
+
export const PlaceHolderButtons = ({
|
|
98
|
+
count = 1,
|
|
99
|
+
}: {
|
|
100
|
+
count?: number;
|
|
101
|
+
}): React.ReactElement => (
|
|
102
|
+
<React.Fragment>
|
|
103
|
+
{Array.from({length: count}).map((_, index) => (
|
|
104
|
+
<View
|
|
105
|
+
key={index}
|
|
106
|
+
style={{
|
|
107
|
+
height: "100%",
|
|
108
|
+
width: "100%",
|
|
109
|
+
boxSizing: "border-box",
|
|
110
|
+
borderRadius: 7,
|
|
111
|
+
border: "4px solid transparent",
|
|
112
|
+
}}
|
|
113
|
+
>
|
|
114
|
+
<View
|
|
115
|
+
style={{
|
|
116
|
+
background: "rgba(33, 36, 44, 0.04)",
|
|
117
|
+
width: "100%",
|
|
118
|
+
height: "100%",
|
|
119
|
+
borderRadius: 4,
|
|
120
|
+
border: `1px solid transparent`,
|
|
121
|
+
}}
|
|
122
|
+
/>
|
|
123
|
+
</View>
|
|
124
|
+
))}
|
|
125
|
+
</React.Fragment>
|
|
112
126
|
);
|
|
@@ -2,9 +2,9 @@ import {action} from "@storybook/addon-actions";
|
|
|
2
2
|
import {withKnobs} from "@storybook/addon-knobs";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
5
|
+
import GeometryInputPage from "./geometry-page";
|
|
6
|
+
import NumbersPage from "./numbers-page";
|
|
7
|
+
import PrealgebraInputPage from "./operators-page";
|
|
8
8
|
|
|
9
9
|
export default {
|
|
10
10
|
title: "Keypad pages",
|
|
@@ -18,7 +18,7 @@ export default {
|
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
export const NumericInput = (): React.ReactElement => (
|
|
21
|
-
<
|
|
21
|
+
<NumbersPage onClickKey={action("onClickKey")} />
|
|
22
22
|
);
|
|
23
23
|
|
|
24
24
|
export const PreAlgebraInput = (): React.ReactElement => (
|
|
@@ -26,5 +26,5 @@ export const PreAlgebraInput = (): React.ReactElement => (
|
|
|
26
26
|
);
|
|
27
27
|
|
|
28
28
|
export const TrigonometryInput = (): React.ReactElement => (
|
|
29
|
-
<
|
|
29
|
+
<GeometryInputPage onClickKey={action("onClickKey")} />
|
|
30
30
|
);
|
|
@@ -1,33 +1,91 @@
|
|
|
1
1
|
import {action} from "@storybook/addon-actions";
|
|
2
|
-
import {withKnobs} from "@storybook/addon-knobs";
|
|
3
2
|
import {INITIAL_VIEWPORTS} from "@storybook/addon-viewport";
|
|
3
|
+
import {ComponentStory} from "@storybook/react";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
|
|
6
|
-
import Keypad from "./index";
|
|
6
|
+
import Keypad, {Props as KeypadProps} from "./index";
|
|
7
|
+
|
|
8
|
+
const opsPage = "Operators Page";
|
|
9
|
+
const numsPage = "Numbers Page";
|
|
10
|
+
const geoPage = "Geometry Page";
|
|
7
11
|
|
|
8
12
|
export default {
|
|
9
13
|
title: "Full Keypad",
|
|
10
|
-
decorators: [withKnobs],
|
|
11
14
|
parameters: {
|
|
12
15
|
backgrounds: {
|
|
13
16
|
values: [{name: "light background", value: "white", default: true}],
|
|
14
17
|
},
|
|
15
18
|
viewport: {defaultViewport: "iphone6", viewports: INITIAL_VIEWPORTS},
|
|
16
19
|
},
|
|
20
|
+
component: Keypad,
|
|
21
|
+
args: {
|
|
22
|
+
advancedRelations: false,
|
|
23
|
+
basicRelations: false,
|
|
24
|
+
divisionKey: false,
|
|
25
|
+
logarithms: false,
|
|
26
|
+
multiplicationDot: false,
|
|
27
|
+
preAlgebra: false,
|
|
28
|
+
trigonometry: false,
|
|
29
|
+
},
|
|
30
|
+
argTypes: {
|
|
31
|
+
advancedRelations: {
|
|
32
|
+
control: "boolean",
|
|
33
|
+
table: {
|
|
34
|
+
category: opsPage,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
basicRelations: {
|
|
38
|
+
control: "boolean",
|
|
39
|
+
table: {
|
|
40
|
+
category: opsPage,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
divisionKey: {
|
|
44
|
+
control: "boolean",
|
|
45
|
+
table: {
|
|
46
|
+
category: numsPage,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
logarithms: {
|
|
50
|
+
control: "boolean",
|
|
51
|
+
table: {
|
|
52
|
+
category: opsPage,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
multiplicationDot: {
|
|
56
|
+
control: "boolean",
|
|
57
|
+
table: {
|
|
58
|
+
category: numsPage,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
preAlgebra: {
|
|
62
|
+
control: "boolean",
|
|
63
|
+
table: {
|
|
64
|
+
category: opsPage,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
trigonometry: {
|
|
68
|
+
control: "boolean",
|
|
69
|
+
table: {
|
|
70
|
+
category: geoPage,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
},
|
|
17
74
|
};
|
|
18
75
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
/>
|
|
25
|
-
);
|
|
76
|
+
const Template: ComponentStory<typeof Keypad> = (
|
|
77
|
+
args: KeypadProps,
|
|
78
|
+
): React.ReactElement => <Keypad {...args} onClickKey={action("onClickKey")} />;
|
|
79
|
+
|
|
80
|
+
export const Default = Template.bind({});
|
|
26
81
|
|
|
27
|
-
export const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
82
|
+
export const PreAlgebra = Template.bind({});
|
|
83
|
+
PreAlgebra.args = {
|
|
84
|
+
preAlgebra: true,
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export const Trigonometry = Template.bind({});
|
|
88
|
+
Trigonometry.args = {
|
|
89
|
+
preAlgebra: true,
|
|
90
|
+
trigonometry: true,
|
|
91
|
+
};
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
|
|
3
|
-
import Keys from "
|
|
4
|
-
|
|
3
|
+
import Keys from "../../../data/key-configs";
|
|
5
4
|
import {
|
|
6
5
|
KeypadPageContainer,
|
|
7
6
|
KeypadButton,
|
|
8
7
|
SecondaryKeypadButton,
|
|
9
8
|
KeypadActionButton,
|
|
10
|
-
} from "
|
|
9
|
+
} from "../keypad-page-items";
|
|
10
|
+
|
|
11
|
+
import {NumbersPageOptions} from "./types";
|
|
11
12
|
|
|
12
13
|
type Props = {
|
|
13
14
|
onClickKey: (keyConfig: string) => void;
|
|
14
|
-
};
|
|
15
|
+
} & NumbersPageOptions;
|
|
15
16
|
|
|
16
|
-
export default class
|
|
17
|
+
export default class NumbersPage extends React.Component<Props> {
|
|
17
18
|
render(): React.ReactNode {
|
|
18
19
|
const {onClickKey} = this.props;
|
|
19
20
|
return (
|
|
@@ -23,7 +24,29 @@ export default class NumericInputPage extends React.Component<Props> {
|
|
|
23
24
|
<KeypadButton keyConfig={Keys.NUM_8} onClickKey={onClickKey} />
|
|
24
25
|
<KeypadButton keyConfig={Keys.NUM_9} onClickKey={onClickKey} />
|
|
25
26
|
<SecondaryKeypadButton
|
|
26
|
-
keyConfig={Keys.
|
|
27
|
+
keyConfig={Keys.DIVIDE}
|
|
28
|
+
style={
|
|
29
|
+
this.props.divisionKey
|
|
30
|
+
? {
|
|
31
|
+
gridColumn: "4",
|
|
32
|
+
gridRow: "1",
|
|
33
|
+
}
|
|
34
|
+
: {
|
|
35
|
+
display: "none",
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
onClickKey={onClickKey}
|
|
39
|
+
/>
|
|
40
|
+
<SecondaryKeypadButton
|
|
41
|
+
keyConfig={
|
|
42
|
+
this.props.multiplicationDot ? Keys.CDOT : Keys.TIMES
|
|
43
|
+
}
|
|
44
|
+
style={
|
|
45
|
+
this.props.divisionKey && {
|
|
46
|
+
gridColumn: "4",
|
|
47
|
+
gridRow: "2",
|
|
48
|
+
}
|
|
49
|
+
}
|
|
27
50
|
onClickKey={onClickKey}
|
|
28
51
|
/>
|
|
29
52
|
<SecondaryKeypadButton
|
|
@@ -42,6 +65,12 @@ export default class NumericInputPage extends React.Component<Props> {
|
|
|
42
65
|
|
|
43
66
|
<SecondaryKeypadButton
|
|
44
67
|
keyConfig={Keys.MINUS}
|
|
68
|
+
style={
|
|
69
|
+
this.props.divisionKey && {
|
|
70
|
+
gridColumn: "4",
|
|
71
|
+
gridRow: "3",
|
|
72
|
+
}
|
|
73
|
+
}
|
|
45
74
|
onClickKey={onClickKey}
|
|
46
75
|
/>
|
|
47
76
|
|
|
@@ -59,11 +88,18 @@ export default class NumericInputPage extends React.Component<Props> {
|
|
|
59
88
|
|
|
60
89
|
<SecondaryKeypadButton
|
|
61
90
|
keyConfig={Keys.PLUS}
|
|
62
|
-
style={
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
91
|
+
style={
|
|
92
|
+
this.props.divisionKey
|
|
93
|
+
? {
|
|
94
|
+
gridColumn: "4",
|
|
95
|
+
gridRow: "4",
|
|
96
|
+
}
|
|
97
|
+
: {
|
|
98
|
+
gridColumn: "4",
|
|
99
|
+
gridRowStart: "3",
|
|
100
|
+
gridRowEnd: "5",
|
|
101
|
+
}
|
|
102
|
+
}
|
|
67
103
|
onClickKey={onClickKey}
|
|
68
104
|
/>
|
|
69
105
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import Keys from "../../../data/key-configs";
|
|
4
|
+
import {PlaceHolderButtons, SecondaryKeypadButton} from "../keypad-page-items";
|
|
5
|
+
|
|
6
|
+
type Props = {
|
|
7
|
+
onClickKey: (keyConfig: string) => void;
|
|
8
|
+
placeholder?: boolean;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const AdvancedRelations = ({
|
|
12
|
+
onClickKey,
|
|
13
|
+
placeholder,
|
|
14
|
+
}: Props): React.ReactElement =>
|
|
15
|
+
placeholder ? (
|
|
16
|
+
<PlaceHolderButtons count={3} />
|
|
17
|
+
) : (
|
|
18
|
+
<React.Fragment>
|
|
19
|
+
<SecondaryKeypadButton
|
|
20
|
+
keyConfig={Keys.NEQ}
|
|
21
|
+
onClickKey={onClickKey}
|
|
22
|
+
/>
|
|
23
|
+
<SecondaryKeypadButton
|
|
24
|
+
keyConfig={Keys.LEQ}
|
|
25
|
+
onClickKey={onClickKey}
|
|
26
|
+
/>
|
|
27
|
+
<SecondaryKeypadButton
|
|
28
|
+
keyConfig={Keys.GEQ}
|
|
29
|
+
onClickKey={onClickKey}
|
|
30
|
+
/>
|
|
31
|
+
</React.Fragment>
|
|
32
|
+
);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import Keys from "../../../data/key-configs";
|
|
4
|
+
import {PlaceHolderButtons, SecondaryKeypadButton} from "../keypad-page-items";
|
|
5
|
+
|
|
6
|
+
type Props = {
|
|
7
|
+
onClickKey: (keyConfig: string) => void;
|
|
8
|
+
placeholder?: boolean;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const BasicRelations = ({
|
|
12
|
+
onClickKey,
|
|
13
|
+
placeholder,
|
|
14
|
+
}: Props): React.ReactElement =>
|
|
15
|
+
placeholder ? (
|
|
16
|
+
<PlaceHolderButtons count={3} />
|
|
17
|
+
) : (
|
|
18
|
+
<React.Fragment>
|
|
19
|
+
<SecondaryKeypadButton
|
|
20
|
+
keyConfig={Keys.EQUAL}
|
|
21
|
+
onClickKey={onClickKey}
|
|
22
|
+
/>
|
|
23
|
+
<SecondaryKeypadButton
|
|
24
|
+
keyConfig={Keys.LT}
|
|
25
|
+
onClickKey={onClickKey}
|
|
26
|
+
/>
|
|
27
|
+
<SecondaryKeypadButton
|
|
28
|
+
keyConfig={Keys.GT}
|
|
29
|
+
onClickKey={onClickKey}
|
|
30
|
+
/>
|
|
31
|
+
</React.Fragment>
|
|
32
|
+
);
|