@khanacademy/perseus-editor 2.15.3 → 2.15.5

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.
Files changed (61) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/editor-page.d.ts +4 -10
  3. package/dist/editor.d.ts +2 -2
  4. package/dist/es/index.js +362 -360
  5. package/dist/es/index.js.map +1 -1
  6. package/dist/index.js +426 -425
  7. package/dist/index.js.map +1 -1
  8. package/dist/widgets/interaction-editor/function-editor.d.ts +26 -0
  9. package/dist/widgets/interaction-editor/index.d.ts +2 -0
  10. package/dist/widgets/interaction-editor/label-editor.d.ts +22 -0
  11. package/dist/widgets/interaction-editor/line-editor.d.ts +30 -0
  12. package/dist/widgets/interaction-editor/movable-line-editor.d.ts +32 -0
  13. package/dist/widgets/interaction-editor/movable-point-editor.d.ts +28 -0
  14. package/dist/widgets/interaction-editor/parametric-editor.d.ts +28 -0
  15. package/dist/widgets/interaction-editor/point-editor.d.ts +20 -0
  16. package/dist/widgets/interaction-editor/rectangle-editor.d.ts +24 -0
  17. package/dist/widgets/interactive-graph-editor.d.ts +92 -92
  18. package/package.json +2 -2
  19. package/src/__stories__/editor-page.stories.tsx +65 -0
  20. package/src/__stories__/editor.stories.tsx +2 -4
  21. package/src/editor-page.tsx +5 -11
  22. package/src/editor.tsx +2 -2
  23. package/src/widgets/__stories__/categorizer-editor.stories.tsx +24 -0
  24. package/src/widgets/__stories__/definition-editor.stories.tsx +18 -0
  25. package/src/widgets/__stories__/dropdown-editor.stories.tsx +18 -0
  26. package/src/widgets/__stories__/explanation-editor.stories.tsx +18 -0
  27. package/src/widgets/__stories__/input-number-editor.stories.tsx +18 -0
  28. package/src/widgets/__stories__/interaction-editor.stories.tsx +24 -0
  29. package/src/widgets/__stories__/matcher-editor.stories.tsx +18 -0
  30. package/src/widgets/__stories__/number-line-editor.stories.tsx +18 -0
  31. package/src/widgets/__stories__/numeric-input-editor.stories.tsx +18 -0
  32. package/src/widgets/__stories__/radio-editor.stories.tsx +3 -3
  33. package/src/widgets/__stories__/sorter-editor.stories.tsx +18 -0
  34. package/src/widgets/__tests__/categorizer-editor.test.tsx +51 -0
  35. package/src/widgets/__tests__/definition-editor.test.tsx +41 -0
  36. package/src/widgets/__tests__/dropdown-editor.test.tsx +57 -0
  37. package/src/widgets/__tests__/explanation-editor.test.tsx +59 -0
  38. package/src/widgets/__tests__/input-number-editor.test.tsx +128 -0
  39. package/src/widgets/__tests__/matcher-editor.test.tsx +47 -0
  40. package/src/widgets/__tests__/number-line-editor.test.tsx +144 -0
  41. package/src/widgets/__tests__/numeric-input-editor.test.tsx +177 -0
  42. package/src/widgets/__tests__/radio-editor.test.tsx +118 -0
  43. package/src/widgets/__tests__/sorter-editor.test.tsx +55 -0
  44. package/src/widgets/dropdown-editor.tsx +1 -0
  45. package/src/widgets/input-number-editor.tsx +2 -0
  46. package/src/widgets/interaction-editor/function-editor.tsx +111 -0
  47. package/src/widgets/interaction-editor/index.ts +3 -0
  48. package/src/widgets/{interaction-editor.tsx → interaction-editor/interaction-editor.tsx} +14 -768
  49. package/src/widgets/interaction-editor/label-editor.tsx +91 -0
  50. package/src/widgets/interaction-editor/line-editor.tsx +129 -0
  51. package/src/widgets/interaction-editor/movable-line-editor.tsx +125 -0
  52. package/src/widgets/interaction-editor/movable-point-editor.tsx +92 -0
  53. package/src/widgets/interaction-editor/parametric-editor.tsx +122 -0
  54. package/src/widgets/interaction-editor/point-editor.tsx +79 -0
  55. package/src/widgets/interaction-editor/rectangle-editor.tsx +105 -0
  56. package/src/widgets/number-line-editor.tsx +16 -5
  57. package/src/widgets/numeric-input-editor.tsx +2 -0
  58. package/tsconfig-build.tsbuildinfo +1 -1
  59. package/dist/widgets/{interaction → interaction-editor}/constraint-editor.d.ts +0 -0
  60. package/dist/widgets/{interaction-editor.d.ts → interaction-editor/interaction-editor.d.ts} +1 -1
  61. /package/src/widgets/{interaction → interaction-editor}/constraint-editor.tsx +0 -0
package/dist/es/index.js CHANGED
@@ -24,7 +24,7 @@ import * as i18n$1 from '@khanacademy/wonder-blocks-i18n';
24
24
 
25
25
  // This file is processed by a Rollup plugin (replace) to inject the production
26
26
  const libName = "@khanacademy/perseus-editor";
27
- const libVersion = "2.15.3";
27
+ const libVersion = "2.15.5";
28
28
  addLibraryVersionToPerseusDebug(libName, libVersion);
29
29
 
