@khanacademy/perseus 12.3.0 → 12.4.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/CHANGELOG.md +19 -0
- package/dist/es/index.css +3 -3
- package/dist/es/index.js +52 -15
- package/dist/es/index.js.map +1 -1
- package/dist/index.css +3 -3
- package/dist/index.js +56 -16
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/src/__tests__/widget-container.test.tsx +126 -0
- package/src/error-boundary.tsx +1 -0
- package/src/styles/articles.less +3 -1
- package/src/styles/perseus-renderer.less +1 -1
- package/src/widget-container.tsx +2 -1
- package/src/widgets/__tests__/__snapshots__/graded-group-set.test.ts.snap +50 -19
- package/src/widgets/graded-group-set.tsx +70 -25
- package/tsconfig-build.tsbuildinfo +1 -1
package/dist/index.css
CHANGED
|
@@ -1742,11 +1742,11 @@ body.mobile ul.inequalities-one-line-radios > li {
|
|
|
1742
1742
|
.framework-perseus.perseus-mobile .clearfix > .perseus-renderer {
|
|
1743
1743
|
margin-bottom: 32px;
|
|
1744
1744
|
}
|
|
1745
|
-
.framework-perseus.perseus-mobile .perseus-renderer > .paragraph ul:not(.perseus-widget-radio) {
|
|
1745
|
+
.framework-perseus.perseus-mobile .perseus-renderer > .paragraph ul:not(.perseus-widget-radio, .indicatorContainer) {
|
|
1746
1746
|
margin: 0 0 0 1em;
|
|
1747
1747
|
padding: 0;
|
|
1748
1748
|
}
|
|
1749
|
-
.framework-perseus.perseus-mobile .perseus-renderer > .paragraph ul:not(.perseus-widget-radio) > li {
|
|
1749
|
+
.framework-perseus.perseus-mobile .perseus-renderer > .paragraph ul:not(.perseus-widget-radio, .indicatorContainer) > li {
|
|
1750
1750
|
padding-left: 10px;
|
|
1751
1751
|
margin-bottom: 24px;
|
|
1752
1752
|
}
|
|
@@ -2394,7 +2394,7 @@ img.zoom-img {
|
|
|
2394
2394
|
.framework-perseus .perseus-renderer > .paragraph > ol {
|
|
2395
2395
|
margin: -11px 0px 22px 0px;
|
|
2396
2396
|
}
|
|
2397
|
-
.framework-perseus .paragraph ul:not(.perseus-widget-radio) {
|
|
2397
|
+
.framework-perseus .paragraph ul:not(.perseus-widget-radio, .indicatorContainer) {
|
|
2398
2398
|
padding-left: 35px;
|
|
2399
2399
|
list-style-type: disc;
|
|
2400
2400
|
}
|
package/dist/index.js
CHANGED
|
@@ -17397,9 +17397,11 @@ class ErrorBoundary extends React__namespace.Component {
|
|
|
17397
17397
|
};
|
|
17398
17398
|
}
|
|
17399
17399
|
componentDidCatch(error, info) {
|
|
17400
|
+
var _this$props$onError, _this$props;
|
|
17400
17401
|
this.setState({
|
|
17401
17402
|
error: error.toString()
|
|
17402
17403
|
});
|
|
17404
|
+
(_this$props$onError = (_this$props = this.props).onError) === null || _this$props$onError === void 0 ? void 0 : _this$props$onError.call(_this$props, error, info);
|
|
17403
17405
|
Log.error("Perseus error boundary caught error", Errors.Internal, {
|
|
17404
17406
|
cause: error,
|
|
17405
17407
|
loggedMetadata: {
|
|
@@ -18882,11 +18884,12 @@ class WidgetContainer extends React__namespace.Component {
|
|
|
18882
18884
|
widget_type: type,
|
|
18883
18885
|
widget_id: this.props.id
|
|
18884
18886
|
},
|
|
18885
|
-
onError:
|
|
18887
|
+
onError: () => {
|
|
18886
18888
|
analytics.onAnalyticsEvent({
|
|
18887
18889
|
type: "perseus:widget-rendering-error",
|
|
18888
18890
|
payload: {
|
|
18889
|
-
widgetType: type
|
|
18891
|
+
widgetType: type,
|
|
18892
|
+
widgetId: this.props.id
|
|
18890
18893
|
}
|
|
18891
18894
|
});
|
|
18892
18895
|
}
|
|
@@ -25060,24 +25063,38 @@ class Indicators extends React__namespace.Component {
|
|
|
25060
25063
|
}
|
|
25061
25064
|
render() {
|
|
25062
25065
|
return /*#__PURE__*/React__namespace.createElement("ul", {
|
|
25063
|
-
|
|
25066
|
+
// reduntantly add class name for use in .less files--
|
|
25067
|
+
// the styles object key gets hashed
|
|
25068
|
+
className: classNames__default["default"](aphrodite.css(styles$j.indicatorContainer), "indicatorContainer")
|
|
25064
25069
|
}, this.props.gradedGroups.map((_ref, i) => {
|
|
25065
25070
|
let {
|
|
25066
25071
|
title
|
|
25067
25072
|
} = _ref;
|
|
25068
25073
|
return /*#__PURE__*/React__namespace.createElement("li", {
|
|
25074
|
+
className: aphrodite.css(styles$j.indicator),
|
|
25075
|
+
key: title
|
|
25076
|
+
}, /*#__PURE__*/React__namespace.createElement(Clickable__default["default"], {
|
|
25069
25077
|
role: "button",
|
|
25070
25078
|
"aria-label": i18n__namespace._("Skip to %(title)s", {
|
|
25071
25079
|
title
|
|
25072
25080
|
}),
|
|
25073
|
-
|
|
25074
|
-
className: aphrodite.css(styles$j.indicator, i === this.props.currentGroup && styles$j.selectedIndicator),
|
|
25075
|
-
tabIndex: 0,
|
|
25081
|
+
style: styles$j.indicatorButton,
|
|
25076
25082
|
onClick: () => this.props.onChangeCurrentGroup(i),
|
|
25077
25083
|
onKeyDown: e => this.handleKeyDown(e, i)
|
|
25078
|
-
},
|
|
25079
|
-
|
|
25080
|
-
|
|
25084
|
+
}, _ref2 => {
|
|
25085
|
+
let {
|
|
25086
|
+
hovered,
|
|
25087
|
+
focused,
|
|
25088
|
+
pressed
|
|
25089
|
+
} = _ref2;
|
|
25090
|
+
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
25091
|
+
style: [styles$j.indicatorDot, (hovered || focused || pressed) && styles$j.indicatorDotFocused]
|
|
25092
|
+
}, i === this.props.currentGroup && /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
25093
|
+
style: styles$j.indicatorDotActive
|
|
25094
|
+
}, /*#__PURE__*/React__namespace.createElement("span", {
|
|
25095
|
+
className: aphrodite.css(a11y.srOnly)
|
|
25096
|
+
}, i18n__namespace._("Current"))));
|
|
25097
|
+
}));
|
|
25081
25098
|
}));
|
|
25082
25099
|
}
|
|
25083
25100
|
}
|
|
@@ -25231,19 +25248,42 @@ const styles$j = aphrodite.StyleSheet.create({
|
|
|
25231
25248
|
display: "flex",
|
|
25232
25249
|
flexDirection: "row",
|
|
25233
25250
|
listStyle: "none",
|
|
25234
|
-
margin: "unset"
|
|
25251
|
+
margin: "unset",
|
|
25252
|
+
paddingInlineStart: "unset",
|
|
25253
|
+
flexWrap: "wrap"
|
|
25235
25254
|
},
|
|
25236
25255
|
indicator: {
|
|
25256
|
+
width: 24,
|
|
25257
|
+
height: 24
|
|
25258
|
+
},
|
|
25259
|
+
indicatorButton: {
|
|
25260
|
+
width: "100%",
|
|
25261
|
+
height: "100%",
|
|
25262
|
+
display: "flex",
|
|
25263
|
+
flexWrap: "wrap",
|
|
25264
|
+
placeContent: "center",
|
|
25265
|
+
cursor: "pointer",
|
|
25266
|
+
":focus": {
|
|
25267
|
+
outline: "none"
|
|
25268
|
+
}
|
|
25269
|
+
},
|
|
25270
|
+
indicatorDot: {
|
|
25271
|
+
boxSizing: "content-box",
|
|
25237
25272
|
width: 10,
|
|
25238
25273
|
height: 10,
|
|
25239
25274
|
borderRadius: "100%",
|
|
25240
|
-
|
|
25275
|
+
borderWidth: 2,
|
|
25241
25276
|
borderColor: Color__default["default"].blue,
|
|
25242
|
-
|
|
25243
|
-
|
|
25277
|
+
borderStyle: "solid"
|
|
25278
|
+
},
|
|
25279
|
+
indicatorDotFocused: {
|
|
25280
|
+
borderWidth: 5,
|
|
25281
|
+
borderStyle: "double"
|
|
25244
25282
|
},
|
|
25245
|
-
|
|
25246
|
-
backgroundColor: Color__default["default"].blue
|
|
25283
|
+
indicatorDotActive: {
|
|
25284
|
+
backgroundColor: Color__default["default"].blue,
|
|
25285
|
+
width: "100%",
|
|
25286
|
+
height: "100%"
|
|
25247
25287
|
},
|
|
25248
25288
|
container: {
|
|
25249
25289
|
borderTop: "1px solid ".concat(gray76),
|
|
@@ -44038,7 +44078,7 @@ const init = function (options) {
|
|
|
44038
44078
|
|
|
44039
44079
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
44040
44080
|
const libName = "@khanacademy/perseus";
|
|
44041
|
-
const libVersion = "12.
|
|
44081
|
+
const libVersion = "12.4.0";
|
|
44042
44082
|
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
44043
44083
|
|
|
44044
44084
|
const apiVersion = {
|