@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/index.js CHANGED
@@ -17764,9 +17764,7 @@ class InteractionTracker {
17764
17764
 
17765
17765
  // @ts-expect-error [FEI-5003] - TS2564 - Property 'widgetType' has no initializer and is not definitely assigned in the constructor.
17766
17766
 
17767
- constructor(trackApi,
17768
- // original apiOptions.trackInteraction
17769
- widgetType, widgetID, setting // "" means track once
17767
+ constructor(trackApi, widgetType, widgetID, setting // "" means track once
17770
17768
  ) {
17771
17769
  _defineProperty(this, "_tracked", void 0);
17772
17770
  _defineProperty(this, "setting", void 0);
@@ -17782,7 +17780,6 @@ class InteractionTracker {
17782
17780
  this.trackApi({
17783
17781
  type: this.widgetType,
17784
17782
  id: this.widgetID,
17785
- // @ts-expect-error [FEI-5003] - TS2698 - Spread types may only be created from object types.
17786
17783
  ...extraData
17787
17784
  });
17788
17785
  });
@@ -22764,7 +22761,8 @@ const Choice = function (props) {
22764
22761
  style: {
22765
22762
  display: "flex",
22766
22763
  flexDirection: "row",
22767
- opacity: showDimmed ? 0.5 : 1.0
22764
+ opacity: showDimmed ? 0.5 : 1.0,
22765
+ overflow: "auto"
22768
22766
  }
22769
22767
  }, /*#__PURE__*/React__namespace.createElement("div", {
22770
22768
  className: "perseus-sr-only"
@@ -23240,6 +23238,7 @@ const styles$r = aphrodite.StyleSheet.create({
23240
23238
  color: gray17,
23241
23239
  fontSize: 14,
23242
23240
  lineHeight: 1.25,
23241
+ fontFamily: "inherit",
23243
23242
  fontStyle: "normal",
23244
23243
  fontWeight: "bold",
23245
23244
  marginBottom: 16
@@ -23310,13 +23309,13 @@ const styles$r = aphrodite.StyleSheet.create({
23310
23309
  responsiveContainer: {
23311
23310
  overflow: "auto",
23312
23311
  marginLeft: negativePhoneMargin,
23313
- marginRight: negativePhoneMargin,
23314
23312
  paddingLeft: phoneMargin
23315
23313
  // paddingRight is handled by responsiveFieldset
23316
23314
  },
23317
23315
 
23318
23316
  responsiveFieldset: {
23319
- paddingRight: phoneMargin
23317
+ paddingRight: phoneMargin,
23318
+ minWidth: "auto"
23320
23319
  }
23321
23320
  });
23322
23321
 
@@ -38173,10 +38172,11 @@ class Passage extends React__namespace.Component {
38173
38172
  const parsedContent = PassageMarkdown.parse(doubleQuoteParsedContent, parseState);
38174
38173
  // Check if the title has any non-empty text in it.
38175
38174
  const hasTitle = /\S/.test(this.props.passageTitle);
38175
+ const joinedTitle = joinString(this.props.passageTitle);
38176
38176
  return /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("div", {
38177
- className: "perseus-widget-passage-container"
38177
+ id: "perseus-widget-passage-container" + joinedTitle
38178
38178
  }, this._renderInstructions(parseState), /*#__PURE__*/React__namespace.createElement("div", {
38179
- className: "perseus-widget-passage"
38179
+ id: "perseus-widget-passage" + joinedTitle
38180
38180
  }, hasTitle && /*#__PURE__*/React__namespace.createElement("h3", {
38181
38181
  className: "passage-title"
38182
38182
  }, /*#__PURE__*/React__namespace.createElement(Renderer, {
@@ -38207,6 +38207,8 @@ class Passage extends React__namespace.Component {
38207
38207
  }, i18n__namespace._("End of reading passage.")))));
38208
38208
  }
38209
38209
  }
38210
+
38211
+ // That's All, Folks! => -thats-all-folks
38210
38212
  _defineProperty(Passage, "defaultProps", {
38211
38213
  passageTitle: "",
38212
38214
  passageText: "",
@@ -38215,6 +38217,7 @@ _defineProperty(Passage, "defaultProps", {
38215
38217
  highlights: {},
38216
38218
  linterContext: PerseusLinter.linterContextDefault
38217
38219
  });
38220
+ const joinString = title => "-" + title.toLowerCase().replace(/[^\w\s]/gi, "").trim().split(/\s+/).join("-");
38218
38221
  var Passage$1 = {
38219
38222
  name: "passage",
38220
38223
  displayName: "Passage (SAT only)",