@khanacademy/perseus-editor 5.2.14 → 5.3.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/index.js CHANGED
@@ -24,7 +24,9 @@ var mathInput = require('@khanacademy/math-input');
24
24
  var wonderBlocksDropdown = require('@khanacademy/wonder-blocks-dropdown');
25
25
  var wonderBlocksForm = require('@khanacademy/wonder-blocks-form');
26
26
  var wonderBlocksTypography = require('@khanacademy/wonder-blocks-typography');
27
+ var wonderBlocksAccordion = require('@khanacademy/wonder-blocks-accordion');
27
28
  var IconButton = require('@khanacademy/wonder-blocks-icon-button');
29
+ var Switch = require('@khanacademy/wonder-blocks-switch');
28
30
  var trashIcon = require('@phosphor-icons/core/bold/trash-bold.svg');
29
31
  var Button = require('@khanacademy/wonder-blocks-button');
30
32
  var i18n$1 = require('@khanacademy/wonder-blocks-i18n');
@@ -60,13 +62,14 @@ var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
60
62
  var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
61
63
  var KAS__namespace = /*#__PURE__*/_interopNamespace(KAS);
62
64
  var IconButton__default = /*#__PURE__*/_interopDefaultLegacy(IconButton);
65
+ var Switch__default = /*#__PURE__*/_interopDefaultLegacy(Switch);
63
66
  var trashIcon__default = /*#__PURE__*/_interopDefaultLegacy(trashIcon);
64
67
  var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
65
68
  var i18n__namespace = /*#__PURE__*/_interopNamespace(i18n$1);
66
69
 
67
70
  // This file is processed by a Rollup plugin (replace) to inject the production
68
71
  const libName = "@khanacademy/perseus-editor";
69
- const libVersion = "5.2.14";
72
+ const libVersion = "5.3.0";
70
73
  perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
71
74
 
72
75
  function _extends() {
@@ -261,13 +264,13 @@ class SectionControlButton extends React__namespace.Component {
261
264
  role: "button",
262
265
  hideDefaultFocusRing: true,
263
266
  "aria-label": title,
264
- style: styles$q.button
267
+ style: styles$r.button
265
268
  }, _ref => {
266
269
  return /*#__PURE__*/React__namespace.createElement(InlineIcon$b, icon);
267
270
  });
268
271
  }
269
272
  }
270
- const styles$q = aphrodite.StyleSheet.create({
273
+ const styles$r = aphrodite.StyleSheet.create({
271
274
  button: {
272
275
  backgroundColor: wonderBlocksTokens.color.gold,
273
276
  margin: 2,
@@ -20785,19 +20788,19 @@ class TexErrorView extends React__namespace.Component {
20785
20788
  const {
20786
20789
  showErrors
20787
20790
  } = this.state;
20788
- const iconStyle = showErrors ? styles$p.iconExpanded : styles$p.iconCollapsed;
20791
+ const iconStyle = showErrors ? styles$q.iconExpanded : styles$q.iconCollapsed;
20789
20792
  return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
20790
- style: styles$p.errorContainer
20793
+ style: styles$q.errorContainer
20791
20794
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
20792
- style: styles$p.title,
20795
+ style: styles$q.title,
20793
20796
  onClick: this.handleToggleTexErrors
20794
20797
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksIcon.PhosphorIcon, {
20795
20798
  icon: caretRight__default["default"],
20796
20799
  style: iconStyle
20797
20800
  }), "\xA0 TeX Errors (", errorList.length, ")"), showErrors && /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
20798
- style: styles$p.errorExplanation
20801
+ style: styles$q.errorExplanation
20799
20802
  }, "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__namespace.createElement(wonderBlocksCore.View, {
20800
- style: styles$p.error,
20803
+ style: styles$q.error,
20801
20804
  key: index
20802
20805
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
20803
20806
  style: {
@@ -20806,7 +20809,7 @@ class TexErrorView extends React__namespace.Component {
20806
20809
  }, e.math), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, null, e.message))));
20807
20810
  }
20808
20811
  }
