@khanacademy/math-input 2.0.0 → 3.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 +20 -0
- package/dist/components/input/math-input.d.ts +1 -1
- package/dist/components/input/math-input.js.flow +1 -1
- 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 +8 -2
- package/dist/components/keypad/keypad-page-items.js.flow +8 -2
- 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} +1 -1
- package/dist/components/{gesture-manager.js.flow → keypad-legacy/gesture-manager.js.flow} +1 -1
- package/dist/components/{gesture-state-machine.d.ts → keypad-legacy/gesture-state-machine.d.ts} +1 -1
- package/dist/components/{gesture-state-machine.js.flow → keypad-legacy/gesture-state-machine.js.flow} +1 -1
- 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} +4 -4
- package/dist/components/{keypad-button.js.flow → keypad-legacy/keypad-button.js.flow} +4 -4
- 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 +4 -5
- package/dist/{store → components/keypad-legacy/store}/actions.js.flow +5 -8
- 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 +4 -14
- package/dist/{store → components/keypad-legacy/store}/types.js.flow +4 -14
- package/dist/components/keypad-legacy/touchable-keypad-button.d.ts +37 -0
- package/dist/components/keypad-legacy/touchable-keypad-button.js.flow +64 -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 +3 -1
- package/dist/data/key-configs.js.flow +3 -1
- package/dist/data/keys.d.ts +1 -3
- package/dist/data/keys.js.flow +0 -2
- package/dist/es/index.js +4991 -4299
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +4784 -4073
- package/dist/index.js.flow +2 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +13 -9
- package/dist/types.js.flow +19 -15
- package/package.json +1 -1
- package/src/components/input/math-input.tsx +1 -1
- package/src/components/keypad/button-assets.tsx +65 -40
- 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} +3 -4
- package/src/components/keypad/index.tsx +19 -14
- package/src/components/keypad/keypad-page-items.tsx +34 -21
- 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} +25 -29
- 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} +7 -20
- package/src/components/{empty-keypad-button.tsx → keypad-legacy/empty-keypad-button.tsx} +2 -2
- 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} +2 -2
- package/src/components/{gesture-state-machine.ts → keypad-legacy/gesture-state-machine.ts} +1 -1
- package/src/components/{icon.tsx → keypad-legacy/icon.tsx} +3 -3
- package/src/components/{keypad-button.tsx → keypad-legacy/keypad-button.tsx} +12 -9
- 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} +5 -5
- 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 +5 -8
- package/src/{store → components/keypad-legacy/store}/echo-reducer.ts +2 -3
- package/src/{store → components/keypad-legacy/store}/index.ts +4 -11
- package/src/{store → components/keypad-legacy/store}/input-reducer.ts +4 -4
- package/src/{store → components/keypad-legacy/store}/keypad-reducer.ts +2 -2
- 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 +14 -18
- 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} +39 -20
- package/src/components/{two-page-keypad.tsx → keypad-legacy/two-page-keypad.tsx} +5 -6
- package/src/data/key-configs.ts +10 -15
- package/src/data/keys.ts +1 -6
- package/src/index.ts +3 -1
- package/src/math-input.stories.tsx +2 -2
- package/src/types.ts +15 -8
- 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
package/dist/types.d.ts
CHANGED
|
@@ -2,14 +2,14 @@ import Keys from "./data/keys";
|
|
|
2
2
|
import { BorderDirection, EchoAnimationType, IconType, KeyType, KeypadType } from "./enums";
|
|
3
3
|
import type { CursorContext } from "./components/input/cursor-contexts";
|
|
4
4
|
export type Border = Partial<ReadonlyArray<BorderDirection>>;
|
|
5
|
-
export
|
|
5
|
+
export interface Bound {
|
|
6
6
|
top: number;
|
|
7
7
|
right: number;
|
|
8
8
|
bottom: number;
|
|
9
9
|
left: number;
|
|
10
10
|
height: number;
|
|
11
11
|
width: number;
|
|
12
|
-
}
|
|
12
|
+
}
|
|
13
13
|
export type Popover = {
|
|
14
14
|
parentId: Keys;
|
|
15
15
|
bounds: Partial<Bound>;
|
|
@@ -18,21 +18,26 @@ export type Popover = {
|
|
|
18
18
|
export type Echo = {
|
|
19
19
|
animationId: string;
|
|
20
20
|
animationType: EchoAnimationType;
|
|
21
|
-
borders: Border;
|
|
22
21
|
id: Keys;
|
|
23
|
-
initialBounds:
|
|
22
|
+
initialBounds: Bound;
|
|
24
23
|
};
|
|
25
24
|
export type IconConfig = {
|
|
26
25
|
type: IconType;
|
|
27
26
|
data: string;
|
|
28
27
|
};
|
|
29
|
-
export type
|
|
30
|
-
ariaLabel: string;
|
|
28
|
+
export type NonManyKeyConfig = {
|
|
31
29
|
id: Keys;
|
|
32
30
|
type: KeyType;
|
|
33
|
-
childKeyIds: Array<Keys>;
|
|
34
31
|
icon: IconConfig;
|
|
32
|
+
ariaLabel: string;
|
|
33
|
+
};
|
|
34
|
+
export type ManyKeyConfig = {
|
|
35
|
+
id: "MANY";
|
|
36
|
+
type: KeyType.MANY;
|
|
37
|
+
childKeyIds: ReadonlyArray<string>;
|
|
38
|
+
ariaLabel?: string;
|
|
35
39
|
};
|
|
40
|
+
export type KeyConfig = NonManyKeyConfig | ManyKeyConfig;
|
|
36
41
|
export type KeypadConfiguration = {
|
|
37
42
|
keypadType: KeypadType;
|
|
38
43
|
extraKeys?: ReadonlyArray<Keys>;
|
|
@@ -56,7 +61,6 @@ export type ActiveNodesObj = {
|
|
|
56
61
|
focus: string | null;
|
|
57
62
|
};
|
|
58
63
|
export type LayoutProps = {
|
|
59
|
-
initialBounds:
|
|
60
|
-
borders: Border;
|
|
64
|
+
initialBounds: Bound;
|
|
61
65
|
};
|
|
62
66
|
export {};
|
package/dist/types.js.flow
CHANGED
|
@@ -14,14 +14,14 @@ import {
|
|
|
14
14
|
} from "./enums";
|
|
15
15
|
import type { CursorContext } from "./components/input/cursor-contexts";
|
|
16
16
|
export type Border = $Rest<$ReadOnlyArray<BorderDirection>, {}>;
|
|
17
|
-
export
|
|
18
|
-
top: number
|
|
19
|
-
right: number
|
|
20
|
-
bottom: number
|
|
21
|
-
left: number
|
|
22
|
-
height: number
|
|
23
|
-
width: number
|
|
24
|
-
|
|
17
|
+
export interface Bound {
|
|
18
|
+
top: number;
|
|
19
|
+
right: number;
|
|
20
|
+
bottom: number;
|
|
21
|
+
left: number;
|
|
22
|
+
height: number;
|
|
23
|
+
width: number;
|
|
24
|
+
}
|
|
25
25
|
export type Popover = {|
|
|
26
26
|
parentId: Keys,
|
|
27
27
|
bounds: $Rest<Bound, {}>,
|
|
@@ -30,21 +30,26 @@ export type Popover = {|
|
|
|
30
30
|
export type Echo = {|
|
|
31
31
|
animationId: string,
|
|
32
32
|
animationType: EchoAnimationType,
|
|
33
|
-
borders: Border,
|
|
34
33
|
id: Keys,
|
|
35
|
-
initialBounds:
|
|
34
|
+
initialBounds: Bound,
|
|
36
35
|
|};
|
|
37
36
|
export type IconConfig = {|
|
|
38
37
|
type: IconType,
|
|
39
38
|
data: string,
|
|
40
39
|
|};
|
|
41
|
-
export type
|
|
42
|
-
ariaLabel: string,
|
|
40
|
+
export type NonManyKeyConfig = {|
|
|
43
41
|
id: Keys,
|
|
44
42
|
type: KeyType,
|
|
45
|
-
childKeyIds: Array<Keys>,
|
|
46
43
|
icon: IconConfig,
|
|
44
|
+
ariaLabel: string,
|
|
45
|
+
|};
|
|
46
|
+
export type ManyKeyConfig = {|
|
|
47
|
+
id: "MANY",
|
|
48
|
+
type: KeyType.MANY,
|
|
49
|
+
childKeyIds: $ReadOnlyArray<string>,
|
|
50
|
+
ariaLabel?: string,
|
|
47
51
|
|};
|
|
52
|
+
export type KeyConfig = NonManyKeyConfig | ManyKeyConfig;
|
|
48
53
|
export type KeypadConfiguration = {|
|
|
49
54
|
keypadType: KeypadType,
|
|
50
55
|
extraKeys?: $ReadOnlyArray<Keys>,
|
|
@@ -68,6 +73,5 @@ export type ActiveNodesObj = {|
|
|
|
68
73
|
focus: string | null,
|
|
69
74
|
|};
|
|
70
75
|
export type LayoutProps = {|
|
|
71
|
-
initialBounds:
|
|
72
|
-
borders: Border,
|
|
76
|
+
initialBounds: Bound,
|
|
73
77
|
|};
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
wonderBlocksBlue,
|
|
14
14
|
offBlack,
|
|
15
15
|
} from "../common-style";
|
|
16
|
-
import ProvidedKeypad from "../provided-keypad";
|
|
16
|
+
import ProvidedKeypad from "../keypad-legacy/provided-keypad";
|
|
17
17
|
|
|
18
18
|
import CursorHandle from "./cursor-handle";
|
|
19
19
|
import DragListener from "./drag-listener";
|
|
@@ -181,9 +181,9 @@ export default function ButtonAsset({id}: Props): React.ReactElement {
|
|
|
181
181
|
<path
|
|
182
182
|
d="M22 10C17 16 17 24 22 30"
|
|
183
183
|
stroke="#21242C"
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
184
|
+
strokeWidth="2"
|
|
185
|
+
strokeLinecap="round"
|
|
186
|
+
strokeLinejoin="round"
|
|
187
187
|
/>
|
|
188
188
|
</svg>
|
|
189
189
|
);
|
|
@@ -199,9 +199,9 @@ export default function ButtonAsset({id}: Props): React.ReactElement {
|
|
|
199
199
|
<path
|
|
200
200
|
d="M19 10C24 16 24 24 19 30"
|
|
201
201
|
stroke="#21242C"
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
202
|
+
strokeWidth="2"
|
|
203
|
+
strokeLinecap="round"
|
|
204
|
+
strokeLinejoin="round"
|
|
205
205
|
/>
|
|
206
206
|
</svg>
|
|
207
207
|
);
|
|
@@ -217,9 +217,9 @@ export default function ButtonAsset({id}: Props): React.ReactElement {
|
|
|
217
217
|
<path
|
|
218
218
|
d="M27 20H13"
|
|
219
219
|
stroke="#21242C"
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
220
|
+
strokeWidth="2"
|
|
221
|
+
strokeLinecap="round"
|
|
222
|
+
strokeLinejoin="round"
|
|
223
223
|
/>
|
|
224
224
|
</svg>
|
|
225
225
|
);
|
|
@@ -235,16 +235,16 @@ export default function ButtonAsset({id}: Props): React.ReactElement {
|
|
|
235
235
|
<path
|
|
236
236
|
d="M27 20H13"
|
|
237
237
|
stroke="#21242C"
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
238
|
+
strokeWidth="2"
|
|
239
|
+
strokeLinecap="round"
|
|
240
|
+
strokeLinejoin="round"
|
|
241
241
|
/>
|
|
242
242
|
<path
|
|
243
243
|
d="M20 13V27"
|
|
244
244
|
stroke="#21242C"
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
245
|
+
strokeWidth="2"
|
|
246
|
+
strokeLinecap="round"
|
|
247
|
+
strokeLinejoin="round"
|
|
248
248
|
/>
|
|
249
249
|
</svg>
|
|
250
250
|
);
|
|
@@ -260,16 +260,16 @@ export default function ButtonAsset({id}: Props): React.ReactElement {
|
|
|
260
260
|
<path
|
|
261
261
|
d="M24.9498 24.9493L15.0503 15.0498"
|
|
262
262
|
stroke="#21242C"
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
263
|
+
strokeWidth="2"
|
|
264
|
+
strokeLinecap="round"
|
|
265
|
+
strokeLinejoin="round"
|
|
266
266
|
/>
|
|
267
267
|
<path
|
|
268
268
|
d="M24.9498 15.0507L15.0503 24.9502"
|
|
269
269
|
stroke="#21242C"
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
270
|
+
strokeWidth="2"
|
|
271
|
+
strokeLinecap="round"
|
|
272
|
+
strokeLinejoin="round"
|
|
273
273
|
/>
|
|
274
274
|
</svg>
|
|
275
275
|
);
|
|
@@ -284,8 +284,8 @@ export default function ButtonAsset({id}: Props): React.ReactElement {
|
|
|
284
284
|
xmlns="http://www.w3.org/2000/svg"
|
|
285
285
|
>
|
|
286
286
|
<path
|
|
287
|
-
|
|
288
|
-
|
|
287
|
+
fillRule="evenodd"
|
|
288
|
+
clipRule="evenodd"
|
|
289
289
|
d="M10 20L16 14H28.1716V26L16 26L10 20ZM8.58579 18.5858L14.5858 12.5858C14.9609 12.2107 15.4696 12 16 12H28.1716C29.2761 12 30.1716 12.8954 30.1716 14V26C30.1716 27.1046 29.2761 28 28.1716 28H16C15.4696 28 14.9609 27.7893 14.5858 27.4142L8.58579 21.4142C7.80474 20.6332 7.80474 19.3668 8.58579 18.5858ZM22.4645 17.2929L21.1716 18.5858L19.8787 17.2929C19.4882 16.9024 18.855 16.9024 18.4645 17.2929C18.074 17.6834 18.074 18.3166 18.4645 18.7071L19.7574 20L18.4645 21.2929C18.074 21.6834 18.074 22.3166 18.4645 22.7071C18.855 23.0976 19.4882 23.0976 19.8787 22.7071L21.1716 21.4142L22.4645 22.7071C22.855 23.0976 23.4882 23.0976 23.8787 22.7071C24.2693 22.3166 24.2693 21.6834 23.8787 21.2929L22.5858 20L23.8787 18.7071C24.2693 18.3166 24.2693 17.6834 23.8787 17.2929C23.4882 16.9024 22.855 16.9024 22.4645 17.2929Z"
|
|
290
290
|
fill="#21242C"
|
|
291
291
|
/>
|
|
@@ -301,8 +301,8 @@ export default function ButtonAsset({id}: Props): React.ReactElement {
|
|
|
301
301
|
xmlns="http://www.w3.org/2000/svg"
|
|
302
302
|
>
|
|
303
303
|
<path
|
|
304
|
-
|
|
305
|
-
|
|
304
|
+
fillRule="evenodd"
|
|
305
|
+
clipRule="evenodd"
|
|
306
306
|
d="M10 12C10 10.8954 10.8954 10 12 10H28C29.1046 10 30 10.8954 30 12V21H28V12L12 12V21H10V12ZM19 14C19 13.4477 19.4477 13 20 13C20.5523 13 21 13.4477 21 14C21 14.5523 20.5523 15 20 15C19.4477 15 19 14.5523 19 14ZM17 13C16.4477 13 16 13.4477 16 14C16 14.5523 16.4477 15 17 15C17.5523 15 18 14.5523 18 14C18 13.4477 17.5523 13 17 13ZM13 14C13 13.4477 13.4477 13 14 13C14.5523 13 15 13.4477 15 14C15 14.5523 14.5523 15 14 15C13.4477 15 13 14.5523 13 14ZM20 16C19.4477 16 19 16.4477 19 17C19 17.5523 19.4477 18 20 18C20.5523 18 21 17.5523 21 17C21 16.4477 20.5523 16 20 16ZM16 17C16 16.4477 16.4477 16 17 16C17.5523 16 18 16.4477 18 17C18 17.5523 17.5523 18 17 18C16.4477 18 16 17.5523 16 17ZM14 16C13.4477 16 13 16.4477 13 17C13 17.5523 13.4477 18 14 18C14.5523 18 15 17.5523 15 17C15 16.4477 14.5523 16 14 16ZM22 14C22 13.4477 22.4477 13 23 13C23.5523 13 24 13.4477 24 14C24 14.5523 23.5523 15 23 15C22.4477 15 22 14.5523 22 14ZM23 16C22.4477 16 22 16.4477 22 17C22 17.5523 22.4477 18 23 18C23.5523 18 24 17.5523 24 17C24 16.4477 23.5523 16 23 16ZM25 14C25 13.4477 25.4477 13 26 13C26.5523 13 27 13.4477 27 14C27 14.5523 26.5523 15 26 15C25.4477 15 25 14.5523 25 14ZM26 16C25.4477 16 25 16.4477 25 17C25 17.5523 25.4477 18 26 18C26.5523 18 27 17.5523 27 17C27 16.4477 26.5523 16 26 16ZM16 20C16 19.4477 16.4477 19 17 19H23C23.5523 19 24 19.4477 24 20C24 20.5523 23.5523 21 23 21H17C16.4477 21 16 20.5523 16 20ZM26.7071 25.7071C27.0976 25.3166 27.0976 24.6834 26.7071 24.2929C26.3166 23.9024 25.6834 23.9024 25.2929 24.2929L20 29.5858L14.7071 24.2929C14.3166 23.9024 13.6834 23.9024 13.2929 24.2929C12.9024 24.6834 12.9024 25.3166 13.2929 25.7071L19.2929 31.7071C19.6834 32.0976 20.3166 32.0976 20.7071 31.7071L26.7071 25.7071Z"
|
|
307
307
|
fill="#21242C"
|
|
308
308
|
/>
|
|
@@ -318,8 +318,8 @@ export default function ButtonAsset({id}: Props): React.ReactElement {
|
|
|
318
318
|
xmlns="http://www.w3.org/2000/svg"
|
|
319
319
|
>
|
|
320
320
|
<path
|
|
321
|
-
|
|
322
|
-
|
|
321
|
+
fillRule="evenodd"
|
|
322
|
+
clipRule="evenodd"
|
|
323
323
|
d="M16 10C16 9.44772 16.4477 9 17 9H23C23.5523 9 24 9.44772 24 10V16C24 16.5523 23.5523 17 23 17H17C16.4477 17 16 16.5523 16 16V10ZM18 11H22V15H18V11ZM14 20C14 19.4477 14.4477 19 15 19H25C25.5523 19 26 19.4477 26 20C26 20.5523 25.5523 21 25 21H15C14.4477 21 14 20.5523 14 20ZM17 23C16.4477 23 16 23.4477 16 24V30C16 30.5523 16.4477 31 17 31H23C23.5523 31 24 30.5523 24 30V24C24 23.4477 23.5523 23 23 23H17ZM22 25H18V29H22V25Z"
|
|
324
324
|
fill="#21242C"
|
|
325
325
|
/>
|
|
@@ -335,8 +335,8 @@ export default function ButtonAsset({id}: Props): React.ReactElement {
|
|
|
335
335
|
xmlns="http://www.w3.org/2000/svg"
|
|
336
336
|
>
|
|
337
337
|
<path
|
|
338
|
-
|
|
339
|
-
|
|
338
|
+
fillRule="evenodd"
|
|
339
|
+
clipRule="evenodd"
|
|
340
340
|
d="M12.9571 13.2929C13.3476 13.6834 13.3476 14.3166 12.9571 14.7071C11.6871 15.9771 11 17.9485 11 20C11 22.0515 11.6871 24.0229 12.9571 25.2929C13.3476 25.6834 13.3476 26.3166 12.9571 26.7071C12.5666 27.0976 11.9334 27.0976 11.5429 26.7071C9.81292 24.9771 9 22.4485 9 20C9 17.5515 9.81292 15.0229 11.5429 13.2929C11.9334 12.9024 12.5666 12.9024 12.9571 13.2929ZM14 20C14 19.4477 14.4477 19 15 19H25C25.5523 19 26 19.4477 26 20C26 20.5523 25.5523 21 25 21H15C14.4477 21 14 20.5523 14 20ZM28.4571 13.2929C28.0666 12.9024 27.4334 12.9024 27.0429 13.2929C26.6524 13.6834 26.6524 14.3166 27.0429 14.7071C28.3129 15.9771 29 17.9485 29 20C29 22.0515 28.3129 24.0229 27.0429 25.2929C26.6524 25.6834 26.6524 26.3166 27.0429 26.7071C27.4334 27.0976 28.0666 27.0976 28.4571 26.7071C30.1871 24.9771 31 22.4485 31 20C31 17.5515 30.1871 15.0229 28.4571 13.2929Z"
|
|
341
341
|
fill="#21242C"
|
|
342
342
|
/>
|
|
@@ -351,7 +351,7 @@ export default function ButtonAsset({id}: Props): React.ReactElement {
|
|
|
351
351
|
fill="none"
|
|
352
352
|
xmlns="http://www.w3.org/2000/svg"
|
|
353
353
|
>
|
|
354
|
-
<g
|
|
354
|
+
<g clipPath="url(#clip0)">
|
|
355
355
|
<circle cx="20" cy="20" r="1.5" fill="#21242C" />
|
|
356
356
|
</g>
|
|
357
357
|
<defs>
|
|
@@ -374,8 +374,8 @@ export default function ButtonAsset({id}: Props): React.ReactElement {
|
|
|
374
374
|
xmlns="http://www.w3.org/2000/svg"
|
|
375
375
|
>
|
|
376
376
|
<path
|
|
377
|
-
|
|
378
|
-
|
|
377
|
+
fillRule="evenodd"
|
|
378
|
+
clipRule="evenodd"
|
|
379
379
|
d="M9.00012 9C9.00012 8.44772 9.44784 8 10.0001 8H16.0001C16.5524 8 17.0001 8.44772 17.0001 9V15C17.0001 15.5523 16.5524 16 16.0001 16H10.0001C9.44784 16 9.00012 15.5523 9.00012 15V9ZM11.0001 10H15.0001V14H11.0001V10ZM23.0001 12C22.6598 12 22.3429 12.173 22.1589 12.4592L13.9849 25.1744L10.8322 20.4453C10.5258 19.9858 9.90493 19.8616 9.44541 20.1679C8.98588 20.4743 8.8617 21.0952 9.16806 21.5547L13.1681 27.5547C13.3552 27.8354 13.6711 28.0028 14.0084 28C14.3457 27.9972 14.6589 27.8245 14.8413 27.5408L23.5461 14H30.0001C30.5524 14 31.0001 13.5523 31.0001 13C31.0001 12.4477 30.5524 12 30.0001 12H23.0001Z"
|
|
380
380
|
fill="#21242C"
|
|
381
381
|
/>
|
|
@@ -393,9 +393,9 @@ export default function ButtonAsset({id}: Props): React.ReactElement {
|
|
|
393
393
|
<path
|
|
394
394
|
d="M10 21L14 27L23 13H30"
|
|
395
395
|
stroke="#21242C"
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
396
|
+
strokeWidth="2"
|
|
397
|
+
strokeLinecap="round"
|
|
398
|
+
strokeLinejoin="round"
|
|
399
399
|
/>
|
|
400
400
|
</svg>
|
|
401
401
|
);
|
|
@@ -409,8 +409,8 @@ export default function ButtonAsset({id}: Props): React.ReactElement {
|
|
|
409
409
|
xmlns="http://www.w3.org/2000/svg"
|
|
410
410
|
>
|
|
411
411
|
<path
|
|
412
|
-
|
|
413
|
-
|
|
412
|
+
fillRule="evenodd"
|
|
413
|
+
clipRule="evenodd"
|
|
414
414
|
d="M33.5791 13.7461C33.4874 13.6545 33.3591 13.6086 33.1941 13.6086H31.4011C31.2397 13.6086 31.0674 13.6251 30.8841 13.6581C30.7007 13.6875 30.5156 13.7296 30.3286 13.7846L32.0226 12.0521C32.2352 11.8358 32.4369 11.6213 32.6276 11.4086C32.8182 11.196 32.9851 10.9778 33.1281 10.7541C33.2747 10.5268 33.3902 10.2885 33.4746 10.0391C33.5589 9.78981 33.6011 9.51847 33.6011 9.22514C33.6011 8.88414 33.5406 8.57247 33.4196 8.29014C33.2986 8.00781 33.1281 7.76764 32.9081 7.56964C32.6881 7.36797 32.4222 7.21214 32.1106 7.10214C31.8026 6.98847 31.4597 6.93164 31.0821 6.93164C30.7227 6.93164 30.3872 6.98114 30.0756 7.08014C29.7639 7.17547 29.4871 7.32031 29.2451 7.51464C29.0031 7.70897 28.8014 7.95281 28.6401 8.24614C28.4787 8.53947 28.3687 8.88047 28.3101 9.26914L29.1131 9.41214C29.3184 9.44514 29.4761 9.43231 29.5861 9.37364C29.6997 9.31131 29.7896 9.18847 29.8556 9.00514C29.8886 8.88781 29.9399 8.77964 30.0096 8.68064C30.0792 8.58164 30.1617 8.49547 30.2571 8.42214C30.3561 8.34881 30.4661 8.29197 30.5871 8.25164C30.7117 8.20764 30.8474 8.18564 30.9941 8.18564C31.3277 8.18564 31.5862 8.27914 31.7696 8.46614C31.9529 8.64947 32.0446 8.91897 32.0446 9.27464C32.0446 9.47631 32.0189 9.66881 31.9676 9.85214C31.9162 10.0355 31.8392 10.217 31.7366 10.3966C31.6339 10.5726 31.5056 10.7541 31.3516 10.9411C31.1976 11.1245 31.0197 11.317 30.8181 11.5186L28.4531 13.8891C28.3577 13.9808 28.2899 14.0835 28.2496 14.1971C28.2092 14.3071 28.1891 14.4098 28.1891 14.5051V15.0001H33.7221V14.1091C33.7221 13.9588 33.6744 13.8378 33.5791 13.7461ZM14 13.0001C14 12.4479 14.4477 12.0001 15 12.0001H25C25.5523 12.0001 26 12.4479 26 13.0001V27.0001C26 27.5524 25.5523 28.0001 25 28.0001H15C14.4477 28.0001 14 27.5524 14 27.0001V13.0001ZM16 14.0001H24V26.0001H16V14.0001Z"
|
|
415
415
|
fill="#21242C"
|
|
416
416
|
/>
|
|
@@ -426,8 +426,8 @@ export default function ButtonAsset({id}: Props): React.ReactElement {
|
|
|
426
426
|
xmlns="http://www.w3.org/2000/svg"
|
|
427
427
|
>
|
|
428
428
|
<path
|
|
429
|
-
|
|
430
|
-
|
|
429
|
+
fillRule="evenodd"
|
|
430
|
+
clipRule="evenodd"
|
|
431
431
|
d="M28 8C28 7.44772 28.4477 7 29 7H35C35.5523 7 36 7.44772 36 8V14C36 14.5523 35.5523 15 35 15H29C28.4477 15 28 14.5523 28 14V8ZM30 9H34V13H30V9ZM14 13C14 12.4477 14.4477 12 15 12H25C25.5523 12 26 12.4477 26 13V27C26 27.5523 25.5523 28 25 28H15C14.4477 28 14 27.5523 14 27V13ZM16 14H24V26H16V14Z"
|
|
432
432
|
fill="#21242C"
|
|
433
433
|
/>
|
|
@@ -487,6 +487,31 @@ export default function ButtonAsset({id}: Props): React.ReactElement {
|
|
|
487
487
|
);
|
|
488
488
|
|
|
489
489
|
default:
|
|
490
|
-
|
|
490
|
+
// placeholder
|
|
491
|
+
return (
|
|
492
|
+
<svg
|
|
493
|
+
width="40"
|
|
494
|
+
height="40"
|
|
495
|
+
viewBox="0 0 40 40"
|
|
496
|
+
fill="black"
|
|
497
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
498
|
+
>
|
|
499
|
+
<text
|
|
500
|
+
y="20"
|
|
501
|
+
textLength="100%"
|
|
502
|
+
lengthAdjust="spacingAndGlyphs"
|
|
503
|
+
>
|
|
504
|
+
{id}
|
|
505
|
+
</text>
|
|
506
|
+
<text
|
|
507
|
+
y="35"
|
|
508
|
+
textLength="100%"
|
|
509
|
+
lengthAdjust="spacingAndGlyphs"
|
|
510
|
+
fill="red"
|
|
511
|
+
>
|
|
512
|
+
placeholder
|
|
513
|
+
</text>
|
|
514
|
+
</svg>
|
|
515
|
+
);
|
|
491
516
|
}
|
|
492
517
|
}
|
|
@@ -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 (
|
|
@@ -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
|
);
|
|
@@ -29,7 +29,7 @@ export const KeypadPageContainer = ({
|
|
|
29
29
|
</View>
|
|
30
30
|
);
|
|
31
31
|
|
|
32
|
-
type KeypadButtonProps = {
|
|
32
|
+
export type KeypadButtonProps = {
|
|
33
33
|
keyConfig: KeyConfig;
|
|
34
34
|
tintColor?: string;
|
|
35
35
|
style?: StyleType;
|
|
@@ -89,24 +89,37 @@ export const KeypadActionButton = ({
|
|
|
89
89
|
/>
|
|
90
90
|
);
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
>
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
92
|
+
/**
|
|
93
|
+
* A placeholder button for the keypad. Optional count prop to render multiple
|
|
94
|
+
* buttons. Defaults to 1.
|
|
95
|
+
*/
|
|
96
|
+
export const PlaceHolderButtons = ({
|
|
97
|
+
count = 1,
|
|
98
|
+
}: {
|
|
99
|
+
count?: number;
|
|
100
|
+
}): React.ReactElement => (
|
|
101
|
+
<React.Fragment>
|
|
102
|
+
{Array.from({length: count}).map((_, index) => (
|
|
103
|
+
<View
|
|
104
|
+
key={index}
|
|
105
|
+
style={{
|
|
106
|
+
height: "100%",
|
|
107
|
+
width: "100%",
|
|
108
|
+
boxSizing: "border-box",
|
|
109
|
+
borderRadius: 7,
|
|
110
|
+
border: "4px solid transparent",
|
|
111
|
+
}}
|
|
112
|
+
>
|
|
113
|
+
<View
|
|
114
|
+
style={{
|
|
115
|
+
background: "rgba(33, 36, 44, 0.04)",
|
|
116
|
+
width: "100%",
|
|
117
|
+
height: "100%",
|
|
118
|
+
borderRadius: 4,
|
|
119
|
+
border: `1px solid transparent`,
|
|
120
|
+
}}
|
|
121
|
+
/>
|
|
122
|
+
</View>
|
|
123
|
+
))}
|
|
124
|
+
</React.Fragment>
|
|
112
125
|
);
|
|
@@ -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
|
);
|