@khanacademy/math-input 21.1.1 → 21.1.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.
@@ -4,7 +4,7 @@ import type { ClickKeyCallback } from "../../types";
4
4
  import type { CursorContext } from "../input/cursor-contexts";
5
5
  import type { AnalyticsEventHandlerFn } from "@khanacademy/perseus-core";
6
6
  export type Props = {
7
- extraKeys: ReadonlyArray<Key>;
7
+ extraKeys?: ReadonlyArray<Key>;
8
8
  cursorContext?: (typeof CursorContext)[keyof typeof CursorContext];
9
9
  showDismiss?: boolean;
10
10
  expandedView?: boolean;
@@ -19,10 +19,4 @@ export type Props = {
19
19
  onClickKey: ClickKeyCallback;
20
20
  onAnalyticsEvent: AnalyticsEventHandlerFn;
21
21
  };
22
- declare function Keypad(props: Props): React.JSX.Element;
23
- declare namespace Keypad {
24
- var defaultProps: {
25
- extraKeys: never[];
26
- };
27
- }
28
- export default Keypad;
22
+ export default function Keypad({ extraKeys, ...props }: Props): React.JSX.Element;
package/dist/es/index.js CHANGED
@@ -16,7 +16,7 @@ import PropTypes from 'prop-types';
16
16
 
17
17
  // This file is processed by a Rollup plugin (replace) to inject the production
18
18
  const libName = "@khanacademy/math-input";
19
- const libVersion = "21.1.1";
19
+ const libVersion = "21.1.3";
20
20
  addLibraryVersionToPerseusDebug(libName, libVersion);
21
21
 
22
22
  function _extends() {
@@ -2340,6 +2340,16 @@ const inlineStyles = {
2340
2340
  }
2341
2341
  };
2342
2342
 
2343
+ function _objectWithoutPropertiesLoose(r, e) {
2344
+ if (null == r) return {};
2345
+ var t = {};
2346
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
2347
+ if (e.includes(n)) continue;
2348
+ t[n] = r[n];
2349
+ }
2350
+ return t;
2351
+ }
2352
+
2343
2353
  const IconAsset = function IconAsset({
2344
2354
  tintColor,
2345
2355
  type
@@ -5070,9 +5080,7 @@ function SharedKeys(props) {
5070
5080
  }));
5071
5081
  }
5072
5082
 
5073
- const defaultProps = {
5074
- extraKeys: []
5075
- };
5083
+ const _excluded = ["extraKeys"];
5076
5084
  function getAvailableTabs(props) {
5077
5085
  var _props$extraKeys;
5078
5086
  // We don't want to show any available tabs on the fractions keypad
@@ -5096,7 +5104,11 @@ function getAvailableTabs(props) {
5096
5104
 
5097
5105
  // The main (v2) Keypad. Use this component to present an accessible, onscreen
5098
5106
  // keypad to learners for entering math expressions.
5099
- function Keypad(props) {
5107
+ function Keypad(_ref) {
5108
+ let {
5109
+ extraKeys = []
5110
+ } = _ref,
5111
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
5100
5112
  // If we're using the Fractions keypad, we want to default select that page
5101
5113
  // Otherwise, we want to default to the Numbers page
5102
5114
  const defaultSelectedPage = props.fractionsOnly ? "Fractions" : "Numbers";
@@ -5104,11 +5116,12 @@ function Keypad(props) {
5104
5116
  const [isMounted, setIsMounted] = React.useState(false);
5105
5117
 
5106
5118
  // We don't want any tabs available on mobile fractions keypad
5107
- const availableTabs = getAvailableTabs(props);
5119
+ const availableTabs = getAvailableTabs(_extends({}, props, {
5120
+ extraKeys
5121
+ }));
5108
5122
  const {
5109
5123
  onClickKey,
5110
5124
  cursorContext,
5111
- extraKeys,
5112
5125
  convertDotToTimes,
5113
5126
  divisionKey,
5114
5127
  preAlgebra,
@@ -5192,7 +5205,6 @@ function Keypad(props) {
5192
5205
  onClickKey: onClickKey
5193
5206
  }))));
5194
5207
  }
5195
- Keypad.defaultProps = defaultProps;
5196
5208
  const styles$1 = StyleSheet.create({
5197
5209
  keypadOuterContainer: {
5198
5210
  display: "flex",