@khanacademy/perseus 22.0.0 → 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, {
@@ -2320,9 +2324,15 @@ class Expression extends React.Component {
2320
2324
  this.refs.input.focus();
2321
2325
  };
2322
2326
  this.blurInputPath = inputPath => {
2327
+ var _this$refs$input;
2323
2328
  // eslint-disable-next-line react/no-string-refs
2324
2329
  // @ts-expect-error - TS2339 - Property 'blur' does not exist on type 'ReactInstance'.
2325
- 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
+ }
2326
2336
  };
2327
2337
  this.getInputPaths = () => {
2328
2338
  // The widget itself is an input, so we return a single empty list to
@@ -21718,10 +21728,16 @@ class SimpleKeypadInput extends React.Component {
21718
21728
  }
21719
21729
 
21720
21730
  blur() {
21731
+ var _this$refs$input;
21732
+ // eslint-disable-next-line react/no-string-refs
21721
21733
  // @ts-expect-error - TS2339 - Property 'blur' does not exist on type 'ReactInstance'.
21722
- 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
+ }
21723
21740
  }
21724
-
21725
21741
  getValue() {
21726
21742
  return this.props.value;
21727
21743
  }
@@ -21866,9 +21882,15 @@ class InputNumber extends React.Component {
21866
21882
  this.refs.input.focus();
21867
21883
  };
21868
21884
  this.blurInputPath = inputPath => {
21885
+ var _this$refs$input;
21869
21886
  // eslint-disable-next-line react/no-string-refs
21870
21887
  // @ts-expect-error - TS2339 - Property 'blur' does not exist on type 'ReactInstance'.
21871
- 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
+ }
21872
21894
  };
21873
21895
  this.getInputPaths = () => {
21874
21896
  // The widget itself is an input, so we return a single empty list to
@@ -28868,6 +28890,7 @@ function scaleCommandBy(scaleFactor) {
28868
28890
  // don't want that.
28869
28891
  const arrowPath = pathBuilder().move(-3, 4).curve(-2.75, 2.5, 0, 0.25, 0.75, 0).curve(0, -0.25, -2.75, -2.5, -3, -4).scale(1.4).build();
28870
28892
  function Arrowhead(props) {
28893
+ var _props$color;
28871
28894
  const [point] = useTransform([props.x, props.y]);
28872
28895
  return /*#__PURE__*/React.createElement("g", {
28873
28896
  transform: `translate(${point[0]} ${point[1]}) rotate(${-props.angle})`
@@ -28877,7 +28900,7 @@ function Arrowhead(props) {
28877
28900
  d: arrowPath,
28878
28901
  fill: "none",
28879
28902
  style: {
28880
- stroke: "inherit"
28903
+ stroke: (_props$color = props.color) != null ? _props$color : "inherit"
28881
28904
  },
28882
28905
  strokeLinejoin: "round",
28883
28906
  strokeLinecap: "round"
@@ -29472,22 +29495,27 @@ function AxisArrows() {
29472
29495
  const {
29473
29496
  range: [[xMin, xMax], [yMin, yMax]]
29474
29497
  } = useGraphConfig();
29498
+ const axisColor = "var(--mafs-fg)";
29475
29499
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Arrowhead, {
29500
+ color: axisColor,
29501
+ x: xMin,
29502
+ y: 0,
29503
+ angle: 180
29504
+ }), /*#__PURE__*/React__default.createElement(Arrowhead, {
29505
+ color: axisColor,
29476
29506
  x: xMax,
29477
29507
  y: 0,
29478
29508
  angle: 0
29479
29509
  }), /*#__PURE__*/React__default.createElement(Arrowhead, {
29510
+ color: axisColor,
29480
29511
  x: 0,
29481
29512
  y: yMin,
29482
- angle: 90
29483
- }), /*#__PURE__*/React__default.createElement(Arrowhead, {
29484
- x: xMin,
29485
- y: 0,
29486
- angle: 180
29513
+ angle: 270
29487
29514
  }), /*#__PURE__*/React__default.createElement(Arrowhead, {
29515
+ color: axisColor,
29488
29516
  x: 0,
29489
29517
  y: yMax,
29490
- angle: 270
29518
+ angle: 90
29491
29519
  }));
29492
29520
  }
29493
29521
 
@@ -29613,7 +29641,7 @@ const Grid = props => {
29613
29641
  return props.markings === "none" ? null : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Coordinates.Cartesian, {
29614
29642
  xAxis: axisOptions(props, 0),
29615
29643
  yAxis: axisOptions(props, 1)
29616
- }), props.markings === "graph" && /*#__PURE__*/React.createElement(AxisArrows, null),
29644
+ }),
29617
29645
  // Only render the axis ticks and arrows if the markings are set to a full "graph"
29618
29646
  props.markings === "graph" && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(AxisTicks, {
29619
29647
  range: props.range,
@@ -43009,7 +43037,7 @@ const init = function init(options) {
43009
43037
 
43010
43038
  // This file is processed by a Rollup plugin (replace) to inject the production
43011
43039
  const libName = "@khanacademy/perseus";
43012
- const libVersion = "22.0.0";
43040
+ const libVersion = "22.0.2";
43013
43041
  addLibraryVersionToPerseusDebug(libName, libVersion);
43014
43042
 
43015
43043
  const apiVersion = {