@khanacademy/math-input 4.2.0 → 4.3.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 +6 -0
- package/dist/components/input/mathquill-types.d.ts +2 -0
- package/dist/components/input/mathquill-types.js.flow +2 -0
- package/dist/components/keypad/index.d.ts +8 -16
- package/dist/components/keypad/index.js.flow +10 -22
- package/dist/components/keypad/keypad-button.d.ts +12 -0
- package/dist/components/keypad/keypad-button.js.flow +18 -0
- package/dist/components/keypad/keypad-pages/extras-page.d.ts +9 -0
- package/dist/components/keypad/{operators-page/basic-relations-buttons.js.flow → keypad-pages/extras-page.js.flow} +3 -3
- package/dist/components/keypad/keypad-pages/geometry-page.d.ts +7 -0
- package/dist/components/keypad/{operators-page/logarithms-buttons.js.flow → keypad-pages/geometry-page.js.flow} +1 -3
- package/dist/components/keypad/keypad-pages/numbers-page.d.ts +7 -0
- package/dist/components/keypad/{operators-page/pre-algebra-buttons.js.flow → keypad-pages/numbers-page.js.flow} +1 -3
- package/dist/components/keypad/keypad-pages/operators-page.d.ts +11 -0
- package/dist/components/keypad/{operators-page/advanced-relations-buttons.js.flow → keypad-pages/operators-page.js.flow} +5 -3
- package/dist/components/keypad/shared-keys.d.ts +9 -0
- package/dist/components/keypad/{numbers-page/types.js.flow → shared-keys.js.flow} +4 -1
- package/dist/es/index.js +321 -465
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +319 -488
- package/dist/index.js.map +1 -1
- package/package.json +2 -3
- package/src/components/input/__tests__/test-math-wrapper.ts +2 -5
- package/src/components/input/mathquill-types.ts +6 -0
- package/src/components/keypad/__tests__/keypad-button.test.tsx +4 -2
- package/src/components/keypad/index.tsx +73 -49
- package/src/components/keypad/{button.stories.tsx → keypad-button.stories.tsx} +2 -1
- package/src/components/keypad/keypad-button.tsx +128 -0
- package/src/components/keypad/keypad-mathquill.stories.tsx +9 -3
- package/src/components/keypad/keypad-pages/extras-page.tsx +34 -0
- package/src/components/keypad/keypad-pages/geometry-page.tsx +33 -0
- package/src/components/keypad/keypad-pages/numbers-page.tsx +84 -0
- package/src/components/keypad/keypad-pages/operators-page.tsx +116 -0
- package/src/components/keypad/shared-keys.tsx +78 -0
- package/tsconfig-build.tsbuildinfo +1 -1
- package/dist/components/keypad/button.d.ts +0 -12
- package/dist/components/keypad/button.js.flow +0 -18
- package/dist/components/keypad/extras-page/index.d.ts +0 -10
- package/dist/components/keypad/extras-page/index.js.flow +0 -15
- package/dist/components/keypad/geometry-page/index.d.ts +0 -9
- package/dist/components/keypad/geometry-page/index.js.flow +0 -14
- package/dist/components/keypad/keypad-page-items.d.ts +0 -26
- package/dist/components/keypad/keypad-page-items.js.flow +0 -40
- package/dist/components/keypad/numbers-page/index.d.ts +0 -10
- package/dist/components/keypad/numbers-page/index.js.flow +0 -18
- package/dist/components/keypad/numbers-page/types.d.ts +0 -4
- package/dist/components/keypad/operators-page/advanced-relations-buttons.d.ts +0 -8
- package/dist/components/keypad/operators-page/basic-relations-buttons.d.ts +0 -8
- package/dist/components/keypad/operators-page/index.d.ts +0 -10
- package/dist/components/keypad/operators-page/index.js.flow +0 -18
- package/dist/components/keypad/operators-page/logarithms-buttons.d.ts +0 -8
- package/dist/components/keypad/operators-page/pre-algebra-buttons.d.ts +0 -8
- package/dist/components/keypad/operators-page/types.d.ts +0 -6
- package/dist/components/keypad/operators-page/types.js.flow +0 -12
- package/src/components/keypad/__tests__/Button.test.tsx +0 -51
- package/src/components/keypad/button.tsx +0 -108
- package/src/components/keypad/extras-page/index.tsx +0 -27
- package/src/components/keypad/geometry-page/index.tsx +0 -89
- package/src/components/keypad/keypad-page-items.tsx +0 -118
- package/src/components/keypad/numbers-page/index.tsx +0 -136
- package/src/components/keypad/numbers-page/types.ts +0 -4
- package/src/components/keypad/operators-page/advanced-relations-buttons.tsx +0 -33
- package/src/components/keypad/operators-page/basic-relations-buttons.tsx +0 -33
- package/src/components/keypad/operators-page/index.tsx +0 -94
- package/src/components/keypad/operators-page/logarithms-buttons.tsx +0 -33
- package/src/components/keypad/operators-page/pre-algebra-buttons.tsx +0 -37
- package/src/components/keypad/operators-page/types.ts +0 -6
- /package/src/components/keypad/{keypad-pages.stories.tsx → keypad-pages/keypad-pages.stories.tsx} +0 -0
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
|
|
3
|
-
import Keys from "../../../data/key-configs";
|
|
4
|
-
import {ClickKeyCallback} from "../../../types";
|
|
5
|
-
import {
|
|
6
|
-
KeypadPageContainer,
|
|
7
|
-
KeypadButton,
|
|
8
|
-
SecondaryKeypadButton,
|
|
9
|
-
KeypadActionButton,
|
|
10
|
-
} from "../keypad-page-items";
|
|
11
|
-
|
|
12
|
-
import {NumbersPageOptions} from "./types";
|
|
13
|
-
|
|
14
|
-
type Props = {
|
|
15
|
-
onClickKey: ClickKeyCallback;
|
|
16
|
-
} & NumbersPageOptions;
|
|
17
|
-
|
|
18
|
-
export default class NumbersPage extends React.Component<Props> {
|
|
19
|
-
render(): React.ReactNode {
|
|
20
|
-
const {onClickKey} = this.props;
|
|
21
|
-
return (
|
|
22
|
-
<KeypadPageContainer>
|
|
23
|
-
{/* Row 1 */}
|
|
24
|
-
<KeypadButton keyConfig={Keys.NUM_7} onClickKey={onClickKey} />
|
|
25
|
-
<KeypadButton keyConfig={Keys.NUM_8} onClickKey={onClickKey} />
|
|
26
|
-
<KeypadButton keyConfig={Keys.NUM_9} onClickKey={onClickKey} />
|
|
27
|
-
<SecondaryKeypadButton
|
|
28
|
-
keyConfig={Keys.DIVIDE}
|
|
29
|
-
style={
|
|
30
|
-
this.props.divisionKey
|
|
31
|
-
? {
|
|
32
|
-
gridColumn: "4",
|
|
33
|
-
gridRow: "1",
|
|
34
|
-
}
|
|
35
|
-
: {
|
|
36
|
-
display: "none",
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
onClickKey={onClickKey}
|
|
40
|
-
/>
|
|
41
|
-
<SecondaryKeypadButton
|
|
42
|
-
keyConfig={
|
|
43
|
-
this.props.multiplicationDot ? Keys.CDOT : Keys.TIMES
|
|
44
|
-
}
|
|
45
|
-
style={
|
|
46
|
-
this.props.divisionKey && {
|
|
47
|
-
gridColumn: "4",
|
|
48
|
-
gridRow: "2",
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
onClickKey={onClickKey}
|
|
52
|
-
/>
|
|
53
|
-
<SecondaryKeypadButton
|
|
54
|
-
keyConfig={Keys.LEFT_PAREN}
|
|
55
|
-
onClickKey={onClickKey}
|
|
56
|
-
/>
|
|
57
|
-
<SecondaryKeypadButton
|
|
58
|
-
keyConfig={Keys.RIGHT_PAREN}
|
|
59
|
-
onClickKey={onClickKey}
|
|
60
|
-
/>
|
|
61
|
-
|
|
62
|
-
{/* Row 2 */}
|
|
63
|
-
<KeypadButton keyConfig={Keys.NUM_4} onClickKey={onClickKey} />
|
|
64
|
-
<KeypadButton keyConfig={Keys.NUM_5} onClickKey={onClickKey} />
|
|
65
|
-
<KeypadButton keyConfig={Keys.NUM_6} onClickKey={onClickKey} />
|
|
66
|
-
|
|
67
|
-
<SecondaryKeypadButton
|
|
68
|
-
keyConfig={Keys.MINUS}
|
|
69
|
-
style={
|
|
70
|
-
this.props.divisionKey && {
|
|
71
|
-
gridColumn: "4",
|
|
72
|
-
gridRow: "3",
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
onClickKey={onClickKey}
|
|
76
|
-
/>
|
|
77
|
-
|
|
78
|
-
<SecondaryKeypadButton
|
|
79
|
-
keyConfig={Keys.FRAC_INCLUSIVE}
|
|
80
|
-
onClickKey={onClickKey}
|
|
81
|
-
style={{
|
|
82
|
-
gridColumn: "5 / 7",
|
|
83
|
-
}}
|
|
84
|
-
/>
|
|
85
|
-
{/* Row 3 */}
|
|
86
|
-
<KeypadButton keyConfig={Keys.NUM_1} onClickKey={onClickKey} />
|
|
87
|
-
<KeypadButton keyConfig={Keys.NUM_2} onClickKey={onClickKey} />
|
|
88
|
-
<KeypadButton keyConfig={Keys.NUM_3} onClickKey={onClickKey} />
|
|
89
|
-
|
|
90
|
-
<SecondaryKeypadButton
|
|
91
|
-
keyConfig={Keys.PLUS}
|
|
92
|
-
style={
|
|
93
|
-
this.props.divisionKey
|
|
94
|
-
? {
|
|
95
|
-
gridColumn: "4",
|
|
96
|
-
gridRow: "4",
|
|
97
|
-
}
|
|
98
|
-
: {
|
|
99
|
-
gridColumn: "4",
|
|
100
|
-
gridRowStart: "3",
|
|
101
|
-
gridRowEnd: "5",
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
onClickKey={onClickKey}
|
|
105
|
-
/>
|
|
106
|
-
|
|
107
|
-
<KeypadActionButton
|
|
108
|
-
keyConfig={Keys.BACKSPACE}
|
|
109
|
-
style={{
|
|
110
|
-
gridColumn: "6",
|
|
111
|
-
}}
|
|
112
|
-
onClickKey={onClickKey}
|
|
113
|
-
/>
|
|
114
|
-
|
|
115
|
-
{/* Row 4 */}
|
|
116
|
-
<KeypadButton keyConfig={Keys.NUM_0} onClickKey={onClickKey} />
|
|
117
|
-
<KeypadButton
|
|
118
|
-
keyConfig={Keys.DECIMAL}
|
|
119
|
-
onClickKey={onClickKey}
|
|
120
|
-
/>
|
|
121
|
-
<KeypadButton
|
|
122
|
-
keyConfig={Keys.NEGATIVE}
|
|
123
|
-
onClickKey={onClickKey}
|
|
124
|
-
/>
|
|
125
|
-
|
|
126
|
-
<KeypadActionButton
|
|
127
|
-
keyConfig={Keys.DISMISS}
|
|
128
|
-
style={{
|
|
129
|
-
gridColumn: "6",
|
|
130
|
-
}}
|
|
131
|
-
onClickKey={onClickKey}
|
|
132
|
-
/>
|
|
133
|
-
</KeypadPageContainer>
|
|
134
|
-
);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
import Keys from "../../../data/key-configs";
|
|
4
|
-
import {ClickKeyCallback} from "../../../types";
|
|
5
|
-
import {PlaceHolderButtons, SecondaryKeypadButton} from "../keypad-page-items";
|
|
6
|
-
|
|
7
|
-
type Props = {
|
|
8
|
-
onClickKey: ClickKeyCallback;
|
|
9
|
-
placeholder?: boolean;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const AdvancedRelations = ({
|
|
13
|
-
onClickKey,
|
|
14
|
-
placeholder,
|
|
15
|
-
}: Props): React.ReactElement =>
|
|
16
|
-
placeholder ? (
|
|
17
|
-
<PlaceHolderButtons count={3} />
|
|
18
|
-
) : (
|
|
19
|
-
<React.Fragment>
|
|
20
|
-
<SecondaryKeypadButton
|
|
21
|
-
keyConfig={Keys.NEQ}
|
|
22
|
-
onClickKey={onClickKey}
|
|
23
|
-
/>
|
|
24
|
-
<SecondaryKeypadButton
|
|
25
|
-
keyConfig={Keys.LEQ}
|
|
26
|
-
onClickKey={onClickKey}
|
|
27
|
-
/>
|
|
28
|
-
<SecondaryKeypadButton
|
|
29
|
-
keyConfig={Keys.GEQ}
|
|
30
|
-
onClickKey={onClickKey}
|
|
31
|
-
/>
|
|
32
|
-
</React.Fragment>
|
|
33
|
-
);
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
import Keys from "../../../data/key-configs";
|
|
4
|
-
import {ClickKeyCallback} from "../../../types";
|
|
5
|
-
import {PlaceHolderButtons, SecondaryKeypadButton} from "../keypad-page-items";
|
|
6
|
-
|
|
7
|
-
type Props = {
|
|
8
|
-
onClickKey: ClickKeyCallback;
|
|
9
|
-
placeholder?: boolean;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const BasicRelations = ({
|
|
13
|
-
onClickKey,
|
|
14
|
-
placeholder,
|
|
15
|
-
}: Props): React.ReactElement =>
|
|
16
|
-
placeholder ? (
|
|
17
|
-
<PlaceHolderButtons count={3} />
|
|
18
|
-
) : (
|
|
19
|
-
<React.Fragment>
|
|
20
|
-
<SecondaryKeypadButton
|
|
21
|
-
keyConfig={Keys.EQUAL}
|
|
22
|
-
onClickKey={onClickKey}
|
|
23
|
-
/>
|
|
24
|
-
<SecondaryKeypadButton
|
|
25
|
-
keyConfig={Keys.LT}
|
|
26
|
-
onClickKey={onClickKey}
|
|
27
|
-
/>
|
|
28
|
-
<SecondaryKeypadButton
|
|
29
|
-
keyConfig={Keys.GT}
|
|
30
|
-
onClickKey={onClickKey}
|
|
31
|
-
/>
|
|
32
|
-
</React.Fragment>
|
|
33
|
-
);
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
|
|
3
|
-
import Keys from "../../../data/key-configs";
|
|
4
|
-
import {ClickKeyCallback} from "../../../types";
|
|
5
|
-
import {
|
|
6
|
-
KeypadPageContainer,
|
|
7
|
-
SecondaryKeypadButton,
|
|
8
|
-
KeypadActionButton,
|
|
9
|
-
} from "../keypad-page-items";
|
|
10
|
-
|
|
11
|
-
import {AdvancedRelations} from "./advanced-relations-buttons";
|
|
12
|
-
import {BasicRelations} from "./basic-relations-buttons";
|
|
13
|
-
import {Logarithms} from "./logarithms-buttons";
|
|
14
|
-
import {PreAlgebra} from "./pre-algebra-buttons";
|
|
15
|
-
import {OperatorsButtonSets} from "./types";
|
|
16
|
-
|
|
17
|
-
type Props = {
|
|
18
|
-
onClickKey: ClickKeyCallback;
|
|
19
|
-
} & OperatorsButtonSets;
|
|
20
|
-
|
|
21
|
-
export default class OperatorsPage extends React.Component<Props> {
|
|
22
|
-
render(): React.ReactNode {
|
|
23
|
-
const {onClickKey} = this.props;
|
|
24
|
-
return (
|
|
25
|
-
<KeypadPageContainer>
|
|
26
|
-
{/* Row 1 */}
|
|
27
|
-
<PreAlgebra
|
|
28
|
-
onClickKey={onClickKey}
|
|
29
|
-
placeholder={!this.props.preAlgebra}
|
|
30
|
-
/>
|
|
31
|
-
|
|
32
|
-
<SecondaryKeypadButton
|
|
33
|
-
keyConfig={Keys.LEFT_PAREN}
|
|
34
|
-
onClickKey={onClickKey}
|
|
35
|
-
/>
|
|
36
|
-
<SecondaryKeypadButton
|
|
37
|
-
keyConfig={Keys.RIGHT_PAREN}
|
|
38
|
-
onClickKey={onClickKey}
|
|
39
|
-
/>
|
|
40
|
-
{/* Row 2 */}
|
|
41
|
-
<Logarithms
|
|
42
|
-
onClickKey={onClickKey}
|
|
43
|
-
placeholder={!this.props.logarithms}
|
|
44
|
-
/>
|
|
45
|
-
<SecondaryKeypadButton
|
|
46
|
-
keyConfig={Keys.x}
|
|
47
|
-
onClickKey={onClickKey}
|
|
48
|
-
style={{
|
|
49
|
-
gridColumn: 5,
|
|
50
|
-
}}
|
|
51
|
-
/>
|
|
52
|
-
<SecondaryKeypadButton
|
|
53
|
-
keyConfig={Keys.FRAC_INCLUSIVE}
|
|
54
|
-
onClickKey={onClickKey}
|
|
55
|
-
style={{
|
|
56
|
-
gridColumn: 6,
|
|
57
|
-
}}
|
|
58
|
-
/>
|
|
59
|
-
{/* Row 3 */}
|
|
60
|
-
{/* TODO: implement relatons buttons */}
|
|
61
|
-
<BasicRelations
|
|
62
|
-
onClickKey={onClickKey}
|
|
63
|
-
placeholder={!this.props.basicRelations}
|
|
64
|
-
/>
|
|
65
|
-
<SecondaryKeypadButton
|
|
66
|
-
keyConfig={Keys.PI}
|
|
67
|
-
onClickKey={onClickKey}
|
|
68
|
-
style={{
|
|
69
|
-
gridColumn: 5,
|
|
70
|
-
}}
|
|
71
|
-
/>
|
|
72
|
-
<KeypadActionButton
|
|
73
|
-
keyConfig={Keys.BACKSPACE}
|
|
74
|
-
style={{
|
|
75
|
-
gridColumn: 6,
|
|
76
|
-
}}
|
|
77
|
-
onClickKey={onClickKey}
|
|
78
|
-
/>
|
|
79
|
-
{/* Row 4 */}
|
|
80
|
-
<AdvancedRelations
|
|
81
|
-
onClickKey={onClickKey}
|
|
82
|
-
placeholder={!this.props.advancedRelations}
|
|
83
|
-
/>
|
|
84
|
-
<KeypadActionButton
|
|
85
|
-
keyConfig={Keys.DISMISS}
|
|
86
|
-
style={{
|
|
87
|
-
gridColumn: "6",
|
|
88
|
-
}}
|
|
89
|
-
onClickKey={onClickKey}
|
|
90
|
-
/>
|
|
91
|
-
</KeypadPageContainer>
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
import Keys from "../../../data/key-configs";
|
|
4
|
-
import {ClickKeyCallback} from "../../../types";
|
|
5
|
-
import {PlaceHolderButtons, SecondaryKeypadButton} from "../keypad-page-items";
|
|
6
|
-
|
|
7
|
-
type Props = {
|
|
8
|
-
onClickKey: ClickKeyCallback;
|
|
9
|
-
placeholder?: boolean;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const Logarithms = ({
|
|
13
|
-
onClickKey,
|
|
14
|
-
placeholder,
|
|
15
|
-
}: Props): React.ReactElement =>
|
|
16
|
-
placeholder ? (
|
|
17
|
-
<PlaceHolderButtons count={3} />
|
|
18
|
-
) : (
|
|
19
|
-
<React.Fragment>
|
|
20
|
-
<SecondaryKeypadButton
|
|
21
|
-
keyConfig={Keys.LOG}
|
|
22
|
-
onClickKey={onClickKey}
|
|
23
|
-
/>
|
|
24
|
-
<SecondaryKeypadButton
|
|
25
|
-
keyConfig={Keys.LOG_N}
|
|
26
|
-
onClickKey={onClickKey}
|
|
27
|
-
/>
|
|
28
|
-
<SecondaryKeypadButton
|
|
29
|
-
keyConfig={Keys.LN}
|
|
30
|
-
onClickKey={onClickKey}
|
|
31
|
-
/>
|
|
32
|
-
</React.Fragment>
|
|
33
|
-
);
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
import Keys from "../../../data/key-configs";
|
|
4
|
-
import {ClickKeyCallback} from "../../../types";
|
|
5
|
-
import {PlaceHolderButtons, SecondaryKeypadButton} from "../keypad-page-items";
|
|
6
|
-
|
|
7
|
-
type Props = {
|
|
8
|
-
onClickKey: ClickKeyCallback;
|
|
9
|
-
placeholder?: boolean;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const PreAlgebra = ({
|
|
13
|
-
onClickKey,
|
|
14
|
-
placeholder,
|
|
15
|
-
}: Props): React.ReactElement =>
|
|
16
|
-
placeholder ? (
|
|
17
|
-
<PlaceHolderButtons count={4} />
|
|
18
|
-
) : (
|
|
19
|
-
<React.Fragment>
|
|
20
|
-
<SecondaryKeypadButton
|
|
21
|
-
keyConfig={Keys.EXP_2}
|
|
22
|
-
onClickKey={onClickKey}
|
|
23
|
-
/>
|
|
24
|
-
<SecondaryKeypadButton
|
|
25
|
-
keyConfig={Keys.EXP}
|
|
26
|
-
onClickKey={onClickKey}
|
|
27
|
-
/>
|
|
28
|
-
<SecondaryKeypadButton
|
|
29
|
-
keyConfig={Keys.SQRT}
|
|
30
|
-
onClickKey={onClickKey}
|
|
31
|
-
/>
|
|
32
|
-
<SecondaryKeypadButton
|
|
33
|
-
keyConfig={Keys.RADICAL}
|
|
34
|
-
onClickKey={onClickKey}
|
|
35
|
-
/>
|
|
36
|
-
</React.Fragment>
|
|
37
|
-
);
|
/package/src/components/keypad/{keypad-pages.stories.tsx → keypad-pages/keypad-pages.stories.tsx}
RENAMED
|
File without changes
|