@khanacademy/perseus-editor 6.0.3 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/es/index.js CHANGED
@@ -22,14 +22,13 @@ import { SingleSelect, OptionItem, ActionMenu, ActionItem } from '@khanacademy/w
22
22
  import { TextField, Checkbox as Checkbox$1 } from '@khanacademy/wonder-blocks-form';
23
23
  import { LabelSmall, LabelMedium, LabelLarge, BodyMonospace } from '@khanacademy/wonder-blocks-typography';
24
24
  import { AccordionSection } from '@khanacademy/wonder-blocks-accordion';
25
- import IconButton from '@khanacademy/wonder-blocks-icon-button';
25
+ import Button from '@khanacademy/wonder-blocks-button';
26
26
  import trashIcon from '@phosphor-icons/core/bold/trash-bold.svg';
27
27
  import Switch from '@khanacademy/wonder-blocks-switch';
28
- import Button from '@khanacademy/wonder-blocks-button';
29
28
 
30
29
  // This file is processed by a Rollup plugin (replace) to inject the production
31
30
  const libName = "@khanacademy/perseus-editor";
32
- const libVersion = "6.0.3";
31
+ const libVersion = "6.1.0";
33
32
  addLibraryVersionToPerseusDebug(libName, libVersion);
34
33
 
35
34
  function _extends() {
@@ -219,7 +218,7 @@ class SectionControlButton extends React.Component {
219
218
  role: "button",
220
219
  hideDefaultFocusRing: true,
221
220
  "aria-label": title,
222
- style: styles$s.button
221
+ style: styles$t.button
223
222
  }, ({
224
223
  hovered,
225
224
  focused,
@@ -227,7 +226,7 @@ class SectionControlButton extends React.Component {
227
226
  }) => /*#__PURE__*/React.createElement(InlineIcon$b, icon));
228
227
  }
229
228
  }