20809
- const styles$p = aphrodite.StyleSheet.create({
20812
+ const styles$q = aphrodite.StyleSheet.create({
20810
20813
  title: {
20811
20814
  backgroundColor: "#eee",
20812
20815
  fontSize: "1.25em",
@@ -24556,12 +24559,12 @@ class SimpleButton extends React__namespace.Component {
24556
24559
  ...otherProps
24557
24560
  } = this.props;
24558
24561
  return /*#__PURE__*/React__namespace.createElement("div", _extends({
24559
- className: aphrodite.css(styles$o.baseButton, color === "green" && styles$o.green, color === "orange" && styles$o.orange),
24562
+ className: aphrodite.css(styles$p.baseButton, color === "green" && styles$p.green, color === "orange" && styles$p.orange),
24560
24563
  onClick: onClick
24561
24564
  }, otherProps), children);
24562
24565
  }
24563
24566
  }
24564
- const styles$o = aphrodite.StyleSheet.create({
24567
+ const styles$p = aphrodite.StyleSheet.create({
24565
24568
  baseButton: {
24566
24569
  top: "0",
24567
24570
  fontSize: "11px",
@@ -24774,23 +24777,23 @@ const LeafContainer = _ref2 => {
24774
24777
  } = _ref2;
24775
24778
  const hasPreviewHeading = shape.type === "content" || shape.type === "hint";
24776
24779
  const previewHeading = hasPreviewHeading && /*#__PURE__*/React__namespace.createElement("div", {
24777
- className: aphrodite.css(styles$n.containerHeader)
24780
+ className: aphrodite.css(styles$o.containerHeader)
24778
24781
  }, /*#__PURE__*/React__namespace.createElement(Header, {
24779
24782
  depth: path.length,
24780
- className: aphrodite.css(styles$n.containerTitle)
24783
+ className: aphrodite.css(styles$o.containerTitle)
24781
24784
  }, capitalize(name)));
24782
24785
  return /*#__PURE__*/React__namespace.createElement("div", {
24783
- className: aphrodite.css(styles$n.container)
24786
+ className: aphrodite.css(styles$o.container)
24784
24787
  }, /*#__PURE__*/React__namespace.createElement("span", {
24785
- className: aphrodite.css(styles$n.row, styles$n.rowHeading)
24788
+ className: aphrodite.css(styles$o.row, styles$o.rowHeading)
24786
24789
  }, /*#__PURE__*/React__namespace.createElement("div", {
24787
- className: aphrodite.css(styles$n.columnLeft)
24790
+ className: aphrodite.css(styles$o.columnLeft)
24788
24791
  }, /*#__PURE__*/React__namespace.createElement("div", {
24789
- className: "pod-title " + aphrodite.css(styles$n.containerHeader)
24792
+ className: "pod-title " + aphrodite.css(styles$o.containerHeader)
24790
24793
  }, /*#__PURE__*/React__namespace.createElement("div", {
24791
- className: aphrodite.css(styles$n.containerTitle)
24794
+ className: aphrodite.css(styles$o.containerTitle)
24792
24795
  }, capitalize(name)), controls)), /*#__PURE__*/React__namespace.createElement("div", {
24793
- className: aphrodite.css(styles$n.columnRight)
24796
+ className: aphrodite.css(styles$o.columnRight)
24794
24797
  }, previewHeading)), children);
24795
24798
  };
24796
24799
  const ArrayContainer = props => {
@@ -24803,11 +24806,11 @@ const ArrayContainer = props => {
24803
24806
  actions
24804
24807
  } = props;
24805
24808
  return /*#__PURE__*/React__namespace.createElement("div", {
24806
- className: aphrodite.css(styles$n.container)
24809
+ className: aphrodite.css(styles$o.container)
24807
24810
  }, controls && /*#__PURE__*/React__namespace.createElement("div", {
24808
- className: aphrodite.css(styles$n.columnLeft, styles$n.containerHeader)
24811
+ className: aphrodite.css(styles$o.columnLeft, styles$o.containerHeader)
24809
24812
  }, controls), /*#__PURE__*/React__namespace.createElement("div", null, children), /*#__PURE__*/React__namespace.createElement("div", {
24810
- className: aphrodite.css(styles$n.columnLeft)
24813
+ className: aphrodite.css(styles$o.columnLeft)
24811
24814
  }, /*#__PURE__*/React__namespace.createElement("a", {
24812
24815
  href: "javascript:void 0",
24813
24816
  onClick: () => actions.addArrayElement(path, shape.elementShape)
@@ -24821,28 +24824,28 @@ const ObjectContainer = _ref3 => {
24821
24824
  path
24822
24825
  } = _ref3;
24823
24826
  const headingEditor = /*#__PURE__*/React__namespace.createElement("div", {
24824
- className: aphrodite.css(styles$n.containerHeader)
24827
+ className: aphrodite.css(styles$o.containerHeader)
24825
24828
  }, /*#__PURE__*/React__namespace.createElement(Header, {
24826
24829
  depth: path.length,
24827
- className: aphrodite.css(styles$n.containerTitle)
24830
+ className: aphrodite.css(styles$o.containerTitle)
24828
24831
  }, capitalize(name)), controls);
24829
24832
  const headingPreview = (name || controls) && /*#__PURE__*/React__namespace.createElement("div", {
24830
- className: aphrodite.css(styles$n.containerHeader, styles$n.previewCollectionHeader)
24833
+ className: aphrodite.css(styles$o.containerHeader, styles$o.previewCollectionHeader)
24831
24834
  }, /*#__PURE__*/React__namespace.createElement(Header, {
24832
24835
  depth: path.length,
24833
- className: aphrodite.css(styles$n.containerTitle)
24836
+ className: aphrodite.css(styles$o.containerTitle)
24834
24837
  }, capitalize(name)));
24835
24838
  const hasBothHeadings = headingEditor && headingPreview;
24836
24839
  return /*#__PURE__*/React__namespace.createElement("div", {
24837
- className: aphrodite.css(styles$n.container)
24840
+ className: aphrodite.css(styles$o.container)
24838
24841
  }, hasBothHeadings && /*#__PURE__*/React__namespace.createElement("span", {
24839
- className: aphrodite.css(styles$n.row)
24842
+ className: aphrodite.css(styles$o.row)
24840
24843
  }, /*#__PURE__*/React__namespace.createElement("div", {
24841
- className: aphrodite.css(styles$n.columnLeft)
24844
+ className: aphrodite.css(styles$o.columnLeft)
24842
24845
  }, headingEditor), /*#__PURE__*/React__namespace.createElement("div", {
24843
- className: aphrodite.css(styles$n.columnRight)
24846
+ className: aphrodite.css(styles$o.columnRight)
24844
24847
  }, headingPreview)), /*#__PURE__*/React__namespace.createElement("div", {
24845
- className: aphrodite.css(path.length > 0 && styles$n.contentIndent)
24848
+ className: aphrodite.css(path.length > 0 && styles$o.contentIndent)
24846
24849
  }, children));
24847
24850
  };
24848
24851
 
@@ -24962,11 +24965,11 @@ const ItemNodeContent = withStickiness(props => {
24962
24965
  className: "framework-perseus"
24963
24966
  }, lens(renderers).get(path));
24964
24967
  return /*#__PURE__*/React__namespace.createElement("span", null, /*#__PURE__*/React__namespace.createElement("div", {
24965
- className: aphrodite.css(styles$n.row)
24968
+ className: aphrodite.css(styles$o.row)
24966
24969
  }, /*#__PURE__*/React__namespace.createElement("div", {
24967
- className: aphrodite.css(styles$n.columnLeft)
24970
+ className: aphrodite.css(styles$o.columnLeft)
24968
24971
  }, /*#__PURE__*/React__namespace.createElement("div", {
24969
- className: aphrodite.css(sticky && styles$n.sticky)
24972
+ className: aphrodite.css(sticky && styles$o.sticky)
24970
24973
  },
24971
24974
  /*#__PURE__*/
24972
24975
  // @ts-expect-error - TS2769 - No overload matches this call.
@@ -24974,9 +24977,9 @@ const ItemNodeContent = withStickiness(props => {
24974
24977
  onChange: newVal => actions.mergeValueAtPath(path, newVal),
24975
24978
  apiOptions: apiOptions
24976
24979
  })))), /*#__PURE__*/React__namespace.createElement("div", {
24977
- className: aphrodite.css(styles$n.columnRight)
24980
+ className: aphrodite.css(styles$o.columnRight)
24978
24981
  }, /*#__PURE__*/React__namespace.createElement("div", {
24979
- className: aphrodite.css(sticky && styles$n.sticky)
24982
+ className: aphrodite.css(sticky && styles$o.sticky)
24980
24983
  }, preview))));
24981
24984
  });
24982
24985
  const HintNodeContent = withStickiness(props => {
@@ -24992,13 +24995,13 @@ const HintNodeContent = withStickiness(props => {
24992
24995
  className: "framework-perseus"
24993
24996
  }, lens(renderers).get(path));
24994
24997
  return /*#__PURE__*/React__namespace.createElement("div", {
24995
- className: aphrodite.css(styles$n.row)
24998
+ className: aphrodite.css(styles$o.row)
24996
24999
  }, /*#__PURE__*/React__namespace.createElement("div", {
24997
- className: aphrodite.css(styles$n.columnLeft)
25000
+ className: aphrodite.css(styles$o.columnLeft)
24998
25001
  }, /*#__PURE__*/React__namespace.createElement("div", {
24999
- className: aphrodite.css(sticky && styles$n.sticky)
25002
+ className: aphrodite.css(sticky && styles$o.sticky)
25000
25003
  }, /*#__PURE__*/React__namespace.createElement(HintEditor, _extends({}, data, {
25001
- className: aphrodite.css(styles$n.hintEditor),
25004
+ className: aphrodite.css(styles$o.hintEditor),
25002
25005
  onChange: newVal => actions.mergeValueAtPath(path, newVal),
25003
25006
  apiOptions: apiOptions,
25004
25007
  showTitle: false,
@@ -25013,9 +25016,9 @@ const HintNodeContent = withStickiness(props => {
25013
25016
  isFirst: true,
25014
25017
  isLast: true
25015
25018
  })))), /*#__PURE__*/React__namespace.createElement("div", {
25016
- className: aphrodite.css(styles$n.columnRight)
25019
+ className: aphrodite.css(styles$o.columnRight)
25017
25020
  }, /*#__PURE__*/React__namespace.createElement("div", {
25018
- className: aphrodite.css(sticky && styles$n.sticky)
25021
+ className: aphrodite.css(sticky && styles$o.sticky)
25019
25022
  }, preview)));
25020
25023
  });
25021
25024
  const TagsNodeContent = props => {
@@ -25032,9 +25035,9 @@ const TagsNodeContent = props => {
25032
25035
  return null;
25033
25036
  }
25034
25037
  return /*#__PURE__*/React__namespace.createElement("div", {
25035
- className: aphrodite.css(styles$n.columnLeft)
25038
+ className: aphrodite.css(styles$o.columnLeft)
25036
25039
  }, /*#__PURE__*/React__namespace.createElement("div", {
25037
- className: aphrodite.css(styles$n.tagsEditor)
25040
+ className: aphrodite.css(styles$o.tagsEditor)
25038
25041
  }, /*#__PURE__*/React__namespace.createElement(GroupMetadataEditor, {
25039
25042
  value: data,
25040
25043
  onChange: newVal => actions.setValueAtPath(path, newVal),
@@ -25065,23 +25068,23 @@ const ArrayNodeContent = props => {
25065
25068
  const subpath = path.concat(i);
25066
25069
  const controls = [i > 0 && /*#__PURE__*/React__namespace.createElement("div", {
25067
25070
  key: "moveArrayElementUp",
25068
- className: aphrodite.css(styles$n.control)
25071
+ className: aphrodite.css(styles$o.control)
25069
25072
  }, /*#__PURE__*/React__namespace.createElement(SimpleButton, {
25070
25073
  color: "orange",
25071
25074
  title: "Move up",
25072
25075
  onClick: () => actions.moveArrayElementUp(subpath)
25073
25076
  }, /*#__PURE__*/React__namespace.createElement("div", {
25074
- className: aphrodite.css(styles$n.verticalFlip)
25077
+ className: aphrodite.css(styles$o.verticalFlip)
25075
25078
  }, /*#__PURE__*/React__namespace.createElement(InlineIcon$6, iconChevronDown)))), i < data.length - 1 && /*#__PURE__*/React__namespace.createElement("div", {
25076
25079
  key: "moveArrayElementDown",
25077
- className: aphrodite.css(styles$n.control)
25080
+ className: aphrodite.css(styles$o.control)
25078
25081
  }, /*#__PURE__*/React__namespace.createElement(SimpleButton, {
25079
25082
  color: "orange",
25080
25083
  title: "Move down",
25081
25084
  onClick: () => actions.moveArrayElementDown(subpath)
25082
25085
  }, /*#__PURE__*/React__namespace.createElement(InlineIcon$6, iconChevronDown))), /*#__PURE__*/React__namespace.createElement("div", {
25083
25086
  key: "removeArrayElement",
25084
- className: aphrodite.css(styles$n.control)
25087
+ className: aphrodite.css(styles$o.control)
25085
25088
  }, /*#__PURE__*/React__namespace.createElement(SimpleButton, {
25086
25089
  color: "orange",
25087
25090
  title: "Delete",
@@ -25089,7 +25092,7 @@ const ArrayNodeContent = props => {
25089
25092
  }, /*#__PURE__*/React__namespace.createElement(InlineIcon$6, iconTrash$4)))];
25090
25093
  return /*#__PURE__*/React__namespace.createElement("div", {
25091
25094
  key: i,
25092
- className: aphrodite.css(styles$n.arrayElement, !elementIsLeaf && styles$n.arrayElementAndNotLeaf)
25095
+ className: aphrodite.css(styles$o.arrayElement, !elementIsLeaf && styles$o.arrayElementAndNotLeaf)
25093
25096
  }, /*#__PURE__*/React__namespace.createElement(NodeContainer, _extends({}, otherProps, {
25094
25097
  key: i,
25095
25098
  shape: shape.elementShape,
@@ -25115,7 +25118,7 @@ const ObjectNodeContent = props => {
25115
25118
  // made sense to the shape's author is the order in which we'll iterate :)
25116
25119
  const children = Object.keys(shape.shape).map(subkey => /*#__PURE__*/React__namespace.createElement("div", {
25117
25120
  key: subkey,
25118
- className: aphrodite.css(styles$n.objectElement)
25121
+ className: aphrodite.css(styles$o.objectElement)
25119
25122
  }, /*#__PURE__*/React__namespace.createElement(NodeContainer, _extends({}, otherProps, {
25120
25123
  shape: shape.shape[subkey],
25121
25124
  data: data[subkey],
@@ -25284,7 +25287,7 @@ class MultiRendererEditor extends React__namespace.Component {
25284
25287
  }, this._renderContent());
25285
25288
  }
25286
25289
  }
25287
- const styles$n = aphrodite.StyleSheet.create({
25290
+ const styles$o = aphrodite.StyleSheet.create({
25288
25291
  // This is used in a number of places throughout this file.
25289
25292
  container: {},
25290
25293
  // eslint-disable-next-line react-native/no-unused-styles
@@ -25436,47 +25439,47 @@ const StatefulArticleEditor = createReactClass__default["default"]({
25436
25439
  screen
25437
25440
  } = this.state;
25438
25441
  return /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("div", {
25439
- style: styles$m.controlBar
25442
+ style: styles$n.controlBar
25440
25443
  }, /*#__PURE__*/React__namespace.createElement("span", {
25441
- style: styles$m.controls
25444
+ style: styles$n.controls
25442
25445
  }, "Mode:", " ", /*#__PURE__*/React__namespace.createElement("span", {
25443
25446
  onClick: () => this.setState({
25444
25447
  mode: "edit"
25445
25448
  }),
25446
- style: mode === "edit" ? styles$m.controlSelected : styles$m.control
25449
+ style: mode === "edit" ? styles$n.controlSelected : styles$n.control
25447
25450
  }, "EDIT"), " | ", /*#__PURE__*/React__namespace.createElement("span", {
25448
25451
  onClick: () => this.setState({
25449
25452
  mode: "preview"
25450
25453
  }),
25451
- style: mode === "preview" ? styles$m.controlSelected : styles$m.control
25454
+ style: mode === "preview" ? styles$n.controlSelected : styles$n.control
25452
25455
  }, "PREVIEW"), " | ", /*#__PURE__*/React__namespace.createElement("span", {
25453
25456
  onClick: () => this.setState({
25454
25457
  mode: "json"
25455
25458
  }),
25456
- style: mode === "json" ? styles$m.controlSelected : styles$m.control
25459
+ style: mode === "json" ? styles$n.controlSelected : styles$n.control
25457
25460
  }, "JSON")), /*#__PURE__*/React__namespace.createElement("span", {
25458
- style: styles$m.controls
25461
+ style: styles$n.controls
25459
25462
  }, "Screen:", " ", /*#__PURE__*/React__namespace.createElement("span", {
25460
25463
  onClick: () => this.setState({
25461
25464
  screen: "phone"
25462
25465
  }),
25463
- style: screen === "phone" ? styles$m.controlSelected : styles$m.control
25466
+ style: screen === "phone" ? styles$n.controlSelected : styles$n.control
25464
25467
  }, "PHONE"), " | ", /*#__PURE__*/React__namespace.createElement("span", {
25465
25468
  onClick: () => this.setState({
25466
25469
  screen: "tablet"
25467
25470
  }),
25468
- style: screen === "tablet" ? styles$m.controlSelected : styles$m.control
25471
+ style: screen === "tablet" ? styles$n.controlSelected : styles$n.control
25469
25472
  }, "TABLET"), " | ", /*#__PURE__*/React__namespace.createElement("span", {
25470
25473
  onClick: () => this.setState({
25471
25474
  screen: "desktop"
25472
25475
  }),
25473
- style: screen === "desktop" ? styles$m.controlSelected : styles$m.control
25476
+ style: screen === "desktop" ? styles$n.controlSelected : styles$n.control
25474
25477
  }, "DESKTOP"))), /*#__PURE__*/React__namespace.createElement("div", {
25475
- style: styles$m.editor
25478
+ style: styles$n.editor
25476
25479
  }, /*#__PURE__*/React__namespace.createElement(ArticleEditor, this.state)));
25477
25480
  }
25478
25481
  });
25479
- const styles$m = {
25482
+ const styles$n = {
25480
25483
  controlBar: {
25481
25484
  marginBottom: 25,
25482
25485
  marginTop: 5
@@ -27015,10 +27018,10 @@ class GradedGroupEditor extends React__namespace.Component {
27015
27018
  }, /*#__PURE__*/React__namespace.createElement("div", {
27016
27019
  className: "perseus-widget-row"
27017
27020
  }, /*#__PURE__*/React__namespace.createElement("label", {
27018
- className: aphrodite.css(styles$l.title)
27021
+ className: aphrodite.css(styles$m.title)
27019
27022
  }, "Title:", " ", /*#__PURE__*/React__namespace.createElement(TextInput$6, {
27020
27023
  value: this.props.title,
27021
- className: aphrodite.css(styles$l.input)
27024
+ className: aphrodite.css(styles$m.input)
27022
27025
  // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
27023
27026
  ,
27024
27027
  onChange: this.change("title")
@@ -27043,7 +27046,7 @@ class GradedGroupEditor extends React__namespace.Component {
27043
27046
  }, /*#__PURE__*/React__namespace.createElement(InlineIcon$4, iconPlus$1), " Add a hint"), this.props.hint && /*#__PURE__*/React__namespace.createElement("div", {
27044
27047
  className: "perseus-hint-editor"
27045
27048
  }, /*#__PURE__*/React__namespace.createElement("div", {
27046
- className: aphrodite.css(styles$l.hintsTitle)
27049
+ className: aphrodite.css(styles$m.hintsTitle)
27047
27050
  }, "Hint"), /*#__PURE__*/React__namespace.createElement(Editor, {
27048
27051
  ref: this.hintEditor,
27049
27052
  content: this.props.hint ? this.props.hint.content : "",
@@ -27075,7 +27078,7 @@ class GradedGroupEditor extends React__namespace.Component {
27075
27078
  };
27076
27079
  };
27077
27080
  }
27078
- const styles$l = aphrodite.StyleSheet.create({
27081
+ const styles$m = aphrodite.StyleSheet.create({
27079
27082
  title: {
27080
27083
  fontSize: 18,
27081
27084
  fontWeight: "bold"
@@ -28441,13 +28444,13 @@ function MathquillInput(props) {
28441
28444
  }
28442
28445
  });
28443
28446
  return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
28444
- style: styles$k.outerWrapper
28447
+ style: styles$l.outerWrapper
28445
28448
  }, /*#__PURE__*/React__namespace.createElement("span", {
28446
28449
  ref: mathFieldWrapperRef,
28447
28450
  className: "perseus-math-input mq-editable-field mq-math-mode"
28448
28451
  }));
28449
28452
  }
28450
- const styles$k = aphrodite.StyleSheet.create({
28453
+ const styles$l = aphrodite.StyleSheet.create({
28451
28454
  outerWrapper: {
28452
28455
  display: "inline-block",
28453
28456
  borderStyle: "solid",
@@ -29533,7 +29536,7 @@ const GraphPointsCountSelector = _ref => {
29533
29536
  // Never uses placeholder, always has value
29534
29537
  ,
29535
29538
  placeholder: "",
29536
- style: styles$j.singleSelectShort
29539
+ style: styles$k.singleSelectShort
29537
29540
  }, [...[...Array(7).keys()].map(n => /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
29538
29541
  key: n,
29539
29542
  value: `${n}`,
@@ -29544,7 +29547,7 @@ const GraphPointsCountSelector = _ref => {
29544
29547
  label: "unlimited"
29545
29548
  })]);
29546
29549
  };
29547
- const styles$j = aphrodite.StyleSheet.create({
29550
+ const styles$k = aphrodite.StyleSheet.create({
29548
29551
  singleSelectShort: {
29549
29552
  // Non-standard spacing, but it's the smallest we can go
29550
29553
  // without running into styling issues with the dropdown.
@@ -29557,7 +29560,7 @@ const GraphTypeSelector = props => {
29557
29560
  selectedValue: props.graphType,
29558
29561
  onChange: props.onChange,
29559
29562
  placeholder: "Select a graph type",
29560
- style: styles$i.singleSelectShort
29563
+ style: styles$j.singleSelectShort
29561
29564
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
29562
29565
  value: "linear",
29563
29566
  label: "Linear function"
@@ -29590,7 +29593,7 @@ const GraphTypeSelector = props => {
29590
29593
  label: "Angle"
29591
29594
  }));
29592
29595
  };
29593
- const styles$i = aphrodite.StyleSheet.create({
29596
+ const styles$j = aphrodite.StyleSheet.create({
29594
29597
  singleSelectShort: {
29595
29598
  // Non-standard spacing, but it's the smallest we can go
29596
29599
  // without running into styling issues with the dropdown.
@@ -29607,16 +29610,16 @@ const LabeledRow = props => {
29607
29610
  style
29608
29611
  } = props;
29609
29612
  return /*#__PURE__*/React__namespace.createElement("label", {
29610
- className: aphrodite.css(styles$h.label)
29613
+ className: aphrodite.css(styles$i.label)
29611
29614
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
29612
- style: [styles$h.row, style]
29615
+ style: [styles$i.row, style]
29613
29616
  }, labelSide === "start" || /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelSmall, {
29614
- style: styles$h.spaceEnd
29617
+ style: styles$i.spaceEnd
29615
29618
  }, label), children, labelSide === "end" && /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelSmall, {
29616
- style: styles$h.spaceStart
29619
+ style: styles$i.spaceStart
29617
29620
  }, label)));
29618
29621
  };
29619
- const styles$h = aphrodite.StyleSheet.create({
29622
+ const styles$i = aphrodite.StyleSheet.create({
29620
29623
  label: {
29621
29624
  width: "fit-content"
29622
29625
  },
@@ -30038,10 +30041,10 @@ class InteractiveGraphSettings extends React__namespace.Component {
30038
30041
  onChange: this.change
30039
30042
  }))), /*#__PURE__*/React__namespace.createElement(LabeledRow, {
30040
30043
  label: "Background image URL:",
30041
- style: styles$g.resetSpaceTop
30044
+ style: styles$h.resetSpaceTop
30042
30045
  }, /*#__PURE__*/React__namespace.createElement("input", {
30043
30046
  type: "text",
30044
- className: aphrodite.css(styles$g.backgroundUrlInput),
30047
+ className: aphrodite.css(styles$h.backgroundUrlInput),
30045
30048
  ref: this.bgUrlRef,
30046
30049
  value: this.state.backgroundImage.url || "",
30047
30050
  onChange: e => {
@@ -30057,24 +30060,24 @@ class InteractiveGraphSettings extends React__namespace.Component {
30057
30060
  onKeyPress: this.changeBackgroundUrl,
30058
30061
  onBlur: this.changeBackgroundUrl
30059
30062
  }), /*#__PURE__*/React__namespace.createElement(InfoTip$c, null, /*#__PURE__*/React__namespace.createElement("p", null, "Create an image in graphie, or use the \"Add image\" function to create a background."))), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30060
- style: styles$g.rulerSection
30063
+ style: styles$h.rulerSection
30061
30064
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30062
- style: styles$g.checkboxRow
30065
+ style: styles$h.checkboxRow
30063
30066
  }, /*#__PURE__*/React__namespace.createElement(PropCheckBox$7, {
30064
30067
  label: "Show ruler",
30065
30068
  showRuler: this.props.showRuler,
30066
30069
  onChange: this.change,
30067
- style: styles$g.resetSpaceTop
30070
+ style: styles$h.resetSpaceTop
30068
30071
  }), /*#__PURE__*/React__namespace.createElement(PropCheckBox$7, {
30069
30072
  label: "Show protractor",
30070
30073
  showProtractor: this.props.showProtractor,
30071
30074
  onChange: this.change,
30072
- style: styles$g.resetSpaceTop
30075
+ style: styles$h.resetSpaceTop
30073
30076
  })), this.props.showRuler && /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30074
- style: styles$g.spaceTop
30077
+ style: styles$h.spaceTop
30075
30078
  }, /*#__PURE__*/React__namespace.createElement(LabeledRow, {
30076
30079
  label: "Ruler label:",
30077
- style: styles$g.resetSpaceTop
30080
+ style: styles$h.resetSpaceTop
30078
30081
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
30079
30082
  id: "ruler-label-select",
30080
30083
  selectedValue: this.props.rulerLabel,
@@ -30084,7 +30087,7 @@ class InteractiveGraphSettings extends React__namespace.Component {
30084
30087
  });
30085
30088
  },
30086
30089
  placeholder: "None",
30087
- style: styles$g.singleSelectShort
30090
+ style: styles$h.singleSelectShort
30088
30091
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
30089
30092
  value: "",
30090
30093
  label: "None",
@@ -30125,7 +30128,7 @@ class InteractiveGraphSettings extends React__namespace.Component {
30125
30128
  });
30126
30129
  },
30127
30130
  placeholder: "10",
30128
- style: styles$g.singleSelectShort
30131
+ style: styles$h.singleSelectShort
30129
30132
  }, [1, 2, 4, 8, 10, 16].map(value => /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
30130
30133
  key: value,
30131
30134
  value: `${value}`,
@@ -30133,7 +30136,7 @@ class InteractiveGraphSettings extends React__namespace.Component {
30133
30136
  })))))));
30134
30137
  }
30135
30138
  }
30136
- const styles$g = aphrodite.StyleSheet.create({
30139
+ const styles$h = aphrodite.StyleSheet.create({
30137
30140
  resetSpaceTop: {
30138
30141
  marginTop: 0
30139
30142
  },
@@ -30177,17 +30180,17 @@ const LockedFigureSelect = props => {
30177
30180
  onChange
30178
30181
  } = props;
30179
30182
  return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30180
- style: styles$f.container
30183
+ style: styles$g.container
30181
30184
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.ActionMenu, {
30182
- menuText: "Add element",
30183
- style: styles$f.addElementSelect
30185
+ menuText: "Add locked figure",
30186
+ style: styles$g.addElementSelect
30184
30187
  }, [/*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.ActionItem, {
30185
30188
  key: `${id}-point`,
30186
30189
  label: "Point",
30187
30190
  onClick: () => onChange("point")
30188
30191
  }, "Point")]));
30189
30192
  };
30190
- const styles$f = aphrodite.StyleSheet.create({
30193
+ const styles$g = aphrodite.StyleSheet.create({
30191
30194
  container: {
30192
30195
  marginTop: wonderBlocksTokens.spacing.medium_16
30193
30196
  },
@@ -30248,21 +30251,98 @@ const defaultContext = {
30248
30251
  };
30249
30252
  const MediaLayoutContext = React__namespace.createContext(defaultContext);
30250
30253
  MediaLayoutContext.displayName = "MediaLayoutContext";
30254
+ aphrodite.StyleSheet.create({
30255
+ grow: {
30256
+ flexGrow: 1
30257
+ }
30258
+ });
30251
30259
 
30252
- class Spring extends React__namespace.Component {
30260
+ class Strut extends React__namespace.Component {
30253
30261
  render() {
30254
30262
  const {
30263
+ size,
30255
30264
  style
30256
30265
  } = this.props;
30257
30266
  return React__namespace.createElement(wonderBlocksCore.View, {
30258
30267
  "aria-hidden": "true",
30259
- style: [styles$e.grow, style]
30268
+ style: [strutStyle(size), style]
30260
30269
  });
30261
30270
  }
30262
30271
  }
30272
+ const strutStyle = size => {
30273
+ return {
30274
+ width: size,
30275
+ MsFlexBasis: size,
30276
+ MsFlexPreferredSize: size,
30277
+ WebkitFlexBasis: size,
30278
+ flexBasis: size,
30279
+ flexShrink: 0
30280
+ };
30281
+ };
30282
+
30283
+ const ColorCircle = props => {
30284
+ const {
30285
+ color,
30286
+ filled = true,
30287
+ decorative = false
30288
+ } = props;
30289
+ return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30290
+ "aria-label":
30291
+ // Don't include an aria label for decorative circles.
30292
+ !decorative ? `Color: ${color}, ${filled ? "filled" : "open"}` : undefined,
30293
+ style: [styles$f.colorCircle, {
30294
+ border: `4px solid ${wonderBlocksTokens.color[color]}`,
30295
+ backgroundColor: filled ? wonderBlocksTokens.color[color] : wonderBlocksTokens.color.white
30296
+ }]
30297
+ });
30298
+ };
30299
+ const styles$f = aphrodite.StyleSheet.create({
30300
+ colorCircle: {
30301
+ // Add a white outline so that the color circle is visible when
30302
+ // the dropdown option is highlighted with its blue background.
30303
+ outline: `2px solid ${wonderBlocksTokens.color.offWhite}`,
30304
+ borderRadius: "50%",
30305
+ width: wonderBlocksTokens.spacing.large_24,
30306
+ height: wonderBlocksTokens.spacing.large_24
30307
+ }
30308
+ });
30309
+
30310
+ const ColorSelect = props => {
30311
+ const {
30312
+ id,
30313
+ selectedValue,
30314
+ onChange
30315
+ } = props;
30316
+ return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30317
+ style: styles$e.row
30318
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
30319
+ htmlFor: id,
30320
+ style: styles$e.label,
30321
+ tag: "label"
30322
+ }, "Color"), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
30323
+ id: id,
30324
+ selectedValue: selectedValue,
30325
+ onChange: onChange
30326
+ // Placeholder is required, but never gets used.
30327
+ ,
30328
+ placeholder: ""
30329
+ }, perseus.lockedFigureColors.map(colorName => /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
30330
+ key: colorName,
30331
+ value: colorName,
30332
+ label: colorName,
30333
+ leftAccessory: /*#__PURE__*/React__namespace.createElement(ColorCircle, {
30334
+ color: colorName,
30335
+ decorative: true
30336
+ })
30337
+ }, colorName))));
30338
+ };
30263
30339
  const styles$e = aphrodite.StyleSheet.create({
30264
- grow: {
30265
- flexGrow: 1
30340
+ row: {
30341
+ flexDirection: "row",
30342
+ alignItems: "center"
30343
+ },
30344
+ label: {
30345
+ marginInlineEnd: wonderBlocksTokens.spacing.xSmall_8
30266
30346
  }
30267
30347
  });
30268
30348
 
@@ -30311,13 +30391,31 @@ function getValidNumberFromString(value) {
30311
30391
  // If the value is not a number, return 0.
30312
30392
  return isNaN(parsed) ? 0 : parsed;
30313
30393
  }
30314
- function getDefaultFigureForFigureType(type) {
30394
+ function getDefaultFigureForType(type) {
30315
30395
  switch (type) {
30316
30396
  case "point":
30317
30397
  return {
30318
30398
  type: "point",
30319
- coord: [0, 0]
30399
+ coord: [0, 0],
30400
+ color: "blue",
30401
+ filled: true
30402
+ };
30403
+ case "line":
30404
+ return {
30405
+ type: "line",
30406
+ kind: "line",
30407
+ points: [getDefaultFigureForType("point"), {
30408
+ ...getDefaultFigureForType("point"),
30409
+ coord: [2, 2]
30410
+ }],
30411
+ color: "blue",
30412
+ lineStyle: "solid",
30413
+ showArrows: false,
30414
+ showStartPoint: false,
30415
+ showEndPoint: false
30320
30416
  };
30417
+ default:
30418
+ throw new wonderStuffCore.UnreachableCaseError(type);
30321
30419
  }
30322
30420
  }
30323
30421
 
@@ -30327,15 +30425,21 @@ function getDefaultFigureForFigureType(type) {
30327
30425
  *
30328
30426
  * Used in the interactive graph editor's locked figures section.
30329
30427
  */
30330
- const possibleColors = ["purple", "blue", "teal", "green", "gold", "red", "pink"];
30331
30428
  const LockedPointSettings = props => {
30332
30429
  const {
30333
30430
  coord,
30431
+ color: pointColor,
30432
+ filled = true,
30433
+ label,
30434
+ toggled = "true",
30334
30435
  style,
30335
- onChangeColor,
30336
- onChangeCoord,
30436
+ onChangeProps,
30437
+ onToggle,
30337
30438
  onRemove
30338
30439
  } = props;
30440
+
30441
+ // Keep track of the coordinates via state as the user is editing them,
30442
+ // before they are updated in the props on blur.
30339
30443
  const [coordState, setCoordState] = React__namespace.useState([
30340
30444
  // Using strings to make it easier to work with the text fields.
30341
30445
  coord[0].toString(), coord[1].toString()]);
@@ -30345,86 +30449,135 @@ const LockedPointSettings = props => {
30345
30449
  const ids = wonderBlocksCore.useUniqueIdWithMock();
30346
30450
  const xCoordId = ids.get("x-coord");
30347
30451
  const yCoordId = ids.get("y-coord");
30348
- const colorSelectId = ids.get("color-select");
30452
+ const colorSelectId = ids.get("point-color-select");
30453
+ const showPointToggleId = ids.get("show-point-toggle");
30349
30454
  function handleBlur() {
30350
30455
  const validCoord = [getValidNumberFromString(coordState[0]), getValidNumberFromString(coordState[1])];
30351
30456
 
30352
30457
  // Make the text field only show valid numbers after blur.
30353
30458
  setCoordState([validCoord[0].toString(), validCoord[1].toString()]);
30354
30459
  // Update the graph with the new coordinates.
30355
- onChangeCoord(validCoord);
30460
+ onChangeProps({
30461
+ coord: validCoord
30462
+ });
30356
30463
  }
30357
30464
  function handleCoordChange(newValue, coordIndex) {
30358
30465
  const newCoord = [...coordState];
30359
30466
  newCoord[coordIndex] = newValue;
30360
30467
  setCoordState(newCoord);
30361
30468
  }
30362
- return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30363
- style: styles$d.container
30469
+ function handleColorChange(newValue) {
30470
+ onChangeProps({
30471
+ color: newValue
30472
+ });
30473
+ }
30474
+ return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View
30475
+ // More specificity so that we can override the default
30476
+ // .heading > h2 > .header styles from the articles.less
30477
+ // file (which is imported in perseus-renderer.less).
30478
+ , {
30479
+ className: "locked-figure-accordion"
30480
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksAccordion.AccordionSection, {
30481
+ style: [styles$d.container, style],
30482
+ headerStyle: styles$d.accordionHeader,
30483
+ header:
30484
+ /*#__PURE__*/
30485
+ // Summary: Point, coords, color (filled/open)
30486
+ React__namespace.createElement(wonderBlocksCore.View, {
30487
+ style: styles$d.row
30488
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, `${label || "Point"} (${coord[0]}, ${coord[1]})`), /*#__PURE__*/React__namespace.createElement(Strut, {
30489
+ size: wonderBlocksTokens.spacing.xSmall_8
30490
+ }), toggled && /*#__PURE__*/React__namespace.createElement(ColorCircle, {
30491
+ color: pointColor,
30492
+ filled: filled
30493
+ }))
30494
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30495
+ style: styles$d.accordionPanel
30364
30496
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30365
30497
  style: styles$d.row
30366
- }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, "Point"), /*#__PURE__*/React__namespace.createElement(Spring, null), /*#__PURE__*/React__namespace.createElement(IconButton__default["default"], {
30367
- icon: trashIcon__default["default"],
30368
- "aria-label": `Delete locked point at ${coordState[0]}, ${coordState[1]}`,
30369
- onClick: onRemove
30370
- })), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, null, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30371
- style: styles$d.row
30498
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30499
+ style: [styles$d.row, styles$d.spaceUnder]
30372
30500
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
30373
30501
  htmlFor: xCoordId,
30374
30502
  style: styles$d.label,
30375
30503
  tag: "label"
30376
- }, "x Coordinate"), /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.TextField, {
30504
+ }, "x Coord"), /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.TextField, {
30377
30505
  id: xCoordId,
30506
+ type: "number",
30378
30507
  value: coordState[0],
30379
30508
  onChange: newValue => handleCoordChange(newValue, 0),
30380
30509
  onBlur: handleBlur,
30381
30510
  style: styles$d.textField
30382
- })), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30383
- style: styles$d.row
30511
+ })), /*#__PURE__*/React__namespace.createElement(Strut, {
30512
+ size: wonderBlocksTokens.spacing.medium_16
30513
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30514
+ style: [styles$d.row, styles$d.spaceUnder]
30384
30515
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
30385
30516
  htmlFor: yCoordId,
30386
30517
  style: styles$d.label,
30387
30518
  tag: "label"
30388
- }, "y Coordinate"), /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.TextField, {
30519
+ }, "y Coord"), /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.TextField, {
30389
30520
  id: yCoordId,
30521
+ type: "number",
30390
30522
  value: coordState[1],
30391
30523
  onChange: newValue => handleCoordChange(newValue, 1),
30392
30524
  onBlur: handleBlur,
30393
30525
  style: styles$d.textField
30394
- }))), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30395
- style: styles$d.row
30396
- }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
30397
- htmlFor: colorSelectId,
30398
- style: styles$d.label,
30399
- tag: "label"
30400
- }, "Color"), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
30526
+ }))), onToggle && /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30527
+ style: [styles$d.row, styles$d.spaceUnder]
30528
+ }, /*#__PURE__*/React__namespace.createElement(Switch__default["default"], {
30529
+ id: showPointToggleId,
30530
+ checked: !!toggled,
30531
+ onChange: onToggle
30532
+ }), /*#__PURE__*/React__namespace.createElement(Strut, {
30533
+ size: wonderBlocksTokens.spacing.small_12
30534
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
30535
+ tag: "label",
30536
+ htmlFor: showPointToggleId
30537
+ }, "Show point on graph")), toggled && /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(ColorSelect, {
30401
30538
  id: colorSelectId,
30402
- selectedValue: style?.fill || "blue",
30403
- onChange: onChangeColor
30404
- // Placeholder is required, but never gets used.
30405
- ,
30406
- placeholder: ""
30407
- }, possibleColors.map(colorName => /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
30408
- key: colorName,
30409
- value: colorName,
30410
- label: colorName,
30411
- leftAccessory: /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30412
- style: [styles$d.colorCircle, {
30413
- backgroundColor: wonderBlocksTokens.color[colorName]
30414
- }]
30415
- })
30416
- }, colorName)))));
30539
+ selectedValue: pointColor || "blue",
30540
+ onChange: handleColorChange
30541
+ }), /*#__PURE__*/React__namespace.createElement(Strut, {
30542
+ size: wonderBlocksTokens.spacing.xSmall_8
30543
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
30544
+ label: "Open point",
30545
+ checked: !filled,
30546
+ onChange: newValue => {
30547
+ onChangeProps({
30548
+ filled: !newValue
30549
+ });
30550
+ },
30551
+ style: styles$d.spaceUnder
30552
+ })), onRemove && /*#__PURE__*/React__namespace.createElement(IconButton__default["default"], {
30553
+ icon: trashIcon__default["default"],
30554
+ "aria-label": `Delete locked point at ${coordState[0]}, ${coordState[1]}`,
30555
+ onClick: onRemove,
30556
+ style: styles$d.deleteButton
30557
+ }))));
30417
30558
  };
