@khanacademy/perseus-editor 6.9.0 → 6.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -67,7 +67,7 @@ var trashIcon__default = /*#__PURE__*/_interopDefaultLegacy(trashIcon);
67
67
 
68
68
  // This file is processed by a Rollup plugin (replace) to inject the production
69
69
  const libName = "@khanacademy/perseus-editor";
70
- const libVersion = "6.9.0";
70
+ const libVersion = "6.10.0";
71
71
  perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
72
72
 
73
73
  function _extends() {
@@ -30386,29 +30386,26 @@ const AngleInput = props => {
30386
30386
  return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30387
30387
  style: [styles$q.row, styles$q.spaceUnder]
30388
30388
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
30389
- tag: "label"
30390
- }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30389
+ tag: "label",
30391
30390
  style: styles$q.row
30392
30391
  }, "angle", /*#__PURE__*/React__namespace.createElement(Strut, {
30393
30392
  size: wonderBlocksTokens.spacing.xxSmall_6
30394
30393
  }), /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.TextField, {
30395
- id: "",
30396
30394
  value: angleInput,
30397
30395
  onChange: handleAngleChange,
30398
30396
  style: styles$q.textField
30399
- }))), /*#__PURE__*/React__namespace.createElement(Strut, {
30397
+ })), /*#__PURE__*/React__namespace.createElement(Strut, {
30400
30398
  size: wonderBlocksTokens.spacing.xxSmall_6
30401
- }), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30402
- style: styles$q.row
30403
- }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelSmall, null, "radians"), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30399
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelSmall, null, "radians"), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30404
30400
  style: styles$q.switch
30405
30401
  }, /*#__PURE__*/React__namespace.createElement(Switch__default["default"], {
30406
30402
  onChange: handleAngleTypeChange,
30407
30403
  checked: isInDegrees
30408
- })), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelSmall, null, "degrees")), /*#__PURE__*/React__namespace.createElement(InfoTip$d, null, /*#__PURE__*/React__namespace.createElement("p", null, "The angle of rotation for the ellipse (if the x radius and y radius are different)."), /*#__PURE__*/React__namespace.createElement("p", null, "Expressions will be evaluted (e.g. \"pi/2\" or \"5pi/4\").")));
30404
+ })), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelSmall, null, "degrees"), /*#__PURE__*/React__namespace.createElement(InfoTip$d, null, /*#__PURE__*/React__namespace.createElement("p", null, "The angle of rotation for the ellipse (if the x radius and y radius are different)."), /*#__PURE__*/React__namespace.createElement("p", null, "Expressions will be evaluted (e.g. \"pi/2\" or \"5pi/4\").")));
30409
30405
  };
30410
30406
  const styles$q = aphrodite.StyleSheet.create({
30411
30407
  row: {
30408
+ display: "flex",
30412
30409
  flexDirection: "row",
30413
30410
  alignItems: "center"
30414
30411
  },
@@ -30455,16 +30452,14 @@ const ColorSelect = props => {
30455
30452
  style,
30456
30453
  onChange
30457
30454
  } = props;
30458
- const ids = wonderBlocksCore.useUniqueIdWithMock();
30459
- const id = ids.get("color-select");
30460
30455
  return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30461
30456
  style: [styles$o.row, style]
30462
30457
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
30463
- htmlFor: id,
30464
- style: styles$o.label,
30465
- tag: "label"
30466
- }, "color"), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
30467
- id: id,
30458
+ tag: "label",
30459
+ style: styles$o.row
30460
+ }, "color", /*#__PURE__*/React__namespace.createElement(Strut, {
30461
+ size: wonderBlocksTokens.spacing.xxSmall_6
30462
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
30468
30463
  selectedValue: selectedValue,
30469
30464
  onChange: onChange
30470
30465
  // Placeholder is required, but never gets used.
@@ -30478,15 +30473,13 @@ const ColorSelect = props => {
30478
30473
  color: colorName,
30479
30474
  decorative: true
30480
30475
  })
30481
- }, colorName))));
30476
+ }, colorName)))));
30482
30477
  };
30483
30478
  const styles$o = aphrodite.StyleSheet.create({
30484
30479
  row: {
30480
+ display: "flex",
30485
30481
  flexDirection: "row",
30486
30482
  alignItems: "center"
30487
- },
30488
- label: {
30489
- marginInlineEnd: wonderBlocksTokens.spacing.xxxSmall_4
30490
30483
  }
30491
30484
  });
30492
30485
 
