@khanacademy/perseus-editor 6.2.0 → 6.2.2

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
@@ -21,14 +21,15 @@ import { useMathInputI18n, createMathField } from '@khanacademy/math-input';
21
21
  import { SingleSelect, OptionItem, ActionMenu, ActionItem } from '@khanacademy/wonder-blocks-dropdown';
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
- import Switch from '@khanacademy/wonder-blocks-switch';
24
+ import Banner from '@khanacademy/wonder-blocks-banner';
25
25
  import { AccordionSection } from '@khanacademy/wonder-blocks-accordion';
26
26
  import Button from '@khanacademy/wonder-blocks-button';
27
27
  import trashIcon from '@phosphor-icons/core/bold/trash-bold.svg';
28
+ import Switch from '@khanacademy/wonder-blocks-switch';
28
29
 
29
30
  // This file is processed by a Rollup plugin (replace) to inject the production
30
31
  const libName = "@khanacademy/perseus-editor";
31
- const libVersion = "6.2.0";
32
+ const libVersion = "6.2.2";
32
33
  addLibraryVersionToPerseusDebug(libName, libVersion);
33
34
 
34
35
  function _extends() {
@@ -28365,6 +28366,7 @@ function MathquillInput(props) {
28365
28366
  const mathFieldWrapperRef = useRef(null);
28366
28367
  const mathFieldInstance = useRef();
28367
28368
  const {
28369
+ locale,
28368
28370
  strings
28369
28371
  } = useMathInputI18n();
28370
28372
  useEffect(() => {
@@ -28372,7 +28374,7 @@ function MathquillInput(props) {
28372
28374
  // make a new Mathquill input
28373
28375
  if (mathFieldWrapperRef.current && !mathFieldInstance.current) {
28374
28376
  // Initialize MathQuill.MathField instance
28375
- mathFieldInstance.current = createMathField(mathFieldWrapperRef.current, strings, baseConfig => _extends({}, baseConfig, {
28377
+ mathFieldInstance.current = createMathField(mathFieldWrapperRef.current, locale, strings, baseConfig => _extends({}, baseConfig, {
28376
28378
  handlers: {
28377
28379
  edit: mathField => {
28378
28380
  // This handler is guaranteed to be called on change, but
@@ -29974,7 +29976,11 @@ class InteractiveGraphSettings extends React.Component {
29974
29976
  showProtractor: this.props.showProtractor,
29975
29977
  onChange: this.change,
29976
29978
  style: styles$k.resetSpaceTop
29977
- })), this.props.showRuler && /*#__PURE__*/React.createElement(View, {
29979
+ })), (this.props.showRuler || this.props.showProtractor) && /*#__PURE__*/React.createElement(Banner, {
29980
+ layout: "floating",
29981
+ text: "The ruler and protractor are not accessible. Please consider an alternate approach.",
29982
+ kind: "warning"
29983
+ }), this.props.showRuler && /*#__PURE__*/React.createElement(View, {
29978
29984
  style: styles$k.spaceTop
29979
29985
  }, /*#__PURE__*/React.createElement(LabeledRow, {
29980
29986
  label: "Ruler label:",
@@ -30073,7 +30079,8 @@ const styles$k = StyleSheet.create({
30073
30079
  checkboxRow: {
30074
30080
  flexDirection: "row",
30075
30081
  alignItems: "center",
30076
- justifyContent: "space-between"
30082
+ justifyContent: "space-between",
30083
+ marginBottom: spacing.xSmall_8
30077
30084
  },
30078
30085
  rulerSection: {
30079
30086
  marginTop: spacing.xSmall_8,
@@ -30269,35 +30276,6 @@ const styles$h = StyleSheet.create({
30269
30276
  }
30270
30277
  });
30271
30278
 
30272
- const LabeledSwitch = props => {
30273
- const {
30274
- checked,
30275
- label,
30276
- style,
30277
- onChange
30278
- } = props;
30279
- const ids = useUniqueIdWithMock();
30280
- const switchId = ids.get("switch");
30281
- return /*#__PURE__*/React.createElement(View, {
30282
- style: [styles$g.row, style]
30283
- }, /*#__PURE__*/React.createElement(Switch, {
30284
- id: switchId,
30285
- checked: checked,
30286
- onChange: onChange
30287
- }), /*#__PURE__*/React.createElement(Strut, {
30288
- size: spacing.xSmall_8
30289
- }), /*#__PURE__*/React.createElement(LabelMedium, {
30290
- tag: "label",
30291
- htmlFor: switchId
30292
- }, label));
30293
- };
30294
- const styles$g = StyleSheet.create({
30295
- row: {
30296
- flexDirection: "row",
30297
- alignItems: "center"
30298
- }
30299
- });
30300
-
30301
30279
  const LockedFigureSettingsAccordion = props => {
30302
30280
  const {
30303
30281
  children,
@@ -30312,14 +30290,14 @@ const LockedFigureSettingsAccordion = props => {
30312
30290
  , {
30313
30291
  className: "locked-figure-accordion"
30314
30292
  }, /*#__PURE__*/React.createElement(AccordionSection, {
30315
- style: [styles$f.container, containerStyle],
30316
- headerStyle: styles$f.accordionHeader,
30293
+ style: [styles$g.container, containerStyle],
30294
+ headerStyle: styles$g.accordionHeader,
30317
30295
  header: header
30318
30296
  }, /*#__PURE__*/React.createElement(View, {
30319
- style: [styles$f.accordionPanel, panelStyle]
30297
+ style: [styles$g.accordionPanel, panelStyle]
30320
30298
  }, children)));
30321
30299
  };
30322
- const styles$f = StyleSheet.create({
30300
+ const styles$g = StyleSheet.create({
30323
30301
  container: {
30324
30302
  backgroundColor: color.fadedBlue8,
30325
30303
  marginTop: spacing.xSmall_8
@@ -30351,16 +30329,16 @@ const LockedFigureSettingsActions = props => {
30351
30329
  figureAriaLabel
30352
30330
  } = props;
30353
30331
  return /*#__PURE__*/React.createElement(View, {
30354
- style: styles$e.container
30332
+ style: styles$f.container
30355
30333
  }, /*#__PURE__*/React.createElement(Button, {
30356
30334
  startIcon: trashIcon,
30357
30335
  "aria-label": `Delete ${figureAriaLabel}`,
30358
30336
  onClick: onRemove,
30359
30337
  kind: "tertiary",
30360
- style: styles$e.deleteButton
30338
+ style: styles$f.deleteButton
30361
30339
  }, "Delete"));
30362
30340
  };
30363
- const styles$e = StyleSheet.create({
30341
+ const styles$f = StyleSheet.create({
30364
30342
  container: {
30365
30343
  width: "100%",
30366
30344
  flexDirection: "row",
@@ -30373,6 +30351,35 @@ const styles$e = StyleSheet.create({
30373
30351
  }
30374
30352
  });
30375
30353
 
30354
+ const LabeledSwitch = props => {
30355
+ const {
30356
+ checked,
30357
+ label,
30358
+ style,
30359
+ onChange
30360
+ } = props;
30361
+ const ids = useUniqueIdWithMock();
30362
+ const switchId = ids.get("switch");
30363
+ return /*#__PURE__*/React.createElement(View, {
30364
+ style: [styles$e.row, style]
30365
+ }, /*#__PURE__*/React.createElement(Switch, {
30366
+ id: switchId,
30367
+ checked: checked,
30368
+ onChange: onChange
30369
+ }), /*#__PURE__*/React.createElement(Strut, {
30370
+ size: spacing.xSmall_8
30371
+ }), /*#__PURE__*/React.createElement(LabelMedium, {
30372
+ tag: "label",
30373
+ htmlFor: switchId
30374
+ }, label));
30375
+ };
30376
+ const styles$e = StyleSheet.create({
30377
+ row: {
30378
+ flexDirection: "row",
30379
+ alignItems: "center"
30380
+ }
30381
+ });
30382
+
30376
30383
  function focusWithChromeStickyFocusBugWorkaround(element) {
30377
30384
  // NOTE(marksandstrom) Chrome sticky focus bug.
30378
30385
  //
@@ -30418,7 +30425,7 @@ function getValidNumberFromString(value) {
30418
30425
  // If the value is not a number, return 0.
30419
30426
  return isNaN(parsed) ? 0 : parsed;
30420
30427
  }
30421
- const DEFAULT_COLOR = "green";
30428
+ const DEFAULT_COLOR = "grayH";
30422
30429
  function getDefaultFigureForType(type) {
30423
30430
  switch (type) {
30424
30431
  case "point":
@@ -30437,7 +30444,6 @@ function getDefaultFigureForType(type) {
30437
30444
  })],
30438
30445
  color: DEFAULT_COLOR,
30439
30446
  lineStyle: "solid",
30440
- showArrows: false,
30441
30447
  showStartPoint: false,
30442
30448
  showEndPoint: false
30443
30449
  };
@@ -30586,7 +30592,6 @@ const LockedLineSettings = props => {
30586
30592
  points,
30587
30593
  color: lineColor,
30588
30594
  lineStyle = "solid",
30589
- showArrows,
30590
30595
  showStartPoint,
30591
30596
  showEndPoint,
30592
30597
  onChangeProps,
@@ -30682,13 +30687,7 @@ const LockedLineSettings = props => {
30682
30687
  }), /*#__PURE__*/React.createElement(OptionItem, {
30683
30688
  value: "dashed",
30684
30689
  label: "dashed"
30685
- })))), /*#__PURE__*/React.createElement(LabeledSwitch, {
30686
- label: "show arrows",
30687
- checked: showArrows,
30688
- onChange: newValue => onChangeProps({
30689
- showArrows: newValue
30690
- })
30691
- }), /*#__PURE__*/React.createElement(LockedPointSettings, _extends({
30690
+ })))), /*#__PURE__*/React.createElement(LockedPointSettings, _extends({
30692
30691
  label: "Start point",
30693
30692
  toggled: showStartPoint
30694
30693
  }, startPoint, {