30418
30559
  const styles$d = aphrodite.StyleSheet.create({
30419
30560
  container: {
30420
30561
  backgroundColor: wonderBlocksTokens.color.fadedBlue8,
30421
- marginBottom: wonderBlocksTokens.spacing.xSmall_8,
30562
+ marginBottom: wonderBlocksTokens.spacing.small_12
30563
+ },
30564
+ accordionHeader: {
30565
+ paddingTop: wonderBlocksTokens.spacing.small_12,
30566
+ paddingBottom: wonderBlocksTokens.spacing.small_12,
30567
+ paddingInlineStart: wonderBlocksTokens.spacing.medium_16,
30568
+ // Fixed height so the addition of the color circle doesn't
30569
+ // change the height of the header when toggling.
30570
+ height: wonderBlocksTokens.spacing.xxLarge_48
30571
+ },
30572
+ accordionPanel: {
30422
30573
  padding: wonderBlocksTokens.spacing.medium_16,
30423
- borderRadius: wonderBlocksTokens.spacing.xSmall_8
30574
+ paddingBottom: wonderBlocksTokens.spacing.xSmall_8
30424
30575
  },
30425
30576
  row: {
30426
30577
  flexDirection: "row",
30427
- alignItems: "center",
30578
+ alignItems: "center"
30579
+ },
30580
+ spaceUnder: {
30428
30581
  marginBottom: wonderBlocksTokens.spacing.xSmall_8
30429
30582
  },
30430
30583
  label: {
@@ -30433,13 +30586,10 @@ const styles$d = aphrodite.StyleSheet.create({
30433
30586
  textField: {
30434
30587
  width: wonderBlocksTokens.spacing.xxxLarge_64
30435
30588
  },
30436
- colorCircle: {
30437
- // Add a white border so that the color circle is visible when
30438
- // the dropdown option is highlighted with its blue background.
30439
- border: `2px solid ${wonderBlocksTokens.color.offWhite}`,
30440
- borderRadius: "50%",
30441
- width: wonderBlocksTokens.spacing.large_24,
30442
- height: wonderBlocksTokens.spacing.large_24
30589
+ deleteButton: {
30590
+ position: "absolute",
30591
+ top: wonderBlocksTokens.spacing.small_12,
30592
+ right: wonderBlocksTokens.spacing.small_12
30443
30593
  }
30444
30594
  });
30445
30595
 
@@ -30469,7 +30619,7 @@ const LockedFiguresSection = props => {
30469
30619
  function addLockedFigure(newFigure) {
30470
30620
  const lockedFigures = figures || [];
30471
30621
  const newProps = {
30472
- lockedFigures: [...lockedFigures, getDefaultFigureForFigureType(newFigure)]
30622
+ lockedFigures: [...lockedFigures, getDefaultFigureForType(newFigure)]
30473
30623
  };
30474
30624
  onChange(newProps);
30475
30625
  }
@@ -30479,39 +30629,34 @@ const LockedFiguresSection = props => {
30479
30629
  lockedFigures: [...lockedFigures.slice(0, index), ...lockedFigures.slice(index + 1)]
30480
30630
  });
30481
30631
  }
30482
- function changeCoord(index, coord) {
30632
+ function changeProps(index,
30633
+ // Omit the type from the figure props so it doesn't think
30634
+ // we're trying to pass in the props for the wrong type.
30635
+ figureProps) {
30483
30636
  const lockedFigures = figures || [];
30484
- const newProps = {
30637
+ const newFigures = {
30485
30638
  lockedFigures: [...lockedFigures.slice(0, index), {
30486
30639
  ...lockedFigures[index],
30487
- coord
30640
+ ...figureProps
30488
30641
  }, ...lockedFigures.slice(index + 1)]
30489
30642
  };
30490
- onChange(newProps);
30491
- }
30492
- function changeColor(index, colorName) {
30493
- const lockedFigures = figures || [];
30494
- const newProps = {
30495
- lockedFigures: [...lockedFigures.slice(0, index), {
30496
- ...lockedFigures[index],
30497
- style: {
30498
- ...lockedFigures[index].style,
30499
- fill: colorName,
30500
- stroke: colorName
30501
- }
30502
- }, ...lockedFigures.slice(index + 1)]
30503
- };
30504
- onChange(newProps);
30643
+ onChange(newFigures);
30505
30644
  }
30506
30645
  return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30507
30646
  style: styles$c.container
30508
- }, figures?.map((figure, index) => /*#__PURE__*/React__namespace.createElement(LockedFigureSettings, _extends({
30509
- key: `${uniqueId}-locked-${figure}-${index}`
30510
- }, figure, {
30511
- onChangeColor: color => changeColor(index, color),
30512
- onChangeCoord: coord => changeCoord(index, coord),
30513
- onRemove: () => removeLockedFigure(index)
30514
- }))), /*#__PURE__*/React__namespace.createElement(LockedFigureSelect, {
30647
+ }, figures?.map((figure, index) => {
30648
+ // TODO(LEMS-1740): Remove this check when
30649
+ // locked lines are added to LockedFigureSettings.
30650
+ if (figure.type === "line") {
30651
+ return;
30652
+ }
30653
+ return /*#__PURE__*/React__namespace.createElement(LockedFigureSettings, _extends({
30654
+ key: `${uniqueId}-locked-${figure}-${index}`
30655
+ }, figure, {
30656
+ onChangeProps: newProps => changeProps(index, newProps),
30657
+ onRemove: () => removeLockedFigure(index)
30658
+ }));
30659
+ }), /*#__PURE__*/React__namespace.createElement(LockedFigureSelect, {
30515
30660
  id: `${uniqueId}-select`,
30516
30661
  onChange: addLockedFigure
30517
30662
  }));
@@ -30613,6 +30758,8 @@ class InteractiveGraphEditor extends React__namespace.Component {
30613
30758
  const snapStep = this.props.snapStep || perseus.Util.snapStepFromGridStep(gridStep);
30614
30759
  const sizeClass = containerSizeClass.SMALL;
30615
30760
  if (this.props.valid === true) {
30761
+ const correct = this.props.correct;
30762
+
30616
30763
  // TODO(aria): send these down all at once
30617
30764
  const graphProps = {
30618
30765
  ref: "graph",
@@ -30622,7 +30769,7 @@ class InteractiveGraphEditor extends React__namespace.Component {
30622
30769
  step: this.props.step,
30623
30770
  gridStep: gridStep,
30624
30771
  snapStep: snapStep,
30625
- graph: this.props.correct,
30772
+ graph: correct,
30626
30773
  backgroundImage: this.props.backgroundImage,
30627
30774
  markings: this.props.markings,
30628
30775
  showProtractor: this.props.showProtractor,
@@ -30646,6 +30793,10 @@ class InteractiveGraphEditor extends React__namespace.Component {
30646
30793
  });
30647
30794
  }
30648
30795
  };
30796
+
30797
+ // This is used to force a remount of the graph component
30798
+ // when there's a significant change
30799
+ const graphKey = `${correct.type}:${correct.numSegments || 0}`;
30649
30800
  graph =
30650
30801
  /*#__PURE__*/
30651
30802
  // There are a bunch of props that renderer.jsx passes to widgets via
@@ -30653,6 +30804,7 @@ class InteractiveGraphEditor extends React__namespace.Component {
30653
30804
  // bother passing.
30654
30805
  // @ts-expect-error - TS2769 - No overload matches this call.
30655
30806
  React__namespace.createElement(InteractiveGraph, _extends({}, graphProps, {
30807
+ key: graphKey,
30656
30808
  containerSizeClass: sizeClass,
30657
30809
  apiOptions: {
30658
30810
  ...this.props.apiOptions,
@@ -30853,9 +31005,9 @@ class InteractiveGraphEditor extends React__namespace.Component {
30853
31005
  borderWidth: 1
30854
31006
  }
30855
31007
  }, equationString), /*#__PURE__*/React__namespace.createElement(InfoTip$b, null, /*#__PURE__*/React__namespace.createElement("p", null, "Graph the correct answer in the graph below and ensure the equation or point coordinates displayed represent the correct answer."))), graph,
30856
- // Only show the "Add element" dropdown if the graph is
31008
+ // Only show the "Add locked figure" dropdown if the graph is
30857
31009
  // using Mafs.
30858
- this.props.graph && this.props.apiOptions?.flags?.["mafs"]?.[this.props.graph.type] && /*#__PURE__*/React__namespace.createElement(LockedFiguresSection, {
31010
+ this.props.graph && this.props.apiOptions?.flags?.mafs?.["interactive-graph-locked-features-m1"] && this.props.apiOptions?.flags?.mafs?.[this.props.graph.type] && /*#__PURE__*/React__namespace.createElement(LockedFiguresSection, {
30859
31011
  figures: this.props.lockedFigures,
30860
31012
  onChange: this.props.onChange
30861
31013
  }));
@@ -30997,7 +31149,7 @@ class FormWrappedTextField extends React__namespace.Component {
30997
31149
  className: aphrodite.css(inputBase),
30998
31150
  ref: forwardedRef,
30999
31151
  id: id,
31000
- "data-test-id": testId
31152
+ "data-testid": testId
31001
31153
  })), !leftSideIcon && wrappedIcon);
31002
31154
  }
31003
31155
  }
@@ -31139,7 +31291,7 @@ class Link extends React__namespace.Component {
31139
31291
  rel = "noopener noreferrer";
31140
31292
  }
31141
31293
  return /*#__PURE__*/React__namespace.createElement(element, {
31142
- "data-test-id": testId,
31294
+ "data-testid": testId,
31143
31295
  ...otherProps,
31144
31296
  ...urlProp,
31145
31297
  className: aphrodite.css(...delegatedStyles) + delegatedClassName,
@@ -31474,7 +31626,7 @@ class Checkbox extends React__namespace.Component {
31474
31626
  return /*#__PURE__*/React__namespace.createElement("div", _extends({}, handlers, {
31475
31627
  className: aphrodite.css(styles$6.container, focused && styles$6.focused),
31476
31628
  style: style,
31477
- "data-test-id": dataTestId,
31629
+ "data-testid": dataTestId,
31478
31630
  "data-checked": checked
31479
31631
  }), /*#__PURE__*/React__namespace.createElement("svg", {
31480
31632
  className: aphrodite.css(styles$6.svg, (disabled || appearDisabled) && styles$6.disabled),
@@ -31724,7 +31876,7 @@ class Option extends React__namespace.Component {
31724
31876
  onKeyDown: event => this.handleKeyDown(event),
31725
31877
  "aria-disabled": disabled,
31726
31878
  "aria-label": ariaLabel,
31727
- "data-test-id": testId
31879
+ "data-testid": testId
31728
31880
  }, optionRenderer && optionRenderer(
31729
31881
  /*#__PURE__*/
31730
31882
  /**