@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/index.js CHANGED
@@ -24,10 +24,11 @@ var mathInput = require('@khanacademy/math-input');
24
24
  var wonderBlocksDropdown = require('@khanacademy/wonder-blocks-dropdown');
25
25
  var wonderBlocksForm = require('@khanacademy/wonder-blocks-form');
26
26
  var wonderBlocksTypography = require('@khanacademy/wonder-blocks-typography');
27
- var Switch = require('@khanacademy/wonder-blocks-switch');
27
+ var Banner = require('@khanacademy/wonder-blocks-banner');
28
28
  var wonderBlocksAccordion = require('@khanacademy/wonder-blocks-accordion');
29
29
  var Button = require('@khanacademy/wonder-blocks-button');
30
30
  var trashIcon = require('@phosphor-icons/core/bold/trash-bold.svg');
31
+ var Switch = require('@khanacademy/wonder-blocks-switch');
31
32
 
32
33
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
33
34
 
@@ -59,13 +60,14 @@ var caretRight__default = /*#__PURE__*/_interopDefaultLegacy(caretRight);
59
60
  var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
60
61
  var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
61
62
  var KAS__namespace = /*#__PURE__*/_interopNamespace(KAS);
62
- var Switch__default = /*#__PURE__*/_interopDefaultLegacy(Switch);
63
+ var Banner__default = /*#__PURE__*/_interopDefaultLegacy(Banner);
63
64
  var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
64
65
  var trashIcon__default = /*#__PURE__*/_interopDefaultLegacy(trashIcon);
66
+ var Switch__default = /*#__PURE__*/_interopDefaultLegacy(Switch);
65
67
 
66
68
  // This file is processed by a Rollup plugin (replace) to inject the production
67
69
  const libName = "@khanacademy/perseus-editor";
68
- const libVersion = "6.2.0";
70
+ const libVersion = "6.2.2";
69
71
  perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
70
72
 
