@khanacademy/math-input 4.1.0 → 4.1.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 (41) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/components/keypad/geometry-page/index.d.ts +2 -1
  3. package/dist/components/keypad/geometry-page/index.js.flow +2 -1
  4. package/dist/components/keypad/index.d.ts +2 -1
  5. package/dist/components/keypad/index.js.flow +2 -1
  6. package/dist/components/keypad/keypad-page-items.d.ts +8 -16
  7. package/dist/components/keypad/keypad-page-items.js.flow +11 -16
  8. package/dist/components/keypad/numbers-page/index.d.ts +2 -1
  9. package/dist/components/keypad/numbers-page/index.js.flow +2 -1
  10. package/dist/components/keypad/operators-page/advanced-relations-buttons.d.ts +2 -1
  11. package/dist/components/keypad/operators-page/advanced-relations-buttons.js.flow +2 -1
  12. package/dist/components/keypad/operators-page/basic-relations-buttons.d.ts +2 -1
  13. package/dist/components/keypad/operators-page/basic-relations-buttons.js.flow +2 -1
  14. package/dist/components/keypad/operators-page/index.d.ts +2 -1
  15. package/dist/components/keypad/operators-page/index.js.flow +2 -1
  16. package/dist/components/keypad/operators-page/logarithms-buttons.d.ts +2 -1
  17. package/dist/components/keypad/operators-page/logarithms-buttons.js.flow +2 -1
  18. package/dist/components/keypad/operators-page/pre-algebra-buttons.d.ts +2 -1
  19. package/dist/components/keypad/operators-page/pre-algebra-buttons.js.flow +2 -1
  20. package/dist/es/index.js.map +1 -1
  21. package/dist/index.js.map +1 -1
  22. package/dist/types.d.ts +1 -0
  23. package/dist/types.js.flow +1 -0
  24. package/package.json +1 -1
  25. package/src/components/keypad/__tests__/Button.test.tsx +51 -0
  26. package/src/components/keypad/__tests__/KeypadButton.test.tsx +41 -0
  27. package/src/components/keypad/__tests__/keypad-v2.cypress.ts +33 -0
  28. package/src/components/keypad/geometry-page/index.tsx +2 -1
  29. package/src/components/keypad/index.tsx +2 -1
  30. package/src/components/keypad/keypad-page-items.tsx +9 -18
  31. package/src/components/keypad/numbers-page/index.tsx +2 -1
  32. package/src/components/keypad/operators-page/advanced-relations-buttons.tsx +2 -1
  33. package/src/components/keypad/operators-page/basic-relations-buttons.tsx +2 -1
  34. package/src/components/keypad/operators-page/index.tsx +2 -1
  35. package/src/components/keypad/operators-page/logarithms-buttons.tsx +2 -1
  36. package/src/components/keypad/operators-page/pre-algebra-buttons.tsx +2 -1
  37. package/src/types.ts +2 -0
  38. package/tsconfig-build.json +1 -2
  39. package/tsconfig-build.tsbuildinfo +1 -1
  40. package/dist/components/input/__tests__/test-math-wrapper.d.ts +0 -8
  41. package/dist/components/input/__tests__/test-math-wrapper.js.flow +0 -14
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @khanacademy/math-input
2
2
 
3
+ ## 4.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 31ed8380: Add math-input v2 keypad tests
8
+ - 937d2308: Added basic Cypress testing for the v2 math-input keypad
9
+
3
10
  ## 4.1.0
4
11
 
5
12
  ### Minor Changes
@@ -1,6 +1,7 @@
1
1
  import * as React from "react";
2
+ import { ClickKeyCallback } from "../../../types";
2
3
  type Props = {
3
- onClickKey: (keyConfig: string) => void;
4
+ onClickKey: ClickKeyCallback;
4
5
  };
