@khanacademy/math-input 6.0.0 → 6.0.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/CHANGELOG.md +14 -0
- package/dist/es/index.js +38 -10
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +37 -10
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- 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-button.tsx +6 -14
- package/src/components/keypad/keypad-mathquill.stories.tsx +10 -1
- package/src/components/tabbar/item.tsx +6 -0
- package/tsconfig-build.tsbuildinfo +1 -1
package/dist/index.js
CHANGED
|
@@ -5051,6 +5051,11 @@ const styles$8 = aphrodite.StyleSheet.create({
|
|
|
5051
5051
|
width: 36,
|
|
5052
5052
|
height: 3,
|
|
5053
5053
|
marginLeft: 3
|
|
5054
|
+
},
|
|
5055
|
+
clickable: {
|
|
5056
|
+
":focus": {
|
|
5057
|
+
outline: "none"
|
|
5058
|
+
}
|
|
5054
5059
|
}
|
|
5055
5060
|
});
|
|
5056
5061
|
function imageTintColor(itemState, hovered, focused, pressed) {
|
|
@@ -5076,6 +5081,7 @@ class TabbarItem extends React__namespace.Component {
|
|
|
5076
5081
|
onClick: onClick,
|
|
5077
5082
|
disabled: itemState === "disabled",
|
|
5078
5083
|
"aria-label": itemType,
|
|
5084
|
+
style: styles$8.clickable,
|
|
5079
5085
|
"aria-selected": itemState === "active",
|
|
5080
5086
|
role: "tab"
|
|
5081
5087
|
}, _ref => {
|
|
@@ -8462,7 +8468,7 @@ const KeypadButton = _ref => {
|
|
|
8462
8468
|
pressed
|
|
8463
8469
|
} = _ref2;
|
|
8464
8470
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
8465
|
-
style: [styles$1.outerBoxBase
|
|
8471
|
+
style: [styles$1.outerBoxBase]
|
|
8466
8472
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
8467
8473
|
style: [styles$1.base, tintColor != null ? {
|
|
8468
8474
|
background: tintColor
|
|
@@ -8488,7 +8494,7 @@ const styles$1 = aphrodite.StyleSheet.create({
|
|
|
8488
8494
|
padding: 1
|
|
8489
8495
|
},
|
|
8490
8496
|
hovered: {
|
|
8491
|
-
border: "
|
|
8497
|
+
border: "2px solid ".concat(Color__default["default"].blue),
|
|
8492
8498
|
padding: 1,
|
|
8493
8499
|
boxShadow: "none"
|
|
8494
8500
|
},
|
|
@@ -8511,16 +8517,13 @@ const styles$1 = aphrodite.StyleSheet.create({
|
|
|
8511
8517
|
borderRadius: 7,
|
|
8512
8518
|
border: "2px solid transparent"
|
|
8513
8519
|
},
|
|
8514
|
-
outerBoxHover: {
|
|
8515
|
-
border: "2px solid ".concat(Color__default["default"].blue)
|
|
8516
|
-
},
|
|
8517
|
-
outerBoxPressed: {
|
|
8518
|
-
border: "2px solid #1B50B3"
|
|
8519
|
-
},
|
|
8520
8520
|
clickable: {
|
|
8521
8521
|
width: "100%",
|
|
8522
8522
|
height: "100%",
|
|
8523
|
-
boxSizing: "border-box"
|
|
8523
|
+
boxSizing: "border-box",
|
|
8524
|
+
":focus": {
|
|
8525
|
+
outline: "none"
|
|
8526
|
+
}
|
|
8524
8527
|
}
|
|
8525
8528
|
});
|
|
8526
8529
|
|
|
@@ -8793,6 +8796,7 @@ function allPages(props) {
|
|
|
8793
8796
|
// keypad to learners for entering math expressions.
|
|
8794
8797
|
function Keypad(props) {
|
|
8795
8798
|
const [selectedPage, setSelectedPage] = React__namespace.useState("Numbers");
|
|
8799
|
+
const [isMounted, setIsMounted] = React__namespace.useState(false);
|
|
8796
8800
|
const availablePages = allPages(props);
|
|
8797
8801
|
const {
|
|
8798
8802
|
onClickKey,
|
|
@@ -8804,8 +8808,31 @@ function Keypad(props) {
|
|
|
8804
8808
|
logarithms,
|
|
8805
8809
|
basicRelations,
|
|
8806
8810
|
advancedRelations,
|
|
8807
|
-
showDismiss
|
|
8811
|
+
showDismiss,
|
|
8812
|
+
sendEvent
|
|
8808
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]);
|
|
8809
8836
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, null, /*#__PURE__*/React__namespace.createElement(Tabbar, {
|
|
8810
8837
|
items: availablePages,
|
|
8811
8838
|
selectedItem: selectedPage,
|