@khanacademy/math-input 22.2.0 → 22.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/es/index.js +3 -36
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +3 -35
- package/dist/index.js.map +1 -1
- package/dist/utils.d.ts +0 -8
- package/package.json +13 -13
package/dist/es/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addLibraryVersionToPerseusDebug } from '@khanacademy/perseus-core';
|
|
1
|
+
import { addLibraryVersionToPerseusDebug, getDecimalSeparator } from '@khanacademy/perseus-core';
|
|
2
2
|
import { KeypadContext } from '@khanacademy/keypad-context';
|
|
3
3
|
import { color } from '@khanacademy/wonder-blocks-tokens';
|
|
4
4
|
import { entries } from '@khanacademy/wonder-stuff-core';
|
|
@@ -16,7 +16,7 @@ import PropTypes from 'prop-types';
|
|
|
16
16
|
|
|
17
17
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
18
18
|
const libName = "@khanacademy/math-input";
|
|
19
|
-
const libVersion = "22.2.
|
|
19
|
+
const libVersion = "22.2.2";
|
|
20
20
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
21
21
|
|
|
22
22
|
function _extends() {
|
|
@@ -394,39 +394,6 @@ let CursorContext = /*#__PURE__*/function (CursorContext) {
|
|
|
394
394
|
}({});
|
|
395
395
|
|
|
396
396
|
var _process;
|
|
397
|
-
const DecimalSeparator = {
|
|
398
|
-
COMMA: ",",
|
|
399
|
-
PERIOD: "."
|
|
400
|
-
};
|
|
401
|
-
|
|
402
|
-
/**
|
|
403
|
-
* Get the character used for separating decimals.
|
|
404
|
-
*/
|
|
405
|
-
const getDecimalSeparator = locale => {
|
|
406
|
-
var _match$;
|
|
407
|
-
let separator = DecimalSeparator.PERIOD;
|
|
408
|
-
switch (locale) {
|
|
409
|
-
// TODO(somewhatabstract): Remove this when Chrome supports the `ka`
|
|
410
|
-
// locale properly.
|
|
411
|
-
// https://github.com/formatjs/formatjs/issues/1526#issuecomment-559891201
|
|
412
|
-
//
|
|
413
|
-
// Supported locales in Chrome:
|
|
414
|
-
// https://source.chromium.org/chromium/chromium/src/+/master:third_party/icu/scripts/chrome_ui_languages.list
|
|
415
|
-
case "ka":
|
|
416
|
-
separator = ",";
|
|
417
|
-
break;
|
|
418
|
-
default:
|
|
419
|
-
const numberWithDecimalSeparator = 1.1;
|
|
420
|
-
// TODO(FEI-3647): Update to use .formatToParts() once we no longer have to
|
|
421
|
-
// support Safari 12.
|
|
422
|
-
const match = new Intl.NumberFormat(locale).format(numberWithDecimalSeparator)
|
|
423
|
-
// 0x661 is ARABIC-INDIC DIGIT ONE
|
|
424
|
-
// 0x6F1 is EXTENDED ARABIC-INDIC DIGIT ONE
|
|
425
|
-
.match(/[^\d\u0661\u06F1]/);
|
|
426
|
-
separator = (_match$ = match == null ? void 0 : match[0]) != null ? _match$ : ".";
|
|
427
|
-
}
|
|
428
|
-
return separator === "," ? DecimalSeparator.COMMA : DecimalSeparator.PERIOD;
|
|
429
|
-
};
|
|
430
397
|
const CDOT_ONLY = ["az", "cs", "da", "de", "hu", "hy", "kk", "ky", "lt", "lv", "nb", "sk", "sr", "sv", "uz"];
|
|
431
398
|
const TIMES_ONLY = ["fr", "tr", "pt-pt"];
|
|
432
399
|
|
|
@@ -3222,7 +3189,7 @@ function ButtonAsset({
|
|
|
3222
3189
|
case "PERIOD":
|
|
3223
3190
|
// Different locales use different symbols for the decimal separator
|
|
3224
3191
|
// (, vs .)
|
|
3225
|
-
if (id === "DECIMAL" && getDecimalSeparator(locale)
|
|
3192
|
+
if (id === "DECIMAL" && getDecimalSeparator(locale) !== ".") {
|
|
3226
3193
|
// comma decimal separator
|
|
3227
3194
|
return /*#__PURE__*/React.createElement("svg", {
|
|
3228
3195
|
width: "40",
|