@khanacademy/math-input 5.0.1 → 6.0.1

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.
Files changed (34) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/components/input/cursor-contexts.d.ts +9 -9
  3. package/dist/components/input/cursor-contexts.js.flow +7 -8
  4. package/dist/components/input/math-wrapper.d.ts +1 -1
  5. package/dist/components/input/math-wrapper.js.flow +8 -2
  6. package/dist/components/input/mathquill-helpers.d.ts +1 -1
  7. package/dist/components/input/mathquill-helpers.js.flow +1 -1
  8. package/dist/components/keypad/index.d.ts +4 -3
  9. package/dist/components/keypad/index.js.flow +7 -3
  10. package/dist/components/keypad/shared-keys.d.ts +1 -1
  11. package/dist/components/keypad/shared-keys.js.flow +4 -1
  12. package/dist/components/keypad-legacy/expression-keypad.d.ts +1 -1
  13. package/dist/components/keypad-legacy/expression-keypad.js.flow +4 -1
  14. package/dist/components/keypad-legacy/fraction-keypad.d.ts +1 -1
  15. package/dist/components/keypad-legacy/fraction-keypad.js.flow +4 -1
  16. package/dist/es/index.js +34 -21
  17. package/dist/es/index.js.map +1 -1
  18. package/dist/index.js +34 -21
  19. package/dist/index.js.map +1 -1
  20. package/dist/types.d.ts +2 -2
  21. package/dist/types.js.flow +2 -2
  22. package/package.json +1 -1
  23. package/src/components/input/cursor-contexts.ts +9 -9
  24. package/src/components/input/mathquill-helpers.ts +1 -1
  25. package/src/components/keypad/__tests__/keypad.test.tsx +37 -2
  26. package/src/components/keypad/index.tsx +10 -4
  27. package/src/components/keypad/keypad-button.tsx +6 -14
  28. package/src/components/keypad/keypad-mathquill.stories.tsx +3 -3
  29. package/src/components/keypad/shared-keys.tsx +4 -2
  30. package/src/components/keypad-legacy/expression-keypad.tsx +1 -1
  31. package/src/components/keypad-legacy/fraction-keypad.tsx +1 -1
  32. package/src/components/tabbar/item.tsx +6 -0
  33. package/src/types.ts +2 -3
  34. package/tsconfig-build.tsbuildinfo +1 -1
package/dist/index.js CHANGED
@@ -61,16 +61,25 @@ var Redux__namespace = /*#__PURE__*/_interopNamespace(Redux);
61
61
  * the radical.
62
62
  */
63
63
 
64
- let CursorContext = /*#__PURE__*/function (CursorContext) {
65
- CursorContext["NONE"] = "NONE";
66
- CursorContext["IN_PARENS"] = "IN_PARENS";
67
- CursorContext["IN_SUPER_SCRIPT"] = "IN_SUPER_SCRIPT";
68
- CursorContext["IN_SUB_SCRIPT"] = "IN_SUB_SCRIPT";
69
- CursorContext["IN_NUMERATOR"] = "IN_NUMERATOR";
70
- CursorContext["IN_DENOMINATOR"] = "IN_DENOMINATOR";
71
- CursorContext["BEFORE_FRACTION"] = "BEFORE_FRACTION";
72
- return CursorContext;
73
- }({});
64
+ const CursorContext = {
65
+ // The cursor is not in any of the other viable contexts.
66
+ NONE: "NONE",
67
+ // The cursor is within a set of parentheses.
68
+ IN_PARENS: "IN_PARENS",
69
+ // The cursor is within a superscript (e.g., an exponent).
70
+ IN_SUPER_SCRIPT: "IN_SUPER_SCRIPT",
71
+ // The cursor is within a subscript (e.g., the base of a custom logarithm).
72
+ IN_SUB_SCRIPT: "IN_SUB_SCRIPT",
73
+ // The cursor is in the numerator of a fraction.
74
+ IN_NUMERATOR: "IN_NUMERATOR",
75
+ // The cursor is in the denominator of a fraction.
76
+ IN_DENOMINATOR: "IN_DENOMINATOR",
77
+ // The cursor is sitting before a fraction; that is, the cursor is within
78
+ // what looks to be a mixed number preceding a fraction. This will only be
79
+ // the case when the only math between the cursor and the fraction to its
80
+ // write is non-leaf math (numbers and variables).
81
+ BEFORE_FRACTION: "BEFORE_FRACTION"
82
+ };
74
83
 
