@khanacademy/perseus 48.2.0 → 49.0.0
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 +106 -75
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +72 -57
- package/dist/index.js.map +1 -1
- package/dist/widgets/label-image/answer-choices.d.ts +2 -1
- package/package.json +48 -48
package/dist/index.js
CHANGED
|
@@ -27638,36 +27638,41 @@ class Dropdown extends React__namespace.Component {
|
|
|
27638
27638
|
value: String(i + 1),
|
|
27639
27639
|
label: choice
|
|
27640
27640
|
}))];
|
|
27641
|
-
return
|
|
27642
|
-
|
|
27643
|
-
|
|
27644
|
-
|
|
27645
|
-
|
|
27646
|
-
|
|
27647
|
-
|
|
27648
|
-
|
|
27649
|
-
|
|
27650
|
-
|
|
27651
|
-
|
|
27652
|
-
e
|
|
27653
|
-
|
|
27654
|
-
|
|
27655
|
-
|
|
27656
|
-
|
|
27657
|
-
|
|
27658
|
-
|
|
27659
|
-
|
|
27660
|
-
|
|
27661
|
-
|
|
27662
|
-
|
|
27663
|
-
|
|
27664
|
-
|
|
27665
|
-
|
|
27666
|
-
|
|
27667
|
-
|
|
27668
|
-
|
|
27669
|
-
|
|
27670
|
-
|
|
27641
|
+
return (
|
|
27642
|
+
/*#__PURE__*/
|
|
27643
|
+
// TODO(WB-1812, somewhatabstract): Migrate to Id or useId
|
|
27644
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
27645
|
+
React__namespace.createElement(wonderBlocksCore.UniqueIDProvider, {
|
|
27646
|
+
scope: "dropdown-widget",
|
|
27647
|
+
mockOnFirstRender: true
|
|
27648
|
+
}, ids => /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View
|
|
27649
|
+
// NOTE(jared): These are required to prevent weird behavior
|
|
27650
|
+
// When there's a dropdown in a zoomable table.
|
|
27651
|
+
, {
|
|
27652
|
+
onClick: e => {
|
|
27653
|
+
e.stopPropagation();
|
|
27654
|
+
},
|
|
27655
|
+
onTouchStart: e => {
|
|
27656
|
+
e.stopPropagation();
|
|
27657
|
+
}
|
|
27658
|
+
}, this.props.visibleLabel && /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, {
|
|
27659
|
+
tag: "label",
|
|
27660
|
+
htmlFor: ids.get("dropdown")
|
|
27661
|
+
}, this.props.visibleLabel), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
|
|
27662
|
+
id: ids.get("dropdown"),
|
|
27663
|
+
placeholder: "",
|
|
27664
|
+
onChange: value => this._handleChange(parseInt(value)),
|
|
27665
|
+
selectedValue: String(this.props.selected),
|
|
27666
|
+
disabled: this.props.apiOptions.readOnly,
|
|
27667
|
+
"aria-label": this.props.ariaLabel || this.props.visibleLabel || this.context.strings.selectAnAnswer
|
|
27668
|
+
// This is currently necessary for SRs to read the labels properly.
|
|
27669
|
+
// However, WB is working on a change to add the "combobox" role to
|
|
27670
|
+
// all dropdowns.
|
|
27671
|
+
// See https://khanacademy.atlassian.net/browse/WB-1671
|
|
27672
|
+
,
|
|
27673
|
+
role: "combobox"
|
|
27674
|
+
}, children)))
|
|
27675
|
+
);
|
|
27671
27676
|
}
|
|
27672
27677
|
}
|
|
27673
27678
|
const optionsTransform = widgetOptions => {
|
|
@@ -27775,32 +27780,37 @@ class Explanation extends React__namespace.Component {
|
|
|
27775
27780
|
"white-space": "normal"
|
|
27776
27781
|
};
|
|
27777
27782
|
const contentStyling = [styles$k.content, this.state.expanded ? styles$k.contentExpanded : styles$k.contentCollapsed, allowTransition && (this.state.expanded ? styles$k.transitionExpanded : styles$k.transitionCollapsed)];
|
|
27778
|
-
return
|
|
27779
|
-
|
|
27780
|
-
|
|
27781
|
-
|
|
27782
|
-
|
|
27783
|
-
|
|
27784
|
-
|
|
27785
|
-
|
|
27786
|
-
|
|
27787
|
-
|
|
27788
|
-
|
|
27789
|
-
|
|
27790
|
-
|
|
27791
|
-
|
|
27792
|
-
|
|
27793
|
-
|
|
27794
|
-
|
|
27795
|
-
|
|
27796
|
-
|
|
27797
|
-
|
|
27798
|
-
|
|
27799
|
-
|
|
27800
|
-
|
|
27801
|
-
|
|
27802
|
-
|
|
27803
|
-
|
|
27783
|
+
return (
|
|
27784
|
+
/*#__PURE__*/
|
|
27785
|
+
// TODO(WB-1812, somewhatabstract): Migrate to Id or useId
|
|
27786
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
27787
|
+
React__namespace.createElement(wonderBlocksCore.UniqueIDProvider, {
|
|
27788
|
+
mockOnFirstRender: true,
|
|
27789
|
+
scope: "explanation-widget"
|
|
27790
|
+
}, ids => /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(Button__default["default"], {
|
|
27791
|
+
"aria-expanded": this.state.expanded,
|
|
27792
|
+
"aria-controls": ids.get("content"),
|
|
27793
|
+
endIcon: caretIcon,
|
|
27794
|
+
kind: "tertiary",
|
|
27795
|
+
labelStyle: labelStyle,
|
|
27796
|
+
onClick: this._onClick,
|
|
27797
|
+
size: "small",
|
|
27798
|
+
style: buttonStyleOverrides
|
|
27799
|
+
}, promptText), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
27800
|
+
id: ids.get("content"),
|
|
27801
|
+
style: contentStyling,
|
|
27802
|
+
"aria-hidden": !this.state.expanded,
|
|
27803
|
+
testId: "content-container"
|
|
27804
|
+
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
27805
|
+
style: styles$k.contentWrapper
|
|
27806
|
+
}, /*#__PURE__*/React__namespace.createElement(Renderer, {
|
|
27807
|
+
apiOptions: this.props.apiOptions,
|
|
27808
|
+
content: this.props.explanation,
|
|
27809
|
+
widgets: this.props.widgets,
|
|
27810
|
+
linterContext: this.props.linterContext,
|
|
27811
|
+
strings: this.context.strings
|
|
27812
|
+
})))))
|
|
27813
|
+
);
|
|
27804
27814
|
}
|
|
27805
27815
|
}
|
|
27806
27816
|
const leftBorderSpacing = 23;
|
|
@@ -39251,6 +39261,8 @@ const AnswerChoices = props => {
|
|
|
39251
39261
|
};
|
|
39252
39262
|
|
|
39253
39263
|
const HideAnswersToggle = props => {
|
|
39264
|
+
// TODO(WB-1812, somewhatabstract): Migrate to Id or useId
|
|
39265
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
39254
39266
|
const idFactory = wonderBlocksCore.useUniqueIdWithMock();
|
|
39255
39267
|
const switchId = idFactory.get("hide-answers-toggle");
|
|
39256
39268
|
const labelId = idFactory.get("hide-answers-label");
|
|
@@ -39296,6 +39308,9 @@ const AnswerPill = props => {
|
|
|
39296
39308
|
focused,
|
|
39297
39309
|
hovered
|
|
39298
39310
|
} = props;
|
|
39311
|
+
|
|
39312
|
+
// TODO(WB-1812, somewhatabstract): Migrate to Id or useId
|
|
39313
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
39299
39314
|
const idFactory = wonderBlocksCore.useUniqueIdWithMock();
|
|
39300
39315
|
const {
|
|
39301
39316
|
strings
|
|
@@ -45643,7 +45658,7 @@ const init = function () {
|
|
|
45643
45658
|
|
|
45644
45659
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
45645
45660
|
const libName = "@khanacademy/perseus";
|
|
45646
|
-
const libVersion = "
|
|
45661
|
+
const libVersion = "49.0.0";
|
|
45647
45662
|
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
45648
45663
|
|
|
45649
45664
|
const apiVersion = {
|