@khanacademy/perseus 19.6.1 → 19.6.3

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/es/index.js CHANGED
@@ -19252,6 +19252,15 @@ const isIdPathPrefix = function isIdPathPrefix(prefixArray, wholeArray) {
19252
19252
  // some return a custom-built object, some delegate to
19253
19253
  // `WidgetJsonifyDeprecated` which returns an object containing widget props
19254
19254
  // (filtered by deprecated keys)).
19255
+ /**
19256
+ * The Widget type represents the common API that the Renderer uses to interact
19257
+ * with all widgets. All widgets must implement the methods in this API, unless
19258
+ * they are marked as optional (?: ...).
19259
+ *
19260
+ * These methods are called on the widget ref and allow the renderer to
19261
+ * communicate with the individual widgets to coordinate actions such as
19262
+ * scoring, state serialization/deserialization, and focus management.
19263
+ */
19255
19264
  class Renderer extends React.Component {
19256
19265
  constructor(_props) {
19257
19266
  super(_props);
@@ -24184,13 +24193,6 @@ class Categorizer extends React.Component {
24184
24193
  this.getUserInput = () => {
24185
24194
  return Categorizer.getUserInputFromProps(this.props);
24186
24195
  };
24187
- this.onChange = (itemNum, catNum) => {
24188
- const values = [...this.props.values];
24189
- // @ts-expect-error - TS2322 - Type 'number' is not assignable to type 'never'.
24190
- values[itemNum] = catNum;
24191
- this.change("values", values);
24192
- this.props.trackInteraction();
24193
- };
24194
24196
  this.simpleValidate = rubric => {
24195
24197
  return Categorizer.validate(this.getUserInput(), rubric);
24196
24198
  };
@@ -24242,18 +24244,14 @@ class Categorizer extends React.Component {
24242
24244
  }, /*#__PURE__*/React.createElement("div", {
24243
24245
  className: ClassNames.INTERACTIVE,
24244
24246
  role: "button",
24245
- "aria-label": catName
24246
- // eslint-disable-next-line react/jsx-no-bind
24247
- ,
24248
- onClick: this.onChange.bind(this, itemNum, catNum)
24247
+ "aria-label": catName,
24248
+ onClick: () => this.onChange(itemNum, catNum)
24249
24249
  }, isMobile && /*#__PURE__*/React.createElement("input", {
24250
24250
  type: "radio",
24251
24251
  name: uniqueId,
24252
24252
  className: css(sharedStyles.responsiveInput, sharedStyles.responsiveRadioInput),
24253
- checked: selected
24254
- // eslint-disable-next-line react/jsx-no-bind
24255
- ,
24256
- onChange: this.onChange.bind(this, itemNum, catNum),
24253
+ checked: selected,
24254
+ onChange: () => this.onChange(itemNum, catNum),
24257
24255
  onClick: e => e.stopPropagation()
24258
24256
  }), !isMobile && /*#__PURE__*/React.createElement("span", {
24259
24257
  className: css(styles$r.radioSpan, selected && styles$r.checkedRadioSpan, this.props.static && selected && styles$r.staticCheckedRadioSpan)
@@ -24273,10 +24271,17 @@ class Categorizer extends React.Component {
24273
24271
  className: extraClassNames + " " + css(...inlineStyles)
24274
24272
  }, table);
24275
24273
  }
24274
+ onChange(itemNum, catNum) {
24275
+ const values = [...this.props.values];
24276
+ // @ts-expect-error - TS2322 - Type 'number' is not assignable to type 'never'.
24277
+ values[itemNum] = catNum;
24278
+ this.change("values", values);
24279
+ this.props.trackInteraction();
24280
+ }
24276
24281
  static validate(userInput, rubric) {
24277
24282
  let completed = true;
24278
24283
  let allCorrect = true;
24279
- _.each(rubric.values, function (value, i) {
24284
+ rubric.values.forEach((value, i) => {
24280
24285
  if (userInput.values[i] == null) {
24281
24286
  completed = false;
24282
24287
  }
@@ -41554,7 +41559,7 @@ const init = function init(options) {
41554
41559
 
41555
41560
  // This file is processed by a Rollup plugin (replace) to inject the production
41556
41561
  const libName = "@khanacademy/perseus";
41557
- const libVersion = "19.6.1";
41562
+ const libVersion = "19.6.3";
41558
41563
  addLibraryVersionToPerseusDebug(libName, libVersion);
41559
41564
 
41560
41565
  const apiVersion = {