5
6
  export default class GeometryPage extends React.Component<Props> {
6
7
  render(): React.ReactNode;
@@ -5,8 +5,9 @@
5
5
  * @flow
6
6
  */
7
7
  import * as React from "react";
8
+ import { ClickKeyCallback } from "../../../types";
8
9
  declare type Props = {|
9
- onClickKey: (keyConfig: string) => void,
10
+ onClickKey: ClickKeyCallback,
10
11
  |};
11
12
  declare export default class GeometryPage extends React.Component<Props> {
12
13
  render(): React.Node;
@@ -1,10 +1,11 @@
1
1
  import * as React from "react";
2
2
  import Key from "../../data/keys";
3
+ import { ClickKeyCallback } from "../../types";
3
4
  import { TabbarItemType } from "../tabbar/types";
4
5
  import { NumbersPageOptions } from "./numbers-page/types";
5
6
  import { OperatorsButtonSets } from "./operators-page/types";
6
7
  export type Props = {
7
- onClickKey: (keyConfig: string) => void;
8
+ onClickKey: ClickKeyCallback;
8
9
  trigonometry?: boolean;
9
10
  extraKeys: ReadonlyArray<Key>;
10
11
  } & OperatorsButtonSets & NumbersPageOptions;
@@ -6,12 +6,13 @@
6
6
  */
7
7
  import * as React from "react";
8
8
  import Key from "../../data/keys";
9
+ import { ClickKeyCallback } from "../../types";
9
10
  import { TabbarItemType } from "../tabbar/types";
10
11
  import { NumbersPageOptions } from "./numbers-page/types";
11
12
  import { OperatorsButtonSets } from "./operators-page/types";
12
13
  export type Props = {|
13
14
  ...{|
14
- onClickKey: (keyConfig: string) => void,
15
+ onClickKey: ClickKeyCallback,
15
16
  trigonometry?: boolean,
16
17
  extraKeys: $ReadOnlyArray<Key>,
17
18
  |},
@@ -1,29 +1,21 @@
1
1
  import * as React from "react";
2
- import { KeyConfig } from "../../types";
2
+ import { KeyConfig, ClickKeyCallback } from "../../types";
3
3
  import type { StyleType } from "@khanacademy/wonder-blocks-core";
4
4
  type KeypadPageContainerProps = {
5
5
  children: React.ReactNode;
6
6
  };
7
7
  export declare const KeypadPageContainer: ({ children, }: KeypadPageContainerProps) => React.ReactElement;
8
- export type KeypadButtonProps = {
9
- keyConfig: KeyConfig;
10
- tintColor?: string;
11
- style?: StyleType;
12
- onClickKey: (keyConfig: string) => void;
13
- };
14
- export declare const KeypadButton: ({ keyConfig, onClickKey, tintColor, style, }: KeypadButtonProps) => React.ReactElement;
15
- type SecondaryKeypadButtonProps = {
8
+ type SharedButtonProps = {
16
9
  keyConfig: KeyConfig;
17
10
  style?: StyleType;
18
- onClickKey: (keyConfig: string) => void;
11
+ onClickKey: ClickKeyCallback;
19
12
  };
20
- export declare const SecondaryKeypadButton: ({ keyConfig, onClickKey, style, }: SecondaryKeypadButtonProps) => React.ReactElement;
21
- type KeypadActionButtonProps = {
22
- keyConfig: KeyConfig;
23
- style?: StyleType;
24
- onClickKey: (keyConfig: string) => void;
13
+ export type KeypadButtonProps = SharedButtonProps & {
14
+ tintColor?: string;
25
15
  };
26
- export declare const KeypadActionButton: ({ keyConfig, onClickKey, style, }: KeypadActionButtonProps) => React.ReactElement;
16
+ export declare const KeypadButton: ({ keyConfig, onClickKey, tintColor, style, }: KeypadButtonProps) => React.ReactElement;
17
+ export declare const SecondaryKeypadButton: ({ keyConfig, onClickKey, style, }: SharedButtonProps) => React.ReactElement;
18
+ export declare const KeypadActionButton: ({ keyConfig, onClickKey, style, }: SharedButtonProps) => React.ReactElement;
27
19
  /**
28
20
  * A placeholder button for the keypad. Optional count prop to render multiple
29
21
  * buttons. Defaults to 1.
@@ -5,7 +5,7 @@
5
5
  * @flow
6
6
  */
7
7
  import * as React from "react";
8
- import { KeyConfig } from "../../types";
8
+ import { KeyConfig, ClickKeyCallback } from "../../types";
9
9
  import type { StyleType } from "@khanacademy/wonder-blocks-core";
10
10
  declare type KeypadPageContainerProps = {|
11
11
  children: React.Node,
@@ -13,28 +13,23 @@ declare type KeypadPageContainerProps = {|
13
13
  declare export var KeypadPageContainer: (
14
14
  x: KeypadPageContainerProps
15
15
  ) => React.Element<any>;
16
- export type KeypadButtonProps = {|
16
+ declare type SharedButtonProps = {|
17
17
  keyConfig: KeyConfig,
18
- tintColor?: string,
19
18
  style?: StyleType,
20
- onClickKey: (keyConfig: string) => void,
19
+ onClickKey: ClickKeyCallback,
21
20
  |};
22
- declare export var KeypadButton: (x: KeypadButtonProps) => React.Element<any>;
23
- declare type SecondaryKeypadButtonProps = {|
24
- keyConfig: KeyConfig,
25
- style?: StyleType,
26
- onClickKey: (keyConfig: string) => void,
21
+ export type KeypadButtonProps = {|
22
+ ...SharedButtonProps,
23
+ ...{|
24
+ tintColor?: string,
25
+ |},
27
26
  |};
27
+ declare export var KeypadButton: (x: KeypadButtonProps) => React.Element<any>;
28
28
  declare export var SecondaryKeypadButton: (
29
- x: SecondaryKeypadButtonProps
29
+ x: SharedButtonProps
30
30
  ) => React.Element<any>;
31
- declare type KeypadActionButtonProps = {|
32
- keyConfig: KeyConfig,
33
- style?: StyleType,
34
- onClickKey: (keyConfig: string) => void,
35
- |};
36
31
  declare export var KeypadActionButton: (
37
- x: KeypadActionButtonProps
32
+ x: SharedButtonProps
38
33
  ) => React.Element<any>;
39
34
  /**
40
35
  * A placeholder button for the keypad. Optional count prop to render multiple
@@ -1,7 +1,8 @@
1
1
  import * as React from "react";
2
+ import { ClickKeyCallback } from "../../../types";
2
3
  import { NumbersPageOptions } from "./types";
3
4
  type Props = {
4
- onClickKey: (keyConfig: string) => void;
5
+ onClickKey: ClickKeyCallback;
5
6
  } & NumbersPageOptions;
6
7
  export default class NumbersPage extends React.Component<Props> {
7
8
  render(): React.ReactNode;
@@ -5,10 +5,11 @@
5
5
  * @flow
6
6
  */
7
7
  import * as React from "react";
8
+ import { ClickKeyCallback } from "../../../types";
8
9
  import { NumbersPageOptions } from "./types";
9
10
  declare type Props = {|
10
11
  ...{|
11
- onClickKey: (keyConfig: string) => void,
12
+ onClickKey: ClickKeyCallback,
12
13
  |},
13
14
  ...NumbersPageOptions,
14
15
  |};
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
+ import { ClickKeyCallback } from "../../../types";
2
3
  type Props = {
3
- onClickKey: (keyConfig: string) => void;
4
+ onClickKey: ClickKeyCallback;
4
5
  placeholder?: boolean;
5
6
  };
6
7
  export declare const AdvancedRelations: ({ onClickKey, placeholder, }: Props) => React.ReactElement;
@@ -5,8 +5,9 @@
5
5
  * @flow
6
6
  */
7
7
  import React from "react";
8
+ import { ClickKeyCallback } from "../../../types";
8
9
  declare type Props = {|
9
- onClickKey: (keyConfig: string) => void,
10
+ onClickKey: ClickKeyCallback,
10
11
  placeholder?: boolean,
11
12
  |};
12
13
  declare export var AdvancedRelations: (x: Props) => React.ReactElement;
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
+ import { ClickKeyCallback } from "../../../types";
2
3
  type Props = {
3
- onClickKey: (keyConfig: string) => void;
4
+ onClickKey: ClickKeyCallback;
4
5
  placeholder?: boolean;
5
6
  };
6
7
  export declare const BasicRelations: ({ onClickKey, placeholder, }: Props) => React.ReactElement;
@@ -5,8 +5,9 @@
5
5
  * @flow
6
6
  */
7
7
  import React from "react";
8
+ import { ClickKeyCallback } from "../../../types";
8
9
  declare type Props = {|
9
- onClickKey: (keyConfig: string) => void,
10
+ onClickKey: ClickKeyCallback,
10
11
  placeholder?: boolean,
11
12
  |};
12
13
  declare export var BasicRelations: (x: Props) => React.ReactElement;
@@ -1,7 +1,8 @@
1
1
  import * as React from "react";
2
+ import { ClickKeyCallback } from "../../../types";
2
3
  import { OperatorsButtonSets } from "./types";
3
4
  type Props = {
4
- onClickKey: (keyConfig: string) => void;
5
+ onClickKey: ClickKeyCallback;
5
6
  } & OperatorsButtonSets;
6
7
  export default class OperatorsPage extends React.Component<Props> {
7
8
  render(): React.ReactNode;
@@ -5,10 +5,11 @@
5
5
  * @flow
6
6
  */
7
7
  import * as React from "react";
8
+ import { ClickKeyCallback } from "../../../types";
8
9
  import { OperatorsButtonSets } from "./types";
9
10
  declare type Props = {|
10
11
  ...{|
11
- onClickKey: (keyConfig: string) => void,
12
+ onClickKey: ClickKeyCallback,
12
13
  |},
13
14
  ...OperatorsButtonSets,
14
15
  |};
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
+ import { ClickKeyCallback } from "../../../types";
2
3
  type Props = {
3
- onClickKey: (keyConfig: string) => void;
4
+ onClickKey: ClickKeyCallback;
4
5
  placeholder?: boolean;
5
6
  };
6
7
  export declare const Logarithms: ({ onClickKey, placeholder, }: Props) => React.ReactElement;
@@ -5,8 +5,9 @@
5
5
  * @flow
6
6
  */
7
7
  import React from "react";
8
+ import { ClickKeyCallback } from "../../../types";
8
9
  declare type Props = {|
9
- onClickKey: (keyConfig: string) => void,
10
+ onClickKey: ClickKeyCallback,
10
11
  placeholder?: boolean,
11
12
  |};
12
13
  declare export var Logarithms: (x: Props) => React.ReactElement;
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
+ import { ClickKeyCallback } from "../../../types";
2
3
  type Props = {
3
- onClickKey: (keyConfig: string) => void;
4
+ onClickKey: ClickKeyCallback;
4
5
  placeholder?: boolean;
5
6
  };
6
7
  export declare const PreAlgebra: ({ onClickKey, placeholder, }: Props) => React.ReactElement;
@@ -5,8 +5,9 @@
5
5
  * @flow
6
6
  */
7
7
  import React from "react";
8
+ import { ClickKeyCallback } from "../../../types";
8
9
  declare type Props = {|
9
- onClickKey: (keyConfig: string) => void,
10
+ onClickKey: ClickKeyCallback,
10
11
  placeholder?: boolean,
11
12
  |};
12
13
  declare export var PreAlgebra: (x: Props) => React.ReactElement;