@khanacademy/math-input 20.1.2 → 21.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/dist/index.d.ts CHANGED
@@ -11,7 +11,6 @@ export { getCursorContext } from "./components/input/mathquill-helpers";
11
11
  export { MobileKeypad } from "./components/keypad";
12
12
  export { default as DesktopKeypad } from "./components/keypad";
13
13
  export { MathInputI18nContextProvider, MathInputI18nContext, useMathInputI18n, } from "./components/i18n-context";
14
- export { KeypadContext, StatefulKeypadContextProvider, } from "./components/keypad-context";
15
14
  export { keypadElementPropType } from "./components/prop-types";
16
15
  export type { KeypadAPI, KeypadConfiguration } from "./types";
17
16
  export { convertDotToTimesByLocale } from "./utils";
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var perseusCore = require('@khanacademy/perseus-core');
6
+ var keypadContext = require('@khanacademy/keypad-context');
6
7
  var wonderBlocksTokens = require('@khanacademy/wonder-blocks-tokens');
7
8
  var wonderStuffCore = require('@khanacademy/wonder-stuff-core');
8
9
  var aphrodite = require('aphrodite');
@@ -44,7 +45,7 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
44
45
 
45
46
  // This file is processed by a Rollup plugin (replace) to inject the production
46
47
  const libName = "@khanacademy/math-input";
47
- const libVersion = "20.1.2";
48
+ const libVersion = "21.0.0";
48
49
  perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
49
50
 
50
51
  function _extends() {
@@ -260,49 +261,6 @@ function MathInputI18nContextProvider(_ref) {
260
261
  }
261
262
  const useMathInputI18n = () => React.useContext(MathInputI18nContext);
262
263
 
263
- /**
264
- * KeypadContext provides a way to the Keypad and Perseus Renderers to
265
- * communicate.
266
- *
267
- * The StatefulKeypadContextProvider wraps the application
268
- * while KeypadContext.Consumer wraps things that need this state:
269
- * - mobile keypad usages
270
- * - Perseus Renderers (Server/Item/Article)
271
- */
272
- // @ts-expect-error - TS2322 - Type 'Context<{ setKeypadElement: (keypadElement: HTMLElement | null | undefined) => void; keypadElement: null; setRenderer: (renderer: RendererInterface | null | undefined) => void; renderer: null; setScrollableElement: (scrollableElement: HTMLElement | ... 1 more ... | undefined) => void; scrollableElement: null; }>' is not assignable to type 'Context<KeypadContext>'.
273
- const KeypadContext = /*#__PURE__*/React__namespace.createContext({
274
- setKeypadActive: keypadActive => {},
275
- keypadActive: false,
276
- setKeypadElement: keypadElement => {},
277
- keypadElement: null,
278
- setRenderer: renderer => {},
279
- renderer: null,
280
- setScrollableElement: scrollableElement => {},
281
- scrollableElement: null
282
- });
283
- function StatefulKeypadContextProvider(props) {
284
- // whether or not to display the keypad
285
- const [keypadActive, setKeypadActive] = React.useState(false);
286
- // used to communicate between the keypad and the Renderer
287
- const [keypadElement, setKeypadElement] = React.useState();
288
- // this is a KeypadContextRendererInterface from Perseus
289
- const [renderer, setRenderer] = React.useState();
290
- const [scrollableElement, setScrollableElement] = React.useState();
291
- const memoizedValue = React.useMemo(() => ({
292
- keypadActive,
293
- setKeypadActive,
294
- keypadElement,
295
- setKeypadElement,
296
- renderer,
297
- setRenderer,
298
- scrollableElement,
299
- setScrollableElement
300
- }), [keypadActive, setKeypadActive, keypadElement, setKeypadElement, renderer, setRenderer, scrollableElement, setScrollableElement]);
301
- return /*#__PURE__*/React__namespace.createElement(KeypadContext.Provider, {
302
- value: memoizedValue
303
- }, props.children);
304
- }
305
-
306
264
  /**
307
265
  * Common parameters used to style components.
308
266
  */
@@ -2378,7 +2336,7 @@ class MathInput extends React__namespace.Component {
2378
2336
  // TODO(diedra): Fix the bug that is causing Android to require a two finger tap
2379
2337
  // to the open the keyboard, and then remove the second half of this label.
2380
2338
  const ariaLabel = this.context.strings.mathInputBox + " " + this.context.strings.fingerTap;
2381
- return /*#__PURE__*/React__namespace.createElement(KeypadContext.Consumer, null, _ref => {
2339
+ return /*#__PURE__*/React__namespace.createElement(keypadContext.KeypadContext.Consumer, null, _ref => {
2382
2340
  let {
2383
2341
  keypadActive,
2384
2342
  setKeypadActive
@@ -6038,7 +5996,7 @@ const styles = aphrodite.StyleSheet.create({
6038
5996
  });
6039
5997
 
6040
5998
  function MobileKeypad(props) {
6041
- return /*#__PURE__*/React__namespace.createElement(KeypadContext.Consumer, null, _ref => {
5999
+ return /*#__PURE__*/React__namespace.createElement(keypadContext.KeypadContext.Consumer, null, _ref => {
6042
6000
  let {
6043
6001
  keypadActive,
6044
6002
  setKeypadActive
@@ -6091,13 +6049,11 @@ exports.CursorContext = CursorContext;
6091
6049
  exports.DesktopKeypad = Keypad;
6092
6050
  exports.KeyArray = KeyArray;
6093
6051
  exports.KeyConfigs = KeyConfigs;
6094
- exports.KeypadContext = KeypadContext;
6095
6052
  exports.KeypadInput = MathInput;
6096
6053
  exports.KeypadType = KeypadType;
6097
6054
  exports.MathInputI18nContext = MathInputI18nContext;
6098
6055
  exports.MathInputI18nContextProvider = MathInputI18nContextProvider;
6099
6056
  exports.MobileKeypad = MobileKeypad;
6100
- exports.StatefulKeypadContextProvider = StatefulKeypadContextProvider;
6101
6057
  exports.convertDotToTimesByLocale = convertDotToTimesByLocale;
6102
6058
  exports.createMathField = createMathField;
6103
6059
  exports.getCursorContext = getCursorContext;