@khanacademy/perseus 1.3.2 → 1.3.4

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/es/index.css +12 -12
  3. package/dist/es/index.js +32 -26
  4. package/dist/es/index.js.map +1 -1
  5. package/dist/index.css +12 -12
  6. package/dist/index.js +32 -26
  7. package/dist/index.js.map +1 -1
  8. package/package.json +1 -1
  9. package/src/__tests__/__snapshots__/perseus-markdown_test.jsx.snap +111 -111
  10. package/src/__tests__/item-renderer_test.jsx +9 -9
  11. package/src/__tests__/jipt-paragraphs_test.js +3 -3
  12. package/src/__tests__/renderer_test.jsx +22 -22
  13. package/src/__tests__/server-item-renderer_test.jsx +7 -7
  14. package/src/components/__tests__/sortable_test.jsx +7 -7
  15. package/src/multi-items/__tests__/__snapshots__/multi-renderer_test.js.snap +5 -5
  16. package/src/multi-items/__tests__/multi-renderer_test.js +90 -90
  17. package/src/renderer.jsx +2 -2
  18. package/src/styles/articles.less +6 -6
  19. package/src/widgets/__tests__/__snapshots__/grapher_test.jsx.snap +68 -68
  20. package/src/widgets/__tests__/__snapshots__/group_test.jsx.snap +5 -5
  21. package/src/widgets/__tests__/__snapshots__/interaction_test.jsx.snap +5 -5
  22. package/src/widgets/__tests__/__snapshots__/interactive-graph_test.jsx.snap +2 -2
  23. package/src/widgets/__tests__/__snapshots__/passage_test.jsx.snap +2 -2
  24. package/src/widgets/__tests__/__snapshots__/radio_test.jsx.snap +52 -52
  25. package/src/widgets/__tests__/categorizer_test.jsx +5 -5
  26. package/src/widgets/__tests__/explanation_test.js +5 -5
  27. package/src/widgets/__tests__/graded-group-set_test.jsx +2 -2
  28. package/src/widgets/__tests__/group_test.jsx +49 -49
  29. package/src/widgets/__tests__/numeric-input_test.jsx +5 -5
  30. package/src/widgets/__tests__/passage_test.jsx +1 -1
  31. package/src/widgets/__tests__/radio/base-radio_test.jsx +28 -1
  32. package/src/widgets/categorizer.jsx +1 -1
  33. package/src/widgets/expression.jsx +6 -6
  34. package/src/widgets/input-number.jsx +4 -4
  35. package/src/widgets/numeric-input.jsx +5 -5
  36. package/src/widgets/radio/base-radio.jsx +8 -3
  37. package/src/widgets/radio/choice-icon/library-choice-icon.jsx +2 -2
  38. package/src/widgets/radio/choice.jsx +1 -1
  39. package/src/widgets/radio/widget.jsx +2 -2
package/dist/index.css CHANGED
@@ -1527,16 +1527,16 @@ body.mobile ul.inequalities-one-line-radios > li {
1527
1527
  font-family: inherit;
1528
1528
  font-size: 14px;
1529
1529
  line-height: 1.25;
1530
- color: #888D93;
1530
+ color: #21242C;
1531
1531
  }
1532
1532
  .framework-perseus:not(.perseus-article):not(.perseus-mobile) .perseus-radio-rationale-content .perseus-renderer > .paragraph .paragraph {
1533
1533
  font-family: inherit;
1534
1534
  font-size: 14px;
1535
1535
  line-height: 1.25;
1536
- color: #888D93;
1536
+ color: #21242C;
1537
1537
  }
1538
1538
  .framework-perseus:not(.perseus-article):not(.perseus-mobile) .perseus-radio-rationale-content .perseus-renderer > .paragraph .paragraph .katex {
1539
- color: #888D93;
1539
+ color: #21242C;
1540
1540
  }
1541
1541
  .bibliotron-article.framework-perseus.perseus-article.perseus-mobile :not(blockquote) > div.paragraph,
