@khanacademy/perseus 6.4.4 → 6.5.1

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 (34) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/es/index.css +607 -388
  3. package/dist/es/index.js +12 -8
  4. package/dist/es/index.js.map +1 -1
  5. package/dist/index.css +607 -388
  6. package/dist/index.js +12 -9
  7. package/dist/index.js.map +1 -1
  8. package/dist/interaction-tracker.d.ts +3 -3
  9. package/dist/interaction-tracker.js.flow +4 -2
  10. package/dist/perseus-api.d.ts +5 -1
  11. package/dist/perseus-api.js.flow +7 -1
  12. package/dist/server-item-renderer.js.flow +4 -4
  13. package/dist/types.d.ts +5 -1
  14. package/dist/types.js.flow +5 -1
  15. package/dist/widgets/radio/choice.js.flow +1 -4
  16. package/package.json +2 -2
  17. package/src/__stories__/item-renderer.stories.tsx +5 -0
  18. package/src/__testdata__/item-renderer.testdata.ts +139 -0
  19. package/src/interaction-tracker.ts +4 -3
  20. package/src/multi-items/__tests__/__snapshots__/multi-renderer.test.tsx.snap +8 -8
  21. package/src/styles/articles.less +24 -18
  22. package/src/styles/khan-exercise.css +577 -365
  23. package/src/styles/widgets/passage.less +37 -28
  24. package/src/types.ts +9 -1
  25. package/src/widgets/__stories__/passage-ref.stories.tsx +18 -7
  26. package/src/widgets/__stories__/passage.stories.tsx +16 -3
  27. package/src/widgets/__tests__/__snapshots__/group.test.tsx.snap +8 -8
  28. package/src/widgets/__tests__/__snapshots__/passage-ref.test.ts.snap +6 -6
  29. package/src/widgets/__tests__/__snapshots__/passage.test.tsx.snap +12 -12
  30. package/src/widgets/__tests__/__snapshots__/radio.test.ts.snap +49 -49
  31. package/src/widgets/passage.tsx +13 -2
  32. package/src/widgets/radio/base-radio.tsx +2 -1
  33. package/src/widgets/radio/choice.tsx +1 -0
  34. package/tsconfig-build.tsbuildinfo +1 -1
package/dist/es/index.js CHANGED
@@ -17702,9 +17702,7 @@ class InteractionTracker {
17702
17702
 
17703
17703
  // @ts-expect-error [FEI-5003] - TS2564 - Property 'widgetType' has no initializer and is not definitely assigned in the constructor.
17704
17704
 
17705
- constructor(trackApi,
17706
- // original apiOptions.trackInteraction
17707
- widgetType, widgetID, setting // "" means track once
17705
+ constructor(trackApi, widgetType, widgetID, setting // "" means track once
17708
17706
  ) {
17709
17707
  this._tracked = void 0;
17710
17708
  this.setting = void 0;
@@ -22685,7 +22683,8 @@ const Choice = function Choice(props) {
22685
22683
  style: {
22686
22684
  display: "flex",
22687
22685
  flexDirection: "row",
22688
- opacity: showDimmed ? 0.5 : 1.0
22686
+ opacity: showDimmed ? 0.5 : 1.0,
22687
+ overflow: "auto"
22689
22688
  }
22690
22689
  }, /*#__PURE__*/React.createElement("div", {
22691
22690
  className: "perseus-sr-only"
@@ -23154,6 +23153,7 @@ const styles$r = StyleSheet.create({
23154
23153
  color: gray17,
23155
23154
  fontSize: 14,
23156
23155
  lineHeight: 1.25,
23156
+ fontFamily: "inherit",
23157
23157
  fontStyle: "normal",
23158
23158
  fontWeight: "bold",
23159
23159
  marginBottom: 16
@@ -23224,13 +23224,13 @@ const styles$r = StyleSheet.create({
23224
23224
  responsiveContainer: {
23225
23225
  overflow: "auto",
23226
23226
  marginLeft: negativePhoneMargin,
23227
- marginRight: negativePhoneMargin,
23228
23227
  paddingLeft: phoneMargin
23229
23228
  // paddingRight is handled by responsiveFieldset
23230
23229
  },
23231
23230
 
23232
23231
  responsiveFieldset: {
23233
- paddingRight: phoneMargin
23232
+ paddingRight: phoneMargin,
23233
+ minWidth: "auto"
23234
23234
  }
23235
23235
  });
23236
23236
 
@@ -37974,10 +37974,11 @@ class Passage extends React.Component {
37974
37974
  const parsedContent = PassageMarkdown.parse(doubleQuoteParsedContent, parseState);
37975
37975
  // Check if the title has any non-empty text in it.
37976
37976
  const hasTitle = /\S/.test(this.props.passageTitle);
37977
+ const joinedTitle = joinString(this.props.passageTitle);
37977
37978
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
37978
- className: "perseus-widget-passage-container"
37979
+ id: "perseus-widget-passage-container" + joinedTitle
37979
37980
  }, this._renderInstructions(parseState), /*#__PURE__*/React.createElement("div", {
37980
- className: "perseus-widget-passage"
37981
+ id: "perseus-widget-passage" + joinedTitle
37981
37982
  }, hasTitle && /*#__PURE__*/React.createElement("h3", {
37982
37983
  className: "passage-title"
37983
37984
  }, /*#__PURE__*/React.createElement(Renderer, {
@@ -38008,6 +38009,8 @@ class Passage extends React.Component {
38008
38009
  }, i18n._("End of reading passage.")))));
38009
38010
  }
38010
38011
  }
38012
+
38013
+ // That's All, Folks! => -thats-all-folks
38011
38014
  Passage.defaultProps = {
38012
38015
  passageTitle: "",
38013
38016
  passageText: "",
@@ -38016,6 +38019,7 @@ Passage.defaultProps = {
38016
38019
  highlights: {},
38017
38020
  linterContext: linterContextDefault
38018
38021
  };
38022
+ const joinString = title => "-" + title.toLowerCase().replace(/[^\w\s]/gi, "").trim().split(/\s+/).join("-");
38019
38023
  var Passage$1 = {
38020
38024
  name: "passage",
38021
38025
  displayName: "Passage (SAT only)",