@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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @khanacademy/perseus
2
2
 
3
+ ## 1.3.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 5a565227: bugfix for Radio editor selection and deletion
8
+
9
+ ## 1.3.3
10
+
11
+ ### Patch Changes
12
+
13
+ - 47d2afc0: Force radio text to be dark for contrast
14
+
3
15
  ## 1.3.2
4
16
 
5
17
  ### Patch Changes
package/dist/es/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/es/index.js CHANGED
@@ -19447,7 +19447,7 @@ class Renderer extends React.Component {
19447
19447
  // look like a widget ID (ie. `widget-type \d+`). I can't figure
19448
19448
  // out how to trigger this line of code though.
19449
19449
 
19450
- /* istanbul ignore next line */
19450
+ /* c8 ignore next line */
19451
19451
  return {};
19452
19452
  }
19453
19453
 
@@ -19786,7 +19786,7 @@ class Renderer extends React.Component {
19786
19786
  // reached. As noted above, these are always QuestionParagraphs
19787
19787
  // now.
19788
19788
 
19789
- /* istanbul ignore if */
19789
+ /* c8 ignore if */
19790
19790
 
19791
19791
  if (typeof nodeOut === "string" && lastWasString) {
19792
19792
  /**
@@ -22484,12 +22484,12 @@ class Expression extends React.Component {
22484
22484
  });
22485
22485
 
22486
22486
  _defineProperty(this, "_handleFocus", () => {
22487
- /* istanbul ignore next */
22487
+ /* c8 ignore next */
22488
22488
  this.props.onFocus([]);
22489
22489
  });
22490
22490
 
22491
22491
  _defineProperty(this, "_handleBlur", () => {
22492
- /* istanbul ignore next */
22492
+ /* c8 ignore next */
22493
22493
  this.props.onBlur([]);
22494
22494
  });
22495
22495
 
@@ -22523,12 +22523,12 @@ class Expression extends React.Component {
22523
22523
  // The widget itself is an input, so we return a single empty list to
22524
22524
  // indicate this.
22525
22525
 
22526
- /* istanbul ignore next */
22526
+ /* c8 ignore next */
22527
22527
  return [[]];
22528
22528
  });
22529
22529
 
22530
22530
  _defineProperty(this, "getGrammarTypeForPath", inputPath => {
22531
- /* istanbul ignore next */
22531
+ /* c8 ignore next */
22532
22532
  return "expression";
22533
22533
  });
22534
22534
 
