@khanacademy/math-input 12.1.1 → 13.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/CHANGELOG.md +11 -0
- package/dist/components/keypad/keypad.d.ts +1 -1
- package/dist/components/keypad/mobile-keypad.d.ts +1 -0
- package/dist/components/keypad/shared-keys.d.ts +1 -1
- package/dist/es/index.js +28 -8
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +28 -8
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/keypad/__tests__/__snapshots__/keypad.test.tsx.snap +84 -26
- package/src/components/keypad/__tests__/keypad-v2-mathquill.test.tsx +1 -1
- package/src/components/keypad/__tests__/keypad.test.tsx +30 -0
- package/src/components/keypad/keypad-button.tsx +3 -0
- package/src/components/keypad/keypad-mathquill.stories.tsx +1 -1
- package/src/components/keypad/keypad.stories.tsx +2 -2
- package/src/components/keypad/keypad.tsx +3 -3
- package/src/components/keypad/mobile-keypad.tsx +20 -3
- package/src/components/keypad/shared-keys.tsx +4 -4
- package/src/full-math-input.stories.tsx +14 -2
- package/src/index.ts +1 -1
- package/src/types.ts +1 -0
- package/tsconfig-build.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @khanacademy/math-input
|
|
2
2
|
|
|
3
|
+
## 13.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 609aeb0a: Ensured that the multiplication symbol in our keypad matches the selected symbol from content.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 91f88d0b: Bugfix: v1 and v2 keypad using different FRAC configs
|
|
12
|
+
- 4aac71b3: Hide v2 mobile MathInput keypad when it's never been activated
|
|
13
|
+
|
|
3
14
|
## 12.1.1
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -8,7 +8,7 @@ export type Props = {
|
|
|
8
8
|
cursorContext?: typeof CursorContext[keyof typeof CursorContext];
|
|
9
9
|
showDismiss?: boolean;
|
|
10
10
|
expandedView?: boolean;
|
|
11
|
-
|
|
11
|
+
convertDotToTimes?: boolean;
|
|
12
12
|
divisionKey?: boolean;
|
|
13
13
|
trigonometry?: boolean;
|
|
14
14
|
preAlgebra?: boolean;
|
|
@@ -5,7 +5,7 @@ type Props = {
|
|
|
5
5
|
onClickKey: ClickKeyCallback;
|
|
6
6
|
selectedPage: KeypadPageType;
|
|
7
7
|
cursorContext?: typeof CursorContext[keyof typeof CursorContext];
|
|
8
|
-
|
|
8
|
+
convertDotToTimes?: boolean;
|
|
9
9
|
divisionKey?: boolean;
|
|
10
10
|
};
|
|
11
11
|
export default function SharedKeys(props: Props): JSX.Element;
|
package/dist/es/index.js
CHANGED
|
@@ -4371,6 +4371,10 @@ const KeypadButton$2 = ({
|
|
|
4371
4371
|
gridColumn: coord[0] + 1,
|
|
4372
4372
|
gridRow: coord[1] + 1
|
|
4373
4373
|
}, style)
|
|
4374
|
+
// Unfortunately the CDOT and TIMES buttons are identical in the DOM
|
|
4375
|
+
// apart from the ICON SVG, so we need to use testId.
|
|
4376
|
+
,
|
|
4377
|
+
testId: keyConfig.id
|
|
4374
4378
|
}, /*#__PURE__*/React.createElement(Clickable, {
|
|
4375
4379
|
onClick: e => onClickKey(keyConfig.id, e),
|
|
4376
4380
|
style: styles$g.clickable,
|
|
@@ -4869,7 +4873,7 @@ function SharedKeys(props) {
|
|
|
4869
4873
|
onClickKey,
|
|
4870
4874
|
cursorContext,
|
|
4871
4875
|
divisionKey,
|
|
4872
|
-
|
|
4876
|
+
convertDotToTimes,
|
|
4873
4877
|
selectedPage
|
|
4874
4878
|
} = props;
|
|
4875
4879
|
const cursorKeyConfig = getCursorContextConfig(cursorContext);
|
|
@@ -4887,12 +4891,12 @@ function SharedKeys(props) {
|
|
|
4887
4891
|
coord: [5, 0],
|
|
4888
4892
|
secondary: true
|
|
4889
4893
|
}), /*#__PURE__*/React.createElement(KeypadButton$2, {
|
|
4890
|
-
keyConfig: KeyConfigs.
|
|
4894
|
+
keyConfig: KeyConfigs.FRAC,
|
|
4891
4895
|
onClickKey: onClickKey,
|
|
4892
4896
|
coord: fractionCoord,
|
|
4893
4897
|
secondary: true
|
|
4894
4898
|
}), /*#__PURE__*/React.createElement(KeypadButton$2, {
|
|
4895
|
-
keyConfig:
|
|
4899
|
+
keyConfig: convertDotToTimes ? KeyConfigs.TIMES : KeyConfigs.CDOT,
|
|
4896
4900
|
onClickKey: onClickKey,
|
|
4897
4901
|
coord: [4, 1],
|
|
4898
4902
|
secondary: true
|
|
@@ -4963,7 +4967,7 @@ function Keypad$2(props) {
|
|
|
4963
4967
|
onClickKey,
|
|
4964
4968
|
cursorContext,
|
|
4965
4969
|
extraKeys,
|
|
4966
|
-
|
|
4970
|
+
convertDotToTimes,
|
|
4967
4971
|
divisionKey,
|
|
4968
4972
|
preAlgebra,
|
|
4969
4973
|
logarithms,
|
|
@@ -5041,7 +5045,7 @@ function Keypad$2(props) {
|
|
|
5041
5045
|
}), !fractionsOnly && /*#__PURE__*/React.createElement(SharedKeys, {
|
|
5042
5046
|
onClickKey: onClickKey,
|
|
5043
5047
|
cursorContext: cursorContext,
|
|
5044
|
-
|
|
5048
|
+
convertDotToTimes: convertDotToTimes,
|
|
5045
5049
|
divisionKey: divisionKey,
|
|
5046
5050
|
selectedPage: selectedPage
|
|
5047
5051
|
})), expandedView && /*#__PURE__*/React.createElement(NavigationPad$1, {
|
|
@@ -5101,7 +5105,8 @@ class MobileKeypad extends React.Component {
|
|
|
5101
5105
|
this.hasMounted = false;
|
|
5102
5106
|
this.state = {
|
|
5103
5107
|
active: false,
|
|
5104
|
-
containerWidth: 0
|
|
5108
|
+
containerWidth: 0,
|
|
5109
|
+
hasBeenActivated: false
|
|
5105
5110
|
};
|
|
5106
5111
|
this._resize = () => {
|
|
5107
5112
|
var _this$_containerRef$c;
|
|
@@ -5122,7 +5127,8 @@ class MobileKeypad extends React.Component {
|
|
|
5122
5127
|
};
|
|
5123
5128
|
this.activate = () => {
|
|
5124
5129
|
this.setState({
|
|
5125
|
-
active: true
|
|
5130
|
+
active: true,
|
|
5131
|
+
hasBeenActivated: true
|
|
5126
5132
|
});
|
|
5127
5133
|
};
|
|
5128
5134
|
this.dismiss = () => {
|
|
@@ -5200,6 +5206,7 @@ class MobileKeypad extends React.Component {
|
|
|
5200
5206
|
} = this.props;
|
|
5201
5207
|
const {
|
|
5202
5208
|
active,
|
|
5209
|
+
hasBeenActivated,
|
|
5203
5210
|
containerWidth,
|
|
5204
5211
|
cursor,
|
|
5205
5212
|
keypadConfig
|
|
@@ -5209,9 +5216,22 @@ class MobileKeypad extends React.Component {
|
|
|
5209
5216
|
styles$c.keypadContainer, active && styles$c.activeKeypadContainer,
|
|
5210
5217
|
// styles passed as props
|
|
5211
5218
|
...(Array.isArray(style) ? style : [style])];
|
|
5219
|
+
|
|
5220
|
+
// If the keypad is yet to have ever been activated, we keep it invisible
|
|
5221
|
+
// so as to avoid, e.g., the keypad flashing at the bottom of the page
|
|
5222
|
+
// during the initial render.
|
|
5223
|
+
// Done inline (dynamicStyle) since stylesheets might not be loaded yet.
|
|
5224
|
+
let dynamicStyle = {};
|
|
5225
|
+
if (!active && !hasBeenActivated) {
|
|
5226
|
+
dynamicStyle = {
|
|
5227
|
+
visibility: "hidden"
|
|
5228
|
+
};
|
|
5229
|
+
}
|
|
5212
5230
|
const isExpression = (keypadConfig == null ? void 0 : keypadConfig.keypadType) === "EXPRESSION";
|
|
5231
|
+
const convertDotToTimes = keypadConfig == null ? void 0 : keypadConfig.times;
|
|
5213
5232
|
return /*#__PURE__*/React.createElement(View, {
|
|
5214
5233
|
style: containerStyle,
|
|
5234
|
+
dynamicStyle: dynamicStyle,
|
|
5215
5235
|
forwardRef: this._containerRef,
|
|
5216
5236
|
ref: element => {
|
|
5217
5237
|
if (!this.hasMounted && element) {
|
|
@@ -5238,7 +5258,7 @@ class MobileKeypad extends React.Component {
|
|
|
5238
5258
|
onClickKey: key => this._handleClickKey(key),
|
|
5239
5259
|
cursorContext: cursor == null ? void 0 : cursor.context,
|
|
5240
5260
|
fractionsOnly: !isExpression,
|
|
5241
|
-
|
|
5261
|
+
convertDotToTimes: convertDotToTimes,
|
|
5242
5262
|
divisionKey: isExpression,
|
|
5243
5263
|
trigonometry: isExpression,
|
|
5244
5264
|
preAlgebra: isExpression,
|