30
30
  function _extends() {
@@ -26326,7 +26326,8 @@ class DropdownEditor extends React.Component {
26326
26326
  value: choice.content
26327
26327
  }), /*#__PURE__*/React.createElement("a", {
26328
26328
  href: "#",
26329
- className: "simple-button orange"
26329
+ className: "simple-button orange",
26330
+ "aria-label": "Delete choice"
26330
26331
  // eslint-disable-next-line react/jsx-no-bind
26331
26332
  // @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
26332
26333
  ,
@@ -27398,7 +27399,7 @@ const {
27398
27399
  RangeInput: RangeInput$5
27399
27400
  } = components;
27400
27401
  const {
27401
- getDependencies: getDependencies$1
27402
+ getDependencies: getDependencies$9
27402
27403
  } = Dependencies;
27403
27404
  const defaultBackgroundImage$3 = {
27404
27405
  url: null,
@@ -27715,7 +27716,7 @@ const GraphSettings = createReactClass({
27715
27716
  const scale = [KhanMath.roundTo(2, Util.scaleFromExtent(this.props.range[0], this.props.box[0])), KhanMath.roundTo(2, Util.scaleFromExtent(this.props.range[1], this.props.box[1]))];
27716
27717
  const {
27717
27718
  TeX
27718
- } = getDependencies$1();
27719
+ } = getDependencies$9();
27719
27720
  return /*#__PURE__*/React.createElement("div", null, _.contains(this.props.editableSettings, "canvas") && /*#__PURE__*/React.createElement("div", {
27720
27721
  className: "graph-settings"
27721
27722
  }, /*#__PURE__*/React.createElement("div", {
@@ -28536,6 +28537,7 @@ class InputNumberEditor extends React.Component {
28536
28537
  type: "text",
28537
28538
  disabled: !this.props.inexact,
28538
28539
  defaultValue: this.props.maxError,
28540
+ "aria-label": "Max error",
28539
28541
  onBlur: e => {
28540
28542
  const ans = "" + (Util.firstNumericalParse(e.target.value) || 0);
28541
28543
  e.target.value = ans;
@@ -28550,7 +28552,8 @@ class InputNumberEditor extends React.Component {
28550
28552
  this.props.onChange({
28551
28553
  answerType: e.target.value
28552
28554
  });
28553
- }
28555
+ },
28556
+ "aria-label": "Answer type"
28554
28557
  }, answerTypeOptions), /*#__PURE__*/React.createElement(InfoTip$f, null, /*#__PURE__*/React.createElement("p", null, "Use the default \"Numbers\" unless the answer must be in a specific form (e.g., question is about converting decimals to fractions)."))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", null, "Width", " ", /*#__PURE__*/React.createElement("select", {
28555
28558
  value: this.props.size,
28556
28559
  onChange: e => {
@@ -28586,136 +28589,107 @@ InputNumberEditor.defaultProps = {
28586
28589
  };
28587
28590
 
28588
28591
  const {
28589
- ButtonGroup: ButtonGroup$2,
28590
- MathInput: MathInput$1,
28591
- NumberInput: NumberInput$c
28592
+ MathInput: MathInput$8,
28593
+ NumberInput: NumberInput$g
28592
28594
  } = components;
28593
- class ConstraintEditor extends React.Component {
28594
- constructor(...args) {
28595
- super(...args);
28596
- this.change = propName => {
28597
- return Changeable.change.call(this, propName);
28595
+ const {
28596
+ getDependencies: getDependencies$8
28597
+ } = Dependencies;
28598
+ //
28599
+ // Editor for function plots
28600
+ //
28601
+ // TODO(eater): Factor this out
28602
+ //
28603
+ class FunctionEditor extends React.Component {
28604
+ constructor(..._args) {
28605
+ super(..._args);
28606
+ this.change = (...args) => {
28607
+ return Changeable.change.apply(this, args);
28608
+ };
28609
+ this.serialize = () => {
28610
+ return EditorJsonify.serialize.call(this);
28598
28611
  };
28599
28612
  }
28600
28613
  render() {
28601
28614
  const {
28602
28615
  TeX
28603
- } = Dependencies.getDependencies();
28616
+ } = getDependencies$8();
28604
28617
  const analyticsStub = {
28605
28618
  onAnalyticsEvent: () => Promise.resolve()
28606
28619
  };
28607
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
28608
- className: "perseus-widget-row"
28609
- }, "Constraint:", " ", /*#__PURE__*/React.createElement(ButtonGroup$2, {
28610
- value: this.props.constraint,
28611
- allowEmpty: false,
28612
- buttons: [{
28613
- value: "none",
28614
- content: "None"
28615
- }, {
28616
- value: "snap",
28617
- content: "Snap"
28618
- }, {
28619
- value: "x",
28620
- content: "x="
28621
- }, {
28622
- value: "y",
28623
- content: "y="
28624
- }],
28625
- onChange: this.change("constraint")
28626
- })), this.props.constraint === "snap" && /*#__PURE__*/React.createElement("div", {
28627
- className: "perseus-widget-row"
28628
- }, "Snap:", " ", /*#__PURE__*/React.createElement(NumberInput$c, {
28629
- value: this.props.snap,
28630
- placeholder: 0,
28631
- onChange: this.change("snap")
28632
- })), this.props.constraint === "x" && /*#__PURE__*/React.createElement("div", {
28633
- className: "graph-settings"
28634
- }, /*#__PURE__*/React.createElement("div", {
28635
- className: "perseus-widget-row"
28636
- }, /*#__PURE__*/React.createElement(TeX, null, "x="), " ", /*#__PURE__*/React.createElement(MathInput$1, {
28637
- buttonsVisible: "never",
28638
- value: this.props.constraintFn,
28639
- onChange: this.change("constraintFn"),
28640
- analytics: analyticsStub
28641
- }))), this.props.constraint === "y" && /*#__PURE__*/React.createElement("div", {
28620
+ return /*#__PURE__*/React.createElement("div", {
28642
28621
  className: "graph-settings"
28643
28622
  }, /*#__PURE__*/React.createElement("div", {
28644
28623
  className: "perseus-widget-row"
28645
- }, /*#__PURE__*/React.createElement(TeX, null, "y="), " ", /*#__PURE__*/React.createElement(MathInput$1, {
28624
+ }, /*#__PURE__*/React.createElement(TeX, null, this.props.funcName + "(x)="), " ", /*#__PURE__*/React.createElement(MathInput$8, {
28646
28625
  buttonsVisible: "never",
28647
- value: this.props.constraintFn,
28648
- onChange: this.change("constraintFn"),
28626
+ value: this.props.value,
28627
+ onChange: this.change("value"),
28649
28628
  analytics: analyticsStub
28650
- }))), "Ensure these are set so nothing can be dragged off the canvas:", /*#__PURE__*/React.createElement("div", {
28651
- className: "perseus-widget-row"
28652
- }, /*#__PURE__*/React.createElement("div", {
28629
+ })), /*#__PURE__*/React.createElement("div", {
28653
28630
  className: "perseus-widget-row"
28654
- }, /*#__PURE__*/React.createElement(TeX, null, "x \\in \\Large["), " ", /*#__PURE__*/React.createElement(MathInput$1, {
28631
+ }, "Range: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput$8, {
28655
28632
  buttonsVisible: "never",
28656
- value: this.props.constraintXMin,
28657
- onChange: this.change("constraintXMin"),
28633
+ value: this.props.rangeMin,
28634
+ onChange: this.change("rangeMin"),
28658
28635
  analytics: analyticsStub
28659
- }), /*#__PURE__*/React.createElement(TeX, null, ", "), " ", /*#__PURE__*/React.createElement(MathInput$1, {
28636
+ }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput$8, {
28660
28637
  buttonsVisible: "never",
28661
- value: this.props.constraintXMax,
28662
- onChange: this.change("constraintXMax"),
28638
+ value: this.props.rangeMax,
28639
+ onChange: this.change("rangeMax"),
28663
28640
  analytics: analyticsStub
28664
- }), " ", /*#__PURE__*/React.createElement(TeX, null, "\\Large]"))), /*#__PURE__*/React.createElement("div", {
28641
+ }), /*#__PURE__*/React.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React.createElement("div", {
28665
28642
  className: "perseus-widget-row"
28666
- }, /*#__PURE__*/React.createElement("div", {
28643
+ }, /*#__PURE__*/React.createElement(ColorPicker, {
28644
+ value: this.props.color,
28645
+ onChange: this.change("color")
28646
+ })), /*#__PURE__*/React.createElement("div", {
28667
28647
  className: "perseus-widget-row"
28668
- }, /*#__PURE__*/React.createElement(TeX, null, "y \\in \\Large["), " ", /*#__PURE__*/React.createElement(MathInput$1, {
28669
- buttonsVisible: "never",
28670
- value: this.props.constraintYMin,
28671
- onChange: this.change("constraintYMin"),
28672
- analytics: analyticsStub
28673
- }), /*#__PURE__*/React.createElement(TeX, null, ", "), " ", /*#__PURE__*/React.createElement(MathInput$1, {
28674
- buttonsVisible: "never",
28675
- value: this.props.constraintYMax,
28676
- onChange: this.change("constraintYMax"),
28677
- analytics: analyticsStub
28678
- }), " ", /*#__PURE__*/React.createElement(TeX, null, "\\Large]"))));
28648
+ }, /*#__PURE__*/React.createElement(DashPicker, {
28649
+ value: this.props.strokeDasharray,
28650
+ onChange: this.change("strokeDasharray")
28651
+ })), /*#__PURE__*/React.createElement("div", {
28652
+ className: "perseus-widget-row"
28653
+ }, /*#__PURE__*/React.createElement("div", {
28654
+ className: "perseus-widget-left-col"
28655
+ }, "Width:", " ", /*#__PURE__*/React.createElement(NumberInput$g, {
28656
+ value: this.props.strokeWidth,
28657
+ placeholder: 2,
28658
+ onChange: this.change("strokeWidth")
28659
+ }))));
28679
28660
  }
28680
28661
  }
28681
- ConstraintEditor.defaultProps = {
28682
- constraint: "none",
28683
- snap: 0.5,
28684
- constraintFn: "0",
28685
- constraintXMin: "-10",
28686
- constraintXMax: "10",
28687
- constraintYMin: "-10",
28688
- constraintYMax: "10"
28662
+ FunctionEditor.propTypes = _extends({}, Changeable.propTypes, {
28663
+ value: PropTypes.string,
28664
+ rangeMin: PropTypes.string,
28665
+ rangeMax: PropTypes.string,
28666
+ color: PropTypes.string,
28667
+ strokeDashArray: PropTypes.string,
28668
+ strokeWidth: PropTypes.number
28669
+ });
28670
+ FunctionEditor.defaultProps = {
28671
+ value: "x",
28672
+ rangeMin: "-10",
28673
+ rangeMax: "10",
28674
+ color: KhanColors.BLUE,
28675
+ strokeDasharray: "",
28676
+ strokeWidth: 2
28689
28677
  };
28690
28678
 
28691
28679
  const {
28692
- MathInput,
28693
- NumberInput: NumberInput$b,
28680
+ MathInput: MathInput$7,
28694
28681
  TextInput: TextInput$5
28695
28682
  } = components;
28696
28683
  const {
28697
- getDependencies
28684
+ getDependencies: getDependencies$7
28698
28685
  } = Dependencies;
28699
- const {
28700
- unescapeMathMode
28701
- } = Util;
28702
- const defaultInteractionProps = {
28703
- graph: {
28704
- box: [400, 400],
28705
- labels: ["x", "y"],
28706
- range: [[-10, 10], [-10, 10]],
28707
- tickStep: [1, 1],
28708
- gridStep: [1, 1],
28709
- markings: "graph"
28710
- },
28711
- elements: []
28712
- };
28713
28686
  //
28714
- // Editor for non-interactive points
28687
+ // Editor for labels
28715
28688
  //
28716
- // TODO(eater): Factor this out
28689
+ // TODO(eater): Factor this out maybe?
28690
+ // TODO(eater): Add text direction
28717
28691
  //
28718
- class PointEditor extends React.Component {
28692
+ class LabelEditor extends React.Component {
28719
28693
  constructor(..._args) {
28720
28694
  super(..._args);
28721
28695
  this.change = (...args) => {
@@ -28728,7 +28702,7 @@ class PointEditor extends React.Component {
28728
28702
  render() {
28729
28703
  const {
28730
28704
  TeX
28731
- } = getDependencies();
28705
+ } = getDependencies$7();
28732
28706
  const analyticsStub = {
28733
28707
  onAnalyticsEvent: () => Promise.resolve()
28734
28708
  };
@@ -28736,48 +28710,60 @@ class PointEditor extends React.Component {
28736
28710
  className: "graph-settings"
28737
28711
  }, /*#__PURE__*/React.createElement("div", {
28738
28712
  className: "perseus-widget-row"
28739
- }, "Coordinate: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput, {
28713
+ }, /*#__PURE__*/React.createElement(TextInput$5, {
28714
+ value: this.props.label,
28715
+ onChange: this.change("label"),
28716
+ style: {
28717
+ width: "100%"
28718
+ }
28719
+ })), /*#__PURE__*/React.createElement("div", {
28720
+ className: "perseus-widget-row"
28721
+ }, "Location: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput$7, {
28740
28722
  buttonsVisible: "never",
28741
- value: this.props.coordX
28742
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28743
- ,
28723
+ value: this.props.coordX,
28744
28724
  onChange: this.change("coordX"),
28745
28725
  analytics: analyticsStub
28746
- }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput, {
28726
+ }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput$7, {
28747
28727
  buttonsVisible: "never",
28748
- value: this.props.coordY
28749
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28750
- ,
28728
+ value: this.props.coordY,
28751
28729
  onChange: this.change("coordY"),
28752
28730
  analytics: analyticsStub
28753
28731
  }), /*#__PURE__*/React.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React.createElement("div", {
28754
28732
  className: "perseus-widget-row"
28755
28733
  }, /*#__PURE__*/React.createElement(ColorPicker, {
28756
- value: this.props.color
28757
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28758
- ,
28734
+ value: this.props.color,
28759
28735
  onChange: this.change("color")
28760
28736
  })));
28761
28737
  }
28762
28738
  }
28763
- PointEditor.propTypes = _extends({}, Changeable.propTypes, {
28739
+ LabelEditor.propTypes = _extends({}, Changeable.propTypes, {
28740
+ color: PropTypes.string,
28764
28741
  coordX: PropTypes.string,
28765
28742
  coordY: PropTypes.string,
28766
- color: PropTypes.string
28743
+ label: PropTypes.string
28767
28744
  });
28768
- PointEditor.defaultProps = {
28745
+ LabelEditor.defaultProps = {
28769
28746
  coordX: "0",
28770
28747
  coordY: "0",
28771
- color: KhanColors.BLACK
28748
+ color: KhanColors.BLACK,
28749
+ label: "\\phi"
28772
28750
  };
28751
+
28752
+ const {
28753
+ MathInput: MathInput$6,
28754
+ NumberInput: NumberInput$f
28755
+ } = components;
28756
+ const {
28757
+ getDependencies: getDependencies$6
28758
+ } = Dependencies;
28773
28759
  //
28774
28760
  // Editor for non-interactive line segments
28775
28761
  //
28776
28762
  // TODO(eater): Factor this out
28777
28763
  //
28778
28764
  class LineEditor extends React.Component {
28779
- constructor(..._args2) {
28780
- super(..._args2);
28765
+ constructor(..._args) {
28766
+ super(..._args);
28781
28767
  this.change = (...args) => {
28782
28768
  return Changeable.change.apply(this, args);
28783
28769
  };
@@ -28788,7 +28774,7 @@ class LineEditor extends React.Component {
28788
28774
  render() {
28789
28775
  const {
28790
28776
  TeX
28791
- } = getDependencies();
28777
+ } = getDependencies$6();
28792
28778
  const analyticsStub = {
28793
28779
  onAnalyticsEvent: () => Promise.resolve()
28794
28780
  };
@@ -28796,64 +28782,48 @@ class LineEditor extends React.Component {
28796
28782
  className: "graph-settings"
28797
28783
  }, /*#__PURE__*/React.createElement("div", {
28798
28784
  className: "perseus-widget-row"
28799
- }, "Start: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput, {
28785
+ }, "Start: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput$6, {
28800
28786
  buttonsVisible: "never",
28801
- value: this.props.startX
28802
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28803
- ,
28787
+ value: this.props.startX,
28804
28788
  onChange: this.change("startX"),
28805
28789
  analytics: analyticsStub
28806
- }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput, {
28790
+ }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput$6, {
28807
28791
  buttonsVisible: "never",
28808
- value: this.props.startY
28809
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28810
- ,
28792
+ value: this.props.startY,
28811
28793
  onChange: this.change("startY"),
28812
28794
  analytics: analyticsStub
28813
28795
  }), /*#__PURE__*/React.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React.createElement("div", {
28814
28796
  className: "perseus-widget-row"
28815
- }, "End: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput, {
28797
+ }, "End: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput$6, {
28816
28798
  buttonsVisible: "never",
28817
- value: this.props.endX
28818
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28819
- ,
28799
+ value: this.props.endX,
28820
28800
  onChange: this.change("endX"),
28821
28801
  analytics: analyticsStub
28822
- }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput, {
28802
+ }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput$6, {
28823
28803
  buttonsVisible: "never",
28824
- value: this.props.endY
28825
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28826
- ,
28804
+ value: this.props.endY,
28827
28805
  onChange: this.change("endY"),
28828
28806
  analytics: analyticsStub
28829
28807
  }), /*#__PURE__*/React.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React.createElement("div", {
28830
28808
  className: "perseus-widget-row"
28831
28809
  }, /*#__PURE__*/React.createElement(ColorPicker, {
28832
- value: this.props.color
28833
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28834
- ,
28810
+ value: this.props.color,
28835
28811
  onChange: this.change("color")
28836
28812
  })), /*#__PURE__*/React.createElement("div", {
28837
28813
  className: "perseus-widget-row"
28838
28814
  }, /*#__PURE__*/React.createElement(DashPicker, {
28839
- value: this.props.strokeDasharray
28840
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28841
- ,
28815
+ value: this.props.strokeDasharray,
28842
28816
  onChange: this.change("strokeDasharray")
28843
28817
  }), "\xA0 \xA0", /*#__PURE__*/React.createElement(ArrowPicker, {
28844
- value: this.props.arrows
28845
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28846
- ,
28818
+ value: this.props.arrows,
28847
28819
  onChange: this.change("arrows")
28848
28820
  })), /*#__PURE__*/React.createElement("div", {
28849
28821
  className: "perseus-widget-row"
28850
28822
  }, /*#__PURE__*/React.createElement("div", {
28851
28823
  className: "perseus-widget-left-col"
28852
- }, "Width:", " ", /*#__PURE__*/React.createElement(NumberInput$b, {
28824
+ }, "Width:", " ", /*#__PURE__*/React.createElement(NumberInput$f, {
28853
28825
  value: this.props.strokeWidth,
28854
- placeholder: 2
28855
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
28856
- ,
28826
+ placeholder: 2,
28857
28827
  onChange: this.change("strokeWidth")
28858
28828
  }))));
28859
28829
  }
@@ -28878,62 +28848,101 @@ LineEditor.defaultProps = {
28878
28848
  arrows: "",
28879
28849
  strokeWidth: 2
28880
28850
  };
28881
- //
28882
- // Editor for interactive movable points
28883
- //
28884
- // TODO(eater): Factor this out
28885
- // TODO(eater): Rethink how constraints are represented
28886
- //
28887
- class MovablePointEditor extends React.Component {
28888
- constructor(..._args3) {
28889
- super(..._args3);
28890
- this.change = (...args) => {
28891
- return Changeable.change.apply(this, args);
28892
- };
28893
- this.serialize = () => {
28894
- return EditorJsonify.serialize.call(this);
28851
+
28852
+ const {
28853
+ ButtonGroup: ButtonGroup$2,
28854
+ MathInput: MathInput$5,
28855
+ NumberInput: NumberInput$e
28856
+ } = components;
28857
+ class ConstraintEditor extends React.Component {
28858
+ constructor(...args) {
28859
+ super(...args);
28860
+ this.change = propName => {
28861
+ return Changeable.change.call(this, propName);
28895
28862
  };
28896
28863
  }
28897
28864
  render() {
28898
28865
  const {
28899
28866
  TeX
28900
- } = getDependencies();
28867
+ } = Dependencies.getDependencies();
28901
28868
  const analyticsStub = {
28902
28869
  onAnalyticsEvent: () => Promise.resolve()
28903
28870
  };
28904
- return /*#__PURE__*/React.createElement("div", {
28905
- className: "graph-settings"
28906
- }, /*#__PURE__*/React.createElement("div", {
28907
- className: "perseus-widget-row"
28908
- }, "Start: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput, {
28909
- buttonsVisible: "never",
28910
- value: this.props.startX,
28911
- onChange: this.change("startX"),
28912
- analytics: analyticsStub
28913
- }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput, {
28914
- buttonsVisible: "never",
28915
- value: this.props.startY,
28916
- onChange: this.change("startY"),
28917
- analytics: analyticsStub
28918
- }), /*#__PURE__*/React.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React.createElement("div", {
28871
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
28919
28872
  className: "perseus-widget-row"
28920
- }, "Update ", /*#__PURE__*/React.createElement(TeX, null, "(x_n, y_n)"), " for ", /*#__PURE__*/React.createElement(TeX, null, "n ="), " ", /*#__PURE__*/React.createElement(NumberInput$b, {
28921
- value: this.props.varSubscript,
28922
- placeholder: 0,
28923
- onChange: this.change("varSubscript")
28924
- })), /*#__PURE__*/React.createElement(ConstraintEditor, this.props));
28925
- }
28926
- }
28927
- MovablePointEditor.propTypes = _extends({}, Changeable.propTypes, {
28928
- startX: PropTypes.string,
28929
- startY: PropTypes.string,
28930
- constraint: PropTypes.string,
28931
- snap: PropTypes.number,
28932
- constraintFn: PropTypes.string
28933
- });
28934
- MovablePointEditor.defaultProps = {
28935
- startX: "0",
28936
- startY: "0",
28873
+ }, "Constraint:", " ", /*#__PURE__*/React.createElement(ButtonGroup$2, {
28874
+ value: this.props.constraint,
28875
+ allowEmpty: false,
28876
+ buttons: [{
28877
+ value: "none",
28878
+ content: "None"
28879
+ }, {
28880
+ value: "snap",
28881
+ content: "Snap"
28882
+ }, {
28883
+ value: "x",
28884
+ content: "x="
28885
+ }, {
28886
+ value: "y",
28887
+ content: "y="
28888
+ }],
28889
+ onChange: this.change("constraint")
28890
+ })), this.props.constraint === "snap" && /*#__PURE__*/React.createElement("div", {
28891
+ className: "perseus-widget-row"
28892
+ }, "Snap:", " ", /*#__PURE__*/React.createElement(NumberInput$e, {
28893
+ value: this.props.snap,
28894
+ placeholder: 0,
28895
+ onChange: this.change("snap")
28896
+ })), this.props.constraint === "x" && /*#__PURE__*/React.createElement("div", {
28897
+ className: "graph-settings"
28898
+ }, /*#__PURE__*/React.createElement("div", {
28899
+ className: "perseus-widget-row"
28900
+ }, /*#__PURE__*/React.createElement(TeX, null, "x="), " ", /*#__PURE__*/React.createElement(MathInput$5, {
28901
+ buttonsVisible: "never",
28902
+ value: this.props.constraintFn,
28903
+ onChange: this.change("constraintFn"),
28904
+ analytics: analyticsStub
28905
+ }))), this.props.constraint === "y" && /*#__PURE__*/React.createElement("div", {
28906
+ className: "graph-settings"
28907
+ }, /*#__PURE__*/React.createElement("div", {
28908
+ className: "perseus-widget-row"
28909
+ }, /*#__PURE__*/React.createElement(TeX, null, "y="), " ", /*#__PURE__*/React.createElement(MathInput$5, {
28910
+ buttonsVisible: "never",
28911
+ value: this.props.constraintFn,
28912
+ onChange: this.change("constraintFn"),
28913
+ analytics: analyticsStub
28914
+ }))), "Ensure these are set so nothing can be dragged off the canvas:", /*#__PURE__*/React.createElement("div", {
28915
+ className: "perseus-widget-row"
28916
+ }, /*#__PURE__*/React.createElement("div", {
28917
+ className: "perseus-widget-row"
28918
+ }, /*#__PURE__*/React.createElement(TeX, null, "x \\in \\Large["), " ", /*#__PURE__*/React.createElement(MathInput$5, {
28919
+ buttonsVisible: "never",
28920
+ value: this.props.constraintXMin,
28921
+ onChange: this.change("constraintXMin"),
28922
+ analytics: analyticsStub
28923
+ }), /*#__PURE__*/React.createElement(TeX, null, ", "), " ", /*#__PURE__*/React.createElement(MathInput$5, {
28924
+ buttonsVisible: "never",
28925
+ value: this.props.constraintXMax,
28926
+ onChange: this.change("constraintXMax"),
28927
+ analytics: analyticsStub
28928
+ }), " ", /*#__PURE__*/React.createElement(TeX, null, "\\Large]"))), /*#__PURE__*/React.createElement("div", {
28929
+ className: "perseus-widget-row"
28930
+ }, /*#__PURE__*/React.createElement("div", {
28931
+ className: "perseus-widget-row"
28932
+ }, /*#__PURE__*/React.createElement(TeX, null, "y \\in \\Large["), " ", /*#__PURE__*/React.createElement(MathInput$5, {
28933
+ buttonsVisible: "never",
28934
+ value: this.props.constraintYMin,
28935
+ onChange: this.change("constraintYMin"),
28936
+ analytics: analyticsStub
28937
+ }), /*#__PURE__*/React.createElement(TeX, null, ", "), " ", /*#__PURE__*/React.createElement(MathInput$5, {
28938
+ buttonsVisible: "never",
28939
+ value: this.props.constraintYMax,
28940
+ onChange: this.change("constraintYMax"),
28941
+ analytics: analyticsStub
28942
+ }), " ", /*#__PURE__*/React.createElement(TeX, null, "\\Large]"))));
28943
+ }
28944
+ }
28945
+ ConstraintEditor.defaultProps = {
28937
28946
  constraint: "none",
28938
28947
  snap: 0.5,
28939
28948
  constraintFn: "0",
@@ -28942,6 +28951,14 @@ MovablePointEditor.defaultProps = {
28942
28951
  constraintYMin: "-10",
28943
28952
  constraintYMax: "10"
28944
28953
  };
28954
+
28955
+ const {
28956
+ MathInput: MathInput$4,
28957
+ NumberInput: NumberInput$d
28958
+ } = components;
28959
+ const {
28960
+ getDependencies: getDependencies$5
28961
+ } = Dependencies;
28945
28962
  //
28946
28963
  // Editor for interactive movable line segments
28947
28964
  //
@@ -28949,8 +28966,8 @@ MovablePointEditor.defaultProps = {
28949
28966
  // TODO(eater): Rethink how constraints are represented
28950
28967
  //
28951
28968
  class MovableLineEditor extends React.Component {
28952
- constructor(..._args4) {
28953
- super(..._args4);
28969
+ constructor(..._args) {
28970
+ super(..._args);
28954
28971
  this.change = (...args) => {
28955
28972
  return Changeable.change.apply(this, args);
28956
28973
  };
@@ -28961,7 +28978,7 @@ class MovableLineEditor extends React.Component {
28961
28978
  render() {
28962
28979
  const {
28963
28980
  TeX
28964
- } = getDependencies();
28981
+ } = getDependencies$5();
28965
28982
  const analyticsStub = {
28966
28983
  onAnalyticsEvent: () => Promise.resolve()
28967
28984
  };
@@ -28969,37 +28986,37 @@ class MovableLineEditor extends React.Component {
28969
28986
  className: "graph-settings"
28970
28987
  }, "Initial position:", /*#__PURE__*/React.createElement("div", {
28971
28988
  className: "perseus-widget-row"
28972
- }, "Start: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput, {
28989
+ }, "Start: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput$4, {
28973
28990
  buttonsVisible: "never",
28974
28991
  value: this.props.startX,
28975
28992
  onChange: this.change("startX"),
28976
28993
  analytics: analyticsStub
28977
- }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput, {
28994
+ }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput$4, {
28978
28995
  buttonsVisible: "never",
28979
28996
  value: this.props.startY,
28980
28997
  onChange: this.change("startY"),
28981
28998
  analytics: analyticsStub
28982
28999
  }), /*#__PURE__*/React.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React.createElement("div", {
28983
29000
  className: "perseus-widget-row"
28984
- }, "End: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput, {
29001
+ }, "End: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput$4, {
28985
29002
  buttonsVisible: "never",
28986
29003
  value: this.props.endX,
28987
29004
  onChange: this.change("endX"),
28988
29005
  analytics: analyticsStub
28989
- }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput, {
29006
+ }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput$4, {
28990
29007
  buttonsVisible: "never",
28991
29008
  value: this.props.endY,
28992
29009
  onChange: this.change("endY"),
28993
29010
  analytics: analyticsStub
28994
29011
  }), /*#__PURE__*/React.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React.createElement("div", {
28995
29012
  className: "perseus-widget-row"
28996
- }, "Start updates ", /*#__PURE__*/React.createElement(TeX, null, "(x_n, y_n)"), " for ", /*#__PURE__*/React.createElement(TeX, null, "n ="), /*#__PURE__*/React.createElement(NumberInput$b, {
29013
+ }, "Start updates ", /*#__PURE__*/React.createElement(TeX, null, "(x_n, y_n)"), " for ", /*#__PURE__*/React.createElement(TeX, null, "n ="), /*#__PURE__*/React.createElement(NumberInput$d, {
28997
29014
  value: this.props.startSubscript,
28998
29015
  placeholder: 0,
28999
29016
  onChange: this.change("startSubscript")
29000
29017
  })), /*#__PURE__*/React.createElement("div", {
29001
29018
  className: "perseus-widget-row"
29002
- }, "End updates ", /*#__PURE__*/React.createElement(TeX, null, "(x_m, y_m)"), " for ", /*#__PURE__*/React.createElement(TeX, null, "m ="), /*#__PURE__*/React.createElement(NumberInput$b, {
29019
+ }, "End updates ", /*#__PURE__*/React.createElement(TeX, null, "(x_m, y_m)"), " for ", /*#__PURE__*/React.createElement(TeX, null, "m ="), /*#__PURE__*/React.createElement(NumberInput$d, {
29003
29020
  value: this.props.endSubscript,
29004
29021
  placeholder: 0,
29005
29022
  onChange: this.change("endSubscript")
@@ -29030,14 +29047,23 @@ MovableLineEditor.defaultProps = {
29030
29047
  constraintYMin: "-10",
29031
29048
  constraintYMax: "10"
29032
29049
  };
29050
+
29051
+ const {
29052
+ MathInput: MathInput$3,
29053
+ NumberInput: NumberInput$c
29054
+ } = components;
29055
+ const {
29056
+ getDependencies: getDependencies$4
29057
+ } = Dependencies;
29033
29058
  //
29034
- // Editor for function plots
29059
+ // Editor for interactive movable points
29035
29060
  //
29036
29061
  // TODO(eater): Factor this out
29062
+ // TODO(eater): Rethink how constraints are represented
29037
29063
  //
29038
- class FunctionEditor extends React.Component {
29039
- constructor(..._args5) {
29040
- super(..._args5);
29064
+ class MovablePointEditor extends React.Component {
29065
+ constructor(..._args) {
29066
+ super(..._args);
29041
29067
  this.change = (...args) => {
29042
29068
  return Changeable.change.apply(this, args);
29043
29069
  };
@@ -29048,7 +29074,7 @@ class FunctionEditor extends React.Component {
29048
29074
  render() {
29049
29075
  const {
29050
29076
  TeX
29051
- } = getDependencies();
29077
+ } = getDependencies$4();
29052
29078
  const analyticsStub = {
29053
29079
  onAnalyticsEvent: () => Promise.resolve()
29054
29080
  };
@@ -29056,80 +29082,59 @@ class FunctionEditor extends React.Component {
29056
29082
  className: "graph-settings"
29057
29083
  }, /*#__PURE__*/React.createElement("div", {
29058
29084
  className: "perseus-widget-row"
29059
- }, /*#__PURE__*/React.createElement(TeX, null, this.props.funcName + "(x)="), " ", /*#__PURE__*/React.createElement(MathInput, {
29085
+ }, "Start: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput$3, {
29060
29086
  buttonsVisible: "never",
29061
- value: this.props.value
29062
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29063
- ,
29064
- onChange: this.change("value"),
29065
- analytics: analyticsStub
29066
- })), /*#__PURE__*/React.createElement("div", {
29067
- className: "perseus-widget-row"
29068
- }, "Range: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput, {
29069
- buttonsVisible: "never",
29070
- value: this.props.rangeMin
29071
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29072
- ,
29073
- onChange: this.change("rangeMin"),
29087
+ value: this.props.startX,
29088
+ onChange: this.change("startX"),
29074
29089
  analytics: analyticsStub
29075
- }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput, {
29090
+ }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput$3, {
29076
29091
  buttonsVisible: "never",
29077
- value: this.props.rangeMax
29078
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29079
- ,
29080
- onChange: this.change("rangeMax"),
29092
+ value: this.props.startY,
29093
+ onChange: this.change("startY"),
29081
29094
  analytics: analyticsStub
29082
29095
  }), /*#__PURE__*/React.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React.createElement("div", {
29083
29096
  className: "perseus-widget-row"
29084
- }, /*#__PURE__*/React.createElement(ColorPicker, {
29085
- value: this.props.color
29086
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29087
- ,
29088
- onChange: this.change("color")
29089
- })), /*#__PURE__*/React.createElement("div", {
29090
- className: "perseus-widget-row"
29091
- }, /*#__PURE__*/React.createElement(DashPicker, {
29092
- value: this.props.strokeDasharray
29093
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29094
- ,
29095
- onChange: this.change("strokeDasharray")
29096
- })), /*#__PURE__*/React.createElement("div", {
29097
- className: "perseus-widget-row"
29098
- }, /*#__PURE__*/React.createElement("div", {
29099
- className: "perseus-widget-left-col"
29100
- }, "Width:", " ", /*#__PURE__*/React.createElement(NumberInput$b, {
29101
- value: this.props.strokeWidth,
29102
- placeholder: 2
29103
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29104
- ,
29105
- onChange: this.change("strokeWidth")
29106
- }))));
29097
+ }, "Update ", /*#__PURE__*/React.createElement(TeX, null, "(x_n, y_n)"), " for ", /*#__PURE__*/React.createElement(TeX, null, "n ="), " ", /*#__PURE__*/React.createElement(NumberInput$c, {
29098
+ value: this.props.varSubscript,
29099
+ placeholder: 0,
29100
+ onChange: this.change("varSubscript")
29101
+ })), /*#__PURE__*/React.createElement(ConstraintEditor, this.props));
29107
29102
  }
29108
29103
  }
29109
- FunctionEditor.propTypes = _extends({}, Changeable.propTypes, {
29110
- value: PropTypes.string,
29111
- rangeMin: PropTypes.string,
29112
- rangeMax: PropTypes.string,
29113
- color: PropTypes.string,
29114
- strokeDashArray: PropTypes.string,
29115
- strokeWidth: PropTypes.number
29104
+ MovablePointEditor.propTypes = _extends({}, Changeable.propTypes, {
29105
+ startX: PropTypes.string,
29106
+ startY: PropTypes.string,
29107
+ constraint: PropTypes.string,
29108
+ snap: PropTypes.number,
29109
+ constraintFn: PropTypes.string
29116
29110
  });
29117
- FunctionEditor.defaultProps = {
29118
- value: "x",
29119
- rangeMin: "-10",
29120
- rangeMax: "10",
29121
- color: KhanColors.BLUE,
29122
- strokeDasharray: "",
29123
- strokeWidth: 2
29111
+ MovablePointEditor.defaultProps = {
29112
+ startX: "0",
29113
+ startY: "0",
29114
+ constraint: "none",
29115
+ snap: 0.5,
29116
+ constraintFn: "0",
29117
+ constraintXMin: "-10",
29118
+ constraintXMax: "10",
29119
+ constraintYMin: "-10",
29120
+ constraintYMax: "10"
29124
29121
  };
29122
+
29123
+ const {
29124
+ MathInput: MathInput$2,
29125
+ NumberInput: NumberInput$b
29126
+ } = components;
29127
+ const {
29128
+ getDependencies: getDependencies$3
29129
+ } = Dependencies;
29125
29130
  //
29126
29131
  // Editor for parametric plots
29127
29132
  //
29128
29133
  // TODO(eater): Factor this out
29129
29134
  //
29130
29135
  class ParametricEditor extends React.Component {
29131
- constructor(..._args6) {
29132
- super(..._args6);
29136
+ constructor(..._args) {
29137
+ super(..._args);
29133
29138
  this.change = (...args) => {
29134
29139
  return Changeable.change.apply(this, args);
29135
29140
  };
@@ -29140,7 +29145,7 @@ class ParametricEditor extends React.Component {
29140
29145
  render() {
29141
29146
  const {
29142
29147
  TeX
29143
- } = getDependencies();
29148
+ } = getDependencies$3();
29144
29149
  const analyticsStub = {
29145
29150
  onAnalyticsEvent: () => Promise.resolve()
29146
29151
  };
@@ -29148,51 +29153,39 @@ class ParametricEditor extends React.Component {
29148
29153
  className: "graph-settings"
29149
29154
  }, /*#__PURE__*/React.createElement("div", {
29150
29155
  className: "perseus-widget-row"
29151
- }, /*#__PURE__*/React.createElement(TeX, null, "X(t) ="), " ", /*#__PURE__*/React.createElement(MathInput, {
29156
+ }, /*#__PURE__*/React.createElement(TeX, null, "X(t) ="), " ", /*#__PURE__*/React.createElement(MathInput$2, {
29152
29157
  buttonsVisible: "never",
29153
- value: this.props.x
29154
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29155
- ,
29158
+ value: this.props.x,
29156
29159
  onChange: this.change("x"),
29157
29160
  analytics: analyticsStub
29158
29161
  })), /*#__PURE__*/React.createElement("div", {
29159
29162
  className: "perseus-widget-row"
29160
- }, /*#__PURE__*/React.createElement(TeX, null, "Y(t) ="), " ", /*#__PURE__*/React.createElement(MathInput, {
29163
+ }, /*#__PURE__*/React.createElement(TeX, null, "Y(t) ="), " ", /*#__PURE__*/React.createElement(MathInput$2, {
29161
29164
  buttonsVisible: "never",
29162
- value: this.props.y
29163
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29164
- ,
29165
+ value: this.props.y,
29165
29166
  onChange: this.change("y"),
29166
29167
  analytics: analyticsStub
29167
29168
  })), /*#__PURE__*/React.createElement("div", {
29168
29169
  className: "perseus-widget-row"
29169
- }, "Range: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput, {
29170
+ }, "Range: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput$2, {
29170
29171
  buttonsVisible: "never",
29171
- value: this.props.rangeMin
29172
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29173
- ,
29172
+ value: this.props.rangeMin,
29174
29173
  onChange: this.change("rangeMin"),
29175
29174
  analytics: analyticsStub
29176
- }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput, {
29175
+ }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput$2, {
29177
29176
  buttonsVisible: "never",
29178
- value: this.props.rangeMax
29179
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29180
- ,
29177
+ value: this.props.rangeMax,
29181
29178
  onChange: this.change("rangeMax"),
29182
29179
  analytics: analyticsStub
29183
29180
  }), /*#__PURE__*/React.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React.createElement("div", {
29184
29181
  className: "perseus-widget-row"
29185
29182
  }, /*#__PURE__*/React.createElement(ColorPicker, {
29186
- value: this.props.color
29187
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29188
- ,
29183
+ value: this.props.color,
29189
29184
  onChange: this.change("color")
29190
29185
  })), /*#__PURE__*/React.createElement("div", {
29191
29186
  className: "perseus-widget-row"
29192
29187
  }, /*#__PURE__*/React.createElement(DashPicker, {
29193
- value: this.props.strokeDasharray
29194
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29195
- ,
29188
+ value: this.props.strokeDasharray,
29196
29189
  onChange: this.change("strokeDasharray")
29197
29190
  })), /*#__PURE__*/React.createElement("div", {
29198
29191
  className: "perseus-widget-row"
@@ -29200,9 +29193,7 @@ class ParametricEditor extends React.Component {
29200
29193
  className: "perseus-widget-left-col"
29201
29194
  }, "Width:", " ", /*#__PURE__*/React.createElement(NumberInput$b, {
29202
29195
  value: this.props.strokeWidth,
29203
- placeholder: 2
29204
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29205
- ,
29196
+ placeholder: 2,
29206
29197
  onChange: this.change("strokeWidth")
29207
29198
  }))));
29208
29199
  }
@@ -29225,15 +29216,21 @@ ParametricEditor.defaultProps = {
29225
29216
  strokeDasharray: "",
29226
29217
  strokeWidth: 2
29227
29218
  };
29219
+
29220
+ const {
29221
+ MathInput: MathInput$1
29222
+ } = components;
29223
+ const {
29224
+ getDependencies: getDependencies$2
29225
+ } = Dependencies;
29228
29226
  //
29229
- // Editor for labels
29227
+ // Editor for non-interactive points
29230
29228
  //
29231
- // TODO(eater): Factor this out maybe?
29232
- // TODO(eater): Add text direction
29229
+ // TODO(eater): Factor this out
29233
29230
  //
29234
- class LabelEditor extends React.Component {
29235
- constructor(..._args7) {
29236
- super(..._args7);
29231
+ class PointEditor extends React.Component {
29232
+ constructor(..._args) {
29233
+ super(..._args);
29237
29234
  this.change = (...args) => {
29238
29235
  return Changeable.change.apply(this, args);
29239
29236
  };
@@ -29244,7 +29241,7 @@ class LabelEditor extends React.Component {
29244
29241
  render() {
29245
29242
  const {
29246
29243
  TeX
29247
- } = getDependencies();
29244
+ } = getDependencies$2();
29248
29245
  const analyticsStub = {
29249
29246
  onAnalyticsEvent: () => Promise.resolve()
29250
29247
  };
@@ -29252,60 +29249,49 @@ class LabelEditor extends React.Component {
29252
29249
  className: "graph-settings"
29253
29250
  }, /*#__PURE__*/React.createElement("div", {
29254
29251
  className: "perseus-widget-row"
29255
- }, /*#__PURE__*/React.createElement(TextInput$5, {
29256
- value: this.props.label
29257
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29258
- ,
29259
- onChange: this.change("label"),
29260
- style: {
29261
- width: "100%"
29262
- }
29263
- })), /*#__PURE__*/React.createElement("div", {
29264
- className: "perseus-widget-row"
29265
- }, "Location: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput, {
29252
+ }, "Coordinate: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput$1, {
29266
29253
  buttonsVisible: "never",
29267
- value: this.props.coordX
29268
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29269
- ,
29254
+ value: this.props.coordX,
29270
29255
  onChange: this.change("coordX"),
29271
29256
  analytics: analyticsStub
29272
- }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput, {
29257
+ }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput$1, {
29273
29258
  buttonsVisible: "never",
29274
- value: this.props.coordY
29275
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29276
- ,
29259
+ value: this.props.coordY,
29277
29260
  onChange: this.change("coordY"),
29278
29261
  analytics: analyticsStub
29279
29262
  }), /*#__PURE__*/React.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React.createElement("div", {
29280
29263
  className: "perseus-widget-row"
29281
29264
  }, /*#__PURE__*/React.createElement(ColorPicker, {
29282
- value: this.props.color
29283
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29284
- ,
29265
+ value: this.props.color,
29285
29266
  onChange: this.change("color")
29286
29267
  })));
29287
29268
  }
29288
29269
  }
29289
- LabelEditor.propTypes = _extends({}, Changeable.propTypes, {
29290
- color: PropTypes.string,
29270
+ PointEditor.propTypes = _extends({}, Changeable.propTypes, {
29291
29271
  coordX: PropTypes.string,
29292
29272
  coordY: PropTypes.string,
29293
- label: PropTypes.string
29273
+ color: PropTypes.string
29294
29274
  });
29295
- LabelEditor.defaultProps = {
29275
+ PointEditor.defaultProps = {
29296
29276
  coordX: "0",
29297
29277
  coordY: "0",
29298
- color: KhanColors.BLACK,
29299
- label: "\\phi"
29278
+ color: KhanColors.BLACK
29300
29279
  };
29280
+
29281
+ const {
29282
+ MathInput
29283
+ } = components;
29284
+ const {
29285
+ getDependencies: getDependencies$1
29286
+ } = Dependencies;
29301
29287
  //
29302
29288
  // Editor for rectangles
29303
29289
  //
29304
29290
  // TODO(eater): Factor this out maybe?
29305
29291
  //
29306
29292
  class RectangleEditor extends React.Component {
29307
- constructor(..._args8) {
29308
- super(..._args8);
29293
+ constructor(..._args) {
29294
+ super(..._args);
29309
29295
  this.change = (...args) => {
29310
29296
  return Changeable.change.apply(this, args);
29311
29297
  };
@@ -29316,7 +29302,7 @@ class RectangleEditor extends React.Component {
29316
29302
  render() {
29317
29303
  const {
29318
29304
  TeX
29319
- } = getDependencies();
29305
+ } = getDependencies$1();
29320
29306
  const analyticsStub = {
29321
29307
  onAnalyticsEvent: () => Promise.resolve()
29322
29308
  };
@@ -29326,43 +29312,33 @@ class RectangleEditor extends React.Component {
29326
29312
  className: "perseus-widget-row"
29327
29313
  }, "Bottom left: ", /*#__PURE__*/React.createElement(TeX, null, "\\Large("), /*#__PURE__*/React.createElement(MathInput, {
29328
29314
  buttonsVisible: "never",
29329
- value: this.props.coordX
29330
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29331
- ,
29315
+ value: this.props.coordX,
29332
29316
  onChange: this.change("coordX"),
29333
29317
  analytics: analyticsStub
29334
29318
  }), /*#__PURE__*/React.createElement(TeX, null, ","), " ", /*#__PURE__*/React.createElement(MathInput, {
29335
29319
  buttonsVisible: "never",
29336
- value: this.props.coordY
29337
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29338
- ,
29320
+ value: this.props.coordY,
29339
29321
  onChange: this.change("coordY"),
29340
29322
  analytics: analyticsStub
29341
29323
  }), /*#__PURE__*/React.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React.createElement("div", {
29342
29324
  className: "perseus-widget-row"
29343
29325
  }, "Width:", " ", /*#__PURE__*/React.createElement(MathInput, {
29344
29326
  buttonsVisible: "never",
29345
- value: this.props.width
29346
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29347
- ,
29327
+ value: this.props.width,
29348
29328
  onChange: this.change("width"),
29349
29329
  analytics: analyticsStub
29350
29330
  })), /*#__PURE__*/React.createElement("div", {
29351
29331
  className: "perseus-widget-row"
29352
29332
  }, "Height:", " ", /*#__PURE__*/React.createElement(MathInput, {
29353
29333
  buttonsVisible: "never",
29354
- value: this.props.height
29355
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29356
- ,
29334
+ value: this.props.height,
29357
29335
  onChange: this.change("height"),
29358
29336
  analytics: analyticsStub
29359
29337
  })), /*#__PURE__*/React.createElement("div", {
29360
29338
  className: "perseus-widget-row"
29361
29339
  }, /*#__PURE__*/React.createElement(ColorPicker, {
29362
29340
  value: this.props.color,
29363
- lightColors: true
29364
- // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
29365
- ,
29341
+ lightColors: true,
29366
29342
  onChange: this.change("color")
29367
29343
  })), /*#__PURE__*/React.createElement("div", {
29368
29344
  className: "perseus-widget-row"
@@ -29383,9 +29359,27 @@ RectangleEditor.defaultProps = {
29383
29359
  height: "3",
29384
29360
  color: KhanColors.LIGHT_BLUE
29385
29361
  };
29362
+
29363
+ const {
29364
+ getDependencies
29365
+ } = Dependencies;
29366
+ const {
29367
+ unescapeMathMode
29368
+ } = Util;
29369
+ const defaultInteractionProps = {
29370
+ graph: {
29371
+ box: [400, 400],
29372
+ labels: ["x", "y"],
29373
+ range: [[-10, 10], [-10, 10]],
29374
+ tickStep: [1, 1],
29375
+ gridStep: [1, 1],
29376
+ markings: "graph"
29377
+ },
29378
+ elements: []
29379
+ };
29386
29380
  class InteractionEditor extends React.Component {
29387
- constructor(..._args9) {
29388
- super(..._args9);
29381
+ constructor(..._args) {
29382
+ super(..._args);
29389
29383
  this.state = {
29390
29384
  usedVarSubscripts: this._getAllVarSubscripts(this.props.elements),
29391
29385
  usedFunctionNames: this._getAllFunctionNames(this.props.elements)
@@ -32444,18 +32438,24 @@ class NumberLineEditor extends React.Component {
32444
32438
  value: this.props.correctRel
32445
32439
  // @ts-expect-error - TS2322 - Type '(arg1: ChangeEvent<HTMLInputElement>) => void' is not assignable to type 'ChangeEventHandler<HTMLSelectElement>'.
32446
32440
  ,
32447
- onChange: this.onChangeRelation
32441
+ onChange: this.onChangeRelation,
32442
+ "aria-label": "Select relationship"
32448
32443
  }, /*#__PURE__*/React.createElement("option", {
32449
- value: "eq"
32450
- }, " = "), /*#__PURE__*/React.createElement("option", {
32451
- value: "lt"
32452
- }, " < "), /*#__PURE__*/React.createElement("option", {
32453
- value: "gt"
32454
- }, " > "), /*#__PURE__*/React.createElement("option", {
32455
- value: "le"
32456
- }, " \u2264 "), /*#__PURE__*/React.createElement("option", {
32457
- value: "ge"
32458
- }, " \u2265 ")), " ", /*#__PURE__*/React.createElement(NumberInput$7, {
32444
+ value: "eq",
32445
+ "aria-label": "Equal"
32446
+ }, "="), /*#__PURE__*/React.createElement("option", {
32447
+ value: "lt",
32448
+ "aria-label": "Less than"
32449
+ }, "<"), /*#__PURE__*/React.createElement("option", {
32450
+ value: "gt",
32451
+ "aria-label": "Greater than"
32452
+ }, ">"), /*#__PURE__*/React.createElement("option", {
32453
+ value: "le",
32454
+ "aria-label": "Less than or equal"
32455
+ }, "\u2264"), /*#__PURE__*/React.createElement("option", {
32456
+ value: "ge",
32457
+ "aria-label": "Greater than or equal"
32458
+ }, "\u2265")), " ", /*#__PURE__*/React.createElement(NumberInput$7, {
32459
32459
  value: this.props.correctX,
32460
32460
  format: this.props.labelStyle
32461
32461
  // eslint-disable-next-line react/jsx-no-bind
@@ -32848,11 +32848,13 @@ const NumericInputEditor = createReactClass({
32848
32848
  }, answer.status), /*#__PURE__*/React.createElement("a", {
32849
32849
  href: "javascript:void(0)",
32850
32850
  className: "answer-trash",
32851
+ "aria-label": "Delete answer",
32851
32852
  onClick: () => this.onTrashAnswer(i),
32852
32853
  onKeyDown: e => this.onSpace(e, this.onTrashAnswer, i)
32853
32854
  }, /*#__PURE__*/React.createElement(InlineIcon$3, iconTrash$2)), /*#__PURE__*/React.createElement("a", {
32854
32855
  href: "javascript:void(0)",
32855
32856
  className: "options-toggle",
32857
+ "aria-label": "Toggle options",
32856
32858
  onClick: () => this.onToggleOptions(i),
32857
32859
  onKeyDown: e => this.onSpace(e, this.onToggleOptions, i)
32858
32860
  }, /*#__PURE__*/React.createElement(InlineIcon$3, iconGear))), /*#__PURE__*/React.createElement("div", {