@khanacademy/perseus-editor 4.1.9 → 4.2.0

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.
@@ -21,7 +21,7 @@ declare class WidgetEditor extends React.Component<WidgetEditorProps, WidgetEdit
21
21
  _handleAlignmentChange: (e: React.SyntheticEvent<HTMLSelectElement>) => void;
22
22
  getSaveWarnings: () => any;
23
23
  serialize: () => {
24
- type: "categorizer" | "iframe" | "table" | "video" | "image" | "radio" | "cs-program" | "definition" | "group" | "dropdown" | "example-graphie-widget" | "example-widget" | "explanation" | "expression" | "graded-group-set" | "graded-group" | "grapher" | "input-number" | "interaction" | "interactive-graph" | "label-image" | "lights-puzzle" | "matcher" | "matrix" | "measurer" | "molecule-renderer" | "number-line" | "numeric-input" | "orderer" | "passage-ref" | "passage" | "plotter" | "reaction-diagtram" | "passage-ref-target" | "sequence" | "simple-markdown-tester" | "simulator" | "sorter" | "unit-input" | "deprecated-standin";
24
+ type: "categorizer" | "iframe" | "table" | "video" | "image" | "radio" | "cs-program" | "definition" | "group" | "dropdown" | "example-graphie-widget" | "example-widget" | "explanation" | "expression" | "graded-group-set" | "graded-group" | "grapher" | "input-number" | "interaction" | "interactive-graph" | "label-image" | "lights-puzzle" | "matcher" | "matrix" | "measurer" | "molecule-renderer" | "number-line" | "numeric-input" | "orderer" | "passage-ref" | "passage" | "plotter" | "python-program" | "reaction-diagtram" | "passage-ref-target" | "sequence" | "simple-markdown-tester" | "simulator" | "sorter" | "unit-input" | "deprecated-standin";
25
25
  alignment: string | undefined;
26
26
  static: boolean | undefined;
27
27
  graded: boolean | undefined;
package/dist/es/index.js CHANGED
@@ -25,7 +25,7 @@ import * as i18n$1 from '@khanacademy/wonder-blocks-i18n';
25
25
 
26
26
  // This file is processed by a Rollup plugin (replace) to inject the production
27
27
  const libName = "@khanacademy/perseus-editor";
28
- const libVersion = "4.1.9";
28
+ const libVersion = "4.2.0";
29
29
  addLibraryVersionToPerseusDebug(libName, libVersion);
30
30
 
31
31
  function _extends() {
@@ -25936,7 +25936,7 @@ CSProgramEditor.defaultProps = {
25936
25936
  };
25937
25937
 
25938
25938
  const {
25939
- TextInput: TextInput$8
25939
+ TextInput: TextInput$9
25940
25940
  } = components;
25941
25941
  class DefinitionEditor extends React.Component {
25942
25942
  constructor(..._args) {
@@ -25956,7 +25956,7 @@ class DefinitionEditor extends React.Component {
25956
25956
  target: "_blank"
25957
25957
  }, "Definition style guide"), /*#__PURE__*/React.createElement("div", {
25958
25958
  className: "perseus-widget-row"
25959
- }, /*#__PURE__*/React.createElement("label", null, "Word to be defined:", " ", /*#__PURE__*/React.createElement(TextInput$8, {
25959
+ }, /*#__PURE__*/React.createElement("label", null, "Word to be defined:", " ", /*#__PURE__*/React.createElement(TextInput$9, {
25960
25960
  value: this.props.togglePrompt
25961
25961
  // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
25962
25962
  ,
@@ -26368,7 +26368,7 @@ ExampleWidgetEditor.defaultProps = {
26368
26368
  };
26369
26369
 
26370
26370
  const {
26371
- TextInput: TextInput$7
26371
+ TextInput: TextInput$8
26372
26372
  } = components;
26373
26373
  const defaultExplanationProps = {
26374
26374
  showPrompt: "Explain",
@@ -26392,14 +26392,14 @@ class ExplanationEditor extends React.Component {
26392
26392
  className: "perseus-widget-explanation-editor"
26393
26393
  }, /*#__PURE__*/React.createElement("div", {
26394
26394
  className: "perseus-widget-row"
26395
- }, /*#__PURE__*/React.createElement("label", null, "Prompt to show explanation:", " ", /*#__PURE__*/React.createElement(TextInput$7, {
26395
+ }, /*#__PURE__*/React.createElement("label", null, "Prompt to show explanation:", " ", /*#__PURE__*/React.createElement(TextInput$8, {
26396
26396
  value: this.props.showPrompt
26397
26397
  // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
26398
26398
  ,
26399
26399
  onChange: this.change("showPrompt")
26400
26400
  }))), /*#__PURE__*/React.createElement("div", {
26401
26401
  className: "perseus-widget-row"
26402
- }, /*#__PURE__*/React.createElement("label", null, "Prompt to hide explanation:", " ", /*#__PURE__*/React.createElement(TextInput$7, {
26402
+ }, /*#__PURE__*/React.createElement("label", null, "Prompt to hide explanation:", " ", /*#__PURE__*/React.createElement(TextInput$8, {
26403
26403
  value: this.props.hidePrompt
26404
26404
  // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
26405
26405
  ,
@@ -26980,7 +26980,7 @@ class AnswerOption extends React.Component {
26980
26980
 
26981
26981
  const {
26982
26982
  InlineIcon: InlineIcon$5,
26983
- TextInput: TextInput$6
26983
+ TextInput: TextInput$7
26984
26984
  } = components;
26985
26985
  const {
26986
26986
  iconPlus: iconPlus$2,
@@ -27030,7 +27030,7 @@ class GradedGroupEditor extends React.Component {
27030
27030
  className: "perseus-widget-row"
27031
27031
  }, /*#__PURE__*/React.createElement("label", {
27032
27032
  className: css(styles$b.title)
27033
- }, "Title:", " ", /*#__PURE__*/React.createElement(TextInput$6, {
27033
+ }, "Title:", " ", /*#__PURE__*/React.createElement(TextInput$7, {
27034
27034
  value: this.props.title,
27035
27035
  className: css(styles$b.input)
27036
27036
  // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
@@ -28420,7 +28420,7 @@ const styles$a = StyleSheet.create({
28420
28420
  });
28421
28421
 
28422
28422
  const {
28423
- NumberInput: NumberInput$g
28423
+ NumberInput: NumberInput$h
28424
28424
  } = components;
28425
28425
  const {
28426
28426
  getDependencies: getDependencies$8
@@ -28469,7 +28469,7 @@ class FunctionEditor extends React.Component {
28469
28469
  className: "perseus-widget-row"
28470
28470
  }, /*#__PURE__*/React.createElement("div", {
28471
28471
  className: "perseus-widget-left-col"
28472
- }, "Width:", " ", /*#__PURE__*/React.createElement(NumberInput$g, {
28472
+ }, "Width:", " ", /*#__PURE__*/React.createElement(NumberInput$h, {
28473
28473
  value: this.props.strokeWidth,
28474
28474
  placeholder: 2,
28475
28475
  onChange: this.change("strokeWidth")
@@ -28486,7 +28486,7 @@ FunctionEditor.defaultProps = {
28486
28486
  };
28487
28487
 
28488
28488
  const {
28489
- TextInput: TextInput$5
28489
+ TextInput: TextInput$6
28490
28490
  } = components;
28491
28491
  const {
28492
28492
  getDependencies: getDependencies$7
@@ -28511,7 +28511,7 @@ class LabelEditor extends React.Component {
28511
28511
  className: "graph-settings"
28512
28512
  }, /*#__PURE__*/React.createElement("div", {
28513
28513
  className: "perseus-widget-row"
28514
- }, /*#__PURE__*/React.createElement(TextInput$5, {
28514
+ }, /*#__PURE__*/React.createElement(TextInput$6, {
28515
28515
  value: this.props.label,
28516
28516
  onChange: this.change("label"),
28517
28517
  style: {
@@ -28541,7 +28541,7 @@ LabelEditor.defaultProps = {
28541
28541
  };
28542
28542
 
28543
28543
  const {
28544
- NumberInput: NumberInput$f
28544
+ NumberInput: NumberInput$g
28545
28545
  } = components;
28546
28546
  const {
28547
28547
  getDependencies: getDependencies$6
@@ -28596,7 +28596,7 @@ class LineEditor extends React.Component {
28596
28596
  className: "perseus-widget-row"
28597
28597
  }, /*#__PURE__*/React.createElement("div", {
28598
28598
  className: "perseus-widget-left-col"
28599
- }, "Width:", " ", /*#__PURE__*/React.createElement(NumberInput$f, {
28599
+ }, "Width:", " ", /*#__PURE__*/React.createElement(NumberInput$g, {
28600
28600
  value: this.props.strokeWidth,
28601
28601
  placeholder: 2,
28602
28602
  onChange: this.change("strokeWidth")
@@ -28616,7 +28616,7 @@ LineEditor.defaultProps = {
28616
28616
 
28617
28617
  const {
28618
28618
  ButtonGroup: ButtonGroup$2,
28619
- NumberInput: NumberInput$e
28619
+ NumberInput: NumberInput$f
28620
28620
  } = components;
28621
28621
  class ConstraintEditor extends React.Component {
28622
28622
  constructor(...args) {
@@ -28650,7 +28650,7 @@ class ConstraintEditor extends React.Component {
28650
28650
  onChange: this.change("constraint")
28651
28651
  })), this.props.constraint === "snap" && /*#__PURE__*/React.createElement("div", {
28652
28652
  className: "perseus-widget-row"
28653
- }, "Snap:", " ", /*#__PURE__*/React.createElement(NumberInput$e, {
28653
+ }, "Snap:", " ", /*#__PURE__*/React.createElement(NumberInput$f, {
28654
28654
  value: this.props.snap,
28655
28655
  placeholder: 0,
28656
28656
  onChange: this.change("snap")
@@ -28702,7 +28702,7 @@ ConstraintEditor.defaultProps = {
28702
28702
  };
28703
28703
 
28704
28704
  const {
28705
- NumberInput: NumberInput$d
28705
+ NumberInput: NumberInput$e
28706
28706
  } = components;
28707
28707
  const {
28708
28708
  getDependencies: getDependencies$5
@@ -28743,13 +28743,13 @@ class MovableLineEditor extends React.Component {
28743
28743
  onChange: this.change("endY")
28744
28744
  }), /*#__PURE__*/React.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React.createElement("div", {
28745
28745
  className: "perseus-widget-row"
28746
- }, "Start updates ", /*#__PURE__*/React.createElement(TeX, null, "(x_n, y_n)"), " for ", /*#__PURE__*/React.createElement(TeX, null, "n ="), /*#__PURE__*/React.createElement(NumberInput$d, {
28746
+ }, "Start updates ", /*#__PURE__*/React.createElement(TeX, null, "(x_n, y_n)"), " for ", /*#__PURE__*/React.createElement(TeX, null, "n ="), /*#__PURE__*/React.createElement(NumberInput$e, {
28747
28747
  value: this.props.startSubscript,
28748
28748
  placeholder: 0,
28749
28749
  onChange: this.change("startSubscript")
28750
28750
  })), /*#__PURE__*/React.createElement("div", {
28751
28751
  className: "perseus-widget-row"
28752
- }, "End updates ", /*#__PURE__*/React.createElement(TeX, null, "(x_m, y_m)"), " for ", /*#__PURE__*/React.createElement(TeX, null, "m ="), /*#__PURE__*/React.createElement(NumberInput$d, {
28752
+ }, "End updates ", /*#__PURE__*/React.createElement(TeX, null, "(x_m, y_m)"), " for ", /*#__PURE__*/React.createElement(TeX, null, "m ="), /*#__PURE__*/React.createElement(NumberInput$e, {
28753
28753
  value: this.props.endSubscript,
28754
28754
  placeholder: 0,
28755
28755
  onChange: this.change("endSubscript")
@@ -28774,7 +28774,7 @@ MovableLineEditor.defaultProps = {
28774
28774
  };
28775
28775
 
28776
28776
  const {
28777
- NumberInput: NumberInput$c
28777
+ NumberInput: NumberInput$d
28778
28778
  } = components;
28779
28779
  const {
28780
28780
  getDependencies: getDependencies$4
@@ -28807,7 +28807,7 @@ class MovablePointEditor extends React.Component {
28807
28807
  onChange: this.change("startY")
28808
28808
  }), /*#__PURE__*/React.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React.createElement("div", {
28809
28809
  className: "perseus-widget-row"
28810
- }, "Update ", /*#__PURE__*/React.createElement(TeX, null, "(x_n, y_n)"), " for ", /*#__PURE__*/React.createElement(TeX, null, "n ="), " ", /*#__PURE__*/React.createElement(NumberInput$c, {
28810
+ }, "Update ", /*#__PURE__*/React.createElement(TeX, null, "(x_n, y_n)"), " for ", /*#__PURE__*/React.createElement(TeX, null, "n ="), " ", /*#__PURE__*/React.createElement(NumberInput$d, {
28811
28811
  value: this.props.varSubscript,
28812
28812
  placeholder: 0,
28813
28813
  onChange: this.change("varSubscript")
@@ -28828,7 +28828,7 @@ MovablePointEditor.defaultProps = {
28828
28828
  };
28829
28829
 
28830
28830
  const {
28831
- NumberInput: NumberInput$b
28831
+ NumberInput: NumberInput$c
28832
28832
  } = components;
28833
28833
  const {
28834
28834
  getDependencies: getDependencies$3
@@ -28882,7 +28882,7 @@ class ParametricEditor extends React.Component {
28882
28882
  className: "perseus-widget-row"
28883
28883
  }, /*#__PURE__*/React.createElement("div", {
28884
28884
  className: "perseus-widget-left-col"
28885
- }, "Width:", " ", /*#__PURE__*/React.createElement(NumberInput$b, {
28885
+ }, "Width:", " ", /*#__PURE__*/React.createElement(NumberInput$c, {
28886
28886
  value: this.props.strokeWidth,
28887
28887
  placeholder: 2,
28888
28888
  onChange: this.change("strokeWidth")
@@ -31322,7 +31322,7 @@ const styles = StyleSheet.create({
31322
31322
 
31323
31323
  const {
31324
31324
  InfoTip: InfoTip$c,
31325
- NumberInput: NumberInput$a,
31325
+ NumberInput: NumberInput$b,
31326
31326
  PropCheckBox: PropCheckBox$7
31327
31327
  } = components;
31328
31328
  const MAX_SIZE = 8;
@@ -31479,11 +31479,11 @@ class LightsPuzzleEditor extends React.Component {
31479
31479
  };
31480
31480
  }
31481
31481
  render() {
31482
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, "Width:", /*#__PURE__*/React.createElement(NumberInput$a, {
31482
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, "Width:", /*#__PURE__*/React.createElement(NumberInput$b, {
31483
31483
  value: this._width(),
31484
31484
  placeholder: 5,
31485
31485
  onChange: this._changeWidth
31486
- }), ", ", "Height:", /*#__PURE__*/React.createElement(NumberInput$a, {
31486
+ }), ", ", "Height:", /*#__PURE__*/React.createElement(NumberInput$b, {
31487
31487
  value: this._height(),
31488
31488
  placeholder: 5,
31489
31489
  onChange: this._changeHeight
@@ -31734,7 +31734,7 @@ MatrixEditor.defaultProps = {
31734
31734
 
31735
31735
  const {
31736
31736
  InfoTip: InfoTip$a,
31737
- NumberInput: NumberInput$9,
31737
+ NumberInput: NumberInput$a,
31738
31738
  PropCheckBox: PropCheckBox$5,
31739
31739
  RangeInput: RangeInput$2
31740
31740
  } = components;
@@ -31794,14 +31794,14 @@ class MeasurerEditor extends React.Component {
31794
31794
  className: "perseus-widget-row"
31795
31795
  }, /*#__PURE__*/React.createElement("label", {
31796
31796
  className: "perseus-widget-left-col"
31797
- }, "Pixels from top:", " ", /*#__PURE__*/React.createElement(NumberInput$9, {
31797
+ }, "Pixels from top:", " ", /*#__PURE__*/React.createElement(NumberInput$a, {
31798
31798
  placeholder: 0,
31799
31799
  onChange: this._changeTop,
31800
31800
  value: image.top,
31801
31801
  useArrowKeys: true
31802
31802
  })), /*#__PURE__*/React.createElement("label", {
31803
31803
  className: "perseus-widget-right-col"
31804
- }, "Pixels from left:", " ", /*#__PURE__*/React.createElement(NumberInput$9, {
31804
+ }, "Pixels from left:", " ", /*#__PURE__*/React.createElement(NumberInput$a, {
31805
31805
  placeholder: 0,
31806
31806
  onChange: this._changeLeft,
31807
31807
  value: image.left,
@@ -31847,14 +31847,14 @@ class MeasurerEditor extends React.Component {
31847
31847
  key: n,
31848
31848
  value: n
31849
31849
  }, n);
31850
- })))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", null, "Ruler pixels per unit:", " ", /*#__PURE__*/React.createElement(NumberInput$9, {
31850
+ })))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", null, "Ruler pixels per unit:", " ", /*#__PURE__*/React.createElement(NumberInput$a, {
31851
31851
  placeholder: 40
31852
31852
  // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
31853
31853
  ,
31854
31854
  onChange: this.change("rulerPixels"),
31855
31855
  value: this.props.rulerPixels,
31856
31856
  useArrowKeys: true
31857
- }))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", null, "Ruler length in units:", " ", /*#__PURE__*/React.createElement(NumberInput$9, {
31857
+ }))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", null, "Ruler length in units:", " ", /*#__PURE__*/React.createElement(NumberInput$a, {
31858
31858
  placeholder: 10
31859
31859
  // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
31860
31860
  ,
@@ -31891,8 +31891,8 @@ MeasurerEditor.defaultProps = {
31891
31891
  };
31892
31892
 
31893
31893
  const {
31894
- NumberInput: NumberInput$8,
31895
- TextInput: TextInput$4
31894
+ NumberInput: NumberInput$9,
31895
+ TextInput: TextInput$5
31896
31896
  } = components;
31897
31897
  class MoleculeWidgetEditor extends React.Component {
31898
31898
  constructor(..._args) {
@@ -31917,10 +31917,10 @@ class MoleculeWidgetEditor extends React.Component {
31917
31917
  };
31918
31918
  }
31919
31919
  render() {
31920
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", null, "SMILES:\xA0", /*#__PURE__*/React.createElement(TextInput$4, {
31920
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", null, "SMILES:\xA0", /*#__PURE__*/React.createElement(TextInput$5, {
31921
31921
  onChange: this.updateMolecule,
31922
31922
  value: this.props.smiles
31923
- }))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", null, "Rotation (deg):\xA0", /*#__PURE__*/React.createElement(NumberInput$8, {
31923
+ }))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", null, "Rotation (deg):\xA0", /*#__PURE__*/React.createElement(NumberInput$9, {
31924
31924
  onChange: this.updateRotation,
31925
31925
  value: this.props.rotationAngle
31926
31926
  }))));
@@ -31936,7 +31936,7 @@ MoleculeWidgetEditor.widgetName = "molecule-renderer";
31936
31936
  const {
31937
31937
  ButtonGroup: ButtonGroup$1,
31938
31938
  InfoTip: InfoTip$9,
31939
- NumberInput: NumberInput$7,
31939
+ NumberInput: NumberInput$8,
31940
31940
  PropCheckBox: PropCheckBox$4,
31941
31941
  RangeInput: RangeInput$1
31942
31942
  } = components;
@@ -32087,7 +32087,7 @@ class NumberLineEditor extends React.Component {
32087
32087
  }, "\u2264"), /*#__PURE__*/React.createElement("option", {
32088
32088
  value: "ge",
32089
32089
  "aria-label": "Greater than or equal"
32090
- }, "\u2265")), " ", /*#__PURE__*/React.createElement(NumberInput$7, {
32090
+ }, "\u2265")), " ", /*#__PURE__*/React.createElement(NumberInput$8, {
32091
32091
  value: this.props.correctX,
32092
32092
  format: this.props.labelStyle
32093
32093
  // eslint-disable-next-line react/jsx-no-bind
@@ -32099,7 +32099,7 @@ class NumberLineEditor extends React.Component {
32099
32099
  useArrowKeys: true
32100
32100
  }), /*#__PURE__*/React.createElement(InfoTip$9, null, /*#__PURE__*/React.createElement("p", null, "This is the correct answer. The answer is validated (as right or wrong) by using only the end position of the point and the relation (=, <, >, \u2264, \u2265)."))), /*#__PURE__*/React.createElement("div", {
32101
32101
  className: "perseus-widget-row"
32102
- }, this.props.static ? /*#__PURE__*/React.createElement("label", null, "Range:") : /*#__PURE__*/React.createElement("label", null, "Position:", " ", /*#__PURE__*/React.createElement(NumberInput$7, {
32102
+ }, this.props.static ? /*#__PURE__*/React.createElement("label", null, "Range:") : /*#__PURE__*/React.createElement("label", null, "Position:", " ", /*#__PURE__*/React.createElement(NumberInput$8, {
32103
32103
  value: this.props.initialX,
32104
32104
  format: this.props.labelStyle
32105
32105
  // eslint-disable-next-line react/jsx-no-bind
@@ -32119,7 +32119,7 @@ class NumberLineEditor extends React.Component {
32119
32119
  className: "perseus-widget-row"
32120
32120
  }, /*#__PURE__*/React.createElement("div", {
32121
32121
  className: "perseus-widget-left-col"
32122
- }, "Labels:", " ", /*#__PURE__*/React.createElement(NumberInput$7, {
32122
+ }, "Labels:", " ", /*#__PURE__*/React.createElement(NumberInput$8, {
32123
32123
  value: labelRange[0],
32124
32124
  placeholder: range[0],
32125
32125
  format: this.props.labelStyle,
@@ -32128,7 +32128,7 @@ class NumberLineEditor extends React.Component {
32128
32128
  ,
32129
32129
  onChange: this.onLabelRangeChange.bind(this, 0),
32130
32130
  useArrowKeys: true
32131
- }), /*#__PURE__*/React.createElement("span", null, " & "), /*#__PURE__*/React.createElement(NumberInput$7, {
32131
+ }), /*#__PURE__*/React.createElement("span", null, " & "), /*#__PURE__*/React.createElement(NumberInput$8, {
32132
32132
  value: labelRange[1],
32133
32133
  placeholder: range[1],
32134
32134
  format: this.props.labelStyle,
@@ -32166,7 +32166,7 @@ class NumberLineEditor extends React.Component {
32166
32166
  onChange: this.props.onChange
32167
32167
  })), /*#__PURE__*/React.createElement("div", {
32168
32168
  className: "perseus-widget-row"
32169
- }, isTickCtrl && /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("label", null, "Start num divisions at", " ", /*#__PURE__*/React.createElement(NumberInput$7, {
32169
+ }, isTickCtrl && /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("label", null, "Start num divisions at", " ", /*#__PURE__*/React.createElement(NumberInput$8, {
32170
32170
  value: this.props.numDivisions || null,
32171
32171
  format: "decimal",
32172
32172
  onChange: this.onNumDivisionsChange,
@@ -32175,7 +32175,7 @@ class NumberLineEditor extends React.Component {
32175
32175
  },
32176
32176
  placeholder: width / this.props.tickStep,
32177
32177
  useArrowKeys: true
32178
- })), /*#__PURE__*/React.createElement(InfoTip$9, null, /*#__PURE__*/React.createElement("p", null, "This controls the number (and position) of the tick marks. The number of divisions is constrained to", " " + divisionRange[0] + EN_DASH + divisionRange[1], ".", /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("strong", null, "Note:"), " The user will be able to specify the number of divisions in a number input."))), !isTickCtrl && /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("label", null, "Num divisions:", " ", /*#__PURE__*/React.createElement(NumberInput$7, {
32178
+ })), /*#__PURE__*/React.createElement(InfoTip$9, null, /*#__PURE__*/React.createElement("p", null, "This controls the number (and position) of the tick marks. The number of divisions is constrained to", " " + divisionRange[0] + EN_DASH + divisionRange[1], ".", /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("strong", null, "Note:"), " The user will be able to specify the number of divisions in a number input."))), !isTickCtrl && /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("label", null, "Num divisions:", " ", /*#__PURE__*/React.createElement(NumberInput$8, {
32179
32179
  value: this.props.numDivisions || null,
32180
32180
  format: "decimal",
32181
32181
  onChange: this.onNumDivisionsChange,
@@ -32184,7 +32184,7 @@ class NumberLineEditor extends React.Component {
32184
32184
  },
32185
32185
  placeholder: width / this.props.tickStep,
32186
32186
  useArrowKeys: true
32187
- })), " ", /*#__PURE__*/React.createElement("label", null, "or tick step:", " ", /*#__PURE__*/React.createElement(NumberInput$7, {
32187
+ })), " ", /*#__PURE__*/React.createElement("label", null, "or tick step:", " ", /*#__PURE__*/React.createElement(NumberInput$8, {
32188
32188
  value: this.props.tickStep || null,
32189
32189
  format: this.props.labelStyle,
32190
32190
  onChange: this.onTickStepChange,
@@ -32195,7 +32195,7 @@ class NumberLineEditor extends React.Component {
32195
32195
  useArrowKeys: true
32196
32196
  })), /*#__PURE__*/React.createElement(InfoTip$9, null, /*#__PURE__*/React.createElement("p", null, "This controls the number (and position) of the tick marks; you can either set the number of divisions (2 divisions would split the entire range in two halves), or the tick step (the distance between ticks) and the other value will be updated accordingly.", " ", /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("strong", null, "Note:"), " There is no check to see if labels coordinate with the tick marks, which may be confusing for users if the blue labels and black ticks are off-step.")))), /*#__PURE__*/React.createElement("div", {
32197
32197
  className: "perseus-widget-row"
32198
- }, /*#__PURE__*/React.createElement("label", null, "Snap increments per tick:", " ", /*#__PURE__*/React.createElement(NumberInput$7, {
32198
+ }, /*#__PURE__*/React.createElement("label", null, "Snap increments per tick:", " ", /*#__PURE__*/React.createElement(NumberInput$8, {
32199
32199
  value: snapDivisions,
32200
32200
  checkValidity: val => val > 0,
32201
32201
  format: this.props.labelStyle
@@ -32244,9 +32244,9 @@ const {
32244
32244
  InfoTip: InfoTip$8,
32245
32245
  InlineIcon: InlineIcon$3,
32246
32246
  MultiButtonGroup,
32247
- NumberInput: NumberInput$6,
32247
+ NumberInput: NumberInput$7,
32248
32248
  PropCheckBox: PropCheckBox$3,
32249
- TextInput: TextInput$3
32249
+ TextInput: TextInput$4
32250
32250
  } = components;
32251
32251
  const {
32252
32252
  iconGear,
@@ -32348,7 +32348,7 @@ const NumericInputEditor = createReactClass({
32348
32348
  })));
32349
32349
  const maxError = i => /*#__PURE__*/React.createElement("div", {
32350
32350
  className: "perseus-widget-row"
32351
- }, /*#__PURE__*/React.createElement("label", null, "Max error", " ", /*#__PURE__*/React.createElement(NumberInput$6, {
32351
+ }, /*#__PURE__*/React.createElement("label", null, "Max error", " ", /*#__PURE__*/React.createElement(NumberInput$7, {
32352
32352
  className: "max-error",
32353
32353
  value: answers[i]["maxError"],
32354
32354
  onChange: this.updateAnswer(i, "maxError"),
@@ -32377,7 +32377,7 @@ const NumericInputEditor = createReactClass({
32377
32377
  }));
32378
32378
  const labelText = /*#__PURE__*/React.createElement("div", {
32379
32379
  className: "perseus-widget-row"
32380
- }, /*#__PURE__*/React.createElement("label", null, "Label text:", " ", /*#__PURE__*/React.createElement(TextInput$3, {
32380
+ }, /*#__PURE__*/React.createElement("label", null, "Label text:", " ", /*#__PURE__*/React.createElement(TextInput$4, {
32381
32381
  value: this.props.labelText,
32382
32382
  onChange: this.change("labelText")
32383
32383
  })), /*#__PURE__*/React.createElement(InfoTip$8, null, /*#__PURE__*/React.createElement("p", null, "Text to describe this input. This will be shown to users using screenreaders.")));
@@ -32418,7 +32418,7 @@ const NumericInputEditor = createReactClass({
32418
32418
  key: i
32419
32419
  }, /*#__PURE__*/React.createElement("div", {
32420
32420
  className: "input-answer-editor-value-container" + (answer.maxError ? " with-max-error" : "")
32421
- }, /*#__PURE__*/React.createElement(NumberInput$6, {
32421
+ }, /*#__PURE__*/React.createElement(NumberInput$7, {
32422
32422
  value: answer.value,
32423
32423
  className: "numeric-input-value",
32424
32424
  placeholder: "answer",
@@ -32465,7 +32465,7 @@ const NumericInputEditor = createReactClass({
32465
32465
  className: "max-error-container"
32466
32466
  }, /*#__PURE__*/React.createElement("div", {
32467
32467
  className: "max-error-plusmn"
32468
- }, "\xB1"), /*#__PURE__*/React.createElement(NumberInput$6, {
32468
+ }, "\xB1"), /*#__PURE__*/React.createElement(NumberInput$7, {
32469
32469
  placeholder: 0,
32470
32470
  value: answers[i]["maxError"],
32471
32471
  format: _.last(answer.answerForms),
@@ -32790,8 +32790,8 @@ PassageEditor.defaultProps = {
32790
32790
 
32791
32791
  const {
32792
32792
  InfoTip: InfoTip$5,
32793
- NumberInput: NumberInput$5,
32794
- TextInput: TextInput$2
32793
+ NumberInput: NumberInput$6,
32794
+ TextInput: TextInput$3
32795
32795
  } = components;
32796
32796
  class PassageRefEditor extends React.Component {
32797
32797
  constructor(..._args) {
@@ -32804,17 +32804,17 @@ class PassageRefEditor extends React.Component {
32804
32804
  };
32805
32805
  }
32806
32806
  render() {
32807
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", null, "Passage Number: ", /*#__PURE__*/React.createElement(NumberInput$5, {
32807
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", null, "Passage Number: ", /*#__PURE__*/React.createElement(NumberInput$6, {
32808
32808
  value: this.props.passageNumber
32809
32809
  // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
32810
32810
  ,
32811
32811
  onChange: this.change("passageNumber")
32812
- }))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", null, "Reference Number: ", /*#__PURE__*/React.createElement(NumberInput$5, {
32812
+ }))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", null, "Reference Number: ", /*#__PURE__*/React.createElement(NumberInput$6, {
32813
32813
  value: this.props.referenceNumber
32814
32814
  // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
32815
32815
  ,
32816
32816
  onChange: this.change("referenceNumber")
32817
- }))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", null, "Summary Text: ", /*#__PURE__*/React.createElement(TextInput$2, {
32817
+ }))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", null, "Summary Text: ", /*#__PURE__*/React.createElement(TextInput$3, {
32818
32818
  value: this.props.summaryText
32819
32819
  // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
32820
32820
  ,
@@ -32868,7 +32868,7 @@ PassageRefTargetEditor.defaultProps = {
32868
32868
 
32869
32869
  const {
32870
32870
  InfoTip: InfoTip$4,
32871
- NumberInput: NumberInput$4,
32871
+ NumberInput: NumberInput$5,
32872
32872
  RangeInput,
32873
32873
  TextListEditor: TextListEditor$1
32874
32874
  } = components;
@@ -33097,7 +33097,7 @@ class PlotterEditor extends React.Component {
33097
33097
  className: "set-from-scale-box"
33098
33098
  }, /*#__PURE__*/React.createElement("span", {
33099
33099
  className: "categories-title"
33100
- }, "Set Categories From Scale"), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", null, "Tick Step:", " ", /*#__PURE__*/React.createElement(NumberInput$4, {
33100
+ }, "Set Categories From Scale"), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", null, "Tick Step:", " ", /*#__PURE__*/React.createElement(NumberInput$5, {
33101
33101
  placeholder: 1,
33102
33102
  useArrowKeys: true,
33103
33103
  value: this.state.tickStep,
@@ -33109,7 +33109,7 @@ class PlotterEditor extends React.Component {
33109
33109
  onChange: this.handleChangeRange
33110
33110
  }))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("button", {
33111
33111
  onClick: this.setCategoriesFromScale
33112
- }, "Set Categories", " "))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", null, "Label Interval:", " ", /*#__PURE__*/React.createElement(NumberInput$4, {
33112
+ }, "Set Categories", " "))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", null, "Label Interval:", " ", /*#__PURE__*/React.createElement(NumberInput$5, {
33113
33113
  useArrowKeys: true,
33114
33114
  value: this.props.labelInterval,
33115
33115
  onChange: this.changeLabelInterval
@@ -33175,6 +33175,62 @@ PlotterEditor.defaultProps = _extends({}, editorDefaults, {
33175
33175
  }
33176
33176
  });
33177
33177
 
33178
+ /**
33179
+ * This editor is for embedding Khan Academy Python programs.
33180
+ */
33181
+ const {
33182
+ NumberInput: NumberInput$4,
33183
+ TextInput: TextInput$2
33184
+ } = components;
33185
+ function validateOptions(height, programID) {
33186
+ const errors = [];
33187
+ if (programID === "") {
33188
+ errors.push("The program ID is required.");
33189
+ }
33190
+ if (!Number.isInteger(height) || height < 1) {
33191
+ errors.push("The height must be a positive integer.");
33192
+ }
33193
+ return errors;
33194
+ }
33195
+
33196
+ /**
33197
+ * This is the main editor for this widget, to specify all the options.
33198
+ */
33199
+ class PythonProgramEditor extends React.Component {
33200
+ constructor(..._args) {
33201
+ super(..._args);
33202
+ this.change = (...args) => {
33203
+ // @ts-expect-error - TS2345 - Argument of type 'readonly unknown[]' is not assignable to parameter of type 'any[]'.
33204
+ return Changeable.change.apply(this, args);
33205
+ };
33206
+ this.getSaveWarnings = () => {
33207
+ return validateOptions(this.props.height, this.props.programID);
33208
+ };
33209
+ }
33210
+ serialize() {
33211
+ return {
33212
+ programID: this.props.programID,
33213
+ height: this.props.height
33214
+ };
33215
+ }
33216
+ render() {
33217
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", null, "User Program ID:", " ", /*#__PURE__*/React.createElement(TextInput$2, {
33218
+ value: this.props.programID,
33219
+ onChange: this.change("programID"),
33220
+ placeholder: "123"
33221
+ })), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("label", null, "Height:", " ", /*#__PURE__*/React.createElement(NumberInput$4, {
33222
+ value: this.props.height,
33223
+ onChange: this.change("height"),
33224
+ placeholder: "400"
33225
+ })));
33226
+ }
33227
+ }
33228
+ PythonProgramEditor.widgetName = "python-program";
33229
+ PythonProgramEditor.defaultProps = {
33230
+ programID: "",
33231
+ height: 400
33232
+ };
33233
+
33178
33234
  const {
33179
33235
  InlineIcon: InlineIcon$2,
33180
33236
  PropCheckBox: PropCheckBox$1
@@ -34291,7 +34347,7 @@ VideoEditor.defaultProps = {
34291
34347
  location: ""
34292
34348
  };
34293
34349
 
34294
- var AllEditors = [CategorizerEditor, CSProgramEditor, DefinitionEditor, DropdownEditor, ExampleGraphieWidgetEditor, ExampleWidgetEditor, ExplanationEditor, ExpressionEditor, GradedGroupEditor, GradedGroupSetEditor, GrapherEditor, GroupEditor, IframeEditor, ImageEditor, InputNumberEditor, InteractionEditor, InteractiveGraphEditor, LabelImageEditor, LightsPuzzleEditor, MatcherEditor, MatrixEditor, MeasurerEditor, MoleculeWidgetEditor, NumberLineEditor, NumericInputEditor, OrdererEditor, PassageEditor, PassageRefEditor, PassageRefTargetEditor, PlotterEditor, ReactionDiagramWidgetEditor, SequenceEditor, SimpleMarkdownTesterEditor, SimulatorEditor, SorterEditor, TableEditor, UnitInputEditor, VideoEditor, RadioEditor, DeprecatedStandinEditor];
34350
+ var AllEditors = [CategorizerEditor, CSProgramEditor, DefinitionEditor, DropdownEditor, ExampleGraphieWidgetEditor, ExampleWidgetEditor, ExplanationEditor, ExpressionEditor, GradedGroupEditor, GradedGroupSetEditor, GrapherEditor, GroupEditor, IframeEditor, ImageEditor, InputNumberEditor, InteractionEditor, InteractiveGraphEditor, LabelImageEditor, LightsPuzzleEditor, MatcherEditor, MatrixEditor, MeasurerEditor, MoleculeWidgetEditor, NumberLineEditor, NumericInputEditor, OrdererEditor, PassageEditor, PassageRefEditor, PassageRefTargetEditor, PlotterEditor, PythonProgramEditor, ReactionDiagramWidgetEditor, SequenceEditor, SimpleMarkdownTesterEditor, SimulatorEditor, SorterEditor, TableEditor, UnitInputEditor, VideoEditor, RadioEditor, DeprecatedStandinEditor];
34295
34351
 
34296
34352
  class TextInput extends React.Component {
34297
34353
  constructor(...args) {