@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/es/index.js +25 -55
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +20 -50
- package/dist/index.js.map +1 -1
- package/dist/widgets/categorizer.d.ts +1 -1
- package/package.json +2 -2
package/dist/es/index.js
CHANGED
|
@@ -24184,13 +24184,6 @@ class Categorizer extends React.Component {
|
|
|
24184
24184
|
this.getUserInput = () => {
|
|
24185
24185
|
return Categorizer.getUserInputFromProps(this.props);
|
|
24186
24186
|
};
|
|
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
24187
|
this.simpleValidate = rubric => {
|
|
24195
24188
|
return Categorizer.validate(this.getUserInput(), rubric);
|
|
24196
24189
|
};
|
|
@@ -24242,18 +24235,14 @@ class Categorizer extends React.Component {
|
|
|
24242
24235
|
}, /*#__PURE__*/React.createElement("div", {
|
|
24243
24236
|
className: ClassNames.INTERACTIVE,
|
|
24244
24237
|
role: "button",
|
|
24245
|
-
"aria-label": catName
|
|
24246
|
-
|
|
24247
|
-
,
|
|
24248
|
-
onClick: this.onChange.bind(this, itemNum, catNum)
|
|
24238
|
+
"aria-label": catName,
|
|
24239
|
+
onClick: () => this.onChange(itemNum, catNum)
|
|
24249
24240
|
}, isMobile && /*#__PURE__*/React.createElement("input", {
|
|
24250
24241
|
type: "radio",
|
|
24251
24242
|
name: uniqueId,
|
|
24252
24243
|
className: css(sharedStyles.responsiveInput, sharedStyles.responsiveRadioInput),
|
|
24253
|
-
checked: selected
|
|
24254
|
-
|
|
24255
|
-
,
|
|
24256
|
-
onChange: this.onChange.bind(this, itemNum, catNum),
|
|
24244
|
+
checked: selected,
|
|
24245
|
+
onChange: () => this.onChange(itemNum, catNum),
|
|
24257
24246
|
onClick: e => e.stopPropagation()
|
|
24258
24247
|
}), !isMobile && /*#__PURE__*/React.createElement("span", {
|
|
24259
24248
|
className: css(styles$r.radioSpan, selected && styles$r.checkedRadioSpan, this.props.static && selected && styles$r.staticCheckedRadioSpan)
|
|
@@ -24273,10 +24262,17 @@ class Categorizer extends React.Component {
|
|
|
24273
24262
|
className: extraClassNames + " " + css(...inlineStyles)
|
|
24274
24263
|
}, table);
|
|
24275
24264
|
}
|
|
24265
|
+
onChange(itemNum, catNum) {
|
|
24266
|
+
const values = [...this.props.values];
|
|
24267
|
+
// @ts-expect-error - TS2322 - Type 'number' is not assignable to type 'never'.
|
|
24268
|
+
values[itemNum] = catNum;
|
|
24269
|
+
this.change("values", values);
|
|
24270
|
+
this.props.trackInteraction();
|
|
24271
|
+
}
|
|
24276
24272
|
static validate(userInput, rubric) {
|
|
24277
24273
|
let completed = true;
|
|
24278
24274
|
let allCorrect = true;
|
|
24279
|
-
|
|
24275
|
+
rubric.values.forEach((value, i) => {
|
|
24280
24276
|
if (userInput.values[i] == null) {
|
|
24281
24277
|
completed = false;
|
|
24282
24278
|
}
|
|
@@ -24844,22 +24840,19 @@ class Explanation extends React.Component {
|
|
|
24844
24840
|
};
|
|
24845
24841
|
}
|
|
24846
24842
|
render() {
|
|
24847
|
-
const {
|
|
24848
|
-
Link
|
|
24849
|
-
} = this.props.apiOptions.baseElements;
|
|
24850
24843
|
const {
|
|
24851
24844
|
isArticle,
|
|
24852
24845
|
isMobile
|
|
24853
24846
|
} = this.props.apiOptions;
|
|
24854
|
-
const
|
|
24855
|
-
let
|
|
24847
|
+
const promptText = this.state.expanded ? this.props.hidePrompt : this.props.showPrompt;
|
|
24848
|
+
let promptContainer;
|
|
24856
24849
|
|
|
24857
24850
|
// TODO(diedra): This isn't a valid href;
|
|
24858
24851
|
// change this to a button that looks like a link.
|
|
24859
24852
|
const href = "javascript:void(0)";
|
|
24860
24853
|
const onClick = this._onClick;
|
|
24861
24854
|
if (isMobile) {
|
|
24862
|
-
|
|
24855
|
+
promptContainer = /*#__PURE__*/React.createElement("div", {
|
|
24863
24856
|
className: css(styles$o.linkContainer)
|
|
24864
24857
|
}, /*#__PURE__*/React.createElement("a", {
|
|
24865
24858
|
className: css(styles$o.mobileExplanationLink),
|
|
@@ -24867,7 +24860,7 @@ class Explanation extends React.Component {
|
|
|
24867
24860
|
onClick: onClick,
|
|
24868
24861
|
role: "button",
|
|
24869
24862
|
"aria-expanded": this.state.expanded
|
|
24870
|
-
},
|
|
24863
|
+
}, promptText), this.state.expanded && /*#__PURE__*/React.createElement("svg", {
|
|
24871
24864
|
className: css(styles$o.disclosureArrow)
|
|
24872
24865
|
}, /*#__PURE__*/React.createElement("polygon", {
|
|
24873
24866
|
style: {
|
|
@@ -24876,41 +24869,18 @@ class Explanation extends React.Component {
|
|
|
24876
24869
|
points: `0,${arrowHeight} ` + `${arrowWidth},${arrowHeight} ` + `${arrowWidth / 2},0`
|
|
24877
24870
|
})));
|
|
24878
24871
|
} else {
|
|
24879
|
-
|
|
24880
|
-
|
|
24881
|
-
|
|
24882
|
-
|
|
24883
|
-
|
|
24884
|
-
|
|
24885
|
-
|
|
24886
|
-
className: css(styles$o.explanationLink)
|
|
24887
|
-
// HACK(michaelpolyak): WB Link doesn't passthrough
|
|
24888
|
-
// class name.
|
|
24889
|
-
,
|
|
24890
|
-
style: styles$o.explanationLink,
|
|
24891
|
-
href: href,
|
|
24892
|
-
onClick: onClick,
|
|
24893
|
-
role: "button",
|
|
24894
|
-
"aria-expanded": this.state.expanded
|
|
24895
|
-
}, `[${linkAnchor}]`));
|
|
24896
|
-
} else {
|
|
24897
|
-
// NOTE: For exercises, the baseElements `Link` is an
|
|
24898
|
-
// anchor tag, see: `perseus-api.jsx`.
|
|
24899
|
-
linkContainer = /*#__PURE__*/React.createElement("div", {
|
|
24900
|
-
className: css(styles$o.linkContainer, styles$o.exerciseLink)
|
|
24901
|
-
}, /*#__PURE__*/React.createElement(Link, {
|
|
24902
|
-
className: css(styles$o.explanationLink),
|
|
24903
|
-
href: href,
|
|
24904
|
-
onClick: onClick,
|
|
24905
|
-
role: "button",
|
|
24906
|
-
"aria-expanded": this.state.expanded
|
|
24907
|
-
}, `[${linkAnchor}]`));
|
|
24908
|
-
}
|
|
24872
|
+
const viewStyling = isArticle ? [styles$o.explanationLink, styles$o.articleLink] : [styles$o.explanationLink, styles$o.exerciseLink];
|
|
24873
|
+
promptContainer = /*#__PURE__*/React.createElement(Clickable, {
|
|
24874
|
+
onClick: onClick,
|
|
24875
|
+
"aria-expanded": this.state.expanded
|
|
24876
|
+
}, () => /*#__PURE__*/React.createElement(View, {
|
|
24877
|
+
style: viewStyling
|
|
24878
|
+
}, `[${promptText}]`));
|
|
24909
24879
|
}
|
|
24910
24880
|
const expandedStyle = isMobile ? styles$o.contentExpandedMobile : styles$o.contentExpanded;
|
|
24911
24881
|
return /*#__PURE__*/React.createElement("div", {
|
|
24912
24882
|
className: css(styles$o.container)
|
|
24913
|
-
},
|
|
24883
|
+
}, promptContainer, this.state.expanded && /*#__PURE__*/React.createElement("div", {
|
|
24914
24884
|
className: css(styles$o.content, isMobile && styles$o.contentMobile, this.state.expanded && expandedStyle)
|
|
24915
24885
|
// eslint-disable-next-line react/no-string-refs
|
|
24916
24886
|
,
|
|
@@ -41580,7 +41550,7 @@ const init = function init(options) {
|
|
|
41580
41550
|
|
|
41581
41551
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
41582
41552
|
const libName = "@khanacademy/perseus";
|
|
41583
|
-
const libVersion = "19.6.
|
|
41553
|
+
const libVersion = "19.6.2";
|
|
41584
41554
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
41585
41555
|
|
|
41586
41556
|
const apiVersion = {
|