@khanacademy/perseus-editor 5.0.1 → 5.0.3

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
@@ -21,8 +21,11 @@ var kmath = require('@khanacademy/kmath');
21
21
  var KAS = require('@khanacademy/kas');
22
22
  var wonderStuffCore = require('@khanacademy/wonder-stuff-core');
23
23
  var mathInput = require('@khanacademy/math-input');
24
+ var wonderBlocksDropdown = require('@khanacademy/wonder-blocks-dropdown');
25
+ var wonderBlocksForm = require('@khanacademy/wonder-blocks-form');
24
26
  var Spacing = require('@khanacademy/wonder-blocks-spacing');
25
- var Typography = require('@khanacademy/wonder-blocks-typography');
27
+ var wonderBlocksTypography = require('@khanacademy/wonder-blocks-typography');
28
+ var wonderBlocksTokens = require('@khanacademy/wonder-blocks-tokens');
26
29
  var Button = require('@khanacademy/wonder-blocks-button');
27
30
  var i18n$1 = require('@khanacademy/wonder-blocks-i18n');
28
31
 
@@ -58,13 +61,12 @@ var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
58
61
  var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
59
62
  var KAS__namespace = /*#__PURE__*/_interopNamespace(KAS);
60
63
  var Spacing__default = /*#__PURE__*/_interopDefaultLegacy(Spacing);
61
- var Typography__namespace = /*#__PURE__*/_interopNamespace(Typography);
62
64
  var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
63
65
  var i18n__namespace = /*#__PURE__*/_interopNamespace(i18n$1);
64
66
 
65
67
  // This file is processed by a Rollup plugin (replace) to inject the production
66
68
  const libName = "@khanacademy/perseus-editor";
67
- const libVersion = "5.0.1";
69
+ const libVersion = "5.0.3";
68
70
  perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
69
71
 
70
72
  function _extends() {
@@ -258,13 +260,13 @@ class SectionControlButton extends React__namespace.Component {
258
260
  role: "button",
259
261
  hideDefaultFocusRing: true,
260
262
  "aria-label": title,
261
- style: styles$g.button
263
+ style: styles$m.button
262
264
  }, _ref => {
263
265
  return /*#__PURE__*/React__namespace.createElement(InlineIcon$b, icon);
264
266
  });
265
267
  }
266
268
  }
267
- const styles$g = aphrodite.StyleSheet.create({
269
+ const styles$m = aphrodite.StyleSheet.create({
268
270
  button: {
269
271
  backgroundColor: Color__default["default"].gold,
270
272
  margin: 2,
@@ -20782,19 +20784,19 @@ class TexErrorView extends React__namespace.Component {
20782
20784
  const {
20783
20785
  showErrors
20784
20786
  } = this.state;
20785
- const iconStyle = showErrors ? styles$f.iconExpanded : styles$f.iconCollapsed;
20787
+ const iconStyle = showErrors ? styles$l.iconExpanded : styles$l.iconCollapsed;
20786
20788
  return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
20787
- style: styles$f.errorContainer
20789
+ style: styles$l.errorContainer
20788
20790
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
20789
- style: styles$f.title,
20791
+ style: styles$l.title,
20790
20792
  onClick: this.handleToggleTexErrors
20791
20793
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksIcon.PhosphorIcon, {
20792
20794
  icon: caretRight__default["default"],
20793
20795
  style: iconStyle
20794
20796
  }), "\xA0 TeX Errors (", errorList.length, ")"), showErrors && /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
20795
- style: styles$f.errorExplanation
20797
+ style: styles$l.errorExplanation
20796
20798
  }, "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, {
20797
- style: styles$f.error,
20799
+ style: styles$l.error,
20798
20800
  key: index
20799
20801
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
20800
20802
  style: {
@@ -20803,7 +20805,7 @@ class TexErrorView extends React__namespace.Component {
20803
20805
  }, e.math), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, null, e.message))));
20804
20806
  }
20805
20807
  }
