@khanacademy/math-input 17.2.1 → 17.2.2

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.js CHANGED
@@ -47,7 +47,7 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
47
47
 
48
48
  // This file is processed by a Rollup plugin (replace) to inject the production
49
49
  const libName = "@khanacademy/math-input";
50
- const libVersion = "17.2.1";
50
+ const libVersion = "17.2.2";
51
51
  perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
52
52
 
53
53
  function _extends() {
@@ -413,6 +413,39 @@ function convertDotToTimesByLocale(convertDotToTimes) {
413
413
  const inJest = typeof process !== "undefined" && !!process?.env?.JEST_WORKER_ID;
414
414
  // Explicitly checking for undefined because Cypress throws an error
415
415
 
416
+ const mathQuillStrings = {
417
+ mathInputBox: i18n__namespace._("Math input box"),
418
+ ariaStaticStringsMap: {
419
+ before: obj => i18n__namespace._("before %(obj)s", {
420
+ obj
421
+ }),
422
+ after: obj => i18n__namespace._("after %(obj)s", {
423
+ obj
424
+ }),
425
+ "beginning of": obj => i18n__namespace._("beginning of %(obj)s", {
426
+ obj
427
+ }),
428
+ "end of": obj => i18n__namespace._("end of %(obj)s", {
429
+ obj
430
+ }),
431
+ Baseline: i18n__namespace._("Baseline"),
432
+ Superscript: i18n__namespace._("Superscript"),
433
+ selected: obj => i18n__namespace._("%(obj)s selected", {
434
+ obj
435
+ }),
436
+ "no answer": i18n__namespace._("no answer"),
437
+ "nothing selected": i18n__namespace._("nothing selected"),
438
+ "nothing to the right": i18n__namespace._("nothing to the right"),
439
+ "nothing to the left": i18n__namespace._("nothing to the left"),
440
+ "block is empty": i18n__namespace._("block is empty"),
441
+ "nothing above": i18n__namespace._("nothing above"),
442
+ labelValue: (label, value) => i18n__namespace._("%(label)s: %(value)s", {
443
+ label,
444
+ value
445
+ })
446
+ }
447
+ };
448
+
416
449
  // We only need one MathQuill instance (referred to as MQ in the docs)
417
450
  // and that contains some MQ constants and the MathField constructor
418
451
  const mathQuillInstance = MathQuill__default["default"].getInterface(3);
@@ -461,9 +494,7 @@ const createBaseConfig = () => ({
461
494
  function createMathField(container, configCallback) {
462
495
  const baseConfig = createBaseConfig();
463
496
  const config = configCallback ? configCallback(baseConfig) : baseConfig;
464
- const mathField = mathQuillInstance.MathField(container, config)
465
- // translated in ./math-input.tsx
466
- .setAriaLabel(i18n__namespace._("Math input box"));
497
+ const mathField = mathQuillInstance.MathField(container, config).setAriaLabel(mathQuillStrings.mathInputBox).setAriaStringsOverrideMap(mathQuillStrings.ariaStaticStringsMap);
467
498
 
468
499
  // We should avoid running SpeechRuleEngine.setup() in Jest. It makes an
469
500
  // HTTP request to fetch non-english speech rules, and cannot be easily
@@ -2209,7 +2240,7 @@ class MathInput extends React__namespace.Component {
2209
2240
  // keyboard appear. It should only require one finger, which is how iOS works.
2210
2241
  // TODO(diedra): Fix the bug that is causing Android to require a two finger tap
2211
2242
  // to the open the keyboard, and then remove the second half of this label.
2212
- const ariaLabel = i18n__namespace._("Math input box") + " " + i18n__namespace._("Tap with one or two fingers to open keyboard");
2243
+ const ariaLabel = mathQuillStrings.mathInputBox + " " + i18n__namespace._("Tap with one or two fingers to open keyboard");
2213
2244
  return /*#__PURE__*/React__namespace.createElement(KeypadContext.Consumer, null, _ref => {
2214
2245
  let {
2215
2246
  keypadActive,