@@ -30503,12 +30496,6 @@ const CoordinatePairInput = props => {
30503
30496
  const [coordState, setCoordState] = React__namespace.useState([
30504
30497
  // Using strings to make it easier to work with the text fields.
30505
30498
  coord[0].toString(), coord[1].toString()]);
30506
-
30507
- // Generate unique IDs so that the programmatic labels can be associated
30508
- // with their respective text fields.
30509
- const ids = wonderBlocksCore.useUniqueIdWithMock();
30510
- const xCoordId = ids.get("x-coord");
30511
- const yCoordId = ids.get("y-coord");
30512
30499
  function handleCoordChange(newValue, coordIndex) {
30513
30500
  // Update the local state (update the input field value).
30514
30501
  const newCoordState = [...coordState];
@@ -30529,40 +30516,38 @@ const CoordinatePairInput = props => {
30529
30516
  return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, null, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30530
30517
  style: [styles$n.row, styles$n.spaceUnder]
30531
30518
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
30532
- htmlFor: xCoordId,
30533
- style: styles$n.label,
30534
- tag: "label"
30535
- }, labels ? labels[0] : "x coord"), /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.TextField, {
30536
- id: xCoordId,
30519
+ tag: "label",
30520
+ style: styles$n.row
30521
+ }, labels ? labels[0] : "x coord", /*#__PURE__*/React__namespace.createElement(Strut, {
30522
+ size: wonderBlocksTokens.spacing.xxSmall_6
30523
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.TextField, {
30537
30524
  type: "number",
30538
30525
  value: coordState[0],
30539
30526
  onChange: newValue => handleCoordChange(newValue, 0),
30540
30527
  style: [styles$n.textField, error ? styles$n.errorField : undefined]
30541
- }), /*#__PURE__*/React__namespace.createElement(Strut, {
30528
+ })), /*#__PURE__*/React__namespace.createElement(Strut, {
30542
30529
  size: wonderBlocksTokens.spacing.medium_16
30543
30530
  }), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
30544
- htmlFor: yCoordId,
30545
- style: styles$n.label,
30546
- tag: "label"
30547
- }, labels ? labels[1] : "y coord"), /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.TextField, {
30548
- id: yCoordId,
30531
+ tag: "label",
30532
+ style: styles$n.row
30533
+ }, labels ? labels[1] : "y coord", /*#__PURE__*/React__namespace.createElement(Strut, {
30534
+ size: wonderBlocksTokens.spacing.xxSmall_6
30535
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.TextField, {
30549
30536
  type: "number",
30550
30537
  value: coordState[1],
30551
30538
  onChange: newValue => handleCoordChange(newValue, 1),
30552
30539
  style: [styles$n.textField, error ? styles$n.errorField : undefined]
30553
- })));
30540
+ }))));
30554
30541
  };
30555
30542
  const styles$n = aphrodite.StyleSheet.create({
30556
30543
  row: {
30544
+ display: "flex",
30557
30545
  flexDirection: "row",
30558
30546
  alignItems: "center"
30559
30547
  },
30560
30548
  spaceUnder: {
30561
30549
  marginBottom: wonderBlocksTokens.spacing.xSmall_8
30562
30550
  },
30563
- label: {
30564
- marginInlineEnd: wonderBlocksTokens.spacing.xxSmall_6
30565
- },
30566
30551
  textField: {
30567
30552
  width: wonderBlocksTokens.spacing.xxxLarge_64
30568
30553
  },
@@ -30704,9 +30689,6 @@ const LockedEllipseSettings = props => {
30704
30689
  onChangeProps,
30705
30690
  onRemove
30706
30691
  } = props;
30707
- const ids = wonderBlocksCore.useUniqueIdWithMock();
30708
- const strokeSelectId = ids.get("stroke-style-select");
30709
- const fillSelectId = ids.get("fill-style-select");
30710
30692
  function handleColorChange(newValue) {
30711
30693
  onChangeProps({
30712
30694
  color: newValue
@@ -30758,10 +30740,10 @@ const LockedEllipseSettings = props => {
30758
30740
  size: wonderBlocksTokens.spacing.medium_16
30759
30741
  }), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
30760
30742
  tag: "label",
30761
- htmlFor: fillSelectId,
30762
- style: styles$j.label
30763
- }, "fill"), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
30764
- id: fillSelectId,
30743
+ style: styles$j.row
30744
+ }, "fill", /*#__PURE__*/React__namespace.createElement(Strut, {
30745
+ size: wonderBlocksTokens.spacing.xxSmall_6
30746
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
30765
30747
  selectedValue: fillStyle,
30766
30748
  onChange: value => onChangeProps({
30767
30749
  fillStyle: value
@@ -30773,14 +30755,12 @@ const LockedEllipseSettings = props => {
30773
30755
  key: option,
30774
30756
  value: option,
30775
30757
  label: option
30776
- }, option)))), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
30777
- style: styles$j.row
30778
- }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
30758
+ }, option))))), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
30779
30759
  tag: "label",