20806
- const styles$f = aphrodite.StyleSheet.create({
20808
+ const styles$l = aphrodite.StyleSheet.create({
20807
20809
  title: {
20808
20810
  backgroundColor: "#eee",
20809
20811
  fontSize: "1.25em",
@@ -24581,12 +24583,12 @@ class SimpleButton extends React__namespace.Component {
24581
24583
  ...otherProps
24582
24584
  } = this.props;
24583
24585
  return /*#__PURE__*/React__namespace.createElement("div", _extends({
24584
- className: aphrodite.css(styles$e.baseButton, color === "green" && styles$e.green, color === "orange" && styles$e.orange),
24586
+ className: aphrodite.css(styles$k.baseButton, color === "green" && styles$k.green, color === "orange" && styles$k.orange),
24585
24587
  onClick: onClick
24586
24588
  }, otherProps), children);
24587
24589
  }
24588
24590
  }
24589
- const styles$e = aphrodite.StyleSheet.create({
24591
+ const styles$k = aphrodite.StyleSheet.create({
24590
24592
  baseButton: {
24591
24593
  top: "0",
24592
24594
  fontSize: "11px",
@@ -24799,23 +24801,23 @@ const LeafContainer = _ref2 => {
24799
24801
  } = _ref2;
24800
24802
  const hasPreviewHeading = shape.type === "content" || shape.type === "hint";
24801
24803
  const previewHeading = hasPreviewHeading && /*#__PURE__*/React__namespace.createElement("div", {
24802
- className: aphrodite.css(styles$d.containerHeader)
24804
+ className: aphrodite.css(styles$j.containerHeader)
24803
24805
  }, /*#__PURE__*/React__namespace.createElement(Header, {
24804
24806
  depth: path.length,
24805
- className: aphrodite.css(styles$d.containerTitle)
24807
+ className: aphrodite.css(styles$j.containerTitle)
24806
24808
  }, capitalize(name)));
24807
24809
  return /*#__PURE__*/React__namespace.createElement("div", {
24808
- className: aphrodite.css(styles$d.container)
24810
+ className: aphrodite.css(styles$j.container)
24809
24811
  }, /*#__PURE__*/React__namespace.createElement("span", {
24810
- className: aphrodite.css(styles$d.row, styles$d.rowHeading)
24812
+ className: aphrodite.css(styles$j.row, styles$j.rowHeading)
24811
24813
  }, /*#__PURE__*/React__namespace.createElement("div", {
24812
- className: aphrodite.css(styles$d.columnLeft)
24814
+ className: aphrodite.css(styles$j.columnLeft)
24813
24815
  }, /*#__PURE__*/React__namespace.createElement("div", {
24814
- className: "pod-title " + aphrodite.css(styles$d.containerHeader)
24816
+ className: "pod-title " + aphrodite.css(styles$j.containerHeader)
24815
24817
  }, /*#__PURE__*/React__namespace.createElement("div", {
24816
- className: aphrodite.css(styles$d.containerTitle)
24818
+ className: aphrodite.css(styles$j.containerTitle)
24817
24819
  }, capitalize(name)), controls)), /*#__PURE__*/React__namespace.createElement("div", {
24818
- className: aphrodite.css(styles$d.columnRight)
24820
+ className: aphrodite.css(styles$j.columnRight)
24819
24821
  }, previewHeading)), children);
24820
24822
  };
24821
24823
  const ArrayContainer = props => {
@@ -24828,11 +24830,11 @@ const ArrayContainer = props => {
24828
24830
  actions
24829
24831
  } = props;
24830
24832
  return /*#__PURE__*/React__namespace.createElement("div", {
24831
- className: aphrodite.css(styles$d.container)
24833
+ className: aphrodite.css(styles$j.container)
24832
24834
  }, controls && /*#__PURE__*/React__namespace.createElement("div", {
24833
- className: aphrodite.css(styles$d.columnLeft, styles$d.containerHeader)
24835
+ className: aphrodite.css(styles$j.columnLeft, styles$j.containerHeader)
24834
24836
  }, controls), /*#__PURE__*/React__namespace.createElement("div", null, children), /*#__PURE__*/React__namespace.createElement("div", {
24835
- className: aphrodite.css(styles$d.columnLeft)
24837
+ className: aphrodite.css(styles$j.columnLeft)
24836
24838
  }, /*#__PURE__*/React__namespace.createElement("a", {
24837
24839
  href: "javascript:void 0",
24838
24840
  onClick: () => actions.addArrayElement(path, shape.elementShape)
@@ -24846,28 +24848,28 @@ const ObjectContainer = _ref3 => {
24846
24848
  path
24847
24849
  } = _ref3;
24848
24850
  const headingEditor = /*#__PURE__*/React__namespace.createElement("div", {
24849
- className: aphrodite.css(styles$d.containerHeader)
24851
+ className: aphrodite.css(styles$j.containerHeader)
24850
24852
  }, /*#__PURE__*/React__namespace.createElement(Header, {
24851
24853
  depth: path.length,
24852
- className: aphrodite.css(styles$d.containerTitle)
24854
+ className: aphrodite.css(styles$j.containerTitle)
24853
24855
  }, capitalize(name)), controls);
24854
24856
  const headingPreview = (name || controls) && /*#__PURE__*/React__namespace.createElement("div", {
24855
- className: aphrodite.css(styles$d.containerHeader, styles$d.previewCollectionHeader)
24857
+ className: aphrodite.css(styles$j.containerHeader, styles$j.previewCollectionHeader)
24856
24858
  }, /*#__PURE__*/React__namespace.createElement(Header, {
24857
24859
  depth: path.length,
24858
- className: aphrodite.css(styles$d.containerTitle)
24860
+ className: aphrodite.css(styles$j.containerTitle)
24859
24861
  }, capitalize(name)));
24860
24862
  const hasBothHeadings = headingEditor && headingPreview;
24861
24863
  return /*#__PURE__*/React__namespace.createElement("div", {
24862
- className: aphrodite.css(styles$d.container)
24864
+ className: aphrodite.css(styles$j.container)
24863
24865
  }, hasBothHeadings && /*#__PURE__*/React__namespace.createElement("span", {
24864
- className: aphrodite.css(styles$d.row)
24866
+ className: aphrodite.css(styles$j.row)
24865
24867
  }, /*#__PURE__*/React__namespace.createElement("div", {
24866
- className: aphrodite.css(styles$d.columnLeft)
24868
+ className: aphrodite.css(styles$j.columnLeft)
24867
24869
  }, headingEditor), /*#__PURE__*/React__namespace.createElement("div", {
24868
- className: aphrodite.css(styles$d.columnRight)
24870
+ className: aphrodite.css(styles$j.columnRight)
24869
24871
  }, headingPreview)), /*#__PURE__*/React__namespace.createElement("div", {
24870
- className: aphrodite.css(path.length > 0 && styles$d.contentIndent)
24872
+ className: aphrodite.css(path.length > 0 && styles$j.contentIndent)
24871
24873
  }, children));
24872
24874
  };
24873
24875
 
@@ -24987,11 +24989,11 @@ const ItemNodeContent = withStickiness(props => {
24987
24989
  className: "framework-perseus"
24988
24990
  }, lens(renderers).get(path));
24989
24991
  return /*#__PURE__*/React__namespace.createElement("span", null, /*#__PURE__*/React__namespace.createElement("div", {
24990
- className: aphrodite.css(styles$d.row)
24992
+ className: aphrodite.css(styles$j.row)
24991
24993
  }, /*#__PURE__*/React__namespace.createElement("div", {
24992
- className: aphrodite.css(styles$d.columnLeft)
24994
+ className: aphrodite.css(styles$j.columnLeft)
24993
24995
  }, /*#__PURE__*/React__namespace.createElement("div", {
24994
- className: aphrodite.css(sticky && styles$d.sticky)
24996
+ className: aphrodite.css(sticky && styles$j.sticky)
24995
24997
  },
24996
24998
  /*#__PURE__*/
24997
24999
  // @ts-expect-error - TS2769 - No overload matches this call.
@@ -24999,9 +25001,9 @@ const ItemNodeContent = withStickiness(props => {
24999
25001
  onChange: newVal => actions.mergeValueAtPath(path, newVal),
25000
25002
  apiOptions: apiOptions
25001
25003
  })))), /*#__PURE__*/React__namespace.createElement("div", {
25002
- className: aphrodite.css(styles$d.columnRight)
25004
+ className: aphrodite.css(styles$j.columnRight)
25003
25005
  }, /*#__PURE__*/React__namespace.createElement("div", {
25004
- className: aphrodite.css(sticky && styles$d.sticky)
25006
+ className: aphrodite.css(sticky && styles$j.sticky)
25005
25007
  }, preview))));
25006
25008
  });
25007
25009
  const HintNodeContent = withStickiness(props => {
@@ -25017,13 +25019,13 @@ const HintNodeContent = withStickiness(props => {
25017
25019
  className: "framework-perseus"
25018
25020
  }, lens(renderers).get(path));
25019
25021
  return /*#__PURE__*/React__namespace.createElement("div", {
25020
- className: aphrodite.css(styles$d.row)
25022
+ className: aphrodite.css(styles$j.row)
25021
25023
  }, /*#__PURE__*/React__namespace.createElement("div", {
25022
- className: aphrodite.css(styles$d.columnLeft)
25024
+ className: aphrodite.css(styles$j.columnLeft)
25023
25025
  }, /*#__PURE__*/React__namespace.createElement("div", {
25024
- className: aphrodite.css(sticky && styles$d.sticky)
25026
+ className: aphrodite.css(sticky && styles$j.sticky)
25025
25027
  }, /*#__PURE__*/React__namespace.createElement(HintEditor, _extends({}, data, {
25026
- className: aphrodite.css(styles$d.hintEditor),
25028
+ className: aphrodite.css(styles$j.hintEditor),
25027
25029
  onChange: newVal => actions.mergeValueAtPath(path, newVal),
25028
25030
  apiOptions: apiOptions,
25029
25031
  showTitle: false,
@@ -25038,9 +25040,9 @@ const HintNodeContent = withStickiness(props => {
25038
25040
  isFirst: true,
25039
25041
  isLast: true
25040
25042
  })))), /*#__PURE__*/React__namespace.createElement("div", {
25041
- className: aphrodite.css(styles$d.columnRight)
25043
+ className: aphrodite.css(styles$j.columnRight)
25042
25044
  }, /*#__PURE__*/React__namespace.createElement("div", {
25043
- className: aphrodite.css(sticky && styles$d.sticky)
25045
+ className: aphrodite.css(sticky && styles$j.sticky)
25044
25046
  }, preview)));
25045
25047
  });
25046
25048
  const TagsNodeContent = props => {
@@ -25057,9 +25059,9 @@ const TagsNodeContent = props => {
25057
25059
  return null;
25058
25060
  }
25059
25061
  return /*#__PURE__*/React__namespace.createElement("div", {
25060
- className: aphrodite.css(styles$d.columnLeft)
25062
+ className: aphrodite.css(styles$j.columnLeft)
25061
25063
  }, /*#__PURE__*/React__namespace.createElement("div", {
25062
- className: aphrodite.css(styles$d.tagsEditor)
25064
+ className: aphrodite.css(styles$j.tagsEditor)
25063
25065
  }, /*#__PURE__*/React__namespace.createElement(GroupMetadataEditor, {
25064
25066
  value: data,
25065
25067
  onChange: newVal => actions.setValueAtPath(path, newVal),
@@ -25090,23 +25092,23 @@ const ArrayNodeContent = props => {
25090
25092
  const subpath = path.concat(i);
25091
25093
  const controls = [i > 0 && /*#__PURE__*/React__namespace.createElement("div", {
25092
25094
  key: "moveArrayElementUp",
25093
- className: aphrodite.css(styles$d.control)
25095
+ className: aphrodite.css(styles$j.control)
25094
25096
  }, /*#__PURE__*/React__namespace.createElement(SimpleButton, {
25095
25097
  color: "orange",
25096
25098
  title: "Move up",
25097
25099
  onClick: () => actions.moveArrayElementUp(subpath)
25098
25100
  }, /*#__PURE__*/React__namespace.createElement("div", {
25099
- className: aphrodite.css(styles$d.verticalFlip)
25101
+ className: aphrodite.css(styles$j.verticalFlip)
25100
25102
  }, /*#__PURE__*/React__namespace.createElement(InlineIcon$6, iconChevronDown)))), i < data.length - 1 && /*#__PURE__*/React__namespace.createElement("div", {
25101
25103
  key: "moveArrayElementDown",
25102
- className: aphrodite.css(styles$d.control)
25104
+ className: aphrodite.css(styles$j.control)
25103
25105
  }, /*#__PURE__*/React__namespace.createElement(SimpleButton, {
25104
25106
  color: "orange",
25105
25107
  title: "Move down",
25106
25108
  onClick: () => actions.moveArrayElementDown(subpath)
25107
25109
  }, /*#__PURE__*/React__namespace.createElement(InlineIcon$6, iconChevronDown))), /*#__PURE__*/React__namespace.createElement("div", {
25108
25110
  key: "removeArrayElement",
25109
- className: aphrodite.css(styles$d.control)
25111
+ className: aphrodite.css(styles$j.control)
25110
25112
  }, /*#__PURE__*/React__namespace.createElement(SimpleButton, {
25111
25113
  color: "orange",
25112
25114
  title: "Delete",
@@ -25114,7 +25116,7 @@ const ArrayNodeContent = props => {
25114
25116
  }, /*#__PURE__*/React__namespace.createElement(InlineIcon$6, iconTrash$4)))];
25115
25117
  return /*#__PURE__*/React__namespace.createElement("div", {
25116
25118
  key: i,
25117
- className: aphrodite.css(styles$d.arrayElement, !elementIsLeaf && styles$d.arrayElementAndNotLeaf)
25119
+ className: aphrodite.css(styles$j.arrayElement, !elementIsLeaf && styles$j.arrayElementAndNotLeaf)
25118
25120
  }, /*#__PURE__*/React__namespace.createElement(NodeContainer, _extends({}, otherProps, {
25119
25121
  key: i,
25120
25122
  shape: shape.elementShape,
@@ -25140,7 +25142,7 @@ const ObjectNodeContent = props => {
25140
25142
  // made sense to the shape's author is the order in which we'll iterate :)
25141
25143
  const children = Object.keys(shape.shape).map(subkey => /*#__PURE__*/React__namespace.createElement("div", {
25142
25144
  key: subkey,
25143
- className: aphrodite.css(styles$d.objectElement)
25145
+ className: aphrodite.css(styles$j.objectElement)
25144
25146
  }, /*#__PURE__*/React__namespace.createElement(NodeContainer, _extends({}, otherProps, {
25145
25147
  shape: shape.shape[subkey],
25146
25148
  data: data[subkey],
@@ -25309,7 +25311,7 @@ class MultiRendererEditor extends React__namespace.Component {
25309
25311
  }, this._renderContent());
25310
25312
  }
25311
25313
  }
25312
- const styles$d = aphrodite.StyleSheet.create({
25314
+ const styles$j = aphrodite.StyleSheet.create({
25313
25315
  // This is used in a number of places throughout this file.
25314
25316
  container: {},
25315
25317
  // eslint-disable-next-line react-native/no-unused-styles
@@ -25461,47 +25463,47 @@ const StatefulArticleEditor = createReactClass__default["default"]({
25461
25463
  screen
25462
25464
  } = this.state;
25463
25465
  return /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("div", {
25464
- style: styles$c.controlBar
25466
+ style: styles$i.controlBar
25465
25467
  }, /*#__PURE__*/React__namespace.createElement("span", {
25466
- style: styles$c.controls
25468
+ style: styles$i.controls
25467
25469
  }, "Mode:", " ", /*#__PURE__*/React__namespace.createElement("span", {
25468
25470
  onClick: () => this.setState({
25469
25471
  mode: "edit"
25470
25472
  }),
25471
- style: mode === "edit" ? styles$c.controlSelected : styles$c.control
25473
+ style: mode === "edit" ? styles$i.controlSelected : styles$i.control
25472
25474
  }, "EDIT"), " | ", /*#__PURE__*/React__namespace.createElement("span", {
25473
25475
  onClick: () => this.setState({
25474
25476
  mode: "preview"
25475
25477
  }),
25476
- style: mode === "preview" ? styles$c.controlSelected : styles$c.control
25478
+ style: mode === "preview" ? styles$i.controlSelected : styles$i.control
25477
25479
  }, "PREVIEW"), " | ", /*#__PURE__*/React__namespace.createElement("span", {
25478
25480
  onClick: () => this.setState({
25479
25481
  mode: "json"
25480
25482
  }),
25481
- style: mode === "json" ? styles$c.controlSelected : styles$c.control
25483
+ style: mode === "json" ? styles$i.controlSelected : styles$i.control
25482
25484
  }, "JSON")), /*#__PURE__*/React__namespace.createElement("span", {
25483
- style: styles$c.controls
25485
+ style: styles$i.controls
25484
25486
  }, "Screen:", " ", /*#__PURE__*/React__namespace.createElement("span", {
25485
25487
  onClick: () => this.setState({
25486
25488
  screen: "phone"
25487
25489
  }),
25488
- style: screen === "phone" ? styles$c.controlSelected : styles$c.control
25490
+ style: screen === "phone" ? styles$i.controlSelected : styles$i.control
25489
25491
  }, "PHONE"), " | ", /*#__PURE__*/React__namespace.createElement("span", {
25490
25492
  onClick: () => this.setState({
25491
25493
  screen: "tablet"
25492
25494
  }),
25493
- style: screen === "tablet" ? styles$c.controlSelected : styles$c.control
25495
+ style: screen === "tablet" ? styles$i.controlSelected : styles$i.control
25494
25496
  }, "TABLET"), " | ", /*#__PURE__*/React__namespace.createElement("span", {
25495
25497
  onClick: () => this.setState({
25496
25498
  screen: "desktop"
25497
25499
  }),
25498
- style: screen === "desktop" ? styles$c.controlSelected : styles$c.control
25500
+ style: screen === "desktop" ? styles$i.controlSelected : styles$i.control
25499
25501
  }, "DESKTOP"))), /*#__PURE__*/React__namespace.createElement("div", {
25500
- style: styles$c.editor
25502
+ style: styles$i.editor
25501
25503
  }, /*#__PURE__*/React__namespace.createElement(ArticleEditor, this.state)));
25502
25504
  }
25503
25505
  });
25504
- const styles$c = {
25506
+ const styles$i = {
25505
25507
  controlBar: {
25506
25508
  marginBottom: 25,
25507
25509
  marginTop: 5
@@ -27039,10 +27041,10 @@ class GradedGroupEditor extends React__namespace.Component {
27039
27041
  }, /*#__PURE__*/React__namespace.createElement("div", {
27040
27042
  className: "perseus-widget-row"
27041
27043
  }, /*#__PURE__*/React__namespace.createElement("label", {
27042
- className: aphrodite.css(styles$b.title)
27044
+ className: aphrodite.css(styles$h.title)
27043
27045
  }, "Title:", " ", /*#__PURE__*/React__namespace.createElement(TextInput$6, {
27044
27046
  value: this.props.title,
27045
- className: aphrodite.css(styles$b.input)
27047
+ className: aphrodite.css(styles$h.input)
27046
27048
  // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
27047
27049
  ,
27048
27050
  onChange: this.change("title")
@@ -27067,7 +27069,7 @@ class GradedGroupEditor extends React__namespace.Component {
27067
27069
  }, /*#__PURE__*/React__namespace.createElement(InlineIcon$4, iconPlus$1), " Add a hint"), this.props.hint && /*#__PURE__*/React__namespace.createElement("div", {
27068
27070
  className: "perseus-hint-editor"
27069
27071
  }, /*#__PURE__*/React__namespace.createElement("div", {
27070
- className: aphrodite.css(styles$b.hintsTitle)
27072
+ className: aphrodite.css(styles$h.hintsTitle)
27071
27073
  }, "Hint"), /*#__PURE__*/React__namespace.createElement(Editor, {
27072
27074
  ref: this.hintEditor,
27073
27075
  content: this.props.hint ? this.props.hint.content : "",
@@ -27099,7 +27101,7 @@ class GradedGroupEditor extends React__namespace.Component {
27099
27101
  };
27100
27102
  };
27101
27103
  }
27102
- const styles$b = aphrodite.StyleSheet.create({
27104
+ const styles$h = aphrodite.StyleSheet.create({
27103
27105
  title: {
27104
27106
  fontSize: 18,
27105
27107
  fontWeight: "bold"
@@ -27510,7 +27512,6 @@ const GraphSettings = createReactClass__default["default"]({
27510
27512
  const {
27511
27513
  TeX
27512
27514
  } = perseus.Dependencies.getDependencies();
27513
- this.props.box; // ?
27514
27515
  return /*#__PURE__*/React__namespace.createElement("div", null, ___default["default"].contains(this.props.editableSettings, "canvas") && /*#__PURE__*/React__namespace.createElement("div", {
27515
27516
  className: "graph-settings"
27516
27517
  }, /*#__PURE__*/React__namespace.createElement("div", {
@@ -28463,13 +28464,13 @@ function MathquillInput(props) {
28463
28464
  }
28464
28465
  });
28465
28466
  return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
28466
- style: styles$a.outerWrapper
28467
+ style: styles$g.outerWrapper
28467
28468
  }, /*#__PURE__*/React__namespace.createElement("span", {
28468
28469
  ref: mathFieldWrapperRef,
28469
28470
  className: "perseus-math-input mq-editable-field mq-math-mode"
28470
28471
  }));
28471
28472
  }
28472
- const styles$a = aphrodite.StyleSheet.create({
28473
+ const styles$g = aphrodite.StyleSheet.create({
28473
28474
  outerWrapper: {
28474
28475
  display: "inline-block",
28475
28476
  borderStyle: "solid",
@@ -29547,48 +29548,107 @@ const GraphPointsCountSelector = _ref => {
29547
29548
  numPoints = 1,
29548
29549
  onChange
29549
29550
  } = _ref;
29550
- return /*#__PURE__*/React__namespace.createElement("select", {
29551
- value: numPoints,
29552
- onChange: e => {
29553
- onChange(parsePointCount(e.target.value));
29551
+ return /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
29552
+ selectedValue: `${numPoints}`,
29553
+ onChange: newValue => {
29554
+ onChange(parsePointCount(newValue));
29554
29555
  }
29555
- }, [...Array(7).keys()].map(n => /*#__PURE__*/React__namespace.createElement("option", {
29556
+ // Never uses placeholder, always has value
29557
+ ,
29558
+ placeholder: "",
29559
+ style: styles$f.singleSelectShort
29560
+ }, [...[...Array(7).keys()].map(n => /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
29556
29561
  key: n,
29557
- value: n
29558
- }, `${n} point${n > 1 ? "s" : ""}`)), /*#__PURE__*/React__namespace.createElement("option", {
29559
- value: UNLIMITED
29560
- }, "unlimited"));
29562
+ value: `${n}`,
29563
+ label: `${n} point${n > 1 ? "s" : ""}`
29564
+ })), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
29565
+ value: UNLIMITED,
29566
+ label: "unlimited"
29567
+ })]);
29561
29568
  };
29569
+ const styles$f = aphrodite.StyleSheet.create({
29570
+ singleSelectShort: {
29571
+ // Non-standard spacing, but it's the smallest we can go
29572
+ // without running into styling issues with the dropdown.
29573
+ height: 26
29574
+ }
29575
+ });
29562
29576
 
29563
29577
  const GraphTypeSelector = props => {
29564
- return /*#__PURE__*/React__namespace.createElement("select", {
29565
- value: props.graphType,
29566
- onChange: e => {
29567
- const type = e.target.value;
29568
- props.onChange(type);
29569
- }
29570
- }, /*#__PURE__*/React__namespace.createElement("option", {
29571
- value: "linear"
29572
- }, "Linear function"), /*#__PURE__*/React__namespace.createElement("option", {
29573
- value: "quadratic"
29574
- }, "Quadratic function"), /*#__PURE__*/React__namespace.createElement("option", {
29575
- value: "sinusoid"
29576
- }, "Sinusoid function"), /*#__PURE__*/React__namespace.createElement("option", {
29577
- value: "circle"
29578
- }, "Circle"), /*#__PURE__*/React__namespace.createElement("option", {
29579
- value: "point"
29580
- }, "Point(s)"), /*#__PURE__*/React__namespace.createElement("option", {
29581
- value: "linear-system"
29582
- }, "Linear System"), /*#__PURE__*/React__namespace.createElement("option", {
29583
- value: "polygon"
29584
- }, "Polygon"), /*#__PURE__*/React__namespace.createElement("option", {
29585
- value: "segment"
29586
- }, "Line Segment(s)"), /*#__PURE__*/React__namespace.createElement("option", {
29587
- value: "ray"
29588
- }, "Ray"), /*#__PURE__*/React__namespace.createElement("option", {
29589
- value: "angle"
29590
- }, "Angle"));
29578
+ return /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
29579
+ selectedValue: props.graphType,
29580
+ onChange: props.onChange,
29581
+ placeholder: "Select a graph type",
29582
+ style: styles$e.singleSelectShort
29583
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
29584
+ value: "linear",
29585
+ label: "Linear function"
29586
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
29587
+ value: "quadratic",
29588
+ label: "Quadratic function"
29589
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
29590
+ value: "sinusoid",
29591
+ label: "Sinusoid function"
29592
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
29593
+ value: "circle",
29594
+ label: "Circle"
29595
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
29596
+ value: "point",
29597
+ label: "Point(s)"
29598
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
29599
+ value: "linear-system",
29600
+ label: "Linear System"
29601
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
29602
+ value: "polygon",
29603
+ label: "Polygon"
29604
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
29605
+ value: "segment",
29606
+ label: "Line Segment(s)"
29607
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
29608
+ value: "ray",
29609
+ label: "Ray"
29610
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
29611
+ value: "angle",
29612
+ label: "Angle"
29613
+ }));
29591
29614
  };
29615
+ const styles$e = aphrodite.StyleSheet.create({
29616
+ singleSelectShort: {
29617
+ // Non-standard spacing, but it's the smallest we can go
29618
+ // without running into styling issues with the dropdown.
29619
+ height: 26
29620
+ }
29621
+ });
29622
+
29623
+ // Renders the given children in a View laid out horizontally.
29624
+ const LabeledRow = props => {
29625
+ const {
29626
+ children,
29627
+ label,
29628
+ labelSide = "left",
29629
+ style
29630
+ } = props;
29631
+ return /*#__PURE__*/React__namespace.createElement("label", null, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
29632
+ style: [styles$d.row, style]
29633
+ }, labelSide === "start" || /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelSmall, {
29634
+ style: styles$d.spaceEnd
29635
+ }, label), children, labelSide === "end" && /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelSmall, {
29636
+ style: styles$d.spaceStart
29637
+ }, label)));
29638
+ };
29639
+ const styles$d = aphrodite.StyleSheet.create({
29640
+ row: {
29641
+ flexDirection: "row",
29642
+ marginTop: wonderBlocksTokens.spacing.xSmall_8,
29643
+ alignItems: "center"
29644
+ },
29645
+ spaceStart: {
29646
+ marginInlineStart: wonderBlocksTokens.spacing.xSmall_8
29647
+ },
29648
+ spaceEnd: {
29649
+ marginInlineEnd: wonderBlocksTokens.spacing.xSmall_8
29650
+ }
29651
+ });
29592
29652
 
29593
29653
  /* eslint-disable react/forbid-prop-types, react/no-unsafe */
29594
29654
  const {
@@ -29607,6 +29667,9 @@ function numSteps(range, step) {
29607
29667
  }
29608
29668
  class InteractiveGraphSettings extends React__namespace.Component {
29609
29669
  _isMounted = false;
29670
+ bgUrlRef = /*#__PURE__*/React__namespace.createRef();
29671
+ labelXRef = /*#__PURE__*/React__namespace.createRef();
29672
+ labelYRef = /*#__PURE__*/React__namespace.createRef();
29610
29673
  static stateFromProps(props) {
29611
29674
  return {
29612
29675
  labelsTextbox: props.labels,
@@ -29614,7 +29677,10 @@ class InteractiveGraphSettings extends React__namespace.Component {
29614
29677
  snapStepTextbox: props.snapStep,
29615
29678
  stepTextbox: props.step,
29616
29679
  rangeTextbox: props.range,
29617
- backgroundImage: ___default["default"].clone(props.backgroundImage)
29680
+ // Shallow-copied clone
29681
+ backgroundImage: {
29682
+ ...props.backgroundImage
29683
+ }
29618
29684
  };
29619
29685
  }
29620
29686
  constructor(props) {
@@ -29622,7 +29688,6 @@ class InteractiveGraphSettings extends React__namespace.Component {
29622
29688
  this.state = InteractiveGraphSettings.stateFromProps(props);
29623
29689
  }
29624
29690
  static defaultProps = {
29625
- editableSettings: ["graph", "snap", "image", "measure"],
29626
29691
  box: [perseus.interactiveSizes.defaultBoxSizeSmall, perseus.interactiveSizes.defaultBoxSizeSmall],
29627
29692
  labels: ["x", "y"],
29628
29693
  range: [[-10, 10], [-10, 10]],
@@ -29682,7 +29747,10 @@ class InteractiveGraphSettings extends React__namespace.Component {
29682
29747
  return;
29683
29748
  }
29684
29749
  const setUrl = (url, width, height) => {
29685
- const image = ___default["default"].clone(this.props.backgroundImage);
29750
+ // Shallow-copied clone
29751
+ const image = {
29752
+ ...this.props.backgroundImage
29753
+ };
29686
29754
  image.url = url;
29687
29755
  image.width = width;
29688
29756
  image.height = height;
@@ -29690,9 +29758,7 @@ class InteractiveGraphSettings extends React__namespace.Component {
29690
29758
  backgroundImage: image
29691
29759
  }, this.changeGraph);
29692
29760
  };
29693
-
29694
- // @ts-expect-error - TS2531 - Object is possibly 'null'. | TS2339 - Property 'value' does not exist on type 'Element | Text'.
29695
- const url = ReactDOM__default["default"].findDOMNode(this.refs["bg-url"]).value; // eslint-disable-line react/no-string-refs
29761
+ const url = this.bgUrlRef.current?.value;
29696
29762
  if (url) {
29697
29763
  perseus.Util.getImageSize(url, (width, height) => {
29698
29764
  if (this._isMounted) {
@@ -29704,11 +29770,10 @@ class InteractiveGraphSettings extends React__namespace.Component {
29704
29770
  }
29705
29771
  };
29706
29772
  renderLabelChoices = choices => {
29707
- return ___default["default"].map(choices, function (nameAndValue) {
29708
- return /*#__PURE__*/React__namespace.createElement("option", {
29709
- value: nameAndValue[1]
29710
- }, nameAndValue[0]);
29711
- });
29773
+ return choices.map(nameAndValue => /*#__PURE__*/React__namespace.createElement("option", {
29774
+ key: nameAndValue[1],
29775
+ value: nameAndValue[1]
29776
+ }, nameAndValue[0]));
29712
29777
  };
29713
29778
  validRange = range => {
29714
29779
  const numbers = ___default["default"].every(range, function (num) {
@@ -29730,9 +29795,6 @@ class InteractiveGraphSettings extends React__namespace.Component {
29730
29795
  minTicks,
29731
29796
  maxTicks
29732
29797
  } = settings;
29733
- if (!___default["default"].isFinite(step)) {
29734
- return name + " must be a valid number";
29735
- }
29736
29798
  const nSteps = numSteps(range, step);
29737
29799
  if (nSteps < minTicks) {
29738
29800
  return name + " is too large, there must be at least " + minTicks + " ticks.";
@@ -29901,105 +29963,76 @@ class InteractiveGraphSettings extends React__namespace.Component {
29901
29963
  };
29902
29964
 
29903
29965
  render() {
29904
- const scale = [perseus.KhanMath.roundTo(2, perseus.Util.scaleFromExtent(this.props.range[0], this.props.box[0])), perseus.KhanMath.roundTo(2, perseus.Util.scaleFromExtent(this.props.range[1], this.props.box[1]))];
29905
- const {
29906
- TeX
29907
- } = perseus.Dependencies.getDependencies();
29908
- return /*#__PURE__*/React__namespace.createElement("div", null, ___default["default"].contains(this.props.editableSettings, "canvas") && /*#__PURE__*/React__namespace.createElement("div", {
29909
- className: "graph-settings"
29910
- }, /*#__PURE__*/React__namespace.createElement("div", {
29911
- className: "perseus-widget-row"
29912
- }, /*#__PURE__*/React__namespace.createElement("label", {
29913
- htmlFor: "canvas-size"
29914
- }, "Canvas size (x,y pixels)"), /*#__PURE__*/React__namespace.createElement(RangeInput$4, {
29915
- id: "canvas-size",
29916
- value: this.props.box,
29917
- onChange: box => {
29918
- this.change({
29919
- box: box
29920
- });
29921
- }
29922
- })), /*#__PURE__*/React__namespace.createElement("div", {
29923
- className: "perseus-widget-row"
29924
- }, "Scale (px per div):", " ", /*#__PURE__*/React__namespace.createElement(TeX, null, "(" + scale[0] + ", " + scale[1] + ")"))), ___default["default"].contains(this.props.editableSettings, "graph") && /*#__PURE__*/React__namespace.createElement("div", {
29966
+ return /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("div", {
29925
29967
  className: "graph-settings"
29926
29968
  }, /*#__PURE__*/React__namespace.createElement("div", {
29927
29969
  className: "perseus-widget-row"
29928
29970
  }, /*#__PURE__*/React__namespace.createElement("div", {
29929
29971
  className: "perseus-widget-left-col"
29930
- }, /*#__PURE__*/React__namespace.createElement("label", {
29931
- htmlFor: "labels-x"
29932
- }, "x Label"), /*#__PURE__*/React__namespace.createElement("input", {
29933
- id: "labels-x",
29972
+ }, /*#__PURE__*/React__namespace.createElement(LabeledRow, {
29973
+ label: "x Label"
29974
+ }, /*#__PURE__*/React__namespace.createElement("input", {
29934
29975
  type: "text",
29935
- className: "graph-settings-axis-label"
29936
- // eslint-disable-next-line react/no-string-refs
29937
- ,
29938
- ref: "labels-0",
29976
+ className: "graph-settings-axis-label",
29977
+ ref: this.labelXRef,
29939
29978
  onChange: e => this.changeLabel(0, e),
29940
29979
  value: this.state.labelsTextbox[0] || ""
29941
- })), /*#__PURE__*/React__namespace.createElement("div", {
29980
+ }))), /*#__PURE__*/React__namespace.createElement("div", {
29942
29981
  className: "perseus-widget-right-col"
29943
- }, /*#__PURE__*/React__namespace.createElement("label", {
29944
- htmlFor: "labels-y"
29945
- }, "y Label"), /*#__PURE__*/React__namespace.createElement("input", {
29946
- id: "labels-y",
29982
+ }, /*#__PURE__*/React__namespace.createElement(LabeledRow, {
29983
+ label: "y Label"
29984
+ }, /*#__PURE__*/React__namespace.createElement("input", {
29947
29985
  type: "text",
29948
- className: "graph-settings-axis-label"
29949
- // eslint-disable-next-line react/no-string-refs
29950
- ,
29951
- ref: "labels-1",
29986
+ className: "graph-settings-axis-label",
29987
+ ref: this.labelYRef,
29952
29988
  onChange: e => this.changeLabel(1, e),
29953
29989
  value: this.state.labelsTextbox[1] || ""
29954
- }))), /*#__PURE__*/React__namespace.createElement("div", {
29990
+ })))), /*#__PURE__*/React__namespace.createElement("div", {
29955
29991
  className: "perseus-widget-row"
29956
29992
  }, /*#__PURE__*/React__namespace.createElement("div", {
29957
29993
  className: "perseus-widget-left-col"
29958
- }, /*#__PURE__*/React__namespace.createElement("label", {
29959
- htmlFor: "range-x"
29960
- }, "x Range"), /*#__PURE__*/React__namespace.createElement(RangeInput$4, {
29961
- id: "range-x",
29994
+ }, /*#__PURE__*/React__namespace.createElement(LabeledRow, {
29995
+ label: "x Range"
29996
+ }, /*#__PURE__*/React__namespace.createElement(RangeInput$4, {
29962
29997
  value: this.state.rangeTextbox[0],
29963
29998
  onChange: vals => this.changeRange(0, vals)
29964
- })), /*#__PURE__*/React__namespace.createElement("div", {
29999
+ }))), /*#__PURE__*/React__namespace.createElement("div", {
29965
30000
  className: "perseus-widget-right-col"
29966
- }, /*#__PURE__*/React__namespace.createElement("label", {
29967
- htmlFor: "range-y"
29968
- }, "y Range"), /*#__PURE__*/React__namespace.createElement(RangeInput$4, {
29969
- id: "range-y",
30001
+ }, /*#__PURE__*/React__namespace.createElement(LabeledRow, {
30002
+ label: "y Range"
30003
+ }, /*#__PURE__*/React__namespace.createElement(RangeInput$4, {
29970
30004
  value: this.state.rangeTextbox[1],
29971
30005
  onChange: vals => this.changeRange(1, vals)
29972
- }))), /*#__PURE__*/React__namespace.createElement("div", {
30006
+ })))), /*#__PURE__*/React__namespace.createElement("div", {
29973
30007
  className: "perseus-widget-row"
29974
30008
  }, /*#__PURE__*/React__namespace.createElement("div", {
29975
30009
  className: "perseus-widget-left-col"
29976
- }, /*#__PURE__*/React__namespace.createElement("label", {
29977
- htmlFor: "tick-step"
29978
- }, "Tick Step"), /*#__PURE__*/React__namespace.createElement(RangeInput$4, {
29979
- id: "tick-step",
30010
+ }, /*#__PURE__*/React__namespace.createElement(LabeledRow, {
30011
+ label: "Tick Step"
30012
+ }, /*#__PURE__*/React__namespace.createElement(RangeInput$4, {
29980
30013
  value: this.state.stepTextbox,
29981
30014
  onChange: this.changeStep
29982
- })), /*#__PURE__*/React__namespace.createElement("div", {
30015
+ }))), /*#__PURE__*/React__namespace.createElement("div", {
29983
30016
  className: "perseus-widget-right-col"
29984
- }, /*#__PURE__*/React__namespace.createElement("label", {
29985
- htmlFor: "grid-step"
29986
- }, "Grid Step"), /*#__PURE__*/React__namespace.createElement(RangeInput$4, {
29987
- id: "grid-step",
30017
+ }, /*#__PURE__*/React__namespace.createElement(LabeledRow, {
30018
+ label: "Grid Step"
30019
+ }, /*#__PURE__*/React__namespace.createElement(RangeInput$4, {
29988
30020
  value: this.state.gridStepTextbox,
29989
30021
  onChange: this.changeGridStep
29990
- }))), ___default["default"].contains(this.props.editableSettings, "snap") && /*#__PURE__*/React__namespace.createElement("div", {
30022
+ })))), /*#__PURE__*/React__namespace.createElement("div", {
29991
30023
  className: "perseus-widget-row"
29992
30024
  }, /*#__PURE__*/React__namespace.createElement("div", {
29993
30025
  className: "perseus-widget-left-col"
29994
- }, /*#__PURE__*/React__namespace.createElement("label", {
29995
- htmlFor: "snap-step"
29996
- }, "Snap Step"), /*#__PURE__*/React__namespace.createElement(RangeInput$4, {
29997
- id: "snap-step",
30026
+ }, /*#__PURE__*/React__namespace.createElement(LabeledRow, {
30027
+ label: "Snap Step"
30028
+ }, /*#__PURE__*/React__namespace.createElement(RangeInput$4, {
29998
30029
  value: this.state.snapStepTextbox,
29999
30030
  onChange: this.changeSnapStep
30000
- }))), /*#__PURE__*/React__namespace.createElement("div", {
30031
+ })))), /*#__PURE__*/React__namespace.createElement("div", {
30001
30032
  className: "perseus-widget-row"
30002
- }, /*#__PURE__*/React__namespace.createElement("label", null, "Markings: "), /*#__PURE__*/React__namespace.createElement(ButtonGroup$2, {
30033
+ }, /*#__PURE__*/React__namespace.createElement(LabeledRow, {
30034
+ label: "Markings:"
30035
+ }, /*#__PURE__*/React__namespace.createElement(ButtonGroup$2, {
30003
30036
  value: this.props.markings,
30004
30037
  allowEmpty: false,
30005
30038
  buttons: [{
@@ -30013,26 +30046,25 @@ class InteractiveGraphSettings extends React__namespace.Component {
30013
30046
  content: "None"
30014
30047
  }],
30015
30048
  onChange: this.change("markings")
30016
- })), /*#__PURE__*/React__namespace.createElement("div", {
30049
+ }))), /*#__PURE__*/React__namespace.createElement("div", {
30017
30050
  className: "perseus-widget-left-col"
30018
30051
  }, /*#__PURE__*/React__namespace.createElement(PropCheckBox$7, {
30019
30052
  label: "Show tooltips",
30020
30053
  showTooltips: this.props.showTooltips,
30021
30054
  onChange: this.change
30022
- }))), ___default["default"].contains(this.props.editableSettings, "image") && /*#__PURE__*/React__namespace.createElement("div", {
30023
- className: "image-settings"
30024
- }, /*#__PURE__*/React__namespace.createElement("div", null, "Background image:"), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("label", {
30025
- htmlFor: "bg-url"
30026
- }, "Url:"), /*#__PURE__*/React__namespace.createElement("input", {
30027
- id: "bg-url",
30055
+ }))), /*#__PURE__*/React__namespace.createElement(LabeledRow, {
30056
+ label: "Background image URL:",
30057
+ style: styles$c.resetSpaceTop
30058
+ }, /*#__PURE__*/React__namespace.createElement("input", {
30028
30059
  type: "text",
30029
- className: "graph-settings-background-url"
30030
- // eslint-disable-next-line react/no-string-refs
30031
- ,
30032
- ref: "bg-url",
30060
+ className: aphrodite.css(styles$c.backgroundUrlInput),
30061
+ ref: this.bgUrlRef,
30033
30062
  value: this.state.backgroundImage.url || "",
30034
30063
  onChange: e => {
30035
- const image = ___default["default"].clone(this.props.backgroundImage);
30064
+ // Shallow-copied clone
30065
+ const image = {
30066
+ ...this.props.backgroundImage
30067
+ };
30036
30068
  image.url = e.target.value;
30037
30069
  this.setState({
30038
30070
  backgroundImage: image
@@ -30040,59 +30072,143 @@ class InteractiveGraphSettings extends React__namespace.Component {
30040
30072
  },
30041
30073
  onKeyPress: this.changeBackgroundUrl,
30042
30074
  onBlur: this.changeBackgroundUrl
30043
- }), /*#__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.")))), ___default["default"].contains(this.props.editableSettings, "measure") && /*#__PURE__*/React__namespace.createElement("div", {
30044
- className: "misc-settings"
30045
- }, /*#__PURE__*/React__namespace.createElement("div", {
30046
- className: "perseus-widget-row"
30047
- }, /*#__PURE__*/React__namespace.createElement("div", {
30048
- className: "perseus-widget-left-col"
30075
+ }), /*#__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, {
30076
+ style: styles$c.rulerSection
30077
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30078
+ style: styles$c.checkboxRow
30049
30079
  }, /*#__PURE__*/React__namespace.createElement(PropCheckBox$7, {
30050
30080
  label: "Show ruler",
30051
30081
  showRuler: this.props.showRuler,
30052
- onChange: this.change
30053
- })), /*#__PURE__*/React__namespace.createElement("div", {
30054
- className: "perseus-widget-right-col"
30055
- }, /*#__PURE__*/React__namespace.createElement(PropCheckBox$7, {
30082
+ onChange: this.change,
30083
+ style: styles$c.resetSpaceTop
30084
+ }), /*#__PURE__*/React__namespace.createElement(PropCheckBox$7, {
30056
30085
  label: "Show protractor",
30057
30086
  showProtractor: this.props.showProtractor,
30058
- onChange: this.change
30059
- }))), this.props.showRuler && /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("label", null, " ", "Ruler label:", " ", /*#__PURE__*/React__namespace.createElement("select", {
30060
- onChange: this.changeRulerLabel,
30061
- value: this.props.rulerLabel
30062
- }, /*#__PURE__*/React__namespace.createElement("option", {
30063
- value: ""
30064
- }, "None"), /*#__PURE__*/React__namespace.createElement("optgroup", {
30065
- label: "Metric"
30066
- }, this.renderLabelChoices([["milimeters", "mm"], ["centimeters", "cm"], ["meters", "m"], ["kilometers", "km"]])), /*#__PURE__*/React__namespace.createElement("optgroup", {
30067
- label: "Imperial"
30068
- }, this.renderLabelChoices([["inches", "in"], ["feet", "ft"], ["yards", "yd"], ["miles", "mi"]]))))), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("label", null, " ", "Ruler ticks:", " ", /*#__PURE__*/React__namespace.createElement("select", {
30069
- onChange: this.changeRulerTicks,
30070
- value: this.props.rulerTicks
30071
- }, ___default["default"].map([1, 2, 4, 8, 10, 16], function (n) {
30072
- return /*#__PURE__*/React__namespace.createElement("option", {
30073
- value: n
30074
- }, n);
30087
+ onChange: this.change,
30088
+ style: styles$c.resetSpaceTop
30089
+ })), this.props.showRuler && /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30090
+ style: styles$c.spaceTop
30091
+ }, /*#__PURE__*/React__namespace.createElement(LabeledRow, {
30092
+ label: "Ruler label:",
30093
+ style: styles$c.resetSpaceTop
30094
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
30095
+ id: "ruler-label-select",
30096
+ selectedValue: this.props.rulerLabel,
30097
+ onChange: newValue => {
30098
+ this.change({
30099
+ rulerLabel: newValue
30100
+ });
30101
+ },
30102
+ placeholder: "None",
30103
+ style: styles$c.singleSelectShort
30104
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
30105
+ value: "",
30106
+ label: "None",
30107
+ horizontalRule: "full-width"
30108
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
30109
+ value: "mm",
30110
+ label: "Milimeters"
30111
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
30112
+ value: "cm",
30113
+ label: "Centimeters"
30114
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
30115
+ value: "m",
30116
+ label: "Meters"
30117
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
30118
+ value: "km",
30119
+ label: "Kilometers",
30120
+ horizontalRule: "full-width"
30121
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
30122
+ value: "in",
30123
+ label: "Inches"
30124
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
30125
+ value: "ft",
30126
+ label: "Feet"
30127
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
30128
+ value: "yd",
30129
+ label: "Yards"
30130
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
30131
+ value: "mi",
30132
+ label: "Miles"
30133
+ }))), /*#__PURE__*/React__namespace.createElement(LabeledRow, {
30134
+ label: "Ruler ticks:"
30135
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
30136
+ id: "ruler-ticks-select",
30137
+ selectedValue: `${this.props.rulerTicks}`,
30138
+ onChange: newValue => {
30139
+ this.change({
30140
+ rulerTicks: newValue
30141
+ });
30142
+ },
30143
+ placeholder: "10",
30144
+ style: styles$c.singleSelectShort
30145
+ }, [1, 2, 4, 8, 10, 16].map(value => /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
30146
+ key: value,
30147
+ value: `${value}`,
30148
+ label: `${value}`
30075
30149
  })))))));
30076
30150
  }
30077
30151
  }
30152
+ const styles$c = aphrodite.StyleSheet.create({
30153
+ resetSpaceTop: {
30154
+ marginTop: 0
30155
+ },
30156
+ spaceTop: {
30157
+ marginTop: wonderBlocksTokens.spacing.xSmall_8
30158
+ },
30159
+ singleSelectShort: {
30160
+ // Non-standard spacing, but it's the smallest we can go
30161
+ // without running into styling issues with the dropdown.
30162
+ height: 26
30163
+ },
30164
+ backgroundUrlInput: {
30165
+ border: `1px solid ${wonderBlocksTokens.color.offBlack32}`,
30166
+ borderRadius: wonderBlocksTokens.spacing.xxxSmall_4,
30167
+ padding: wonderBlocksTokens.spacing.xxxSmall_4
30168
+ },
30169
+ checkboxRow: {
30170
+ flexDirection: "row",
30171
+ alignItems: "center",
30172
+ justifyContent: "space-between"
30173
+ },
30174
+ rulerSection: {
30175
+ marginTop: wonderBlocksTokens.spacing.xSmall_8,
30176
+ borderTop: `1px solid ${wonderBlocksTokens.color.offBlack16}`,
30177
+ paddingTop: wonderBlocksTokens.spacing.xSmall_8,
30178
+ paddingBottom: wonderBlocksTokens.spacing.xSmall_8,
30179
+ borderBottom: `1px solid ${wonderBlocksTokens.color.offBlack16}`
30180
+ }
30181
+ });
30078
30182
 
30079
30183
  const SegmentCountSelector = _ref => {
30080
30184
  let {
30081
30185
  numSegments = 1,
30082
30186
  onChange
30083
30187
  } = _ref;
30084
- return /*#__PURE__*/React__namespace.createElement("select", {
30188
+ return /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
30085
30189
  key: "segment-select",
30086
- value: numSegments,
30087
- onChange: e => {
30088
- const num = +e.target.value;
30190
+ selectedValue: `${numSegments}`
30191
+ // Never uses placeholder, always has value
30192
+ ,
30193
+ placeholder: "",
30194
+ onChange: newValue => {
30195
+ const num = +newValue;
30089
30196
  onChange(num);
30090
- }
30091
- }, ___default["default"].range(1, 7).map(n => /*#__PURE__*/React__namespace.createElement("option", {
30197
+ },
30198
+ style: styles$b.singleSelectShort
30199
+ }, ___default["default"].range(1, 7).map(n => /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
30092
30200
  key: n,
30093
- value: n
30094
- }, `${n} segment${n > 1 ? "s" : ""}`)));
30201
+ value: `${n}`,
30202
+ label: `${n} segment${n > 1 ? "s" : ""}`
30203
+ })));
30095
30204
  };
30205
+ const styles$b = aphrodite.StyleSheet.create({
30206
+ singleSelectShort: {
30207
+ // Non-standard spacing, but it's the smallest we can go
30208
+ // without running into styling issues with the dropdown.
30209
+ height: 26
30210
+ }
30211
+ });
30096
30212
 
30097
30213
  const {
30098
30214
  InfoTip: InfoTip$b
@@ -30113,27 +30229,13 @@ const deprecatedProps = {
30113
30229
  };
30114
30230
  }
30115
30231
  };
30116
- // Renders the given children in a View laid out horizontally.
30117
- const Row = props => {
30118
- const {
30119
- children,
30120
- style
30121
- } = props;
30122
- return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30123
- style: {
30124
- ...style,
30125
- flexDirection: "row",
30126
- marginTop: Spacing__default["default"].xSmall_8
30127
- }
30128
- }, children);
30129
- };
30130
- const FieldLabel = props => {
30131
- return /*#__PURE__*/React__namespace.createElement(Typography__namespace.LabelSmall, {
30132
- style: {
30133
- marginRight: Spacing__default["default"].xSmall_8
30134
- }
30135
- }, props.children);
30136
- };
30232
+ const POLYGON_SIDES = ___default["default"].map(___default["default"].range(3, 13), function (value) {
30233
+ return /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
30234
+ key: `polygon-sides-${value}`,
30235
+ value: `${value}`,
30236
+ label: `${value} sides`
30237
+ });
30238
+ });
30137
30239
  /**
30138
30240
  * An editor for the InteractiveGraph widget, which allows the user to
30139
30241
  * specify the graph's properties and the correct answer.
@@ -30183,6 +30285,7 @@ class InteractiveGraphEditor extends React__namespace.Component {
30183
30285
  markings: this.props.markings,
30184
30286
  showProtractor: this.props.showProtractor,
30185
30287
  showRuler: this.props.showRuler,
30288
+ showTooltips: this.props.showTooltips,
30186
30289
  rulerLabel: this.props.rulerLabel,
30187
30290
  rulerTicks: this.props.rulerTicks,
30188
30291
  trackInteraction: function () {},
@@ -30222,7 +30325,9 @@ class InteractiveGraphEditor extends React__namespace.Component {
30222
30325
  className: "perseus-error"
30223
30326
  }, this.props.valid);
30224
30327
  }
30225
- return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, null, /*#__PURE__*/React__namespace.createElement(Row, null, /*#__PURE__*/React__namespace.createElement(FieldLabel, null, "Type of Graph:"), /*#__PURE__*/React__namespace.createElement(GraphTypeSelector, {
30328
+ return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, null, /*#__PURE__*/React__namespace.createElement(LabeledRow, {
30329
+ label: "Type of Graph:"
30330
+ }, /*#__PURE__*/React__namespace.createElement(GraphTypeSelector, {
30226
30331
  graphType: this.props.graph?.type ?? InteractiveGraph.defaultProps.graph.type,
30227
30332
  onChange: type => {
30228
30333
  this.props.onChange({
@@ -30234,7 +30339,9 @@ class InteractiveGraphEditor extends React__namespace.Component {
30234
30339
  }
30235
30340
  });
30236
30341
  }
30237
- })), this.props.correct?.type === "point" && /*#__PURE__*/React__namespace.createElement(Row, null, /*#__PURE__*/React__namespace.createElement(FieldLabel, null, "Number of Points:"), /*#__PURE__*/React__namespace.createElement(GraphPointsCountSelector, {
30342
+ })), this.props.correct?.type === "point" && /*#__PURE__*/React__namespace.createElement(LabeledRow, {
30343
+ label: "Number of Points:"
30344
+ }, /*#__PURE__*/React__namespace.createElement(GraphPointsCountSelector, {
30238
30345
  numPoints: this.props.correct?.numPoints,
30239
30346
  onChange: points => {
30240
30347
  this.props.onChange({
@@ -30244,13 +30351,16 @@ class InteractiveGraphEditor extends React__namespace.Component {
30244
30351
  }
30245
30352
  });
30246
30353
  }
30247
- })), this.props.correct?.type === "polygon" && /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(Row, null, /*#__PURE__*/React__namespace.createElement(FieldLabel, null, "Number of sides:"), /*#__PURE__*/React__namespace.createElement("select", {
30354
+ })), this.props.correct?.type === "polygon" && /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(LabeledRow, {
30355
+ label: "Number of sides:"
30356
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
30248
30357
  key: "polygon-select",
30249
- value: this.props.correct?.numSides || 3,
30250
- onChange: e => {
30358
+ selectedValue: this.props.correct?.numSides ? `${this.props.correct.numSides}` : "3",
30359
+ placeholder: "",
30360
+ onChange: newValue => {
30251
30361
  const graph = {
30252
30362
  ...this.props.correct,
30253
- numSides: parsePointCount(e.target.value),
30363
+ numSides: parsePointCount(newValue),
30254
30364
  coords: null,
30255
30365
  // reset the snap for UNLIMITED, which
30256
30366
  // only supports "grid"
@@ -30260,38 +30370,45 @@ class InteractiveGraphEditor extends React__namespace.Component {
30260
30370
  this.props.onChange({
30261
30371
  correct: graph
30262
30372
  });
30263
- }
30264
- }, ___default["default"].map(___default["default"].range(3, 13), function (n) {
30265
- return /*#__PURE__*/React__namespace.createElement("option", {
30266
- key: n,
30267
- value: n
30268
- }, `${n} sides`);
30269
- }), /*#__PURE__*/React__namespace.createElement("option", {
30270
- value: "unlimited"
30271
- }, "unlimited sides"))), /*#__PURE__*/React__namespace.createElement(Row, null, /*#__PURE__*/React__namespace.createElement(FieldLabel, null, "Snap to:"), /*#__PURE__*/React__namespace.createElement("select", {
30272
- key: "polygon-snap",
30273
- value: this.props.correct?.snapTo,
30274
- onChange: e => {
30373
+ },
30374
+ style: styles$a.singleSelectShort
30375
+ }, [...POLYGON_SIDES, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
30376
+ value: "unlimited",
30377
+ label: "unlimited sides"
30378
+ })])), /*#__PURE__*/React__namespace.createElement(LabeledRow, {
30379
+ label: "Snap to:"
30380
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
30381
+ selectedValue: this.props.correct?.snapTo || "grid"
30382
+ // Never uses placeholder, always has value
30383
+ ,
30384
+ placeholder: "",
30385
+ onChange: newValue => {
30275
30386
  const graph = {
30276
30387
  ...this.props.correct,
30277
- snapTo: e.target.value,
30388
+ snapTo: newValue,
30278
30389
  coords: null
30279
30390
  };
30280
30391
  this.props.onChange({
30281
30392
  correct: graph
30282
30393
  });
30283
- }
30284
- }, /*#__PURE__*/React__namespace.createElement("option", {
30285
- value: "grid"
30286
- }, "grid"), this.props.correct?.numSides !== "unlimited" && /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement("option", {
30287
- value: "angles"
30288
- }, "interior angles"), /*#__PURE__*/React__namespace.createElement("option", {
30289
- value: "sides"
30290
- }, "side measures"))), /*#__PURE__*/React__namespace.createElement(InfoTip$b, null, /*#__PURE__*/React__namespace.createElement("p", null, "These options affect the movement of the vertex points. The grid option will guide the points to the nearest half step along the grid."), /*#__PURE__*/React__namespace.createElement("p", null, "The interior angle and side measure options guide the points to the nearest whole angle or side"), " ", "measure respectively.")), /*#__PURE__*/React__namespace.createElement(Row, null, /*#__PURE__*/React__namespace.createElement(Typography__namespace.LabelSmall, {
30291
- tag: "label"
30292
- }, "Show angle measures:", " ", /*#__PURE__*/React__namespace.createElement("input", {
30293
- type: "checkbox",
30294
- checked: this.props.correct?.showAngles,
30394
+ },
30395
+ style: styles$a.singleSelectShort
30396
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
30397
+ value: "grid",
30398
+ label: "grid"
30399
+ }), this.props.correct?.numSides !== "unlimited" && /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
30400
+ value: "angles",
30401
+ label: "interior angles"
30402
+ }), this.props.correct?.numSides !== "unlimited" && /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
30403
+ value: "sides",
30404
+ label: "side measures"
30405
+ })), /*#__PURE__*/React__namespace.createElement(InfoTip$b, null, /*#__PURE__*/React__namespace.createElement("p", null, "These options affect the movement of the vertex points. The grid option will guide the points to the nearest half step along the grid."), /*#__PURE__*/React__namespace.createElement("p", null, "The interior angle and side measure options guide the points to the nearest whole angle or side"), " ", "measure respectively.")), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30406
+ style: styles$a.row
30407
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
30408
+ label: /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelSmall, null, "Show angle measures"),
30409
+ checked:
30410
+ // Don't show indeterminate checkbox state
30411
+ !!this.props.correct?.showAngles,
30295
30412
  onChange: () => {
30296
30413
  this.props.onChange({
30297
30414
  correct: {
@@ -30300,11 +30417,13 @@ class InteractiveGraphEditor extends React__namespace.Component {
30300
30417
  }
30301
30418
  });
30302
30419
  }
30303
- })), /*#__PURE__*/React__namespace.createElement(InfoTip$b, null, /*#__PURE__*/React__namespace.createElement("p", null, "Displays the interior angle measures."))), /*#__PURE__*/React__namespace.createElement(Row, null, /*#__PURE__*/React__namespace.createElement(Typography__namespace.LabelSmall, {
30304
- tag: "label"
30305
- }, "Show side measures:", " ", /*#__PURE__*/React__namespace.createElement("input", {
30306
- type: "checkbox",
30307
- checked: this.props.correct?.showSides,
30420
+ }), /*#__PURE__*/React__namespace.createElement(InfoTip$b, null, /*#__PURE__*/React__namespace.createElement("p", null, "Displays the interior angle measures."))), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30421
+ style: styles$a.row
30422
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
30423
+ label: /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelSmall, null, "Show side measures"),
30424
+ checked:
30425
+ // Don't show indeterminate checkbox state
30426
+ !!this.props.correct?.showSides,
30308
30427
  onChange: () => {
30309
30428
  this.props.onChange({
30310
30429
  correct: {
@@ -30313,7 +30432,9 @@ class InteractiveGraphEditor extends React__namespace.Component {
30313
30432
  }
30314
30433
  });
30315
30434
  }
30316
- })), /*#__PURE__*/React__namespace.createElement(InfoTip$b, null, /*#__PURE__*/React__namespace.createElement("p", null, "Displays the side lengths.")))), this.props.correct?.type === "segment" && /*#__PURE__*/React__namespace.createElement(Row, null, /*#__PURE__*/React__namespace.createElement(FieldLabel, null, "Number of segments: "), /*#__PURE__*/React__namespace.createElement(SegmentCountSelector, {
30435
+ }), /*#__PURE__*/React__namespace.createElement(InfoTip$b, null, /*#__PURE__*/React__namespace.createElement("p", null, "Displays the side lengths.")))), this.props.correct?.type === "segment" && /*#__PURE__*/React__namespace.createElement(LabeledRow, {
30436
+ label: "Number of segments:"
30437
+ }, /*#__PURE__*/React__namespace.createElement(SegmentCountSelector, {
30317
30438
  numSegments: this.props.correct?.numSegments,
30318
30439
  onChange: sides => {
30319
30440
  this.props.onChange({
@@ -30324,16 +30445,7 @@ class InteractiveGraphEditor extends React__namespace.Component {
30324
30445
  }
30325
30446
  });
30326
30447
  }
30327
- })), /*#__PURE__*/React__namespace.createElement(Row, null, /*#__PURE__*/React__namespace.createElement(FieldLabel, null, "Correct answer:"), /*#__PURE__*/React__namespace.createElement(Typography__namespace.BodyMonospace, {
30328
- style: {
30329
- fontSize: 12,
30330
- backgroundColor: "#eee",
30331
- paddingInline: Spacing__default["default"].xxSmall_6,
30332
- borderColor: "#ccc",
30333
- borderStyle: "solid",
30334
- borderWidth: 1
30335
- }
30336
- }, 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."))), /*#__PURE__*/React__namespace.createElement(InteractiveGraphSettings, {
30448
+ })), /*#__PURE__*/React__namespace.createElement(InteractiveGraphSettings, {
30337
30449
  box: getInteractiveBoxFromSizeClass(sizeClass),
30338
30450
  range: this.props.range,
30339
30451
  labels: this.props.labels,
@@ -30349,38 +30461,64 @@ class InteractiveGraphEditor extends React__namespace.Component {
30349
30461
  rulerLabel: this.props.rulerLabel,
30350
30462
  rulerTicks: this.props.rulerTicks,
30351
30463
  onChange: this.props.onChange
30352
- }), this.props.correct.type === "polygon" && /*#__PURE__*/React__namespace.createElement("div", {
30353
- className: "type-settings"
30354
- }, /*#__PURE__*/React__namespace.createElement("label", null, " ", "Student answer must", " ", /*#__PURE__*/React__namespace.createElement("select", {
30355
- value: this.props.correct.match,
30464
+ }), this.props.correct.type === "polygon" && /*#__PURE__*/React__namespace.createElement(LabeledRow, {
30465
+ label: "Student answer must"
30466
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
30467
+ selectedValue: this.props.correct.match || "exact",
30356
30468
  onChange: this.changeMatchType
30357
- }, /*#__PURE__*/React__namespace.createElement("option", {
30358
- value: "exact"
30359
- }, "match exactly"), /*#__PURE__*/React__namespace.createElement("option", {
30360
- value: "congruent"
30361
- }, "be congruent"), /*#__PURE__*/React__namespace.createElement("option", {
30362
- value: "approx"
30363
- }, "be approximately congruent"), /*#__PURE__*/React__namespace.createElement("option", {
30364
- value: "similar"
30365
- }, "be similar"))), /*#__PURE__*/React__namespace.createElement(InfoTip$b, null, /*#__PURE__*/React__namespace.createElement("ul", null, /*#__PURE__*/React__namespace.createElement("li", null, /*#__PURE__*/React__namespace.createElement("p", null, /*#__PURE__*/React__namespace.createElement("b", null, "Match Exactly:"), " Match exactly in size, orientation, and location on the grid even if it is not shown in the background.")), /*#__PURE__*/React__namespace.createElement("li", null, /*#__PURE__*/React__namespace.createElement("p", null, /*#__PURE__*/React__namespace.createElement("b", null, "Be Congruent:"), " Be congruent in size and shape, but can be located anywhere on the grid.")), /*#__PURE__*/React__namespace.createElement("li", null, /*#__PURE__*/React__namespace.createElement("p", null, /*#__PURE__*/React__namespace.createElement("b", null, "Be Approximately Congruent:"), " Be exactly similar, and congruent in size and shape to within 0.1 units, but can be located anywhere on the grid.", " ", /*#__PURE__*/React__namespace.createElement("em", null, "Use this with snapping to angle measure."))), /*#__PURE__*/React__namespace.createElement("li", null, /*#__PURE__*/React__namespace.createElement("p", null, /*#__PURE__*/React__namespace.createElement("b", null, "Be Similar:"), " Be similar with matching interior angles, and side measures that are matching or a multiple of the correct side measures. The figure can be located anywhere on the grid."))))), this.props.correct.type === "angle" && /*#__PURE__*/React__namespace.createElement("div", {
30366
- className: "type-settings"
30367
- }, /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("label", null, " ", "Student answer must", " ", /*#__PURE__*/React__namespace.createElement("select", {
30368
- value: this.props.correct.match,
30469
+ // Never uses placeholder, always has value
30470
+ ,
30471
+ placeholder: "",
30472
+ style: styles$a.singleSelectShort
30473
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
30474
+ value: "exact",
30475
+ label: "match exactly"
30476
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
30477
+ value: "congruent",
30478
+ label: "be congruent"
30479
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
30480
+ value: "approx",
30481
+ label: "be approximately congruent"
30482
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
30483
+ value: "similar",
30484
+ label: "be similar"
30485
+ })), /*#__PURE__*/React__namespace.createElement(InfoTip$b, null, /*#__PURE__*/React__namespace.createElement("ul", null, /*#__PURE__*/React__namespace.createElement("li", null, /*#__PURE__*/React__namespace.createElement("p", null, /*#__PURE__*/React__namespace.createElement("b", null, "Match Exactly:"), " Match exactly in size, orientation, and location on the grid even if it is not shown in the background.")), /*#__PURE__*/React__namespace.createElement("li", null, /*#__PURE__*/React__namespace.createElement("p", null, /*#__PURE__*/React__namespace.createElement("b", null, "Be Congruent:"), " Be congruent in size and shape, but can be located anywhere on the grid.")), /*#__PURE__*/React__namespace.createElement("li", null, /*#__PURE__*/React__namespace.createElement("p", null, /*#__PURE__*/React__namespace.createElement("b", null, "Be Approximately Congruent:"), " Be exactly similar, and congruent in size and shape to within 0.1 units, but can be located anywhere on the grid.", " ", /*#__PURE__*/React__namespace.createElement("em", null, "Use this with snapping to angle measure."))), /*#__PURE__*/React__namespace.createElement("li", null, /*#__PURE__*/React__namespace.createElement("p", null, /*#__PURE__*/React__namespace.createElement("b", null, "Be Similar:"), " Be similar with matching interior angles, and side measures that are matching or a multiple of the correct side measures. The figure can be located anywhere on the grid."))))), this.props.correct.type === "angle" && /*#__PURE__*/React__namespace.createElement(LabeledRow, {
30486
+ label: "Student answer must"
30487
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
30488
+ selectedValue: this.props.correct.match || "exact",
30369
30489
  onChange: this.changeMatchType
30370
- }, /*#__PURE__*/React__namespace.createElement("option", {
30371
- value: "exact"
30372
- }, "match exactly"), /*#__PURE__*/React__namespace.createElement("option", {
30373
- value: "congruent"
30374
- }, "be congruent"))), /*#__PURE__*/React__namespace.createElement(InfoTip$b, null, /*#__PURE__*/React__namespace.createElement("p", null, "Congruency requires only that the angle measures are the same. An exact match implies congruency, but also requires that the angles have the same orientation and that the vertices are in the same position.")))), graph);
30375
- }
30376
- changeMatchType(e) {
30377
- const correct = ___default["default"].extend({}, this.props.correct, {
30378
- match: e.target.value
30379
- });
30490
+ // Never uses placeholder, always has value
30491
+ ,
30492
+ placeholder: "",
30493
+ style: styles$a.singleSelectShort
30494
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
30495
+ value: "exact",
30496
+ label: "match exactly"
30497
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
30498
+ value: "congruent",
30499
+ label: "be congruent"
30500
+ })), /*#__PURE__*/React__namespace.createElement(InfoTip$b, null, /*#__PURE__*/React__namespace.createElement("p", null, "Congruency requires only that the angle measures are the same. An exact match implies congruency, but also requires that the angles have the same orientation and that the vertices are in the same position."))), /*#__PURE__*/React__namespace.createElement(LabeledRow, {
30501
+ label: "Correct answer:"
30502
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.BodyMonospace, {
30503
+ style: {
30504
+ fontSize: 12,
30505
+ backgroundColor: "#eee",
30506
+ paddingInline: Spacing__default["default"].xxSmall_6,
30507
+ borderColor: "#ccc",
30508
+ borderStyle: "solid",
30509
+ borderWidth: 1
30510
+ }
30511
+ }, 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);
30512
+ }
30513
+ changeMatchType = newValue => {
30514
+ const correct = {
30515
+ ...this.props.correct,
30516
+ match: newValue
30517
+ };
30380
30518
  this.props.onChange({
30381
30519
  correct: correct
30382
30520
  });
30383
- }
30521
+ };
30384
30522
  serialize() {
30385
30523
  const json = ___default["default"].pick(this.props, "step", "backgroundImage", "markings", "labels", "showProtractor", "showRuler", "showTooltips", "rulerLabel", "rulerTicks", "range", "gridStep", "snapStep");
30386
30524
 
@@ -30406,6 +30544,18 @@ class InteractiveGraphEditor extends React__namespace.Component {
30406
30544
  return json;
30407
30545
  }
30408
30546
  }
30547
+ const styles$a = aphrodite.StyleSheet.create({
30548
+ singleSelectShort: {
30549
+ // Non-standard spacing, but it's the smallest we can go
30550
+ // without running into styling issues with the dropdown.
30551
+ height: 26
30552
+ },
30553
+ row: {
30554
+ flexDirection: "row",
30555
+ marginTop: Spacing__default["default"].xSmall_8,
30556
+ alignItems: "center"
30557
+ }
30558
+ });
30409
30559
 
30410
30560
  class FormWrappedTextField extends React__namespace.Component {
30411
30561
  state = {