@khanacademy/perseus-editor 11.3.0 → 11.4.1

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
@@ -20,11 +20,11 @@ var wonderBlocksForm = require('@khanacademy/wonder-blocks-form');
20
20
  var ReactDOM = require('react-dom');
21
21
  var kmath = require('@khanacademy/kmath');
22
22
  var KAS = require('@khanacademy/kas');
23
+ var Button = require('@khanacademy/wonder-blocks-button');
24
+ var wonderBlocksTypography = require('@khanacademy/wonder-blocks-typography');
23
25
  var wonderStuffCore = require('@khanacademy/wonder-stuff-core');
24
26
  var mathInput = require('@khanacademy/math-input');
25
27
  var wonderBlocksDropdown = require('@khanacademy/wonder-blocks-dropdown');
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.3.0";
86
+ const libVersion = "11.4.1";
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$P.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$P = 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$O.expanded : styles$O.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$O = 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$N.errorContainer
20828
+ style: styles$P.errorContainer
20829
20829
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
20830
- style: styles$N.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$N.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$N.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$N = aphrodite.StyleSheet.create({
20846
+ const styles$P = aphrodite.StyleSheet.create({
20847
20847
  title: {
20848
20848
  backgroundColor: "#eee",
20849
20849
  fontSize: "1.25em",
@@ -23920,7 +23920,7 @@ class ItemExtrasEditor extends React__namespace.Component {
23920
23920
  }
23921
23921
  }
23922
23922
  const ItemExtraCheckbox = props => /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
23923
- style: [styles$M.checkbox, props.indent ? styles$M.indented : undefined]
23923
+ style: [styles$O.checkbox, props.indent ? styles$O.indented : undefined]
23924
23924
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
23925
23925
  label: /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
23926
23926
  style: {
@@ -23930,7 +23930,7 @@ const ItemExtraCheckbox = props => /*#__PURE__*/React__namespace.createElement(w
23930
23930
  checked: props.checked,
23931
23931
  onChange: newCheckedState => props.onChange(newCheckedState)
23932
23932
  }));
23933
- const styles$M = aphrodite.StyleSheet.create({
23933
+ const styles$O = aphrodite.StyleSheet.create({
23934
23934
  indented: {
23935
23935
  marginInlineStart: wonderBlocksTokens.spacing.large_24
23936
23936
  }
@@ -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$L.baseButton, color === "green" && styles$L.green, color === "orange" && styles$L.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$L = 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$K.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$K.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$K.container)
24820
+ className: aphrodite.css(styles$M.container)
24821
24821
  }, /*#__PURE__*/React__namespace.createElement("span", {
24822
- className: aphrodite.css(styles$K.row, styles$K.rowHeading)
24822
+ className: aphrodite.css(styles$M.row, styles$M.rowHeading)
24823
24823
  }, /*#__PURE__*/React__namespace.createElement("div", {
24824
- className: aphrodite.css(styles$K.columnLeft)
24824
+ className: aphrodite.css(styles$M.columnLeft)
24825
24825
  }, /*#__PURE__*/React__namespace.createElement("div", {
24826
- className: "pod-title " + aphrodite.css(styles$K.containerHeader)
24826
+ className: "pod-title " + aphrodite.css(styles$M.containerHeader)
24827
24827
  }, /*#__PURE__*/React__namespace.createElement("div", {
24828
- className: aphrodite.css(styles$K.containerTitle)
24828
+ className: aphrodite.css(styles$M.containerTitle)
24829
24829
  }, capitalize(name)), controls)), /*#__PURE__*/React__namespace.createElement("div", {
24830
- className: aphrodite.css(styles$K.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$K.container)
24843
+ className: aphrodite.css(styles$M.container)
24844
24844
  }, controls && /*#__PURE__*/React__namespace.createElement("div", {
24845
- className: aphrodite.css(styles$K.columnLeft, styles$K.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$K.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$K.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$K.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$K.containerHeader, styles$K.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$K.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$K.container)
24874
+ className: aphrodite.css(styles$M.container)
24875
24875
  }, hasBothHeadings && /*#__PURE__*/React__namespace.createElement("span", {
24876
- className: aphrodite.css(styles$K.row)
24876
+ className: aphrodite.css(styles$M.row)
24877
24877
  }, /*#__PURE__*/React__namespace.createElement("div", {
24878
- className: aphrodite.css(styles$K.columnLeft)
24878
+ className: aphrodite.css(styles$M.columnLeft)
24879
24879
  }, headingEditor), /*#__PURE__*/React__namespace.createElement("div", {
24880
- className: aphrodite.css(styles$K.columnRight)
24880
+ className: aphrodite.css(styles$M.columnRight)
24881
24881
  }, headingPreview)), /*#__PURE__*/React__namespace.createElement("div", {
24882
- className: aphrodite.css(path.length > 0 && styles$K.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$K.row)
25002
+ className: aphrodite.css(styles$M.row)
25003
25003
  }, /*#__PURE__*/React__namespace.createElement("div", {
25004
- className: aphrodite.css(styles$K.columnLeft)
25004
+ className: aphrodite.css(styles$M.columnLeft)
25005
25005
  }, /*#__PURE__*/React__namespace.createElement("div", {
25006
- className: aphrodite.css(sticky && styles$K.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$K.columnRight)
25014
+ className: aphrodite.css(styles$M.columnRight)
25015
25015
  }, /*#__PURE__*/React__namespace.createElement("div", {
25016
- className: aphrodite.css(sticky && styles$K.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$K.row)
25032
+ className: aphrodite.css(styles$M.row)
25033
25033
  }, /*#__PURE__*/React__namespace.createElement("div", {
25034
- className: aphrodite.css(styles$K.columnLeft)
25034
+ className: aphrodite.css(styles$M.columnLeft)
25035
25035
  }, /*#__PURE__*/React__namespace.createElement("div", {
25036
- className: aphrodite.css(sticky && styles$K.sticky)
25036
+ className: aphrodite.css(sticky && styles$M.sticky)
25037
25037
  }, /*#__PURE__*/React__namespace.createElement(HintEditor, _extends({}, data, {
25038
- className: aphrodite.css(styles$K.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$K.columnRight)
25053
+ className: aphrodite.css(styles$M.columnRight)
25054
25054
  }, /*#__PURE__*/React__namespace.createElement("div", {
25055
- className: aphrodite.css(sticky && styles$K.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$K.columnLeft)
25072
+ className: aphrodite.css(styles$M.columnLeft)
25073
25073
  }, /*#__PURE__*/React__namespace.createElement("div", {
25074
- className: aphrodite.css(styles$K.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$K.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$K.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$K.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$K.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$K.arrayElement, !elementIsLeaf && styles$K.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$K.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$K = 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
@@ -25830,7 +25830,7 @@ class CSProgramEditor extends React__namespace.Component {
25830
25830
 
25831
25831
  /* eslint-disable @khanacademy/ts-no-error-suppressions */
25832
25832
  const {
25833
- TextInput: TextInput$9
25833
+ TextInput: TextInput$8
25834
25834
  } = perseus.components;
25835
25835
  class DefinitionEditor extends React__namespace.Component {
25836
25836
  static propTypes = {
@@ -25864,7 +25864,7 @@ class DefinitionEditor extends React__namespace.Component {
25864
25864
  target: "_blank"
25865
25865
  }, "Definition style guide"), /*#__PURE__*/React__namespace.createElement("div", {
25866
25866
  className: "perseus-widget-row"
25867
- }, /*#__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, {
25868
25868
  value: this.props.togglePrompt
25869
25869
  // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
25870
25870
  ,
@@ -26274,7 +26274,7 @@ class ExampleWidgetEditor extends React__namespace.Component {
26274
26274
 
26275
26275
  /* eslint-disable @khanacademy/ts-no-error-suppressions */
26276
26276
  const {
26277
- TextInput: TextInput$8
26277
+ TextInput: TextInput$7
26278
26278
  } = perseus.components;
26279
26279
  const defaultExplanationProps = {
26280
26280
  showPrompt: "Explain",
@@ -26311,14 +26311,14 @@ class ExplanationEditor extends React__namespace.Component {
26311
26311
  className: "perseus-widget-explanation-editor"
26312
26312
  }, /*#__PURE__*/React__namespace.createElement("div", {
26313
26313
  className: "perseus-widget-row"
26314
- }, /*#__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, {
26315
26315
  value: this.props.showPrompt
26316
26316
  // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
26317
26317
  ,
26318
26318
  onChange: this.change("showPrompt")
26319
26319
  }))), /*#__PURE__*/React__namespace.createElement("div", {
26320
26320
  className: "perseus-widget-row"
26321
- }, /*#__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, {
26322
26322
  value: this.props.hidePrompt
26323
26323
  // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
26324
26324
  ,
@@ -26346,9 +26346,106 @@ class ExplanationEditor extends React__namespace.Component {
26346
26346
  }
26347
26347
  }
26348
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
+
26349
26441
  const PT = PropTypes__default["default"];
26350
26442
 
26351
- // 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
+ */
26352
26449
  // eslint-disable-next-line react/no-unsafe
26353
26450
  const SortableArea = createReactClass__default["default"]({
26354
26451
  displayName: "SortableArea",
@@ -26505,6 +26602,7 @@ const SortableItem = createReactClass__default["default"]({
26505
26602
  e.preventDefault();
26506
26603
  },
26507
26604
  render: function () {
26605
+ // I think these might be getting styles from Webapp
26508
26606
  let dragState = "sortable-disabled";
26509
26607
  if (this.props.dragging) {
26510
26608
  dragState = "sortable-dragging";
@@ -26513,7 +26611,7 @@ const SortableItem = createReactClass__default["default"]({
26513
26611
  }
26514
26612
  return /*#__PURE__*/React__namespace.createElement("li", {
26515
26613
  draggable: this.props.draggable,
26516
- className: dragState,
26614
+ className: [dragState, aphrodite.css(styles$K.sortableListItem)].join(" "),
26517
26615
  onDragStart: this.handleDragStart,
26518
26616
  onDrop: this.handleDrop,
26519
26617
  onDragEnter: this.handleDragEnter,
@@ -26521,10 +26619,14 @@ const SortableItem = createReactClass__default["default"]({
26521
26619
  }, this.props.component);
26522
26620
  }
26523
26621
  });
26622
+ const styles$K = aphrodite.StyleSheet.create({
26623
+ sortableListItem: {
26624
+ margin: "5px 0"
26625
+ }
26626
+ });
26524
26627
 
26525
26628
  const {
26526
- InfoTip: InfoTip$i,
26527
- TextInput: TextInput$7
26629
+ InfoTip: InfoTip$i
26528
26630
  } = perseus.components;
26529
26631
 
26530
26632
  // types for iterables
@@ -26571,6 +26673,12 @@ class ExpressionEditor extends React__namespace.Component {
26571
26673
  buttonSets: ["basic"],
26572
26674
  functions: ["f", "g", "h"]
26573
26675
  };
26676
+ constructor(props) {
26677
+ super(props);
26678
+ this.state = {
26679
+ functionsInternal: this.props.functions.join(" ")
26680
+ };
26681
+ }
26574
26682
  change() {
26575
26683
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
26576
26684
  args[_key] = arguments[_key];
@@ -26607,81 +26715,69 @@ class ExpressionEditor extends React__namespace.Component {
26607
26715
  }, obj)));
26608
26716
  const sortable = /*#__PURE__*/React__namespace.createElement(SortableArea, {
26609
26717
  components: answerOptions,
26610
- onReorder: this.handleReorder,
26611
- className: "answer-options-list"
26718
+ onReorder: this.handleReorder
26612
26719
  });
26613
26720
 
26614
26721
  // checkboxes to choose which sets of input buttons are shown
26615
26722
  const buttonSetChoices = buttonSetsList.map(name => {
26616
26723
  // The first one gets special cased to always be checked, disabled,
26617
26724
  // and float left.
26618
- const isFirst = name === "basic";
26619
- const checked = this.props.buttonSets.includes(name) || isFirst;
26620
- return /*#__PURE__*/React__namespace.createElement("label", {
26621
- className: "button-set-label",
26622
- key: name
26623
- }, /*#__PURE__*/React__namespace.createElement("input", {
26624
- 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,
26625
26730
  checked: checked,
26626
- disabled: isFirst,
26731
+ disabled: isBasic,
26627
26732
  onChange: () => this.handleButtonSet(name)
26628
- }), name);
26733
+ });
26629
26734
  });
26630
- const {
26631
- TeX
26632
- } = perseus.Dependencies.getDependencies(); // OldExpression only
26633
-
26634
- buttonSetChoices.unshift( /*#__PURE__*/React__namespace.createElement("label", {
26635
- className: "button-set-label",
26636
- key: "show-div"
26637
- }, /*#__PURE__*/React__namespace.createElement("input", {
26638
- 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"),
26639
26739
  onChange: this.handleToggleDiv
26640
- }), /*#__PURE__*/React__namespace.createElement("span", {
26641
- className: "show-div-button"
26642
- }, "show ", /*#__PURE__*/React__namespace.createElement(TeX, null, "\\div"), " button")));
26643
- return /*#__PURE__*/React__namespace.createElement("div", {
26644
- className: "perseus-widget-expression-editor"
26645
- }, /*#__PURE__*/React__namespace.createElement("h3", {
26646
- className: "expression-editor-h3"
26647
- }, "Global Options"), /*#__PURE__*/React__namespace.createElement("div", {
26648
- className: "perseus-widget-row"
26649
- }, /*#__PURE__*/React__namespace.createElement("label", null, "Visible label:", " ", /*#__PURE__*/React__namespace.createElement(TextInput$7, {
26650
- 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 || "",
26651
26746
  onChange: this.change("visibleLabel")
26652
- })), /*#__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", {
26653
- className: "perseus-widget-row"
26654
- }, /*#__PURE__*/React__namespace.createElement("label", null, "Aria label:", " ", /*#__PURE__*/React__namespace.createElement(TextInput$7, {
26655
- 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 || "",
26656
26752
  onChange: this.change("ariaLabel")
26657
- })), /*#__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", {
26658
26754
  href: "https://www.w3.org/WAI/tips/designing/#ensure-that-form-elements-include-clearly-associated-labels",
26659
26755
  target: "_blank"
26660
- }, "this article.")))), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
26661
- label: "Use \xD7 for rendering multiplication instead of a center dot.",
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,
26761
+ onChange: this.handleFunctions
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",
26662
26766
  checked: this.props.times,
26663
26767
  onChange: value => {
26664
26768
  this.props.onChange({
26665
26769
  times: value
26666
26770
  });
26667
26771
  }
26668
- }), /*#__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", {
26669
- type: "text",
26670
- defaultValue: this.props.functions.join(" "),
26671
- onChange: this.handleFunctions
26672
- })), /*#__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", {
26673
- className: "expression-editor-h3"
26674
- }, "Answers"), /*#__PURE__*/React__namespace.createElement("p", {
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", {
26675
26775
  style: {
26676
26776
  margin: "4px 0"
26677
26777
  }
26678
- }, "student responses area matched against these from top to bottom"), sortable, /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("button", {
26679
- className: "simple-button orange",
26680
- style: {
26681
- fontSize: 13
26682
- },
26683
- onClick: this.newAnswer,
26684
- 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
26685
26781
  }, "Add new answer")));
26686
26782
  }
26687
26783
  serialize = () => {
@@ -26816,9 +26912,12 @@ class ExpressionEditor extends React__namespace.Component {
26816
26912
  };
26817
26913
 
26818
26914
  // called when the function variables change
26819
- handleFunctions = e => {
26915
+ handleFunctions = value => {
26916
+ this.setState({
26917
+ functionsInternal: value
26918
+ });
26820
26919
  const newProps = {};
26821
- newProps.functions = e.target.value.split(/[ ,]+/).filter(wonderStuffCore.isTruthy);
26920
+ newProps.functions = value.split(/[ ,]+/).filter(wonderStuffCore.isTruthy);
26822
26921
  this.props.onChange(newProps);
26823
26922
  };
26824
26923
  }
@@ -26833,11 +26932,6 @@ class AnswerOption extends React__namespace.Component {
26833
26932
  state = {
26834
26933
  deleteFocused: false
26835
26934
  };
26836
- handleDeleteBlur = () => {
26837
- this.setState({
26838
- deleteFocused: false
26839
- });
26840
- };
26841
26935
  change = (() => {
26842
26936
  var _this = this;
26843
26937
  return function () {
@@ -26848,36 +26942,34 @@ class AnswerOption extends React__namespace.Component {
26848
26942
  };
26849
26943
  })();
26850
26944
  render() {
26851
- let removeButton = null;
26852
- if (this.state.deleteFocused) {
26853
- removeButton = /*#__PURE__*/React__namespace.createElement("button", {
26854
- type: "button",
26855
- className: "simple-button orange",
26856
- onClick: this.handleImSure,
26857
- onBlur: this.handleDeleteBlur
26858
- }, "I'm sure!");
26859
- } else {
26860
- removeButton = /*#__PURE__*/React__namespace.createElement("button", {
26861
- type: "button",
26862
- className: "simple-button orange",
26863
- onClick: this.handleDelete
26864
- }, "Delete");
26865
- }
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);
26866
26962
  return /*#__PURE__*/React__namespace.createElement("div", {
26867
- className: "expression-answer-option"
26963
+ className: aphrodite.css(styles$J.answerOption)
26868
26964
  }, /*#__PURE__*/React__namespace.createElement("div", {
26869
- className: "answer-handle"
26965
+ className: aphrodite.css(styles$J.answerHandle)
26870
26966
  }), /*#__PURE__*/React__namespace.createElement("div", {
26871
- className: "answer-body"
26872
- }, /*#__PURE__*/React__namespace.createElement("div", {
26873
- className: "answer-considered"
26874
- }, /*#__PURE__*/React__namespace.createElement("div", {
26967
+ className: aphrodite.css(styles$J.answerBody)
26968
+ }, /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("button", {
26875
26969
  onClick: this.toggleConsidered,
26876
- className: "answer-status " + this.props.considered
26877
- }, this.props.considered), /*#__PURE__*/React__namespace.createElement("div", {
26878
- className: "answer-expression"
26879
- }, /*#__PURE__*/React__namespace.createElement(perseus.Expression, this.props.expressionProps))), /*#__PURE__*/React__namespace.createElement("div", {
26880
- className: "answer-option"
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)
26881
26973
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
26882
26974
  label: "Answer expression must have the same form.",
26883
26975
  checked: this.props.form,
@@ -26887,7 +26979,7 @@ class AnswerOption extends React__namespace.Component {
26887
26979
  });
26888
26980
  }
26889
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", {
26890
- className: "answer-option"
26982
+ className: aphrodite.css(styles$J.paddedY, styles$J.paddedX)
26891
26983
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
26892
26984
  label: "Answer expression must be fully expanded and simplified.",
26893
26985
  checked: this.props.simplify,
@@ -26897,12 +26989,17 @@ class AnswerOption extends React__namespace.Component {
26897
26989
  });
26898
26990
  }
26899
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", {
26900
- className: "remove-container"
26992
+ className: aphrodite.css(styles$J.buttonRow, styles$J.paddedY)
26901
26993
  }, removeButton)));
26902
26994
  }
26903
26995
  handleImSure = () => {
26904
26996
  this.props.onDelete();
26905
26997
  };
26998
+ handleCancelDelete = () => {
26999
+ this.setState({
27000
+ deleteFocused: false
27001
+ });
27002
+ };
26906
27003
  handleDelete = () => {
26907
27004
  this.setState({
26908
27005
  deleteFocused: true
@@ -26915,6 +27012,49 @@ class AnswerOption extends React__namespace.Component {
26915
27012
  });
26916
27013
  };
26917
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
+ });
26918
27058
 
26919
27059
  /* eslint-disable @khanacademy/ts-no-error-suppressions */
26920
27060
  const {
@@ -26974,10 +27114,10 @@ class GradedGroupEditor extends React__namespace.Component {
26974
27114
  }, /*#__PURE__*/React__namespace.createElement("div", {
26975
27115
  className: "perseus-widget-row"
26976
27116
  }, /*#__PURE__*/React__namespace.createElement("label", {
26977
- className: aphrodite.css(styles$J.title)
27117
+ className: aphrodite.css(styles$I.title)
26978
27118
  }, "Title:", " ", /*#__PURE__*/React__namespace.createElement(TextInput$6, {
26979
27119
  value: this.props.title,
26980
- className: aphrodite.css(styles$J.input)
27120
+ className: aphrodite.css(styles$I.input)
26981
27121
  // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
26982
27122
  ,
26983
27123
  onChange: this.change("title")
@@ -27002,7 +27142,7 @@ class GradedGroupEditor extends React__namespace.Component {
27002
27142
  }, /*#__PURE__*/React__namespace.createElement(InlineIcon$3, iconPlus$1), " Add a hint"), this.props.hint && /*#__PURE__*/React__namespace.createElement("div", {
27003
27143
  className: "perseus-hint-editor"
27004
27144
  }, /*#__PURE__*/React__namespace.createElement("div", {
27005
- className: aphrodite.css(styles$J.hintsTitle)
27145
+ className: aphrodite.css(styles$I.hintsTitle)
27006
27146
  }, "Hint"), /*#__PURE__*/React__namespace.createElement(Editor, {
27007
27147
  ref: this.hintEditor,
27008
27148
  content: this.props.hint ? this.props.hint.content : "",
@@ -27034,7 +27174,7 @@ class GradedGroupEditor extends React__namespace.Component {
27034
27174
  };
27035
27175
  };
27036
27176
  }
27037
- const styles$J = aphrodite.StyleSheet.create({
27177
+ const styles$I = aphrodite.StyleSheet.create({
27038
27178
  title: {
27039
27179
  fontSize: 18,
27040
27180
  fontWeight: "bold"
@@ -28421,13 +28561,13 @@ function MathquillInput(props) {
28421
28561
  }
28422
28562
  });
28423
28563
  return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
28424
- style: styles$I.outerWrapper
28564
+ style: styles$H.outerWrapper
28425
28565
  }, /*#__PURE__*/React__namespace.createElement("span", {
28426
28566
  ref: mathFieldWrapperRef,
28427
28567
  className: "perseus-math-input mq-editable-field mq-math-mode"
28428
28568
  }));
28429
28569
  }
28430
- const styles$I = aphrodite.StyleSheet.create({
28570
+ const styles$H = aphrodite.StyleSheet.create({
28431
28571
  outerWrapper: {
28432
28572
  display: "inline-block",
28433
28573
  borderStyle: "solid",
@@ -29497,16 +29637,16 @@ const LabeledRow = props => {
29497
29637
  style
29498
29638
  } = props;
29499
29639
  return /*#__PURE__*/React__namespace.createElement("label", {
29500
- className: aphrodite.css(styles$H.label)
29640
+ className: aphrodite.css(styles$G.label)
29501
29641
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
29502
- style: [styles$H.row, style]
29642
+ style: [styles$G.row, style]
29503
29643
  }, labelSide === "start" || /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelSmall, {
29504
- style: styles$H.spaceEnd
29644
+ style: styles$G.spaceEnd
29505
29645
  }, label), children, labelSide === "end" && /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelSmall, {
29506
- style: styles$H.spaceStart
29646
+ style: styles$G.spaceStart
29507
29647
  }, label)));
29508
29648
  };
29509
- const styles$H = aphrodite.StyleSheet.create({
29649
+ const styles$G = aphrodite.StyleSheet.create({
29510
29650
  label: {
29511
29651
  width: "fit-content"
29512
29652
  },
@@ -29524,98 +29664,6 @@ const styles$H = aphrodite.StyleSheet.create({
29524
29664
  }
29525
29665
  });
29526
29666
 
29527
- const mediaDefaultSpecLargeMarginWidth = wonderBlocksTokens.spacing.large_24;
29528
- const MEDIA_DEFAULT_SPEC = {
29529
- small: {
29530
- query: "(max-width: 767px)",
29531
- totalColumns: 4,
29532
- gutterWidth: wonderBlocksTokens.spacing.medium_16,
29533
- marginWidth: wonderBlocksTokens.spacing.medium_16
29534
- },
29535
- medium: {
29536
- query: "(min-width: 768px) and (max-width: 1023px)",
29537
- totalColumns: 8,
29538
- gutterWidth: wonderBlocksTokens.spacing.xLarge_32,
29539
- marginWidth: wonderBlocksTokens.spacing.large_24
29540
- },
29541
- large: {
29542
- query: "(min-width: 1024px)",
29543
- totalColumns: 12,
29544
- gutterWidth: wonderBlocksTokens.spacing.xLarge_32,
29545
- marginWidth: mediaDefaultSpecLargeMarginWidth,
29546
- maxWidth: 1120 + mediaDefaultSpecLargeMarginWidth * 2
29547
- }
29548
- };
29549
- ({
29550
- large: {
29551
- query: "(min-width: 1px)",
29552
- totalColumns: 12,
29553
- gutterWidth: wonderBlocksTokens.spacing.xLarge_32,
29554
- marginWidth: wonderBlocksTokens.spacing.medium_16
29555
- }
29556
- });
29557
- ({
29558
- small: {
29559
- query: "(max-width: 767px)",
29560
- totalColumns: 4,
29561
- gutterWidth: wonderBlocksTokens.spacing.medium_16,
29562
- marginWidth: wonderBlocksTokens.spacing.medium_16
29563
- },
29564
- large: {
29565
- query: "(min-width: 768px)",
29566
- totalColumns: 12,
29567
- gutterWidth: wonderBlocksTokens.spacing.xLarge_32,
29568
- marginWidth: wonderBlocksTokens.spacing.xxLarge_48
29569
- }
29570
- });
29571
-
29572
- const defaultContext = {
29573
- ssrSize: "large",
29574
- mediaSpec: MEDIA_DEFAULT_SPEC
29575
- };
29576
- const MediaLayoutContext = React__namespace.createContext(defaultContext);
29577
- MediaLayoutContext.displayName = "MediaLayoutContext";
29578
-
29579
- class Spring extends React__namespace.Component {
29580
- render() {
29581
- const {
29582
- style
29583
- } = this.props;
29584
- return React__namespace.createElement(wonderBlocksCore.View, {
29585
- "aria-hidden": "true",
29586
- style: [styles$G.grow, style]
29587
- });
29588
- }
29589
- }
29590
- const styles$G = aphrodite.StyleSheet.create({
29591
- grow: {
29592
- flexGrow: 1
29593
- }
29594
- });
29595
-
29596
- class Strut extends React__namespace.Component {
29597
- render() {
29598
- const {
29599
- size,
29600
- style
29601
- } = this.props;
29602
- return React__namespace.createElement(wonderBlocksCore.View, {
29603
- "aria-hidden": "true",
29604
- style: [strutStyle(size), style]
29605
- });
29606
- }
29607
- }
29608
- const strutStyle = size => {
29609
- return {
29610
- width: size,
29611
- MsFlexBasis: size,
29612
- MsFlexPreferredSize: size,
29613
- WebkitFlexBasis: size,
29614
- flexBasis: size,
29615
- flexShrink: 0
29616
- };
29617
- };
29618
-
29619
29667
  function Heading(_ref) {
29620
29668
  let {
29621
29669
  title,
@@ -32063,6 +32111,29 @@ const StartCoordsCircle = props => {
32063
32111
  startCoords,
32064
32112
  onChange
32065
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
+ }
32066
32137
  return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
32067
32138
  style: styles$g.tile
32068
32139
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
@@ -32078,18 +32149,14 @@ const StartCoordsCircle = props => {
32078
32149
  })
32079
32150
  })), /*#__PURE__*/React__namespace.createElement(Strut, {
32080
32151
  size: wonderBlocksTokens.spacing.small_12
32081
- }), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
32152
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, {
32153
+ tag: "label",
32082
32154
  style: styles$g.row
32083
- }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, "Radius:"), /*#__PURE__*/React__namespace.createElement(Strut, {
32155
+ }, "Radius:", /*#__PURE__*/React__namespace.createElement(Strut, {
32084
32156
  size: wonderBlocksTokens.spacing.small_12
32085
32157
  }), /*#__PURE__*/React__namespace.createElement(ScrolllessNumberTextField, {
32086
- value: startCoords.radius.toString(),
32087
- onChange: value => {
32088
- onChange({
32089
- center: startCoords.center,
32090
- radius: parseFloat(value)
32091
- });
32092
- },
32158
+ value: radiusState,
32159
+ onChange: handleRadiuschange,
32093
32160
  style: styles$g.textField
32094
32161
  })));
32095
32162
  };
@@ -32101,6 +32168,7 @@ const styles$g = aphrodite.StyleSheet.create({
32101
32168
  borderRadius: wonderBlocksTokens.spacing.xSmall_8
32102
32169
  },
32103
32170
  row: {
32171
+ display: "flex",
32104
32172
  flexDirection: "row",
32105
32173
  alignItems: "center"
32106
32174
  },
@@ -35207,7 +35275,7 @@ class NumericInputEditor extends React__namespace.Component {
35207
35275
  }));
35208
35276
  const labelText = /*#__PURE__*/React__namespace.createElement("div", {
35209
35277
  className: "perseus-widget-row"
35210
- }, /*#__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, {
35211
35279
  value: this.props.labelText,
35212
35280
  onChange: this.change("labelText")
35213
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.")));
@@ -35351,11 +35419,11 @@ class NumericInputEditor extends React__namespace.Component {
35351
35419
  });
35352
35420
  return /*#__PURE__*/React__namespace.createElement("div", {
35353
35421
  className: "perseus-input-number-editor"
35354
- }, /*#__PURE__*/React__namespace.createElement("div", {
35422
+ }, labelText, inputSize, rightAlign, coefficientCheck, /*#__PURE__*/React__namespace.createElement("div", {
35355
35423
  className: "ui-title"
35356
35424
  }, "User input"), /*#__PURE__*/React__namespace.createElement("div", {
35357
35425
  className: "msg-title"
35358
- }, "Message shown to user on attempt"), generateInputAnswerEditors(), addAnswerButton, inputSize, rightAlign, coefficientCheck, labelText);
35426
+ }, "Message shown to user on attempt"), generateInputAnswerEditors(), addAnswerButton);
35359
35427
  }
35360
35428
  change = (() => {
35361
35429
  var _this = this;