@khanacademy/math-input 4.0.0 → 4.1.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.
Files changed (33) hide show
  1. package/.eslintrc.js +7 -1
  2. package/CHANGELOG.md +7 -0
  3. package/dist/components/keypad/button.d.ts +1 -0
  4. package/dist/components/keypad/button.js.flow +1 -0
  5. package/dist/components/keypad/extras-page/index.d.ts +10 -0
  6. package/dist/components/keypad/extras-page/index.js.flow +15 -0
  7. package/dist/components/keypad/index.d.ts +7 -1
  8. package/dist/components/keypad/index.js.flow +7 -1
  9. package/dist/components/keypad-legacy/two-page-keypad.d.ts +6 -4
  10. package/dist/components/keypad-legacy/two-page-keypad.js.flow +6 -4
  11. package/dist/components/tabbar/tabbar.d.ts +6 -9
  12. package/dist/components/tabbar/tabbar.js.flow +6 -9
  13. package/dist/components/tabbar/types.d.ts +1 -1
  14. package/dist/components/tabbar/types.js.flow +1 -1
  15. package/dist/es/index.js +223 -154
  16. package/dist/es/index.js.map +1 -1
  17. package/dist/index.js +223 -154
  18. package/dist/index.js.map +1 -1
  19. package/package.json +2 -1
  20. package/src/components/keypad/button-assets.tsx +33 -3
  21. package/src/components/keypad/button.tsx +7 -2
  22. package/src/components/keypad/extras-page/index.tsx +27 -0
  23. package/src/components/keypad/index.tsx +34 -7
  24. package/src/components/keypad/keypad-mathquill.stories.tsx +28 -15
  25. package/src/components/keypad/keypad-page-items.tsx +1 -0
  26. package/src/components/keypad-legacy/two-page-keypad.tsx +18 -6
  27. package/src/components/tabbar/__tests__/tabbar.test.tsx +36 -36
  28. package/src/components/tabbar/icons.tsx +68 -50
  29. package/src/components/tabbar/item.tsx +5 -1
  30. package/src/components/tabbar/tabbar.stories.tsx +23 -12
  31. package/src/components/tabbar/tabbar.tsx +22 -38
  32. package/src/components/tabbar/types.ts +1 -1
  33. package/tsconfig-build.tsbuildinfo +1 -1
package/.eslintrc.js CHANGED
@@ -6,7 +6,13 @@ module.exports = {
6
6
  rules: {
7
7
  "import/no-extraneous-dependencies": [
8
8
  "error",
9
- {packageDir: [__dirname, path.join(__dirname, "../../")]},
9
+ {
10
+ packageDir: [__dirname, path.join(__dirname, "../../")],
11
+ // note(matthewc): I changed this in a time pinch and I'm not sure
12
+ // it's right so I made a ticket to circle back to it
13
+ // https://khanacademy.atlassian.net/browse/LC-864
14
+ devDependencies: ["**/*.stories.tsx", "**/*.test.tsx"],
15
+ },
10
16
  ],
11
17
  },
12
18
  };
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @khanacademy/math-input
2
2
 
3
+ ## 4.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - a7f56710: add support for extraKeys to the v2 MathInput Keypad
8
+ - a7f56710: Make tabbar accept styles, create v2 keypad popover example
9
+
3
10
  ## 4.0.0
4
11
 
5
12
  ### Major Changes
@@ -3,6 +3,7 @@ import type { StyleType } from "@khanacademy/wonder-blocks-core";
3
3
  export type Props = {
4
4
  onPress: () => void;
5
5
  children: React.ReactNode;
6
+ ariaLabel: string;
6
7
  style?: StyleType;
7
8
  tintColor?: string;
8
9
  };
@@ -9,6 +9,7 @@ import type { StyleType } from "@khanacademy/wonder-blocks-core";
9
9
  export type Props = {|
10
10
  onPress: () => void,
11
11
  children: React.Node,
12
+ ariaLabel: string,
12
13
  style?: StyleType,
13
14
  tintColor?: string,
14
15
  |};
@@ -0,0 +1,10 @@
1
+ import * as React from "react";
2
+ import Key from "../../../data/keys";
3
+ type Props = {
4
+ extraKeys: ReadonlyArray<Key>;
5
+ onClickKey: (keyConfig: string) => void;
6
+ };
7
+ export default class ExtrasPage extends React.Component<Props> {
8
+ render(): React.ReactNode;
9
+ }
10
+ export {};
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Flowtype definitions for data
3
+ * Generated by Flowgen from a Typescript Definition
4
+ * Flowgen v1.21.0
5
+ * @flow
6
+ */
7
+ import * as React from "react";
8
+ import Key from "../../../data/keys";
9
+ declare type Props = {|
10
+ extraKeys: $ReadOnlyArray<Key>,
11
+ onClickKey: (keyConfig: string) => void,
12
+ |};
13
+ declare export default class ExtrasPage extends React.Component<Props> {
14
+ render(): React.Node;
15
+ }
@@ -1,16 +1,22 @@
1
1
  import * as React from "react";
2
+ import Key from "../../data/keys";
3
+ import { TabbarItemType } from "../tabbar/types";
2
4
  import { NumbersPageOptions } from "./numbers-page/types";
3
5
  import { OperatorsButtonSets } from "./operators-page/types";
4
- import type { TabbarItemType } from "../tabbar/types";
5
6
  export type Props = {
6
7
  onClickKey: (keyConfig: string) => void;
7
8
  trigonometry?: boolean;
9
+ extraKeys: ReadonlyArray<Key>;
8
10
  } & OperatorsButtonSets & NumbersPageOptions;
9
11
  type State = {
10
12
  selectedPage: TabbarItemType;
11
13
  };