75
84
  function _defineProperty(obj, key, value) {
76
85
  key = _toPropertyKey(key);
@@ -5042,6 +5051,11 @@ const styles$8 = aphrodite.StyleSheet.create({
5042
5051
  width: 36,
5043
5052
  height: 3,
5044
5053
  marginLeft: 3
5054
+ },
5055
+ clickable: {
5056
+ ":focus": {
5057
+ outline: "none"
5058
+ }
5045
5059
  }
5046
5060
  });
5047
5061
  function imageTintColor(itemState, hovered, focused, pressed) {
@@ -5067,6 +5081,7 @@ class TabbarItem extends React__namespace.Component {
5067
5081
  onClick: onClick,
5068
5082
  disabled: itemState === "disabled",
5069
5083
  "aria-label": itemType,
5084
+ style: styles$8.clickable,
5070
5085
  "aria-selected": itemState === "active",
5071
5086
  role: "tab"
5072
5087
  }, _ref => {
@@ -8453,7 +8468,7 @@ const KeypadButton = _ref => {
8453
8468
  pressed
8454
8469
  } = _ref2;
8455
8470
  return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
8456
- style: [styles$1.outerBoxBase, hovered && styles$1.outerBoxHover, pressed && styles$1.outerBoxPressed]
8471
+ style: [styles$1.outerBoxBase]
8457
8472
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
8458
8473
  style: [styles$1.base, tintColor != null ? {
8459
8474
  background: tintColor
@@ -8479,7 +8494,7 @@ const styles$1 = aphrodite.StyleSheet.create({
8479
8494
  padding: 1
8480
8495
  },
8481
8496
  hovered: {
8482
- border: "1px solid ".concat(Color__default["default"].blue),
8497
+ border: "2px solid ".concat(Color__default["default"].blue),
8483
8498
  padding: 1,
8484
8499
  boxShadow: "none"
8485
8500
  },
@@ -8502,16 +8517,13 @@ const styles$1 = aphrodite.StyleSheet.create({
8502
8517
  borderRadius: 7,
8503
8518
  border: "2px solid transparent"
8504
8519
  },
8505
- outerBoxHover: {
8506
- border: "2px solid ".concat(Color__default["default"].blue)
8507
- },
8508
- outerBoxPressed: {
8509
- border: "2px solid #1B50B3"
8510
- },
8511
8520
  clickable: {
8512
8521
  width: "100%",
8513
8522
  height: "100%",
8514
- boxSizing: "border-box"
8523
+ boxSizing: "border-box",
8524
+ ":focus": {
8525
+ outline: "none"
8526
+ }
8515
8527
  }
8516
8528
  });
8517
8529
 
@@ -8794,7 +8806,8 @@ function Keypad(props) {
8794
8806
  preAlgebra,
8795
8807
  logarithms,
8796
8808
  basicRelations,
8797
- advancedRelations
8809
+ advancedRelations,
8810
+ showDismiss
8798
8811
  } = props;
8799
8812
  return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, null, /*#__PURE__*/React__namespace.createElement(Tabbar, {
8800
8813
  items: availablePages,
@@ -8803,7 +8816,7 @@ function Keypad(props) {
8803
8816
  setSelectedPage(tabbarItem);
8804
8817
  },
8805
8818
  style: styles.tabbar,
8806
- onClickClose: () => onClickKey("DISMISS")
8819
+ onClickClose: showDismiss ? () => onClickKey("DISMISS") : undefined
8807
8820
  }), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
8808
8821
  style: styles.grid,
8809
8822
  role: "grid",