@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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @khanacademy/math-input
2
2
 
3
+ ## 6.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 71c631ea: Add keypad opened and closed analytics events
8
+ - Updated dependencies [71c631ea]
9
+ - @khanacademy/perseus-core@0.0.2
10
+
11
+ ## 6.0.1
12
+
13
+ ### Patch Changes
14
+
15
+ - 8d1745c1: Removed double focus outline from keypad buttons
16
+
3
17
  ## 6.0.0
4
18
 
5
19
  ### Major Changes
package/dist/es/index.js CHANGED
@@ -4,6 +4,7 @@ import { getDecimalSeparator } from '@khanacademy/wonder-blocks-i18n';
4
4
  import { entries } from '@khanacademy/wonder-stuff-core';
5
5
  import { StyleSheet, css } from 'aphrodite';
6
6
  import * as React from 'react';
7
+ import { useEffect } from 'react';
7
8
  import ReactDOM from 'react-dom';
8
9
  import $ from 'jquery';
9
10
  import MathQuill from 'mathquill';
@@ -4908,6 +4909,11 @@ const styles$8 = StyleSheet.create({
4908
4909
  width: 36,
4909
4910
  height: 3,
4910
4911
  marginLeft: 3
4912
+ },
4913
+ clickable: {
4914
+ ":focus": {
4915
+ outline: `none`
4916
+ }
4911
4917
  }
4912
4918
  });
4913
4919
  function imageTintColor(itemState, hovered, focused, pressed) {
@@ -4933,6 +4939,7 @@ class TabbarItem extends React.Component {
4933
4939
  onClick: onClick,
4934
4940
  disabled: itemState === "disabled",
4935
4941
  "aria-label": itemType,
4942
+ style: styles$8.clickable,
4936
4943
  "aria-selected": itemState === "active",
4937
4944
  role: "tab"
4938
4945
  }, ({
@@ -8263,7 +8270,7 @@ const KeypadButton = ({
8263
8270
  pressed
8264
8271
  }) => {
8265
8272
  return /*#__PURE__*/React.createElement(View$1, {
8266
- style: [styles$1.outerBoxBase, hovered && styles$1.outerBoxHover, pressed && styles$1.outerBoxPressed]
8273
+ style: [styles$1.outerBoxBase]
8267
8274
  }, /*#__PURE__*/React.createElement(View$1, {
8268
8275
  style: [styles$1.base, tintColor != null ? {
8269
8276
  background: tintColor
@@ -8289,7 +8296,7 @@ const styles$1 = StyleSheet.create({
8289
8296
  padding: 1
8290
8297
  },
8291
8298
  hovered: {
8292
- border: `1px solid ${Color.blue}`,
8299
+ border: `2px solid ${Color.blue}`,
8293
8300
  padding: 1,
8294
8301
  boxShadow: "none"
8295
8302
  },
@@ -8312,16 +8319,13 @@ const styles$1 = StyleSheet.create({
8312
8319
  borderRadius: 7,
8313
8320
  border: "2px solid transparent"
8314
8321
  },
8315
- outerBoxHover: {
8316
- border: `2px solid ${Color.blue}`
8317
- },
8318
- outerBoxPressed: {
8319
- border: "2px solid #1B50B3"
8320
- },
8321
8322
  clickable: {
8322
8323
  width: "100%",
8323
8324
  height: "100%",
8324
- boxSizing: "border-box"
8325
+ boxSizing: "border-box",
8326
+ ":focus": {
8327
+ outline: `none`
8328
+ }
8325
8329
  }
8326
8330
  });
8327
8331
 
@@ -8594,6 +8598,7 @@ function allPages(props) {
8594
8598
  // keypad to learners for entering math expressions.
8595
8599
  function Keypad(props) {
8596
8600
  const [selectedPage, setSelectedPage] = React.useState("Numbers");
8601
+ const [isMounted, setIsMounted] = React.useState(false);
8597
8602
  const availablePages = allPages(props);
8598
8603
  const {
8599
8604
  onClickKey,
@@ -8605,8 +8610,31 @@ function Keypad(props) {
8605
8610
  logarithms,
8606
8611
  basicRelations,
8607
8612
  advancedRelations,
8608
- showDismiss
8613
+ showDismiss,
8614
+ sendEvent
8609
8615
  } = props;
8616
+ useEffect(() => {
8617
+ if (!isMounted) {
8618
+ sendEvent({
8619
+ type: "math-input:keypad-opened",
8620
+ payload: {
8621
+ virtualKeypadVersion: "MATH_INPUT_KEYPAD_V2"
8622
+ }
8623
+ });
8624
+ setIsMounted(true);
8625
+ }
8626
+ return () => {
8627
+ if (isMounted) {
8628
+ sendEvent({
8629
+ type: "math-input:keypad-closed",
8630
+ payload: {
8631
+ virtualKeypadVersion: "MATH_INPUT_KEYPAD_V2"
8632
+ }
8633
+ });
8634
+ setIsMounted(false);
8635
+ }
8636
+ };
8637
+ }, [sendEvent, isMounted]);
8610
8638
  return /*#__PURE__*/React.createElement(View$1, null, /*#__PURE__*/React.createElement(Tabbar, {
8611
8639
  items: availablePages,
8612
8640
  selectedItem: selectedPage,