71
73
  function _extends() {
@@ -28417,6 +28419,7 @@ function MathquillInput(props) {
28417
28419
  const mathFieldWrapperRef = React.useRef(null);
28418
28420
  const mathFieldInstance = React.useRef();
28419
28421
  const {
28422
+ locale,
28420
28423
  strings
28421
28424
  } = mathInput.useMathInputI18n();
28422
28425
  React.useEffect(() => {
@@ -28424,7 +28427,7 @@ function MathquillInput(props) {
28424
28427
  // make a new Mathquill input
28425
28428
  if (mathFieldWrapperRef.current && !mathFieldInstance.current) {
28426
28429
  // Initialize MathQuill.MathField instance
28427
- mathFieldInstance.current = mathInput.createMathField(mathFieldWrapperRef.current, strings, baseConfig => ({
28430
+ mathFieldInstance.current = mathInput.createMathField(mathFieldWrapperRef.current, locale, strings, baseConfig => ({
28428
28431
  ...baseConfig,
28429
28432
  handlers: {
28430
28433
  edit: mathField => {
@@ -30082,7 +30085,11 @@ class InteractiveGraphSettings extends React__namespace.Component {
30082
30085
  showProtractor: this.props.showProtractor,
30083
30086
  onChange: this.change,
30084
30087
  style: styles$k.resetSpaceTop
30085
- })), this.props.showRuler && /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30088
+ })), (this.props.showRuler || this.props.showProtractor) && /*#__PURE__*/React__namespace.createElement(Banner__default["default"], {
30089
+ layout: "floating",
30090
+ text: "The ruler and protractor are not accessible. Please consider an alternate approach.",
30091
+ kind: "warning"
30092
+ }), this.props.showRuler && /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30086
30093
  style: styles$k.spaceTop
30087
30094
  }, /*#__PURE__*/React__namespace.createElement(LabeledRow, {
30088
30095
  label: "Ruler label:",
@@ -30165,7 +30172,8 @@ const styles$k = aphrodite.StyleSheet.create({
30165
30172
  checkboxRow: {
30166
30173
  flexDirection: "row",
30167
30174
  alignItems: "center",
30168
- justifyContent: "space-between"
30175
+ justifyContent: "space-between",
30176
+ marginBottom: wonderBlocksTokens.spacing.xSmall_8
30169
30177
  },
30170
30178
  rulerSection: {
30171
30179
  marginTop: wonderBlocksTokens.spacing.xSmall_8,
@@ -30361,35 +30369,6 @@ const styles$h = aphrodite.StyleSheet.create({
30361
30369
  }
30362
30370
  });
30363
30371
 
30364
- const LabeledSwitch = props => {
30365
- const {
30366
- checked,
30367
- label,
30368
- style,
30369
- onChange
30370
- } = props;
30371
- const ids = wonderBlocksCore.useUniqueIdWithMock();
30372
- const switchId = ids.get("switch");
30373
- return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30374
- style: [styles$g.row, style]
30375
- }, /*#__PURE__*/React__namespace.createElement(Switch__default["default"], {
30376
- id: switchId,
30377
- checked: checked,
30378
- onChange: onChange
30379
- }), /*#__PURE__*/React__namespace.createElement(Strut, {
30380
- size: wonderBlocksTokens.spacing.xSmall_8
30381
- }), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
30382
- tag: "label",
30383
- htmlFor: switchId
30384
- }, label));
30385
- };
30386
- const styles$g = aphrodite.StyleSheet.create({
30387
- row: {
30388
- flexDirection: "row",
30389
- alignItems: "center"
30390
- }
30391
- });
30392
-
30393
30372
  const LockedFigureSettingsAccordion = props => {
30394
30373
  const {
30395
30374
  children,
@@ -30404,14 +30383,14 @@ const LockedFigureSettingsAccordion = props => {
30404
30383
  , {
30405
30384
  className: "locked-figure-accordion"
30406
30385
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksAccordion.AccordionSection, {
30407
- style: [styles$f.container, containerStyle],
30408
- headerStyle: styles$f.accordionHeader,
30386
+ style: [styles$g.container, containerStyle],
30387
+ headerStyle: styles$g.accordionHeader,
30409
30388
  header: header
30410
30389
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30411
- style: [styles$f.accordionPanel, panelStyle]
30390
+ style: [styles$g.accordionPanel, panelStyle]
30412
30391
  }, children)));
30413
30392
  };
30414
- const styles$f = aphrodite.StyleSheet.create({
30393
+ const styles$g = aphrodite.StyleSheet.create({
30415
30394
  container: {
30416
30395
  backgroundColor: wonderBlocksTokens.color.fadedBlue8,
30417
30396
  marginTop: wonderBlocksTokens.spacing.xSmall_8
@@ -30443,16 +30422,16 @@ const LockedFigureSettingsActions = props => {
30443
30422
  figureAriaLabel
30444
30423
  } = props;
30445
30424
  return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30446
- style: styles$e.container
30425
+ style: styles$f.container
30447
30426
  }, /*#__PURE__*/React__namespace.createElement(Button__default["default"], {
30448
30427
  startIcon: trashIcon__default["default"],
30449
30428
  "aria-label": `Delete ${figureAriaLabel}`,
30450
30429
  onClick: onRemove,
30451
30430
  kind: "tertiary",
30452
- style: styles$e.deleteButton
30431
+ style: styles$f.deleteButton
30453
30432
  }, "Delete"));
30454
30433
  };
30455
- const styles$e = aphrodite.StyleSheet.create({
30434
+ const styles$f = aphrodite.StyleSheet.create({
30456
30435
  container: {
30457
30436
  width: "100%",
30458
30437
  flexDirection: "row",
@@ -30465,6 +30444,35 @@ const styles$e = aphrodite.StyleSheet.create({
30465
30444
  }
30466
30445
  });
30467
30446
 
30447
+ const LabeledSwitch = props => {
30448
+ const {
30449
+ checked,
30450
+ label,
30451
+ style,
30452
+ onChange
30453
+ } = props;
30454
+ const ids = wonderBlocksCore.useUniqueIdWithMock();
30455
+ const switchId = ids.get("switch");
30456
+ return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30457
+ style: [styles$e.row, style]
30458
+ }, /*#__PURE__*/React__namespace.createElement(Switch__default["default"], {
30459
+ id: switchId,
30460
+ checked: checked,
30461
+ onChange: onChange
30462
+ }), /*#__PURE__*/React__namespace.createElement(Strut, {
30463
+ size: wonderBlocksTokens.spacing.xSmall_8
30464
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
30465
+ tag: "label",
30466
+ htmlFor: switchId
30467
+ }, label));
30468
+ };
30469
+ const styles$e = aphrodite.StyleSheet.create({
30470
+ row: {
30471
+ flexDirection: "row",
30472
+ alignItems: "center"
30473
+ }
30474
+ });
30475
+
30468
30476
  function focusWithChromeStickyFocusBugWorkaround(element) {
30469
30477
  // NOTE(marksandstrom) Chrome sticky focus bug.
30470
30478
  //
@@ -30510,7 +30518,7 @@ function getValidNumberFromString(value) {
30510
30518
  // If the value is not a number, return 0.
30511
30519
  return isNaN(parsed) ? 0 : parsed;
30512
30520
  }
30513
- const DEFAULT_COLOR = "green";
30521
+ const DEFAULT_COLOR = "grayH";
30514
30522
  function getDefaultFigureForType(type) {
30515
30523
  switch (type) {
30516
30524
  case "point":
@@ -30530,7 +30538,6 @@ function getDefaultFigureForType(type) {
30530
30538
  }],
30531
30539
  color: DEFAULT_COLOR,
30532
30540
  lineStyle: "solid",
30533
- showArrows: false,
30534
30541
  showStartPoint: false,
30535
30542
  showEndPoint: false
30536
30543
  };
@@ -30679,7 +30686,6 @@ const LockedLineSettings = props => {
30679
30686
  points,
30680
30687
  color: lineColor,
30681
30688
  lineStyle = "solid",
30682
- showArrows,
30683
30689
  showStartPoint,
30684
30690
  showEndPoint,
30685
30691
  onChangeProps,
@@ -30780,13 +30786,7 @@ const LockedLineSettings = props => {
30780
30786
  }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
30781
30787
  value: "dashed",
30782
30788
  label: "dashed"
30783
- })))), /*#__PURE__*/React__namespace.createElement(LabeledSwitch, {
30784
- label: "show arrows",
30785
- checked: showArrows,
30786
- onChange: newValue => onChangeProps({
30787
- showArrows: newValue
30788
- })
30789
- }), /*#__PURE__*/React__namespace.createElement(LockedPointSettings, _extends({
30789
+ })))), /*#__PURE__*/React__namespace.createElement(LockedPointSettings, _extends({
30790
30790
  label: "Start point",
30791
30791
  toggled: showStartPoint
30792
30792
  }, startPoint, {