@khanacademy/perseus-editor 7.0.3 → 8.1.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.
package/dist/es/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { addLibraryVersionToPerseusDebug } from '@khanacademy/perseus-core';
2
- import { constants, components, Widgets, icons, WIDGET_PROP_DENYLIST, Util, Log, PerseusError, Errors, PerseusMarkdown, preprocessTex, ApiOptions, buildMapper, itemToTree, buildEmptyItemTreeForShape, shapes, ItemExtras, itemDataVersion, ClassNames, MultiItems, traverse, Categorizer as Categorizer$1, Changeable, EditorJsonify, Dependencies, WidgetJsonifyDeprecated, PerseusExpressionAnswerFormConsidered, Expression, interactiveSizes, KhanMath, GrapherWidget, GrapherUtil, SizingUtils, PerseusI18nContext, KhanColors, ColorPicker, DashPicker, ArrowPicker, ElementContainer, lockedFigureColors, lockedFigureFillStyles, InteractiveGraphWidget, globalStyles, globalConstants, MatrixWidget, PlotterWidget, plotterPlotTypes, BaseRadio, TableWidget, displaySigFigs, widgets } from '@khanacademy/perseus';
1
+ import { addLibraryVersionToPerseusDebug, PerseusError, Errors } from '@khanacademy/perseus-core';
2
+ import { constants, components, Widgets, icons, WIDGET_PROP_DENYLIST, Util, Log, PerseusMarkdown, preprocessTex, ApiOptions, buildMapper, itemToTree, buildEmptyItemTreeForShape, shapes, ItemExtras, itemDataVersion, ClassNames, MultiItems, traverse, Categorizer as Categorizer$1, Changeable, EditorJsonify, Dependencies, WidgetJsonifyDeprecated, PerseusExpressionAnswerFormConsidered, Expression, interactiveSizes, KhanMath, GrapherWidget, GrapherUtil, SizingUtils, PerseusI18nContext, KhanColors, ColorPicker, DashPicker, ArrowPicker, ElementContainer, lockedFigureColors, lockedFigureFillStyles, getLineCoords, InteractiveGraphWidget, globalStyles, globalConstants, MatrixWidget, PlotterWidget, plotterPlotTypes, BaseRadio, TableWidget, displaySigFigs, widgets } from '@khanacademy/perseus';
3
3
  import * as React from 'react';
4
4
  import { useRef, useEffect } from 'react';
5
5
  import _ from 'underscore';
@@ -33,10 +33,11 @@ import Switch from '@khanacademy/wonder-blocks-switch';
33
33
  import minusCircle from '@phosphor-icons/core/regular/minus-circle.svg';
34
34
  import plusCircle from '@phosphor-icons/core/regular/plus-circle.svg';
35
35
  import Banner from '@khanacademy/wonder-blocks-banner';
36
+ import arrowCounterClockwise from '@phosphor-icons/core/bold/arrow-counter-clockwise-bold.svg';
36
37
 
37
38
  // This file is processed by a Rollup plugin (replace) to inject the production
38
39
  const libName = "@khanacademy/perseus-editor";
39
- const libVersion = "7.0.3";
40
+ const libVersion = "8.1.0";
40
41
  addLibraryVersionToPerseusDebug(libName, libVersion);
41
42
 
42
43
  function _extends() {
@@ -226,7 +227,7 @@ class SectionControlButton extends React.Component {
226
227
  role: "button",
227
228
  hideDefaultFocusRing: true,
228
229
  "aria-label": title,
229
- style: styles$G.button
230
+ style: styles$H.button
230
231
  }, ({
231
232
  hovered,
232
233
  focused,
@@ -234,7 +235,7 @@ class SectionControlButton extends React.Component {
234
235
  }) => /*#__PURE__*/React.createElement(InlineIcon$b, icon));
235
236
  }
236
237
  }
