@khanacademy/math-input 4.2.0 → 4.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/components/input/mathquill-types.d.ts +2 -0
  3. package/dist/components/input/mathquill-types.js.flow +2 -0
  4. package/dist/components/keypad/index.d.ts +8 -16
  5. package/dist/components/keypad/index.js.flow +10 -22
  6. package/dist/components/keypad/keypad-button.d.ts +12 -0
  7. package/dist/components/keypad/keypad-button.js.flow +18 -0
  8. package/dist/components/keypad/keypad-pages/extras-page.d.ts +9 -0
  9. package/dist/components/keypad/{operators-page/basic-relations-buttons.js.flow → keypad-pages/extras-page.js.flow} +3 -3
  10. package/dist/components/keypad/keypad-pages/geometry-page.d.ts +7 -0
  11. package/dist/components/keypad/{operators-page/logarithms-buttons.js.flow → keypad-pages/geometry-page.js.flow} +1 -3
  12. package/dist/components/keypad/keypad-pages/numbers-page.d.ts +7 -0
  13. package/dist/components/keypad/{operators-page/pre-algebra-buttons.js.flow → keypad-pages/numbers-page.js.flow} +1 -3
  14. package/dist/components/keypad/keypad-pages/operators-page.d.ts +11 -0
  15. package/dist/components/keypad/{operators-page/advanced-relations-buttons.js.flow → keypad-pages/operators-page.js.flow} +5 -3
  16. package/dist/components/keypad/shared-keys.d.ts +9 -0
  17. package/dist/components/keypad/{numbers-page/types.js.flow → shared-keys.js.flow} +4 -1
  18. package/dist/es/index.js +771 -842
  19. package/dist/es/index.js.map +1 -1
  20. package/dist/index.js +834 -930
  21. package/dist/index.js.map +1 -1
  22. package/package.json +2 -3
  23. package/src/components/input/__tests__/test-math-wrapper.ts +2 -5
  24. package/src/components/input/mathquill-types.ts +6 -0
  25. package/src/components/keypad/__tests__/keypad-button.test.tsx +4 -2
  26. package/src/components/keypad/button-assets.tsx +506 -310
  27. package/src/components/keypad/index.tsx +73 -49
  28. package/src/components/keypad/{button.stories.tsx → keypad-button.stories.tsx} +2 -1
  29. package/src/components/keypad/keypad-button.tsx +128 -0
  30. package/src/components/keypad/keypad-mathquill.stories.tsx +10 -4
  31. package/src/components/keypad/keypad-pages/extras-page.tsx +34 -0
  32. package/src/components/keypad/keypad-pages/geometry-page.tsx +33 -0
  33. package/src/components/keypad/keypad-pages/numbers-page.tsx +84 -0
  34. package/src/components/keypad/keypad-pages/operators-page.tsx +116 -0
  35. package/src/components/keypad/keypad.stories.tsx +11 -0
  36. package/src/components/keypad/shared-keys.tsx +78 -0
  37. package/src/components/tabbar/icons.tsx +26 -8
  38. package/tsconfig-build.tsbuildinfo +1 -1
  39. package/dist/components/keypad/button.d.ts +0 -12
  40. package/dist/components/keypad/button.js.flow +0 -18
  41. package/dist/components/keypad/extras-page/index.d.ts +0 -10
  42. package/dist/components/keypad/extras-page/index.js.flow +0 -15
  43. package/dist/components/keypad/geometry-page/index.d.ts +0 -9
  44. package/dist/components/keypad/geometry-page/index.js.flow +0 -14
  45. package/dist/components/keypad/keypad-page-items.d.ts +0 -26
  46. package/dist/components/keypad/keypad-page-items.js.flow +0 -40
  47. package/dist/components/keypad/numbers-page/index.d.ts +0 -10
  48. package/dist/components/keypad/numbers-page/index.js.flow +0 -18
  49. package/dist/components/keypad/numbers-page/types.d.ts +0 -4
  50. package/dist/components/keypad/operators-page/advanced-relations-buttons.d.ts +0 -8
  51. package/dist/components/keypad/operators-page/basic-relations-buttons.d.ts +0 -8
  52. package/dist/components/keypad/operators-page/index.d.ts +0 -10
  53. package/dist/components/keypad/operators-page/index.js.flow +0 -18
  54. package/dist/components/keypad/operators-page/logarithms-buttons.d.ts +0 -8
  55. package/dist/components/keypad/operators-page/pre-algebra-buttons.d.ts +0 -8
  56. package/dist/components/keypad/operators-page/types.d.ts +0 -6
  57. package/dist/components/keypad/operators-page/types.js.flow +0 -12
  58. package/src/components/keypad/__tests__/Button.test.tsx +0 -51
  59. package/src/components/keypad/button.tsx +0 -108
  60. package/src/components/keypad/extras-page/index.tsx +0 -27
  61. package/src/components/keypad/geometry-page/index.tsx +0 -89
  62. package/src/components/keypad/keypad-page-items.tsx +0 -118
  63. package/src/components/keypad/numbers-page/index.tsx +0 -136
  64. package/src/components/keypad/numbers-page/types.ts +0 -4
  65. package/src/components/keypad/operators-page/advanced-relations-buttons.tsx +0 -33
  66. package/src/components/keypad/operators-page/basic-relations-buttons.tsx +0 -33
  67. package/src/components/keypad/operators-page/index.tsx +0 -94
  68. package/src/components/keypad/operators-page/logarithms-buttons.tsx +0 -33
  69. package/src/components/keypad/operators-page/pre-algebra-buttons.tsx +0 -37
  70. package/src/components/keypad/operators-page/types.ts +0 -6
  71. /package/src/components/keypad/{keypad-pages.stories.tsx → keypad-pages/keypad-pages.stories.tsx} +0 -0
@@ -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
- );
@@ -1,6 +0,0 @@
1
- export type OperatorsButtonSets = {
2
- preAlgebra?: boolean;
3
- logarithms?: boolean;
4
- basicRelations?: boolean;
5
- advancedRelations?: boolean;
6
- };