@khanacademy/math-input 10.1.1 → 11.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 CHANGED
@@ -1,5 +1,16 @@
1
1
  # @khanacademy/math-input
2
2
 
3
+ ## 11.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 2af4f9fa: Switch from using ProvideKeypad in ArticleRenderer to passing the keypad element down instead
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [2af4f9fa]
12
+ - @khanacademy/perseus-core@1.0.0
13
+
3
14
  ## 10.1.1
4
15
 
5
16
  ### Patch Changes
@@ -7,6 +18,7 @@
7
18
  - 3f7be05a: Updated Keypad V2 TabbarItemType to KeypadPageType as a more accurate description.
8
19
  - 810c7bd9: Resize letter SVGs
9
20
  - b161d004: Ensured that the keypad is hidden from screen readers when it is closed.
21
+ - a99a9ca4: Fix direction types for MathQuill interface
10
22
 
11
23
  ## 10.1.0
12
24
 
@@ -1,7 +1,7 @@
1
1
  import type Key from "../../data/keys";
2
2
  export interface MathQuillInterface {
3
- L: "L";
4
- R: "R";
3
+ L: -1;
4
+ R: 1;
5
5
  /**
6
6
  * Creates an editable MathQuill initialized with the contents of the HTML
7
7
  * element and returns a MathField object.
@@ -7,12 +7,13 @@
7
7
  * ExerciseFooter.
8
8
  */
9
9
  import * as React from "react";
10
- import type { RendererInterface } from "@khanacademy/perseus-core";
10
+ import type { KeypadAPI } from "../types";
11
+ import type { KeypadContextRendererInterface } from "@khanacademy/perseus-core";
11
12
  type KeypadContext = {
12
- setKeypadElement: (keypadElement?: HTMLElement | null | undefined) => void;
13
- keypadElement: HTMLElement | null | undefined;
14
- setRenderer: (renderer?: RendererInterface | null | undefined) => void;
15
- renderer: RendererInterface | null | undefined;
13
+ setKeypadElement: (keypadElement?: KeypadAPI) => void;
14
+ keypadElement: KeypadAPI | null | undefined;
15
+ setRenderer: (renderer?: KeypadContextRendererInterface | null | undefined) => void;
16
+ renderer: KeypadContextRendererInterface | null | undefined;
16
17
  setScrollableElement: (scrollableElement?: HTMLElement | null | undefined) => void;
17
18
  scrollableElement: HTMLElement | null | undefined;
18
19
  };
package/dist/es/index.js CHANGED
@@ -1564,7 +1564,7 @@ class MathInput extends React.Component {
1564
1564
  });
1565
1565
  };
1566
1566
  this.focus = () => {
1567
- var _this$props$keypadEle2;
1567
+ var _this$props$keypadEle2, _this$props;
1568
1568
  // Pass this component's handleKey method to the keypad so it can call
1569
1569
  // it whenever it needs to trigger a keypress action.
1570
1570
  (_this$props$keypadEle2 = this.props.keypadElement) == null ? void 0 : _this$props$keypadEle2.setKeyHandler(key => {
@@ -1590,7 +1590,7 @@ class MathInput extends React.Component {
1590
1590
  return cursor;
1591
1591
  });
1592
1592
  this.mathField.focus();
1593
- this.props.onFocus && this.props.onFocus();
1593
+ (_this$props = this.props) == null ? void 0 : _this$props.onFocus();
1594
1594
  this.setState({
1595
1595
  focused: true
1596
1596
  }, () => {
@@ -1600,13 +1600,14 @@ class MathInput extends React.Component {
1600
1600
  // Android Browser 4.3.
1601
1601
  setTimeout(() => {
1602
1602
  if (this._isMounted) {
1603
+ var _this$props$keypadEle3;
1603
1604
  // TODO(benkomalo): the keypad is animating at this point,
1604
1605
  // so we can't call _cacheKeypadBounds(), even though
1605
1606
  // it'd be nice to do so. It should probably be the case
1606
1607
  // that the higher level controller tells us when the
1607
1608
  // keypad is settled (then scrollIntoView wouldn't have
1608
1609
  // to make assumptions about that either).
1609
- const maybeKeypadNode = this.props.keypadElement && this.props.keypadElement.getDOMNode();
1610
+ const maybeKeypadNode = (_this$props$keypadEle3 = this.props.keypadElement) == null ? void 0 : _this$props$keypadEle3.getDOMNode();
1610
1611
  scrollIntoView(this._container, maybeKeypadNode);
1611
1612
  }
1612
1613
  });
@@ -5099,8 +5100,8 @@ class MobileKeypad extends React.Component {
5099
5100
  this._throttleResize = false;
5100
5101
  this.hasMounted = false;
5101
5102
  this.state = {
5102
- containerWidth: 0,
5103
- active: false
5103
+ active: false,
5104
+ containerWidth: 0
5104
5105
  };
5105
5106
  this._resize = () => {
5106
5107
  var _this$_containerRef$c;