@khanacademy/perseus 22.0.1 → 22.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.
@@ -83,6 +83,7 @@ declare class MathInput extends React.Component<Props, State> {
83
83
  }>;
84
84
  context: React.ContextType<typeof MathInputI18nContext>;
85
85
  inputRef: React.RefObject<InnerMathInput>;
86
+ blur(): void;
86
87
  focus(): void;
87
88
  insert(value: any): void;
88
89
  render(): JSX.Element;
package/dist/es/index.js CHANGED
@@ -542,13 +542,17 @@ class MathInput extends React.Component {
542
542
  super(...args);
543
543
  this.inputRef = /*#__PURE__*/React.createRef();
544
544
  }
545
- focus() {
545
+ blur() {
546
546
  var _this$inputRef$curren;
547
- (_this$inputRef$curren = this.inputRef.current) == null || _this$inputRef$curren.focus();
547
+ (_this$inputRef$curren = this.inputRef.current) == null || _this$inputRef$curren.blur();
548
548
  }
549
- insert(value) {
549
+ focus() {
550
550
  var _this$inputRef$curren2;
551
- (_this$inputRef$curren2 = this.inputRef.current) == null || _this$inputRef$curren2.insert(value);
551
+ (_this$inputRef$curren2 = this.inputRef.current) == null || _this$inputRef$curren2.focus();
552
+ }
553
+ insert(value) {
554
+ var _this$inputRef$curren3;
555
+ (_this$inputRef$curren3 = this.inputRef.current) == null || _this$inputRef$curren3.insert(value);
552
556
  }
553
557
  render() {
554
558
  return /*#__PURE__*/React.createElement(InnerMathInput, _extends({}, this.props, {
@@ -2323,7 +2327,12 @@ class Expression extends React.Component {
2323
2327
  var _this$refs$input;
2324
2328
  // eslint-disable-next-line react/no-string-refs
2325
2329
  // @ts-expect-error - TS2339 - Property 'blur' does not exist on type 'ReactInstance'.
2326
- (_this$refs$input = this.refs.input) == null || _this$refs$input.blur();
2330
+ if (typeof ((_this$refs$input = this.refs.input) == null ? void 0 : _this$refs$input.blur) === "function") {
2331
+ var _this$refs$input2;
2332
+ // eslint-disable-next-line react/no-string-refs
2333
+ // @ts-expect-error - TS2339 - Property 'blur' does not exist on type 'ReactInstance'.
2334
+ (_this$refs$input2 = this.refs.input) == null || _this$refs$input2.blur();
2335
+ }
2327
2336
  };
2328
2337
  this.getInputPaths = () => {
2329
2338
  // The widget itself is an input, so we return a single empty list to
@@ -21720,10 +21729,15 @@ class SimpleKeypadInput extends React.Component {
21720
21729
 
21721
21730
  blur() {
21722
21731
  var _this$refs$input;
21732
+ // eslint-disable-next-line react/no-string-refs
21723
21733
  // @ts-expect-error - TS2339 - Property 'blur' does not exist on type 'ReactInstance'.
21724
- (_this$refs$input = this.refs.input) == null || _this$refs$input.blur(); // eslint-disable-line react/no-string-refs
21734
+ if (typeof ((_this$refs$input = this.refs.input) == null ? void 0 : _this$refs$input.blur) === "function") {
21735
+ var _this$refs$input2;
21736
+ // eslint-disable-next-line react/no-string-refs
21737
+ // @ts-expect-error - TS2339 - Property 'blur' does not exist on type 'ReactInstance'.
21738
+ (_this$refs$input2 = this.refs.input) == null || _this$refs$input2.blur();
21739
+ }
21725
21740
  }
21726
-
21727
21741
  getValue() {
21728
21742
  return this.props.value;
21729
21743
  }
@@ -21871,7 +21885,12 @@ class InputNumber extends React.Component {
21871
21885
  var _this$refs$input;
21872
21886
  // eslint-disable-next-line react/no-string-refs
21873
21887
  // @ts-expect-error - TS2339 - Property 'blur' does not exist on type 'ReactInstance'.
21874
- (_this$refs$input = this.refs.input) == null || _this$refs$input.blur();
21888
+ if (typeof ((_this$refs$input = this.refs.input) == null ? void 0 : _this$refs$input.blur) === "function") {
21889
+ var _this$refs$input2;
21890
+ // eslint-disable-next-line react/no-string-refs
21891
+ // @ts-expect-error - TS2339 - Property 'blur' does not exist on type 'ReactInstance'.
21892
+ (_this$refs$input2 = this.refs.input) == null || _this$refs$input2.blur();
21893
+ }
21875
21894
  };
21876
21895
  this.getInputPaths = () => {
21877
21896
  // The widget itself is an input, so we return a single empty list to
@@ -43018,7 +43037,7 @@ const init = function init(options) {
43018
43037
 
43019
43038
  // This file is processed by a Rollup plugin (replace) to inject the production
43020
43039
  const libName = "@khanacademy/perseus";
43021
- const libVersion = "22.0.1";
43040
+ const libVersion = "22.0.2";
43022
43041
  addLibraryVersionToPerseusDebug(libName, libVersion);
43023
43042
 
43024
43043
  const apiVersion = {