237
- const styles$G = StyleSheet.create({
238
+ const styles$H = StyleSheet.create({
238
239
  button: {
239
240
  backgroundColor: color.gold,
240
241
  margin: 2,
@@ -20739,13 +20740,13 @@ class WidgetSelect extends React.Component {
20739
20740
  * that collapse a region.
20740
20741
  */
20741
20742
  function ToggleableCaret(props) {
20742
- const iconStyle = props.isExpanded ? styles$F.expanded : styles$F.collapsed;
20743
+ const iconStyle = props.isExpanded ? styles$G.expanded : styles$G.collapsed;
20743
20744
  return /*#__PURE__*/React.createElement(PhosphorIcon, {
20744
20745
  icon: caretRight,
20745
20746
  style: iconStyle
20746
20747
  });
20747
20748
  }
20748
- const styles$F = StyleSheet.create({
20749
+ const styles$G = StyleSheet.create({
20749
20750
  collapsed: {
20750
20751
  transition: ".15s"
20751
20752
  },
@@ -20778,16 +20779,16 @@ class TexErrorView extends React.Component {
20778
20779
  showErrors
20779
20780
  } = this.state;
20780
20781
  return /*#__PURE__*/React.createElement(View, {
20781
- style: styles$E.errorContainer
20782
+ style: styles$F.errorContainer
20782
20783
  }, /*#__PURE__*/React.createElement(View, {
20783
- style: styles$E.title,
20784
+ style: styles$F.title,
20784
20785
  onClick: this.handleToggleTexErrors
20785
20786
  }, /*#__PURE__*/React.createElement(ToggleableCaret, {
20786
20787
  isExpanded: showErrors
20787
20788
  }), "\xA0 TeX Errors (", errorList.length, ")"), showErrors && /*#__PURE__*/React.createElement(View, {
20788
- style: styles$E.errorExplanation
20789
+ style: styles$F.errorExplanation
20789
20790
  }, "If your math doesn't display correctly, these errors might help you troubleshoot. Message #content-kitchen for help."), showErrors && errorList.map((e, index) => /*#__PURE__*/React.createElement(View, {
20790
- style: styles$E.error,
20791
+ style: styles$F.error,
20791
20792
  key: index
20792
20793
  }, /*#__PURE__*/React.createElement(View, {
20793
20794
  style: {
@@ -20796,7 +20797,7 @@ class TexErrorView extends React.Component {
20796
20797
  }, e.math), /*#__PURE__*/React.createElement(View, null, e.message))));
20797
20798
  }
20798
20799
  }
20799
- const styles$E = StyleSheet.create({
20800
+ const styles$F = StyleSheet.create({
20800
20801
  title: {
20801
20802
  backgroundColor: "#eee",
20802
20803
  fontSize: "1.25em",
@@ -24590,7 +24591,7 @@ class SimpleButton extends React.Component {
24590
24591
  } = _this$props,
24591
24592
  otherProps = _objectWithoutPropertiesLoose(_this$props, _excluded$3);
24592
24593
  return /*#__PURE__*/React.createElement("div", _extends({
24593
- className: css(styles$D.baseButton, color === "green" && styles$D.green, color === "orange" && styles$D.orange),
24594
+ className: css(styles$E.baseButton, color === "green" && styles$E.green, color === "orange" && styles$E.orange),
24594
24595
  onClick: onClick
24595
24596
  }, otherProps), children);
24596
24597
  }
@@ -24605,7 +24606,7 @@ SimpleButton.defaultProps = {
24605
24606
  color: "green",
24606
24607
  onClick: () => {}
24607
24608
  };
24608
- const styles$D = StyleSheet.create({
24609
+ const styles$E = StyleSheet.create({
24609
24610
  baseButton: {
24610
24611
  top: "0",
24611
24612
  fontSize: "11px",
@@ -24825,23 +24826,23 @@ const LeafContainer = ({
24825
24826
  }) => {
24826
24827
  const hasPreviewHeading = shape.type === "content" || shape.type === "hint";
24827
24828
  const previewHeading = hasPreviewHeading && /*#__PURE__*/React.createElement("div", {
24828
- className: css(styles$C.containerHeader)
24829
+ className: css(styles$D.containerHeader)
24829
24830
  }, /*#__PURE__*/React.createElement(Header, {
24830
24831
  depth: path.length,
24831
- className: css(styles$C.containerTitle)
24832
+ className: css(styles$D.containerTitle)
24832
24833
  }, capitalize(name)));
24833
24834
  return /*#__PURE__*/React.createElement("div", {
24834
- className: css(styles$C.container)
24835
+ className: css(styles$D.container)
24835
24836
  }, /*#__PURE__*/React.createElement("span", {
24836
- className: css(styles$C.row, styles$C.rowHeading)
24837
+ className: css(styles$D.row, styles$D.rowHeading)
24837
24838
  }, /*#__PURE__*/React.createElement("div", {
24838
- className: css(styles$C.columnLeft)
24839
+ className: css(styles$D.columnLeft)
24839
24840
  }, /*#__PURE__*/React.createElement("div", {
24840
- className: "pod-title " + css(styles$C.containerHeader)
24841
+ className: "pod-title " + css(styles$D.containerHeader)
24841
24842
  }, /*#__PURE__*/React.createElement("div", {
24842
- className: css(styles$C.containerTitle)
24843
+ className: css(styles$D.containerTitle)
24843
24844
  }, capitalize(name)), controls)), /*#__PURE__*/React.createElement("div", {
24844
- className: css(styles$C.columnRight)
24845
+ className: css(styles$D.columnRight)
24845
24846
  }, previewHeading)), children);
24846
24847
  };
24847
24848
  const ArrayContainer = props => {
@@ -24854,11 +24855,11 @@ const ArrayContainer = props => {
24854
24855
  actions
24855
24856
  } = props;
24856
24857
  return /*#__PURE__*/React.createElement("div", {
24857
- className: css(styles$C.container)
24858
+ className: css(styles$D.container)
24858
24859
  }, controls && /*#__PURE__*/React.createElement("div", {
24859
- className: css(styles$C.columnLeft, styles$C.containerHeader)
24860
+ className: css(styles$D.columnLeft, styles$D.containerHeader)
24860
24861
  }, controls), /*#__PURE__*/React.createElement("div", null, children), /*#__PURE__*/React.createElement("div", {
24861
- className: css(styles$C.columnLeft)
24862
+ className: css(styles$D.columnLeft)
24862
24863
  }, /*#__PURE__*/React.createElement("a", {
24863
24864
  href: "javascript:void 0",
24864
24865
  onClick: () => actions.addArrayElement(path, shape.elementShape)
@@ -24871,28 +24872,28 @@ const ObjectContainer = ({
24871
24872
  path
24872
24873
  }) => {
24873
24874
  const headingEditor = /*#__PURE__*/React.createElement("div", {
24874
- className: css(styles$C.containerHeader)
24875
+ className: css(styles$D.containerHeader)
24875
24876
  }, /*#__PURE__*/React.createElement(Header, {
24876
24877
  depth: path.length,
24877
- className: css(styles$C.containerTitle)
24878
+ className: css(styles$D.containerTitle)
24878
24879
  }, capitalize(name)), controls);
24879
24880
  const headingPreview = (name || controls) && /*#__PURE__*/React.createElement("div", {
24880
- className: css(styles$C.containerHeader, styles$C.previewCollectionHeader)
24881
+ className: css(styles$D.containerHeader, styles$D.previewCollectionHeader)
24881
24882
  }, /*#__PURE__*/React.createElement(Header, {
24882
24883
  depth: path.length,
24883
- className: css(styles$C.containerTitle)
24884
+ className: css(styles$D.containerTitle)
24884
24885
  }, capitalize(name)));
24885
24886
  const hasBothHeadings = headingEditor && headingPreview;
24886
24887
  return /*#__PURE__*/React.createElement("div", {
24887
- className: css(styles$C.container)
24888
+ className: css(styles$D.container)
24888
24889
  }, hasBothHeadings && /*#__PURE__*/React.createElement("span", {
24889
- className: css(styles$C.row)
24890
+ className: css(styles$D.row)
24890
24891
  }, /*#__PURE__*/React.createElement("div", {
24891
- className: css(styles$C.columnLeft)
24892
+ className: css(styles$D.columnLeft)
24892
24893
  }, headingEditor), /*#__PURE__*/React.createElement("div", {
24893
- className: css(styles$C.columnRight)
24894
+ className: css(styles$D.columnRight)
24894
24895
  }, headingPreview)), /*#__PURE__*/React.createElement("div", {
24895
- className: css(path.length > 0 && styles$C.contentIndent)
24896
+ className: css(path.length > 0 && styles$D.contentIndent)
24896
24897
  }, children));
24897
24898
  };
24898
24899
 
@@ -25015,11 +25016,11 @@ const ItemNodeContent = withStickiness(props => {
25015
25016
  className: "framework-perseus"
25016
25017
  }, lens(renderers).get(path));
25017
25018
  return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("div", {
25018
- className: css(styles$C.row)
25019
+ className: css(styles$D.row)
25019
25020
  }, /*#__PURE__*/React.createElement("div", {
25020
- className: css(styles$C.columnLeft)
25021
+ className: css(styles$D.columnLeft)
25021
25022
  }, /*#__PURE__*/React.createElement("div", {
25022
- className: css(sticky && styles$C.sticky)
25023
+ className: css(sticky && styles$D.sticky)
25023
25024
  },
25024
25025
  /*#__PURE__*/
25025
25026
  // @ts-expect-error - TS2769 - No overload matches this call.
@@ -25027,9 +25028,9 @@ const ItemNodeContent = withStickiness(props => {
25027
25028
  onChange: newVal => actions.mergeValueAtPath(path, newVal),
25028
25029
  apiOptions: apiOptions
25029
25030
  })))), /*#__PURE__*/React.createElement("div", {
25030
- className: css(styles$C.columnRight)
25031
+ className: css(styles$D.columnRight)
25031
25032
  }, /*#__PURE__*/React.createElement("div", {
25032
- className: css(sticky && styles$C.sticky)
25033
+ className: css(sticky && styles$D.sticky)
25033
25034
  }, preview))));
25034
25035
  });
25035
25036
  const HintNodeContent = withStickiness(props => {
@@ -25045,13 +25046,13 @@ const HintNodeContent = withStickiness(props => {
25045
25046
  className: "framework-perseus"
25046
25047
  }, lens(renderers).get(path));
25047
25048
  return /*#__PURE__*/React.createElement("div", {
25048
- className: css(styles$C.row)
25049
+ className: css(styles$D.row)
25049
25050
  }, /*#__PURE__*/React.createElement("div", {
25050
- className: css(styles$C.columnLeft)
25051
+ className: css(styles$D.columnLeft)
25051
25052
  }, /*#__PURE__*/React.createElement("div", {
25052
- className: css(sticky && styles$C.sticky)
25053
+ className: css(sticky && styles$D.sticky)
25053
25054
  }, /*#__PURE__*/React.createElement(HintEditor, _extends({}, data, {
25054
- className: css(styles$C.hintEditor),
25055
+ className: css(styles$D.hintEditor),
25055
25056
  onChange: newVal => actions.mergeValueAtPath(path, newVal),
25056
25057
  apiOptions: apiOptions,
25057
25058
  showTitle: false,
@@ -25066,9 +25067,9 @@ const HintNodeContent = withStickiness(props => {
25066
25067
  isFirst: true,
25067
25068
  isLast: true
25068
25069
  })))), /*#__PURE__*/React.createElement("div", {
25069
- className: css(styles$C.columnRight)
25070
+ className: css(styles$D.columnRight)
25070
25071
  }, /*#__PURE__*/React.createElement("div", {
25071
- className: css(sticky && styles$C.sticky)
25072
+ className: css(sticky && styles$D.sticky)
25072
25073
  }, preview)));
25073
25074
  });
25074
25075
  const TagsNodeContent = props => {
@@ -25085,9 +25086,9 @@ const TagsNodeContent = props => {
25085
25086
  return null;
25086
25087
  }
25087
25088
  return /*#__PURE__*/React.createElement("div", {
25088
- className: css(styles$C.columnLeft)
25089
+ className: css(styles$D.columnLeft)
25089
25090
  }, /*#__PURE__*/React.createElement("div", {
25090
- className: css(styles$C.tagsEditor)
25091
+ className: css(styles$D.tagsEditor)
25091
25092
  }, /*#__PURE__*/React.createElement(GroupMetadataEditor, {
25092
25093
  value: data,
25093
25094
  onChange: newVal => actions.setValueAtPath(path, newVal),
@@ -25118,23 +25119,23 @@ const ArrayNodeContent = props => {
25118
25119
  const subpath = path.concat(i);
25119
25120
  const controls = [i > 0 && /*#__PURE__*/React.createElement("div", {
25120
25121
  key: "moveArrayElementUp",
25121
- className: css(styles$C.control)
25122
+ className: css(styles$D.control)
25122
25123
  }, /*#__PURE__*/React.createElement(SimpleButton, {
25123
25124
  color: "orange",
25124
25125
  title: "Move up",
25125
25126
  onClick: () => actions.moveArrayElementUp(subpath)
25126
25127
  }, /*#__PURE__*/React.createElement("div", {
25127
- className: css(styles$C.verticalFlip)
25128
+ className: css(styles$D.verticalFlip)
25128
25129
  }, /*#__PURE__*/React.createElement(InlineIcon$6, iconChevronDown)))), i < data.length - 1 && /*#__PURE__*/React.createElement("div", {
25129
25130
  key: "moveArrayElementDown",
25130
- className: css(styles$C.control)
25131
+ className: css(styles$D.control)
25131
25132
  }, /*#__PURE__*/React.createElement(SimpleButton, {
25132
25133
  color: "orange",
25133
25134
  title: "Move down",
25134
25135
  onClick: () => actions.moveArrayElementDown(subpath)
25135
25136
  }, /*#__PURE__*/React.createElement(InlineIcon$6, iconChevronDown))), /*#__PURE__*/React.createElement("div", {
25136
25137
  key: "removeArrayElement",
25137
- className: css(styles$C.control)
25138
+ className: css(styles$D.control)
25138
25139
  }, /*#__PURE__*/React.createElement(SimpleButton, {
25139
25140
  color: "orange",
25140
25141
  title: "Delete",
@@ -25142,7 +25143,7 @@ const ArrayNodeContent = props => {
25142
25143
  }, /*#__PURE__*/React.createElement(InlineIcon$6, iconTrash$4)))];
25143
25144
  return /*#__PURE__*/React.createElement("div", {
25144
25145
  key: i,
25145
- className: css(styles$C.arrayElement, !elementIsLeaf && styles$C.arrayElementAndNotLeaf)
25146
+ className: css(styles$D.arrayElement, !elementIsLeaf && styles$D.arrayElementAndNotLeaf)
25146
25147
  }, /*#__PURE__*/React.createElement(NodeContainer, _extends({}, otherProps, {
25147
25148
  key: i,
25148
25149
  shape: shape.elementShape,
@@ -25168,7 +25169,7 @@ const ObjectNodeContent = props => {
25168
25169
  // made sense to the shape's author is the order in which we'll iterate :)
25169
25170
  const children = Object.keys(shape.shape).map(subkey => /*#__PURE__*/React.createElement("div", {
25170
25171
  key: subkey,
25171
- className: css(styles$C.objectElement)
25172
+ className: css(styles$D.objectElement)
25172
25173
  }, /*#__PURE__*/React.createElement(NodeContainer, _extends({}, otherProps, {
25173
25174
  shape: shape.shape[subkey],
25174
25175
  data: data[subkey],
@@ -25335,7 +25336,7 @@ class MultiRendererEditor extends React.Component {
25335
25336
  }, this._renderContent());
25336
25337
  }
25337
25338
  }
25338
- const styles$C = StyleSheet.create({
25339
+ const styles$D = StyleSheet.create({
25339
25340
  // This is used in a number of places throughout this file.
25340
25341
  container: {},
25341
25342
  // eslint-disable-next-line react-native/no-unused-styles
@@ -25487,47 +25488,47 @@ const StatefulArticleEditor = createReactClass({
25487
25488
  screen
25488
25489
  } = this.state;
25489
25490
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
25490
- style: styles$B.controlBar
25491
+ style: styles$C.controlBar
25491
25492
  }, /*#__PURE__*/React.createElement("span", {
25492
- style: styles$B.controls
25493
+ style: styles$C.controls
25493
25494
  }, "Mode:", " ", /*#__PURE__*/React.createElement("span", {
25494
25495
  onClick: () => this.setState({
25495
25496
  mode: "edit"
25496
25497
  }),
25497
- style: mode === "edit" ? styles$B.controlSelected : styles$B.control
25498
+ style: mode === "edit" ? styles$C.controlSelected : styles$C.control
25498
25499
  }, "EDIT"), " | ", /*#__PURE__*/React.createElement("span", {
25499
25500
  onClick: () => this.setState({
25500
25501
  mode: "preview"
25501
25502
  }),
25502
- style: mode === "preview" ? styles$B.controlSelected : styles$B.control
25503
+ style: mode === "preview" ? styles$C.controlSelected : styles$C.control
25503
25504
  }, "PREVIEW"), " | ", /*#__PURE__*/React.createElement("span", {
25504
25505
  onClick: () => this.setState({
25505
25506
  mode: "json"
25506
25507
  }),
25507
- style: mode === "json" ? styles$B.controlSelected : styles$B.control
25508
+ style: mode === "json" ? styles$C.controlSelected : styles$C.control
25508
25509
  }, "JSON")), /*#__PURE__*/React.createElement("span", {
25509
- style: styles$B.controls
25510
+ style: styles$C.controls
25510
25511
  }, "Screen:", " ", /*#__PURE__*/React.createElement("span", {
25511
25512
  onClick: () => this.setState({
25512
25513
  screen: "phone"
25513
25514
  }),
25514
- style: screen === "phone" ? styles$B.controlSelected : styles$B.control
25515
+ style: screen === "phone" ? styles$C.controlSelected : styles$C.control
25515
25516
  }, "PHONE"), " | ", /*#__PURE__*/React.createElement("span", {
25516
25517
  onClick: () => this.setState({
25517
25518
  screen: "tablet"
25518
25519
  }),
25519
- style: screen === "tablet" ? styles$B.controlSelected : styles$B.control
25520
+ style: screen === "tablet" ? styles$C.controlSelected : styles$C.control
25520
25521
  }, "TABLET"), " | ", /*#__PURE__*/React.createElement("span", {
25521
25522
  onClick: () => this.setState({
25522
25523
  screen: "desktop"
25523
25524
  }),
25524
- style: screen === "desktop" ? styles$B.controlSelected : styles$B.control
25525
+ style: screen === "desktop" ? styles$C.controlSelected : styles$C.control
25525
25526
  }, "DESKTOP"))), /*#__PURE__*/React.createElement("div", {
25526
- style: styles$B.editor
25527
+ style: styles$C.editor
25527
25528
  }, /*#__PURE__*/React.createElement(ArticleEditor, this.state)));
25528
25529
  }
25529
25530
  });
25530
- const styles$B = {
25531
+ const styles$C = {
25531
25532
  controlBar: {
25532
25533
  marginBottom: 25,
25533
25534
  marginTop: 5
@@ -27017,10 +27018,10 @@ class GradedGroupEditor extends React.Component {
27017
27018
  }, /*#__PURE__*/React.createElement("div", {
27018
27019
  className: "perseus-widget-row"
27019
27020
  }, /*#__PURE__*/React.createElement("label", {
27020
- className: css(styles$A.title)
27021
+ className: css(styles$B.title)
27021
27022
  }, "Title:", " ", /*#__PURE__*/React.createElement(TextInput$6, {
27022
27023
  value: this.props.title,
27023
- className: css(styles$A.input)
27024
+ className: css(styles$B.input)
27024
27025
  // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
27025
27026
  ,
27026
27027
  onChange: this.change("title")
@@ -27045,7 +27046,7 @@ class GradedGroupEditor extends React.Component {
27045
27046
  }, /*#__PURE__*/React.createElement(InlineIcon$4, iconPlus$1), " Add a hint"), this.props.hint && /*#__PURE__*/React.createElement("div", {
27046
27047
  className: "perseus-hint-editor"
27047
27048
  }, /*#__PURE__*/React.createElement("div", {
27048
- className: css(styles$A.hintsTitle)
27049
+ className: css(styles$B.hintsTitle)
27049
27050
  }, "Hint"), /*#__PURE__*/React.createElement(Editor, {
27050
27051
  ref: this.hintEditor,
27051
27052
  content: this.props.hint ? this.props.hint.content : "",
@@ -27082,7 +27083,7 @@ GradedGroupEditor.defaultProps = {
27082
27083
  images: {},
27083
27084
  hint: null
27084
27085
  };
27085
- const styles$A = StyleSheet.create({
27086
+ const styles$B = StyleSheet.create({
27086
27087
  title: {
27087
27088
  fontSize: 18,
27088
27089
  fontWeight: "bold"
@@ -28421,13 +28422,13 @@ function MathquillInput(props) {
28421
28422
  }
28422
28423
  });
28423
28424
  return /*#__PURE__*/React.createElement(View, {
28424
- style: styles$z.outerWrapper
28425
+ style: styles$A.outerWrapper
28425
28426
  }, /*#__PURE__*/React.createElement("span", {
28426
28427
  ref: mathFieldWrapperRef,
28427
28428
  className: "perseus-math-input mq-editable-field mq-math-mode"
28428
28429
  }));
28429
28430
  }
28430
- const styles$z = StyleSheet.create({
28431
+ const styles$A = StyleSheet.create({
28431
28432
  outerWrapper: {
28432
28433
  display: "inline-block",
28433
28434
  borderStyle: "solid",
@@ -29473,16 +29474,16 @@ const LabeledRow = props => {
29473
29474
  style
29474
29475
  } = props;
29475
29476
  return /*#__PURE__*/React.createElement("label", {
29476
- className: css(styles$y.label)
29477
+ className: css(styles$z.label)
29477
29478
  }, /*#__PURE__*/React.createElement(View, {
29478
- style: [styles$y.row, style]
29479
+ style: [styles$z.row, style]
29479
29480
  }, labelSide === "start" || /*#__PURE__*/React.createElement(LabelSmall, {
29480
- style: styles$y.spaceEnd
29481
+ style: styles$z.spaceEnd
29481
29482
  }, label), children, labelSide === "end" && /*#__PURE__*/React.createElement(LabelSmall, {
29482
- style: styles$y.spaceStart
29483
+ style: styles$z.spaceStart
29483
29484
  }, label)));
29484
29485
  };
29485
- const styles$y = StyleSheet.create({
29486
+ const styles$z = StyleSheet.create({
29486
29487
  label: {
29487
29488
  width: "fit-content"
29488
29489
  },
@@ -29559,11 +29560,11 @@ class Spring extends React.Component {
29559
29560
  } = this.props;
29560
29561
  return React.createElement(View, {
29561
29562
  "aria-hidden": "true",
29562
- style: [styles$x.grow, style]
29563
+ style: [styles$y.grow, style]
29563
29564
  });
29564
29565
  }
29565
29566
  }
29566
- const styles$x = StyleSheet.create({
29567
+ const styles$y = StyleSheet.create({
29567
29568
  grow: {
29568
29569
  flexGrow: 1
29569
29570
  }
@@ -29712,17 +29713,17 @@ const LockedFigureSelect = props => {
29712
29713
  } = props;
29713
29714
  const figureTypes = props.showM2Features ? ["point", "line", "vector", "ellipse", "polygon"] : ["point", "line"];
29714
29715
  return /*#__PURE__*/React.createElement(View, {
29715
- style: styles$w.container
29716
+ style: styles$x.container
29716
29717
  }, /*#__PURE__*/React.createElement(ActionMenu, {
29717
29718
  menuText: "Add locked figure",
29718
- style: styles$w.addElementSelect
29719
+ style: styles$x.addElementSelect
29719
29720
  }, figureTypes.map(figureType => /*#__PURE__*/React.createElement(ActionItem, {
29720
29721
  key: `${id}-${figureType}`,
29721
29722
  label: figureType,
29722
29723
  onClick: () => onChange(figureType)
29723
29724
  }, figureType))));
29724
29725
  };
29725
- const styles$w = StyleSheet.create({
29726
+ const styles$x = StyleSheet.create({
29726
29727
  container: {
29727
29728
  marginTop: spacing.xSmall_8
29728
29729
  },
@@ -29753,19 +29754,19 @@ const AngleInput = props => {
29753
29754
  }
29754
29755
  return /*#__PURE__*/React.createElement(LabelMedium, {
29755
29756
  tag: "label",
29756
- style: styles$v.row
29757
+ style: styles$w.row
29757
29758
  }, "angle (degrees)", /*#__PURE__*/React.createElement(Strut, {
29758
29759
  size: spacing.xxSmall_6
29759
29760
  }), /*#__PURE__*/React.createElement(TextField, {
29760
29761
  type: "number",
29761
29762
  value: angleInput,
29762
29763
  onChange: handleAngleChange,
29763
- style: styles$v.textField
29764
+ style: styles$w.textField
29764
29765
  }), /*#__PURE__*/React.createElement(Strut, {
29765
29766
  size: spacing.xxSmall_6
29766
29767
  }));
29767
29768
  };
29768
- const styles$v = StyleSheet.create({
29769
+ const styles$w = StyleSheet.create({
29769
29770
  row: {
29770
29771
  display: "flex",
29771
29772
  flexDirection: "row",
@@ -29790,6 +29791,12 @@ const CoordinatePairInput = props => {
29790
29791
  const [coordState, setCoordState] = React.useState([
29791
29792
  // Using strings to make it easier to work with the text fields.
29792
29793
  coord[0].toString(), coord[1].toString()]);
29794
+
29795
+ // Update the local state when the props change. (Such as when the graph
29796
+ // type is changed, and the coordinates are reset.)
29797
+ React.useEffect(() => {
29798
+ setCoordState([coord[0].toString(), coord[1].toString()]);
29799
+ }, [coord]);
29793
29800
  function handleCoordChange(newValue, coordIndex) {
29794
29801
  // Update the local state (update the input field value).
29795
29802
  const newCoordState = [...coordState];
@@ -29808,32 +29815,32 @@ const CoordinatePairInput = props => {
29808
29815
  onChange(newCoords);
29809
29816
  }
29810
29817
  return /*#__PURE__*/React.createElement(View, {
29811
- style: [styles$u.row, style]
29818
+ style: [styles$v.row, style]
29812
29819
  }, /*#__PURE__*/React.createElement(LabelMedium, {
29813
29820
  tag: "label",
29814
- style: styles$u.row
29821
+ style: styles$v.row
29815
29822
  }, labels ? labels[0] : "x coord", /*#__PURE__*/React.createElement(Strut, {
29816
29823
  size: spacing.xxSmall_6
29817
29824
  }), /*#__PURE__*/React.createElement(TextField, {
29818
29825
  type: "number",
29819
29826
  value: coordState[0],
29820
29827
  onChange: newValue => handleCoordChange(newValue, 0),
29821
- style: [styles$u.textField, error ? styles$u.errorField : undefined]
29828
+ style: [styles$v.textField, error ? styles$v.errorField : undefined]
29822
29829
  })), /*#__PURE__*/React.createElement(Strut, {
29823
29830
  size: spacing.medium_16
29824
29831
  }), /*#__PURE__*/React.createElement(LabelMedium, {
29825
29832
  tag: "label",
29826
- style: styles$u.row
29833
+ style: styles$v.row
29827
29834
  }, labels ? labels[1] : "y coord", /*#__PURE__*/React.createElement(Strut, {
29828
29835
  size: spacing.xxSmall_6
29829
29836
  }), /*#__PURE__*/React.createElement(TextField, {
29830
29837
  type: "number",
29831
29838
  value: coordState[1],
29832
29839
  onChange: newValue => handleCoordChange(newValue, 1),
29833
- style: [styles$u.textField, error ? styles$u.errorField : undefined]
29840
+ style: [styles$v.textField, error ? styles$v.errorField : undefined]
29834
29841
  })));
29835
29842
  };
29836
- const styles$u = StyleSheet.create({
29843
+ const styles$v = StyleSheet.create({
29837
29844
  row: {
29838
29845
  display: "flex",
29839
29846
  flexDirection: "row",
@@ -29866,14 +29873,14 @@ const PerseusEditorAccordion = props => {
29866
29873
  }, /*#__PURE__*/React.createElement(AccordionSection, {
29867
29874
  expanded: expanded,
29868
29875
  onToggle: onToggle,
29869
- style: [styles$t.container, containerStyle],
29870
- headerStyle: styles$t.accordionHeader,
29876
+ style: [styles$u.container, containerStyle],
29877
+ headerStyle: styles$u.accordionHeader,
29871
29878
  header: header
29872
29879
  }, /*#__PURE__*/React.createElement(View, {
29873
- style: [styles$t.accordionPanel, panelStyle]
29880
+ style: [styles$u.accordionPanel, panelStyle]
29874
29881
  }, children)));
29875
29882
  };
29876
- const styles$t = StyleSheet.create({
29883
+ const styles$u = StyleSheet.create({
29877
29884
  container: {
29878
29885
  backgroundColor: color.fadedBlue8,
29879
29886
  marginTop: spacing.xSmall_8
@@ -29904,13 +29911,13 @@ const ColorSwatch = props => {
29904
29911
  "aria-label":
29905
29912
  // Don't include an aria label for decorative circles.
29906
29913
  !decorative ? `${color$1}, ${filled ? "filled" : "open"}` : undefined,
29907
- style: [styles$s.colorSwatch, {
29914
+ style: [styles$t.colorSwatch, {
29908
29915
  border: `4px solid ${lockedFigureColors[color$1]}`,
29909
29916
  backgroundColor: filled ? lockedFigureColors[color$1] : color.white
29910
29917
  }]
29911
29918
  });
29912
29919
  };
29913
- const styles$s = StyleSheet.create({
29920
+ const styles$t = StyleSheet.create({
29914
29921
  colorSwatch: {
29915
29922
  // Add a white outline so that the color swatch is visible when
29916
29923
  // the dropdown option is highlighted with its blue background.
@@ -29929,10 +29936,10 @@ const ColorSelect = props => {
29929
29936
  onChange
29930
29937
  } = props;
29931
29938
  return /*#__PURE__*/React.createElement(View, {
29932
- style: [styles$r.row, style]
29939
+ style: [styles$s.row, style]
29933
29940
  }, /*#__PURE__*/React.createElement(LabelMedium, {
29934
29941
  tag: "label",
29935
- style: styles$r.row
29942
+ style: styles$s.row
29936
29943
  }, "color", /*#__PURE__*/React.createElement(Strut, {
29937
29944
  size: spacing.xxSmall_6
29938
29945
  }), /*#__PURE__*/React.createElement(SingleSelect, {
@@ -29951,7 +29958,7 @@ const ColorSelect = props => {
29951
29958
  })
29952
29959
  }, colorName)))));
29953
29960
  };
29954
- const styles$r = StyleSheet.create({
29961
+ const styles$s = StyleSheet.create({
29955
29962
  row: {
29956
29963
  display: "flex",
29957
29964
  flexDirection: "row",
@@ -29967,17 +29974,17 @@ const EllipseSwatch = props => {
29967
29974
  } = props;
29968
29975
  return /*#__PURE__*/React.createElement(View, {
29969
29976
  "aria-label": `${color}, stroke ${strokeStyle}, fill ${fillStyle}`,
29970
- style: [styles$q.container, {
29977
+ style: [styles$r.container, {
29971
29978
  border: `4px ${strokeStyle} ${lockedFigureColors[color]}`
29972
29979
  }]
29973
29980
  }, /*#__PURE__*/React.createElement(View, {
29974
- style: [styles$q.innerCircle, {
29981
+ style: [styles$r.innerCircle, {
29975
29982
  backgroundColor: lockedFigureColors[color],
29976
29983
  opacity: lockedFigureFillStyles[fillStyle]
29977
29984
  }]
29978
29985
  }));
29979
29986
  };
29980
- const styles$q = StyleSheet.create({
29987
+ const styles$r = StyleSheet.create({
29981
29988
  container: {
29982
29989
  // Add a white outline so that the color swatch is visible when
29983
29990
  // the dropdown option is highlighted with its blue background.
@@ -30008,40 +30015,40 @@ const LockedFigureSettingsActions = props => {
30008
30015
  onRemove
30009
30016
  } = props;
30010
30017
  return /*#__PURE__*/React.createElement(View, {
30011
- style: styles$p.container
30018
+ style: styles$q.container
30012
30019
  }, /*#__PURE__*/React.createElement(Button, {
30013
30020
  startIcon: trashIcon,
30014
30021
  "aria-label": `Delete locked ${figureType}`,
30015
30022
  onClick: onRemove,
30016
30023
  kind: "tertiary",
30017
- style: styles$p.deleteButton
30024
+ style: styles$q.deleteButton
30018
30025
  }, "Delete"), /*#__PURE__*/React.createElement(Spring, null), props.showM2Features && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IconButton, {
30019
30026
  icon: caretDoubleUpIcon,
30020
30027
  size: "small",
30021
30028
  "aria-label": `Move locked ${figureType} to the back`,
30022
30029
  onClick: () => onMove("back"),
30023
- style: styles$p.iconButton
30030
+ style: styles$q.iconButton
30024
30031
  }), /*#__PURE__*/React.createElement(IconButton, {
30025
30032
  icon: caretUpIcon,
30026
30033
  size: "small",
30027
30034
  "aria-label": `Move locked ${figureType} backward`,
30028
30035
  onClick: () => onMove("backward"),
30029
- style: styles$p.iconButton
30036
+ style: styles$q.iconButton
30030
30037
  }), /*#__PURE__*/React.createElement(IconButton, {
30031
30038
  icon: caretDownIcon,
30032
30039
  size: "small",
30033
30040
  "aria-label": `Move locked ${figureType} forward`,
30034
30041
  onClick: () => onMove("forward"),
30035
- style: styles$p.iconButton
30042
+ style: styles$q.iconButton
30036
30043
  }), /*#__PURE__*/React.createElement(IconButton, {
30037
30044
  icon: caretDoubleDownIcon,
30038
30045
  size: "small",
30039
30046
  "aria-label": `Move locked ${figureType} to the front`,
30040
30047
  onClick: () => onMove("front"),
30041
- style: styles$p.iconButton
30048
+ style: styles$q.iconButton
30042
30049
  })));
30043
30050
  };
30044
- const styles$p = StyleSheet.create({
30051
+ const styles$q = StyleSheet.create({
30045
30052
  container: {
30046
30053
  width: "100%",
30047
30054
  flexDirection: "row",
@@ -30088,7 +30095,7 @@ const LockedEllipseSettings = props => {
30088
30095
  /*#__PURE__*/
30089
30096
  // Summary: Ellipse, center, radius, color (opacity, dashed)
30090
30097
  React.createElement(View, {
30091
- style: styles$o.row
30098
+ style: styles$p.row
30092
30099
  }, /*#__PURE__*/React.createElement(LabelLarge, null, `Ellipse (${center[0]}, ${center[1]}), radius ${radius[0]}, ${radius[1]}`), /*#__PURE__*/React.createElement(Strut, {
30093
30100
  size: spacing.xSmall_8
30094
30101
  }), /*#__PURE__*/React.createElement(EllipseSwatch, {
@@ -30097,19 +30104,19 @@ const LockedEllipseSettings = props => {
30097
30104
  strokeStyle: strokeStyle
30098
30105
  }))
30099
30106
  }, /*#__PURE__*/React.createElement(View, {
30100
- style: styles$o.row
30107
+ style: styles$p.row
30101
30108
  }, /*#__PURE__*/React.createElement(CoordinatePairInput, {
30102
30109
  coord: center,
30103
- style: styles$o.spaceUnder,
30110
+ style: styles$p.spaceUnder,
30104
30111
  onChange: newCoords => onChangeProps({
30105
30112
  center: newCoords
30106
30113
  })
30107
30114
  }), /*#__PURE__*/React.createElement(View, {
30108
- style: styles$o.spaceUnder
30115
+ style: styles$p.spaceUnder
30109
30116
  }, /*#__PURE__*/React.createElement(InfoTip$d, null, "The coordinates for the center of the ellipse."))), /*#__PURE__*/React.createElement(CoordinatePairInput, {
30110
30117
  coord: radius,
30111
30118
  labels: ["x radius", "y radius"],
30112
- style: styles$o.spaceUnder,
30119
+ style: styles$p.spaceUnder,
30113
30120
  onChange: newCoords => onChangeProps({
30114
30121
  radius: newCoords
30115
30122
  })
@@ -30121,7 +30128,7 @@ const LockedEllipseSettings = props => {
30121
30128
  }), /*#__PURE__*/React.createElement(Strut, {
30122
30129
  size: spacing.xSmall_8
30123
30130
  }), /*#__PURE__*/React.createElement(View, {
30124
- style: [styles$o.row, styles$o.spaceUnder]
30131
+ style: [styles$p.row, styles$p.spaceUnder]
30125
30132
  }, /*#__PURE__*/React.createElement(ColorSelect, {
30126
30133
  selectedValue: color,
30127
30134
  onChange: handleColorChange
@@ -30129,7 +30136,7 @@ const LockedEllipseSettings = props => {
30129
30136
  size: spacing.medium_16
30130
30137
  }), /*#__PURE__*/React.createElement(LabelMedium, {
30131
30138
  tag: "label",
30132
- style: styles$o.row
30139
+ style: styles$p.row
30133
30140
  }, "fill", /*#__PURE__*/React.createElement(Strut, {
30134
30141
  size: spacing.xxSmall_6
30135
30142
  }), /*#__PURE__*/React.createElement(SingleSelect, {
@@ -30146,7 +30153,7 @@ const LockedEllipseSettings = props => {
30146
30153
  label: option
30147
30154
  }, option))))), /*#__PURE__*/React.createElement(LabelMedium, {
30148
30155
  tag: "label",
30149
- style: styles$o.row
30156
+ style: styles$p.row
30150
30157
  }, "stroke", /*#__PURE__*/React.createElement(Strut, {
30151
30158
  size: spacing.xxSmall_6
30152
30159
  }), /*#__PURE__*/React.createElement(SingleSelect, {
@@ -30170,7 +30177,7 @@ const LockedEllipseSettings = props => {
30170
30177
  onRemove: onRemove
30171
30178
  }));
30172
30179
  };
30173
- const styles$o = StyleSheet.create({
30180
+ const styles$p = StyleSheet.create({
30174
30181
  row: {
30175
30182
  display: "flex",
30176
30183
  flexDirection: "row",
@@ -30191,7 +30198,7 @@ const LabeledSwitch = props => {
30191
30198
  const ids = useUniqueIdWithMock();
30192
30199
  const switchId = ids.get("switch");
30193
30200
  return /*#__PURE__*/React.createElement(View, {
30194
- style: [styles$n.row, style]
30201
+ style: [styles$o.row, style]
30195
30202
  }, /*#__PURE__*/React.createElement(Switch, {
30196
30203
  id: switchId,
30197
30204
  checked: checked,
@@ -30203,7 +30210,7 @@ const LabeledSwitch = props => {
30203
30210
  htmlFor: switchId
30204
30211
  }, label));
30205
30212
  };
30206
- const styles$n = StyleSheet.create({
30213
+ const styles$o = StyleSheet.create({
30207
30214
  row: {
30208
30215
  flexDirection: "row",
30209
30216
  alignItems: "center"
@@ -30237,13 +30244,13 @@ const DefiningPointSettings = props => {
30237
30244
  return /*#__PURE__*/React.createElement(PerseusEditorAccordion, {
30238
30245
  expanded: expanded,
30239
30246
  onToggle: onToggle,
30240
- containerStyle: styles$m.container,
30241
- panelStyle: styles$m.accordionPanel,
30247
+ containerStyle: styles$n.container,
30248
+ panelStyle: styles$n.accordionPanel,
30242
30249
  header:
30243
30250
  /*#__PURE__*/
30244
30251
  // Summary: Point, coords, color (filled/open)
30245
30252
  React.createElement(View, {
30246
- style: styles$m.row
30253
+ style: styles$n.row
30247
30254
  }, /*#__PURE__*/React.createElement(LabelLarge, null, `${label || "Point"} (${coord[0]}, ${coord[1]})`), /*#__PURE__*/React.createElement(Strut, {
30248
30255
  size: spacing.xSmall_8
30249
30256
  }), showPoint && /*#__PURE__*/React.createElement(ColorSwatch, {
@@ -30253,7 +30260,7 @@ const DefiningPointSettings = props => {
30253
30260
  }, /*#__PURE__*/React.createElement(CoordinatePairInput, {
30254
30261
  coord: coord,
30255
30262
  error: !!error,
30256
- style: styles$m.spaceUnder,
30263
+ style: styles$n.spaceUnder,
30257
30264
  onChange: newCoords => {
30258
30265
  onChangeProps({
30259
30266
  coord: newCoords
@@ -30262,12 +30269,12 @@ const DefiningPointSettings = props => {
30262
30269
  }), onTogglePoint && /*#__PURE__*/React.createElement(LabeledSwitch, {
30263
30270
  label: "show point on graph",
30264
30271
  checked: !!showPoint,
30265
- style: showPoint && styles$m.spaceUnder,
30272
+ style: showPoint && styles$n.spaceUnder,
30266
30273
  onChange: onTogglePoint
30267
30274
  }), showPoint && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ColorSelect, {
30268
30275
  selectedValue: pointColor,
30269
30276
  onChange: handleColorChange,
30270
- style: styles$m.spaceUnder
30277
+ style: styles$n.spaceUnder
30271
30278
  }), /*#__PURE__*/React.createElement(LabeledSwitch, {
30272
30279
  label: "open point",
30273
30280
  checked: !filled,
@@ -30278,7 +30285,7 @@ const DefiningPointSettings = props => {
30278
30285
  }
30279
30286
  })));
30280
30287
  };
30281
- const styles$m = StyleSheet.create({
30288
+ const styles$n = StyleSheet.create({
30282
30289
  container: {
30283
30290
  marginTop: spacing.xSmall_8,
30284
30291
  marginBottom: 0,
@@ -30305,15 +30312,15 @@ const LineSwatch = props => {
30305
30312
  lineStyle
30306
30313
  } = props;
30307
30314
  return /*#__PURE__*/React.createElement(View, {
30308
- style: styles$l.container
30315
+ style: styles$m.container
30309
30316
  }, /*#__PURE__*/React.createElement(View, {
30310
30317
  "aria-label": `${color}, ${lineStyle}`,
30311
- style: [styles$l.lineSwatch, {
30318
+ style: [styles$m.lineSwatch, {
30312
30319
  border: `5px ${lineStyle} ${lockedFigureColors[color]}`
30313
30320
  }]
30314
30321
  }));
30315
30322
  };
30316
- const styles$l = StyleSheet.create({
30323
+ const styles$m = StyleSheet.create({
30317
30324
  container: {
30318
30325
  backgroundColor: color.white,
30319
30326
  justifyContent: "center",
@@ -30367,7 +30374,7 @@ const LockedLineSettings = props => {
30367
30374
  expanded: props.expanded,
30368
30375
  onToggle: props.onToggle,
30369
30376
  header: /*#__PURE__*/React.createElement(View, {
30370
- style: styles$k.row
30377
+ style: styles$l.row
30371
30378
  }, /*#__PURE__*/React.createElement(LabelLarge, null, lineLabel), /*#__PURE__*/React.createElement(Strut, {
30372
30379
  size: spacing.xSmall_8
30373
30380
  }), /*#__PURE__*/React.createElement(LineSwatch, {
@@ -30376,7 +30383,7 @@ const LockedLineSettings = props => {
30376
30383
  }))
30377
30384
  }, /*#__PURE__*/React.createElement(LabelMedium, {
30378
30385
  tag: "label",
30379
- style: [styles$k.row, styles$k.spaceUnder]
30386
+ style: [styles$l.row, styles$l.spaceUnder]
30380
30387
  }, "kind", /*#__PURE__*/React.createElement(Strut, {
30381
30388
  size: spacing.xxxSmall_4
30382
30389
  }), /*#__PURE__*/React.createElement(SingleSelect, {
@@ -30397,7 +30404,7 @@ const LockedLineSettings = props => {
30397
30404
  value: "segment",
30398
30405
  label: "segment"
30399
30406
  }))), /*#__PURE__*/React.createElement(View, {
30400
- style: styles$k.row
30407
+ style: styles$l.row
30401
30408
  }, /*#__PURE__*/React.createElement(ColorSelect, {
30402
30409
  selectedValue: lineColor,
30403
30410
  onChange: handleColorChange
@@ -30405,7 +30412,7 @@ const LockedLineSettings = props => {
30405
30412
  size: spacing.small_12
30406
30413
  }), /*#__PURE__*/React.createElement(LabelMedium, {
30407
30414
  tag: "label",
30408
- style: styles$k.row
30415
+ style: styles$l.row
30409
30416
  }, "style", /*#__PURE__*/React.createElement(Strut, {
30410
30417
  size: spacing.xxxSmall_4
30411
30418
  }), /*#__PURE__*/React.createElement(SingleSelect, {
@@ -30416,7 +30423,7 @@ const LockedLineSettings = props => {
30416
30423
  // Placeholder is required, but never gets used.
30417
30424
  ,
30418
30425
  placeholder: "",
30419
- style: styles$k.selectMarginOffset
30426
+ style: styles$l.selectMarginOffset
30420
30427
  }, /*#__PURE__*/React.createElement(OptionItem, {
30421
30428
  value: "solid",
30422
30429
  label: "solid"
@@ -30424,7 +30431,7 @@ const LockedLineSettings = props => {
30424
30431
  value: "dashed",
30425
30432
  label: "dashed"
30426
30433
  })))), isInvalid && /*#__PURE__*/React.createElement(LabelMedium, {
30427
- style: styles$k.errorText
30434
+ style: styles$l.errorText
30428
30435
  }, lengthZeroStr), /*#__PURE__*/React.createElement(DefiningPointSettings, _extends({
30429
30436
  label: "Point 1",
30430
30437
  showPoint: showPoint1,
@@ -30450,7 +30457,7 @@ const LockedLineSettings = props => {
30450
30457
  onRemove: onRemove
30451
30458
  }));
30452
30459
  };
30453
- const styles$k = StyleSheet.create({
30460
+ const styles$l = StyleSheet.create({
30454
30461
  row: {
30455
30462
  display: "flex",
30456
30463
  flexDirection: "row",
@@ -30495,7 +30502,7 @@ const LockedPointSettings = props => {
30495
30502
  /*#__PURE__*/
30496
30503
  // Summary: Point, coords, color (filled/open)
30497
30504
  React.createElement(View, {
30498
- style: styles$j.row
30505
+ style: styles$k.row
30499
30506
  }, /*#__PURE__*/React.createElement(LabelLarge, null, `Point (${coord[0]}, ${coord[1]})`), /*#__PURE__*/React.createElement(Strut, {
30500
30507
  size: spacing.xSmall_8
30501
30508
  }), /*#__PURE__*/React.createElement(ColorSwatch, {
@@ -30504,7 +30511,7 @@ const LockedPointSettings = props => {
30504
30511
  }))
30505
30512
  }, /*#__PURE__*/React.createElement(CoordinatePairInput, {
30506
30513
  coord: coord,
30507
- style: styles$j.spaceUnder,
30514
+ style: styles$k.spaceUnder,
30508
30515
  onChange: newCoord => {
30509
30516
  onChangeProps({
30510
30517
  coord: newCoord
@@ -30513,7 +30520,7 @@ const LockedPointSettings = props => {
30513
30520
  }), /*#__PURE__*/React.createElement(ColorSelect, {
30514
30521
  selectedValue: pointColor,
30515
30522
  onChange: handleColorChange,
30516
- style: styles$j.spaceUnder
30523
+ style: styles$k.spaceUnder
30517
30524
  }), /*#__PURE__*/React.createElement(LabeledSwitch, {
30518
30525
  label: "open point",
30519
30526
  checked: !filled,
@@ -30529,7 +30536,7 @@ const LockedPointSettings = props => {
30529
30536
  onRemove: onRemove
30530
30537
  }));
30531
30538
  };
30532
- const styles$j = StyleSheet.create({
30539
+ const styles$k = StyleSheet.create({
30533
30540
  row: {
30534
30541
  flexDirection: "row",
30535
30542
  alignItems: "center"
@@ -30547,17 +30554,17 @@ const PolygonSwatch = props => {
30547
30554
  } = props;
30548
30555
  return /*#__PURE__*/React.createElement(View, {
30549
30556
  "aria-label": `${color}, stroke ${strokeStyle}, fill ${fillStyle}`,
30550
- style: [styles$i.container, {
30557
+ style: [styles$j.container, {
30551
30558
  border: `4px ${strokeStyle} ${lockedFigureColors[color]}`
30552
30559
  }]
30553
30560
  }, /*#__PURE__*/React.createElement(View, {
30554
- style: [styles$i.innerSquare, {
30561
+ style: [styles$j.innerSquare, {
30555
30562
  backgroundColor: lockedFigureColors[color],
30556
30563
  opacity: lockedFigureFillStyles[fillStyle]
30557
30564
  }]
30558
30565
  }));
30559
30566
  };
30560
- const styles$i = StyleSheet.create({
30567
+ const styles$j = StyleSheet.create({
30561
30568
  container: {
30562
30569
  // Add a white outline so that the color swatch is visible when
30563
30570
  // the dropdown option is highlighted with its blue background.
@@ -30599,7 +30606,7 @@ const LockedPolygonSettings = props => {
30599
30606
  /*#__PURE__*/
30600
30607
  // Summary: Polygon, number of sides, style swatch
30601
30608
  React.createElement(View, {
30602
- style: styles$h.row
30609
+ style: styles$i.row
30603
30610
  }, /*#__PURE__*/React.createElement(LabelLarge, null, `Polygon, ${points.length} sides`), /*#__PURE__*/React.createElement(Strut, {
30604
30611
  size: spacing.xSmall_8
30605
30612
  }), /*#__PURE__*/React.createElement(PolygonSwatch, {
@@ -30608,7 +30615,7 @@ const LockedPolygonSettings = props => {
30608
30615
  strokeStyle: strokeStyle
30609
30616
  }))
30610
30617
  }, /*#__PURE__*/React.createElement(View, {
30611
- style: [styles$h.row, styles$h.spaceUnder]
30618
+ style: [styles$i.row, styles$i.spaceUnder]
30612
30619
  }, /*#__PURE__*/React.createElement(ColorSelect, {
30613
30620
  selectedValue: color,
30614
30621
  onChange: handleColorChange
@@ -30616,7 +30623,7 @@ const LockedPolygonSettings = props => {
30616
30623
  size: spacing.medium_16
30617
30624
  }), /*#__PURE__*/React.createElement(LabelMedium, {
30618
30625
  tag: "label",
30619
- style: styles$h.row
30626
+ style: styles$i.row
30620
30627
  }, "fill", /*#__PURE__*/React.createElement(Strut, {
30621
30628
  size: spacing.xxSmall_6
30622
30629
  }), /*#__PURE__*/React.createElement(SingleSelect, {
@@ -30633,7 +30640,7 @@ const LockedPolygonSettings = props => {
30633
30640
  label: option
30634
30641
  }, option))))), /*#__PURE__*/React.createElement(LabelMedium, {
30635
30642
  tag: "label",
30636
- style: [styles$h.row, styles$h.spaceUnder]
30643
+ style: [styles$i.row, styles$i.spaceUnder]
30637
30644
  }, "stroke", /*#__PURE__*/React.createElement(Strut, {
30638
30645
  size: spacing.xxSmall_6
30639
30646
  }), /*#__PURE__*/React.createElement(SingleSelect, {
@@ -30656,17 +30663,17 @@ const LockedPolygonSettings = props => {
30656
30663
  onChange: newValue => onChangeProps({
30657
30664
  showVertices: newValue
30658
30665
  }),
30659
- style: styles$h.spaceUnder
30666
+ style: styles$i.spaceUnder
30660
30667
  }), /*#__PURE__*/React.createElement(PerseusEditorAccordion, {
30661
30668
  header: /*#__PURE__*/React.createElement(LabelLarge, null, "Points"),
30662
30669
  expanded: true,
30663
- containerStyle: styles$h.pointAccordionContainer,
30664
- panelStyle: styles$h.pointAccordionPanel
30670
+ containerStyle: styles$i.pointAccordionContainer,
30671
+ panelStyle: styles$i.pointAccordionPanel
30665
30672
  }, points.map((point, index) => {
30666
30673
  const pointLabel = String.fromCharCode(65 + index);
30667
30674
  return /*#__PURE__*/React.createElement(View, {
30668
30675
  key: `locked-polygon-point-${point[0]}-${point[1]}-index-${index}`,
30669
- style: [styles$h.row, styles$h.spaceUnder]
30676
+ style: [styles$i.row, styles$i.spaceUnder]
30670
30677
  }, /*#__PURE__*/React.createElement(LabelLarge, null, `${pointLabel}:`), /*#__PURE__*/React.createElement(Strut, {
30671
30678
  size: spacing.medium_16
30672
30679
  }), /*#__PURE__*/React.createElement(CoordinatePairInput, {
@@ -30694,7 +30701,7 @@ const LockedPolygonSettings = props => {
30694
30701
  points: newPoints
30695
30702
  });
30696
30703
  },
30697
- style: styles$h.icon
30704
+ style: styles$i.icon
30698
30705
  }));
30699
30706
  }), /*#__PURE__*/React.createElement(Button, {
30700
30707
  kind: "tertiary",
@@ -30711,7 +30718,7 @@ const LockedPolygonSettings = props => {
30711
30718
  onRemove: onRemove
30712
30719
  }));
30713
30720
  };
30714
- const styles$h = StyleSheet.create({
30721
+ const styles$i = StyleSheet.create({
30715
30722
  row: {
30716
30723
  display: "flex",
30717
30724
  flexDirection: "row",
@@ -30769,7 +30776,7 @@ const LockedVectorSettings = props => {
30769
30776
  expanded: props.expanded,
30770
30777
  onToggle: props.onToggle,
30771
30778
  header: /*#__PURE__*/React.createElement(View, {
30772
- style: styles$g.row
30779
+ style: styles$h.row
30773
30780
  }, /*#__PURE__*/React.createElement(LabelLarge, null, lineLabel), /*#__PURE__*/React.createElement(Strut, {
30774
30781
  size: spacing.xSmall_8
30775
30782
  }), /*#__PURE__*/React.createElement(LineSwatch, {
@@ -30777,19 +30784,19 @@ const LockedVectorSettings = props => {
30777
30784
  lineStyle: "solid"
30778
30785
  }))
30779
30786
  }, /*#__PURE__*/React.createElement(View, {
30780
- style: [styles$g.row, styles$g.spaceUnder]
30787
+ style: [styles$h.row, styles$h.spaceUnder]
30781
30788
  }, /*#__PURE__*/React.createElement(ColorSelect, {
30782
30789
  selectedValue: lineColor,
30783
30790
  onChange: handleColorChange
30784
30791
  })), isInvalid && /*#__PURE__*/React.createElement(LabelMedium, {
30785
- style: styles$g.errorText
30792
+ style: styles$h.errorText
30786
30793
  }, lengthErrorMessage), /*#__PURE__*/React.createElement(PerseusEditorAccordion, {
30787
30794
  expanded: true // Initial state is expanded
30788
30795
  ,
30789
- containerStyle: styles$g.container,
30790
- panelStyle: styles$g.accordionPanel,
30796
+ containerStyle: styles$h.container,
30797
+ panelStyle: styles$h.accordionPanel,
30791
30798
  header: /*#__PURE__*/React.createElement(View, {
30792
- style: styles$g.row
30799
+ style: styles$h.row
30793
30800
  }, /*#__PURE__*/React.createElement(LabelLarge, null, `Tail (${tail[0]}, ${tail[1]})`))
30794
30801
  }, /*#__PURE__*/React.createElement(CoordinatePairInput, {
30795
30802
  coord: tail,
@@ -30800,10 +30807,10 @@ const LockedVectorSettings = props => {
30800
30807
  })), /*#__PURE__*/React.createElement(PerseusEditorAccordion, {
30801
30808
  expanded: true // Initial state is expanded
30802
30809
  ,
30803
- containerStyle: styles$g.container,
30804
- panelStyle: styles$g.accordionPanel,
30810
+ containerStyle: styles$h.container,
30811
+ panelStyle: styles$h.accordionPanel,
30805
30812
  header: /*#__PURE__*/React.createElement(View, {
30806
- style: styles$g.row
30813
+ style: styles$h.row
30807
30814
  }, /*#__PURE__*/React.createElement(LabelLarge, null, `Tip (${tip[0]}, ${tip[1]})`))
30808
30815
  }, /*#__PURE__*/React.createElement(CoordinatePairInput, {
30809
30816
  coord: tip,
@@ -30818,7 +30825,7 @@ const LockedVectorSettings = props => {
30818
30825
  onRemove: onRemove
30819
30826
  }));
30820
30827
  };
30821
- const styles$g = StyleSheet.create({
30828
+ const styles$h = StyleSheet.create({
30822
30829
  accordionPanel: {
30823
30830
  paddingBottom: spacing.medium_16
30824
30831
  },
@@ -30987,7 +30994,7 @@ const LockedFiguresSection = props => {
30987
30994
  onRemove: () => removeLockedFigure(index)
30988
30995
  }));
30989
30996
  }), /*#__PURE__*/React.createElement(View, {
30990
- style: styles$f.buttonContainer
30997
+ style: styles$g.buttonContainer
30991
30998
  }, /*#__PURE__*/React.createElement(LockedFigureSelect, {
30992
30999
  showM2Features: props.showM2Features,
30993
31000
  showM2bFeatures: props.showM2bFeatures,
@@ -30998,10 +31005,10 @@ const LockedFiguresSection = props => {
30998
31005
  }), showExpandButton && /*#__PURE__*/React.createElement(Button, {
30999
31006
  kind: "secondary",
31000
31007
  onClick: () => toggleExpanded(allCollapsed),
31001
- style: styles$f.button
31008
+ style: styles$g.button
31002
31009
  }, buttonLabel)));
31003
31010
  };
31004
- const styles$f = StyleSheet.create({
31011
+ const styles$g = StyleSheet.create({
31005
31012
  buttonContainer: {
31006
31013
  flexDirection: "row",
31007
31014
  alignItems: "center"
@@ -31036,7 +31043,7 @@ const GraphPointsCountSelector = ({
31036
31043
  // Never uses placeholder, always has value
31037
31044
  ,
31038
31045
  placeholder: "",
31039
- style: styles$e.singleSelectShort
31046
+ style: styles$f.singleSelectShort
31040
31047
  }, [...[...Array(7).keys()].map(n => /*#__PURE__*/React.createElement(OptionItem, {
31041
31048
  key: n,
31042
31049
  value: `${n}`,
@@ -31047,7 +31054,7 @@ const GraphPointsCountSelector = ({
31047
31054
  label: "unlimited"
31048
31055
  })]);
31049
31056
  };
31050
- const styles$e = StyleSheet.create({
31057
+ const styles$f = StyleSheet.create({
31051
31058
  singleSelectShort: {
31052
31059
  // Non-standard spacing, but it's the smallest we can go
31053
31060
  // without running into styling issues with the dropdown.
@@ -31060,7 +31067,7 @@ const GraphTypeSelector = props => {
31060
31067
  selectedValue: props.graphType,
31061
31068
  onChange: props.onChange,
31062
31069
  placeholder: "Select a graph type",
31063
- style: styles$d.singleSelectShort
31070
+ style: styles$e.singleSelectShort
31064
31071
  }, /*#__PURE__*/React.createElement(OptionItem, {
31065
31072
  value: "linear",
31066
31073
  label: "Linear function"
@@ -31093,7 +31100,7 @@ const GraphTypeSelector = props => {
31093
31100
  label: "Angle"
31094
31101
  }));
31095
31102
  };
31096
- const styles$d = StyleSheet.create({
31103
+ const styles$e = StyleSheet.create({
31097
31104
  singleSelectShort: {
31098
31105
  // Non-standard spacing, but it's the smallest we can go
31099
31106
  // without running into styling issues with the dropdown.
@@ -31510,10 +31517,10 @@ class InteractiveGraphSettings extends React.Component {
31510
31517
  onChange: this.change
31511
31518
  }))), /*#__PURE__*/React.createElement(LabeledRow, {
31512
31519
  label: "Background image URL:",
31513
- style: styles$c.resetSpaceTop
31520
+ style: styles$d.resetSpaceTop
31514
31521
  }, /*#__PURE__*/React.createElement("input", {
31515
31522
  type: "text",
31516
- className: css(styles$c.backgroundUrlInput),
31523
+ className: css(styles$d.backgroundUrlInput),
31517
31524
  ref: this.bgUrlRef,
31518
31525
  value: this.state.backgroundImage.url || "",
31519
31526
  onChange: e => {
@@ -31527,28 +31534,28 @@ class InteractiveGraphSettings extends React.Component {
31527
31534
  onKeyPress: this.changeBackgroundUrl,
31528
31535
  onBlur: this.changeBackgroundUrl
31529
31536
  }), /*#__PURE__*/React.createElement(InfoTip$c, null, /*#__PURE__*/React.createElement("p", null, "Create an image in graphie, or use the \"Add image\" function to create a background."))), /*#__PURE__*/React.createElement(View, {
31530
- style: styles$c.rulerSection
31537
+ style: styles$d.rulerSection
31531
31538
  }, /*#__PURE__*/React.createElement(View, {
31532
- style: styles$c.checkboxRow
31539
+ style: styles$d.checkboxRow
31533
31540
  }, /*#__PURE__*/React.createElement(PropCheckBox$7, {
31534
31541
  label: "Show ruler",
31535
31542
  showRuler: this.props.showRuler,
31536
31543
  onChange: this.change,
31537
- style: styles$c.resetSpaceTop
31544
+ style: styles$d.resetSpaceTop
31538
31545
  }), /*#__PURE__*/React.createElement(PropCheckBox$7, {
31539
31546
  label: "Show protractor",
31540
31547
  showProtractor: this.props.showProtractor,
31541
31548
  onChange: this.change,
31542
- style: styles$c.resetSpaceTop
31549
+ style: styles$d.resetSpaceTop
31543
31550
  })), (this.props.showRuler || this.props.showProtractor) && /*#__PURE__*/React.createElement(Banner, {
31544
31551
  layout: "floating",
31545
31552
  text: "The ruler and protractor are not accessible. Please consider an alternate approach.",
31546
31553
  kind: "warning"
31547
31554
  }), this.props.showRuler && /*#__PURE__*/React.createElement(View, {
31548
- style: styles$c.spaceTop
31555
+ style: styles$d.spaceTop
31549
31556
  }, /*#__PURE__*/React.createElement(LabeledRow, {
31550
31557
  label: "Ruler label:",
31551
- style: styles$c.resetSpaceTop
31558
+ style: styles$d.resetSpaceTop
31552
31559
  }, /*#__PURE__*/React.createElement(SingleSelect, {
31553
31560
  id: "ruler-label-select",
31554
31561
  selectedValue: this.props.rulerLabel,
@@ -31558,7 +31565,7 @@ class InteractiveGraphSettings extends React.Component {
31558
31565
  });
31559
31566
  },
31560
31567
  placeholder: "None",
31561
- style: styles$c.singleSelectShort
31568
+ style: styles$d.singleSelectShort
31562
31569
  }, /*#__PURE__*/React.createElement(OptionItem, {
31563
31570
  value: "",
31564
31571
  label: "None",
@@ -31599,7 +31606,7 @@ class InteractiveGraphSettings extends React.Component {
31599
31606
  });
31600
31607
  },
31601
31608
  placeholder: "10",
31602
- style: styles$c.singleSelectShort
31609
+ style: styles$d.singleSelectShort
31603
31610
  }, [1, 2, 4, 8, 10, 16].map(value => /*#__PURE__*/React.createElement(OptionItem, {
31604
31611
  key: value,
31605
31612
  value: `${value}`,
@@ -31623,7 +31630,7 @@ InteractiveGraphSettings.defaultProps = {
31623
31630
  rulerLabel: "",
31624
31631
  rulerTicks: 10
31625
31632
  };
31626
- const styles$c = StyleSheet.create({
31633
+ const styles$d = StyleSheet.create({
31627
31634
  resetSpaceTop: {
31628
31635
  marginTop: 0
31629
31636
  },
@@ -31668,13 +31675,13 @@ const SegmentCountSelector = ({
31668
31675
  const num = +newValue;
31669
31676
  onChange(num);
31670
31677
  },
31671
- style: styles$b.singleSelectShort
31678
+ style: styles$c.singleSelectShort
31672
31679
  }, _.range(1, 7).map(n => /*#__PURE__*/React.createElement(OptionItem, {
31673
31680
  key: n,
31674
31681
  value: `${n}`,
31675
31682
  label: `${n} segment${n > 1 ? "s" : ""}`
31676
31683
  })));
31677
- const styles$b = StyleSheet.create({
31684
+ const styles$c = StyleSheet.create({
31678
31685
  singleSelectShort: {
31679
31686
  // Non-standard spacing, but it's the smallest we can go
31680
31687
  // without running into styling issues with the dropdown.
@@ -31682,6 +31689,77 @@ const styles$b = StyleSheet.create({
31682
31689
  }
31683
31690
  });
31684
31691
 
31692
+ const StartCoordSettingsInner = props => {
31693
+ const {
31694
+ type,
31695
+ startCoords,
31696
+ onChange
31697
+ } = props;
31698
+
31699
+ // Check if coords is of type CollinearTuple
31700
+ switch (type) {
31701
+ case "linear":
31702
+ case "ray":
31703
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(View, {
31704
+ style: styles$b.tile
31705
+ }, /*#__PURE__*/React.createElement(LabelLarge, null, "Point 1"), /*#__PURE__*/React.createElement(CoordinatePairInput, {
31706
+ coord: startCoords[0],
31707
+ onChange: value => onChange([value, startCoords[1]])
31708
+ })), /*#__PURE__*/React.createElement(View, {
31709
+ style: styles$b.tile
31710
+ }, /*#__PURE__*/React.createElement(LabelLarge, null, "Point 2"), /*#__PURE__*/React.createElement(CoordinatePairInput, {
31711
+ coord: startCoords[1],
31712
+ onChange: value => onChange([startCoords[0], value])
31713
+ })));
31714
+ default:
31715
+ return null;
31716
+ }
31717
+ };
31718
+ const StartCoordSettings = props => {
31719
+ var _props$startCoords;
31720
+ const {
31721
+ type,
31722
+ range,
31723
+ step,
31724
+ onChange
31725
+ } = props;
31726
+ const [isOpen, setIsOpen] = React.useState(true);
31727
+ if (type !== "linear" && type !== "ray") {
31728
+ return null;
31729
+ }
31730
+ const defaultStartCoords = getLineCoords({
31731
+ type: type
31732
+ }, range, step);
31733
+ return /*#__PURE__*/React.createElement(View, {
31734
+ style: styles$b.container
31735
+ }, /*#__PURE__*/React.createElement(Heading, {
31736
+ title: "Start coordinates",
31737
+ isOpen: isOpen,
31738
+ onToggle: () => setIsOpen(!isOpen)
31739
+ }), isOpen && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StartCoordSettingsInner, {
31740
+ type: type,
31741
+ startCoords: (_props$startCoords = props.startCoords) != null ? _props$startCoords : defaultStartCoords,
31742
+ onChange: onChange
31743
+ }), /*#__PURE__*/React.createElement(Strut, {
31744
+ size: spacing.small_12
31745
+ }), /*#__PURE__*/React.createElement(Button, {
31746
+ startIcon: arrowCounterClockwise,
31747
+ kind: "tertiary",
31748
+ size: "small",
31749
+ onClick: () => {
31750
+ onChange(defaultStartCoords);
31751
+ }
31752
+ }, "Use default start coords")));
31753
+ };
31754
+ const styles$b = StyleSheet.create({
31755
+ tile: {
31756
+ backgroundColor: color.fadedBlue8,
31757
+ marginTop: spacing.xSmall_8,
31758
+ padding: spacing.small_12,
31759
+ borderRadius: spacing.xSmall_8
31760
+ }
31761
+ });
31762
+
31685
31763
  const {
31686
31764
  InfoTip: InfoTip$b
31687
31765
  } = components;
@@ -31729,6 +31807,18 @@ class InteractiveGraphEditor extends React.Component {
31729
31807
  correct: correct
31730
31808
  });
31731
31809
  };
31810
+ this.changeStartCoords = coords => {
31811
+ var _this$props$graph, _this$props$graph2;
31812
+ if (((_this$props$graph = this.props.graph) == null ? void 0 : _this$props$graph.type) !== "linear" && ((_this$props$graph2 = this.props.graph) == null ? void 0 : _this$props$graph2.type) !== "ray") {
31813
+ return;
31814
+ }
31815
+ const graph = _extends({}, this.props.graph, {
31816
+ startCoords: coords
31817
+ });
31818
+ this.props.onChange({
31819
+ graph: graph
31820
+ });
31821
+ };
31732
31822
  this.getSaveWarnings = () => {
31733
31823
  const issues = [];
31734
31824
 
@@ -31747,7 +31837,7 @@ class InteractiveGraphEditor extends React.Component {
31747
31837
  DeprecationMixin.UNSAFE_componentWillMount.call(this);
31748
31838
  }
31749
31839
  render() {
31750
- var _this$props$graph$typ, _this$props$graph, _this$props$correct, _this$props$correct2, _this$props$correct3, _this$props$correct4, _this$props$correct5, _this$props$correct6, _this$props$correct7, _this$props$correct8, _this$props$correct9, _this$props$correct10, _this$props$correct11, _this$props$apiOption, _this$props$apiOption2, _this$props$apiOption3;
31840
+ var _this$props$graph$typ, _this$props$graph3, _this$props$correct, _this$props$correct2, _this$props$correct3, _this$props$correct4, _this$props$correct5, _this$props$correct6, _this$props$correct7, _this$props$correct8, _this$props$correct9, _this$props$correct10, _this$props$correct11, _this$props$graph6, _this$props$graph7, _this$props$apiOption, _this$props$apiOption2, _this$props$apiOption3, _this$props$apiOption4;
31751
31841
  let graph;
31752
31842
  let equationString;
31753
31843
  const gridStep = this.props.gridStep || Util.getGridStep(this.props.range, this.props.step, interactiveSizes.defaultBoxSize);
@@ -31779,13 +31869,14 @@ class InteractiveGraphEditor extends React.Component {
31779
31869
  let correct = this.props.correct;
31780
31870
  // @ts-expect-error - TS2532 - Object is possibly 'undefined'.
31781
31871
  if (correct.type === newProps.graph.type) {
31782
- correct = _.extend({}, correct, newProps.graph);
31872
+ correct = _extends({}, correct, newProps.graph);
31783
31873
  } else {
31784
31874
  // Clear options from previous graph
31785
31875
  correct = newProps.graph;
31786
31876
  }
31787
31877
  this.props.onChange({
31788
- correct: correct
31878
+ correct: correct,
31879
+ graph: this.props.graph
31789
31880
  });
31790
31881
  }
31791
31882
  };
@@ -31813,7 +31904,7 @@ class InteractiveGraphEditor extends React.Component {
31813
31904
  return /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(LabeledRow, {
31814
31905
  label: "Type of Graph:"
31815
31906
  }, /*#__PURE__*/React.createElement(GraphTypeSelector, {
31816
- graphType: (_this$props$graph$typ = (_this$props$graph = this.props.graph) == null ? void 0 : _this$props$graph.type) != null ? _this$props$graph$typ : InteractiveGraph.defaultProps.graph.type,
31907
+ graphType: (_this$props$graph$typ = (_this$props$graph3 = this.props.graph) == null ? void 0 : _this$props$graph3.type) != null ? _this$props$graph$typ : InteractiveGraph.defaultProps.graph.type,
31817
31908
  onChange: type => {
31818
31909
  this.props.onChange({
31819
31910
  graph: {
@@ -31899,8 +31990,8 @@ class InteractiveGraphEditor extends React.Component {
31899
31990
  // Don't show indeterminate checkbox state
31900
31991
  !!((_this$props$correct8 = this.props.correct) != null && _this$props$correct8.showAngles),
31901
31992
  onChange: () => {
31902
- var _this$props$graph2;
31903
- if (((_this$props$graph2 = this.props.graph) == null ? void 0 : _this$props$graph2.type) === "polygon") {
31993
+ var _this$props$graph4;
31994
+ if (((_this$props$graph4 = this.props.graph) == null ? void 0 : _this$props$graph4.type) === "polygon") {
31904
31995
  this.props.onChange({
31905
31996
  correct: _extends({}, this.props.correct, {
31906
31997
  showAngles: !this.props.correct.showAngles
@@ -31919,8 +32010,8 @@ class InteractiveGraphEditor extends React.Component {
31919
32010
  // Don't show indeterminate checkbox state
31920
32011
  !!((_this$props$correct9 = this.props.correct) != null && _this$props$correct9.showSides),
31921
32012
  onChange: () => {
31922
- var _this$props$graph3;
31923
- if (((_this$props$graph3 = this.props.graph) == null ? void 0 : _this$props$graph3.type) === "polygon") {
32013
+ var _this$props$graph5;
32014
+ if (((_this$props$graph5 = this.props.graph) == null ? void 0 : _this$props$graph5.type) === "polygon") {
31924
32015
  this.props.onChange({
31925
32016
  correct: _extends({}, this.props.correct, {
31926
32017
  showSides: !this.props.correct.showSides
@@ -31948,6 +32039,10 @@ class InteractiveGraphEditor extends React.Component {
31948
32039
  }
31949
32040
  });
31950
32041
  }
32042
+ })), (((_this$props$graph6 = this.props.graph) == null ? void 0 : _this$props$graph6.type) === "linear" || ((_this$props$graph7 = this.props.graph) == null ? void 0 : _this$props$graph7.type) === "ray") && ((_this$props$apiOption = this.props.apiOptions.flags) == null || (_this$props$apiOption = _this$props$apiOption.mafs) == null ? void 0 : _this$props$apiOption["start-coords-ui"]) && /*#__PURE__*/React.createElement(StartCoordSettings, _extends({}, this.props.graph, {
32043
+ range: this.props.range,
32044
+ step: this.props.step,
32045
+ onChange: this.changeStartCoords
31951
32046
  })), /*#__PURE__*/React.createElement(InteractiveGraphSettings, {
31952
32047
  box: getInteractiveBoxFromSizeClass(sizeClass),
31953
32048
  range: this.props.range,
@@ -32014,24 +32109,30 @@ class InteractiveGraphEditor extends React.Component {
32014
32109
  }, equationString), /*#__PURE__*/React.createElement(InfoTip$b, null, /*#__PURE__*/React.createElement("p", null, "Graph the correct answer in the graph below and ensure the equation or point coordinates displayed represent the correct answer."))), graph,
32015
32110
  // Only show the "Add locked figure" dropdown if the graph
32016
32111
  // is using Mafs.
32017
- this.props.graph && ((_this$props$apiOption = this.props.apiOptions) == null || (_this$props$apiOption = _this$props$apiOption.flags) == null || (_this$props$apiOption = _this$props$apiOption.mafs) == null ? void 0 : _this$props$apiOption[this.props.graph.type]) && /*#__PURE__*/React.createElement(LockedFiguresSection, {
32018
- showM2Features: (_this$props$apiOption2 = this.props.apiOptions) == null || (_this$props$apiOption2 = _this$props$apiOption2.flags) == null || (_this$props$apiOption2 = _this$props$apiOption2.mafs) == null ? void 0 : _this$props$apiOption2["interactive-graph-locked-features-m2"],
32019
- showM2bFeatures: (_this$props$apiOption3 = this.props.apiOptions) == null || (_this$props$apiOption3 = _this$props$apiOption3.flags) == null || (_this$props$apiOption3 = _this$props$apiOption3.mafs) == null ? void 0 : _this$props$apiOption3["interactive-graph-locked-features-m2b"],
32112
+ this.props.graph && ((_this$props$apiOption2 = this.props.apiOptions) == null || (_this$props$apiOption2 = _this$props$apiOption2.flags) == null || (_this$props$apiOption2 = _this$props$apiOption2.mafs) == null ? void 0 : _this$props$apiOption2[this.props.graph.type]) && /*#__PURE__*/React.createElement(LockedFiguresSection, {
32113
+ showM2Features: (_this$props$apiOption3 = this.props.apiOptions) == null || (_this$props$apiOption3 = _this$props$apiOption3.flags) == null || (_this$props$apiOption3 = _this$props$apiOption3.mafs) == null ? void 0 : _this$props$apiOption3["interactive-graph-locked-features-m2"],
32114
+ showM2bFeatures: (_this$props$apiOption4 = this.props.apiOptions) == null || (_this$props$apiOption4 = _this$props$apiOption4.flags) == null || (_this$props$apiOption4 = _this$props$apiOption4.mafs) == null ? void 0 : _this$props$apiOption4["interactive-graph-locked-features-m2b"],
32020
32115
  figures: this.props.lockedFigures,
32021
32116
  onChange: this.props.onChange
32022
32117
  }));
32023
32118
  }
32119
+ // serialize() is what makes copy/paste work. All the properties included
32120
+ // in the serialization json are included when, for example, a graph
32121
+ // is copied from the question editor and pasted into the hint editor
32122
+ // (double brackets in the markdown).
32024
32123
  serialize() {
32025
32124
  const json = _.pick(this.props, "step", "backgroundImage", "markings", "labels", "showProtractor", "showRuler", "showTooltips", "rulerLabel", "rulerTicks", "range", "gridStep", "snapStep", "lockedFigures");
32026
32125
 
32027
32126
  // eslint-disable-next-line react/no-string-refs
32028
32127
  const graph = this.refs.graph;
32029
32128
  if (graph) {
32129
+ var _this$props$graph8;
32030
32130
  // @ts-expect-error TS2339 Property 'getUserInput' does not exist on type 'ReactInstance'. Property 'getUserInput' does not exist on type 'Component<any, {}, any>'.
32031
32131
  const correct = graph && graph.getUserInput();
32032
32132
  _.extend(json, {
32033
32133
  graph: {
32034
- type: correct.type
32134
+ type: correct.type,
32135
+ startCoords: (_this$props$graph8 = this.props.graph) == null ? void 0 : _this$props$graph8.startCoords
32035
32136
  },
32036
32137
  correct: correct
32037
32138
  });
@@ -34471,9 +34572,14 @@ class NumericInputEditor extends React.Component {
34471
34572
  onChange: this.props.onChange
34472
34573
  }), /*#__PURE__*/React.createElement(InfoTip$7, null, /*#__PURE__*/React.createElement("p", null, "A coefficient style number allows the student to use - for -1 and an empty string to mean 1."))));
34473
34574
  const addAnswerButton = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("a", {
34474
- href: "javascript:void(0)",
34575
+ href: "#",
34475
34576
  className: "simple-button orange",
34476
- onClick: () => this.addAnswer(),
34577
+ onClick: e => {
34578
+ // preventDefault ensures that href="#"
34579
+ // doesn't scroll to the top of the page
34580
+ e.preventDefault();
34581
+ this.addAnswer();
34582
+ },
34477
34583
  onKeyDown: e => this.onSpace(e, this.addAnswer)
34478
34584
  }, /*#__PURE__*/React.createElement("span", null, "Add new answer")));
34479
34585
  const instructions = {
@@ -34555,21 +34661,36 @@ class NumericInputEditor extends React.Component {
34555
34661
  })) : null, /*#__PURE__*/React.createElement("div", {
34556
34662
  className: "value-divider"
34557
34663
  }), /*#__PURE__*/React.createElement("a", {
34558
- href: "javascript:void(0)",
34664
+ href: "#",
34559
34665
  className: "answer-status " + answer.status,
34560
- onClick: () => this.onStatusChange(i),
34666
+ onClick: e => {
34667
+ // preventDefault ensures that href="#"
34668
+ // doesn't scroll to the top of the page
34669
+ e.preventDefault();
34670
+ this.onStatusChange(i);
34671
+ },
34561
34672
  onKeyDown: e => this.onSpace(e, this.onStatusChange)
34562
34673
  }, answer.status), /*#__PURE__*/React.createElement("a", {
34563
- href: "javascript:void(0)",
34674
+ href: "#",
34564
34675
  className: "answer-trash",
34565
34676
  "aria-label": "Delete answer",
34566
- onClick: () => this.onTrashAnswer(i),
34677
+ onClick: e => {
34678
+ // preventDefault ensures that href="#"
34679
+ // doesn't scroll to the top of the page
34680
+ e.preventDefault();
34681
+ this.onTrashAnswer(i);
34682
+ },
34567
34683
  onKeyDown: e => this.onSpace(e, this.onTrashAnswer)
34568
34684
  }, /*#__PURE__*/React.createElement(InlineIcon$2, iconTrash$1)), /*#__PURE__*/React.createElement("a", {
34569
- href: "javascript:void(0)",
34685
+ href: "#",
34570
34686
  className: "options-toggle",
34571
34687
  "aria-label": "Toggle options",
34572
- onClick: () => this.onToggleOptions(i),
34688
+ onClick: e => {
34689
+ // preventDefault ensures that href="#"
34690
+ // doesn't scroll to the top of the page
34691
+ e.preventDefault();
34692
+ this.onToggleOptions(i);
34693
+ },
34573
34694
  onKeyDown: e => this.onSpace(e, this.onToggleOptions)
34574
34695
  }, /*#__PURE__*/React.createElement(InlineIcon$2, iconGear))), /*#__PURE__*/React.createElement("div", {
34575
34696
  className: "input-answer-editor-message"