@khanacademy/math-input 17.2.1 → 17.2.3

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.
@@ -64,3 +64,4 @@ declare module "mathquill" {
64
64
  cursor?: Cursor;
65
65
  }
66
66
  }
67
+ export type MathQuillAriaStatisStringsMap = MathQuill.v3.AriaStaticStringsMap;
@@ -0,0 +1,19 @@
1
+ export declare const mathQuillStrings: {
2
+ mathInputBox: string;
3
+ ariaStaticStringsMap: {
4
+ before: (obj: string) => string;
5
+ after: (obj: string) => string;
6
+ "beginning of": (obj: string) => string;
7
+ "end of": (obj: string) => string;
8
+ Baseline: string;
9
+ Superscript: string;
10
+ selected: (obj: string) => string;
11
+ "no answer": string;
12
+ "nothing selected": string;
13
+ "nothing to the right": string;
14
+ "nothing to the left": string;
15
+ "block is empty": string;
16
+ "nothing above": string;
17
+ labelValue: (label: string, value: string) => string;
18
+ };
19
+ };
package/dist/es/index.js CHANGED
@@ -17,7 +17,7 @@ import PropTypes from 'prop-types';
17
17
 
18
18
  // This file is processed by a Rollup plugin (replace) to inject the production
19
19
  const libName = "@khanacademy/math-input";
20
- const libVersion = "17.2.1";
20
+ const libVersion = "17.2.3";
21
21
  addLibraryVersionToPerseusDebug(libName, libVersion);
22
22
 
23
23
  function _extends() {
@@ -383,6 +383,39 @@ function convertDotToTimesByLocale(convertDotToTimes) {
383
383
  const inJest = typeof process !== "undefined" && !!((_process = process) != null && (_process = _process.env) != null && _process.JEST_WORKER_ID);
384
384
  // Explicitly checking for undefined because Cypress throws an error
385
385
 
386
+ const mathQuillStrings = {
387
+ mathInputBox: i18n._("Math input box"),
388
+ ariaStaticStringsMap: {
389
+ before: obj => i18n._("before %(obj)s", {
390
+ obj
391
+ }),
392
+ after: obj => i18n._("after %(obj)s", {
393
+ obj
394
+ }),
395
+ "beginning of": obj => i18n._("beginning of %(obj)s", {
396
+ obj
397
+ }),
398
+ "end of": obj => i18n._("end of %(obj)s", {
399
+ obj
400
+ }),
401
+ Baseline: i18n._("Baseline"),
402
+ Superscript: i18n._("Superscript"),
403
+ selected: obj => i18n._("%(obj)s selected", {
404
+ obj
405
+ }),
406
+ "no answer": i18n._("no answer"),
407
+ "nothing selected": i18n._("nothing selected"),
408
+ "nothing to the right": i18n._("nothing to the right"),
409
+ "nothing to the left": i18n._("nothing to the left"),
410
+ "block is empty": i18n._("block is empty"),
411
+ "nothing above": i18n._("nothing above"),
412
+ labelValue: (label, value) => i18n._("%(label)s: %(value)s", {
413
+ label,
414
+ value
415
+ })
416
+ }
417
+ };
418
+
386
419
  // We only need one MathQuill instance (referred to as MQ in the docs)
387
420
  // and that contains some MQ constants and the MathField constructor
388
421
  const mathQuillInstance = MathQuill.getInterface(3);
@@ -431,9 +464,7 @@ const createBaseConfig = () => ({
431
464
  function createMathField(container, configCallback) {
432
465
  const baseConfig = createBaseConfig();
433
466
  const config = configCallback ? configCallback(baseConfig) : baseConfig;
434
- const mathField = mathQuillInstance.MathField(container, config)
435
- // translated in ./math-input.tsx
436
- .setAriaLabel(i18n._("Math input box"));
467
+ const mathField = mathQuillInstance.MathField(container, config).setAriaLabel(mathQuillStrings.mathInputBox).setAriaStringsOverrideMap(mathQuillStrings.ariaStaticStringsMap);
437
468
 
438
469
  // We should avoid running SpeechRuleEngine.setup() in Jest. It makes an
439
470
  // HTTP request to fetch non-english speech rules, and cannot be easily
@@ -2176,7 +2207,7 @@ class MathInput extends React.Component {
2176
2207
  // keyboard appear. It should only require one finger, which is how iOS works.
2177
2208
  // TODO(diedra): Fix the bug that is causing Android to require a two finger tap
2178
2209
  // to the open the keyboard, and then remove the second half of this label.
2179
- const ariaLabel = i18n._("Math input box") + " " + i18n._("Tap with one or two fingers to open keyboard");
2210
+ const ariaLabel = mathQuillStrings.mathInputBox + " " + i18n._("Tap with one or two fingers to open keyboard");
2180
2211
  return /*#__PURE__*/React.createElement(KeypadContext.Consumer, null, ({
2181
2212
  keypadActive,
2182
2213
  setKeypadActive