30780
- htmlFor: strokeSelectId,
30781
- style: styles$j.label
30782
- }, "stroke"), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
30783
- id: strokeSelectId,
30760
+ style: styles$j.row
30761
+ }, "stroke", /*#__PURE__*/React__namespace.createElement(Strut, {
30762
+ size: wonderBlocksTokens.spacing.xxSmall_6
30763
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
30784
30764
  selectedValue: strokeStyle,
30785
30765
  onChange: value => onChangeProps({
30786
30766
  strokeStyle: value
@@ -30801,12 +30781,10 @@ const LockedEllipseSettings = props => {
30801
30781
  };
30802
30782
  const styles$j = aphrodite.StyleSheet.create({
30803
30783
  row: {
30784
+ display: "flex",
30804
30785
  flexDirection: "row",
30805
30786
  alignItems: "center"
30806
30787
  },
30807
- label: {
30808
- marginInlineEnd: wonderBlocksTokens.spacing.xxSmall_6
30809
- },
30810
30788
  spaceUnder: {
30811
30789
  marginBottom: wonderBlocksTokens.spacing.xSmall_8
30812
30790
  }
@@ -30966,12 +30944,6 @@ const LockedLineSettings = props => {
30966
30944
  onRemove
30967
30945
  } = props;
30968
30946
  const [point1, point2] = points;
30969
-
30970
- // Generate unique IDs so that the programmatic labels can be associated
30971
- // with their respective text fields.
30972
- const ids = wonderBlocksCore.useUniqueIdWithMock();
30973
- const kindSelectId = ids.get("line-kind-select");
30974
- const styleSelectId = ids.get("line-style-select");
30975
30947
  const capitalizeKind = kind.charAt(0).toUpperCase() + kind.slice(1);
30976
30948
  const lineLabel = `${capitalizeKind} (${point1.coord[0]},
30977
30949
  ${point1.coord[1]}), (${point2.coord[0]}, ${point2.coord[1]})`;
@@ -31012,14 +30984,12 @@ const LockedLineSettings = props => {
31012
30984
  color: lineColor,
31013
30985
  lineStyle: lineStyle
31014
30986
  }))
31015
- }, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
31016
- style: [styles$f.row, styles$f.spaceUnder]
31017
30987
  }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
31018
- htmlFor: kindSelectId,
31019
- style: styles$f.label,
31020
- tag: "label"
31021
- }, "kind"), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
31022
- id: kindSelectId,
30988
+ tag: "label",
30989
+ style: [styles$f.row, styles$f.spaceUnder]
30990
+ }, "kind", /*#__PURE__*/React__namespace.createElement(Strut, {
30991
+ size: wonderBlocksTokens.spacing.xxxSmall_4
30992
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
31023
30993
  selectedValue: kind,
31024
30994
  onChange: value => onChangeProps({
31025
30995
  kind: value
@@ -31037,20 +31007,18 @@ const LockedLineSettings = props => {
31037
31007
  value: "segment",
31038
31008
  label: "segment"
31039
31009
  }))), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
31040
- style: [styles$f.row, styles$f.spaceUnder]
31010
+ style: styles$f.row
31041
31011
  }, /*#__PURE__*/React__namespace.createElement(ColorSelect, {
31042
31012
  selectedValue: lineColor,
31043
31013
  onChange: handleColorChange
31044
31014
  }), /*#__PURE__*/React__namespace.createElement(Strut, {
31045
31015
  size: wonderBlocksTokens.spacing.small_12
31046
- }), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
31016
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
31017
+ tag: "label",
31047
31018
  style: styles$f.row
31048
- }, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
31049
- htmlFor: styleSelectId,
31050
- style: styles$f.label,
31051
- tag: "label"
31052
- }, "style"), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
31053
- id: styleSelectId,
31019
+ }, "style", /*#__PURE__*/React__namespace.createElement(Strut, {
31020
+ size: wonderBlocksTokens.spacing.xxxSmall_4
31021
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
31054
31022
  selectedValue: lineStyle,
31055
31023
  onChange: value => onChangeProps({
31056
31024
  lineStyle: value
@@ -31100,9 +31068,6 @@ const styles$f = aphrodite.StyleSheet.create({
31100
31068
  spaceUnder: {
31101
31069
  marginBottom: wonderBlocksTokens.spacing.xSmall_8
31102
31070
  },
31103
- label: {
31104
- marginInlineEnd: wonderBlocksTokens.spacing.xxxSmall_4
31105
- },
31106
31071
  selectMarginOffset: {
31107
31072
  // Align with the point settings accordions.
31108
31073
  marginInlineEnd: -wonderBlocksTokens.spacing.xxxSmall_4