1542
1542
  .framework-perseus:not(.perseus-article).perseus-mobile :not(blockquote) > div.paragraph {
@@ -1696,18 +1696,18 @@ body.mobile ul.inequalities-one-line-radios > li {
1696
1696
  font-family: inherit;
1697
1697
  font-size: 16px;
1698
1698
  line-height: 1.25;
1699
- color: #888D93;
1699
+ color: #21242C;
1700
1700
  }
1701
1701
  .bibliotron-article.framework-perseus.perseus-article.perseus-mobile .perseus-radio-rationale-content .perseus-renderer > .paragraph .paragraph,
1702
1702
  .framework-perseus:not(.perseus-article).perseus-mobile .perseus-radio-rationale-content .perseus-renderer > .paragraph .paragraph {
1703
1703
  font-family: inherit;
1704
1704
  font-size: 16px;
1705
1705
  line-height: 1.25;
1706
- color: #888D93;
1706
+ color: #21242C;
1707
1707
  }
1708
1708
  .bibliotron-article.framework-perseus.perseus-article.perseus-mobile .perseus-radio-rationale-content .perseus-renderer > .paragraph .paragraph .katex,
1709
1709
  .framework-perseus:not(.perseus-article).perseus-mobile .perseus-radio-rationale-content .perseus-renderer > .paragraph .paragraph .katex {
1710
- color: #888D93;
1710
+ color: #21242C;
1711
1711
  }
1712
1712
  .bibliotron-article.framework-perseus.perseus-article.perseus-mobile .perseus-image-caption .paragraph .paragraph,
1713
1713
  .framework-perseus:not(.perseus-article).perseus-mobile .perseus-image-caption .paragraph .paragraph {
@@ -1859,18 +1859,18 @@ body.mobile ul.inequalities-one-line-radios > li {
1859
1859
  font-family: inherit;
1860
1860
  font-size: 18px;
1861
1861
  line-height: 1.25;
1862
- color: #888D93;
1862
+ color: #21242C;
1863
1863
  }
1864
1864
  .bibliotron-article.framework-perseus.perseus-article.perseus-mobile .perseus-radio-rationale-content .perseus-renderer > .paragraph .paragraph,
1865
1865
  .framework-perseus:not(.perseus-article).perseus-mobile .perseus-radio-rationale-content .perseus-renderer > .paragraph .paragraph {
1866
1866
  font-family: inherit;
1867
1867
  font-size: 18px;
1868
1868
  line-height: 1.25;
1869
- color: #888D93;
1869
+ color: #21242C;
1870
1870
  }
1871
1871
  .bibliotron-article.framework-perseus.perseus-article.perseus-mobile .perseus-radio-rationale-content .perseus-renderer > .paragraph .paragraph .katex,
1872
1872
  .framework-perseus:not(.perseus-article).perseus-mobile .perseus-radio-rationale-content .perseus-renderer > .paragraph .paragraph .katex {
1873
- color: #888D93;
1873
+ color: #21242C;
1874
1874
  }
1875
1875
  .bibliotron-article.framework-perseus.perseus-article.perseus-mobile .perseus-image-caption .paragraph .paragraph,
1876
1876
  .framework-perseus:not(.perseus-article).perseus-mobile .perseus-image-caption .paragraph .paragraph {
@@ -2022,18 +2022,18 @@ body.mobile ul.inequalities-one-line-radios > li {
2022
2022
  font-family: inherit;
2023
2023
  font-size: 20px;
2024
2024
  line-height: 1.25;
2025
- color: #888D93;
2025
+ color: #21242C;
2026
2026
  }
2027
2027
  .bibliotron-article.framework-perseus.perseus-article.perseus-mobile .perseus-radio-rationale-content .perseus-renderer > .paragraph .paragraph,
2028
2028
  .framework-perseus:not(.perseus-article).perseus-mobile .perseus-radio-rationale-content .perseus-renderer > .paragraph .paragraph {
2029
2029
  font-family: inherit;
2030
2030
  font-size: 20px;
2031
2031
  line-height: 1.25;
2032
- color: #888D93;
2032
+ color: #21242C;
2033
2033
  }
2034
2034
  .bibliotron-article.framework-perseus.perseus-article.perseus-mobile .perseus-radio-rationale-content .perseus-renderer > .paragraph .paragraph .katex,
2035
2035
  .framework-perseus:not(.perseus-article).perseus-mobile .perseus-radio-rationale-content .perseus-renderer > .paragraph .paragraph .katex {
2036
- color: #888D93;
2036
+ color: #21242C;
2037
2037
  }
2038
2038
  .bibliotron-article.framework-perseus.perseus-article.perseus-mobile .perseus-image-caption .paragraph .paragraph,
2039
2039
  .framework-perseus:not(.perseus-article).perseus-mobile .perseus-image-caption .paragraph .paragraph {
package/dist/index.js CHANGED
@@ -19343,7 +19343,7 @@ class Renderer extends React__namespace.Component {
19343
19343
  // look like a widget ID (ie. `widget-type \d+`). I can't figure
19344
19344
  // out how to trigger this line of code though.
19345
19345
 
19346
- /* istanbul ignore next line */
19346
+ /* c8 ignore next line */
19347
19347
  return {};
19348
19348
  }
19349
19349
 
@@ -19682,7 +19682,7 @@ class Renderer extends React__namespace.Component {
19682
19682
  // reached. As noted above, these are always QuestionParagraphs
19683
19683
  // now.
19684
19684
 
19685
- /* istanbul ignore if */
19685
+ /* c8 ignore if */
19686
19686
 
19687
19687
  if (typeof nodeOut === "string" && lastWasString) {
19688
19688
  /**
@@ -22384,12 +22384,12 @@ class Expression extends React__namespace.Component {
22384
22384
  });
22385
22385
 
22386
22386
  _defineProperty(this, "_handleFocus", () => {
22387
- /* istanbul ignore next */
22387
+ /* c8 ignore next */
22388
22388
  this.props.onFocus([]);
22389
22389
  });
22390
22390
 
22391
22391
  _defineProperty(this, "_handleBlur", () => {
22392
- /* istanbul ignore next */
22392
+ /* c8 ignore next */
22393
22393
  this.props.onBlur([]);
22394
22394
  });
22395
22395
 
@@ -22423,12 +22423,12 @@ class Expression extends React__namespace.Component {
22423
22423
  // The widget itself is an input, so we return a single empty list to
22424
22424
  // indicate this.
22425
22425
 
22426
- /* istanbul ignore next */
22426
+ /* c8 ignore next */
22427
22427
  return [[]];
22428
22428
  });
22429
22429
 
22430
22430
  _defineProperty(this, "getGrammarTypeForPath", inputPath => {
22431
- /* istanbul ignore next */
22431
+ /* c8 ignore next */
22432
22432
  return "expression";
22433
22433
  });
22434
22434
 
@@ -22478,7 +22478,7 @@ class Expression extends React__namespace.Component {
22478
22478
  // in the function variables list for the expression.
22479
22479
 
22480
22480
  if (!expression.parsed) {
22481
- /* istanbul ignore next */
22481
+ /* c8 ignore next */
22482
22482
  Log.error("Unable to parse solution answer for expression", Errors.InvalidInput, {
22483
22483
  loggedMetadata: {
22484
22484
  rubric: JSON.stringify(rubric)
@@ -22782,7 +22782,7 @@ const keypadConfigurationForProps = widgetOptions => {
22782
22782
  };
22783
22783
 
22784
22784
  const propUpgrades$2 = {
22785
- /* istanbul ignore next */
22785
+ /* c8 ignore next */
22786
22786
  "1": v0props => ({
22787
22787
  times: v0props.times,
22788
22788
  buttonSets: v0props.buttonSets,
@@ -23050,12 +23050,12 @@ class InputNumber extends React__namespace.Component {
23050
23050
  // The widget itself is an input, so we return a single empty list to
23051
23051
  // indicate this.
23052
23052
 
23053
- /* istanbul ignore next */
23053
+ /* c8 ignore next */
23054
23054
  return [[]];
23055
23055
  });
23056
23056
 
23057
23057
  _defineProperty(this, "getGrammarTypeForPath", path => {
23058
- /* istanbul ignore next */
23058
+ /* c8 ignore next */
23059
23059
  return "number";
23060
23060
  });
23061
23061
 
@@ -23116,7 +23116,7 @@ class InputNumber extends React__namespace.Component {
23116
23116
  let correct = null;
23117
23117
  let answerBlurb = null; // SAT is deprecated and not testable
23118
23118
 
23119
- /* istanbul ignore if */
23119
+ /* c8 ignore if */
23120
23120
 
23121
23121
  if (this.props.apiOptions.satStyling && rubric) {
23122
23122
  const score = this.simpleValidate(rubric);
@@ -23160,7 +23160,7 @@ class InputNumber extends React__namespace.Component {
23160
23160
  linterContext: this.props.linterContext
23161
23161
  }); // SAT is deprecated, answer blurb is an SAT feature
23162
23162
 
23163
- /* istanbul ignore if */
23163
+ /* c8 ignore if */
23164
23164
 
23165
23165
  if (answerBlurb) {
23166
23166
  return /*#__PURE__*/React__namespace.createElement("span", {
@@ -23321,7 +23321,7 @@ class NumericInput extends React__namespace.Component {
23321
23321
  let answerBlurb;
23322
23322
  /* Ignore this block because SAT is deprecated */
23323
23323
 
23324
- /* istanbul ignore next */
23324
+ /* c8 ignore next */
23325
23325
 
23326
23326
  if (this.props.apiOptions.satStyling && rubric) {
23327
23327
  const score = this.simpleValidate(rubric);
@@ -23420,17 +23420,17 @@ class NumericInput extends React__namespace.Component {
23420
23420
  // The widget itself is an input, so we return a single empty list to
23421
23421
  // indicate this.
23422
23422
 
23423
- /* istanbul ignore next */
23423
+ /* c8 ignore next */
23424
23424
  return [[]];
23425
23425
  });
23426
23426
 
23427
23427
  _defineProperty(this, "getGrammarTypeForPath", inputPath => {
23428
- /* istanbul ignore next */
23428
+ /* c8 ignore next */
23429
23429
  return "number";
23430
23430
  });
23431
23431
 
23432
23432
  _defineProperty(this, "setInputValue", (path, newValue, cb) => {
23433
- /* istanbul ignore next */
23433
+ /* c8 ignore next */
23434
23434
  this.props.onChange({
23435
23435
  currentValue: newValue
23436
23436
  }, cb);
@@ -23639,7 +23639,7 @@ class NumericInput extends React__namespace.Component {
23639
23639
  });
23640
23640
  /* This only gets used with SAT Content */
23641
23641
 
23642
- /* istanbul ignore next if */
23642
+ /* c8 ignore next if */
23643
23643
 
23644
23644
  if (answerBlurb) {
23645
23645
  return /*#__PURE__*/React__namespace.createElement("span", {
@@ -26872,8 +26872,8 @@ function LibraryChoiceIcon(props) {
26872
26872
  }, /*#__PURE__*/React__namespace.createElement("div", {
26873
26873
  style: dynamicStyles,
26874
26874
  "data-test-id": "choice-icon__library-choice-icon",
26875
- className: aphrodite.css(styles$r.circle, showCorrectness && correct && styles$r.circleCorrect, showCorrectness && !correct && styles$r.circleIncorrect, showCorrectness && !correct && (checked || previouslyAnswered) && styles$r.circleIncorrectAnswered) // used in BaseRadio to check if we actually clicked on the
26876
- // radio icon
26875
+ className: aphrodite.css(styles$r.circle, showCorrectness && correct && styles$r.circleCorrect, showCorrectness && !correct && styles$r.circleIncorrect, showCorrectness && !correct && (checked || previouslyAnswered) && styles$r.circleIncorrectAnswered) // used in BaseRadio editMode to check
26876
+ // if we actually clicked on the radio icon
26877
26877
  ,
26878
26878
  "data-is-radio-icon": true
26879
26879
  }, /*#__PURE__*/React__namespace.createElement("div", {
@@ -27298,7 +27298,8 @@ function Choice(props) {
27298
27298
  },
27299
27299
  disabled: disabled || apiOptions.staticRender || apiOptions.readOnly,
27300
27300
  style: {
27301
- flex: 1
27301
+ flex: 1,
27302
+ color: Color__default["default"].offBlack
27302
27303
  },
27303
27304
  ref: forwardedRef,
27304
27305
  "aria-hidden": "true"
@@ -27654,7 +27655,7 @@ function BaseRadio(props) {
27654
27655
  style: {
27655
27656
  listStyle: "none"
27656
27657
  }
27657
- }, choices.map(function (choice, i) {
27658
+ }, choices.map((choice, i) => {
27658
27659
  let Element = Choice$1;
27659
27660
  const ref = /*#__PURE__*/React__namespace.createRef();
27660
27661
  choiceRefs.current[i] = ref;
@@ -27673,6 +27674,11 @@ function BaseRadio(props) {
27673
27674
  showRationale: choice.hasRationale && (reviewMode || choice.showRationale),
27674
27675
  pos: i,
27675
27676
  onChange: newValues => {
27677
+ // editMode selection is handled in clickHandler
27678
+ if (editMode) {
27679
+ return;
27680
+ }
27681
+
27676
27682
  updateChoice(i, newValues);
27677
27683
  },
27678
27684
  ref
@@ -27730,7 +27736,7 @@ function BaseRadio(props) {
27730
27736
  // radio icon, then we want to trigger the
27731
27737
  // check by flipping the choice of the icon.
27732
27738
  if (elem.getAttribute("data-is-radio-icon")) {
27733
- this.updateChoice(i, {
27739
+ updateChoice(i, {
27734
27740
  checked: !choice.checked,
27735
27741
  crossedOut: choice.crossedOut
27736
27742
  });
@@ -27754,7 +27760,7 @@ function BaseRadio(props) {
27754
27760
  onClick: clickHandler,
27755
27761
  onTouchStart: !labelWrap ? null : captureScratchpadTouchStart$2
27756
27762
  }, /*#__PURE__*/React__namespace.createElement(Element, elementProps));
27757
- }, this))); // Allow for horizontal scrolling if content is too wide, which may be
27763
+ }))); // Allow for horizontal scrolling if content is too wide, which may be
27758
27764
  // an issue especially on phones.
27759
27765
  // This is disabled in SAT, since it conflicts with their theming.
27760
27766
 
@@ -28101,7 +28107,7 @@ class Radio$1 extends React__namespace.Component {
28101
28107
  noneOfTheAboveSelected
28102
28108
  }; // Support legacy choiceState implementation
28103
28109
  }
28104
- /* istanbul ignore if - props.values is deprecated */
28110
+ /* c8 ignore if - props.values is deprecated */
28105
28111
 
28106
28112
 
28107
28113
  const {
@@ -28196,7 +28202,7 @@ class Radio$1 extends React__namespace.Component {
28196
28202
  } else if (this.props.values) {
28197
28203
  // Support legacy choiceStates implementation
28198
28204
 
28199
- /* istanbul ignore next - props.values is deprecated */
28205
+ /* c8 ignore next - props.values is deprecated */
28200
28206
  choiceStates = this.props.values.map(val => ({
28201
28207
  selected: val,
28202
28208
  crossedOut: false,
@@ -28579,7 +28585,7 @@ _defineProperty(Categorizer, "defaultProps", {
28579
28585
 
28580
28586
  const pageMargin = 16; // Stylesheets aren't directly testable
28581
28587
 
28582
- /* istanbul ignore next */
28588
+ /* c8 ignore next */
28583
28589
 
28584
28590
  const styles$m = aphrodite.StyleSheet.create({
28585
28591
  mobileTable: {