@khanacademy/perseus-editor 11.2.0 → 11.4.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
@@ -16,15 +16,15 @@ var wonderBlocksCore = require('@khanacademy/wonder-blocks-core');
16
16
  var wonderBlocksIcon = require('@khanacademy/wonder-blocks-icon');
17
17
  var caretRight = require('@phosphor-icons/core/bold/caret-right-bold.svg');
18
18
  var classNames = require('classnames');
19
+ var wonderBlocksForm = require('@khanacademy/wonder-blocks-form');
19
20
  var ReactDOM = require('react-dom');
20
21
  var kmath = require('@khanacademy/kmath');
21
22
  var KAS = require('@khanacademy/kas');
23
+ var Button = require('@khanacademy/wonder-blocks-button');
24
+ var wonderBlocksTypography = require('@khanacademy/wonder-blocks-typography');
22
25
  var wonderStuffCore = require('@khanacademy/wonder-stuff-core');
23
26
  var mathInput = require('@khanacademy/math-input');
24
27
  var wonderBlocksDropdown = require('@khanacademy/wonder-blocks-dropdown');
25
- var wonderBlocksForm = require('@khanacademy/wonder-blocks-form');
26
- var wonderBlocksTypography = require('@khanacademy/wonder-blocks-typography');
27
- var Button = require('@khanacademy/wonder-blocks-button');
28
28
  var wonderBlocksAccordion = require('@khanacademy/wonder-blocks-accordion');
29
29
  var IconButton = require('@khanacademy/wonder-blocks-icon-button');
30
30
  var caretDoubleDownIcon = require('@phosphor-icons/core/bold/caret-double-down-bold.svg');
@@ -83,7 +83,7 @@ var arrowCounterClockwise__default = /*#__PURE__*/_interopDefaultLegacy(arrowCou
83
83
 
84
84
  // This file is processed by a Rollup plugin (replace) to inject the production
85
85
  const libName = "@khanacademy/perseus-editor";
86
- const libVersion = "11.2.0";
86
+ const libVersion = "11.4.0";
87
87
  perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
88
88
 
89
89
  function _extends() {
@@ -278,13 +278,13 @@ class SectionControlButton extends React__namespace.Component {
278
278
  role: "button",
279
279
  hideDefaultFocusRing: true,
280
280
  "aria-label": title,
281
- style: styles$L.button
281
+ style: styles$R.button
282
282
  }, _ref => {
283
283
  return /*#__PURE__*/React__namespace.createElement(InlineIcon$a, icon);
284
284
  });
285
285
  }
286
286
  }
