@khanacademy/math-input 6.0.1 → 6.0.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.
- package/CHANGELOG.md +14 -0
- package/dist/es/index.js +26 -1
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +25 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/keypad/__tests__/keypad-v2-mathquill.test.tsx +63 -4
- package/src/components/keypad/index.tsx +22 -0
- package/src/components/keypad/keypad-mathquill.stories.tsx +10 -1
- package/tsconfig-build.tsbuildinfo +1 -1
package/dist/index.js
CHANGED
|
@@ -8796,6 +8796,7 @@ function allPages(props) {
|
|
|
8796
8796
|
// keypad to learners for entering math expressions.
|
|
8797
8797
|
function Keypad(props) {
|
|
8798
8798
|
const [selectedPage, setSelectedPage] = React__namespace.useState("Numbers");
|
|
8799
|
+
const [isMounted, setIsMounted] = React__namespace.useState(false);
|
|
8799
8800
|
const availablePages = allPages(props);
|
|
8800
8801
|
const {
|
|
8801
8802
|
onClickKey,
|
|
@@ -8807,8 +8808,31 @@ function Keypad(props) {
|
|
|
8807
8808
|
logarithms,
|
|
8808
8809
|
basicRelations,
|
|
8809
8810
|
advancedRelations,
|
|
8810
|
-
showDismiss
|
|
8811
|
+
showDismiss,
|
|
8812
|
+
sendEvent
|
|
8811
8813
|
} = props;
|
|
8814
|
+
React.useEffect(() => {
|
|
8815
|
+
if (!isMounted) {
|
|
8816
|
+
sendEvent({
|
|
8817
|
+
type: "math-input:keypad-opened",
|
|
8818
|
+
payload: {
|
|
8819
|
+
virtualKeypadVersion: "MATH_INPUT_KEYPAD_V2"
|
|
8820
|
+
}
|
|
8821
|
+
});
|
|
8822
|
+
setIsMounted(true);
|
|
8823
|
+
}
|
|
8824
|
+
return () => {
|
|
8825
|
+
if (isMounted) {
|
|
8826
|
+
sendEvent({
|
|
8827
|
+
type: "math-input:keypad-closed",
|
|
8828
|
+
payload: {
|
|
8829
|
+
virtualKeypadVersion: "MATH_INPUT_KEYPAD_V2"
|
|
8830
|
+
}
|
|
8831
|
+
});
|
|
8832
|
+
setIsMounted(false);
|
|
8833
|
+
}
|
|
8834
|
+
};
|
|
8835
|
+
}, [sendEvent, isMounted]);
|
|
8812
8836
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, null, /*#__PURE__*/React__namespace.createElement(Tabbar, {
|
|
8813
8837
|
items: availablePages,
|
|
8814
8838
|
selectedItem: selectedPage,
|