@khanacademy/math-input 6.0.3 → 7.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 +15 -0
- package/dist/components/input/math-input.d.ts +2 -2
- package/dist/components/input/math-input.js.flow +2 -2
- package/dist/components/keypad/index.d.ts +2 -26
- package/dist/components/keypad/index.js.flow +2 -31
- package/dist/components/keypad/keypad.d.ts +26 -0
- package/dist/components/keypad/keypad.js.flow +37 -0
- package/dist/components/keypad/mobile-keypad.d.ts +39 -0
- package/dist/components/keypad/mobile-keypad.js.flow +57 -0
- package/dist/components/keypad/shared-keys.d.ts +1 -1
- package/dist/components/keypad/shared-keys.js.flow +1 -1
- package/dist/components/keypad-legacy/index.d.ts +1 -0
- package/dist/components/keypad-legacy/index.js.flow +7 -0
- package/dist/components/keypad-legacy/provided-keypad.d.ts +2 -2
- package/dist/components/keypad-legacy/provided-keypad.js.flow +10 -2
- package/dist/components/keypad-legacy/touchable-keypad-button.d.ts +1 -1
- package/dist/components/keypad-legacy/touchable-keypad-button.js.flow +1 -1
- package/dist/components/keypad-legacy/two-page-keypad.d.ts +1 -1
- package/dist/components/keypad-legacy/two-page-keypad.js.flow +1 -1
- package/dist/components/tabbar/index.d.ts +2 -0
- package/dist/components/tabbar/index.js.flow +8 -0
- package/dist/es/index.js +306 -173
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.js +322 -187
- package/dist/index.js.flow +9 -9
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +9 -0
- package/dist/types.js.flow +12 -0
- package/package.json +1 -1
- package/src/components/input/math-input.tsx +4 -5
- package/src/components/keypad/index.tsx +2 -173
- package/src/components/keypad/keypad.stories.tsx +2 -1
- package/src/components/keypad/keypad.tsx +171 -0
- package/src/components/keypad/mobile-keypad.tsx +165 -0
- package/src/components/keypad/shared-keys.tsx +1 -1
- package/src/components/keypad-legacy/index.ts +1 -0
- package/src/components/keypad-legacy/provided-keypad.tsx +7 -2
- package/src/components/keypad-legacy/two-page-keypad.tsx +3 -2
- package/src/components/prop-types.js +0 -1
- package/src/components/tabbar/index.ts +2 -0
- package/src/full-math-input.stories.tsx +78 -0
- package/src/index.ts +28 -9
- package/src/types.ts +11 -0
- package/tsconfig-build.tsbuildinfo +1 -1
- package/src/math-input.stories.tsx +0 -67
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @khanacademy/math-input
|
|
2
2
|
|
|
3
|
+
## 7.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 04e68d1c: Change keypadElement from LegacyKeypad to KeypadAPI
|
|
8
|
+
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
- acafa72d: Add MobileKeypad to v2 keypad in MathInput
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- d0f28dbd: Add story for ExpressionEditor
|
|
16
|
+
- 54590cc7: Add index.ts files to some dirs in MathInput for organization
|
|
17
|
+
|
|
3
18
|
## 6.0.3
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import
|
|
2
|
+
import type { KeypadAPI } from "../../types";
|
|
3
3
|
type Props = {
|
|
4
|
-
keypadElement
|
|
4
|
+
keypadElement?: KeypadAPI;
|
|
5
5
|
onBlur: () => void;
|
|
6
6
|
onChange: (value: string, callback: any) => void;
|
|
7
7
|
onFocus: () => void;
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
7
|
import * as React from "react";
|
|
8
|
-
import
|
|
8
|
+
import type { KeypadAPI } from "../../types";
|
|
9
9
|
declare type Props = {|
|
|
10
|
-
keypadElement
|
|
10
|
+
keypadElement?: KeypadAPI,
|
|
11
11
|
onBlur: () => void,
|
|
12
12
|
onChange: (value: string, callback: any) => void,
|
|
13
13
|
onFocus: () => void,
|
|
@@ -1,26 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { ClickKeyCallback } from "../../types";
|
|
4
|
-
import { CursorContext } from "../input/cursor-contexts";
|
|
5
|
-
import type { SendEventFn } from "@khanacademy/perseus-core";
|
|
6
|
-
export type Props = {
|
|
7
|
-
extraKeys: ReadonlyArray<Key>;
|
|
8
|
-
cursorContext?: typeof CursorContext[keyof typeof CursorContext];
|
|
9
|
-
showDismiss?: boolean;
|
|
10
|
-
multiplicationDot?: boolean;
|
|
11
|
-
divisionKey?: boolean;
|
|
12
|
-
trigonometry?: boolean;
|
|
13
|
-
preAlgebra?: boolean;
|
|
14
|
-
logarithms?: boolean;
|
|
15
|
-
basicRelations?: boolean;
|
|
16
|
-
advancedRelations?: boolean;
|
|
17
|
-
onClickKey: ClickKeyCallback;
|
|
18
|
-
sendEvent: SendEventFn;
|
|
19
|
-
};
|
|
20
|
-
declare function Keypad(props: Props): JSX.Element;
|
|
21
|
-
declare namespace Keypad {
|
|
22
|
-
var defaultProps: {
|
|
23
|
-
extraKeys: never[];
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
export default Keypad;
|
|
1
|
+
export { default } from "./keypad";
|
|
2
|
+
export { default as MobileKeypad } from "./mobile-keypad";
|
|
@@ -4,34 +4,5 @@
|
|
|
4
4
|
* Flowgen v1.21.0
|
|
5
5
|
* @flow
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import { CursorContext } from "../input/cursor-contexts";
|
|
10
|
-
import type { SendEventFn } from "@khanacademy/perseus-core";
|
|
11
|
-
export type Props = {|
|
|
12
|
-
extraKeys: $ReadOnlyArray<Key>,
|
|
13
|
-
cursorContext?: $ElementType<
|
|
14
|
-
typeof CursorContext,
|
|
15
|
-
$Keys<typeof CursorContext>
|
|
16
|
-
>,
|
|
17
|
-
showDismiss?: boolean,
|
|
18
|
-
multiplicationDot?: boolean,
|
|
19
|
-
divisionKey?: boolean,
|
|
20
|
-
trigonometry?: boolean,
|
|
21
|
-
preAlgebra?: boolean,
|
|
22
|
-
logarithms?: boolean,
|
|
23
|
-
basicRelations?: boolean,
|
|
24
|
-
advancedRelations?: boolean,
|
|
25
|
-
onClickKey: ClickKeyCallback,
|
|
26
|
-
sendEvent: SendEventFn,
|
|
27
|
-
|};
|
|
28
|
-
declare var Keypad: typeof npm$namespace$Keypad;
|
|
29
|
-
|
|
30
|
-
declare var npm$namespace$Keypad: {|
|
|
31
|
-
(props: Props): React$Node,
|
|
32
|
-
defaultProps: typeof Keypad$defaultProps,
|
|
33
|
-
|};
|
|
34
|
-
declare var Keypad$defaultProps: {|
|
|
35
|
-
extraKeys: empty[],
|
|
36
|
-
|};
|
|
37
|
-
declare export default typeof Keypad;
|
|
7
|
+
declare export { default } from "./keypad";
|
|
8
|
+
declare export { default as MobileKeypad } from "./mobile-keypad";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import Key from "../../data/keys";
|
|
3
|
+
import { ClickKeyCallback } from "../../types";
|
|
4
|
+
import { CursorContext } from "../input/cursor-contexts";
|
|
5
|
+
import type { SendEventFn } from "@khanacademy/perseus-core";
|
|
6
|
+
export type Props = {
|
|
7
|
+
extraKeys: ReadonlyArray<Key>;
|
|
8
|
+
cursorContext?: typeof CursorContext[keyof typeof CursorContext];
|
|
9
|
+
showDismiss?: boolean;
|
|
10
|
+
multiplicationDot?: boolean;
|
|
11
|
+
divisionKey?: boolean;
|
|
12
|
+
trigonometry?: boolean;
|
|
13
|
+
preAlgebra?: boolean;
|
|
14
|
+
logarithms?: boolean;
|
|
15
|
+
basicRelations?: boolean;
|
|
16
|
+
advancedRelations?: boolean;
|
|
17
|
+
onClickKey: ClickKeyCallback;
|
|
18
|
+
sendEvent: SendEventFn;
|
|
19
|
+
};
|
|
20
|
+
declare function Keypad(props: Props): JSX.Element;
|
|
21
|
+
declare namespace Keypad {
|
|
22
|
+
var defaultProps: {
|
|
23
|
+
extraKeys: never[];
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export default Keypad;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowtype definitions for data
|
|
3
|
+
* Generated by Flowgen from a Typescript Definition
|
|
4
|
+
* Flowgen v1.21.0
|
|
5
|
+
* @flow
|
|
6
|
+
*/
|
|
7
|
+
import Key from "../../data/keys";
|
|
8
|
+
import { ClickKeyCallback } from "../../types";
|
|
9
|
+
import { CursorContext } from "../input/cursor-contexts";
|
|
10
|
+
import type { SendEventFn } from "@khanacademy/perseus-core";
|
|
11
|
+
export type Props = {|
|
|
12
|
+
extraKeys: $ReadOnlyArray<Key>,
|
|
13
|
+
cursorContext?: $ElementType<
|
|
14
|
+
typeof CursorContext,
|
|
15
|
+
$Keys<typeof CursorContext>
|
|
16
|
+
>,
|
|
17
|
+
showDismiss?: boolean,
|
|
18
|
+
multiplicationDot?: boolean,
|
|
19
|
+
divisionKey?: boolean,
|
|
20
|
+
trigonometry?: boolean,
|
|
21
|
+
preAlgebra?: boolean,
|
|
22
|
+
logarithms?: boolean,
|
|
23
|
+
basicRelations?: boolean,
|
|
24
|
+
advancedRelations?: boolean,
|
|
25
|
+
onClickKey: ClickKeyCallback,
|
|
26
|
+
sendEvent: SendEventFn,
|
|
27
|
+
|};
|
|
28
|
+
declare var Keypad: typeof npm$namespace$Keypad;
|
|
29
|
+
|
|
30
|
+
declare var npm$namespace$Keypad: {|
|
|
31
|
+
(props: Props): React$Node,
|
|
32
|
+
defaultProps: typeof Keypad$defaultProps,
|
|
33
|
+
|};
|
|
34
|
+
declare var Keypad$defaultProps: {|
|
|
35
|
+
extraKeys: empty[],
|
|
36
|
+
|};
|
|
37
|
+
declare export default typeof Keypad;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import ReactDOM from "react-dom";
|
|
4
|
+
import Key from "../../data/keys";
|
|
5
|
+
import { Cursor, KeypadConfiguration, KeyHandler, KeypadAPI } from "../../types";
|
|
6
|
+
/**
|
|
7
|
+
* This is the v2 equivalent of v1's ProvidedKeypad. It follows the same
|
|
8
|
+
* external API so that it can be hot-swapped with the v1 keypad and
|
|
9
|
+
* is responsible for connecting the keypad with MathInput and the Renderer.
|
|
10
|
+
*
|
|
11
|
+
* Ideally this strategy of attaching methods on the class component for
|
|
12
|
+
* other components to call will be replaced props/callbacks since React
|
|
13
|
+
* doesn't support this type of code anymore (functional components
|
|
14
|
+
* can't have methods attached to them).
|
|
15
|
+
*/
|
|
16
|
+
type Props = {
|
|
17
|
+
onElementMounted?: (arg1: any) => void;
|
|
18
|
+
onDismiss?: () => void;
|
|
19
|
+
style?: StyleType;
|
|
20
|
+
};
|
|
21
|
+
type State = {
|
|
22
|
+
active: boolean;
|
|
23
|
+
keypadConfig?: KeypadConfiguration;
|
|
24
|
+
keyHandler?: KeyHandler;
|
|
25
|
+
cursor?: Cursor;
|
|
26
|
+
};
|
|
27
|
+
declare class MobileKeypad extends React.Component<Props, State> implements KeypadAPI {
|
|
28
|
+
hasMounted: boolean;
|
|
29
|
+
state: State;
|
|
30
|
+
activate: () => void;
|
|
31
|
+
dismiss: () => void;
|
|
32
|
+
configure: (configuration: KeypadConfiguration, cb: () => void) => void;
|
|
33
|
+
setCursor: (cursor: Cursor) => void;
|
|
34
|
+
setKeyHandler: (keyHandler: KeyHandler) => void;
|
|
35
|
+
getDOMNode: () => ReturnType<typeof ReactDOM.findDOMNode>;
|
|
36
|
+
_handleClickKey(key: Key): void;
|
|
37
|
+
render(): React.ReactNode;
|
|
38
|
+
}
|
|
39
|
+
export default MobileKeypad;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowtype definitions for data
|
|
3
|
+
* Generated by Flowgen from a Typescript Definition
|
|
4
|
+
* Flowgen v1.21.0
|
|
5
|
+
* @flow
|
|
6
|
+
*/
|
|
7
|
+
import { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import ReactDOM from "react-dom";
|
|
10
|
+
import Key from "../../data/keys";
|
|
11
|
+
import {
|
|
12
|
+
Cursor,
|
|
13
|
+
KeypadConfiguration,
|
|
14
|
+
KeyHandler,
|
|
15
|
+
KeypadAPI,
|
|
16
|
+
} from "../../types";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* This is the v2 equivalent of v1's ProvidedKeypad. It follows the same
|
|
20
|
+
* external API so that it can be hot-swapped with the v1 keypad and
|
|
21
|
+
* is responsible for connecting the keypad with MathInput and the Renderer.
|
|
22
|
+
*
|
|
23
|
+
* Ideally this strategy of attaching methods on the class component for
|
|
24
|
+
* other components to call will be replaced props/callbacks since React
|
|
25
|
+
* doesn't support this type of code anymore (functional components
|
|
26
|
+
* can't have methods attached to them).
|
|
27
|
+
*/
|
|
28
|
+
declare type Props = {|
|
|
29
|
+
onElementMounted?: (arg1: any) => void,
|
|
30
|
+
onDismiss?: () => void,
|
|
31
|
+
style?: StyleType,
|
|
32
|
+
|};
|
|
33
|
+
declare type State = {|
|
|
34
|
+
active: boolean,
|
|
35
|
+
keypadConfig?: KeypadConfiguration,
|
|
36
|
+
keyHandler?: KeyHandler,
|
|
37
|
+
cursor?: Cursor,
|
|
38
|
+
|};
|
|
39
|
+
declare class MobileKeypad
|
|
40
|
+
extends React.Component<Props, State>
|
|
41
|
+
implements KeypadAPI
|
|
42
|
+
{
|
|
43
|
+
hasMounted: boolean;
|
|
44
|
+
state: State;
|
|
45
|
+
activate: () => void;
|
|
46
|
+
dismiss: () => void;
|
|
47
|
+
configure: (configuration: KeypadConfiguration, cb: () => void) => void;
|
|
48
|
+
setCursor: (cursor: Cursor) => void;
|
|
49
|
+
setKeyHandler: (keyHandler: KeyHandler) => void;
|
|
50
|
+
getDOMNode: () => $Call<
|
|
51
|
+
<R>((...args: any[]) => R) => R,
|
|
52
|
+
typeof ReactDOM.findDOMNode
|
|
53
|
+
>;
|
|
54
|
+
_handleClickKey(key: Key): void;
|
|
55
|
+
render(): React.Node;
|
|
56
|
+
}
|
|
57
|
+
declare export default typeof MobileKeypad;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ClickKeyCallback } from "../../types";
|
|
3
3
|
import { CursorContext } from "../input/cursor-contexts";
|
|
4
|
-
import { TabbarItemType } from "../tabbar
|
|
4
|
+
import { TabbarItemType } from "../tabbar";
|
|
5
5
|
type Props = {
|
|
6
6
|
onClickKey: ClickKeyCallback;
|
|
7
7
|
selectedPage: TabbarItemType;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { ClickKeyCallback } from "../../types";
|
|
8
8
|
import { CursorContext } from "../input/cursor-contexts";
|
|
9
|
-
import { TabbarItemType } from "../tabbar
|
|
9
|
+
import { TabbarItemType } from "../tabbar";
|
|
10
10
|
declare type Props = {|
|
|
11
11
|
onClickKey: ClickKeyCallback,
|
|
12
12
|
selectedPage: TabbarItemType,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./provided-keypad";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import ReactDOM from "react-dom";
|
|
3
|
-
import type { Cursor, KeypadConfiguration, KeyHandler } from "../../types";
|
|
3
|
+
import type { Cursor, KeypadConfiguration, KeyHandler, KeypadAPI } from "../../types";
|
|
4
4
|
import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
5
5
|
type Props = {
|
|
6
6
|
onElementMounted?: (arg1: any) => void;
|
|
7
7
|
onDismiss?: () => void;
|
|
8
8
|
style?: StyleType;
|
|
9
9
|
};
|
|
10
|
-
declare class ProvidedKeypad extends React.Component<Props> {
|
|
10
|
+
declare class ProvidedKeypad extends React.Component<Props> implements KeypadAPI {
|
|
11
11
|
store: any;
|
|
12
12
|
constructor(props: any);
|
|
13
13
|
activate: () => void;
|
|
@@ -6,14 +6,22 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import * as React from "react";
|
|
8
8
|
import ReactDOM from "react-dom";
|
|
9
|
-
import type {
|
|
9
|
+
import type {
|
|
10
|
+
Cursor,
|
|
11
|
+
KeypadConfiguration,
|
|
12
|
+
KeyHandler,
|
|
13
|
+
KeypadAPI,
|
|
14
|
+
} from "../../types";
|
|
10
15
|
import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
11
16
|
declare type Props = {|
|
|
12
17
|
onElementMounted?: (arg1: any) => void,
|
|
13
18
|
onDismiss?: () => void,
|
|
14
19
|
style?: StyleType,
|
|
15
20
|
|};
|
|
16
|
-
declare class ProvidedKeypad
|
|
21
|
+
declare class ProvidedKeypad
|
|
22
|
+
extends React.Component<Props>
|
|
23
|
+
implements KeypadAPI
|
|
24
|
+
{
|
|
17
25
|
store: any;
|
|
18
26
|
constructor(props: any): this;
|
|
19
27
|
activate: () => void;
|
|
@@ -33,5 +33,5 @@ declare class TouchableKeypadButton extends React.Component<Props> {
|
|
|
33
33
|
componentWillUnmount(): void;
|
|
34
34
|
render(): JSX.Element;
|
|
35
35
|
}
|
|
36
|
-
declare const _default: import("react-redux").ConnectedComponent<typeof TouchableKeypadButton, import("react-redux").Omit<React.ClassAttributes<TouchableKeypadButton> & Props, "style" | "ariaLabel" | "type" | "id" | "icon" | "
|
|
36
|
+
declare const _default: import("react-redux").ConnectedComponent<typeof TouchableKeypadButton, import("react-redux").Omit<React.ClassAttributes<TouchableKeypadButton> & Props, "style" | "ariaLabel" | "type" | "id" | "icon" | "focused" | "childKeyIds" | "borders" | "childKeys" | "disabled" | "popoverEnabled" | "gestureManager"> & OwnProps>;
|
|
37
37
|
export default _default;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import * as $Flowgen$Import$react_2d_redux from "react-redux";
|
|
8
8
|
import * as React from "react";
|
|
9
|
-
import { TabbarItemType } from "../tabbar
|
|
9
|
+
import type { TabbarItemType } from "../tabbar";
|
|
10
10
|
declare interface ReduxProps {
|
|
11
11
|
paginationEnabled: boolean;
|
|
12
12
|
}
|