@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/es/index.js
CHANGED
|
@@ -44,13 +44,21 @@ import cornersOutIcon from '@phosphor-icons/core/regular/corners-out.svg';
|
|
|
44
44
|
import Link from '@khanacademy/wonder-blocks-link';
|
|
45
45
|
|
|
46
46
|
function _extends() {
|
|
47
|
-
|
|
48
|
-
for (var
|
|
49
|
-
var
|
|
50
|
-
|
|
47
|
+
_extends = Object.assign || function (target) {
|
|
48
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
49
|
+
var source = arguments[i];
|
|
50
|
+
|
|
51
|
+
for (var key in source) {
|
|
52
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
53
|
+
target[key] = source[key];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
51
56
|
}
|
|
52
|
-
|
|
53
|
-
|
|
57
|
+
|
|
58
|
+
return target;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return _extends.apply(this, arguments);
|
|
54
62
|
}
|
|
55
63
|
|
|
56
64
|
/**
|
|
@@ -4445,14 +4453,17 @@ const InteractiveUtil = {
|
|
|
4445
4453
|
}
|
|
4446
4454
|
};
|
|
4447
4455
|
|
|
4448
|
-
function _classPrivateFieldBase(
|
|
4449
|
-
if (!
|
|
4450
|
-
|
|
4456
|
+
function _classPrivateFieldBase(receiver, privateKey) {
|
|
4457
|
+
if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) {
|
|
4458
|
+
throw new TypeError("attempted to use private field on non-instance");
|
|
4459
|
+
}
|
|
4460
|
+
|
|
4461
|
+
return receiver;
|
|
4451
4462
|
}
|
|
4452
4463
|
|
|
4453
4464
|
var id = 0;
|
|
4454
|
-
function _classPrivateFieldKey(
|
|
4455
|
-
return "__private_" + id++ + "_" +
|
|
4465
|
+
function _classPrivateFieldKey(name) {
|
|
4466
|
+
return "__private_" + id++ + "_" + name;
|
|
4456
4467
|
}
|
|
4457
4468
|
|
|
4458
4469
|
/*!
|
|
@@ -21081,14 +21092,19 @@ TextInput.defaultProps = {
|
|
|
21081
21092
|
disabled: false
|
|
21082
21093
|
};
|
|
21083
21094
|
|
|
21084
|
-
function _objectWithoutPropertiesLoose(
|
|
21085
|
-
if (
|
|
21086
|
-
var
|
|
21087
|
-
|
|
21088
|
-
|
|
21089
|
-
|
|
21095
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
21096
|
+
if (source == null) return {};
|
|
21097
|
+
var target = {};
|
|
21098
|
+
var sourceKeys = Object.keys(source);
|
|
21099
|
+
var key, i;
|
|
21100
|
+
|
|
21101
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
21102
|
+
key = sourceKeys[i];
|
|
21103
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
21104
|
+
target[key] = source[key];
|
|
21090
21105
|
}
|
|
21091
|
-
|
|
21106
|
+
|
|
21107
|
+
return target;
|
|
21092
21108
|
}
|
|
21093
21109
|
|
|
21094
21110
|
const _excluded$7 = ["position", "visibility", "left", "top"];
|
|
@@ -27369,36 +27385,41 @@ class Dropdown extends React.Component {
|
|
|
27369
27385
|
value: String(i + 1),
|
|
27370
27386
|
label: choice
|
|
27371
27387
|
}))];
|
|
27372
|
-
return
|
|
27373
|
-
|
|
27374
|
-
|
|
27375
|
-
|
|
27376
|
-
|
|
27377
|
-
|
|
27378
|
-
|
|
27379
|
-
|
|
27380
|
-
|
|
27381
|
-
|
|
27382
|
-
|
|
27383
|
-
e
|
|
27384
|
-
|
|
27385
|
-
|
|
27386
|
-
|
|
27387
|
-
|
|
27388
|
-
|
|
27389
|
-
|
|
27390
|
-
|
|
27391
|
-
|
|
27392
|
-
|
|
27393
|
-
|
|
27394
|
-
|
|
27395
|
-
|
|
27396
|
-
|
|
27397
|
-
|
|
27398
|
-
|
|
27399
|
-
|
|
27400
|
-
|
|
27401
|
-
|
|
27388
|
+
return (
|
|
27389
|
+
/*#__PURE__*/
|
|
27390
|
+
// TODO(WB-1812, somewhatabstract): Migrate to Id or useId
|
|
27391
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
27392
|
+
React.createElement(UniqueIDProvider, {
|
|
27393
|
+
scope: "dropdown-widget",
|
|
27394
|
+
mockOnFirstRender: true
|
|
27395
|
+
}, ids => /*#__PURE__*/React.createElement(View
|
|
27396
|
+
// NOTE(jared): These are required to prevent weird behavior
|
|
27397
|
+
// When there's a dropdown in a zoomable table.
|
|
27398
|
+
, {
|
|
27399
|
+
onClick: e => {
|
|
27400
|
+
e.stopPropagation();
|
|
27401
|
+
},
|
|
27402
|
+
onTouchStart: e => {
|
|
27403
|
+
e.stopPropagation();
|
|
27404
|
+
}
|
|
27405
|
+
}, this.props.visibleLabel && /*#__PURE__*/React.createElement(LabelLarge, {
|
|
27406
|
+
tag: "label",
|
|
27407
|
+
htmlFor: ids.get("dropdown")
|
|
27408
|
+
}, this.props.visibleLabel), /*#__PURE__*/React.createElement(SingleSelect, {
|
|
27409
|
+
id: ids.get("dropdown"),
|
|
27410
|
+
placeholder: "",
|
|
27411
|
+
onChange: value => this._handleChange(parseInt(value)),
|
|
27412
|
+
selectedValue: String(this.props.selected),
|
|
27413
|
+
disabled: this.props.apiOptions.readOnly,
|
|
27414
|
+
"aria-label": this.props.ariaLabel || this.props.visibleLabel || this.context.strings.selectAnAnswer
|
|
27415
|
+
// This is currently necessary for SRs to read the labels properly.
|
|
27416
|
+
// However, WB is working on a change to add the "combobox" role to
|
|
27417
|
+
// all dropdowns.
|
|
27418
|
+
// See https://khanacademy.atlassian.net/browse/WB-1671
|
|
27419
|
+
,
|
|
27420
|
+
role: "combobox"
|
|
27421
|
+
}, children)))
|
|
27422
|
+
);
|
|
27402
27423
|
}
|
|
27403
27424
|
}
|
|
27404
27425
|
Dropdown.contextType = PerseusI18nContext;
|
|
@@ -27501,32 +27522,37 @@ class Explanation extends React.Component {
|
|
|
27501
27522
|
"white-space": "normal"
|
|
27502
27523
|
};
|
|
27503
27524
|
const contentStyling = [styles$k.content, this.state.expanded ? styles$k.contentExpanded : styles$k.contentCollapsed, allowTransition && (this.state.expanded ? styles$k.transitionExpanded : styles$k.transitionCollapsed)];
|
|
27504
|
-
return
|
|
27505
|
-
|
|
27506
|
-
|
|
27507
|
-
|
|
27508
|
-
|
|
27509
|
-
|
|
27510
|
-
|
|
27511
|
-
|
|
27512
|
-
|
|
27513
|
-
|
|
27514
|
-
|
|
27515
|
-
|
|
27516
|
-
|
|
27517
|
-
|
|
27518
|
-
|
|
27519
|
-
|
|
27520
|
-
|
|
27521
|
-
|
|
27522
|
-
|
|
27523
|
-
|
|
27524
|
-
|
|
27525
|
-
|
|
27526
|
-
|
|
27527
|
-
|
|
27528
|
-
|
|
27529
|
-
|
|
27525
|
+
return (
|
|
27526
|
+
/*#__PURE__*/
|
|
27527
|
+
// TODO(WB-1812, somewhatabstract): Migrate to Id or useId
|
|
27528
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
27529
|
+
React.createElement(UniqueIDProvider, {
|
|
27530
|
+
mockOnFirstRender: true,
|
|
27531
|
+
scope: "explanation-widget"
|
|
27532
|
+
}, ids => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
27533
|
+
"aria-expanded": this.state.expanded,
|
|
27534
|
+
"aria-controls": ids.get("content"),
|
|
27535
|
+
endIcon: caretIcon,
|
|
27536
|
+
kind: "tertiary",
|
|
27537
|
+
labelStyle: labelStyle,
|
|
27538
|
+
onClick: this._onClick,
|
|
27539
|
+
size: "small",
|
|
27540
|
+
style: buttonStyleOverrides
|
|
27541
|
+
}, promptText), /*#__PURE__*/React.createElement(View, {
|
|
27542
|
+
id: ids.get("content"),
|
|
27543
|
+
style: contentStyling,
|
|
27544
|
+
"aria-hidden": !this.state.expanded,
|
|
27545
|
+
testId: "content-container"
|
|
27546
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
27547
|
+
style: styles$k.contentWrapper
|
|
27548
|
+
}, /*#__PURE__*/React.createElement(Renderer, {
|
|
27549
|
+
apiOptions: this.props.apiOptions,
|
|
27550
|
+
content: this.props.explanation,
|
|
27551
|
+
widgets: this.props.widgets,
|
|
27552
|
+
linterContext: this.props.linterContext,
|
|
27553
|
+
strings: this.context.strings
|
|
27554
|
+
})))))
|
|
27555
|
+
);
|
|
27530
27556
|
}
|
|
27531
27557
|
}
|
|
27532
27558
|
Explanation.contextType = PerseusI18nContext;
|
|
@@ -38888,6 +38914,8 @@ const AnswerChoices = props => {
|
|
|
38888
38914
|
};
|
|
38889
38915
|
|
|
38890
38916
|
const HideAnswersToggle = props => {
|
|
38917
|
+
// TODO(WB-1812, somewhatabstract): Migrate to Id or useId
|
|
38918
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
38891
38919
|
const idFactory = useUniqueIdWithMock();
|
|
38892
38920
|
const switchId = idFactory.get("hide-answers-toggle");
|
|
38893
38921
|
const labelId = idFactory.get("hide-answers-label");
|
|
@@ -38933,6 +38961,9 @@ const AnswerPill = props => {
|
|
|
38933
38961
|
focused,
|
|
38934
38962
|
hovered
|
|
38935
38963
|
} = props;
|
|
38964
|
+
|
|
38965
|
+
// TODO(WB-1812, somewhatabstract): Migrate to Id or useId
|
|
38966
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
38936
38967
|
const idFactory = useUniqueIdWithMock();
|
|
38937
38968
|
const {
|
|
38938
38969
|
strings
|
|
@@ -45276,7 +45307,7 @@ const init = function init() {
|
|
|
45276
45307
|
|
|
45277
45308
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
45278
45309
|
const libName = "@khanacademy/perseus";
|
|
45279
|
-
const libVersion = "
|
|
45310
|
+
const libVersion = "49.0.0";
|
|
45280
45311
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
45281
45312
|
|
|
45282
45313
|
const apiVersion = {
|