287
- const styles$L = aphrodite.StyleSheet.create({
287
+ const styles$R = aphrodite.StyleSheet.create({
288
288
  button: {
289
289
  backgroundColor: wonderBlocksTokens.color.gold,
290
290
  margin: 2,
@@ -20789,13 +20789,13 @@ class WidgetSelect extends React__namespace.Component {
20789
20789
  * that collapse a region.
20790
20790
  */
20791
20791
  function ToggleableCaret(props) {
20792
- const iconStyle = props.isExpanded ? styles$K.expanded : styles$K.collapsed;
20792
+ const iconStyle = props.isExpanded ? styles$Q.expanded : styles$Q.collapsed;
20793
20793
  return /*#__PURE__*/React__namespace.createElement(wonderBlocksIcon.PhosphorIcon, {
20794
20794
  icon: caretRight__default["default"],
20795
20795
  style: iconStyle
20796
20796
  });
20797
20797
  }
20798
- const styles$K = aphrodite.StyleSheet.create({
20798
+ const styles$Q = aphrodite.StyleSheet.create({
20799
20799
  collapsed: {
20800
20800
  transition: ".15s"
20801
20801
  },
@@ -20825,16 +20825,16 @@ class TexErrorView extends React__namespace.Component {
20825
20825
  showErrors
20826
20826
  } = this.state;
20827
20827
  return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
20828
- style: styles$J.errorContainer
20828
+ style: styles$P.errorContainer
20829
20829
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
20830
- style: styles$J.title,
20830
+ style: styles$P.title,
20831
20831
  onClick: this.handleToggleTexErrors
20832
20832
  }, /*#__PURE__*/React__namespace.createElement(ToggleableCaret, {
20833
20833
  isExpanded: showErrors
20834
20834
  }), "\xA0 TeX Errors (", errorList.length, ")"), showErrors && /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
20835
- style: styles$J.errorExplanation
20835
+ style: styles$P.errorExplanation
20836
20836
  }, "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, {
20837
- style: styles$J.error,
20837
+ style: styles$P.error,
20838
20838
  key: index
20839
20839
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
20840
20840
  style: {
@@ -20843,7 +20843,7 @@ class TexErrorView extends React__namespace.Component {
20843
20843
  }, e.math), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, null, e.message))));
20844
20844
  }
20845
20845
  }
20846
- const styles$J = aphrodite.StyleSheet.create({
20846
+ const styles$P = aphrodite.StyleSheet.create({
20847
20847
  title: {
20848
20848
  backgroundColor: "#eee",
20849
20849
  fontSize: "1.25em",
@@ -23656,12 +23656,10 @@ class CombinedHintsEditor extends React__namespace.Component {
23656
23656
  };
23657
23657
  handleHintChange = (i, newProps, cb, silent) => {
23658
23658
  // TODO(joel) - lens
23659
- const hints = ___default["default"](this.props.hints).clone();
23659
+ const hints = [...this.props.hints];
23660
23660
  hints[i] = ___default["default"].extend({}, this.serializeHint(i, {
23661
23661
  keepDeletedWidgets: true
23662
23662
  }), newProps);
23663
-
23664
- // @ts-expect-error - TS2740 - Type 'Hint' is missing the following properties from type 'readonly Hint[]': length, concat, join, slice, and 18 more.
23665
23663
  this.props.onChange({
23666
23664
  hints: hints
23667
23665
  }, cb, silent);
@@ -23671,21 +23669,16 @@ class CombinedHintsEditor extends React__namespace.Component {
23671
23669
  if (!confirm("Are you sure you want to delete this hint?")) {
23672
23670
  return;
23673
23671
  }
23674
- const hints = ___default["default"](this.props.hints).clone();
23675
- // @ts-expect-error - TS2339 - Property 'splice' does not exist on type 'Hint'.
23672
+ const hints = [...this.props.hints];
23676
23673
  hints.splice(i, 1);
23677
- // @ts-expect-error - TS2322 - Type 'Hint' is not assignable to type 'readonly Hint[]'.
23678
23674
  this.props.onChange({
23679
23675
  hints: hints
23680
23676
  });
23681
23677
  };
23682
23678
  handleHintMove = (i, dir) => {
23683
- const hints = ___default["default"](this.props.hints).clone();
23684
- // @ts-expect-error - TS2339 - Property 'splice' does not exist on type 'Hint'.
23679
+ const hints = [...this.props.hints];
23685
23680
  const hint = hints.splice(i, 1)[0];
23686
- // @ts-expect-error - TS2339 - Property 'splice' does not exist on type 'Hint'.
23687
23681
  hints.splice(i + dir, 0, hint);
23688
- // @ts-expect-error - TS2322 - Type 'Hint' is not assignable to type 'readonly Hint[]'.
23689
23682
  this.props.onChange({
23690
23683
  hints: hints
23691
23684
  }, () => {
@@ -23695,10 +23688,10 @@ class CombinedHintsEditor extends React__namespace.Component {
23695
23688
  });
23696
23689
  };
23697
23690
  addHint = () => {
23698
- const hints = ___default["default"](this.props.hints).clone()
23699
- // @ts-expect-error - TS2339 - Property 'concat' does not exist on type 'Hint'.
23700
- .concat([{
23701
- content: ""
23691
+ const hints = this.props.hints.concat([{
23692
+ content: "",
23693
+ images: {},
23694
+ widgets: {}
23702
23695
  }]);
23703
23696
  this.props.onChange({
23704
23697
  hints: hints
@@ -23821,65 +23814,65 @@ class ItemExtrasEditor extends React__namespace.Component {
23821
23814
  }, /*#__PURE__*/React__namespace.createElement("div", {
23822
23815
  className: "perseus-answer-options"
23823
23816
  }, /*#__PURE__*/React__namespace.createElement(ItemExtraCheckbox, {
23824
- label: "Show calculator:",
23817
+ label: "Show calculator",
23825
23818
  infoTip: "Use the calculator when completing difficult calculations is NOT the intent of the question. DON\u2019T use the calculator when testing the student\u2019s ability to complete different types of computations.",
23826
23819
  checked: this.props.calculator,
23827
- onChange: e => {
23820
+ onChange: newCheckedState => {
23828
23821
  this.props.onChange({
23829
- calculator: e.target.checked
23822
+ calculator: newCheckedState
23830
23823
  });
23831
23824
  }
23832
23825
  }), /*#__PURE__*/React__namespace.createElement(ItemExtraCheckbox, {
23833
- label: "Show financial calculator:",
23826
+ label: "Show financial calculator",
23834
23827
  infoTip: "This provides the student with the ability to view a financial calculator, e.g., for answering financial questions. Once checked, requires at least one of the three options below to be checked.",
23835
23828
  checked: this.shouldShowFinancialCalculatorOptions(),
23836
- onChange: e => {
23829
+ onChange: newCheckedState => {
23837
23830
  // If the financial calculator is unchecked,
23838
23831
  // these need to be reset. All checked by
23839
23832
  // default.
23840
23833
  this.props.onChange({
23841
- financialCalculatorMonthlyPayment: e.target.checked,
23842
- financialCalculatorTotalAmount: e.target.checked,
23843
- financialCalculatorTimeToPayOff: e.target.checked
23834
+ financialCalculatorMonthlyPayment: newCheckedState,
23835
+ financialCalculatorTotalAmount: newCheckedState,
23836
+ financialCalculatorTimeToPayOff: newCheckedState
23844
23837
  });
23845
23838
  }
23846
23839
  }), this.shouldShowFinancialCalculatorOptions() && /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(ItemExtraCheckbox, {
23847
- label: "Include monthly payment:",
23840
+ label: "Include monthly payment",
23848
23841
  infoTip: "This provides the student with the ability to view a monthly payment calculator; e.g., given a loan amount, interest rate, and term, what is the monthly payment?",
23849
23842
  checked: this.props.financialCalculatorMonthlyPayment,
23850
- onChange: e => {
23843
+ onChange: newCheckedState => {
23851
23844
  this.props.onChange({
23852
- financialCalculatorMonthlyPayment: e.target.checked
23845
+ financialCalculatorMonthlyPayment: newCheckedState
23853
23846
  });
23854
23847
  },
23855
23848
  indent: true
23856
23849
  }), /*#__PURE__*/React__namespace.createElement(ItemExtraCheckbox, {
23857
- label: "Include total amount:",
23850
+ label: "Include total amount",
23858
23851
  infoTip: "This provides the student with the ability to view a total amount calculator; e.g., given a monthly payment, interest rate, and term, what is the total amount to be paid?",
23859
23852
  checked: this.props.financialCalculatorTotalAmount,
23860
- onChange: e => {
23853
+ onChange: newCheckedState => {
23861
23854
  this.props.onChange({
23862
- financialCalculatorTotalAmount: e.target.checked
23855
+ financialCalculatorTotalAmount: newCheckedState
23863
23856
  });
23864
23857
  },
23865
23858
  indent: true
23866
23859
  }), /*#__PURE__*/React__namespace.createElement(ItemExtraCheckbox, {
23867
- label: "Include time-to-pay-off:",
23860
+ label: "Include time-to-pay-off",
23868
23861
  infoTip: "This provides the student with the ability to view a time to pay off calculator; e.g., given a loan amount, interest rate, and monthly payment, how long will it take to pay off the loan?",
23869
23862
  checked: this.props.financialCalculatorTimeToPayOff,
23870
- onChange: e => {
23863
+ onChange: newCheckedState => {
23871
23864
  this.props.onChange({
23872
- financialCalculatorTimeToPayOff: e.target.checked
23865
+ financialCalculatorTimeToPayOff: newCheckedState
23873
23866
  });
23874
23867
  },
23875
23868
  indent: true
23876
23869
  })), /*#__PURE__*/React__namespace.createElement(ItemExtraCheckbox, {
23877
- label: "Show periodic table:",
23870
+ label: "Show periodic table",
23878
23871
  infoTip: "This provides the student with the ability to view a periodic table of the elements, e.g., for answering chemistry questions.",
23879
23872
  checked: this.props.periodicTable,
23880
- onChange: e => {
23873
+ onChange: newCheckedState => {
23881
23874
  this.props.onChange({
23882
- periodicTable: e.target.checked,
23875
+ periodicTable: newCheckedState,
23883
23876
  // If the periodic table is unchecked,
23884
23877
  // this needs to be reset. If table is
23885
23878
  // checked, it should already be false.
@@ -23887,54 +23880,61 @@ class ItemExtrasEditor extends React__namespace.Component {
23887
23880
  });
23888
23881
  }
23889
23882
  }), this.props.periodicTable && /*#__PURE__*/React__namespace.createElement(ItemExtraCheckbox, {
23890
- label: "Include key/legend with periodic table:",
23883
+ label: "Include key/legend with periodic table",
23891
23884
  infoTip: "Include a key for HS courses; omit for AP chemistry.",
23892
23885
  checked: this.props.periodicTableWithKey,
23893
- onChange: e => {
23886
+ onChange: newCheckedState => {
23894
23887
  this.props.onChange({
23895
- periodicTableWithKey: e.target.checked
23888
+ periodicTableWithKey: newCheckedState
23896
23889
  });
23897
23890
  },
23898
23891
  indent: true
23899
23892
  }), /*#__PURE__*/React__namespace.createElement(ItemExtraCheckbox, {
23900
- label: "Show z table (statistics):",
23893
+ label: "Show z table (statistics)",
23901
23894
  infoTip: "This provides the student with the ability to view a table of critical values for the z distribution, e.g. for answering statistics questions.",
23902
23895
  checked: this.props.zTable,
23903
- onChange: e => {
23896
+ onChange: newCheckedState => {
23904
23897
  this.props.onChange({
23905
- zTable: e.target.checked
23898
+ zTable: newCheckedState
23906
23899
  });
23907
23900
  }
23908
23901
  }), /*#__PURE__*/React__namespace.createElement(ItemExtraCheckbox, {
23909
- label: "Show t table (statistics):",
23902
+ label: "Show t table (statistics)",
23910
23903
  infoTip: "This provides the student with the ability to view a table of critical values for the Student's t distribution, e.g. for answering statistics questions.",
23911
23904
  checked: this.props.tTable,
23912
- onChange: e => {
23905
+ onChange: newCheckedState => {
23913
23906
  this.props.onChange({
23914
- tTable: e.target.checked
23907
+ tTable: newCheckedState
23915
23908
  });
23916
23909
  }
23917
23910
  }), /*#__PURE__*/React__namespace.createElement(ItemExtraCheckbox, {
23918
- label: "Show chi-squared table (statistics):",
23911
+ label: "Show chi-squared table (statistics)",
23919
23912
  infoTip: "This provides the student with the ability to view a table of critical values for the chi-squared distribution, e.g. for answering statistics questions.",
23920
23913
  checked: this.props.chi2Table,
23921
- onChange: e => {
23914
+ onChange: newCheckedState => {
23922
23915
  this.props.onChange({
23923
- chi2Table: e.target.checked
23916
+ chi2Table: newCheckedState
23924
23917
  });
23925
23918
  }
23926
23919
  })));
23927
23920
  }
23928
23921
  }
23929
- const ItemExtraCheckbox = props => /*#__PURE__*/React__namespace.createElement("div", {
23930
- style: {
23931
- marginLeft: props.indent ? "10px" : "0px"
23932
- }
23933
- }, /*#__PURE__*/React__namespace.createElement("label", null, props.label, /*#__PURE__*/React__namespace.createElement("input", {
23934
- type: "checkbox",
23922
+ const ItemExtraCheckbox = props => /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
23923
+ style: [styles$O.checkbox, props.indent ? styles$O.indented : undefined]
23924
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
23925
+ label: /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
23926
+ style: {
23927
+ flexDirection: "row"
23928
+ }
23929
+ }, props.label, " ", /*#__PURE__*/React__namespace.createElement(InfoTip$l, null, props.infoTip)),
23935
23930
  checked: props.checked,
23936
- onChange: props.onChange
23937
- })), /*#__PURE__*/React__namespace.createElement(InfoTip$l, null, props.infoTip));
23931
+ onChange: newCheckedState => props.onChange(newCheckedState)
23932
+ }));
23933
+ const styles$O = aphrodite.StyleSheet.create({
23934
+ indented: {
23935
+ marginInlineStart: wonderBlocksTokens.spacing.large_24
23936
+ }
23937
+ });
23938
23938
 
23939
23939
  const ITEM_DATA_VERSION = perseus.itemDataVersion;
23940
23940
  class ItemEditor extends React__namespace.Component {
@@ -24593,12 +24593,12 @@ class SimpleButton extends React__namespace.Component {
24593
24593
  ...otherProps
24594
24594
  } = this.props;
24595
24595
  return /*#__PURE__*/React__namespace.createElement("div", _extends({
24596
- className: aphrodite.css(styles$I.baseButton, color === "green" && styles$I.green, color === "orange" && styles$I.orange),
24596
+ className: aphrodite.css(styles$N.baseButton, color === "green" && styles$N.green, color === "orange" && styles$N.orange),
24597
24597
  onClick: onClick
24598
24598
  }, otherProps), children);
24599
24599
  }
24600
24600
  }
24601
- const styles$I = aphrodite.StyleSheet.create({
24601
+ const styles$N = aphrodite.StyleSheet.create({
24602
24602
  baseButton: {
24603
24603
  top: "0",
24604
24604
  fontSize: "11px",
@@ -24811,23 +24811,23 @@ const LeafContainer = _ref2 => {
24811
24811
  } = _ref2;
24812
24812
  const hasPreviewHeading = shape.type === "content" || shape.type === "hint";
24813
24813
  const previewHeading = hasPreviewHeading && /*#__PURE__*/React__namespace.createElement("div", {
24814
- className: aphrodite.css(styles$H.containerHeader)
24814
+ className: aphrodite.css(styles$M.containerHeader)
24815
24815
  }, /*#__PURE__*/React__namespace.createElement(Header, {
24816
24816
  depth: path.length,
24817
- className: aphrodite.css(styles$H.containerTitle)
24817
+ className: aphrodite.css(styles$M.containerTitle)
24818
24818
  }, capitalize(name)));
24819
24819
  return /*#__PURE__*/React__namespace.createElement("div", {
24820
- className: aphrodite.css(styles$H.container)
24820
+ className: aphrodite.css(styles$M.container)
24821
24821
  }, /*#__PURE__*/React__namespace.createElement("span", {
24822
- className: aphrodite.css(styles$H.row, styles$H.rowHeading)
24822
+ className: aphrodite.css(styles$M.row, styles$M.rowHeading)
24823
24823
  }, /*#__PURE__*/React__namespace.createElement("div", {
24824
- className: aphrodite.css(styles$H.columnLeft)
24824
+ className: aphrodite.css(styles$M.columnLeft)
24825
24825
  }, /*#__PURE__*/React__namespace.createElement("div", {
24826
- className: "pod-title " + aphrodite.css(styles$H.containerHeader)
24826
+ className: "pod-title " + aphrodite.css(styles$M.containerHeader)
24827
24827
  }, /*#__PURE__*/React__namespace.createElement("div", {
24828
- className: aphrodite.css(styles$H.containerTitle)
24828
+ className: aphrodite.css(styles$M.containerTitle)
24829
24829
  }, capitalize(name)), controls)), /*#__PURE__*/React__namespace.createElement("div", {
24830
- className: aphrodite.css(styles$H.columnRight)
24830
+ className: aphrodite.css(styles$M.columnRight)
24831
24831
  }, previewHeading)), children);
24832
24832
  };
24833
24833
  const ArrayContainer = props => {
@@ -24840,11 +24840,11 @@ const ArrayContainer = props => {
24840
24840
  actions
24841
24841
  } = props;
24842
24842
  return /*#__PURE__*/React__namespace.createElement("div", {
24843
- className: aphrodite.css(styles$H.container)
24843
+ className: aphrodite.css(styles$M.container)
24844
24844
  }, controls && /*#__PURE__*/React__namespace.createElement("div", {
24845
- className: aphrodite.css(styles$H.columnLeft, styles$H.containerHeader)
24845
+ className: aphrodite.css(styles$M.columnLeft, styles$M.containerHeader)
24846
24846
  }, controls), /*#__PURE__*/React__namespace.createElement("div", null, children), /*#__PURE__*/React__namespace.createElement("div", {
24847
- className: aphrodite.css(styles$H.columnLeft)
24847
+ className: aphrodite.css(styles$M.columnLeft)
24848
24848
  }, /*#__PURE__*/React__namespace.createElement("a", {
24849
24849
  href: "javascript:void 0",
24850
24850
  onClick: () => actions.addArrayElement(path, shape.elementShape)
@@ -24858,28 +24858,28 @@ const ObjectContainer = _ref3 => {
24858
24858
  path
24859
24859
  } = _ref3;
24860
24860
  const headingEditor = /*#__PURE__*/React__namespace.createElement("div", {
24861
- className: aphrodite.css(styles$H.containerHeader)
24861
+ className: aphrodite.css(styles$M.containerHeader)
24862
24862
  }, /*#__PURE__*/React__namespace.createElement(Header, {
24863
24863
  depth: path.length,
24864
- className: aphrodite.css(styles$H.containerTitle)
24864
+ className: aphrodite.css(styles$M.containerTitle)
24865
24865
  }, capitalize(name)), controls);
24866
24866
  const headingPreview = (name || controls) && /*#__PURE__*/React__namespace.createElement("div", {
24867
- className: aphrodite.css(styles$H.containerHeader, styles$H.previewCollectionHeader)
24867
+ className: aphrodite.css(styles$M.containerHeader, styles$M.previewCollectionHeader)
24868
24868
  }, /*#__PURE__*/React__namespace.createElement(Header, {
24869
24869
  depth: path.length,
24870
- className: aphrodite.css(styles$H.containerTitle)
24870
+ className: aphrodite.css(styles$M.containerTitle)
24871
24871
  }, capitalize(name)));
24872
24872
  const hasBothHeadings = headingEditor && headingPreview;
24873
24873
  return /*#__PURE__*/React__namespace.createElement("div", {
24874
- className: aphrodite.css(styles$H.container)
24874
+ className: aphrodite.css(styles$M.container)
24875
24875
  }, hasBothHeadings && /*#__PURE__*/React__namespace.createElement("span", {
24876
- className: aphrodite.css(styles$H.row)
24876
+ className: aphrodite.css(styles$M.row)
24877
24877
  }, /*#__PURE__*/React__namespace.createElement("div", {
24878
- className: aphrodite.css(styles$H.columnLeft)
24878
+ className: aphrodite.css(styles$M.columnLeft)
24879
24879
  }, headingEditor), /*#__PURE__*/React__namespace.createElement("div", {
24880
- className: aphrodite.css(styles$H.columnRight)
24880
+ className: aphrodite.css(styles$M.columnRight)
24881
24881
  }, headingPreview)), /*#__PURE__*/React__namespace.createElement("div", {
24882
- className: aphrodite.css(path.length > 0 && styles$H.contentIndent)
24882
+ className: aphrodite.css(path.length > 0 && styles$M.contentIndent)
24883
24883
  }, children));
24884
24884
  };
24885
24885
 
@@ -24999,11 +24999,11 @@ const ItemNodeContent = withStickiness(props => {
24999
24999
  className: "framework-perseus"
25000
25000
  }, lens(renderers).get(path));
25001
25001
  return /*#__PURE__*/React__namespace.createElement("span", null, /*#__PURE__*/React__namespace.createElement("div", {
25002
- className: aphrodite.css(styles$H.row)
25002
+ className: aphrodite.css(styles$M.row)
25003
25003
  }, /*#__PURE__*/React__namespace.createElement("div", {
25004
- className: aphrodite.css(styles$H.columnLeft)
25004
+ className: aphrodite.css(styles$M.columnLeft)
25005
25005
  }, /*#__PURE__*/React__namespace.createElement("div", {
25006
- className: aphrodite.css(sticky && styles$H.sticky)
25006
+ className: aphrodite.css(sticky && styles$M.sticky)
25007
25007
  },
25008
25008
  /*#__PURE__*/
25009
25009
  // @ts-expect-error - TS2769 - No overload matches this call.
@@ -25011,9 +25011,9 @@ const ItemNodeContent = withStickiness(props => {
25011
25011
  onChange: newVal => actions.mergeValueAtPath(path, newVal),
25012
25012
  apiOptions: apiOptions
25013
25013
  })))), /*#__PURE__*/React__namespace.createElement("div", {
25014
- className: aphrodite.css(styles$H.columnRight)
25014
+ className: aphrodite.css(styles$M.columnRight)
25015
25015
  }, /*#__PURE__*/React__namespace.createElement("div", {
25016
- className: aphrodite.css(sticky && styles$H.sticky)
25016
+ className: aphrodite.css(sticky && styles$M.sticky)
25017
25017
  }, preview))));
25018
25018
  });
25019
25019
  const HintNodeContent = withStickiness(props => {
@@ -25029,13 +25029,13 @@ const HintNodeContent = withStickiness(props => {
25029
25029
  className: "framework-perseus"
25030
25030
  }, lens(renderers).get(path));
25031
25031
  return /*#__PURE__*/React__namespace.createElement("div", {
25032
- className: aphrodite.css(styles$H.row)
25032
+ className: aphrodite.css(styles$M.row)
25033
25033
  }, /*#__PURE__*/React__namespace.createElement("div", {
25034
- className: aphrodite.css(styles$H.columnLeft)
25034
+ className: aphrodite.css(styles$M.columnLeft)
25035
25035
  }, /*#__PURE__*/React__namespace.createElement("div", {
25036
- className: aphrodite.css(sticky && styles$H.sticky)
25036
+ className: aphrodite.css(sticky && styles$M.sticky)
25037
25037
  }, /*#__PURE__*/React__namespace.createElement(HintEditor, _extends({}, data, {
25038
- className: aphrodite.css(styles$H.hintEditor),
25038
+ className: aphrodite.css(styles$M.hintEditor),
25039
25039
  onChange: newVal => actions.mergeValueAtPath(path, newVal),
25040
25040
  apiOptions: apiOptions,
25041
25041
  showTitle: false,
@@ -25050,9 +25050,9 @@ const HintNodeContent = withStickiness(props => {
25050
25050
  isFirst: true,
25051
25051
  isLast: true
25052
25052
  })))), /*#__PURE__*/React__namespace.createElement("div", {
25053
- className: aphrodite.css(styles$H.columnRight)
25053
+ className: aphrodite.css(styles$M.columnRight)
25054
25054
  }, /*#__PURE__*/React__namespace.createElement("div", {
25055
- className: aphrodite.css(sticky && styles$H.sticky)
25055
+ className: aphrodite.css(sticky && styles$M.sticky)
25056
25056
  }, preview)));
25057
25057
  });
25058
25058
  const TagsNodeContent = props => {
@@ -25069,9 +25069,9 @@ const TagsNodeContent = props => {
25069
25069
  return null;
25070
25070
  }
25071
25071
  return /*#__PURE__*/React__namespace.createElement("div", {
25072
- className: aphrodite.css(styles$H.columnLeft)
25072
+ className: aphrodite.css(styles$M.columnLeft)
25073
25073
  }, /*#__PURE__*/React__namespace.createElement("div", {
25074
- className: aphrodite.css(styles$H.tagsEditor)
25074
+ className: aphrodite.css(styles$M.tagsEditor)
25075
25075
  }, /*#__PURE__*/React__namespace.createElement(GroupMetadataEditor, {
25076
25076
  value: data,
25077
25077
  onChange: newVal => actions.setValueAtPath(path, newVal),
@@ -25102,23 +25102,23 @@ const ArrayNodeContent = props => {
25102
25102
  const subpath = path.concat(i);
25103
25103
  const controls = [i > 0 && /*#__PURE__*/React__namespace.createElement("div", {
25104
25104
  key: "moveArrayElementUp",
25105
- className: aphrodite.css(styles$H.control)
25105
+ className: aphrodite.css(styles$M.control)
25106
25106
  }, /*#__PURE__*/React__namespace.createElement(SimpleButton, {
25107
25107
  color: "orange",
25108
25108
  title: "Move up",
25109
25109
  onClick: () => actions.moveArrayElementUp(subpath)
25110
25110
  }, /*#__PURE__*/React__namespace.createElement("div", {
25111
- className: aphrodite.css(styles$H.verticalFlip)
25111
+ className: aphrodite.css(styles$M.verticalFlip)
25112
25112
  }, /*#__PURE__*/React__namespace.createElement(InlineIcon$5, iconChevronDown)))), i < data.length - 1 && /*#__PURE__*/React__namespace.createElement("div", {
25113
25113
  key: "moveArrayElementDown",
25114
- className: aphrodite.css(styles$H.control)
25114
+ className: aphrodite.css(styles$M.control)
25115
25115
  }, /*#__PURE__*/React__namespace.createElement(SimpleButton, {
25116
25116
  color: "orange",
25117
25117
  title: "Move down",
25118
25118
  onClick: () => actions.moveArrayElementDown(subpath)
25119
25119
  }, /*#__PURE__*/React__namespace.createElement(InlineIcon$5, iconChevronDown))), /*#__PURE__*/React__namespace.createElement("div", {
25120
25120
  key: "removeArrayElement",
25121
- className: aphrodite.css(styles$H.control)
25121
+ className: aphrodite.css(styles$M.control)
25122
25122
  }, /*#__PURE__*/React__namespace.createElement(SimpleButton, {
25123
25123
  color: "orange",
25124
25124
  title: "Delete",
@@ -25126,7 +25126,7 @@ const ArrayNodeContent = props => {
25126
25126
  }, /*#__PURE__*/React__namespace.createElement(InlineIcon$5, iconTrash$4)))];
25127
25127
  return /*#__PURE__*/React__namespace.createElement("div", {
25128
25128
  key: i,
25129
- className: aphrodite.css(styles$H.arrayElement, !elementIsLeaf && styles$H.arrayElementAndNotLeaf)
25129
+ className: aphrodite.css(styles$M.arrayElement, !elementIsLeaf && styles$M.arrayElementAndNotLeaf)
25130
25130
  }, /*#__PURE__*/React__namespace.createElement(NodeContainer, _extends({}, otherProps, {
25131
25131
  key: i,
25132
25132
  shape: shape.elementShape,
@@ -25152,7 +25152,7 @@ const ObjectNodeContent = props => {
25152
25152
  // made sense to the shape's author is the order in which we'll iterate :)
25153
25153
  const children = Object.keys(shape.shape).map(subkey => /*#__PURE__*/React__namespace.createElement("div", {
25154
25154
  key: subkey,
25155
- className: aphrodite.css(styles$H.objectElement)
25155
+ className: aphrodite.css(styles$M.objectElement)
25156
25156
  }, /*#__PURE__*/React__namespace.createElement(NodeContainer, _extends({}, otherProps, {
25157
25157
  shape: shape.shape[subkey],
25158
25158
  data: data[subkey],
@@ -25322,7 +25322,7 @@ class MultiRendererEditor extends React__namespace.Component {
25322
25322
  }, this._renderContent());
25323
25323
  }
25324
25324
  }
25325
- const styles$H = aphrodite.StyleSheet.create({
25325
+ const styles$M = aphrodite.StyleSheet.create({
25326
25326
  // This is used in a number of places throughout this file.
25327
25327
  container: {},
25328
25328
  // eslint-disable-next-line react-native/no-unused-styles
@@ -25486,7 +25486,6 @@ const StatefulEditorPage = createReactClass__default["default"]({
25486
25486
  });
25487
25487
 
25488
25488
  const {
25489
- PropCheckBox: PropCheckBox$c,
25490
25489
  TextListEditor: TextListEditor$4
25491
25490
  } = perseus.components;
25492
25491
  const Categorizer = perseus.Categorizer.widget;
@@ -25521,11 +25520,14 @@ class CategorizerEditor extends React__namespace.Component {
25521
25520
  render() {
25522
25521
  return /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("div", {
25523
25522
  className: "perseus-widget-row"
25524
- }, /*#__PURE__*/React__namespace.createElement(PropCheckBox$c, {
25523
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
25525
25524
  label: "Randomize item order",
25526
- labelAlignment: "right",
25527
- randomizeItems: this.props.randomizeItems,
25528
- onChange: this.props.onChange
25525
+ checked: this.props.randomizeItems,
25526
+ onChange: value => {
25527
+ this.props.onChange({
25528
+ randomizeItems: value
25529
+ });
25530
+ }
25529
25531
  })), "Categories:", /*#__PURE__*/React__namespace.createElement(TextListEditor$4, {
25530
25532
  options: this.props.categories,
25531
25533
  onChange: cat => {
@@ -25619,8 +25621,7 @@ class BlurInput extends React__namespace.Component {
25619
25621
 
25620
25622
  /* eslint-disable no-useless-escape */
25621
25623
  const {
25622
- InfoTip: InfoTip$k,
25623
- PropCheckBox: PropCheckBox$b
25624
+ InfoTip: InfoTip$k
25624
25625
  } = perseus.components;
25625
25626
  const DEFAULT_WIDTH = 400;
25626
25627
  const DEFAULT_HEIGHT = 400;
@@ -25803,14 +25804,22 @@ class CSProgramEditor extends React__namespace.Component {
25803
25804
  return /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("label", null, "Url or Program ID:", " ", /*#__PURE__*/React__namespace.createElement(BlurInput, {
25804
25805
  value: this.props.programID,
25805
25806
  onChange: this._handleProgramIDChange
25806
- })), /*#__PURE__*/React__namespace.createElement("br", null), /*#__PURE__*/React__namespace.createElement(PropCheckBox$b, {
25807
+ })), /*#__PURE__*/React__namespace.createElement("br", null), /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
25807
25808
  label: "Show Editor",
25808
- showEditor: this.props.showEditor,
25809
- onChange: this.props.onChange
25810
- }), /*#__PURE__*/React__namespace.createElement(InfoTip$k, null, "If you show the editor, you should use the \"full-width\" alignment to make room for the width of the editor."), /*#__PURE__*/React__namespace.createElement("br", null), /*#__PURE__*/React__namespace.createElement(PropCheckBox$b, {
25809
+ checked: this.props.showEditor,
25810
+ onChange: value => {
25811
+ this.props.onChange({
25812
+ showEditor: value
25813
+ });
25814
+ }
25815
+ }), /*#__PURE__*/React__namespace.createElement(InfoTip$k, null, "If you show the editor, you should use the \"full-width\" alignment to make room for the width of the editor."), /*#__PURE__*/React__namespace.createElement("br", null), /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
25811
25816
  label: "Show Buttons",
25812
- showButtons: this.props.showButtons,
25813
- onChange: this.props.onChange
25817
+ checked: this.props.showButtons,
25818
+ onChange: value => {
25819
+ this.props.onChange({
25820
+ showButtons: value
25821
+ });
25822
+ }
25814
25823
  }), /*#__PURE__*/React__namespace.createElement("br", null), /*#__PURE__*/React__namespace.createElement("label", null, "Settings:", /*#__PURE__*/React__namespace.createElement(PairsEditor$1, {
25815
25824
  name: "settings",
25816
25825
  pairs: this.props.settings,
@@ -25821,7 +25830,7 @@ class CSProgramEditor extends React__namespace.Component {
25821
25830
 
25822
25831
  /* eslint-disable @khanacademy/ts-no-error-suppressions */
25823
25832
  const {
25824
- TextInput: TextInput$9
25833
+ TextInput: TextInput$8
25825
25834
  } = perseus.components;
25826
25835
  class DefinitionEditor extends React__namespace.Component {
25827
25836
  static propTypes = {
@@ -25855,7 +25864,7 @@ class DefinitionEditor extends React__namespace.Component {
25855
25864
  target: "_blank"
25856
25865
  }, "Definition style guide"), /*#__PURE__*/React__namespace.createElement("div", {
25857
25866
  className: "perseus-widget-row"
25858
- }, /*#__PURE__*/React__namespace.createElement("label", null, "Word to be defined:", " ", /*#__PURE__*/React__namespace.createElement(TextInput$9, {
25867
+ }, /*#__PURE__*/React__namespace.createElement("label", null, "Word to be defined:", " ", /*#__PURE__*/React__namespace.createElement(TextInput$8, {
25859
25868
  value: this.props.togglePrompt
25860
25869
  // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
25861
25870
  ,
@@ -26265,7 +26274,7 @@ class ExampleWidgetEditor extends React__namespace.Component {
26265
26274
 
26266
26275
  /* eslint-disable @khanacademy/ts-no-error-suppressions */
26267
26276
  const {
26268
- TextInput: TextInput$8
26277
+ TextInput: TextInput$7
26269
26278
  } = perseus.components;
26270
26279
  const defaultExplanationProps = {
26271
26280
  showPrompt: "Explain",
@@ -26302,14 +26311,14 @@ class ExplanationEditor extends React__namespace.Component {
26302
26311
  className: "perseus-widget-explanation-editor"
26303
26312
  }, /*#__PURE__*/React__namespace.createElement("div", {
26304
26313
  className: "perseus-widget-row"
26305
- }, /*#__PURE__*/React__namespace.createElement("label", null, "Prompt to show explanation:", " ", /*#__PURE__*/React__namespace.createElement(TextInput$8, {
26314
+ }, /*#__PURE__*/React__namespace.createElement("label", null, "Prompt to show explanation:", " ", /*#__PURE__*/React__namespace.createElement(TextInput$7, {
26306
26315
  value: this.props.showPrompt
26307
26316
  // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
26308
26317
  ,
26309
26318
  onChange: this.change("showPrompt")
26310
26319
  }))), /*#__PURE__*/React__namespace.createElement("div", {
26311
26320
  className: "perseus-widget-row"
26312
- }, /*#__PURE__*/React__namespace.createElement("label", null, "Prompt to hide explanation:", " ", /*#__PURE__*/React__namespace.createElement(TextInput$8, {
26321
+ }, /*#__PURE__*/React__namespace.createElement("label", null, "Prompt to hide explanation:", " ", /*#__PURE__*/React__namespace.createElement(TextInput$7, {
26313
26322
  value: this.props.hidePrompt
26314
26323
  // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
26315
26324
  ,
@@ -26337,9 +26346,106 @@ class ExplanationEditor extends React__namespace.Component {
26337
26346
  }
26338
26347
  }
26339
26348
 
26349
+ const mediaDefaultSpecLargeMarginWidth = wonderBlocksTokens.spacing.large_24;
26350
+ const MEDIA_DEFAULT_SPEC = {
26351
+ small: {
26352
+ query: "(max-width: 767px)",
26353
+ totalColumns: 4,
26354
+ gutterWidth: wonderBlocksTokens.spacing.medium_16,
26355
+ marginWidth: wonderBlocksTokens.spacing.medium_16
26356
+ },
26357
+ medium: {
26358
+ query: "(min-width: 768px) and (max-width: 1023px)",
26359
+ totalColumns: 8,
26360
+ gutterWidth: wonderBlocksTokens.spacing.xLarge_32,
26361
+ marginWidth: wonderBlocksTokens.spacing.large_24
26362
+ },
26363
+ large: {
26364
+ query: "(min-width: 1024px)",
26365
+ totalColumns: 12,
26366
+ gutterWidth: wonderBlocksTokens.spacing.xLarge_32,
26367
+ marginWidth: mediaDefaultSpecLargeMarginWidth,
26368
+ maxWidth: 1120 + mediaDefaultSpecLargeMarginWidth * 2
26369
+ }
26370
+ };
26371
+ ({
26372
+ large: {
26373
+ query: "(min-width: 1px)",
26374
+ totalColumns: 12,
26375
+ gutterWidth: wonderBlocksTokens.spacing.xLarge_32,
26376
+ marginWidth: wonderBlocksTokens.spacing.medium_16
26377
+ }
26378
+ });
26379
+ ({
26380
+ small: {
26381
+ query: "(max-width: 767px)",
26382
+ totalColumns: 4,
26383
+ gutterWidth: wonderBlocksTokens.spacing.medium_16,
26384
+ marginWidth: wonderBlocksTokens.spacing.medium_16
26385
+ },
26386
+ large: {
26387
+ query: "(min-width: 768px)",
26388
+ totalColumns: 12,
26389
+ gutterWidth: wonderBlocksTokens.spacing.xLarge_32,
26390
+ marginWidth: wonderBlocksTokens.spacing.xxLarge_48
26391
+ }
26392
+ });
26393
+
26394
+ const defaultContext = {
26395
+ ssrSize: "large",
26396
+ mediaSpec: MEDIA_DEFAULT_SPEC
26397
+ };
26398
+ const MediaLayoutContext = React__namespace.createContext(defaultContext);
26399
+ MediaLayoutContext.displayName = "MediaLayoutContext";
26400
+
26401
+ class Spring extends React__namespace.Component {
26402
+ render() {
26403
+ const {
26404
+ style
26405
+ } = this.props;
26406
+ return React__namespace.createElement(wonderBlocksCore.View, {
26407
+ "aria-hidden": "true",
26408
+ style: [styles$L.grow, style]
26409
+ });
26410
+ }
26411
+ }
26412
+ const styles$L = aphrodite.StyleSheet.create({
26413
+ grow: {
26414
+ flexGrow: 1
26415
+ }
26416
+ });
26417
+
26418
+ class Strut extends React__namespace.Component {
26419
+ render() {
26420
+ const {
26421
+ size,
26422
+ style
26423
+ } = this.props;
26424
+ return React__namespace.createElement(wonderBlocksCore.View, {
26425
+ "aria-hidden": "true",
26426
+ style: [strutStyle(size), style]
26427
+ });
26428
+ }
26429
+ }
26430
+ const strutStyle = size => {
26431
+ return {
26432
+ width: size,
26433
+ MsFlexBasis: size,
26434
+ MsFlexPreferredSize: size,
26435
+ WebkitFlexBasis: size,
26436
+ flexBasis: size,
26437
+ flexShrink: 0
26438
+ };
26439
+ };
26440
+
26340
26441
  const PT = PropTypes__default["default"];
26341
26442
 
26342
- // Takes an array of components to sort
26443
+ /**
26444
+ * Takes an array of components to sort.
26445
+ * As of 08/05/24, there are two sortable components
26446
+ * (one in perseus and one in perseus-editor).
26447
+ * As far as I can tell, this one is only used in ExpressionEditor.
26448
+ */
26343
26449
  // eslint-disable-next-line react/no-unsafe
26344
26450
  const SortableArea = createReactClass__default["default"]({
26345
26451
  displayName: "SortableArea",
@@ -26496,6 +26602,7 @@ const SortableItem = createReactClass__default["default"]({
26496
26602
  e.preventDefault();
26497
26603
  },
26498
26604
  render: function () {
26605
+ // I think these might be getting styles from Webapp
26499
26606
  let dragState = "sortable-disabled";
26500
26607
  if (this.props.dragging) {
26501
26608
  dragState = "sortable-dragging";
@@ -26504,7 +26611,7 @@ const SortableItem = createReactClass__default["default"]({
26504
26611
  }
26505
26612
  return /*#__PURE__*/React__namespace.createElement("li", {
26506
26613
  draggable: this.props.draggable,
26507
- className: dragState,
26614
+ className: [dragState, aphrodite.css(styles$K.sortableListItem)].join(" "),
26508
26615
  onDragStart: this.handleDragStart,
26509
26616
  onDrop: this.handleDrop,
26510
26617
  onDragEnter: this.handleDragEnter,
@@ -26512,11 +26619,14 @@ const SortableItem = createReactClass__default["default"]({
26512
26619
  }, this.props.component);
26513
26620
  }
26514
26621
  });
26622
+ const styles$K = aphrodite.StyleSheet.create({
26623
+ sortableListItem: {
26624
+ margin: "5px 0"
26625
+ }
26626
+ });
26515
26627
 
26516
26628
  const {
26517
- InfoTip: InfoTip$i,
26518
- PropCheckBox: PropCheckBox$a,
26519
- TextInput: TextInput$7
26629
+ InfoTip: InfoTip$i
26520
26630
  } = perseus.components;
26521
26631
 
26522
26632
  // types for iterables
@@ -26563,6 +26673,12 @@ class ExpressionEditor extends React__namespace.Component {
26563
26673
  buttonSets: ["basic"],
26564
26674
  functions: ["f", "g", "h"]
26565
26675
  };
26676
+ constructor(props) {
26677
+ super(props);
26678
+ this.state = {
26679
+ functionsInternal: this.props.functions.join(" ")
26680
+ };
26681
+ }
26566
26682
  change() {
26567
26683
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
26568
26684
  args[_key] = arguments[_key];
@@ -26599,78 +26715,69 @@ class ExpressionEditor extends React__namespace.Component {
26599
26715
  }, obj)));
26600
26716
  const sortable = /*#__PURE__*/React__namespace.createElement(SortableArea, {
26601
26717
  components: answerOptions,
26602
- onReorder: this.handleReorder,
26603
- className: "answer-options-list"
26718
+ onReorder: this.handleReorder
26604
26719
  });
26605
26720
 
26606
26721
  // checkboxes to choose which sets of input buttons are shown
26607
26722
  const buttonSetChoices = buttonSetsList.map(name => {
26608
26723
  // The first one gets special cased to always be checked, disabled,
26609
26724
  // and float left.
26610
- const isFirst = name === "basic";
26611
- const checked = this.props.buttonSets.includes(name) || isFirst;
26612
- return /*#__PURE__*/React__namespace.createElement("label", {
26613
- className: "button-set-label",
26614
- key: name
26615
- }, /*#__PURE__*/React__namespace.createElement("input", {
26616
- type: "checkbox",
26725
+ const isBasic = name === "basic";
26726
+ const checked = this.props.buttonSets.includes(name) || isBasic;
26727
+ return /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
26728
+ key: name,
26729
+ label: name,
26617
26730
  checked: checked,
26618
- disabled: isFirst,
26731
+ disabled: isBasic,
26619
26732
  onChange: () => this.handleButtonSet(name)
26620
- }), name);
26733
+ });
26621
26734
  });
26622
- const {
26623
- TeX
26624
- } = perseus.Dependencies.getDependencies(); // OldExpression only
26625
-
26626
- buttonSetChoices.unshift( /*#__PURE__*/React__namespace.createElement("label", {
26627
- className: "button-set-label",
26628
- key: "show-div"
26629
- }, /*#__PURE__*/React__namespace.createElement("input", {
26630
- type: "checkbox",
26735
+ buttonSetChoices.unshift( /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
26736
+ key: "show \xF7 button",
26737
+ label: "show \xF7 button",
26738
+ checked: this.props.buttonSets.includes("basic+div"),
26631
26739
  onChange: this.handleToggleDiv
26632
- }), /*#__PURE__*/React__namespace.createElement("span", {
26633
- className: "show-div-button"
26634
- }, "show ", /*#__PURE__*/React__namespace.createElement(TeX, null, "\\div"), " button")));
26635
- return /*#__PURE__*/React__namespace.createElement("div", {
26636
- className: "perseus-widget-expression-editor"
26637
- }, /*#__PURE__*/React__namespace.createElement("h3", {
26638
- className: "expression-editor-h3"
26639
- }, "Global Options"), /*#__PURE__*/React__namespace.createElement("div", {
26640
- className: "perseus-widget-row"
26641
- }, /*#__PURE__*/React__namespace.createElement("label", null, "Visible label:", " ", /*#__PURE__*/React__namespace.createElement(TextInput$7, {
26642
- value: this.props.visibleLabel,
26740
+ }));
26741
+ return /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.HeadingSmall, null, "Global Options"), /*#__PURE__*/React__namespace.createElement("div", {
26742
+ className: aphrodite.css(styles$J.paddedY)
26743
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.LabeledTextField, {
26744
+ label: "Visible label",
26745
+ value: this.props.visibleLabel || "",
26643
26746
  onChange: this.change("visibleLabel")
26644
- })), /*#__PURE__*/React__namespace.createElement(InfoTip$i, null, /*#__PURE__*/React__namespace.createElement("p", null, "Optional visible text; strongly encouraged to help learners using dictation software, but can be omitted if the surrounding content provides enough context."))), /*#__PURE__*/React__namespace.createElement("div", {
26645
- className: "perseus-widget-row"
26646
- }, /*#__PURE__*/React__namespace.createElement("label", null, "Aria label:", " ", /*#__PURE__*/React__namespace.createElement(TextInput$7, {
26647
- value: this.props.ariaLabel,
26747
+ }), /*#__PURE__*/React__namespace.createElement(InfoTip$i, null, /*#__PURE__*/React__namespace.createElement("p", null, "Optional visible text; strongly encouraged to help learners using dictation software, but can be omitted if the surrounding content provides enough context."))), /*#__PURE__*/React__namespace.createElement("div", {
26748
+ className: aphrodite.css(styles$J.paddedY)
26749
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.LabeledTextField, {
26750
+ label: "Aria label",
26751
+ value: this.props.ariaLabel || "",
26648
26752
  onChange: this.change("ariaLabel")
26649
- })), /*#__PURE__*/React__namespace.createElement(InfoTip$i, null, /*#__PURE__*/React__namespace.createElement("p", null, "Label text that's read by screen readers. Highly recommend adding a label here to ensure your exercise is accessible. For more information on writting accessible labels, please see", " ", /*#__PURE__*/React__namespace.createElement("a", {
26753
+ }), /*#__PURE__*/React__namespace.createElement(InfoTip$i, null, /*#__PURE__*/React__namespace.createElement("p", null, "Label text that's read by screen readers. Highly recommend adding a label here to ensure your exercise is accessible. For more information on writting accessible labels, please see", " ", /*#__PURE__*/React__namespace.createElement("a", {
26650
26754
  href: "https://www.w3.org/WAI/tips/designing/#ensure-that-form-elements-include-clearly-associated-labels",
26651
26755
  target: "_blank"
26652
- }, "this article.")))), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement(PropCheckBox$a, {
26653
- times: this.props.times,
26654
- onChange: this.props.onChange,
26655
- labelAlignment: "right",
26656
- label: "Use \xD7 for rendering multiplication instead of a center dot."
26657
- }), /*#__PURE__*/React__namespace.createElement(InfoTip$i, null, /*#__PURE__*/React__namespace.createElement("p", null, "For pre-algebra problems this option displays multiplication as \\times instead of \\cdot in both the rendered output and the acceptable formats examples."))), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("label", null, "Function variables: ", /*#__PURE__*/React__namespace.createElement("input", {
26658
- type: "text",
26659
- defaultValue: this.props.functions.join(" "),
26756
+ }, "this article.")))), /*#__PURE__*/React__namespace.createElement("div", {
26757
+ className: aphrodite.css(styles$J.paddedY)
26758
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.LabeledTextField, {
26759
+ label: "Function variables",
26760
+ value: this.state.functionsInternal,
26660
26761
  onChange: this.handleFunctions
26661
- })), /*#__PURE__*/React__namespace.createElement(InfoTip$i, null, /*#__PURE__*/React__namespace.createElement("p", null, "Single-letter variables listed here will be interpreted as functions. This let us know that f(x) means \"f of x\" and not \"f times x\"."))), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("div", null, "Button sets:"), buttonSetChoices), /*#__PURE__*/React__namespace.createElement("h3", {
26662
- className: "expression-editor-h3"
26663
- }, "Answers"), /*#__PURE__*/React__namespace.createElement("p", {
26762
+ }), /*#__PURE__*/React__namespace.createElement(InfoTip$i, null, /*#__PURE__*/React__namespace.createElement("p", null, "Single-letter variables listed here will be interpreted as functions. This let us know that f(x) means \"f of x\" and not \"f times x\"."))), /*#__PURE__*/React__namespace.createElement("div", {
26763
+ className: aphrodite.css(styles$J.paddedY)
26764
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
26765
+ label: "Use \xD7 instead of \u22C5 for multiplication",
26766
+ checked: this.props.times,
26767
+ onChange: value => {
26768
+ this.props.onChange({
26769
+ times: value
26770
+ });
26771
+ }
26772
+ }), /*#__PURE__*/React__namespace.createElement(InfoTip$i, null, /*#__PURE__*/React__namespace.createElement("p", null, "For pre-algebra problems this option displays multiplication as \\times instead of \\cdot in both the rendered output and the acceptable formats examples."))), /*#__PURE__*/React__namespace.createElement("div", {
26773
+ className: aphrodite.css(styles$J.paddedY)
26774
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.HeadingXSmall, null, "Button Sets"), buttonSetChoices), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.HeadingSmall, null, "Answers"), /*#__PURE__*/React__namespace.createElement("p", {
26664
26775
  style: {
26665
26776
  margin: "4px 0"
26666
26777
  }
26667
- }, "student responses area matched against these from top to bottom"), sortable, /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("button", {
26668
- className: "simple-button orange",
26669
- style: {
26670
- fontSize: 13
26671
- },
26672
- onClick: this.newAnswer,
26673
- type: "button"
26778
+ }, "student responses area matched against these from top to bottom"), sortable, /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement(Button__default["default"], {
26779
+ size: "small",
26780
+ onClick: this.newAnswer
26674
26781
  }, "Add new answer")));
26675
26782
  }
26676
26783
  serialize = () => {
@@ -26805,9 +26912,12 @@ class ExpressionEditor extends React__namespace.Component {
26805
26912
  };
26806
26913
 
26807
26914
  // called when the function variables change
26808
- handleFunctions = e => {
26915
+ handleFunctions = value => {
26916
+ this.setState({
26917
+ functionsInternal: value
26918
+ });
26809
26919
  const newProps = {};
26810
- newProps.functions = e.target.value.split(/[ ,]+/).filter(wonderStuffCore.isTruthy);
26920
+ newProps.functions = value.split(/[ ,]+/).filter(wonderStuffCore.isTruthy);
26811
26921
  this.props.onChange(newProps);
26812
26922
  };
26813
26923
  }
@@ -26822,11 +26932,6 @@ class AnswerOption extends React__namespace.Component {
26822
26932
  state = {
26823
26933
  deleteFocused: false
26824
26934
  };
26825
- handleDeleteBlur = () => {
26826
- this.setState({
26827
- deleteFocused: false
26828
- });
26829
- };
26830
26935
  change = (() => {
26831
26936
  var _this = this;
26832
26937
  return function () {
@@ -26837,55 +26942,64 @@ class AnswerOption extends React__namespace.Component {
26837
26942
  };
26838
26943
  })();
26839
26944
  render() {
26840
- let removeButton = null;
26841
- if (this.state.deleteFocused) {
26842
- removeButton = /*#__PURE__*/React__namespace.createElement("button", {
26843
- type: "button",
26844
- className: "simple-button orange",
26845
- onClick: this.handleImSure,
26846
- onBlur: this.handleDeleteBlur
26847
- }, "I'm sure!");
26848
- } else {
26849
- removeButton = /*#__PURE__*/React__namespace.createElement("button", {
26850
- type: "button",
26851
- className: "simple-button orange",
26852
- onClick: this.handleDelete
26853
- }, "Delete");
26854
- }
26945
+ const removeButton = this.state.deleteFocused ? /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(Button__default["default"], {
26946
+ size: "small",
26947
+ onClick: this.handleImSure,
26948
+ color: "destructive"
26949
+ }, "I'm sure!"), /*#__PURE__*/React__namespace.createElement(Strut, {
26950
+ size: wonderBlocksTokens.spacing.small_12
26951
+ }), /*#__PURE__*/React__namespace.createElement(Button__default["default"], {
26952
+ size: "small",
26953
+ onClick: this.handleCancelDelete,
26954
+ light: true
26955
+ }, "Cancel")) : /*#__PURE__*/React__namespace.createElement(Button__default["default"], {
26956
+ size: "small",
26957
+ onClick: this.handleDelete,
26958
+ color: "destructive",
26959
+ light: true
26960
+ }, "Delete");
26961
+ const answerStatusCss = aphrodite.css(styles$J.answerStatus, this.props.considered === "wrong" && styles$J.answerStatusWrong, this.props.considered === "correct" && styles$J.answerStatusCorrect, this.props.considered === "ungraded" && styles$J.answerStatusUngraded);
26855
26962
  return /*#__PURE__*/React__namespace.createElement("div", {
26856
- className: "expression-answer-option"
26963
+ className: aphrodite.css(styles$J.answerOption)
26857
26964
  }, /*#__PURE__*/React__namespace.createElement("div", {
26858
- className: "answer-handle"
26965
+ className: aphrodite.css(styles$J.answerHandle)
26859
26966
  }), /*#__PURE__*/React__namespace.createElement("div", {
26860
- className: "answer-body"
26861
- }, /*#__PURE__*/React__namespace.createElement("div", {
26862
- className: "answer-considered"
26863
- }, /*#__PURE__*/React__namespace.createElement("div", {
26967
+ className: aphrodite.css(styles$J.answerBody)
26968
+ }, /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("button", {
26864
26969
  onClick: this.toggleConsidered,
26865
- className: "answer-status " + this.props.considered
26866
- }, this.props.considered), /*#__PURE__*/React__namespace.createElement("div", {
26867
- className: "answer-expression"
26868
- }, /*#__PURE__*/React__namespace.createElement(perseus.Expression, this.props.expressionProps))), /*#__PURE__*/React__namespace.createElement("div", {
26869
- className: "answer-option"
26870
- }, /*#__PURE__*/React__namespace.createElement(PropCheckBox$a, {
26871
- form: this.props.form,
26872
- onChange: this.props.onChange,
26873
- labelAlignment: "right",
26874
- label: "Answer expression must have the same form."
26970
+ className: answerStatusCss
26971
+ }, this.props.considered), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement(perseus.Expression, this.props.expressionProps))), /*#__PURE__*/React__namespace.createElement("div", {
26972
+ className: aphrodite.css(styles$J.paddedY, styles$J.paddedX)
26973
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
26974
+ label: "Answer expression must have the same form.",
26975
+ checked: this.props.form,
26976
+ onChange: value => {
26977
+ this.props.onChange({
26978
+ form: value
26979
+ });
26980
+ }
26875
26981
  }), /*#__PURE__*/React__namespace.createElement(InfoTip$i, null, /*#__PURE__*/React__namespace.createElement("p", null, "The student's answer must be in the same form. Commutativity and excess negative signs are ignored."))), /*#__PURE__*/React__namespace.createElement("div", {
26876
- className: "answer-option"
26877
- }, /*#__PURE__*/React__namespace.createElement(PropCheckBox$a, {
26878
- simplify: this.props.simplify,
26879
- onChange: this.props.onChange,
26880
- labelAlignment: "right",
26881
- label: "Answer expression must be fully expanded and simplified."
26982
+ className: aphrodite.css(styles$J.paddedY, styles$J.paddedX)
26983
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
26984
+ label: "Answer expression must be fully expanded and simplified.",
26985
+ checked: this.props.simplify,
26986
+ onChange: value => {
26987
+ this.props.onChange({
26988
+ simplify: value
26989
+ });
26990
+ }
26882
26991
  }), /*#__PURE__*/React__namespace.createElement(InfoTip$i, null, /*#__PURE__*/React__namespace.createElement("p", null, "The student's answer must be fully expanded and simplified. Answering this equation (x^2+2x+1) with this factored equation (x+1)^2 will render this response \"Your answer is not fully expanded and simplified.\""))), /*#__PURE__*/React__namespace.createElement("div", {
26883
- className: "remove-container"
26992
+ className: aphrodite.css(styles$J.buttonRow, styles$J.paddedY)
26884
26993
  }, removeButton)));
26885
26994
  }
26886
26995
  handleImSure = () => {
26887
26996
  this.props.onDelete();
26888
26997
  };
26998
+ handleCancelDelete = () => {
26999
+ this.setState({
27000
+ deleteFocused: false
27001
+ });
27002
+ };
26889
27003
  handleDelete = () => {
26890
27004
  this.setState({
26891
27005
  deleteFocused: true
@@ -26898,6 +27012,49 @@ class AnswerOption extends React__namespace.Component {
26898
27012
  });
26899
27013
  };
26900
27014
  }
27015
+ const styles$J = aphrodite.StyleSheet.create({
27016
+ paddedX: {
27017
+ paddingLeft: wonderBlocksTokens.spacing.xSmall_8,
27018
+ paddingRight: wonderBlocksTokens.spacing.xSmall_8
27019
+ },
27020
+ paddedY: {
27021
+ paddingTop: wonderBlocksTokens.spacing.xxSmall_6,
27022
+ paddingBottom: wonderBlocksTokens.spacing.xxSmall_6
27023
+ },
27024
+ answerOption: {
27025
+ border: "1px solid #ddd",
27026
+ borderRadius: "3px",
27027
+ display: "flex"
27028
+ },
27029
+ answerHandle: {
27030
+ // textured draggy handle
27031
+ background: "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAAIklEQVQoU2M4c+bMfxAGAgYYmwGrIIiDjrELjpo5aiZeMwF+yNnOs5KSvgAAAABJRU5ErkJggg==) no-repeat 50% 50%",
27032
+ borderRight: "1px solid #ddd",
27033
+ cursor: "move",
27034
+ width: "20px",
27035
+ minWidth: "20px"
27036
+ },
27037
+ answerStatus: {
27038
+ border: "none",
27039
+ userSelect: "none",
27040
+ width: "100px",
27041
+ paddingTop: wonderBlocksTokens.spacing.small_12,
27042
+ paddingBottom: wonderBlocksTokens.spacing.small_12
27043
+ },
27044
+ answerStatusWrong: {
27045
+ backgroundColor: wonderBlocksTokens.color.fadedRed16
27046
+ },
27047
+ answerStatusCorrect: {
27048
+ backgroundColor: wonderBlocksTokens.color.fadedGreen16
27049
+ },
27050
+ answerStatusUngraded: {
27051
+ backgroundColor: wonderBlocksTokens.color.fadedBlue16
27052
+ },
27053
+ answerBody: {},
27054
+ buttonRow: {
27055
+ display: "flex"
27056
+ }
27057
+ });
26901
27058
 
26902
27059
  /* eslint-disable @khanacademy/ts-no-error-suppressions */
26903
27060
  const {
@@ -26957,10 +27114,10 @@ class GradedGroupEditor extends React__namespace.Component {
26957
27114
  }, /*#__PURE__*/React__namespace.createElement("div", {
26958
27115
  className: "perseus-widget-row"
26959
27116
  }, /*#__PURE__*/React__namespace.createElement("label", {
26960
- className: aphrodite.css(styles$G.title)
27117
+ className: aphrodite.css(styles$I.title)
26961
27118
  }, "Title:", " ", /*#__PURE__*/React__namespace.createElement(TextInput$6, {
26962
27119
  value: this.props.title,
26963
- className: aphrodite.css(styles$G.input)
27120
+ className: aphrodite.css(styles$I.input)
26964
27121
  // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
26965
27122
  ,
26966
27123
  onChange: this.change("title")
@@ -26985,7 +27142,7 @@ class GradedGroupEditor extends React__namespace.Component {
26985
27142
  }, /*#__PURE__*/React__namespace.createElement(InlineIcon$3, iconPlus$1), " Add a hint"), this.props.hint && /*#__PURE__*/React__namespace.createElement("div", {
26986
27143
  className: "perseus-hint-editor"
26987
27144
  }, /*#__PURE__*/React__namespace.createElement("div", {
26988
- className: aphrodite.css(styles$G.hintsTitle)
27145
+ className: aphrodite.css(styles$I.hintsTitle)
26989
27146
  }, "Hint"), /*#__PURE__*/React__namespace.createElement(Editor, {
26990
27147
  ref: this.hintEditor,
26991
27148
  content: this.props.hint ? this.props.hint.content : "",
@@ -27017,7 +27174,7 @@ class GradedGroupEditor extends React__namespace.Component {
27017
27174
  };
27018
27175
  };
27019
27176
  }
27020
- const styles$G = aphrodite.StyleSheet.create({
27177
+ const styles$I = aphrodite.StyleSheet.create({
27021
27178
  title: {
27022
27179
  fontSize: 18,
27023
27180
  fontWeight: "bold"
@@ -27105,7 +27262,6 @@ const setArrayItem = (list, i, value) => [...list.slice(0, i), value, ...list.sl
27105
27262
  const {
27106
27263
  ButtonGroup: ButtonGroup$4,
27107
27264
  InfoTip: InfoTip$h,
27108
- PropCheckBox: PropCheckBox$9,
27109
27265
  RangeInput: RangeInput$6
27110
27266
  } = perseus.components;
27111
27267
  const defaultBackgroundImage$3 = {
@@ -27540,10 +27696,14 @@ const GraphSettings = createReactClass__default["default"]({
27540
27696
  onChange: this.change("markings")
27541
27697
  })), /*#__PURE__*/React__namespace.createElement("div", {
27542
27698
  className: "perseus-widget-left-col"
27543
- }, /*#__PURE__*/React__namespace.createElement(PropCheckBox$9, {
27699
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
27544
27700
  label: "Show tooltips",
27545
- showTooltips: this.props.showTooltips,
27546
- onChange: this.change
27701
+ checked: this.props.showTooltips,
27702
+ onChange: value => {
27703
+ this.change({
27704
+ showTooltips: value
27705
+ });
27706
+ }
27547
27707
  }))), ___default["default"].contains(this.props.editableSettings, "image") && /*#__PURE__*/React__namespace.createElement("div", {
27548
27708
  className: "image-settings"
27549
27709
  }, /*#__PURE__*/React__namespace.createElement("div", null, "Background image:"), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("label", {
@@ -27571,16 +27731,24 @@ const GraphSettings = createReactClass__default["default"]({
27571
27731
  className: "perseus-widget-row"
27572
27732
  }, /*#__PURE__*/React__namespace.createElement("div", {
27573
27733
  className: "perseus-widget-left-col"
27574
- }, /*#__PURE__*/React__namespace.createElement(PropCheckBox$9, {
27734
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
27575
27735
  label: "Show ruler",
27576
- showRuler: this.props.showRuler,
27577
- onChange: this.change
27736
+ checked: this.props.showRuler,
27737
+ onChange: value => {
27738
+ this.change({
27739
+ showRuler: value
27740
+ });
27741
+ }
27578
27742
  })), /*#__PURE__*/React__namespace.createElement("div", {
27579
27743
  className: "perseus-widget-right-col"
27580
- }, /*#__PURE__*/React__namespace.createElement(PropCheckBox$9, {
27744
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
27581
27745
  label: "Show protractor",
27582
- showProtractor: this.props.showProtractor,
27583
- onChange: this.change
27746
+ checked: this.props.showProtractor,
27747
+ onChange: value => {
27748
+ this.change({
27749
+ showProtractor: value
27750
+ });
27751
+ }
27584
27752
  }))), 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", {
27585
27753
  onChange: this.changeRulerLabel,
27586
27754
  value: this.props.rulerLabel
@@ -27788,9 +27956,6 @@ class GroupEditor extends React__namespace.Component {
27788
27956
  }
27789
27957
 
27790
27958
  /* eslint-disable @khanacademy/ts-no-error-suppressions */
27791
- const {
27792
- PropCheckBox: PropCheckBox$8
27793
- } = perseus.components;
27794
27959
  /**
27795
27960
  * This is used for editing a name/value pair.
27796
27961
  */
@@ -27929,14 +28094,22 @@ class IframeEditor extends React__namespace.Component {
27929
28094
  // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
27930
28095
  ,
27931
28096
  onChange: this.change("height")
27932
- })), /*#__PURE__*/React__namespace.createElement(PropCheckBox$8, {
28097
+ })), /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
27933
28098
  label: "Allow full screen",
27934
- allowFullScreen: this.props.allowFullScreen,
27935
- onChange: this.props.onChange
27936
- }), /*#__PURE__*/React__namespace.createElement("br", null), /*#__PURE__*/React__namespace.createElement(PropCheckBox$8, {
28099
+ checked: this.props.allowFullScreen,
28100
+ onChange: value => {
28101
+ this.props.onChange({
28102
+ allowFullScreen: value
28103
+ });
28104
+ }
28105
+ }), /*#__PURE__*/React__namespace.createElement("br", null), /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
27937
28106
  label: "Allow iframe content to redirect the page",
27938
- allowTopNavigation: this.props.allowTopNavigation,
27939
- onChange: this.props.onChange
28107
+ checked: this.props.allowTopNavigation,
28108
+ onChange: value => {
28109
+ this.props.onChange({
28110
+ allowTopNavigation: value
28111
+ });
28112
+ }
27940
28113
  }));
27941
28114
  }
27942
28115
  handleSettingsChange = settings => {
@@ -28388,13 +28561,13 @@ function MathquillInput(props) {
28388
28561
  }
28389
28562
  });
28390
28563
  return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
28391
- style: styles$F.outerWrapper
28564
+ style: styles$H.outerWrapper
28392
28565
  }, /*#__PURE__*/React__namespace.createElement("span", {
28393
28566
  ref: mathFieldWrapperRef,
28394
28567
  className: "perseus-math-input mq-editable-field mq-math-mode"
28395
28568
  }));
28396
28569
  }
28397
- const styles$F = aphrodite.StyleSheet.create({
28570
+ const styles$H = aphrodite.StyleSheet.create({
28398
28571
  outerWrapper: {
28399
28572
  display: "inline-block",
28400
28573
  borderStyle: "solid",
@@ -29464,16 +29637,16 @@ const LabeledRow = props => {
29464
29637
  style
29465
29638
  } = props;
29466
29639
  return /*#__PURE__*/React__namespace.createElement("label", {
29467
- className: aphrodite.css(styles$E.label)
29640
+ className: aphrodite.css(styles$G.label)
29468
29641
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
29469
- style: [styles$E.row, style]
29642
+ style: [styles$G.row, style]
29470
29643
  }, labelSide === "start" || /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelSmall, {
29471
- style: styles$E.spaceEnd
29644
+ style: styles$G.spaceEnd
29472
29645
  }, label), children, labelSide === "end" && /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelSmall, {
29473
- style: styles$E.spaceStart
29646
+ style: styles$G.spaceStart
29474
29647
  }, label)));
29475
29648
  };
29476
- const styles$E = aphrodite.StyleSheet.create({
29649
+ const styles$G = aphrodite.StyleSheet.create({
29477
29650
  label: {
29478
29651
  width: "fit-content"
29479
29652
  },
@@ -29491,98 +29664,6 @@ const styles$E = aphrodite.StyleSheet.create({
29491
29664
  }
29492
29665
  });
29493
29666
 
29494
- const mediaDefaultSpecLargeMarginWidth = wonderBlocksTokens.spacing.large_24;
29495
- const MEDIA_DEFAULT_SPEC = {
29496
- small: {
29497
- query: "(max-width: 767px)",
29498
- totalColumns: 4,
29499
- gutterWidth: wonderBlocksTokens.spacing.medium_16,
29500
- marginWidth: wonderBlocksTokens.spacing.medium_16
29501
- },
29502
- medium: {
29503
- query: "(min-width: 768px) and (max-width: 1023px)",
29504
- totalColumns: 8,
29505
- gutterWidth: wonderBlocksTokens.spacing.xLarge_32,
29506
- marginWidth: wonderBlocksTokens.spacing.large_24
29507
- },
29508
- large: {
29509
- query: "(min-width: 1024px)",
29510
- totalColumns: 12,
29511
- gutterWidth: wonderBlocksTokens.spacing.xLarge_32,
29512
- marginWidth: mediaDefaultSpecLargeMarginWidth,
29513
- maxWidth: 1120 + mediaDefaultSpecLargeMarginWidth * 2
29514
- }
29515
- };
29516
- ({
29517
- large: {
29518
- query: "(min-width: 1px)",
29519
- totalColumns: 12,
29520
- gutterWidth: wonderBlocksTokens.spacing.xLarge_32,
29521
- marginWidth: wonderBlocksTokens.spacing.medium_16
29522
- }
29523
- });
29524
- ({
29525
- small: {
29526
- query: "(max-width: 767px)",
29527
- totalColumns: 4,
29528
- gutterWidth: wonderBlocksTokens.spacing.medium_16,
29529
- marginWidth: wonderBlocksTokens.spacing.medium_16
29530
- },
29531
- large: {
29532
- query: "(min-width: 768px)",
29533
- totalColumns: 12,
29534
- gutterWidth: wonderBlocksTokens.spacing.xLarge_32,
29535
- marginWidth: wonderBlocksTokens.spacing.xxLarge_48
29536
- }
29537
- });
29538
-
29539
- const defaultContext = {
29540
- ssrSize: "large",
29541
- mediaSpec: MEDIA_DEFAULT_SPEC
29542
- };
29543
- const MediaLayoutContext = React__namespace.createContext(defaultContext);
29544
- MediaLayoutContext.displayName = "MediaLayoutContext";
29545
-
29546
- class Spring extends React__namespace.Component {
29547
- render() {
29548
- const {
29549
- style
29550
- } = this.props;
29551
- return React__namespace.createElement(wonderBlocksCore.View, {
29552
- "aria-hidden": "true",
29553
- style: [styles$D.grow, style]
29554
- });
29555
- }
29556
- }
29557
- const styles$D = aphrodite.StyleSheet.create({
29558
- grow: {
29559
- flexGrow: 1
29560
- }
29561
- });
29562
-
29563
- class Strut extends React__namespace.Component {
29564
- render() {
29565
- const {
29566
- size,
29567
- style
29568
- } = this.props;
29569
- return React__namespace.createElement(wonderBlocksCore.View, {
29570
- "aria-hidden": "true",
29571
- style: [strutStyle(size), style]
29572
- });
29573
- }
29574
- }
29575
- const strutStyle = size => {
29576
- return {
29577
- width: size,
29578
- MsFlexBasis: size,
29579
- MsFlexPreferredSize: size,
29580
- WebkitFlexBasis: size,
29581
- flexBasis: size,
29582
- flexShrink: 0
29583
- };
29584
- };
29585
-
29586
29667
  function Heading(_ref) {
29587
29668
  let {
29588
29669
  title,
@@ -29591,11 +29672,11 @@ function Heading(_ref) {
29591
29672
  onToggle
29592
29673
  } = _ref;
29593
29674
  return /*#__PURE__*/React__namespace.createElement(Clickable__default["default"], {
29594
- style: [styles$C.container, !isCollapsible && styles$C.notClickable],
29675
+ style: [styles$F.container, !isCollapsible && styles$F.notClickable],
29595
29676
  disabled: !isCollapsible,
29596
29677
  onClick: () => isCollapsible && onToggle?.(!isOpen)
29597
29678
  }, () => /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
29598
- style: styles$C.heading
29679
+ style: styles$F.heading
29599
29680
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, {
29600
29681
  style: {
29601
29682
  fontSize: 14,
@@ -29605,7 +29686,7 @@ function Heading(_ref) {
29605
29686
  isExpanded: isOpen
29606
29687
  })));
29607
29688
  }
29608
- const styles$C = aphrodite.StyleSheet.create({
29689
+ const styles$F = aphrodite.StyleSheet.create({
29609
29690
  container: {
29610
29691
  marginTop: wonderBlocksTokens.spacing.small_12,
29611
29692
  // NOTE(jeremy): This is the inverse of the @editorPadding CSS
@@ -29773,6 +29854,25 @@ function getDefaultGraphStartCoords(graph, range, step) {
29773
29854
  ...graph,
29774
29855
  startCoords: undefined
29775
29856
  }, range, step);
29857
+ case "point":
29858
+ return perseus.getPointCoords({
29859
+ ...graph,
29860
+ startCoords: undefined
29861
+ }, range, step);
29862
+ case "polygon":
29863
+ return perseus.getPolygonCoords({
29864
+ ...graph,
29865
+ startCoords: undefined
29866
+ }, range, step);
29867
+ case "angle":
29868
+ return perseus.getAngleCoords({
29869
+ graph: {
29870
+ ...graph,
29871
+ startCoords: undefined
29872
+ },
29873
+ range,
29874
+ step
29875
+ });
29776
29876
  default:
29777
29877
  return undefined;
29778
29878
  }
@@ -29804,6 +29904,35 @@ const getQuadraticEquation = startCoords => {
29804
29904
  const c = (p2[0] * p3[0] * (p2[0] - p3[0]) * p1[1] + p3[0] * p1[0] * (p3[0] - p1[0]) * p2[1] + p1[0] * p2[0] * (p1[0] - p2[0]) * p3[1]) / denom;
29805
29905
  return "y = " + a.toFixed(3) + "x^2 + " + b.toFixed(3) + "x + " + c.toFixed(3);
29806
29906
  };
29907
+ const shouldShowStartCoordsUI = (flags, graph) => {
29908
+ // TODO(LEMS-2228): Remove flags once this is fully released
29909
+ const startCoordsUiPhase1Types = ["linear", "linear-system", "ray", "segment", "circle"];
29910
+ const startCoordsUiPhase2Types = ["sinusoid", "quadratic"];
29911
+ const startCoordsPhase1 = flags?.mafs?.["start-coords-ui-phase-1"];
29912
+ const startCoordsPhase2 = flags?.mafs?.["start-coords-ui-phase-2"];
29913
+ const startCoordsPoint = flags?.mafs?.["start-coords-ui-point"];
29914
+ const startCoordsPolygon = flags?.mafs?.["start-coords-ui-polygon"];
29915
+ const startCoordsAngle = flags?.mafs?.["start-coords-ui-angle"];
29916
+ if (startCoordsPhase1 && startCoordsUiPhase1Types.includes(graph.type)) {
29917
+ return true;
29918
+ }
29919
+ if (startCoordsPhase2 && startCoordsUiPhase2Types.includes(graph.type)) {
29920
+ return true;
29921
+ }
29922
+ if (startCoordsAngle && graph.type === "angle") {
29923
+ return true;
29924
+ }
29925
+ if (startCoordsPoint && graph.type === "point" && graph.numPoints !== "unlimited") {
29926
+ return true;
29927
+ }
29928
+ if (startCoordsPolygon && graph.type === "polygon" && graph.numSides !== "unlimited" && (
29929
+ // Pre-initialized graph with undefined snapTo value
29930
+ // initializes to snapTo="grid"
29931
+ graph.snapTo === "grid" || graph.snapTo === undefined)) {
29932
+ return true;
29933
+ }
29934
+ return false;
29935
+ };
29807
29936
 
29808
29937
  /**
29809
29938
  * Dropdown for selecting a locked figure to add to an interactive graph.
@@ -29820,17 +29949,17 @@ const LockedFigureSelect = props => {
29820
29949
  const figureTypes = ["point", "line", "vector", "ellipse", "polygon"];
29821
29950
  const figureTypesCurrent = props.showM2bFeatures ? [...figureTypes, "function"] : figureTypes;
29822
29951
  return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
29823
- style: styles$B.container
29952
+ style: styles$E.container
29824
29953
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.ActionMenu, {
29825
29954
  menuText: "Add locked figure",
29826
- style: styles$B.addElementSelect
29955
+ style: styles$E.addElementSelect
29827
29956
  }, figureTypesCurrent.map(figureType => /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.ActionItem, {
29828
29957
  key: `${id}-${figureType}`,
29829
29958
  label: figureType,
29830
29959
  onClick: () => onChange(figureType)
29831
29960
  }))));
29832
29961
  };
29833
- const styles$B = aphrodite.StyleSheet.create({
29962
+ const styles$E = aphrodite.StyleSheet.create({
29834
29963
  container: {
29835
29964
  marginTop: wonderBlocksTokens.spacing.xSmall_8
29836
29965
  },
@@ -29840,6 +29969,45 @@ const styles$B = aphrodite.StyleSheet.create({
29840
29969
  }
29841
29970
  });
29842
29971
 
29972
+ /**
29973
+ * This is a custom text field of type="number" for use in Perseus Editors.
29974
+ *
29975
+ * This makes it so that the text field's input number updates on scroll
29976
+ * without scrolling the page.
29977
+ *
29978
+ * NOTE 1: Native HTML number inputs do not update the number value on scroll,
29979
+ * they only scroll the page. Inputs in React do NOT work this way (explanation
29980
+ * here: https://stackoverflow.com/a/68266494). By default, scrolling on a
29981
+ * focused number input in React causes BOTH the input value to change AND
29982
+ * the page to scroll. The behavior in this component is an improvement on
29983
+ * the React behavior, but it's the opposite of the native HTML behavior.
29984
+ *
29985
+ * NOTE 2: Firefox seems to have a custom override for this. Even with this
29986
+ * stopPropogation, Firefox matches the native HTML behavior.
29987
+ */
29988
+ const ScrolllessNumberTextField = props => {
29989
+ const inputRef = React__namespace.useRef(null);
29990
+ React__namespace.useEffect(() => {
29991
+ const ref = inputRef.current;
29992
+
29993
+ // stopPropogation makes it so that the page scroll event is not
29994
+ // triggered when the input is focused and the user scrolls.
29995
+ // The input value will still change on scroll.
29996
+ const ignoreScroll = e => {
29997
+ e.stopPropagation();
29998
+ };
29999
+ ref?.addEventListener("wheel", ignoreScroll);
30000
+ return () => {
30001
+ ref?.removeEventListener("wheel", ignoreScroll);
30002
+ };
30003
+ }, [inputRef]);
30004
+ return /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.TextField, _extends({
30005
+ type: "number"
30006
+ }, props, {
30007
+ ref: inputRef
30008
+ }));
30009
+ };
30010
+
29843
30011
  const AngleInput = props => {
29844
30012
  const {
29845
30013
  angle,
@@ -29861,19 +30029,18 @@ const AngleInput = props => {
29861
30029
  }
29862
30030
  return /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
29863
30031
  tag: "label",
29864
- style: styles$A.row
30032
+ style: styles$D.row
29865
30033
  }, "angle (degrees)", /*#__PURE__*/React__namespace.createElement(Strut, {
29866
30034
  size: wonderBlocksTokens.spacing.xxSmall_6
29867
- }), /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.TextField, {
29868
- type: "number",
30035
+ }), /*#__PURE__*/React__namespace.createElement(ScrolllessNumberTextField, {
29869
30036
  value: angleInput,
29870
30037
  onChange: handleAngleChange,
29871
- style: styles$A.textField
30038
+ style: styles$D.textField
29872
30039
  }), /*#__PURE__*/React__namespace.createElement(Strut, {
29873
30040
  size: wonderBlocksTokens.spacing.xxSmall_6
29874
30041
  }));
29875
30042
  };
29876
- const styles$A = aphrodite.StyleSheet.create({
30043
+ const styles$D = aphrodite.StyleSheet.create({
29877
30044
  row: {
29878
30045
  display: "flex",
29879
30046
  flexDirection: "row",
@@ -29922,32 +30089,30 @@ const CoordinatePairInput = props => {
29922
30089
  onChange(newCoords);
29923
30090
  }
29924
30091
  return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
29925
- style: [styles$z.row, style]
30092
+ style: [styles$C.row, style]
29926
30093
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
29927
30094
  tag: "label",
29928
- style: styles$z.row
30095
+ style: styles$C.row
29929
30096
  }, labels ? labels[0] : "x coord", /*#__PURE__*/React__namespace.createElement(Strut, {
29930
30097
  size: wonderBlocksTokens.spacing.xxSmall_6
29931
- }), /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.TextField, {
29932
- type: "number",
30098
+ }), /*#__PURE__*/React__namespace.createElement(ScrolllessNumberTextField, {
29933
30099
  value: coordState[0],
29934
30100
  onChange: newValue => handleCoordChange(newValue, 0),
29935
- style: [styles$z.textField, error ? styles$z.errorField : undefined]
30101
+ style: [styles$C.textField, error ? styles$C.errorField : undefined]
29936
30102
  })), /*#__PURE__*/React__namespace.createElement(Strut, {
29937
30103
  size: wonderBlocksTokens.spacing.medium_16
29938
30104
  }), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
29939
30105
  tag: "label",
29940
- style: styles$z.row
30106
+ style: styles$C.row
29941
30107
  }, labels ? labels[1] : "y coord", /*#__PURE__*/React__namespace.createElement(Strut, {
29942
30108
  size: wonderBlocksTokens.spacing.xxSmall_6
29943
- }), /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.TextField, {
29944
- type: "number",
30109
+ }), /*#__PURE__*/React__namespace.createElement(ScrolllessNumberTextField, {
29945
30110
  value: coordState[1],
29946
30111
  onChange: newValue => handleCoordChange(newValue, 1),
29947
- style: [styles$z.textField, error ? styles$z.errorField : undefined]
30112
+ style: [styles$C.textField, error ? styles$C.errorField : undefined]
29948
30113
  })));
29949
30114
  };
29950
- const styles$z = aphrodite.StyleSheet.create({
30115
+ const styles$C = aphrodite.StyleSheet.create({
29951
30116
  row: {
29952
30117
  display: "flex",
29953
30118
  flexDirection: "row",
@@ -29980,14 +30145,14 @@ const PerseusEditorAccordion = props => {
29980
30145
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksAccordion.AccordionSection, {
29981
30146
  expanded: expanded,
29982
30147
  onToggle: onToggle,
29983
- style: [styles$y.container, containerStyle],
29984
- headerStyle: styles$y.accordionHeader,
30148
+ style: [styles$B.container, containerStyle],
30149
+ headerStyle: styles$B.accordionHeader,
29985
30150
  header: header
29986
30151
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
29987
- style: [styles$y.accordionPanel, panelStyle]
30152
+ style: [styles$B.accordionPanel, panelStyle]
29988
30153
  }, children)));
29989
30154
  };
29990
- const styles$y = aphrodite.StyleSheet.create({
30155
+ const styles$B = aphrodite.StyleSheet.create({
29991
30156
  container: {
29992
30157
  backgroundColor: wonderBlocksTokens.color.fadedBlue8,
29993
30158
  marginTop: wonderBlocksTokens.spacing.xSmall_8
@@ -30018,13 +30183,13 @@ const ColorSwatch = props => {
30018
30183
  "aria-label":
30019
30184
  // Don't include an aria label for decorative circles.
30020
30185
  !decorative ? `${color}, ${filled ? "filled" : "open"}` : undefined,
30021
- style: [styles$x.colorSwatch, {
30186
+ style: [styles$A.colorSwatch, {
30022
30187
  border: `4px solid ${perseus.lockedFigureColors[color]}`,
30023
30188
  backgroundColor: filled ? perseus.lockedFigureColors[color] : wonderBlocksTokens.color.white
30024
30189
  }]
30025
30190
  });
30026
30191
  };
30027
- const styles$x = aphrodite.StyleSheet.create({
30192
+ const styles$A = aphrodite.StyleSheet.create({
30028
30193
  colorSwatch: {
30029
30194
  // Add a white outline so that the color swatch is visible when
30030
30195
  // the dropdown option is highlighted with its blue background.
@@ -30043,10 +30208,10 @@ const ColorSelect = props => {
30043
30208
  onChange
30044
30209
  } = props;
30045
30210
  return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30046
- style: [styles$w.row, style]
30211
+ style: [styles$z.row, style]
30047
30212
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
30048
30213
  tag: "label",
30049
- style: styles$w.row
30214
+ style: styles$z.row
30050
30215
  }, "color", /*#__PURE__*/React__namespace.createElement(Strut, {
30051
30216
  size: wonderBlocksTokens.spacing.xxSmall_6
30052
30217
  }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
@@ -30065,11 +30230,14 @@ const ColorSelect = props => {
30065
30230
  })
30066
30231
  })))));
30067
30232
  };
30068
- const styles$w = aphrodite.StyleSheet.create({
30233
+ const styles$z = aphrodite.StyleSheet.create({
30069
30234
  row: {
30070
30235
  display: "flex",
30071
30236
  flexDirection: "row",
30072
- alignItems: "center"
30237
+ alignItems: "center",
30238
+ // Set minWidth to "auto" to prevent the component from bleeding
30239
+ // into the margins. (minWidth is 0 by default.)
30240
+ minWidth: "auto"
30073
30241
  }
30074
30242
  });
30075
30243
 
@@ -30081,17 +30249,17 @@ const EllipseSwatch = props => {
30081
30249
  } = props;
30082
30250
  return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30083
30251
  "aria-label": `${color}, stroke ${strokeStyle}, fill ${fillStyle}`,
30084
- style: [styles$v.container, {
30252
+ style: [styles$y.container, {
30085
30253
  border: `4px ${strokeStyle} ${perseus.lockedFigureColors[color]}`
30086
30254
  }]
30087
30255
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30088
- style: [styles$v.innerCircle, {
30256
+ style: [styles$y.innerCircle, {
30089
30257
  backgroundColor: perseus.lockedFigureColors[color],
30090
- opacity: perseus.lockedFigureFillStyles[fillStyle]
30258
+ opacity: fillStyle === "white" ? 0 : perseus.lockedFigureFillStyles[fillStyle]
30091
30259
  }]
30092
30260
  }));
30093
30261
  };
30094
- const styles$v = aphrodite.StyleSheet.create({
30262
+ const styles$y = aphrodite.StyleSheet.create({
30095
30263
  container: {
30096
30264
  // Add a white outline so that the color swatch is visible when
30097
30265
  // the dropdown option is highlighted with its blue background.
@@ -30110,6 +30278,40 @@ const styles$v = aphrodite.StyleSheet.create({
30110
30278
  }
30111
30279
  });
30112
30280
 
30281
+ const LineStrokeSelect = props => {
30282
+ const {
30283
+ selectedValue,
30284
+ onChange
30285
+ } = props;
30286
+ return /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
30287
+ tag: "label",
30288
+ style: styles$x.lineStrokeSelect
30289
+ }, "stroke", /*#__PURE__*/React__namespace.createElement(Strut, {
30290
+ size: wonderBlocksTokens.spacing.xxxSmall_4
30291
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
30292
+ selectedValue: selectedValue,
30293
+ onChange: onChange
30294
+ // Placeholder is required, but never gets used.
30295
+ ,
30296
+ placeholder: ""
30297
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
30298
+ value: "solid",
30299
+ label: "solid"
30300
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
30301
+ value: "dashed",
30302
+ label: "dashed"
30303
+ })));
30304
+ };
30305
+ const styles$x = aphrodite.StyleSheet.create({
30306
+ lineStrokeSelect: {
30307
+ display: "flex",
30308
+ flexDirection: "row",
30309
+ alignItems: "center",
30310
+ // Allow truncation, stop bleeding over the edge.
30311
+ minWidth: 0
30312
+ }
30313
+ });
30314
+
30113
30315
  /**
30114
30316
  * The part of a locked figure settings panel that contains actions
30115
30317
  * for this panel and its associated locked figure, including
@@ -30122,40 +30324,40 @@ const LockedFigureSettingsActions = props => {
30122
30324
  onRemove
30123
30325
  } = props;
30124
30326
  return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30125
- style: styles$u.container
30327
+ style: styles$w.container
30126
30328
  }, /*#__PURE__*/React__namespace.createElement(Button__default["default"], {
30127
30329
  startIcon: trashIcon__default["default"],
30128
30330
  "aria-label": `Delete locked ${figureType}`,
30129
30331
  onClick: onRemove,
30130
30332
  kind: "tertiary",
30131
- style: styles$u.deleteButton
30333
+ style: styles$w.deleteButton
30132
30334
  }, "Delete"), /*#__PURE__*/React__namespace.createElement(Spring, null), /*#__PURE__*/React__namespace.createElement(IconButton__default["default"], {
30133
30335
  icon: caretDoubleUpIcon__default["default"],
30134
30336
  size: "small",
30135
30337
  "aria-label": `Move locked ${figureType} to the back`,
30136
30338
  onClick: () => onMove("back"),
30137
- style: styles$u.iconButton
30339
+ style: styles$w.iconButton
30138
30340
  }), /*#__PURE__*/React__namespace.createElement(IconButton__default["default"], {
30139
30341
  icon: caretUpIcon__default["default"],
30140
30342
  size: "small",
30141
30343
  "aria-label": `Move locked ${figureType} backward`,
30142
30344
  onClick: () => onMove("backward"),
30143
- style: styles$u.iconButton
30345
+ style: styles$w.iconButton
30144
30346
  }), /*#__PURE__*/React__namespace.createElement(IconButton__default["default"], {
30145
30347
  icon: caretDownIcon__default["default"],
30146
30348
  size: "small",
30147
30349
  "aria-label": `Move locked ${figureType} forward`,
30148
30350
  onClick: () => onMove("forward"),
30149
- style: styles$u.iconButton
30351
+ style: styles$w.iconButton
30150
30352
  }), /*#__PURE__*/React__namespace.createElement(IconButton__default["default"], {
30151
30353
  icon: caretDoubleDownIcon__default["default"],
30152
30354
  size: "small",
30153
30355
  "aria-label": `Move locked ${figureType} to the front`,
30154
30356
  onClick: () => onMove("front"),
30155
- style: styles$u.iconButton
30357
+ style: styles$w.iconButton
30156
30358
  }));
30157
30359
  };
30158
- const styles$u = aphrodite.StyleSheet.create({
30360
+ const styles$w = aphrodite.StyleSheet.create({
30159
30361
  container: {
30160
30362
  width: "100%",
30161
30363
  flexDirection: "row",
@@ -30202,7 +30404,7 @@ const LockedEllipseSettings = props => {
30202
30404
  /*#__PURE__*/
30203
30405
  // Summary: Ellipse, center, radius, color (opacity, dashed)
30204
30406
  React__namespace.createElement(wonderBlocksCore.View, {
30205
- style: styles$t.row
30407
+ style: styles$v.row
30206
30408
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, `Ellipse (${center[0]}, ${center[1]}), radius ${radius[0]}, ${radius[1]}`), /*#__PURE__*/React__namespace.createElement(Strut, {
30207
30409
  size: wonderBlocksTokens.spacing.xSmall_8
30208
30410
  }), /*#__PURE__*/React__namespace.createElement(EllipseSwatch, {
@@ -30211,19 +30413,19 @@ const LockedEllipseSettings = props => {
30211
30413
  strokeStyle: strokeStyle
30212
30414
  }))
30213
30415
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30214
- style: styles$t.row
30416
+ style: styles$v.row
30215
30417
  }, /*#__PURE__*/React__namespace.createElement(CoordinatePairInput, {
30216
30418
  coord: center,
30217
- style: styles$t.spaceUnder,
30419
+ style: styles$v.spaceUnder,
30218
30420
  onChange: newCoords => onChangeProps({
30219
30421
  center: newCoords
30220
30422
  })
30221
30423
  }), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30222
- style: styles$t.spaceUnder
30424
+ style: styles$v.spaceUnder
30223
30425
  }, /*#__PURE__*/React__namespace.createElement(InfoTip$d, null, "The coordinates for the center of the ellipse."))), /*#__PURE__*/React__namespace.createElement(CoordinatePairInput, {
30224
30426
  coord: radius,
30225
30427
  labels: ["x radius", "y radius"],
30226
- style: styles$t.spaceUnder,
30428
+ style: styles$v.spaceUnder,
30227
30429
  onChange: newCoords => onChangeProps({
30228
30430
  radius: newCoords
30229
30431
  })
@@ -30235,7 +30437,7 @@ const LockedEllipseSettings = props => {
30235
30437
  }), /*#__PURE__*/React__namespace.createElement(Strut, {
30236
30438
  size: wonderBlocksTokens.spacing.xSmall_8
30237
30439
  }), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30238
- style: [styles$t.row, styles$t.spaceUnder]
30440
+ style: [styles$v.row, styles$v.spaceUnder]
30239
30441
  }, /*#__PURE__*/React__namespace.createElement(ColorSelect, {
30240
30442
  selectedValue: color,
30241
30443
  onChange: handleColorChange
@@ -30243,7 +30445,7 @@ const LockedEllipseSettings = props => {
30243
30445
  size: wonderBlocksTokens.spacing.medium_16
30244
30446
  }), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
30245
30447
  tag: "label",
30246
- style: styles$t.row
30448
+ style: [styles$v.row, styles$v.truncatedWidth]
30247
30449
  }, "fill", /*#__PURE__*/React__namespace.createElement(Strut, {
30248
30450
  size: wonderBlocksTokens.spacing.xxSmall_6
30249
30451
  }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
@@ -30258,25 +30460,200 @@ const LockedEllipseSettings = props => {
30258
30460
  key: option,
30259
30461
  value: option,
30260
30462
  label: option
30261
- }))))), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
30262
- tag: "label",
30263
- style: styles$t.row
30264
- }, "stroke", /*#__PURE__*/React__namespace.createElement(Strut, {
30265
- size: wonderBlocksTokens.spacing.xxSmall_6
30266
- }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
30463
+ }))))), /*#__PURE__*/React__namespace.createElement(LineStrokeSelect, {
30267
30464
  selectedValue: strokeStyle,
30268
30465
  onChange: value => onChangeProps({
30269
30466
  strokeStyle: value
30270
30467
  })
30468
+ }), /*#__PURE__*/React__namespace.createElement(LockedFigureSettingsActions, {
30469
+ figureType: props.type,
30470
+ onMove: onMove,
30471
+ onRemove: onRemove
30472
+ }));
30473
+ };
30474
+ const styles$v = aphrodite.StyleSheet.create({
30475
+ row: {
30476
+ display: "flex",
30477
+ flexDirection: "row",
30478
+ alignItems: "center"
30479
+ },
30480
+ spaceUnder: {
30481
+ marginBottom: wonderBlocksTokens.spacing.xSmall_8
30482
+ },
30483
+ truncatedWidth: {
30484
+ // Allow truncation, stop bleeding over the edge.
30485
+ minWidth: 0
30486
+ }
30487
+ });
30488
+
30489
+ const LineSwatch = props => {
30490
+ const {
30491
+ color,
30492
+ lineStyle
30493
+ } = props;
30494
+ return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30495
+ style: styles$u.container
30496
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30497
+ "aria-label": `${color}, ${lineStyle}`,
30498
+ style: [styles$u.lineSwatch, {
30499
+ border: `5px ${lineStyle} ${perseus.lockedFigureColors[color]}`
30500
+ }]
30501
+ }));
30502
+ };
30503
+ const styles$u = aphrodite.StyleSheet.create({
30504
+ container: {
30505
+ backgroundColor: wonderBlocksTokens.color.white,
30506
+ justifyContent: "center",
30507
+ padding: wonderBlocksTokens.spacing.xSmall_8,
30508
+ borderRadius: wonderBlocksTokens.spacing.xxxSmall_4
30509
+ },
30510
+ lineSwatch: {
30511
+ width: 40
30512
+ }
30513
+ });
30514
+
30515
+ /**
30516
+ * LockedFunctionSettings is a component that allows the user to edit the
30517
+ * settings of specifically a locked function on the graph.
30518
+ *
30519
+ * Used in the interactive graph editor's locked figures section.
30520
+ */
30521
+ const LockedFunctionSettings = props => {
30522
+ const {
30523
+ color: lineColor,
30524
+ strokeStyle,
30525
+ equation,
30526
+ directionalAxis,
30527
+ domain,
30528
+ onChangeProps,
30529
+ onMove,
30530
+ onRemove
30531
+ } = props;
30532
+ const equationPrefix = directionalAxis === "x" ? "y=" : "x=";
30533
+ const lineLabel = `Function (${equationPrefix}${equation})`;
30534
+
30535
+ // Tracking the string value of domain constraints to handle interim state of
30536
+ // entering a negative value, as well as representing Infinity as an empty string.
30537
+ // This variable is used when specifying the values of the input fields.
30538
+ const [domainEntries, setDomainEntries] = React.useState([domain && domain[0] !== -Infinity ? domain[0].toString() : "", domain && domain[1] !== Infinity ? domain[1].toString() : ""]);
30539
+ React.useEffect(() => {
30540
+ // "useEffect" used to maintain parity between domain constraints and their string representation.
30541
+ setDomainEntries([domain && domain[0] !== -Infinity ? domain[0].toString() : "", domain && domain[1] !== Infinity ? domain[1].toString() : ""]);
30542
+ }, [domain]);
30543
+
30544
+ // Generic function for handling property changes (except for 'domain')
30545
+ function handlePropChange(property, newValue) {
30546
+ const updatedProps = {};
30547
+ updatedProps[property] = newValue;
30548
+ onChangeProps(updatedProps);
30549
+ }
30550
+
30551
+ /*
30552
+ Reason for having a separate 'propChange' function for 'domain':
30553
+ Domain entries are optional. Their default value is +/- Infinity.
30554
+ Since input fields that are empty evaluate to zero, there needs to be
30555
+ dedicated code to convert empty to Infinity.
30556
+ */
30557
+ function handleDomainChange(limitIndex, newValueString) {
30558
+ const newDomainEntries = [...domainEntries];
30559
+ newDomainEntries[limitIndex] = newValueString;
30560
+ setDomainEntries(newDomainEntries);
30561
+ const newDomain = domain ? [...domain] : [-Infinity, Infinity];
30562
+ let newValue = parseFloat(newValueString);
30563
+ if (newValueString === "" && limitIndex === 0) {
30564
+ newValue = -Infinity;
30565
+ } else if (newValueString === "" && limitIndex === 1) {
30566
+ newValue = Infinity;
30567
+ }
30568
+ newDomain[limitIndex] = newValue;
30569
+ onChangeProps({
30570
+ domain: newDomain
30571
+ });
30572
+ }
30573
+ return /*#__PURE__*/React__namespace.createElement(PerseusEditorAccordion, {
30574
+ expanded: props.expanded,
30575
+ onToggle: props.onToggle,
30576
+ header: /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30577
+ style: styles$t.row
30578
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, {
30579
+ style: styles$t.accordionHeader
30580
+ }, lineLabel), /*#__PURE__*/React__namespace.createElement(Strut, {
30581
+ size: wonderBlocksTokens.spacing.xSmall_8
30582
+ }), /*#__PURE__*/React__namespace.createElement(LineSwatch, {
30583
+ color: lineColor,
30584
+ lineStyle: strokeStyle
30585
+ }))
30586
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30587
+ style: [styles$t.row, styles$t.spaceUnder]
30588
+ }, /*#__PURE__*/React__namespace.createElement(ColorSelect, {
30589
+ selectedValue: lineColor,
30590
+ onChange: newValue => {
30591
+ handlePropChange("color", newValue);
30592
+ }
30593
+ }), /*#__PURE__*/React__namespace.createElement(Strut, {
30594
+ size: wonderBlocksTokens.spacing.small_12
30595
+ }), /*#__PURE__*/React__namespace.createElement(LineStrokeSelect, {
30596
+ selectedValue: strokeStyle,
30597
+ onChange: newValue => {
30598
+ handlePropChange("strokeStyle", newValue);
30599
+ }
30600
+ })), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30601
+ style: [styles$t.row, styles$t.rowSpace]
30602
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
30603
+ selectedValue: directionalAxis,
30604
+ onChange: newValue => {
30605
+ handlePropChange("directionalAxis", newValue);
30606
+ },
30607
+ "aria-label": "equation prefix",
30608
+ style: styles$t.equationPrefix
30271
30609
  // Placeholder is required, but never gets used.
30272
30610
  ,
30273
30611
  placeholder: ""
30274
30612
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
30275
- value: "solid",
30276
- label: "solid"
30613
+ value: "x",
30614
+ label: "y ="
30277
30615
  }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
30278
- value: "dashed",
30279
- label: "dashed"
30616
+ value: "y",
30617
+ label: "x ="
30618
+ })), /*#__PURE__*/React__namespace.createElement(Strut, {
30619
+ size: wonderBlocksTokens.spacing.xSmall_8
30620
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.TextField, {
30621
+ type: "text",
30622
+ "aria-label": "equation",
30623
+ value: equation,
30624
+ onChange: newValue => {
30625
+ handlePropChange("equation", newValue);
30626
+ },
30627
+ style: [styles$t.textField]
30628
+ })), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30629
+ style: [styles$t.row, styles$t.rowSpace]
30630
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
30631
+ tag: "label",
30632
+ style: styles$t.domainMin
30633
+ }, "domain min", /*#__PURE__*/React__namespace.createElement(Strut, {
30634
+ size: wonderBlocksTokens.spacing.xxSmall_6
30635
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.TextField, {
30636
+ type: "number",
30637
+ style: styles$t.domainMinField,
30638
+ value: domainEntries[0],
30639
+ onChange: newValue => {
30640
+ handleDomainChange(0, newValue);
30641
+ }
30642
+ })), /*#__PURE__*/React__namespace.createElement(Strut, {
30643
+ size: wonderBlocksTokens.spacing.medium_16
30644
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
30645
+ tag: "label",
30646
+ "aria-label": "domain max",
30647
+ style: styles$t.domainMax
30648
+ }, "max", /*#__PURE__*/React__namespace.createElement(Strut, {
30649
+ size: wonderBlocksTokens.spacing.xxSmall_6
30650
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.TextField, {
30651
+ type: "number",
30652
+ style: styles$t.domainMaxField,
30653
+ value: domainEntries[1],
30654
+ onChange: newValue => {
30655
+ handleDomainChange(1, newValue);
30656
+ }
30280
30657
  }))), /*#__PURE__*/React__namespace.createElement(LockedFigureSettingsActions, {
30281
30658
  figureType: props.type,
30282
30659
  onMove: onMove,
@@ -30284,13 +30661,57 @@ const LockedEllipseSettings = props => {
30284
30661
  }));
30285
30662
  };
30286
30663
  const styles$t = aphrodite.StyleSheet.create({
30664
+ accordionHeader: {
30665
+ textOverflow: "ellipsis",
30666
+ // A maximum width needs to be specified in order for the ellipsis to work.
30667
+ // The 64px in the calculation accounts for the line swatch (56px) and the preceding strut (8px).
30668
+ // Margin and padding won't work here because they would create space between the header text and the swatch.
30669
+ maxWidth: "calc(100% - 64px)",
30670
+ overflow: "hidden",
30671
+ whiteSpace: "nowrap"
30672
+ },
30673
+ equationPrefix: {
30674
+ minWidth: "auto"
30675
+ },
30676
+ domainMin: {
30677
+ alignItems: "center",
30678
+ display: "flex",
30679
+ // The 'width' property is applied to the label, which wraps the text and the input field.
30680
+ // The width of the input fields (min/max) should be the same (to have a consistent look),
30681
+ // so the following calculation distributes the space accordingly.
30682
+ // For the "domain min" block, the text is 82.7px, and the strut is 6px (88.7px total).
30683
+ // The "domain max" block is 30.23px, and the strut is 6px (36.23px total).
30684
+ // The calculation takes the remain space after the text & struts (141px total) are removed,
30685
+ // and divides it between the two input fields equally.
30686
+ // The calculation reads: "Take 1/2 of the non-text space, and add the required space for this label's text"
30687
+ width: "calc(((100% - 141px) / 2) + 88.7px)",
30688
+ // @ts-expect-error // TS2353: textWrap does not exist in type CSSProperties
30689
+ textWrap: "nowrap"
30690
+ },
30691
+ domainMinField: {
30692
+ width: "calc(100% - 88.7px)" // make room for the label
30693
+ },
30694
+
30695
+ domainMax: {
30696
+ alignItems: "center",
30697
+ display: "flex",
30698
+ // See explanation for "domainMin" for the calculation below.
30699
+ width: "calc(((100% - 141px) / 2) + 36.2px)"
30700
+ },
30701
+ domainMaxField: {
30702
+ width: "calc(100% - 36.2px)" // make room for the label
30703
+ },
30704
+
30705
+ rowSpace: {
30706
+ marginTop: wonderBlocksTokens.spacing.xSmall_8
30707
+ },
30287
30708
  row: {
30288
30709
  display: "flex",
30289
30710
  flexDirection: "row",
30290
30711
  alignItems: "center"
30291
30712
  },
30292
- spaceUnder: {
30293
- marginBottom: wonderBlocksTokens.spacing.xSmall_8
30713
+ textField: {
30714
+ flexGrow: "1"
30294
30715
  }
30295
30716
  });
30296
30717
 
@@ -30412,32 +30833,6 @@ const styles$r = aphrodite.StyleSheet.create({
30412
30833
  }
30413
30834
  });
30414
30835
 
30415
- const LineSwatch = props => {
30416
- const {
30417
- color,
30418
- lineStyle
30419
- } = props;
30420
- return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30421
- style: styles$q.container
30422
- }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30423
- "aria-label": `${color}, ${lineStyle}`,
30424
- style: [styles$q.lineSwatch, {
30425
- border: `5px ${lineStyle} ${perseus.lockedFigureColors[color]}`
30426
- }]
30427
- }));
30428
- };
30429
- const styles$q = aphrodite.StyleSheet.create({
30430
- container: {
30431
- backgroundColor: wonderBlocksTokens.color.white,
30432
- justifyContent: "center",
30433
- padding: wonderBlocksTokens.spacing.xSmall_8,
30434
- borderRadius: wonderBlocksTokens.spacing.xxxSmall_4
30435
- },
30436
- lineSwatch: {
30437
- width: 40
30438
- }
30439
- });
30440
-
30441
30836
  const lengthZeroStr = "The line cannot have length 0.";
30442
30837
  const LockedLineSettings = props => {
30443
30838
  const {
@@ -30485,7 +30880,7 @@ const LockedLineSettings = props => {
30485
30880
  expanded: props.expanded,
30486
30881
  onToggle: props.onToggle,
30487
30882
  header: /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30488
- style: styles$p.row
30883
+ style: styles$q.row
30489
30884
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, lineLabel), /*#__PURE__*/React__namespace.createElement(Strut, {
30490
30885
  size: wonderBlocksTokens.spacing.xSmall_8
30491
30886
  }), /*#__PURE__*/React__namespace.createElement(LineSwatch, {
@@ -30494,7 +30889,7 @@ const LockedLineSettings = props => {
30494
30889
  }))
30495
30890
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
30496
30891
  tag: "label",
30497
- style: [styles$p.row, styles$p.spaceUnder]
30892
+ style: [styles$q.row, styles$q.spaceUnder]
30498
30893
  }, "kind", /*#__PURE__*/React__namespace.createElement(Strut, {
30499
30894
  size: wonderBlocksTokens.spacing.xxxSmall_4
30500
30895
  }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
@@ -30515,34 +30910,19 @@ const LockedLineSettings = props => {
30515
30910
  value: "segment",
30516
30911
  label: "segment"
30517
30912
  }))), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30518
- style: styles$p.row
30913
+ style: styles$q.row
30519
30914
  }, /*#__PURE__*/React__namespace.createElement(ColorSelect, {
30520
30915
  selectedValue: lineColor,
30521
30916
  onChange: handleColorChange
30522
30917
  }), /*#__PURE__*/React__namespace.createElement(Strut, {
30523
30918
  size: wonderBlocksTokens.spacing.small_12
30524
- }), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
30525
- tag: "label",
30526
- style: styles$p.row
30527
- }, "style", /*#__PURE__*/React__namespace.createElement(Strut, {
30528
- size: wonderBlocksTokens.spacing.xxxSmall_4
30529
- }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
30919
+ }), /*#__PURE__*/React__namespace.createElement(LineStrokeSelect, {
30530
30920
  selectedValue: lineStyle,
30531
30921
  onChange: value => onChangeProps({
30532
30922
  lineStyle: value
30533
30923
  })
30534
- // Placeholder is required, but never gets used.
30535
- ,
30536
- placeholder: "",
30537
- style: styles$p.selectMarginOffset
30538
- }, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
30539
- value: "solid",
30540
- label: "solid"
30541
- }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
30542
- value: "dashed",
30543
- label: "dashed"
30544
- })))), isInvalid && /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
30545
- style: styles$p.errorText
30924
+ })), isInvalid && /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
30925
+ style: styles$q.errorText
30546
30926
  }, lengthZeroStr), /*#__PURE__*/React__namespace.createElement(DefiningPointSettings, _extends({
30547
30927
  label: "Point 1",
30548
30928
  showPoint: showPoint1,
@@ -30567,7 +30947,7 @@ const LockedLineSettings = props => {
30567
30947
  onRemove: onRemove
30568
30948
  }));
30569
30949
  };
30570
- const styles$p = aphrodite.StyleSheet.create({
30950
+ const styles$q = aphrodite.StyleSheet.create({
30571
30951
  row: {
30572
30952
  display: "flex",
30573
30953
  flexDirection: "row",
@@ -30576,10 +30956,6 @@ const styles$p = aphrodite.StyleSheet.create({
30576
30956
  spaceUnder: {
30577
30957
  marginBottom: wonderBlocksTokens.spacing.xSmall_8
30578
30958
  },
30579
- selectMarginOffset: {
30580
- // Align with the point settings accordions.
30581
- marginInlineEnd: -wonderBlocksTokens.spacing.xxxSmall_4
30582
- },
30583
30959
  errorText: {
30584
30960
  color: wonderBlocksTokens.color.red
30585
30961
  }
@@ -30612,7 +30988,7 @@ const LockedPointSettings = props => {
30612
30988
  /*#__PURE__*/
30613
30989
  // Summary: Point, coords, color (filled/open)
30614
30990
  React__namespace.createElement(wonderBlocksCore.View, {
30615
- style: styles$o.row
30991
+ style: styles$p.row
30616
30992
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, `Point (${coord[0]}, ${coord[1]})`), /*#__PURE__*/React__namespace.createElement(Strut, {
30617
30993
  size: wonderBlocksTokens.spacing.xSmall_8
30618
30994
  }), /*#__PURE__*/React__namespace.createElement(ColorSwatch, {
@@ -30621,7 +30997,7 @@ const LockedPointSettings = props => {
30621
30997
  }))
30622
30998
  }, /*#__PURE__*/React__namespace.createElement(CoordinatePairInput, {
30623
30999
  coord: coord,
30624
- style: styles$o.spaceUnder,
31000
+ style: styles$p.spaceUnder,
30625
31001
  onChange: newCoord => {
30626
31002
  onChangeProps({
30627
31003
  coord: newCoord
@@ -30630,7 +31006,7 @@ const LockedPointSettings = props => {
30630
31006
  }), /*#__PURE__*/React__namespace.createElement(ColorSelect, {
30631
31007
  selectedValue: pointColor,
30632
31008
  onChange: handleColorChange,
30633
- style: styles$o.spaceUnder
31009
+ style: styles$p.spaceUnder
30634
31010
  }), /*#__PURE__*/React__namespace.createElement(LabeledSwitch, {
30635
31011
  label: "open point",
30636
31012
  checked: !filled,
@@ -30645,7 +31021,7 @@ const LockedPointSettings = props => {
30645
31021
  onRemove: onRemove
30646
31022
  }));
30647
31023
  };
30648
- const styles$o = aphrodite.StyleSheet.create({
31024
+ const styles$p = aphrodite.StyleSheet.create({
30649
31025
  row: {
30650
31026
  flexDirection: "row",
30651
31027
  alignItems: "center"
@@ -30663,17 +31039,17 @@ const PolygonSwatch = props => {
30663
31039
  } = props;
30664
31040
  return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30665
31041
  "aria-label": `${color}, stroke ${strokeStyle}, fill ${fillStyle}`,
30666
- style: [styles$n.container, {
31042
+ style: [styles$o.container, {
30667
31043
  border: `4px ${strokeStyle} ${perseus.lockedFigureColors[color]}`
30668
31044
  }]
30669
31045
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30670
- style: [styles$n.innerSquare, {
31046
+ style: [styles$o.innerSquare, {
30671
31047
  backgroundColor: perseus.lockedFigureColors[color],
30672
- opacity: perseus.lockedFigureFillStyles[fillStyle]
31048
+ opacity: fillStyle === "white" ? 0 : perseus.lockedFigureFillStyles[fillStyle]
30673
31049
  }]
30674
31050
  }));
30675
31051
  };
30676
- const styles$n = aphrodite.StyleSheet.create({
31052
+ const styles$o = aphrodite.StyleSheet.create({
30677
31053
  container: {
30678
31054
  // Add a white outline so that the color swatch is visible when
30679
31055
  // the dropdown option is highlighted with its blue background.
@@ -30715,7 +31091,7 @@ const LockedPolygonSettings = props => {
30715
31091
  /*#__PURE__*/
30716
31092
  // Summary: Polygon, number of sides, style swatch
30717
31093
  React__namespace.createElement(wonderBlocksCore.View, {
30718
- style: styles$m.row
31094
+ style: styles$n.row
30719
31095
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, `Polygon, ${points.length} sides`), /*#__PURE__*/React__namespace.createElement(Strut, {
30720
31096
  size: wonderBlocksTokens.spacing.xSmall_8
30721
31097
  }), /*#__PURE__*/React__namespace.createElement(PolygonSwatch, {
@@ -30724,7 +31100,7 @@ const LockedPolygonSettings = props => {
30724
31100
  strokeStyle: strokeStyle
30725
31101
  }))
30726
31102
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30727
- style: [styles$m.row, styles$m.spaceUnder]
31103
+ style: [styles$n.row, styles$n.spaceUnder]
30728
31104
  }, /*#__PURE__*/React__namespace.createElement(ColorSelect, {
30729
31105
  selectedValue: color,
30730
31106
  onChange: handleColorChange
@@ -30732,7 +31108,7 @@ const LockedPolygonSettings = props => {
30732
31108
  size: wonderBlocksTokens.spacing.medium_16
30733
31109
  }), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
30734
31110
  tag: "label",
30735
- style: styles$m.row
31111
+ style: [styles$n.row, styles$n.truncatedWidth]
30736
31112
  }, "fill", /*#__PURE__*/React__namespace.createElement(Strut, {
30737
31113
  size: wonderBlocksTokens.spacing.xxSmall_6
30738
31114
  }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
@@ -30747,42 +31123,28 @@ const LockedPolygonSettings = props => {
30747
31123
  key: option,
30748
31124
  value: option,
30749
31125
  label: option
30750
- }))))), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
30751
- tag: "label",
30752
- style: [styles$m.row, styles$m.spaceUnder]
30753
- }, "stroke", /*#__PURE__*/React__namespace.createElement(Strut, {
30754
- size: wonderBlocksTokens.spacing.xxSmall_6
30755
- }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
31126
+ }))))), /*#__PURE__*/React__namespace.createElement(LineStrokeSelect, {
30756
31127
  selectedValue: strokeStyle,
30757
31128
  onChange: value => onChangeProps({
30758
31129
  strokeStyle: value
30759
31130
  })
30760
- // Placeholder is required, but never gets used.
30761
- ,
30762
- placeholder: ""
30763
- }, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
30764
- value: "solid",
30765
- label: "solid"
30766
- }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
30767
- value: "dashed",
30768
- label: "dashed"
30769
- }))), /*#__PURE__*/React__namespace.createElement(LabeledSwitch, {
31131
+ }), /*#__PURE__*/React__namespace.createElement(LabeledSwitch, {
30770
31132
  label: "show vertices",
30771
31133
  checked: showVertices,
30772
31134
  onChange: newValue => onChangeProps({
30773
31135
  showVertices: newValue
30774
31136
  }),
30775
- style: styles$m.spaceUnder
31137
+ style: styles$n.spaceUnder
30776
31138
  }), /*#__PURE__*/React__namespace.createElement(PerseusEditorAccordion, {
30777
31139
  header: /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, "Points"),
30778
31140
  expanded: true,
30779
- containerStyle: styles$m.pointAccordionContainer,
30780
- panelStyle: styles$m.pointAccordionPanel
31141
+ containerStyle: styles$n.pointAccordionContainer,
31142
+ panelStyle: styles$n.pointAccordionPanel
30781
31143
  }, points.map((point, index) => {
30782
31144
  const pointLabel = String.fromCharCode(65 + index);
30783
31145
  return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30784
- key: `locked-polygon-point-${point[0]}-${point[1]}-index-${index}`,
30785
- style: [styles$m.row, styles$m.spaceUnder]
31146
+ key: `locked-polygon-point-index-${index}`,
31147
+ style: [styles$n.row, styles$n.spaceUnder]
30786
31148
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, `${pointLabel}:`), /*#__PURE__*/React__namespace.createElement(Strut, {
30787
31149
  size: wonderBlocksTokens.spacing.medium_16
30788
31150
  }), /*#__PURE__*/React__namespace.createElement(CoordinatePairInput, {
@@ -30810,7 +31172,7 @@ const LockedPolygonSettings = props => {
30810
31172
  points: newPoints
30811
31173
  });
30812
31174
  },
30813
- style: styles$m.icon
31175
+ style: styles$n.icon
30814
31176
  }));
30815
31177
  }), /*#__PURE__*/React__namespace.createElement(Button__default["default"], {
30816
31178
  kind: "tertiary",
@@ -30826,7 +31188,7 @@ const LockedPolygonSettings = props => {
30826
31188
  onRemove: onRemove
30827
31189
  }));
30828
31190
  };
30829
- const styles$m = aphrodite.StyleSheet.create({
31191
+ const styles$n = aphrodite.StyleSheet.create({
30830
31192
  row: {
30831
31193
  display: "flex",
30832
31194
  flexDirection: "row",
@@ -30843,6 +31205,10 @@ const styles$m = aphrodite.StyleSheet.create({
30843
31205
  },
30844
31206
  spaceUnder: {
30845
31207
  marginBottom: wonderBlocksTokens.spacing.xSmall_8
31208
+ },
31209
+ truncatedWidth: {
31210
+ // Allow truncation, stop bleeding over the edge.
31211
+ minWidth: 0
30846
31212
  }
30847
31213
  });
30848
31214
 
@@ -30884,7 +31250,7 @@ const LockedVectorSettings = props => {
30884
31250
  expanded: props.expanded,
30885
31251
  onToggle: props.onToggle,
30886
31252
  header: /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30887
- style: styles$l.row
31253
+ style: styles$m.row
30888
31254
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, lineLabel), /*#__PURE__*/React__namespace.createElement(Strut, {
30889
31255
  size: wonderBlocksTokens.spacing.xSmall_8
30890
31256
  }), /*#__PURE__*/React__namespace.createElement(LineSwatch, {
@@ -30892,19 +31258,19 @@ const LockedVectorSettings = props => {
30892
31258
  lineStyle: "solid"
30893
31259
  }))
30894
31260
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30895
- style: [styles$l.row, styles$l.spaceUnder]
31261
+ style: [styles$m.row, styles$m.spaceUnder]
30896
31262
  }, /*#__PURE__*/React__namespace.createElement(ColorSelect, {
30897
31263
  selectedValue: lineColor,
30898
31264
  onChange: handleColorChange
30899
31265
  })), isInvalid && /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
30900
- style: styles$l.errorText
31266
+ style: styles$m.errorText
30901
31267
  }, lengthErrorMessage), /*#__PURE__*/React__namespace.createElement(PerseusEditorAccordion, {
30902
31268
  expanded: true // Initial state is expanded
30903
31269
  ,
30904
- containerStyle: styles$l.container,
30905
- panelStyle: styles$l.accordionPanel,
31270
+ containerStyle: styles$m.container,
31271
+ panelStyle: styles$m.accordionPanel,
30906
31272
  header: /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30907
- style: styles$l.row
31273
+ style: styles$m.row
30908
31274
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, `Tail (${tail[0]}, ${tail[1]})`))
30909
31275
  }, /*#__PURE__*/React__namespace.createElement(CoordinatePairInput, {
30910
31276
  coord: tail,
@@ -30915,10 +31281,10 @@ const LockedVectorSettings = props => {
30915
31281
  })), /*#__PURE__*/React__namespace.createElement(PerseusEditorAccordion, {
30916
31282
  expanded: true // Initial state is expanded
30917
31283
  ,
30918
- containerStyle: styles$l.container,
30919
- panelStyle: styles$l.accordionPanel,
31284
+ containerStyle: styles$m.container,
31285
+ panelStyle: styles$m.accordionPanel,
30920
31286
  header: /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30921
- style: styles$l.row
31287
+ style: styles$m.row
30922
31288
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, `Tip (${tip[0]}, ${tip[1]})`))
30923
31289
  }, /*#__PURE__*/React__namespace.createElement(CoordinatePairInput, {
30924
31290
  coord: tip,
@@ -30932,7 +31298,7 @@ const LockedVectorSettings = props => {
30932
31298
  onRemove: onRemove
30933
31299
  }));
30934
31300
  };
30935
- const styles$l = aphrodite.StyleSheet.create({
31301
+ const styles$m = aphrodite.StyleSheet.create({
30936
31302
  accordionPanel: {
30937
31303
  paddingBottom: wonderBlocksTokens.spacing.medium_16
30938
31304
  },
@@ -30974,6 +31340,11 @@ const LockedFigureSettings = props => {
30974
31340
  return /*#__PURE__*/React__namespace.createElement(LockedEllipseSettings, props);
30975
31341
  case "polygon":
30976
31342
  return /*#__PURE__*/React__namespace.createElement(LockedPolygonSettings, props);
31343
+ case "function":
31344
+ if (props.showM2bFeatures) {
31345
+ return /*#__PURE__*/React__namespace.createElement(LockedFunctionSettings, props);
31346
+ }
31347
+ break;
30977
31348
  }
30978
31349
  return null;
30979
31350
  };
@@ -31079,12 +31450,6 @@ const LockedFiguresSection = props => {
31079
31450
  onToggle: () => setIsExpanded(!isExpanded),
31080
31451
  isCollapsible: true
31081
31452
  }), isExpanded && /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, null, figures?.map((figure, index) => {
31082
- if (figure.type === "function") {
31083
- // TODO(LEMS-1947): Add locked function settings.
31084
- // Remove this block once function locked figure settings are
31085
- // implemented.
31086
- return;
31087
- }
31088
31453
  return /*#__PURE__*/React__namespace.createElement(LockedFigureSettings, _extends({
31089
31454
  key: `${uniqueId}-locked-${figure}-${index}`,
31090
31455
  showM2bFeatures: props.showM2bFeatures,
@@ -31100,7 +31465,7 @@ const LockedFiguresSection = props => {
31100
31465
  onRemove: () => removeLockedFigure(index)
31101
31466
  }));
31102
31467
  }), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
31103
- style: styles$k.buttonContainer
31468
+ style: styles$l.buttonContainer
31104
31469
  }, /*#__PURE__*/React__namespace.createElement(LockedFigureSelect, {
31105
31470
  showM2bFeatures: props.showM2bFeatures,
31106
31471
  id: `${uniqueId}-select`,
@@ -31110,10 +31475,10 @@ const LockedFiguresSection = props => {
31110
31475
  }), showExpandButton && /*#__PURE__*/React__namespace.createElement(Button__default["default"], {
31111
31476
  kind: "secondary",
31112
31477
  onClick: () => toggleExpanded(allCollapsed),
31113
- style: styles$k.button
31478
+ style: styles$l.button
31114
31479
  }, buttonLabel))));
31115
31480
  };
31116
- const styles$k = aphrodite.StyleSheet.create({
31481
+ const styles$l = aphrodite.StyleSheet.create({
31117
31482
  buttonContainer: {
31118
31483
  flexDirection: "row",
31119
31484
  alignItems: "center"
@@ -31149,7 +31514,7 @@ const GraphPointsCountSelector = _ref => {
31149
31514
  // Never uses placeholder, always has value
31150
31515
  ,
31151
31516
  placeholder: "",
31152
- style: styles$j.singleSelectShort
31517
+ style: styles$k.singleSelectShort
31153
31518
  }, [...[...Array(7).keys()].map(n => /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
31154
31519
  key: n,
31155
31520
  value: `${n}`,
@@ -31160,7 +31525,7 @@ const GraphPointsCountSelector = _ref => {
31160
31525
  label: "unlimited"
31161
31526
  })]);
31162
31527
  };
31163
- const styles$j = aphrodite.StyleSheet.create({
31528
+ const styles$k = aphrodite.StyleSheet.create({
31164
31529
  singleSelectShort: {
31165
31530
  // Non-standard spacing, but it's the smallest we can go
31166
31531
  // without running into styling issues with the dropdown.
@@ -31173,7 +31538,7 @@ const GraphTypeSelector = props => {
31173
31538
  selectedValue: props.graphType,
31174
31539
  onChange: props.onChange,
31175
31540
  placeholder: "Select a graph type",
31176
- style: styles$i.singleSelectShort
31541
+ style: styles$j.singleSelectShort
31177
31542
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
31178
31543
  value: "linear",
31179
31544
  label: "Linear function"
@@ -31206,7 +31571,7 @@ const GraphTypeSelector = props => {
31206
31571
  label: "Angle"
31207
31572
  }));
31208
31573
  };
31209
- const styles$i = aphrodite.StyleSheet.create({
31574
+ const styles$j = aphrodite.StyleSheet.create({
31210
31575
  singleSelectShort: {
31211
31576
  // Non-standard spacing, but it's the smallest we can go
31212
31577
  // without running into styling issues with the dropdown.
@@ -31241,7 +31606,6 @@ function InteractiveGraphCorrectAnswer(props) {
31241
31606
  const {
31242
31607
  ButtonGroup: ButtonGroup$2,
31243
31608
  InfoTip: InfoTip$c,
31244
- PropCheckBox: PropCheckBox$7,
31245
31609
  RangeInput: RangeInput$4
31246
31610
  } = perseus.components;
31247
31611
  const defaultBackgroundImage$1 = {
@@ -31629,16 +31993,20 @@ class InteractiveGraphSettings extends React__namespace.Component {
31629
31993
  onChange: this.change("markings")
31630
31994
  }))), /*#__PURE__*/React__namespace.createElement("div", {
31631
31995
  className: "perseus-widget-left-col"
31632
- }, /*#__PURE__*/React__namespace.createElement(PropCheckBox$7, {
31996
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
31633
31997
  label: "Show tooltips",
31634
- showTooltips: this.props.showTooltips,
31635
- onChange: this.change
31998
+ checked: this.props.showTooltips,
31999
+ onChange: value => {
32000
+ this.change({
32001
+ showTooltips: value
32002
+ });
32003
+ }
31636
32004
  }))), /*#__PURE__*/React__namespace.createElement(LabeledRow, {
31637
32005
  label: "Background image URL:",
31638
- style: styles$h.resetSpaceTop
32006
+ style: styles$i.resetSpaceTop
31639
32007
  }, /*#__PURE__*/React__namespace.createElement("input", {
31640
32008
  type: "text",
31641
- className: aphrodite.css(styles$h.backgroundUrlInput),
32009
+ className: aphrodite.css(styles$i.backgroundUrlInput),
31642
32010
  ref: this.bgUrlRef,
31643
32011
  value: this.state.backgroundImage.url || "",
31644
32012
  onChange: e => {
@@ -31654,14 +32022,18 @@ class InteractiveGraphSettings extends React__namespace.Component {
31654
32022
  onKeyPress: this.changeBackgroundUrl,
31655
32023
  onBlur: this.changeBackgroundUrl
31656
32024
  }), /*#__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, {
31657
- style: styles$h.protractorSection
32025
+ style: styles$i.protractorSection
31658
32026
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
31659
- style: styles$h.checkboxRow
31660
- }, /*#__PURE__*/React__namespace.createElement(PropCheckBox$7, {
32027
+ style: styles$i.checkboxRow
32028
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
31661
32029
  label: "Show protractor",
31662
- showProtractor: this.props.showProtractor,
31663
- onChange: this.change,
31664
- style: styles$h.resetSpaceTop
32030
+ checked: this.props.showProtractor,
32031
+ onChange: value => {
32032
+ this.change({
32033
+ showProtractor: value
32034
+ });
32035
+ },
32036
+ style: styles$i.resetSpaceTop
31665
32037
  })), this.props.showProtractor && /*#__PURE__*/React__namespace.createElement(Banner__default["default"], {
31666
32038
  layout: "floating",
31667
32039
  text: "The protractor is not accessible. Please consider an alternate approach.",
@@ -31669,7 +32041,7 @@ class InteractiveGraphSettings extends React__namespace.Component {
31669
32041
  }))));
31670
32042
  }
31671
32043
  }
31672
- const styles$h = aphrodite.StyleSheet.create({
32044
+ const styles$i = aphrodite.StyleSheet.create({
31673
32045
  resetSpaceTop: {
31674
32046
  marginTop: 0
31675
32047
  },
@@ -31708,14 +32080,14 @@ const SegmentCountSelector = _ref => {
31708
32080
  const num = +newValue;
31709
32081
  onChange(num);
31710
32082
  },
31711
- style: styles$g.singleSelectShort
32083
+ style: styles$h.singleSelectShort
31712
32084
  }, ___default["default"].range(1, 7).map(n => /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
31713
32085
  key: n,
31714
32086
  value: `${n}`,
31715
32087
  label: `${n} segment${n > 1 ? "s" : ""}`
31716
32088
  })));
31717
32089
  };
31718
- const styles$g = aphrodite.StyleSheet.create({
32090
+ const styles$h = aphrodite.StyleSheet.create({
31719
32091
  singleSelectShort: {
31720
32092
  // Non-standard spacing, but it's the smallest we can go
31721
32093
  // without running into styling issues with the dropdown.
@@ -31723,15 +32095,49 @@ const styles$g = aphrodite.StyleSheet.create({
31723
32095
  }
31724
32096
  });
31725
32097
 
32098
+ const StartCoordsAngle = props => {
32099
+ const {
32100
+ startCoords
32101
+ } = props;
32102
+ return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, null, "WIP", /*#__PURE__*/React__namespace.createElement("br", null), " Start coords:", startCoords.map((coord, index) => {
32103
+ return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
32104
+ key: index
32105
+ }, `Point ${index + 1}: (${coord[0]}, ${coord[1]})`);
32106
+ }));
32107
+ };
32108
+
31726
32109
  const StartCoordsCircle = props => {
31727
32110
  const {
31728
32111
  startCoords,
31729
32112
  onChange
31730
32113
  } = props;
32114
+ const [radiusState, setRadiusState] = React__namespace.useState(startCoords.radius.toString());
32115
+
32116
+ // Update the local state when the props change. (Specifically, when
32117
+ // the radius is reset from the "Use default start coordinates" button.)
32118
+ React__namespace.useEffect(() => {
32119
+ setRadiusState(startCoords.radius.toString());
32120
+ }, [startCoords.radius]);
32121
+ function handleRadiuschange(newValue) {
32122
+ // Update the local state to update the input field.
32123
+ setRadiusState(newValue);
32124
+
32125
+ // Assume the user is in the middle of typing. Don't update
32126
+ // the props until they've finished typing a valid number.
32127
+ if (isNaN(+newValue) || newValue === "" || +newValue === 0) {
32128
+ return;
32129
+ }
32130
+
32131
+ // Update the props (update the graph).
32132
+ onChange({
32133
+ center: startCoords.center,
32134
+ radius: parseFloat(newValue)
32135
+ });
32136
+ }
31731
32137
  return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
31732
- style: styles$f.tile
32138
+ style: styles$g.tile
31733
32139
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
31734
- style: styles$f.row
32140
+ style: styles$g.row
31735
32141
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, "Center:"), /*#__PURE__*/React__namespace.createElement(Strut, {
31736
32142
  size: wonderBlocksTokens.spacing.small_12
31737
32143
  }), /*#__PURE__*/React__namespace.createElement(CoordinatePairInput, {
@@ -31743,23 +32149,18 @@ const StartCoordsCircle = props => {
31743
32149
  })
31744
32150
  })), /*#__PURE__*/React__namespace.createElement(Strut, {
31745
32151
  size: wonderBlocksTokens.spacing.small_12
31746
- }), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
31747
- style: styles$f.row
31748
- }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, "Radius:"), /*#__PURE__*/React__namespace.createElement(Strut, {
32152
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, {
32153
+ tag: "label",
32154
+ style: styles$g.row
32155
+ }, "Radius:", /*#__PURE__*/React__namespace.createElement(Strut, {
31749
32156
  size: wonderBlocksTokens.spacing.small_12
31750
- }), /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.TextField, {
31751
- value: startCoords.radius.toString(),
31752
- type: "number",
31753
- onChange: value => {
31754
- onChange({
31755
- center: startCoords.center,
31756
- radius: parseFloat(value)
31757
- });
31758
- },
31759
- style: styles$f.textField
32157
+ }), /*#__PURE__*/React__namespace.createElement(ScrolllessNumberTextField, {
32158
+ value: radiusState,
32159
+ onChange: handleRadiuschange,
32160
+ style: styles$g.textField
31760
32161
  })));
31761
32162
  };
31762
- const styles$f = aphrodite.StyleSheet.create({
32163
+ const styles$g = aphrodite.StyleSheet.create({
31763
32164
  tile: {
31764
32165
  backgroundColor: wonderBlocksTokens.color.fadedBlue8,
31765
32166
  marginTop: wonderBlocksTokens.spacing.xSmall_8,
@@ -31767,6 +32168,7 @@ const styles$f = aphrodite.StyleSheet.create({
31767
32168
  borderRadius: wonderBlocksTokens.spacing.xSmall_8
31768
32169
  },
31769
32170
  row: {
32171
+ display: "flex",
31770
32172
  flexDirection: "row",
31771
32173
  alignItems: "center"
31772
32174
  },
@@ -31781,7 +32183,7 @@ const StartCoordsLine = props => {
31781
32183
  onChange
31782
32184
  } = props;
31783
32185
  return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
31784
- style: styles$e.tile
32186
+ style: styles$f.tile
31785
32187
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, "Point 1:"), /*#__PURE__*/React__namespace.createElement(Strut, {
31786
32188
  size: wonderBlocksTokens.spacing.small_12
31787
32189
  }), /*#__PURE__*/React__namespace.createElement(CoordinatePairInput, {
@@ -31789,7 +32191,7 @@ const StartCoordsLine = props => {
31789
32191
  labels: ["x", "y"],
31790
32192
  onChange: value => onChange([value, startCoords[1]])
31791
32193
  })), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
31792
- style: styles$e.tile
32194
+ style: styles$f.tile
31793
32195
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, "Point 2:"), /*#__PURE__*/React__namespace.createElement(Strut, {
31794
32196
  size: wonderBlocksTokens.spacing.small_12
31795
32197
  }), /*#__PURE__*/React__namespace.createElement(CoordinatePairInput, {
@@ -31798,7 +32200,7 @@ const StartCoordsLine = props => {
31798
32200
  onChange: value => onChange([startCoords[0], value])
31799
32201
  })));
31800
32202
  };
31801
- const styles$e = aphrodite.StyleSheet.create({
32203
+ const styles$f = aphrodite.StyleSheet.create({
31802
32204
  tile: {
31803
32205
  backgroundColor: wonderBlocksTokens.color.fadedBlue8,
31804
32206
  marginTop: wonderBlocksTokens.spacing.xSmall_8,
@@ -31821,7 +32223,7 @@ const StartCoordsMultiline = props => {
31821
32223
  header: /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, `${graphName} ${i + 1}`),
31822
32224
  expanded: true
31823
32225
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
31824
- style: styles$d.nestedTile
32226
+ style: styles$e.nestedTile
31825
32227
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, "Point 1:"), /*#__PURE__*/React__namespace.createElement(Strut, {
31826
32228
  size: wonderBlocksTokens.spacing.small_12
31827
32229
  }), /*#__PURE__*/React__namespace.createElement(CoordinatePairInput, {
@@ -31833,7 +32235,7 @@ const StartCoordsMultiline = props => {
31833
32235
  onChange(newCoords);
31834
32236
  }
31835
32237
  })), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
31836
- style: styles$d.nestedTile
32238
+ style: styles$e.nestedTile
31837
32239
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, "Point 2:"), /*#__PURE__*/React__namespace.createElement(Strut, {
31838
32240
  size: wonderBlocksTokens.spacing.small_12
31839
32241
  }), /*#__PURE__*/React__namespace.createElement(CoordinatePairInput, {
@@ -31846,7 +32248,7 @@ const StartCoordsMultiline = props => {
31846
32248
  }
31847
32249
  })))));
31848
32250
  };
31849
- const styles$d = aphrodite.StyleSheet.create({
32251
+ const styles$e = aphrodite.StyleSheet.create({
31850
32252
  nestedTile: {
31851
32253
  paddingBottom: wonderBlocksTokens.spacing.small_12,
31852
32254
  flexDirection: "row",
@@ -31854,6 +32256,39 @@ const styles$d = aphrodite.StyleSheet.create({
31854
32256
  }
31855
32257
  });
31856
32258
 
32259
+ const StartCoordsPoint = props => {
32260
+ const {
32261
+ startCoords,
32262
+ onChange
32263
+ } = props;
32264
+ return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, startCoords.map((coord, index) => {
32265
+ return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
32266
+ key: index,
32267
+ style: styles$d.tile
32268
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, `Point ${index + 1}:`), /*#__PURE__*/React__namespace.createElement(Strut, {
32269
+ size: wonderBlocksTokens.spacing.small_12
32270
+ }), /*#__PURE__*/React__namespace.createElement(CoordinatePairInput, {
32271
+ coord: coord,
32272
+ labels: ["x", "y"],
32273
+ onChange: newCoord => {
32274
+ const newStartCoords = [...startCoords];
32275
+ newStartCoords[index] = newCoord;
32276
+ onChange(newStartCoords);
32277
+ }
32278
+ }));
32279
+ }));
32280
+ };
32281
+ const styles$d = aphrodite.StyleSheet.create({
32282
+ tile: {
32283
+ backgroundColor: wonderBlocksTokens.color.fadedBlue8,
32284
+ marginTop: wonderBlocksTokens.spacing.xSmall_8,
32285
+ padding: wonderBlocksTokens.spacing.small_12,
32286
+ borderRadius: wonderBlocksTokens.spacing.xSmall_8,
32287
+ flexDirection: "row",
32288
+ alignItems: "center"
32289
+ }
32290
+ });
32291
+
31857
32292
  const StartCoordsQuadratic = props => {
31858
32293
  const {
31859
32294
  startCoords,
@@ -32012,6 +32447,24 @@ const StartCoordsSettingsInner = props => {
32012
32447
  startCoords: quadraticCoords,
32013
32448
  onChange: onChange
32014
32449
  });
32450
+ // Graphs with startCoords of type ReadonlyArray<Coord>
32451
+ case "point":
32452
+ case "polygon":
32453
+ const pointCoords = type === "point" ? perseus.getPointCoords(props, range, step) : perseus.getPolygonCoords(props, range, step);
32454
+ return /*#__PURE__*/React__namespace.createElement(StartCoordsPoint, {
32455
+ startCoords: pointCoords,
32456
+ onChange: onChange
32457
+ });
32458
+ case "angle":
32459
+ const angleCoords = perseus.getAngleCoords({
32460
+ graph: props,
32461
+ range,
32462
+ step
32463
+ });
32464
+ return /*#__PURE__*/React__namespace.createElement(StartCoordsAngle, {
32465
+ startCoords: angleCoords,
32466
+ onChange: onChange
32467
+ });
32015
32468
  default:
32016
32469
  return null;
32017
32470
  }
@@ -32066,10 +32519,6 @@ const POLYGON_SIDES = ___default["default"].map(___default["default"].range(3, 1
32066
32519
  label: `${value} sides`
32067
32520
  });
32068
32521
  });
32069
-
32070
- // TODO(LEMS-2228): Remove flags once this is fully released
32071
- const startCoordsUiPhase1Types = ["linear", "linear-system", "ray", "segment", "circle"];
32072
- const startCoordsUiPhase2Types = ["sinusoid", "quadratic"];
32073
32522
  /**
32074
32523
  * An editor for the InteractiveGraph widget, which allows the user to
32075
32524
  * specify the graph's properties and the correct answer.
@@ -32163,9 +32612,6 @@ class InteractiveGraphEditor extends React__namespace.Component {
32163
32612
  className: "perseus-error"
32164
32613
  }, this.props.valid);
32165
32614
  }
32166
- const startCoordsPhase1 = this.props.apiOptions?.flags?.mafs?.["start-coords-ui-phase-1"];
32167
- const startCoordsPhase2 = this.props.apiOptions?.flags?.mafs?.["start-coords-ui-phase-2"];
32168
- const displayStartCoordsUI = this.props.graph && (startCoordsPhase1 && startCoordsUiPhase1Types.includes(this.props.graph.type) || startCoordsPhase2 && startCoordsUiPhase2Types.includes(this.props.graph.type));
32169
32615
  return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, null, /*#__PURE__*/React__namespace.createElement(LabeledRow, {
32170
32616
  label: "Type of Graph:"
32171
32617
  }, /*#__PURE__*/React__namespace.createElement(GraphTypeSelector, {
@@ -32238,7 +32684,8 @@ class InteractiveGraphEditor extends React__namespace.Component {
32238
32684
  coords: null
32239
32685
  };
32240
32686
  this.props.onChange({
32241
- correct: graph
32687
+ correct: graph,
32688
+ graph: graph
32242
32689
  });
32243
32690
  },
32244
32691
  style: styles$a.singleSelectShort
@@ -32312,7 +32759,7 @@ class InteractiveGraphEditor extends React__namespace.Component {
32312
32759
  }
32313
32760
  })), this.props.graph?.type &&
32314
32761
  // TODO(LEMS-2228): Remove flags once this is fully released
32315
- displayStartCoordsUI && /*#__PURE__*/React__namespace.createElement(StartCoordsSettings, _extends({}, this.props.graph, {
32762
+ shouldShowStartCoordsUI(this.props.apiOptions.flags, this.props.graph) && /*#__PURE__*/React__namespace.createElement(StartCoordsSettings, _extends({}, this.props.graph, {
32316
32763
  range: this.props.range,
32317
32764
  step: this.props.step,
32318
32765
  onChange: this.changeStartCoords
@@ -33938,7 +34385,6 @@ const styles = aphrodite.StyleSheet.create({
33938
34385
  /* eslint-disable react/forbid-prop-types, react/sort-comp */
33939
34386
  const {
33940
34387
  InfoTip: InfoTip$a,
33941
- PropCheckBox: PropCheckBox$6,
33942
34388
  TextListEditor: TextListEditor$3
33943
34389
  } = perseus.components;
33944
34390
  class MatcherEditor extends React__namespace.Component {
@@ -33990,14 +34436,22 @@ class MatcherEditor extends React__namespace.Component {
33990
34436
  // eslint-disable-next-line react/jsx-no-bind
33991
34437
  ,
33992
34438
  onChange: this.onLabelChange.bind(this, 1)
33993
- })), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement(PropCheckBox$6, {
34439
+ })), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
33994
34440
  label: "Order of the matched pairs matters:",
33995
- orderMatters: this.props.orderMatters,
33996
- onChange: this.props.onChange
33997
- }), /*#__PURE__*/React__namespace.createElement(InfoTip$a, null, /*#__PURE__*/React__namespace.createElement("p", null, "With this option enabled, only the order provided above will be treated as correct. This is useful when ordering is significant, such as in the context of a proof."), /*#__PURE__*/React__namespace.createElement("p", null, "If disabled, pairwise matching is sufficient. To make this clear, the left column becomes fixed in the provided order and only the cards in the right column can be moved."))), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement(PropCheckBox$6, {
34441
+ checked: this.props.orderMatters,
34442
+ onChange: value => {
34443
+ this.props.onChange({
34444
+ orderMatters: value
34445
+ });
34446
+ }
34447
+ }), /*#__PURE__*/React__namespace.createElement(InfoTip$a, null, /*#__PURE__*/React__namespace.createElement("p", null, "With this option enabled, only the order provided above will be treated as correct. This is useful when ordering is significant, such as in the context of a proof."), /*#__PURE__*/React__namespace.createElement("p", null, "If disabled, pairwise matching is sufficient. To make this clear, the left column becomes fixed in the provided order and only the cards in the right column can be moved."))), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
33998
34448
  label: "Padding:",
33999
- padding: this.props.padding,
34000
- onChange: this.props.onChange
34449
+ checked: this.props.padding,
34450
+ onChange: value => {
34451
+ this.props.onChange({
34452
+ padding: value
34453
+ });
34454
+ }
34001
34455
  }), /*#__PURE__*/React__namespace.createElement(InfoTip$a, null, /*#__PURE__*/React__namespace.createElement("p", null, "Padding is good for text, but not needed for images."))));
34002
34456
  }
34003
34457
  onLabelChange = (index, e) => {
@@ -34150,7 +34604,6 @@ class MatrixEditor extends React__namespace.Component {
34150
34604
  const {
34151
34605
  InfoTip: InfoTip$9,
34152
34606
  NumberInput: NumberInput$7,
34153
- PropCheckBox: PropCheckBox$5,
34154
34607
  RangeInput: RangeInput$2
34155
34608
  } = perseus.components;
34156
34609
  const defaultImage = {
@@ -34224,16 +34677,24 @@ class MeasurerEditor extends React__namespace.Component {
34224
34677
  className: "perseus-widget-row"
34225
34678
  }, /*#__PURE__*/React__namespace.createElement("div", {
34226
34679
  className: "perseus-widget-left-col"
34227
- }, /*#__PURE__*/React__namespace.createElement(PropCheckBox$5, {
34680
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
34228
34681
  label: "Show ruler",
34229
- showRuler: this.props.showRuler,
34230
- onChange: this.props.onChange
34682
+ checked: this.props.showRuler,
34683
+ onChange: value => {
34684
+ this.props.onChange({
34685
+ showRuler: value
34686
+ });
34687
+ }
34231
34688
  })), /*#__PURE__*/React__namespace.createElement("div", {
34232
34689
  className: "perseus-widget-right-col"
34233
- }, /*#__PURE__*/React__namespace.createElement(PropCheckBox$5, {
34690
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
34234
34691
  label: "Show protractor",
34235
- showProtractor: this.props.showProtractor,
34236
- onChange: this.props.onChange
34692
+ checked: this.props.showProtractor,
34693
+ onChange: value => {
34694
+ this.props.onChange({
34695
+ showProtractor: value
34696
+ });
34697
+ }
34237
34698
  }))), 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", {
34238
34699
  onChange: e =>
34239
34700
  // @ts-expect-error - TS2554 - Expected 3 arguments, but got 2.
@@ -34360,7 +34821,6 @@ const {
34360
34821
  ButtonGroup: ButtonGroup$1,
34361
34822
  InfoTip: InfoTip$8,
34362
34823
  NumberInput: NumberInput$5,
34363
- PropCheckBox: PropCheckBox$4,
34364
34824
  RangeInput: RangeInput$1
34365
34825
  } = perseus.components;
34366
34826
  const bound = (x, gt, lt) => Math.min(Math.max(x, gt), lt);
@@ -34600,22 +35060,34 @@ class NumberLineEditor extends React__namespace.Component {
34600
35060
  className: "perseus-widget-row"
34601
35061
  }, !this.props.static && /*#__PURE__*/React__namespace.createElement("div", {
34602
35062
  className: "perseus-widget-left-col"
34603
- }, /*#__PURE__*/React__namespace.createElement(PropCheckBox$4, {
35063
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
34604
35064
  label: "Show tick controller",
34605
- isTickCtrl: this.props.isTickCtrl,
34606
- onChange: this.props.onChange
35065
+ checked: this.props.isTickCtrl,
35066
+ onChange: value => {
35067
+ this.props.onChange({
35068
+ isTickCtrl: value
35069
+ });
35070
+ }
34607
35071
  })), /*#__PURE__*/React__namespace.createElement("div", {
34608
35072
  className: "perseus-widget-right-col"
34609
- }, /*#__PURE__*/React__namespace.createElement(PropCheckBox$4, {
35073
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
34610
35074
  label: "Show label ticks",
34611
- labelTicks: this.props.labelTicks,
34612
- onChange: this.props.onChange
35075
+ checked: this.props.labelTicks,
35076
+ onChange: value => {
35077
+ this.props.onChange({
35078
+ labelTicks: value
35079
+ });
35080
+ }
34613
35081
  }))), /*#__PURE__*/React__namespace.createElement("div", {
34614
35082
  className: "perseus-widget-row"
34615
- }, !this.props.static && /*#__PURE__*/React__namespace.createElement(PropCheckBox$4, {
35083
+ }, !this.props.static && /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
34616
35084
  label: "Show tooltips",
34617
- showTooltips: this.props.showTooltips,
34618
- onChange: this.props.onChange
35085
+ checked: this.props.showTooltips,
35086
+ onChange: value => {
35087
+ this.props.onChange({
35088
+ showTooltips: value
35089
+ });
35090
+ }
34619
35091
  })), /*#__PURE__*/React__namespace.createElement("div", {
34620
35092
  className: "perseus-widget-row"
34621
35093
  }, isTickCtrl && /*#__PURE__*/React__namespace.createElement("span", null, /*#__PURE__*/React__namespace.createElement("label", null, "Start num divisions at", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$5, {
@@ -34666,7 +35138,6 @@ const {
34666
35138
  InlineIcon: InlineIcon$1,
34667
35139
  MultiButtonGroup,
34668
35140
  NumberInput: NumberInput$4,
34669
- PropCheckBox: PropCheckBox$3,
34670
35141
  TextInput: TextInput$3
34671
35142
  } = perseus.components;
34672
35143
  const {
@@ -34760,12 +35231,14 @@ class NumericInputEditor extends React__namespace.Component {
34760
35231
  onChange: this.updateAnswer(i, "answerForms") || (() => {})
34761
35232
  }), /*#__PURE__*/React__namespace.createElement(InfoTip$7, null, /*#__PURE__*/React__namespace.createElement("p", null, "Formats will be autoselected for you based on the given answer; to show no suggested formats and accept all types, simply have a decimal/integer be the answer. Values with \u03C0 will have format \"pi\", and values that are fractions will have some subset (mixed will be \"mixed\" and \"proper\"; improper/proper will both be \"improper\" and \"proper\"). If you would like to specify that it is only a proper fraction (or only a mixed/improper fraction), deselect the other format. Except for specific cases, you should not need to change the autoselected formats."), /*#__PURE__*/React__namespace.createElement("p", null, "To restrict the answer to ", /*#__PURE__*/React__namespace.createElement("em", null, "only"), " an improper fraction (i.e. 7/4), select the improper fraction and toggle \"strict\" to true. This ", /*#__PURE__*/React__namespace.createElement("b", null, "will not"), " ", "accept 1.75 as an answer.", " "), /*#__PURE__*/React__namespace.createElement("p", null, "Unless you are testing that specific skill, please do not restrict the answer format."))), /*#__PURE__*/React__namespace.createElement("div", {
34762
35233
  className: "perseus-widget-row"
34763
- }, /*#__PURE__*/React__namespace.createElement(PropCheckBox$3, {
35234
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
34764
35235
  label: "Strictly match only these formats",
34765
- strict: answers[i]["strict"]
34766
- // eslint-disable-next-line react/jsx-no-bind
34767
- ,
34768
- onChange: this.updateAnswer.bind(this, i)
35236
+ checked: answers[i]["strict"],
35237
+ onChange: value => {
35238
+ this.updateAnswer.bind(this, i)({
35239
+ strict: value
35240
+ });
35241
+ }
34769
35242
  })));
34770
35243
  const maxError = i => /*#__PURE__*/React__namespace.createElement("div", {
34771
35244
  className: "perseus-widget-row"
@@ -34791,23 +35264,31 @@ class NumericInputEditor extends React__namespace.Component {
34791
35264
  }), /*#__PURE__*/React__namespace.createElement(InfoTip$7, null, /*#__PURE__*/React__namespace.createElement("p", null, "Use size \"Normal\" for all text boxes, unless there are multiple text boxes in one line and the answer area is too narrow to fit them.")));
34792
35265
  const rightAlign = /*#__PURE__*/React__namespace.createElement("div", {
34793
35266
  className: "perseus-widget-row"
34794
- }, /*#__PURE__*/React__namespace.createElement(PropCheckBox$3, {
35267
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
34795
35268
  label: "Right alignment",
34796
- rightAlign: this.props.rightAlign,
34797
- onChange: this.props.onChange
35269
+ checked: this.props.rightAlign,
35270
+ onChange: value => {
35271
+ this.props.onChange({
35272
+ rightAlign: value
35273
+ });
35274
+ }
34798
35275
  }));
34799
35276
  const labelText = /*#__PURE__*/React__namespace.createElement("div", {
34800
35277
  className: "perseus-widget-row"
34801
- }, /*#__PURE__*/React__namespace.createElement("label", null, "Label text:", " ", /*#__PURE__*/React__namespace.createElement(TextInput$3, {
35278
+ }, /*#__PURE__*/React__namespace.createElement("label", null, "Aria label", /*#__PURE__*/React__namespace.createElement(TextInput$3, {
34802
35279
  value: this.props.labelText,
34803
35280
  onChange: this.change("labelText")
34804
35281
  })), /*#__PURE__*/React__namespace.createElement(InfoTip$7, null, /*#__PURE__*/React__namespace.createElement("p", null, "Text to describe this input. This will be shown to users using screenreaders.")));
34805
35282
  const coefficientCheck = /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("div", {
34806
35283
  className: "perseus-widget-row"
34807
- }, /*#__PURE__*/React__namespace.createElement(PropCheckBox$3, {
35284
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
34808
35285
  label: "Coefficient",
34809
- coefficient: this.props.coefficient,
34810
- onChange: this.props.onChange
35286
+ checked: this.props.coefficient,
35287
+ onChange: value => {
35288
+ this.props.onChange({
35289
+ coefficient: value
35290
+ });
35291
+ }
34811
35292
  }), /*#__PURE__*/React__namespace.createElement(InfoTip$7, null, /*#__PURE__*/React__namespace.createElement("p", null, "A coefficient style number allows the student to use - for -1 and an empty string to mean 1."))));
34812
35293
  const addAnswerButton = /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("a", {
34813
35294
  href: "#",
@@ -34938,11 +35419,11 @@ class NumericInputEditor extends React__namespace.Component {
34938
35419
  });
34939
35420
  return /*#__PURE__*/React__namespace.createElement("div", {
34940
35421
  className: "perseus-input-number-editor"
34941
- }, /*#__PURE__*/React__namespace.createElement("div", {
35422
+ }, labelText, inputSize, rightAlign, coefficientCheck, /*#__PURE__*/React__namespace.createElement("div", {
34942
35423
  className: "ui-title"
34943
35424
  }, "User input"), /*#__PURE__*/React__namespace.createElement("div", {
34944
35425
  className: "msg-title"
34945
- }, "Message shown to user on attempt"), generateInputAnswerEditors(), addAnswerButton, inputSize, rightAlign, coefficientCheck, labelText);
35426
+ }, "Message shown to user on attempt"), generateInputAnswerEditors(), addAnswerButton);
34946
35427
  }
34947
35428
  change = (() => {
34948
35429
  var _this = this;
@@ -35158,8 +35639,7 @@ class OrdererEditor extends React__namespace.Component {
35158
35639
  }
35159
35640
 
35160
35641
  const {
35161
- InfoTip: InfoTip$5,
35162
- PropCheckBox: PropCheckBox$2
35642
+ InfoTip: InfoTip$5
35163
35643
  } = perseus.components;
35164
35644
  class PassageEditor extends React__namespace.Component {
35165
35645
  static propTypes = {
@@ -35224,11 +35704,14 @@ class PassageEditor extends React__namespace.Component {
35224
35704
  className: "perseus-widget-passage-editor"
35225
35705
  }, /*#__PURE__*/React__namespace.createElement("div", {
35226
35706
  className: "perseus-widget-row"
35227
- }, /*#__PURE__*/React__namespace.createElement(PropCheckBox$2, {
35707
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
35228
35708
  label: "Show line numbers",
35229
- labelAlignment: "right",
35230
- showLineNumbers: this.props.showLineNumbers,
35231
- onChange: this.props.onChange
35709
+ checked: this.props.showLineNumbers,
35710
+ onChange: value => {
35711
+ this.props.onChange({
35712
+ showLineNumbers: value
35713
+ });
35714
+ }
35232
35715
  })), /*#__PURE__*/React__namespace.createElement("div", null, "Passage title:", /*#__PURE__*/React__namespace.createElement(InfoTip$5, null, /*#__PURE__*/React__namespace.createElement("p", null, "An optional title that will appear directly above the passage in the same font style. (E.g. Passage 1)")), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("input", {
35233
35716
  type: "text",
35234
35717
  defaultValue: this.props.passageTitle,
@@ -35700,8 +36183,7 @@ class PythonProgramEditor extends React__namespace.Component {
35700
36183
 
35701
36184
  /* eslint-disable jsx-a11y/anchor-is-valid, react/forbid-prop-types, react/sort-comp */
35702
36185
  const {
35703
- InlineIcon,
35704
- PropCheckBox: PropCheckBox$1
36186
+ InlineIcon
35705
36187
  } = perseus.components;
35706
36188
  const {
35707
36189
  iconPlus,
@@ -35805,25 +36287,34 @@ class RadioEditor extends React__namespace.Component {
35805
36287
  target: "_blank"
35806
36288
  }, "Multiple choice style guide"), /*#__PURE__*/React__namespace.createElement("br", null), /*#__PURE__*/React__namespace.createElement("div", {
35807
36289
  className: "perseus-widget-left-col"
35808
- }, /*#__PURE__*/React__namespace.createElement(PropCheckBox$1, {
36290
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
35809
36291
  label: "Multiple selections",
35810
- labelAlignment: "right",
35811
- multipleSelect: this.props.multipleSelect,
35812
- onChange: this.onMultipleSelectChange
36292
+ checked: this.props.multipleSelect,
36293
+ onChange: value => {
36294
+ this.onMultipleSelectChange({
36295
+ multipleSelect: value
36296
+ });
36297
+ }
35813
36298
  })), /*#__PURE__*/React__namespace.createElement("div", {
35814
36299
  className: "perseus-widget-right-col"
35815
- }, /*#__PURE__*/React__namespace.createElement(PropCheckBox$1, {
36300
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
35816
36301
  label: "Randomize order",
35817
- labelAlignment: "right",
35818
- randomize: this.props.randomize,
35819
- onChange: this.props.onChange
36302
+ checked: this.props.randomize,
36303
+ onChange: value => {
36304
+ this.props.onChange({
36305
+ randomize: value
36306
+ });
36307
+ }
35820
36308
  })), this.props.multipleSelect && /*#__PURE__*/React__namespace.createElement("div", {
35821
36309
  className: "perseus-widget-left-col"
35822
- }, /*#__PURE__*/React__namespace.createElement(PropCheckBox$1, {
36310
+ }, /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
35823
36311
  label: "Specify number correct",
35824
- labelAlignment: "right",
35825
- countChoices: this.props.countChoices,
35826
- onChange: this.onCountChoicesChange
36312
+ checked: this.props.countChoices,
36313
+ onChange: value => {
36314
+ this.onCountChoicesChange({
36315
+ countChoices: value
36316
+ });
36317
+ }
35827
36318
  }))), /*#__PURE__*/React__namespace.createElement(perseus.BaseRadio, {
35828
36319
  multipleSelect: this.props.multipleSelect,
35829
36320
  countChoices: this.props.countChoices,
@@ -36052,7 +36543,6 @@ class SimpleMarkdownTesterEditor extends React__namespace.Component {
36052
36543
  /* eslint-disable @khanacademy/ts-no-error-suppressions */
36053
36544
  const {
36054
36545
  InfoTip: InfoTip$2,
36055
- PropCheckBox,
36056
36546
  TextListEditor
36057
36547
  } = perseus.components;
36058
36548
  const HORIZONTAL = "horizontal";
@@ -36098,10 +36588,14 @@ class SorterEditor extends React__namespace.Component {
36098
36588
  value: HORIZONTAL
36099
36589
  }, "Horizontal"), /*#__PURE__*/React__namespace.createElement("option", {
36100
36590
  value: VERTICAL
36101
- }, "Vertical"))), /*#__PURE__*/React__namespace.createElement(InfoTip$2, null, /*#__PURE__*/React__namespace.createElement("p", null, "Use the horizontal layout for short text and small images. The vertical layout is best for longer text and larger images."))), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement(PropCheckBox, {
36591
+ }, "Vertical"))), /*#__PURE__*/React__namespace.createElement(InfoTip$2, null, /*#__PURE__*/React__namespace.createElement("p", null, "Use the horizontal layout for short text and small images. The vertical layout is best for longer text and larger images."))), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
36102
36592
  label: "Padding:",
36103
- padding: this.props.padding,
36104
- onChange: this.props.onChange
36593
+ checked: this.props.padding,
36594
+ onChange: value => {
36595
+ this.props.onChange({
36596
+ padding: value
36597
+ });
36598
+ }
36105
36599
  }), /*#__PURE__*/React__namespace.createElement(InfoTip$2, null, /*#__PURE__*/React__namespace.createElement("p", null, "Padding is good for text, but not needed for images."))));
36106
36600
  }
36107
36601
  }