@khanacademy/perseus 19.6.0 → 19.6.2

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
@@ -24355,18 +24355,14 @@ class Categorizer extends React__namespace.Component {
24355
24355
  }, /*#__PURE__*/React__namespace.createElement("div", {
24356
24356
  className: ClassNames.INTERACTIVE,
24357
24357
  role: "button",
24358
- "aria-label": catName
24359
- // eslint-disable-next-line react/jsx-no-bind
24360
- ,
24361
- onClick: this.onChange.bind(this, itemNum, catNum)
24358
+ "aria-label": catName,
24359
+ onClick: () => this.onChange(itemNum, catNum)
24362
24360
  }, isMobile && /*#__PURE__*/React__namespace.createElement("input", {
24363
24361
  type: "radio",
24364
24362
  name: uniqueId,
24365
24363
  className: aphrodite.css(sharedStyles.responsiveInput, sharedStyles.responsiveRadioInput),
24366
- checked: selected
24367
- // eslint-disable-next-line react/jsx-no-bind
24368
- ,
24369
- onChange: this.onChange.bind(this, itemNum, catNum),
24364
+ checked: selected,
24365
+ onChange: () => this.onChange(itemNum, catNum),
24370
24366
  onClick: e => e.stopPropagation()
24371
24367
  }), !isMobile && /*#__PURE__*/React__namespace.createElement("span", {
24372
24368
  className: aphrodite.css(styles$r.radioSpan, selected && styles$r.checkedRadioSpan, this.props.static && selected && styles$r.staticCheckedRadioSpan)
@@ -24386,20 +24382,20 @@ class Categorizer extends React__namespace.Component {
24386
24382
  className: extraClassNames + " " + aphrodite.css(...inlineStyles)
24387
24383
  }, table);
24388
24384
  }
24389
- onChange = (itemNum, catNum) => {
24385
+ onChange(itemNum, catNum) {
24390
24386
  const values = [...this.props.values];
24391
24387
  // @ts-expect-error - TS2322 - Type 'number' is not assignable to type 'never'.
24392
24388
  values[itemNum] = catNum;
24393
24389
  this.change("values", values);
24394
24390
  this.props.trackInteraction();
24395
- };
24391
+ }
24396
24392
  simpleValidate = rubric => {
24397
24393
  return Categorizer.validate(this.getUserInput(), rubric);
24398
24394
  };
24399
24395
  static validate(userInput, rubric) {
24400
24396
  let completed = true;
24401
24397
  let allCorrect = true;
24402
- ___default["default"].each(rubric.values, function (value, i) {
24398
+ rubric.values.forEach((value, i) => {
24403
24399
  if (userInput.values[i] == null) {
24404
24400
  completed = false;
24405
24401
  }
@@ -24970,22 +24966,19 @@ class Explanation extends React__namespace.Component {
24970
24966
  this.props.trackInteraction();
24971
24967
  };
24972
24968
  render() {
24973
- const {
24974
- Link
24975
- } = this.props.apiOptions.baseElements;
24976
24969
  const {
24977
24970
  isArticle,
24978
24971
  isMobile
24979
24972
  } = this.props.apiOptions;
24980
- const linkAnchor = this.state.expanded ? this.props.hidePrompt : this.props.showPrompt;
24981
- let linkContainer;
24973
+ const promptText = this.state.expanded ? this.props.hidePrompt : this.props.showPrompt;
24974
+ let promptContainer;
24982
24975
 
24983
24976
  // TODO(diedra): This isn't a valid href;
24984
24977
  // change this to a button that looks like a link.
24985
24978
  const href = "javascript:void(0)";
24986
24979
  const onClick = this._onClick;
24987
24980
  if (isMobile) {
24988
- linkContainer = /*#__PURE__*/React__namespace.createElement("div", {
24981
+ promptContainer = /*#__PURE__*/React__namespace.createElement("div", {
24989
24982
  className: aphrodite.css(styles$o.linkContainer)
24990
24983
  }, /*#__PURE__*/React__namespace.createElement("a", {
24991
24984
  className: aphrodite.css(styles$o.mobileExplanationLink),
@@ -24993,7 +24986,7 @@ class Explanation extends React__namespace.Component {
24993
24986
  onClick: onClick,
24994
24987
  role: "button",
24995
24988
  "aria-expanded": this.state.expanded
24996
- }, linkAnchor), this.state.expanded && /*#__PURE__*/React__namespace.createElement("svg", {
24989
+ }, promptText), this.state.expanded && /*#__PURE__*/React__namespace.createElement("svg", {
24997
24990
  className: aphrodite.css(styles$o.disclosureArrow)
24998
24991
  }, /*#__PURE__*/React__namespace.createElement("polygon", {
24999
24992
  style: {
@@ -25002,41 +24995,18 @@ class Explanation extends React__namespace.Component {
25002
24995
  points: `0,${arrowHeight} ` + `${arrowWidth},${arrowHeight} ` + `${arrowWidth / 2},0`
25003
24996
  })));
25004
24997
  } else {
25005
- if (isArticle) {
25006
- // NOTE: For articles, the baseElements `Link` may is either be
25007
- // an anchor tag (if rendered in a modal) or a Wonder Blocks
25008
- // link component in lesson page, see: `article-page.jsx`.
25009
- linkContainer = /*#__PURE__*/React__namespace.createElement("div", {
25010
- className: aphrodite.css(styles$o.linkContainer, styles$o.articleLink)
25011
- }, /*#__PURE__*/React__namespace.createElement(Link, {
25012
- className: aphrodite.css(styles$o.explanationLink)
25013
- // HACK(michaelpolyak): WB Link doesn't passthrough
25014
- // class name.
25015
- ,
25016
- style: styles$o.explanationLink,
25017
- href: href,
25018
- onClick: onClick,
25019
- role: "button",
25020
- "aria-expanded": this.state.expanded
25021
- }, `[${linkAnchor}]`));
25022
- } else {
25023
- // NOTE: For exercises, the baseElements `Link` is an
25024
- // anchor tag, see: `perseus-api.jsx`.
25025
- linkContainer = /*#__PURE__*/React__namespace.createElement("div", {
25026
- className: aphrodite.css(styles$o.linkContainer, styles$o.exerciseLink)
25027
- }, /*#__PURE__*/React__namespace.createElement(Link, {
25028
- className: aphrodite.css(styles$o.explanationLink),
25029
- href: href,
25030
- onClick: onClick,
25031
- role: "button",
25032
- "aria-expanded": this.state.expanded
25033
- }, `[${linkAnchor}]`));
25034
- }
24998
+ const viewStyling = isArticle ? [styles$o.explanationLink, styles$o.articleLink] : [styles$o.explanationLink, styles$o.exerciseLink];
24999
+ promptContainer = /*#__PURE__*/React__namespace.createElement(Clickable__default["default"], {
25000
+ onClick: onClick,
25001
+ "aria-expanded": this.state.expanded
25002
+ }, () => /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
25003
+ style: viewStyling
25004
+ }, `[${promptText}]`));
25035
25005
  }
25036
25006
  const expandedStyle = isMobile ? styles$o.contentExpandedMobile : styles$o.contentExpanded;
25037
25007
  return /*#__PURE__*/React__namespace.createElement("div", {
25038
25008
  className: aphrodite.css(styles$o.container)
25039
- }, linkContainer, this.state.expanded && /*#__PURE__*/React__namespace.createElement("div", {
25009
+ }, promptContainer, this.state.expanded && /*#__PURE__*/React__namespace.createElement("div", {
25040
25010
  className: aphrodite.css(styles$o.content, isMobile && styles$o.contentMobile, this.state.expanded && expandedStyle)
25041
25011
  // eslint-disable-next-line react/no-string-refs
25042
25012
  ,
@@ -41718,7 +41688,7 @@ const init = function (options) {
41718
41688
 
41719
41689
  // This file is processed by a Rollup plugin (replace) to inject the production
41720
41690
  const libName = "@khanacademy/perseus";
41721
- const libVersion = "19.6.0";
41691
+ const libVersion = "19.6.2";
41722
41692
  perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
41723
41693
 
41724
41694
  const apiVersion = {