14
+ type DefaultProps = {
15
+ extraKeys: Props["extraKeys"];
16
+ };
12
17
  export default class Keypad extends React.Component<Props, State> {
13
18
  state: State;
19
+ static defaultProps: DefaultProps;
14
20
  render(): React.ReactNode;
15
21
  }
16
22
  export {};
@@ -5,13 +5,15 @@
5
5
  * @flow
6
6
  */
7
7
  import * as React from "react";
8
+ import Key from "../../data/keys";
9
+ import { TabbarItemType } from "../tabbar/types";
8
10
  import { NumbersPageOptions } from "./numbers-page/types";
9
11
  import { OperatorsButtonSets } from "./operators-page/types";
10
- import type { TabbarItemType } from "../tabbar/types";
11
12
  export type Props = {|
12
13
  ...{|
13
14
  onClickKey: (keyConfig: string) => void,
14
15
  trigonometry?: boolean,
16
+ extraKeys: $ReadOnlyArray<Key>,
15
17
  |},
16
18
  ...OperatorsButtonSets,
17
19
  ...NumbersPageOptions,
@@ -19,7 +21,11 @@ export type Props = {|
19
21
  declare type State = {|
20
22
  selectedPage: TabbarItemType,
21
23
  |};
24
+ declare type DefaultProps = {|
25
+ extraKeys: $PropertyType<Props, "extraKeys">,
26
+ |};
22
27
  declare export default class Keypad extends React.Component<Props, State> {
23
28
  state: State;
29
+ static defaultProps: DefaultProps;
24
30
  render(): React.Node;
25
31
  }
@@ -2,6 +2,7 @@
2
2
  * A keypad with two pages of keys.
3
3
  */
4
4
  import * as React from "react";
5
+ import { TabbarItemType } from "../tabbar/types";
5
6
  interface ReduxProps {
6
7
  paginationEnabled: boolean;
7
8
  }
@@ -9,10 +10,11 @@ interface Props extends ReduxProps {
9
10
  leftPage: React.ReactNode;
10
11
  rightPage: React.ReactNode;
11
12
  }
12
- declare class TwoPageKeypad extends React.Component<Props> {
13
- state: {
14
- selectedPage: string;
15
- };
13
+ type State = {
14
+ selectedPage: TabbarItemType;
15
+ };
16
+ declare class TwoPageKeypad extends React.Component<Props, State> {
17
+ state: State;
16
18
  render(): JSX.Element;
17
19
  }
18
20
  declare const _default: import("react-redux").ConnectedComponent<typeof TwoPageKeypad, import("react-redux").Omit<React.ClassAttributes<TwoPageKeypad> & Props, "paginationEnabled">>;
@@ -6,6 +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/types";
9
10
  declare interface ReduxProps {
10
11
  paginationEnabled: boolean;
11
12
  }
@@ -13,10 +14,11 @@ declare type Props = {
13
14
  leftPage: React.Node,
14
15
  rightPage: React.Node,
15
16
  } & ReduxProps;
16
- declare class TwoPageKeypad extends React.Component<Props> {
17
- state: {|
18
- selectedPage: string,
19
- |};
17
+ declare type State = {|
18
+ selectedPage: TabbarItemType,
19
+ |};
20
+ declare class TwoPageKeypad extends React.Component<Props, State> {
21
+ state: State;
20
22
  render(): React$Node;
21
23
  }
22
24
  declare var _default: $Flowgen$Import$react_2d_redux.ConnectedComponent<
@@ -1,14 +1,11 @@
1
+ import { StyleType } from "@khanacademy/wonder-blocks-core";
1
2
  import * as React from "react";
2
- import type { TabbarItemType } from "./types";
3
- type TabbarState = {
4
- selectedItem: number;
5
- };
3
+ import { TabbarItemType } from "./types";
6
4
  type Props = {
7
5
  items: ReadonlyArray<TabbarItemType>;
8
- onSelect: (item: TabbarItemType) => void;
6
+ selectedItem: TabbarItemType;
7
+ onSelectItem: (item: TabbarItemType) => void;
8
+ style?: StyleType;
9
9
  };
10
- declare class Tabbar extends React.Component<Props, TabbarState> {
11
- state: TabbarState;
12
- render(): React.ReactNode;
13
- }
10
+ declare function Tabbar(props: Props): React.ReactElement;
14
11
  export default Tabbar;
@@ -4,17 +4,14 @@
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
+ import { StyleType } from "@khanacademy/wonder-blocks-core";
7
8
  import * as React from "react";
8
- import type { TabbarItemType } from "./types";
9
- declare type TabbarState = {|
10
- selectedItem: number,
11
- |};
9
+ import { TabbarItemType } from "./types";
12
10
  declare type Props = {|
13
11
  items: $ReadOnlyArray<TabbarItemType>,
14
- onSelect: (item: TabbarItemType) => void,
12
+ selectedItem: TabbarItemType,
13
+ onSelectItem: (item: TabbarItemType) => void,
14
+ style?: StyleType,
15
15
  |};
16
- declare class Tabbar extends React.Component<Props, TabbarState> {
17
- state: TabbarState;
18
- render(): React.Node;
19
- }
16
+ declare function Tabbar(props: Props): React.Element<any>;
20
17
  declare export default typeof Tabbar;
@@ -1 +1 @@
1
- export type TabbarItemType = "Geometry" | "Operators" | "Numbers";
1
+ export type TabbarItemType = "Geometry" | "Operators" | "Numbers" | "Extras";
@@ -4,4 +4,4 @@
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
- export type TabbarItemType = "Geometry" | "Operators" | "Numbers";
7
+ export type TabbarItemType = "Geometry" | "Operators" | "Numbers" | "Extras";