@@ -22578,7 +22578,7 @@ class Expression extends React.Component {
22578
22578
  // in the function variables list for the expression.
22579
22579
 
22580
22580
  if (!expression.parsed) {
22581
- /* istanbul ignore next */
22581
+ /* c8 ignore next */
22582
22582
  Log.error("Unable to parse solution answer for expression", Errors.InvalidInput, {
22583
22583
  loggedMetadata: {
22584
22584
  rubric: JSON.stringify(rubric)
@@ -22884,7 +22884,7 @@ var keypadConfigurationForProps = widgetOptions => {
22884
22884
  };
22885
22885
 
22886
22886
  var propUpgrades$2 = {
22887
- /* istanbul ignore next */
22887
+ /* c8 ignore next */
22888
22888
  "1": v0props => ({
22889
22889
  times: v0props.times,
22890
22890
  buttonSets: v0props.buttonSets,
@@ -23155,12 +23155,12 @@ class InputNumber extends React.Component {
23155
23155
  // The widget itself is an input, so we return a single empty list to
23156
23156
  // indicate this.
23157
23157
 
23158
- /* istanbul ignore next */
23158
+ /* c8 ignore next */
23159
23159
  return [[]];
23160
23160
  });
23161
23161
 
23162
23162
  _defineProperty(this, "getGrammarTypeForPath", path => {
23163
- /* istanbul ignore next */
23163
+ /* c8 ignore next */
23164
23164
  return "number";
23165
23165
  });
23166
23166
 
@@ -23221,7 +23221,7 @@ class InputNumber extends React.Component {
23221
23221
  var correct = null;
23222
23222
  var answerBlurb = null; // SAT is deprecated and not testable
23223
23223
 
23224
- /* istanbul ignore if */
23224
+ /* c8 ignore if */
23225
23225
 
23226
23226
  if (this.props.apiOptions.satStyling && rubric) {
23227
23227
  var score = this.simpleValidate(rubric);
@@ -23265,7 +23265,7 @@ class InputNumber extends React.Component {
23265
23265
  linterContext: this.props.linterContext
23266
23266
  }); // SAT is deprecated, answer blurb is an SAT feature
23267
23267
 
23268
- /* istanbul ignore if */
23268
+ /* c8 ignore if */
23269
23269
 
23270
23270
  if (answerBlurb) {
23271
23271
  return /*#__PURE__*/React.createElement("span", {
@@ -23426,7 +23426,7 @@ class NumericInput extends React.Component {
23426
23426
  var answerBlurb;
23427
23427
  /* Ignore this block because SAT is deprecated */
23428
23428
 
23429
- /* istanbul ignore next */
23429
+ /* c8 ignore next */
23430
23430
 
23431
23431
  if (this.props.apiOptions.satStyling && rubric) {
23432
23432
  var score = this.simpleValidate(rubric);
@@ -23525,17 +23525,17 @@ class NumericInput extends React.Component {
23525
23525
  // The widget itself is an input, so we return a single empty list to
23526
23526
  // indicate this.
23527
23527
 
23528
- /* istanbul ignore next */
23528
+ /* c8 ignore next */
23529
23529
  return [[]];
23530
23530
  });
23531
23531
 
23532
23532
  _defineProperty(this, "getGrammarTypeForPath", inputPath => {
23533
- /* istanbul ignore next */
23533
+ /* c8 ignore next */
23534
23534
  return "number";
23535
23535
  });
23536
23536
 
23537
23537
  _defineProperty(this, "setInputValue", (path, newValue, cb) => {
23538
- /* istanbul ignore next */
23538
+ /* c8 ignore next */
23539
23539
  this.props.onChange({
23540
23540
  currentValue: newValue
23541
23541
  }, cb);
@@ -23744,7 +23744,7 @@ class NumericInput extends React.Component {
23744
23744
  });
23745
23745
  /* This only gets used with SAT Content */
23746
23746
 
23747
- /* istanbul ignore next if */
23747
+ /* c8 ignore next if */
23748
23748
 
23749
23749
  if (answerBlurb) {
23750
23750
  return /*#__PURE__*/React.createElement("span", {
@@ -26976,8 +26976,8 @@ function LibraryChoiceIcon(props) {
26976
26976
  }, /*#__PURE__*/React.createElement("div", {
26977
26977
  style: dynamicStyles,
26978
26978
  "data-test-id": "choice-icon__library-choice-icon",
26979
- className: 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
26980
- // radio icon
26979
+ className: 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
26980
+ // if we actually clicked on the radio icon
26981
26981
  ,
26982
26982
  "data-is-radio-icon": true
26983
26983
  }, /*#__PURE__*/React.createElement("div", {
@@ -27402,7 +27402,8 @@ function Choice(props) {
27402
27402
  },
27403
27403
  disabled: disabled || apiOptions.staticRender || apiOptions.readOnly,
27404
27404
  style: {
27405
- flex: 1
27405
+ flex: 1,
27406
+ color: Color.offBlack
27406
27407
  },
27407
27408
  ref: forwardedRef,
27408
27409
  "aria-hidden": "true"
@@ -27762,7 +27763,7 @@ function BaseRadio(props) {
27762
27763
  style: {
27763
27764
  listStyle: "none"
27764
27765
  }
27765
- }, choices.map(function (choice, i) {
27766
+ }, choices.map((choice, i) => {
27766
27767
  var Element = Choice$1;
27767
27768
  var ref = /*#__PURE__*/React.createRef();
27768
27769
  choiceRefs.current[i] = ref;
@@ -27781,6 +27782,11 @@ function BaseRadio(props) {
27781
27782
  showRationale: choice.hasRationale && (reviewMode || choice.showRationale),
27782
27783
  pos: i,
27783
27784
  onChange: newValues => {
27785
+ // editMode selection is handled in clickHandler
27786
+ if (editMode) {
27787
+ return;
27788
+ }
27789
+
27784
27790
  updateChoice(i, newValues);
27785
27791
  },
27786
27792
  ref
@@ -27838,7 +27844,7 @@ function BaseRadio(props) {
27838
27844
  // radio icon, then we want to trigger the
27839
27845
  // check by flipping the choice of the icon.
27840
27846
  if (elem.getAttribute("data-is-radio-icon")) {
27841
- this.updateChoice(i, {
27847
+ updateChoice(i, {
27842
27848
  checked: !choice.checked,
27843
27849
  crossedOut: choice.crossedOut
27844
27850
  });
@@ -27862,7 +27868,7 @@ function BaseRadio(props) {
27862
27868
  onClick: clickHandler,
27863
27869
  onTouchStart: !labelWrap ? null : captureScratchpadTouchStart$2
27864
27870
  }, /*#__PURE__*/React.createElement(Element, elementProps));
27865
- }, this))); // Allow for horizontal scrolling if content is too wide, which may be
27871
+ }))); // Allow for horizontal scrolling if content is too wide, which may be
27866
27872
  // an issue especially on phones.
27867
27873
  // This is disabled in SAT, since it conflicts with their theming.
27868
27874
 
@@ -28208,7 +28214,7 @@ class Radio$1 extends React.Component {
28208
28214
  noneOfTheAboveSelected
28209
28215
  }; // Support legacy choiceState implementation
28210
28216
  }
28211
- /* istanbul ignore if - props.values is deprecated */
28217
+ /* c8 ignore if - props.values is deprecated */
28212
28218
 
28213
28219
 
28214
28220
  var {
@@ -28303,7 +28309,7 @@ class Radio$1 extends React.Component {
28303
28309
  } else if (this.props.values) {
28304
28310
  // Support legacy choiceStates implementation
28305
28311
 
28306
- /* istanbul ignore next - props.values is deprecated */
28312
+ /* c8 ignore next - props.values is deprecated */
28307
28313
  choiceStates = this.props.values.map(val => ({
28308
28314
  selected: val,
28309
28315
  crossedOut: false,
@@ -28686,7 +28692,7 @@ _defineProperty(Categorizer, "defaultProps", {
28686
28692
 
28687
28693
  var pageMargin = 16; // Stylesheets aren't directly testable
28688
28694
 
28689
- /* istanbul ignore next */
28695
+ /* c8 ignore next */
28690
28696
 
28691
28697
  var styles$m = StyleSheet.create({
28692
28698
  mobileTable: {