230
- const styles$s = StyleSheet.create({
229
+ const styles$t = StyleSheet.create({
231
230
  button: {
232
231
  backgroundColor: color.gold,
233
232
  margin: 2,
@@ -20749,19 +20748,19 @@ class TexErrorView extends React.Component {
20749
20748
  const {
20750
20749
  showErrors
20751
20750
  } = this.state;
20752
- const iconStyle = showErrors ? styles$r.iconExpanded : styles$r.iconCollapsed;
20751
+ const iconStyle = showErrors ? styles$s.iconExpanded : styles$s.iconCollapsed;
20753
20752
  return /*#__PURE__*/React.createElement(View, {
20754
- style: styles$r.errorContainer
20753
+ style: styles$s.errorContainer
20755
20754
  }, /*#__PURE__*/React.createElement(View, {
20756
- style: styles$r.title,
20755
+ style: styles$s.title,
20757
20756
  onClick: this.handleToggleTexErrors
20758
20757
  }, /*#__PURE__*/React.createElement(PhosphorIcon, {
20759
20758
  icon: caretRight,
20760
20759
  style: iconStyle
20761
20760
  }), "\xA0 TeX Errors (", errorList.length, ")"), showErrors && /*#__PURE__*/React.createElement(View, {
20762
- style: styles$r.errorExplanation
20761
+ style: styles$s.errorExplanation
20763
20762
  }, "If your math doesn't display correctly, these errors might help you troubleshoot. Message #content-kitchen for help."), showErrors && errorList.map((e, index) => /*#__PURE__*/React.createElement(View, {
20764
- style: styles$r.error,
20763
+ style: styles$s.error,
20765
20764
  key: index
20766
20765
  }, /*#__PURE__*/React.createElement(View, {
20767
20766
  style: {
@@ -20770,7 +20769,7 @@ class TexErrorView extends React.Component {
20770
20769
  }, e.math), /*#__PURE__*/React.createElement(View, null, e.message))));
20771
20770
  }
20772
20771
  }
20773
- const styles$r = StyleSheet.create({
20772
+ const styles$s = StyleSheet.create({
20774
20773
  title: {
20775
20774
  backgroundColor: "#eee",
20776
20775
  fontSize: "1.25em",
@@ -24571,7 +24570,7 @@ class SimpleButton extends React.Component {
24571
24570
  } = _this$props,
24572
24571
  otherProps = _objectWithoutPropertiesLoose(_this$props, _excluded$3);
24573
24572
  return /*#__PURE__*/React.createElement("div", _extends({
24574
- className: css(styles$q.baseButton, color === "green" && styles$q.green, color === "orange" && styles$q.orange),
24573
+ className: css(styles$r.baseButton, color === "green" && styles$r.green, color === "orange" && styles$r.orange),
24575
24574
  onClick: onClick
24576
24575
  }, otherProps), children);
24577
24576
  }
@@ -24586,7 +24585,7 @@ SimpleButton.defaultProps = {
24586
24585
  color: "green",
24587
24586
  onClick: () => {}
24588
24587
  };
24589
- const styles$q = StyleSheet.create({
24588
+ const styles$r = StyleSheet.create({
24590
24589
  baseButton: {
24591
24590
  top: "0",
24592
24591
  fontSize: "11px",
@@ -24806,23 +24805,23 @@ const LeafContainer = ({
24806
24805
  }) => {
24807
24806
  const hasPreviewHeading = shape.type === "content" || shape.type === "hint";
24808
24807
  const previewHeading = hasPreviewHeading && /*#__PURE__*/React.createElement("div", {
24809
- className: css(styles$p.containerHeader)
24808
+ className: css(styles$q.containerHeader)
24810
24809
  }, /*#__PURE__*/React.createElement(Header, {
24811
24810
  depth: path.length,
24812
- className: css(styles$p.containerTitle)
24811
+ className: css(styles$q.containerTitle)
24813
24812
  }, capitalize(name)));
24814
24813
  return /*#__PURE__*/React.createElement("div", {
24815
- className: css(styles$p.container)
24814
+ className: css(styles$q.container)
24816
24815
  }, /*#__PURE__*/React.createElement("span", {
24817
- className: css(styles$p.row, styles$p.rowHeading)
24816
+ className: css(styles$q.row, styles$q.rowHeading)
24818
24817
  }, /*#__PURE__*/React.createElement("div", {
24819
- className: css(styles$p.columnLeft)
24818
+ className: css(styles$q.columnLeft)
24820
24819
  }, /*#__PURE__*/React.createElement("div", {
24821
- className: "pod-title " + css(styles$p.containerHeader)
24820
+ className: "pod-title " + css(styles$q.containerHeader)
24822
24821
  }, /*#__PURE__*/React.createElement("div", {
24823
- className: css(styles$p.containerTitle)
24822
+ className: css(styles$q.containerTitle)
24824
24823
  }, capitalize(name)), controls)), /*#__PURE__*/React.createElement("div", {
24825
- className: css(styles$p.columnRight)
24824
+ className: css(styles$q.columnRight)
24826
24825
  }, previewHeading)), children);
24827
24826
  };
24828
24827
  const ArrayContainer = props => {
@@ -24835,11 +24834,11 @@ const ArrayContainer = props => {
24835
24834
  actions
24836
24835
  } = props;
24837
24836
  return /*#__PURE__*/React.createElement("div", {
24838
- className: css(styles$p.container)
24837
+ className: css(styles$q.container)
24839
24838
  }, controls && /*#__PURE__*/React.createElement("div", {
24840
- className: css(styles$p.columnLeft, styles$p.containerHeader)
24839
+ className: css(styles$q.columnLeft, styles$q.containerHeader)
24841
24840
  }, controls), /*#__PURE__*/React.createElement("div", null, children), /*#__PURE__*/React.createElement("div", {
24842
- className: css(styles$p.columnLeft)
24841
+ className: css(styles$q.columnLeft)
24843
24842
  }, /*#__PURE__*/React.createElement("a", {
24844
24843
  href: "javascript:void 0",
24845
24844
  onClick: () => actions.addArrayElement(path, shape.elementShape)
@@ -24852,28 +24851,28 @@ const ObjectContainer = ({
24852
24851
  path
24853
24852
  }) => {
24854
24853
  const headingEditor = /*#__PURE__*/React.createElement("div", {
24855
- className: css(styles$p.containerHeader)
24854
+ className: css(styles$q.containerHeader)
24856
24855
  }, /*#__PURE__*/React.createElement(Header, {
24857
24856
  depth: path.length,
24858
- className: css(styles$p.containerTitle)
24857
+ className: css(styles$q.containerTitle)
24859
24858
  }, capitalize(name)), controls);
24860
24859
  const headingPreview = (name || controls) && /*#__PURE__*/React.createElement("div", {
24861
- className: css(styles$p.containerHeader, styles$p.previewCollectionHeader)
24860
+ className: css(styles$q.containerHeader, styles$q.previewCollectionHeader)
24862
24861
  }, /*#__PURE__*/React.createElement(Header, {
24863
24862
  depth: path.length,
24864
- className: css(styles$p.containerTitle)
24863
+ className: css(styles$q.containerTitle)
24865
24864
  }, capitalize(name)));
24866
24865
  const hasBothHeadings = headingEditor && headingPreview;
24867
24866
  return /*#__PURE__*/React.createElement("div", {
24868
- className: css(styles$p.container)
24867
+ className: css(styles$q.container)
24869
24868
  }, hasBothHeadings && /*#__PURE__*/React.createElement("span", {
24870
- className: css(styles$p.row)
24869
+ className: css(styles$q.row)
24871
24870
  }, /*#__PURE__*/React.createElement("div", {
24872
- className: css(styles$p.columnLeft)
24871
+ className: css(styles$q.columnLeft)
24873
24872
  }, headingEditor), /*#__PURE__*/React.createElement("div", {
24874
- className: css(styles$p.columnRight)
24873
+ className: css(styles$q.columnRight)
24875
24874
  }, headingPreview)), /*#__PURE__*/React.createElement("div", {
24876
- className: css(path.length > 0 && styles$p.contentIndent)
24875
+ className: css(path.length > 0 && styles$q.contentIndent)
24877
24876
  }, children));
24878
24877
  };
24879
24878
 
@@ -24996,11 +24995,11 @@ const ItemNodeContent = withStickiness(props => {
24996
24995
  className: "framework-perseus"
24997
24996
  }, lens(renderers).get(path));
24998
24997
  return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("div", {
24999
- className: css(styles$p.row)
24998
+ className: css(styles$q.row)
25000
24999
  }, /*#__PURE__*/React.createElement("div", {
25001
- className: css(styles$p.columnLeft)
25000
+ className: css(styles$q.columnLeft)
25002
25001
  }, /*#__PURE__*/React.createElement("div", {
25003
- className: css(sticky && styles$p.sticky)
25002
+ className: css(sticky && styles$q.sticky)
25004
25003
  },
25005
25004
  /*#__PURE__*/
25006
25005
  // @ts-expect-error - TS2769 - No overload matches this call.
@@ -25008,9 +25007,9 @@ const ItemNodeContent = withStickiness(props => {
25008
25007
  onChange: newVal => actions.mergeValueAtPath(path, newVal),
25009
25008
  apiOptions: apiOptions
25010
25009
  })))), /*#__PURE__*/React.createElement("div", {
25011
- className: css(styles$p.columnRight)
25010
+ className: css(styles$q.columnRight)
25012
25011
  }, /*#__PURE__*/React.createElement("div", {
25013
- className: css(sticky && styles$p.sticky)
25012
+ className: css(sticky && styles$q.sticky)
25014
25013
  }, preview))));
25015
25014
  });
25016
25015
  const HintNodeContent = withStickiness(props => {
@@ -25026,13 +25025,13 @@ const HintNodeContent = withStickiness(props => {
25026
25025
  className: "framework-perseus"
25027
25026
  }, lens(renderers).get(path));
25028
25027
  return /*#__PURE__*/React.createElement("div", {
25029
- className: css(styles$p.row)
25028
+ className: css(styles$q.row)
25030
25029
  }, /*#__PURE__*/React.createElement("div", {
25031
- className: css(styles$p.columnLeft)
25030
+ className: css(styles$q.columnLeft)
25032
25031
  }, /*#__PURE__*/React.createElement("div", {
25033
- className: css(sticky && styles$p.sticky)
25032
+ className: css(sticky && styles$q.sticky)
25034
25033
  }, /*#__PURE__*/React.createElement(HintEditor, _extends({}, data, {
25035
- className: css(styles$p.hintEditor),
25034
+ className: css(styles$q.hintEditor),
25036
25035
  onChange: newVal => actions.mergeValueAtPath(path, newVal),
25037
25036
  apiOptions: apiOptions,
25038
25037
  showTitle: false,
@@ -25047,9 +25046,9 @@ const HintNodeContent = withStickiness(props => {
25047
25046
  isFirst: true,
25048
25047
  isLast: true
25049
25048
  })))), /*#__PURE__*/React.createElement("div", {
25050
- className: css(styles$p.columnRight)
25049
+ className: css(styles$q.columnRight)
25051
25050
  }, /*#__PURE__*/React.createElement("div", {
25052
- className: css(sticky && styles$p.sticky)
25051
+ className: css(sticky && styles$q.sticky)
25053
25052
  }, preview)));
25054
25053
  });
25055
25054
  const TagsNodeContent = props => {
@@ -25066,9 +25065,9 @@ const TagsNodeContent = props => {
25066
25065
  return null;
25067
25066
  }
25068
25067
  return /*#__PURE__*/React.createElement("div", {
25069
- className: css(styles$p.columnLeft)
25068
+ className: css(styles$q.columnLeft)
25070
25069
  }, /*#__PURE__*/React.createElement("div", {
25071
- className: css(styles$p.tagsEditor)
25070
+ className: css(styles$q.tagsEditor)
25072
25071
  }, /*#__PURE__*/React.createElement(GroupMetadataEditor, {
25073
25072
  value: data,
25074
25073
  onChange: newVal => actions.setValueAtPath(path, newVal),
@@ -25099,23 +25098,23 @@ const ArrayNodeContent = props => {
25099
25098
  const subpath = path.concat(i);
25100
25099
  const controls = [i > 0 && /*#__PURE__*/React.createElement("div", {
25101
25100
  key: "moveArrayElementUp",
25102
- className: css(styles$p.control)
25101
+ className: css(styles$q.control)
25103
25102
  }, /*#__PURE__*/React.createElement(SimpleButton, {
25104
25103
  color: "orange",
25105
25104
  title: "Move up",
25106
25105
  onClick: () => actions.moveArrayElementUp(subpath)
25107
25106
  }, /*#__PURE__*/React.createElement("div", {
25108
- className: css(styles$p.verticalFlip)
25107
+ className: css(styles$q.verticalFlip)
25109
25108
  }, /*#__PURE__*/React.createElement(InlineIcon$6, iconChevronDown)))), i < data.length - 1 && /*#__PURE__*/React.createElement("div", {
25110
25109
  key: "moveArrayElementDown",
25111
- className: css(styles$p.control)
25110
+ className: css(styles$q.control)
25112
25111
  }, /*#__PURE__*/React.createElement(SimpleButton, {
25113
25112
  color: "orange",
25114
25113
  title: "Move down",
25115
25114
  onClick: () => actions.moveArrayElementDown(subpath)
25116
25115
  }, /*#__PURE__*/React.createElement(InlineIcon$6, iconChevronDown))), /*#__PURE__*/React.createElement("div", {
25117
25116
  key: "removeArrayElement",
25118
- className: css(styles$p.control)
25117
+ className: css(styles$q.control)
25119
25118
  }, /*#__PURE__*/React.createElement(SimpleButton, {
25120
25119
  color: "orange",
25121
25120
  title: "Delete",
@@ -25123,7 +25122,7 @@ const ArrayNodeContent = props => {
25123
25122
  }, /*#__PURE__*/React.createElement(InlineIcon$6, iconTrash$4)))];
25124
25123
  return /*#__PURE__*/React.createElement("div", {
25125
25124
  key: i,
25126
- className: css(styles$p.arrayElement, !elementIsLeaf && styles$p.arrayElementAndNotLeaf)
25125
+ className: css(styles$q.arrayElement, !elementIsLeaf && styles$q.arrayElementAndNotLeaf)
25127
25126
  }, /*#__PURE__*/React.createElement(NodeContainer, _extends({}, otherProps, {
25128
25127
  key: i,
25129
25128
  shape: shape.elementShape,
@@ -25149,7 +25148,7 @@ const ObjectNodeContent = props => {
25149
25148
  // made sense to the shape's author is the order in which we'll iterate :)
25150
25149
  const children = Object.keys(shape.shape).map(subkey => /*#__PURE__*/React.createElement("div", {
25151
25150
  key: subkey,
25152
- className: css(styles$p.objectElement)
25151
+ className: css(styles$q.objectElement)
25153
25152
  }, /*#__PURE__*/React.createElement(NodeContainer, _extends({}, otherProps, {
25154
25153
  shape: shape.shape[subkey],
25155
25154
  data: data[subkey],
@@ -25316,7 +25315,7 @@ class MultiRendererEditor extends React.Component {
25316
25315
  }, this._renderContent());
25317
25316
  }
25318
25317
  }
25319
- const styles$p = StyleSheet.create({
25318
+ const styles$q = StyleSheet.create({
25320
25319
  // This is used in a number of places throughout this file.
25321
25320
  container: {},
25322
25321
  // eslint-disable-next-line react-native/no-unused-styles
@@ -25468,47 +25467,47 @@ const StatefulArticleEditor = createReactClass({
25468
25467
  screen
25469
25468
  } = this.state;
25470
25469
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
25471
- style: styles$o.controlBar
25470
+ style: styles$p.controlBar
25472
25471
  }, /*#__PURE__*/React.createElement("span", {
25473
- style: styles$o.controls
25472
+ style: styles$p.controls
25474
25473
  }, "Mode:", " ", /*#__PURE__*/React.createElement("span", {
25475
25474
  onClick: () => this.setState({
25476
25475
  mode: "edit"
25477
25476
  }),
25478
- style: mode === "edit" ? styles$o.controlSelected : styles$o.control
25477
+ style: mode === "edit" ? styles$p.controlSelected : styles$p.control
25479
25478
  }, "EDIT"), " | ", /*#__PURE__*/React.createElement("span", {
25480
25479
  onClick: () => this.setState({
25481
25480
  mode: "preview"
25482
25481
  }),
25483
- style: mode === "preview" ? styles$o.controlSelected : styles$o.control
25482
+ style: mode === "preview" ? styles$p.controlSelected : styles$p.control
25484
25483
  }, "PREVIEW"), " | ", /*#__PURE__*/React.createElement("span", {
25485
25484
  onClick: () => this.setState({
25486
25485
  mode: "json"
25487
25486
  }),
25488
- style: mode === "json" ? styles$o.controlSelected : styles$o.control
25487
+ style: mode === "json" ? styles$p.controlSelected : styles$p.control
25489
25488
  }, "JSON")), /*#__PURE__*/React.createElement("span", {
25490
- style: styles$o.controls
25489
+ style: styles$p.controls
25491
25490
  }, "Screen:", " ", /*#__PURE__*/React.createElement("span", {
25492
25491
  onClick: () => this.setState({
25493
25492
  screen: "phone"
25494
25493
  }),
25495
- style: screen === "phone" ? styles$o.controlSelected : styles$o.control
25494
+ style: screen === "phone" ? styles$p.controlSelected : styles$p.control
25496
25495
  }, "PHONE"), " | ", /*#__PURE__*/React.createElement("span", {
25497
25496
  onClick: () => this.setState({
25498
25497
  screen: "tablet"
25499
25498
  }),
25500
- style: screen === "tablet" ? styles$o.controlSelected : styles$o.control
25499
+ style: screen === "tablet" ? styles$p.controlSelected : styles$p.control
25501
25500
  }, "TABLET"), " | ", /*#__PURE__*/React.createElement("span", {
25502
25501
  onClick: () => this.setState({
25503
25502
  screen: "desktop"
25504
25503
  }),
25505
- style: screen === "desktop" ? styles$o.controlSelected : styles$o.control
25504
+ style: screen === "desktop" ? styles$p.controlSelected : styles$p.control
25506
25505
  }, "DESKTOP"))), /*#__PURE__*/React.createElement("div", {
25507
- style: styles$o.editor
25506
+ style: styles$p.editor
25508
25507
  }, /*#__PURE__*/React.createElement(ArticleEditor, this.state)));
25509
25508
  }
25510
25509
  });
25511
- const styles$o = {
25510
+ const styles$p = {
25512
25511
  controlBar: {
25513
25512
  marginBottom: 25,
25514
25513
  marginTop: 5
@@ -26998,10 +26997,10 @@ class GradedGroupEditor extends React.Component {
26998
26997
  }, /*#__PURE__*/React.createElement("div", {
26999
26998
  className: "perseus-widget-row"
27000
26999
  }, /*#__PURE__*/React.createElement("label", {
27001
- className: css(styles$n.title)
27000
+ className: css(styles$o.title)
27002
27001
  }, "Title:", " ", /*#__PURE__*/React.createElement(TextInput$6, {
27003
27002
  value: this.props.title,
27004
- className: css(styles$n.input)
27003
+ className: css(styles$o.input)
27005
27004
  // @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
27006
27005
  ,
27007
27006
  onChange: this.change("title")
@@ -27026,7 +27025,7 @@ class GradedGroupEditor extends React.Component {
27026
27025
  }, /*#__PURE__*/React.createElement(InlineIcon$4, iconPlus$1), " Add a hint"), this.props.hint && /*#__PURE__*/React.createElement("div", {
27027
27026
  className: "perseus-hint-editor"
27028
27027
  }, /*#__PURE__*/React.createElement("div", {
27029
- className: css(styles$n.hintsTitle)
27028
+ className: css(styles$o.hintsTitle)
27030
27029
  }, "Hint"), /*#__PURE__*/React.createElement(Editor, {
27031
27030
  ref: this.hintEditor,
27032
27031
  content: this.props.hint ? this.props.hint.content : "",
@@ -27063,7 +27062,7 @@ GradedGroupEditor.defaultProps = {
27063
27062
  images: {},
27064
27063
  hint: null
27065
27064
  };
27066
- const styles$n = StyleSheet.create({
27065
+ const styles$o = StyleSheet.create({
27067
27066
  title: {
27068
27067
  fontSize: 18,
27069
27068
  fontWeight: "bold"
@@ -28401,13 +28400,13 @@ function MathquillInput(props) {
28401
28400
  }
28402
28401
  });
28403
28402
  return /*#__PURE__*/React.createElement(View, {
28404
- style: styles$m.outerWrapper
28403
+ style: styles$n.outerWrapper
28405
28404
  }, /*#__PURE__*/React.createElement("span", {
28406
28405
  ref: mathFieldWrapperRef,
28407
28406
  className: "perseus-math-input mq-editable-field mq-math-mode"
28408
28407
  }));
28409
28408
  }
28410
- const styles$m = StyleSheet.create({
28409
+ const styles$n = StyleSheet.create({
28411
28410
  outerWrapper: {
28412
28411
  display: "inline-block",
28413
28412
  borderStyle: "solid",
@@ -29468,7 +29467,7 @@ const GraphPointsCountSelector = ({
29468
29467
  // Never uses placeholder, always has value
29469
29468
  ,
29470
29469
  placeholder: "",
29471
- style: styles$l.singleSelectShort
29470
+ style: styles$m.singleSelectShort
29472
29471
  }, [...[...Array(7).keys()].map(n => /*#__PURE__*/React.createElement(OptionItem, {
29473
29472
  key: n,
29474
29473
  value: `${n}`,
@@ -29479,7 +29478,7 @@ const GraphPointsCountSelector = ({
29479
29478
  label: "unlimited"
29480
29479
  })]);
29481
29480
  };
29482
- const styles$l = StyleSheet.create({
29481
+ const styles$m = StyleSheet.create({
29483
29482
  singleSelectShort: {
29484
29483
  // Non-standard spacing, but it's the smallest we can go
29485
29484
  // without running into styling issues with the dropdown.
@@ -29492,7 +29491,7 @@ const GraphTypeSelector = props => {
29492
29491
  selectedValue: props.graphType,
29493
29492
  onChange: props.onChange,
29494
29493
  placeholder: "Select a graph type",
29495
- style: styles$k.singleSelectShort
29494
+ style: styles$l.singleSelectShort
29496
29495
  }, /*#__PURE__*/React.createElement(OptionItem, {
29497
29496
  value: "linear",
29498
29497
  label: "Linear function"
@@ -29525,7 +29524,7 @@ const GraphTypeSelector = props => {
29525
29524
  label: "Angle"
29526
29525
  }));
29527
29526
  };
29528
- const styles$k = StyleSheet.create({
29527
+ const styles$l = StyleSheet.create({
29529
29528
  singleSelectShort: {
29530
29529
  // Non-standard spacing, but it's the smallest we can go
29531
29530
  // without running into styling issues with the dropdown.
@@ -29542,16 +29541,16 @@ const LabeledRow = props => {
29542
29541
  style
29543
29542
  } = props;
29544
29543
  return /*#__PURE__*/React.createElement("label", {
29545
- className: css(styles$j.label)
29544
+ className: css(styles$k.label)
29546
29545
  }, /*#__PURE__*/React.createElement(View, {
29547
- style: [styles$j.row, style]
29546
+ style: [styles$k.row, style]
29548
29547
  }, labelSide === "start" || /*#__PURE__*/React.createElement(LabelSmall, {
29549
- style: styles$j.spaceEnd
29548
+ style: styles$k.spaceEnd
29550
29549
  }, label), children, labelSide === "end" && /*#__PURE__*/React.createElement(LabelSmall, {
29551
- style: styles$j.spaceStart
29550
+ style: styles$k.spaceStart
29552
29551
  }, label)));
29553
29552
  };
29554
- const styles$j = StyleSheet.create({
29553
+ const styles$k = StyleSheet.create({
29555
29554
  label: {
29556
29555
  width: "fit-content"
29557
29556
  },
@@ -29945,10 +29944,10 @@ class InteractiveGraphSettings extends React.Component {
29945
29944
  onChange: this.change
29946
29945
  }))), /*#__PURE__*/React.createElement(LabeledRow, {
29947
29946
  label: "Background image URL:",
29948
- style: styles$i.resetSpaceTop
29947
+ style: styles$j.resetSpaceTop
29949
29948
  }, /*#__PURE__*/React.createElement("input", {
29950
29949
  type: "text",
29951
- className: css(styles$i.backgroundUrlInput),
29950
+ className: css(styles$j.backgroundUrlInput),
29952
29951
  ref: this.bgUrlRef,
29953
29952
  value: this.state.backgroundImage.url || "",
29954
29953
  onChange: e => {
@@ -29962,24 +29961,24 @@ class InteractiveGraphSettings extends React.Component {
29962
29961
  onKeyPress: this.changeBackgroundUrl,
29963
29962
  onBlur: this.changeBackgroundUrl
29964
29963
  }), /*#__PURE__*/React.createElement(InfoTip$c, null, /*#__PURE__*/React.createElement("p", null, "Create an image in graphie, or use the \"Add image\" function to create a background."))), /*#__PURE__*/React.createElement(View, {
29965
- style: styles$i.rulerSection
29964
+ style: styles$j.rulerSection
29966
29965
  }, /*#__PURE__*/React.createElement(View, {
29967
- style: styles$i.checkboxRow
29966
+ style: styles$j.checkboxRow
29968
29967
  }, /*#__PURE__*/React.createElement(PropCheckBox$7, {
29969
29968
  label: "Show ruler",
29970
29969
  showRuler: this.props.showRuler,
29971
29970
  onChange: this.change,
29972
- style: styles$i.resetSpaceTop
29971
+ style: styles$j.resetSpaceTop
29973
29972
  }), /*#__PURE__*/React.createElement(PropCheckBox$7, {
29974
29973
  label: "Show protractor",
29975
29974
  showProtractor: this.props.showProtractor,
29976
29975
  onChange: this.change,
29977
- style: styles$i.resetSpaceTop
29976
+ style: styles$j.resetSpaceTop
29978
29977
  })), this.props.showRuler && /*#__PURE__*/React.createElement(View, {
29979
- style: styles$i.spaceTop
29978
+ style: styles$j.spaceTop
29980
29979
  }, /*#__PURE__*/React.createElement(LabeledRow, {
29981
29980
  label: "Ruler label:",
29982
- style: styles$i.resetSpaceTop
29981
+ style: styles$j.resetSpaceTop
29983
29982
  }, /*#__PURE__*/React.createElement(SingleSelect, {
29984
29983
  id: "ruler-label-select",
29985
29984
  selectedValue: this.props.rulerLabel,
@@ -29989,7 +29988,7 @@ class InteractiveGraphSettings extends React.Component {
29989
29988
  });
29990
29989
  },
29991
29990
  placeholder: "None",
29992
- style: styles$i.singleSelectShort
29991
+ style: styles$j.singleSelectShort
29993
29992
  }, /*#__PURE__*/React.createElement(OptionItem, {
29994
29993
  value: "",
29995
29994
  label: "None",
@@ -30030,7 +30029,7 @@ class InteractiveGraphSettings extends React.Component {
30030
30029
  });
30031
30030
  },
30032
30031
  placeholder: "10",
30033
- style: styles$i.singleSelectShort
30032
+ style: styles$j.singleSelectShort
30034
30033
  }, [1, 2, 4, 8, 10, 16].map(value => /*#__PURE__*/React.createElement(OptionItem, {
30035
30034
  key: value,
30036
30035
  value: `${value}`,
@@ -30054,7 +30053,7 @@ InteractiveGraphSettings.defaultProps = {
30054
30053
  rulerLabel: "",
30055
30054
  rulerTicks: 10
30056
30055
  };
30057
- const styles$i = StyleSheet.create({
30056
+ const styles$j = StyleSheet.create({
30058
30057
  resetSpaceTop: {
30059
30058
  marginTop: 0
30060
30059
  },
@@ -30098,10 +30097,10 @@ const LockedFigureSelect = props => {
30098
30097
  onChange
30099
30098
  } = props;
30100
30099
  return /*#__PURE__*/React.createElement(View, {
30101
- style: styles$h.container
30100
+ style: styles$i.container
30102
30101
  }, /*#__PURE__*/React.createElement(ActionMenu, {
30103
30102
  menuText: "Add locked figure",
30104
- style: styles$h.addElementSelect
30103
+ style: styles$i.addElementSelect
30105
30104
  }, [/*#__PURE__*/React.createElement(ActionItem, {
30106
30105
  key: `${id}-point`,
30107
30106
  label: "Point",
@@ -30112,7 +30111,7 @@ const LockedFigureSelect = props => {
30112
30111
  onClick: () => onChange("line")
30113
30112
  }, "Line")]));
30114
30113
  };
30115
- const styles$h = StyleSheet.create({
30114
+ const styles$i = StyleSheet.create({
30116
30115
  container: {
30117
30116
  marginTop: spacing.xxxSmall_4
30118
30117
  },
@@ -30212,13 +30211,13 @@ const ColorSwatch = props => {
30212
30211
  "aria-label":
30213
30212
  // Don't include an aria label for decorative circles.
30214
30213
  !decorative ? `Color: ${color$1}, ${filled ? "filled" : "open"}` : undefined,
30215
- style: [styles$g.colorSwatch, {
30214
+ style: [styles$h.colorSwatch, {
30216
30215
  border: `4px solid ${lockedFigureColors[color$1]}`,
30217
30216
  backgroundColor: filled ? lockedFigureColors[color$1] : color.white
30218
30217
  }]
30219
30218
  });
30220
30219
  };
30221
- const styles$g = StyleSheet.create({
30220
+ const styles$h = StyleSheet.create({
30222
30221
  colorSwatch: {
30223
30222
  // Add a white outline so that the color swatch is visible when
30224
30223
  // the dropdown option is highlighted with its blue background.
@@ -30237,10 +30236,10 @@ const ColorSelect = props => {
30237
30236
  onChange
30238
30237
  } = props;
30239
30238
  return /*#__PURE__*/React.createElement(View, {
30240
- style: styles$f.row
30239
+ style: styles$g.row
30241
30240
  }, /*#__PURE__*/React.createElement(LabelMedium, {
30242
30241
  htmlFor: id,
30243
- style: styles$f.label,
30242
+ style: styles$g.label,
30244
30243
  tag: "label"
30245
30244
  }, "Color"), /*#__PURE__*/React.createElement(SingleSelect, {
30246
30245
  id: id,
@@ -30259,7 +30258,7 @@ const ColorSelect = props => {
30259
30258
  })
30260
30259
  }, colorName))));
30261
30260
  };
30262
- const styles$f = StyleSheet.create({
30261
+ const styles$g = StyleSheet.create({
30263
30262
  row: {
30264
30263
  flexDirection: "row",
30265
30264
  alignItems: "center"
@@ -30269,6 +30268,38 @@ const styles$f = StyleSheet.create({
30269
30268
  }
30270
30269
  });
30271
30270
 
30271
+ /**
30272
+ * The part of a locked figure settings panel that contains actions
30273
+ * for this panel and its associated locked figure, including
30274
+ * the delete button.
30275
+ */
30276
+ const LockedFigureSettingsActions = props => {
30277
+ const {
30278
+ onRemove,
30279
+ figureAriaLabel
30280
+ } = props;
30281
+ return /*#__PURE__*/React.createElement(View, {
30282
+ style: styles$f.container
30283
+ }, /*#__PURE__*/React.createElement(Button, {
30284
+ startIcon: trashIcon,
30285
+ "aria-label": `Delete ${figureAriaLabel}`,
30286
+ onClick: onRemove,
30287
+ kind: "tertiary",
30288
+ style: styles$f.deleteButton
30289
+ }, "Delete"));
30290
+ };
30291
+ const styles$f = StyleSheet.create({
30292
+ container: {
30293
+ width: "100%",
30294
+ flexDirection: "row",
30295
+ alignItems: "center"
30296
+ },
30297
+ deleteButton: {
30298
+ // Line up the delete icon with the rest of the content.
30299
+ marginInlineStart: -spacing.xxxSmall_4
30300
+ }
30301
+ });
30302
+
30272
30303
  function focusWithChromeStickyFocusBugWorkaround(element) {
30273
30304
  // NOTE(marksandstrom) Chrome sticky focus bug.
30274
30305
  //
@@ -30471,11 +30502,9 @@ const LockedPointSettings = props => {
30471
30502
  });
30472
30503
  },
30473
30504
  style: styles$e.spaceUnder
30474
- })), onRemove && /*#__PURE__*/React.createElement(IconButton, {
30475
- icon: trashIcon,
30476
- "aria-label": `Delete locked point at ${coordState[0]}, ${coordState[1]}`,
30477
- onClick: onRemove,
30478
- style: styles$e.deleteButton
30505
+ })), onRemove && /*#__PURE__*/React.createElement(LockedFigureSettingsActions, {
30506
+ onRemove: onRemove,
30507
+ figureAriaLabel: `locked point at ${coordState[0]}, ${coordState[1]}`
30479
30508
  }))));
30480
30509
  };
30481
30510
  const styles$e = StyleSheet.create({
@@ -30507,11 +30536,6 @@ const styles$e = StyleSheet.create({
30507
30536
  },
30508
30537
  textField: {
30509
30538
  width: spacing.xxxLarge_64
30510
- },
30511
- deleteButton: {
30512
- position: "absolute",
30513
- top: spacing.small_12,
30514
- right: spacing.small_12
30515
30539
  }
30516
30540
  });
30517
30541
 
@@ -30651,13 +30675,11 @@ const LockedLineSettings = props => {
30651
30675
  }),
30652
30676
  onChangeProps: newProps => handleChangePoint(newProps, 1),
30653
30677
  style: styles$d.lockedPointSettingsContainer
30654
- })), /*#__PURE__*/React.createElement(IconButton, {
30655
- icon: trashIcon,
30656
- "aria-label": `Delete locked line defined by
30657
- ${startPoint.coord[0]}, ${startPoint.coord[1]} and
30658
- ${endPoint.coord[0]}, ${endPoint.coord[1]}.`,
30659
- onClick: onRemove,
30660
- style: styles$d.deleteButton
30678
+ })), /*#__PURE__*/React.createElement(LockedFigureSettingsActions, {
30679
+ onRemove: onRemove,
30680
+ figureAriaLabel: `locked line defined by
30681
+ ${startPoint.coord[0]}, ${startPoint.coord[1]} and
30682
+ ${endPoint.coord[0]}, ${endPoint.coord[1]}.`
30661
30683
  }))));
30662
30684
  };
30663
30685
  const styles$d = StyleSheet.create({
@@ -30690,11 +30712,6 @@ const styles$d = StyleSheet.create({
30690
30712
  },
30691
30713
  label: {
30692
30714
  marginInlineEnd: spacing.xSmall_8
30693
- },
30694
- deleteButton: {
30695
- position: "absolute",
30696
- top: spacing.small_12,
30697
- right: spacing.small_12
30698
30715
  }
30699
30716
  });
30700
30717
 
@@ -30731,10 +30748,13 @@ const LockedFiguresSection = props => {
30731
30748
  onChange(newProps);
30732
30749
  }
30733
30750
  function removeLockedFigure(index) {
30734
- const lockedFigures = figures || [];
30735
- onChange({
30736
- lockedFigures: [...lockedFigures.slice(0, index), ...lockedFigures.slice(index + 1)]
30737
- });
30751
+ // eslint-disable-next-line no-alert
30752
+ if (window.confirm("Are you sure you want to delete this figure?")) {
30753
+ const lockedFigures = figures || [];
30754
+ onChange({
30755
+ lockedFigures: [...lockedFigures.slice(0, index), ...lockedFigures.slice(index + 1)]
30756
+ });
30757
+ }
30738
30758
  }
30739
30759
  function changeProps(index,
30740
30760
  // Omit the type from the figure props so it doesn't think
@@ -30988,7 +31008,7 @@ class InteractiveGraphEditor extends React.Component {
30988
31008
  }), ((_this$props$correct7 = this.props.correct) == null ? void 0 : _this$props$correct7.numSides) !== "unlimited" && /*#__PURE__*/React.createElement(OptionItem, {
30989
31009
  value: "sides",
30990
31010
  label: "side measures"
30991
- })), /*#__PURE__*/React.createElement(InfoTip$b, null, /*#__PURE__*/React.createElement("p", null, "These options affect the movement of the vertex points. The grid option will guide the points to the nearest half step along the grid."), /*#__PURE__*/React.createElement("p", null, "The interior angle and side measure options guide the points to the nearest whole angle or side"), " ", "measure respectively.")), /*#__PURE__*/React.createElement(View, {
31011
+ })), /*#__PURE__*/React.createElement(InfoTip$b, null, /*#__PURE__*/React.createElement("p", null, "These options affect the movement of the vertex points. The grid option will guide the points to the nearest half step along the grid."), /*#__PURE__*/React.createElement("p", null, "The interior angle and side measure options guide the points to the nearest whole angle or side measure respectively."))), /*#__PURE__*/React.createElement(View, {
30992
31012
  style: styles$a.row
30993
31013
  }, /*#__PURE__*/React.createElement(Checkbox$1, {
30994
31014
  label: /*#__PURE__*/React.createElement(LabelSmall, null, "Show angle measures"),