@khanacademy/perseus-editor 5.3.0 → 6.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/all-editors.d.ts +38 -1
- package/dist/components/color-swatch.d.ts +9 -0
- package/dist/components/locked-figure-settings.d.ts +2 -1
- package/dist/components/locked-line-settings.d.ts +8 -0
- package/dist/es/index.css +1 -1
- package/dist/es/index.js +385 -198
- package/dist/es/index.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +410 -209
- package/dist/index.js.map +1 -1
- package/dist/widgets/input-number-editor.d.ts +6 -0
- package/dist/widgets/interactive-graph-editor.d.ts +208 -70
- package/dist/widgets/numeric-input-editor.d.ts +69 -1
- package/package.json +4 -6
- package/dist/components/color-circle.d.ts +0 -9
- package/dist/strings.js +0 -9
package/dist/index.js
CHANGED
|
@@ -26,10 +26,9 @@ var wonderBlocksForm = require('@khanacademy/wonder-blocks-form');
|
|
|
26
26
|
var wonderBlocksTypography = require('@khanacademy/wonder-blocks-typography');
|
|
27
27
|
var wonderBlocksAccordion = require('@khanacademy/wonder-blocks-accordion');
|
|
28
28
|
var IconButton = require('@khanacademy/wonder-blocks-icon-button');
|
|
29
|
-
var Switch = require('@khanacademy/wonder-blocks-switch');
|
|
30
29
|
var trashIcon = require('@phosphor-icons/core/bold/trash-bold.svg');
|
|
30
|
+
var Switch = require('@khanacademy/wonder-blocks-switch');
|
|
31
31
|
var Button = require('@khanacademy/wonder-blocks-button');
|
|
32
|
-
var i18n$1 = require('@khanacademy/wonder-blocks-i18n');
|
|
33
32
|
|
|
34
33
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
35
34
|
|
|
@@ -62,14 +61,13 @@ var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
|
62
61
|
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
63
62
|
var KAS__namespace = /*#__PURE__*/_interopNamespace(KAS);
|
|
64
63
|
var IconButton__default = /*#__PURE__*/_interopDefaultLegacy(IconButton);
|
|
65
|
-
var Switch__default = /*#__PURE__*/_interopDefaultLegacy(Switch);
|
|
66
64
|
var trashIcon__default = /*#__PURE__*/_interopDefaultLegacy(trashIcon);
|
|
65
|
+
var Switch__default = /*#__PURE__*/_interopDefaultLegacy(Switch);
|
|
67
66
|
var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
|
|
68
|
-
var i18n__namespace = /*#__PURE__*/_interopNamespace(i18n$1);
|
|
69
67
|
|
|
70
68
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
71
69
|
const libName = "@khanacademy/perseus-editor";
|
|
72
|
-
const libVersion = "
|
|
70
|
+
const libVersion = "6.0.0";
|
|
73
71
|
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
74
72
|
|
|
75
73
|
function _extends() {
|
|
@@ -264,13 +262,13 @@ class SectionControlButton extends React__namespace.Component {
|
|
|
264
262
|
role: "button",
|
|
265
263
|
hideDefaultFocusRing: true,
|
|
266
264
|
"aria-label": title,
|
|
267
|
-
style: styles$
|
|
265
|
+
style: styles$s.button
|
|
268
266
|
}, _ref => {
|
|
269
267
|
return /*#__PURE__*/React__namespace.createElement(InlineIcon$b, icon);
|
|
270
268
|
});
|
|
271
269
|
}
|
|
272
270
|
}
|
|
273
|
-
const styles$
|
|
271
|
+
const styles$s = aphrodite.StyleSheet.create({
|
|
274
272
|
button: {
|
|
275
273
|
backgroundColor: wonderBlocksTokens.color.gold,
|
|
276
274
|
margin: 2,
|
|
@@ -20614,6 +20612,7 @@ const _upgradeWidgetInfo = props => {
|
|
|
20614
20612
|
// transforms will not be propogated upwards until serialization.
|
|
20615
20613
|
// eslint-disable-next-line react/no-unsafe
|
|
20616
20614
|
class WidgetEditor extends React__namespace.Component {
|
|
20615
|
+
widget;
|
|
20617
20616
|
constructor(props) {
|
|
20618
20617
|
super(props);
|
|
20619
20618
|
this.state = {
|
|
@@ -20788,19 +20787,19 @@ class TexErrorView extends React__namespace.Component {
|
|
|
20788
20787
|
const {
|
|
20789
20788
|
showErrors
|
|
20790
20789
|
} = this.state;
|
|
20791
|
-
const iconStyle = showErrors ? styles$
|
|
20790
|
+
const iconStyle = showErrors ? styles$r.iconExpanded : styles$r.iconCollapsed;
|
|
20792
20791
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
20793
|
-
style: styles$
|
|
20792
|
+
style: styles$r.errorContainer
|
|
20794
20793
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
20795
|
-
style: styles$
|
|
20794
|
+
style: styles$r.title,
|
|
20796
20795
|
onClick: this.handleToggleTexErrors
|
|
20797
20796
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksIcon.PhosphorIcon, {
|
|
20798
20797
|
icon: caretRight__default["default"],
|
|
20799
20798
|
style: iconStyle
|
|
20800
20799
|
}), "\xA0 TeX Errors (", errorList.length, ")"), showErrors && /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
20801
|
-
style: styles$
|
|
20800
|
+
style: styles$r.errorExplanation
|
|
20802
20801
|
}, "If your math doesn't display correctly, these errors might help you troubleshoot. Message #content-kitchen for help."), showErrors && errorList.map((e, index) => /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
20803
|
-
style: styles$
|
|
20802
|
+
style: styles$r.error,
|
|
20804
20803
|
key: index
|
|
20805
20804
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
20806
20805
|
style: {
|
|
@@ -20809,7 +20808,7 @@ class TexErrorView extends React__namespace.Component {
|
|
|
20809
20808
|
}, e.math), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, null, e.message))));
|
|
20810
20809
|
}
|
|
20811
20810
|
}
|
|
20812
|
-
const styles$
|
|
20811
|
+
const styles$r = aphrodite.StyleSheet.create({
|
|
20813
20812
|
title: {
|
|
20814
20813
|
backgroundColor: "#eee",
|
|
20815
20814
|
fontSize: "1.25em",
|
|
@@ -20915,6 +20914,9 @@ const imageUrlsFromContent = function (content) {
|
|
|
20915
20914
|
};
|
|
20916
20915
|
// eslint-disable-next-line react/no-unsafe
|
|
20917
20916
|
class Editor extends React__namespace.Component {
|
|
20917
|
+
lastUserValue;
|
|
20918
|
+
deferredChange;
|
|
20919
|
+
widgetIds;
|
|
20918
20920
|
underlay = /*#__PURE__*/React__namespace.createRef();
|
|
20919
20921
|
textarea = /*#__PURE__*/React__namespace.createRef();
|
|
20920
20922
|
static defaultProps = {
|
|
@@ -21694,14 +21696,16 @@ window.addEventListener("message", event => {
|
|
|
21694
21696
|
}
|
|
21695
21697
|
});
|
|
21696
21698
|
class IframeContentRenderer extends React__namespace.Component {
|
|
21699
|
+
_frame;
|
|
21697
21700
|
container = /*#__PURE__*/React__namespace.createRef();
|
|
21698
21701
|
|
|
21699
21702
|
// @ts-expect-error - TS2564 - Property '_isMounted' has no initializer and is not definitely assigned in the constructor.
|
|
21700
|
-
|
|
21703
|
+
_isMounted;
|
|
21704
|
+
_lastData;
|
|
21701
21705
|
// @ts-expect-error - TS2564 - Property '_lastHeight' has no initializer and is not definitely assigned in the constructor.
|
|
21702
|
-
|
|
21706
|
+
_lastHeight;
|
|
21703
21707
|
// @ts-expect-error - TS2564 - Property 'iframeID' has no initializer and is not definitely assigned in the constructor.
|
|
21704
|
-
|
|
21708
|
+
iframeID;
|
|
21705
21709
|
componentDidMount() {
|
|
21706
21710
|
// TODO(scottgrant): This is a hack to remove the deprecated call to
|
|
21707
21711
|
// this.isMounted() but is still considered an anti-pattern.
|
|
@@ -24010,6 +24014,8 @@ const {
|
|
|
24010
24014
|
HUD
|
|
24011
24015
|
} = perseus.components;
|
|
24012
24016
|
class EditorPage extends React__namespace.Component {
|
|
24017
|
+
_isMounted;
|
|
24018
|
+
renderer;
|
|
24013
24019
|
itemEditor = /*#__PURE__*/React__namespace.createRef();
|
|
24014
24020
|
hintsEditor = /*#__PURE__*/React__namespace.createRef();
|
|
24015
24021
|
static defaultProps = {
|
|
@@ -24559,12 +24565,12 @@ class SimpleButton extends React__namespace.Component {
|
|
|
24559
24565
|
...otherProps
|
|
24560
24566
|
} = this.props;
|
|
24561
24567
|
return /*#__PURE__*/React__namespace.createElement("div", _extends({
|
|
24562
|
-
className: aphrodite.css(styles$
|
|
24568
|
+
className: aphrodite.css(styles$q.baseButton, color === "green" && styles$q.green, color === "orange" && styles$q.orange),
|
|
24563
24569
|
onClick: onClick
|
|
24564
24570
|
}, otherProps), children);
|
|
24565
24571
|
}
|
|
24566
24572
|
}
|
|
24567
|
-
const styles$
|
|
24573
|
+
const styles$q = aphrodite.StyleSheet.create({
|
|
24568
24574
|
baseButton: {
|
|
24569
24575
|
top: "0",
|
|
24570
24576
|
fontSize: "11px",
|
|
@@ -24777,23 +24783,23 @@ const LeafContainer = _ref2 => {
|
|
|
24777
24783
|
} = _ref2;
|
|
24778
24784
|
const hasPreviewHeading = shape.type === "content" || shape.type === "hint";
|
|
24779
24785
|
const previewHeading = hasPreviewHeading && /*#__PURE__*/React__namespace.createElement("div", {
|
|
24780
|
-
className: aphrodite.css(styles$
|
|
24786
|
+
className: aphrodite.css(styles$p.containerHeader)
|
|
24781
24787
|
}, /*#__PURE__*/React__namespace.createElement(Header, {
|
|
24782
24788
|
depth: path.length,
|
|
24783
|
-
className: aphrodite.css(styles$
|
|
24789
|
+
className: aphrodite.css(styles$p.containerTitle)
|
|
24784
24790
|
}, capitalize(name)));
|
|
24785
24791
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
24786
|
-
className: aphrodite.css(styles$
|
|
24792
|
+
className: aphrodite.css(styles$p.container)
|
|
24787
24793
|
}, /*#__PURE__*/React__namespace.createElement("span", {
|
|
24788
|
-
className: aphrodite.css(styles$
|
|
24794
|
+
className: aphrodite.css(styles$p.row, styles$p.rowHeading)
|
|
24789
24795
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
24790
|
-
className: aphrodite.css(styles$
|
|
24796
|
+
className: aphrodite.css(styles$p.columnLeft)
|
|
24791
24797
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
24792
|
-
className: "pod-title " + aphrodite.css(styles$
|
|
24798
|
+
className: "pod-title " + aphrodite.css(styles$p.containerHeader)
|
|
24793
24799
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
24794
|
-
className: aphrodite.css(styles$
|
|
24800
|
+
className: aphrodite.css(styles$p.containerTitle)
|
|
24795
24801
|
}, capitalize(name)), controls)), /*#__PURE__*/React__namespace.createElement("div", {
|
|
24796
|
-
className: aphrodite.css(styles$
|
|
24802
|
+
className: aphrodite.css(styles$p.columnRight)
|
|
24797
24803
|
}, previewHeading)), children);
|
|
24798
24804
|
};
|
|
24799
24805
|
const ArrayContainer = props => {
|
|
@@ -24806,11 +24812,11 @@ const ArrayContainer = props => {
|
|
|
24806
24812
|
actions
|
|
24807
24813
|
} = props;
|
|
24808
24814
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
24809
|
-
className: aphrodite.css(styles$
|
|
24815
|
+
className: aphrodite.css(styles$p.container)
|
|
24810
24816
|
}, controls && /*#__PURE__*/React__namespace.createElement("div", {
|
|
24811
|
-
className: aphrodite.css(styles$
|
|
24817
|
+
className: aphrodite.css(styles$p.columnLeft, styles$p.containerHeader)
|
|
24812
24818
|
}, controls), /*#__PURE__*/React__namespace.createElement("div", null, children), /*#__PURE__*/React__namespace.createElement("div", {
|
|
24813
|
-
className: aphrodite.css(styles$
|
|
24819
|
+
className: aphrodite.css(styles$p.columnLeft)
|
|
24814
24820
|
}, /*#__PURE__*/React__namespace.createElement("a", {
|
|
24815
24821
|
href: "javascript:void 0",
|
|
24816
24822
|
onClick: () => actions.addArrayElement(path, shape.elementShape)
|
|
@@ -24824,28 +24830,28 @@ const ObjectContainer = _ref3 => {
|
|
|
24824
24830
|
path
|
|
24825
24831
|
} = _ref3;
|
|
24826
24832
|
const headingEditor = /*#__PURE__*/React__namespace.createElement("div", {
|
|
24827
|
-
className: aphrodite.css(styles$
|
|
24833
|
+
className: aphrodite.css(styles$p.containerHeader)
|
|
24828
24834
|
}, /*#__PURE__*/React__namespace.createElement(Header, {
|
|
24829
24835
|
depth: path.length,
|
|
24830
|
-
className: aphrodite.css(styles$
|
|
24836
|
+
className: aphrodite.css(styles$p.containerTitle)
|
|
24831
24837
|
}, capitalize(name)), controls);
|
|
24832
24838
|
const headingPreview = (name || controls) && /*#__PURE__*/React__namespace.createElement("div", {
|
|
24833
|
-
className: aphrodite.css(styles$
|
|
24839
|
+
className: aphrodite.css(styles$p.containerHeader, styles$p.previewCollectionHeader)
|
|
24834
24840
|
}, /*#__PURE__*/React__namespace.createElement(Header, {
|
|
24835
24841
|
depth: path.length,
|
|
24836
|
-
className: aphrodite.css(styles$
|
|
24842
|
+
className: aphrodite.css(styles$p.containerTitle)
|
|
24837
24843
|
}, capitalize(name)));
|
|
24838
24844
|
const hasBothHeadings = headingEditor && headingPreview;
|
|
24839
24845
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
24840
|
-
className: aphrodite.css(styles$
|
|
24846
|
+
className: aphrodite.css(styles$p.container)
|
|
24841
24847
|
}, hasBothHeadings && /*#__PURE__*/React__namespace.createElement("span", {
|
|
24842
|
-
className: aphrodite.css(styles$
|
|
24848
|
+
className: aphrodite.css(styles$p.row)
|
|
24843
24849
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
24844
|
-
className: aphrodite.css(styles$
|
|
24850
|
+
className: aphrodite.css(styles$p.columnLeft)
|
|
24845
24851
|
}, headingEditor), /*#__PURE__*/React__namespace.createElement("div", {
|
|
24846
|
-
className: aphrodite.css(styles$
|
|
24852
|
+
className: aphrodite.css(styles$p.columnRight)
|
|
24847
24853
|
}, headingPreview)), /*#__PURE__*/React__namespace.createElement("div", {
|
|
24848
|
-
className: aphrodite.css(path.length > 0 && styles$
|
|
24854
|
+
className: aphrodite.css(path.length > 0 && styles$p.contentIndent)
|
|
24849
24855
|
}, children));
|
|
24850
24856
|
};
|
|
24851
24857
|
|
|
@@ -24913,7 +24919,7 @@ const NodeContent = props => {
|
|
|
24913
24919
|
const withStickiness = WrappedComponent => {
|
|
24914
24920
|
return class StickyComponent extends React__namespace.Component {
|
|
24915
24921
|
// @ts-expect-error - TS2564 - Property 'stickynessTimer' has no initializer and is not definitely assigned in the constructor.
|
|
24916
|
-
|
|
24922
|
+
stickynessTimer;
|
|
24917
24923
|
state = {
|
|
24918
24924
|
sticky: false
|
|
24919
24925
|
};
|
|
@@ -24965,11 +24971,11 @@ const ItemNodeContent = withStickiness(props => {
|
|
|
24965
24971
|
className: "framework-perseus"
|
|
24966
24972
|
}, lens(renderers).get(path));
|
|
24967
24973
|
return /*#__PURE__*/React__namespace.createElement("span", null, /*#__PURE__*/React__namespace.createElement("div", {
|
|
24968
|
-
className: aphrodite.css(styles$
|
|
24974
|
+
className: aphrodite.css(styles$p.row)
|
|
24969
24975
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
24970
|
-
className: aphrodite.css(styles$
|
|
24976
|
+
className: aphrodite.css(styles$p.columnLeft)
|
|
24971
24977
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
24972
|
-
className: aphrodite.css(sticky && styles$
|
|
24978
|
+
className: aphrodite.css(sticky && styles$p.sticky)
|
|
24973
24979
|
},
|
|
24974
24980
|
/*#__PURE__*/
|
|
24975
24981
|
// @ts-expect-error - TS2769 - No overload matches this call.
|
|
@@ -24977,9 +24983,9 @@ const ItemNodeContent = withStickiness(props => {
|
|
|
24977
24983
|
onChange: newVal => actions.mergeValueAtPath(path, newVal),
|
|
24978
24984
|
apiOptions: apiOptions
|
|
24979
24985
|
})))), /*#__PURE__*/React__namespace.createElement("div", {
|
|
24980
|
-
className: aphrodite.css(styles$
|
|
24986
|
+
className: aphrodite.css(styles$p.columnRight)
|
|
24981
24987
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
24982
|
-
className: aphrodite.css(sticky && styles$
|
|
24988
|
+
className: aphrodite.css(sticky && styles$p.sticky)
|
|
24983
24989
|
}, preview))));
|
|
24984
24990
|
});
|
|
24985
24991
|
const HintNodeContent = withStickiness(props => {
|
|
@@ -24995,13 +25001,13 @@ const HintNodeContent = withStickiness(props => {
|
|
|
24995
25001
|
className: "framework-perseus"
|
|
24996
25002
|
}, lens(renderers).get(path));
|
|
24997
25003
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
24998
|
-
className: aphrodite.css(styles$
|
|
25004
|
+
className: aphrodite.css(styles$p.row)
|
|
24999
25005
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
25000
|
-
className: aphrodite.css(styles$
|
|
25006
|
+
className: aphrodite.css(styles$p.columnLeft)
|
|
25001
25007
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
25002
|
-
className: aphrodite.css(sticky && styles$
|
|
25008
|
+
className: aphrodite.css(sticky && styles$p.sticky)
|
|
25003
25009
|
}, /*#__PURE__*/React__namespace.createElement(HintEditor, _extends({}, data, {
|
|
25004
|
-
className: aphrodite.css(styles$
|
|
25010
|
+
className: aphrodite.css(styles$p.hintEditor),
|
|
25005
25011
|
onChange: newVal => actions.mergeValueAtPath(path, newVal),
|
|
25006
25012
|
apiOptions: apiOptions,
|
|
25007
25013
|
showTitle: false,
|
|
@@ -25016,9 +25022,9 @@ const HintNodeContent = withStickiness(props => {
|
|
|
25016
25022
|
isFirst: true,
|
|
25017
25023
|
isLast: true
|
|
25018
25024
|
})))), /*#__PURE__*/React__namespace.createElement("div", {
|
|
25019
|
-
className: aphrodite.css(styles$
|
|
25025
|
+
className: aphrodite.css(styles$p.columnRight)
|
|
25020
25026
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
25021
|
-
className: aphrodite.css(sticky && styles$
|
|
25027
|
+
className: aphrodite.css(sticky && styles$p.sticky)
|
|
25022
25028
|
}, preview)));
|
|
25023
25029
|
});
|
|
25024
25030
|
const TagsNodeContent = props => {
|
|
@@ -25035,9 +25041,9 @@ const TagsNodeContent = props => {
|
|
|
25035
25041
|
return null;
|
|
25036
25042
|
}
|
|
25037
25043
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
25038
|
-
className: aphrodite.css(styles$
|
|
25044
|
+
className: aphrodite.css(styles$p.columnLeft)
|
|
25039
25045
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
25040
|
-
className: aphrodite.css(styles$
|
|
25046
|
+
className: aphrodite.css(styles$p.tagsEditor)
|
|
25041
25047
|
}, /*#__PURE__*/React__namespace.createElement(GroupMetadataEditor, {
|
|
25042
25048
|
value: data,
|
|
25043
25049
|
onChange: newVal => actions.setValueAtPath(path, newVal),
|
|
@@ -25068,23 +25074,23 @@ const ArrayNodeContent = props => {
|
|
|
25068
25074
|
const subpath = path.concat(i);
|
|
25069
25075
|
const controls = [i > 0 && /*#__PURE__*/React__namespace.createElement("div", {
|
|
25070
25076
|
key: "moveArrayElementUp",
|
|
25071
|
-
className: aphrodite.css(styles$
|
|
25077
|
+
className: aphrodite.css(styles$p.control)
|
|
25072
25078
|
}, /*#__PURE__*/React__namespace.createElement(SimpleButton, {
|
|
25073
25079
|
color: "orange",
|
|
25074
25080
|
title: "Move up",
|
|
25075
25081
|
onClick: () => actions.moveArrayElementUp(subpath)
|
|
25076
25082
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
25077
|
-
className: aphrodite.css(styles$
|
|
25083
|
+
className: aphrodite.css(styles$p.verticalFlip)
|
|
25078
25084
|
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$6, iconChevronDown)))), i < data.length - 1 && /*#__PURE__*/React__namespace.createElement("div", {
|
|
25079
25085
|
key: "moveArrayElementDown",
|
|
25080
|
-
className: aphrodite.css(styles$
|
|
25086
|
+
className: aphrodite.css(styles$p.control)
|
|
25081
25087
|
}, /*#__PURE__*/React__namespace.createElement(SimpleButton, {
|
|
25082
25088
|
color: "orange",
|
|
25083
25089
|
title: "Move down",
|
|
25084
25090
|
onClick: () => actions.moveArrayElementDown(subpath)
|
|
25085
25091
|
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$6, iconChevronDown))), /*#__PURE__*/React__namespace.createElement("div", {
|
|
25086
25092
|
key: "removeArrayElement",
|
|
25087
|
-
className: aphrodite.css(styles$
|
|
25093
|
+
className: aphrodite.css(styles$p.control)
|
|
25088
25094
|
}, /*#__PURE__*/React__namespace.createElement(SimpleButton, {
|
|
25089
25095
|
color: "orange",
|
|
25090
25096
|
title: "Delete",
|
|
@@ -25092,7 +25098,7 @@ const ArrayNodeContent = props => {
|
|
|
25092
25098
|
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$6, iconTrash$4)))];
|
|
25093
25099
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
25094
25100
|
key: i,
|
|
25095
|
-
className: aphrodite.css(styles$
|
|
25101
|
+
className: aphrodite.css(styles$p.arrayElement, !elementIsLeaf && styles$p.arrayElementAndNotLeaf)
|
|
25096
25102
|
}, /*#__PURE__*/React__namespace.createElement(NodeContainer, _extends({}, otherProps, {
|
|
25097
25103
|
key: i,
|
|
25098
25104
|
shape: shape.elementShape,
|
|
@@ -25118,7 +25124,7 @@ const ObjectNodeContent = props => {
|
|
|
25118
25124
|
// made sense to the shape's author is the order in which we'll iterate :)
|
|
25119
25125
|
const children = Object.keys(shape.shape).map(subkey => /*#__PURE__*/React__namespace.createElement("div", {
|
|
25120
25126
|
key: subkey,
|
|
25121
|
-
className: aphrodite.css(styles$
|
|
25127
|
+
className: aphrodite.css(styles$p.objectElement)
|
|
25122
25128
|
}, /*#__PURE__*/React__namespace.createElement(NodeContainer, _extends({}, otherProps, {
|
|
25123
25129
|
shape: shape.shape[subkey],
|
|
25124
25130
|
data: data[subkey],
|
|
@@ -25127,6 +25133,7 @@ const ObjectNodeContent = props => {
|
|
|
25127
25133
|
return /*#__PURE__*/React__namespace.createElement("div", null, children);
|
|
25128
25134
|
};
|
|
25129
25135
|
class MultiRendererEditor extends React__namespace.Component {
|
|
25136
|
+
layout;
|
|
25130
25137
|
_renderLayout = () => {
|
|
25131
25138
|
const {
|
|
25132
25139
|
Layout,
|
|
@@ -25287,7 +25294,7 @@ class MultiRendererEditor extends React__namespace.Component {
|
|
|
25287
25294
|
}, this._renderContent());
|
|
25288
25295
|
}
|
|
25289
25296
|
}
|
|
25290
|
-
const styles$
|
|
25297
|
+
const styles$p = aphrodite.StyleSheet.create({
|
|
25291
25298
|
// This is used in a number of places throughout this file.
|
|
25292
25299
|
container: {},
|
|
25293
25300
|
// eslint-disable-next-line react-native/no-unused-styles
|
|
@@ -25439,47 +25446,47 @@ const StatefulArticleEditor = createReactClass__default["default"]({
|
|
|
25439
25446
|
screen
|
|
25440
25447
|
} = this.state;
|
|
25441
25448
|
return /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("div", {
|
|
25442
|
-
style: styles$
|
|
25449
|
+
style: styles$o.controlBar
|
|
25443
25450
|
}, /*#__PURE__*/React__namespace.createElement("span", {
|
|
25444
|
-
style: styles$
|
|
25451
|
+
style: styles$o.controls
|
|
25445
25452
|
}, "Mode:", " ", /*#__PURE__*/React__namespace.createElement("span", {
|
|
25446
25453
|
onClick: () => this.setState({
|
|
25447
25454
|
mode: "edit"
|
|
25448
25455
|
}),
|
|
25449
|
-
style: mode === "edit" ? styles$
|
|
25456
|
+
style: mode === "edit" ? styles$o.controlSelected : styles$o.control
|
|
25450
25457
|
}, "EDIT"), " | ", /*#__PURE__*/React__namespace.createElement("span", {
|
|
25451
25458
|
onClick: () => this.setState({
|
|
25452
25459
|
mode: "preview"
|
|
25453
25460
|
}),
|
|
25454
|
-
style: mode === "preview" ? styles$
|
|
25461
|
+
style: mode === "preview" ? styles$o.controlSelected : styles$o.control
|
|
25455
25462
|
}, "PREVIEW"), " | ", /*#__PURE__*/React__namespace.createElement("span", {
|
|
25456
25463
|
onClick: () => this.setState({
|
|
25457
25464
|
mode: "json"
|
|
25458
25465
|
}),
|
|
25459
|
-
style: mode === "json" ? styles$
|
|
25466
|
+
style: mode === "json" ? styles$o.controlSelected : styles$o.control
|
|
25460
25467
|
}, "JSON")), /*#__PURE__*/React__namespace.createElement("span", {
|
|
25461
|
-
style: styles$
|
|
25468
|
+
style: styles$o.controls
|
|
25462
25469
|
}, "Screen:", " ", /*#__PURE__*/React__namespace.createElement("span", {
|
|
25463
25470
|
onClick: () => this.setState({
|
|
25464
25471
|
screen: "phone"
|
|
25465
25472
|
}),
|
|
25466
|
-
style: screen === "phone" ? styles$
|
|
25473
|
+
style: screen === "phone" ? styles$o.controlSelected : styles$o.control
|
|
25467
25474
|
}, "PHONE"), " | ", /*#__PURE__*/React__namespace.createElement("span", {
|
|
25468
25475
|
onClick: () => this.setState({
|
|
25469
25476
|
screen: "tablet"
|
|
25470
25477
|
}),
|
|
25471
|
-
style: screen === "tablet" ? styles$
|
|
25478
|
+
style: screen === "tablet" ? styles$o.controlSelected : styles$o.control
|
|
25472
25479
|
}, "TABLET"), " | ", /*#__PURE__*/React__namespace.createElement("span", {
|
|
25473
25480
|
onClick: () => this.setState({
|
|
25474
25481
|
screen: "desktop"
|
|
25475
25482
|
}),
|
|
25476
|
-
style: screen === "desktop" ? styles$
|
|
25483
|
+
style: screen === "desktop" ? styles$o.controlSelected : styles$o.control
|
|
25477
25484
|
}, "DESKTOP"))), /*#__PURE__*/React__namespace.createElement("div", {
|
|
25478
|
-
style: styles$
|
|
25485
|
+
style: styles$o.editor
|
|
25479
25486
|
}, /*#__PURE__*/React__namespace.createElement(ArticleEditor, this.state)));
|
|
25480
25487
|
}
|
|
25481
25488
|
});
|
|
25482
|
-
const styles$
|
|
25489
|
+
const styles$o = {
|
|
25483
25490
|
controlBar: {
|
|
25484
25491
|
marginBottom: 25,
|
|
25485
25492
|
marginTop: 5
|
|
@@ -27018,10 +27025,10 @@ class GradedGroupEditor extends React__namespace.Component {
|
|
|
27018
27025
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
27019
27026
|
className: "perseus-widget-row"
|
|
27020
27027
|
}, /*#__PURE__*/React__namespace.createElement("label", {
|
|
27021
|
-
className: aphrodite.css(styles$
|
|
27028
|
+
className: aphrodite.css(styles$n.title)
|
|
27022
27029
|
}, "Title:", " ", /*#__PURE__*/React__namespace.createElement(TextInput$6, {
|
|
27023
27030
|
value: this.props.title,
|
|
27024
|
-
className: aphrodite.css(styles$
|
|
27031
|
+
className: aphrodite.css(styles$n.input)
|
|
27025
27032
|
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
27026
27033
|
,
|
|
27027
27034
|
onChange: this.change("title")
|
|
@@ -27046,7 +27053,7 @@ class GradedGroupEditor extends React__namespace.Component {
|
|
|
27046
27053
|
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$4, iconPlus$1), " Add a hint"), this.props.hint && /*#__PURE__*/React__namespace.createElement("div", {
|
|
27047
27054
|
className: "perseus-hint-editor"
|
|
27048
27055
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
27049
|
-
className: aphrodite.css(styles$
|
|
27056
|
+
className: aphrodite.css(styles$n.hintsTitle)
|
|
27050
27057
|
}, "Hint"), /*#__PURE__*/React__namespace.createElement(Editor, {
|
|
27051
27058
|
ref: this.hintEditor,
|
|
27052
27059
|
content: this.props.hint ? this.props.hint.content : "",
|
|
@@ -27078,7 +27085,7 @@ class GradedGroupEditor extends React__namespace.Component {
|
|
|
27078
27085
|
};
|
|
27079
27086
|
};
|
|
27080
27087
|
}
|
|
27081
|
-
const styles$
|
|
27088
|
+
const styles$n = aphrodite.StyleSheet.create({
|
|
27082
27089
|
title: {
|
|
27083
27090
|
fontSize: 18,
|
|
27084
27091
|
fontWeight: "bold"
|
|
@@ -27095,7 +27102,7 @@ const styles$m = aphrodite.StyleSheet.create({
|
|
|
27095
27102
|
|
|
27096
27103
|
class GradedGroupSetEditor extends React__namespace.Component {
|
|
27097
27104
|
// @ts-expect-error - TS2564 - Property '_editors' has no initializer and is not definitely assigned in the constructor.
|
|
27098
|
-
|
|
27105
|
+
_editors;
|
|
27099
27106
|
static propTypes = {
|
|
27100
27107
|
...perseus.Changeable.propTypes,
|
|
27101
27108
|
apiOptions: perseus.ApiOptions.propTypes,
|
|
@@ -28287,6 +28294,7 @@ const answerTypes = {
|
|
|
28287
28294
|
}
|
|
28288
28295
|
};
|
|
28289
28296
|
class InputNumberEditor extends React__namespace.Component {
|
|
28297
|
+
static contextType = perseus.PerseusI18nContext;
|
|
28290
28298
|
static widgetName = "input-number";
|
|
28291
28299
|
static defaultProps = {
|
|
28292
28300
|
value: 0,
|
|
@@ -28299,7 +28307,7 @@ class InputNumberEditor extends React__namespace.Component {
|
|
|
28299
28307
|
};
|
|
28300
28308
|
input = /*#__PURE__*/React__namespace.createRef();
|
|
28301
28309
|
handleAnswerChange = str => {
|
|
28302
|
-
const value = perseus.Util.firstNumericalParse(str) || 0;
|
|
28310
|
+
const value = perseus.Util.firstNumericalParse(str, this.context.strings) || 0;
|
|
28303
28311
|
this.props.onChange({
|
|
28304
28312
|
value: value
|
|
28305
28313
|
});
|
|
@@ -28350,7 +28358,7 @@ class InputNumberEditor extends React__namespace.Component {
|
|
|
28350
28358
|
defaultValue: this.props.maxError,
|
|
28351
28359
|
"aria-label": "Max error",
|
|
28352
28360
|
onBlur: e => {
|
|
28353
|
-
const ans = "" + (perseus.Util.firstNumericalParse(e.target.value) || 0);
|
|
28361
|
+
const ans = "" + (perseus.Util.firstNumericalParse(e.target.value, this.context.strings) || 0);
|
|
28354
28362
|
e.target.value = ans;
|
|
28355
28363
|
this.props.onChange({
|
|
28356
28364
|
maxError: ans
|
|
@@ -28410,12 +28418,15 @@ class InputNumberEditor extends React__namespace.Component {
|
|
|
28410
28418
|
function MathquillInput(props) {
|
|
28411
28419
|
const mathFieldWrapperRef = React.useRef(null);
|
|
28412
28420
|
const mathFieldInstance = React.useRef();
|
|
28421
|
+
const {
|
|
28422
|
+
strings
|
|
28423
|
+
} = mathInput.useMathInputI18n();
|
|
28413
28424
|
React.useEffect(() => {
|
|
28414
28425
|
// If we have the mount for the input, but not the input
|
|
28415
28426
|
// make a new Mathquill input
|
|
28416
28427
|
if (mathFieldWrapperRef.current && !mathFieldInstance.current) {
|
|
28417
28428
|
// Initialize MathQuill.MathField instance
|
|
28418
|
-
mathFieldInstance.current = mathInput.createMathField(mathFieldWrapperRef.current, baseConfig => ({
|
|
28429
|
+
mathFieldInstance.current = mathInput.createMathField(mathFieldWrapperRef.current, strings, baseConfig => ({
|
|
28419
28430
|
...baseConfig,
|
|
28420
28431
|
handlers: {
|
|
28421
28432
|
edit: mathField => {
|
|
@@ -28444,13 +28455,13 @@ function MathquillInput(props) {
|
|
|
28444
28455
|
}
|
|
28445
28456
|
});
|
|
28446
28457
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
28447
|
-
style: styles$
|
|
28458
|
+
style: styles$m.outerWrapper
|
|
28448
28459
|
}, /*#__PURE__*/React__namespace.createElement("span", {
|
|
28449
28460
|
ref: mathFieldWrapperRef,
|
|
28450
28461
|
className: "perseus-math-input mq-editable-field mq-math-mode"
|
|
28451
28462
|
}));
|
|
28452
28463
|
}
|
|
28453
|
-
const styles$
|
|
28464
|
+
const styles$m = aphrodite.StyleSheet.create({
|
|
28454
28465
|
outerWrapper: {
|
|
28455
28466
|
display: "inline-block",
|
|
28456
28467
|
borderStyle: "solid",
|
|
@@ -29536,7 +29547,7 @@ const GraphPointsCountSelector = _ref => {
|
|
|
29536
29547
|
// Never uses placeholder, always has value
|
|
29537
29548
|
,
|
|
29538
29549
|
placeholder: "",
|
|
29539
|
-
style: styles$
|
|
29550
|
+
style: styles$l.singleSelectShort
|
|
29540
29551
|
}, [...[...Array(7).keys()].map(n => /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
29541
29552
|
key: n,
|
|
29542
29553
|
value: `${n}`,
|
|
@@ -29547,7 +29558,7 @@ const GraphPointsCountSelector = _ref => {
|
|
|
29547
29558
|
label: "unlimited"
|
|
29548
29559
|
})]);
|
|
29549
29560
|
};
|
|
29550
|
-
const styles$
|
|
29561
|
+
const styles$l = aphrodite.StyleSheet.create({
|
|
29551
29562
|
singleSelectShort: {
|
|
29552
29563
|
// Non-standard spacing, but it's the smallest we can go
|
|
29553
29564
|
// without running into styling issues with the dropdown.
|
|
@@ -29560,7 +29571,7 @@ const GraphTypeSelector = props => {
|
|
|
29560
29571
|
selectedValue: props.graphType,
|
|
29561
29572
|
onChange: props.onChange,
|
|
29562
29573
|
placeholder: "Select a graph type",
|
|
29563
|
-
style: styles$
|
|
29574
|
+
style: styles$k.singleSelectShort
|
|
29564
29575
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
29565
29576
|
value: "linear",
|
|
29566
29577
|
label: "Linear function"
|
|
@@ -29593,7 +29604,7 @@ const GraphTypeSelector = props => {
|
|
|
29593
29604
|
label: "Angle"
|
|
29594
29605
|
}));
|
|
29595
29606
|
};
|
|
29596
|
-
const styles$
|
|
29607
|
+
const styles$k = aphrodite.StyleSheet.create({
|
|
29597
29608
|
singleSelectShort: {
|
|
29598
29609
|
// Non-standard spacing, but it's the smallest we can go
|
|
29599
29610
|
// without running into styling issues with the dropdown.
|
|
@@ -29610,16 +29621,16 @@ const LabeledRow = props => {
|
|
|
29610
29621
|
style
|
|
29611
29622
|
} = props;
|
|
29612
29623
|
return /*#__PURE__*/React__namespace.createElement("label", {
|
|
29613
|
-
className: aphrodite.css(styles$
|
|
29624
|
+
className: aphrodite.css(styles$j.label)
|
|
29614
29625
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
29615
|
-
style: [styles$
|
|
29626
|
+
style: [styles$j.row, style]
|
|
29616
29627
|
}, labelSide === "start" || /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelSmall, {
|
|
29617
|
-
style: styles$
|
|
29628
|
+
style: styles$j.spaceEnd
|
|
29618
29629
|
}, label), children, labelSide === "end" && /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelSmall, {
|
|
29619
|
-
style: styles$
|
|
29630
|
+
style: styles$j.spaceStart
|
|
29620
29631
|
}, label)));
|
|
29621
29632
|
};
|
|
29622
|
-
const styles$
|
|
29633
|
+
const styles$j = aphrodite.StyleSheet.create({
|
|
29623
29634
|
label: {
|
|
29624
29635
|
width: "fit-content"
|
|
29625
29636
|
},
|
|
@@ -30041,10 +30052,10 @@ class InteractiveGraphSettings extends React__namespace.Component {
|
|
|
30041
30052
|
onChange: this.change
|
|
30042
30053
|
}))), /*#__PURE__*/React__namespace.createElement(LabeledRow, {
|
|
30043
30054
|
label: "Background image URL:",
|
|
30044
|
-
style: styles$
|
|
30055
|
+
style: styles$i.resetSpaceTop
|
|
30045
30056
|
}, /*#__PURE__*/React__namespace.createElement("input", {
|
|
30046
30057
|
type: "text",
|
|
30047
|
-
className: aphrodite.css(styles$
|
|
30058
|
+
className: aphrodite.css(styles$i.backgroundUrlInput),
|
|
30048
30059
|
ref: this.bgUrlRef,
|
|
30049
30060
|
value: this.state.backgroundImage.url || "",
|
|
30050
30061
|
onChange: e => {
|
|
@@ -30060,24 +30071,24 @@ class InteractiveGraphSettings extends React__namespace.Component {
|
|
|
30060
30071
|
onKeyPress: this.changeBackgroundUrl,
|
|
30061
30072
|
onBlur: this.changeBackgroundUrl
|
|
30062
30073
|
}), /*#__PURE__*/React__namespace.createElement(InfoTip$c, null, /*#__PURE__*/React__namespace.createElement("p", null, "Create an image in graphie, or use the \"Add image\" function to create a background."))), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30063
|
-
style: styles$
|
|
30074
|
+
style: styles$i.rulerSection
|
|
30064
30075
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30065
|
-
style: styles$
|
|
30076
|
+
style: styles$i.checkboxRow
|
|
30066
30077
|
}, /*#__PURE__*/React__namespace.createElement(PropCheckBox$7, {
|
|
30067
30078
|
label: "Show ruler",
|
|
30068
30079
|
showRuler: this.props.showRuler,
|
|
30069
30080
|
onChange: this.change,
|
|
30070
|
-
style: styles$
|
|
30081
|
+
style: styles$i.resetSpaceTop
|
|
30071
30082
|
}), /*#__PURE__*/React__namespace.createElement(PropCheckBox$7, {
|
|
30072
30083
|
label: "Show protractor",
|
|
30073
30084
|
showProtractor: this.props.showProtractor,
|
|
30074
30085
|
onChange: this.change,
|
|
30075
|
-
style: styles$
|
|
30086
|
+
style: styles$i.resetSpaceTop
|
|
30076
30087
|
})), this.props.showRuler && /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30077
|
-
style: styles$
|
|
30088
|
+
style: styles$i.spaceTop
|
|
30078
30089
|
}, /*#__PURE__*/React__namespace.createElement(LabeledRow, {
|
|
30079
30090
|
label: "Ruler label:",
|
|
30080
|
-
style: styles$
|
|
30091
|
+
style: styles$i.resetSpaceTop
|
|
30081
30092
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
|
|
30082
30093
|
id: "ruler-label-select",
|
|
30083
30094
|
selectedValue: this.props.rulerLabel,
|
|
@@ -30087,7 +30098,7 @@ class InteractiveGraphSettings extends React__namespace.Component {
|
|
|
30087
30098
|
});
|
|
30088
30099
|
},
|
|
30089
30100
|
placeholder: "None",
|
|
30090
|
-
style: styles$
|
|
30101
|
+
style: styles$i.singleSelectShort
|
|
30091
30102
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
30092
30103
|
value: "",
|
|
30093
30104
|
label: "None",
|
|
@@ -30128,7 +30139,7 @@ class InteractiveGraphSettings extends React__namespace.Component {
|
|
|
30128
30139
|
});
|
|
30129
30140
|
},
|
|
30130
30141
|
placeholder: "10",
|
|
30131
|
-
style: styles$
|
|
30142
|
+
style: styles$i.singleSelectShort
|
|
30132
30143
|
}, [1, 2, 4, 8, 10, 16].map(value => /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
30133
30144
|
key: value,
|
|
30134
30145
|
value: `${value}`,
|
|
@@ -30136,7 +30147,7 @@ class InteractiveGraphSettings extends React__namespace.Component {
|
|
|
30136
30147
|
})))))));
|
|
30137
30148
|
}
|
|
30138
30149
|
}
|
|
30139
|
-
const styles$
|
|
30150
|
+
const styles$i = aphrodite.StyleSheet.create({
|
|
30140
30151
|
resetSpaceTop: {
|
|
30141
30152
|
marginTop: 0
|
|
30142
30153
|
},
|
|
@@ -30180,22 +30191,26 @@ const LockedFigureSelect = props => {
|
|
|
30180
30191
|
onChange
|
|
30181
30192
|
} = props;
|
|
30182
30193
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30183
|
-
style: styles$
|
|
30194
|
+
style: styles$h.container
|
|
30184
30195
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.ActionMenu, {
|
|
30185
30196
|
menuText: "Add locked figure",
|
|
30186
|
-
style: styles$
|
|
30197
|
+
style: styles$h.addElementSelect
|
|
30187
30198
|
}, [/*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.ActionItem, {
|
|
30188
30199
|
key: `${id}-point`,
|
|
30189
30200
|
label: "Point",
|
|
30190
30201
|
onClick: () => onChange("point")
|
|
30191
|
-
}, "Point")
|
|
30202
|
+
}, "Point"), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.ActionItem, {
|
|
30203
|
+
key: `${id}-line`,
|
|
30204
|
+
label: "Line",
|
|
30205
|
+
onClick: () => onChange("line")
|
|
30206
|
+
}, "Line")]));
|
|
30192
30207
|
};
|
|
30193
|
-
const styles$
|
|
30208
|
+
const styles$h = aphrodite.StyleSheet.create({
|
|
30194
30209
|
container: {
|
|
30195
|
-
marginTop: wonderBlocksTokens.spacing.
|
|
30210
|
+
marginTop: wonderBlocksTokens.spacing.xxxSmall_4
|
|
30196
30211
|
},
|
|
30197
30212
|
addElementSelect: {
|
|
30198
|
-
backgroundColor: wonderBlocksTokens.color.
|
|
30213
|
+
backgroundColor: wonderBlocksTokens.color.fadedBlue8,
|
|
30199
30214
|
borderRadius: wonderBlocksTokens.spacing.xxxSmall_4
|
|
30200
30215
|
}
|
|
30201
30216
|
});
|
|
@@ -30280,7 +30295,7 @@ const strutStyle = size => {
|
|
|
30280
30295
|
};
|
|
30281
30296
|
};
|
|
30282
30297
|
|
|
30283
|
-
const
|
|
30298
|
+
const ColorSwatch = props => {
|
|
30284
30299
|
const {
|
|
30285
30300
|
color,
|
|
30286
30301
|
filled = true,
|
|
@@ -30290,15 +30305,15 @@ const ColorCircle = props => {
|
|
|
30290
30305
|
"aria-label":
|
|
30291
30306
|
// Don't include an aria label for decorative circles.
|
|
30292
30307
|
!decorative ? `Color: ${color}, ${filled ? "filled" : "open"}` : undefined,
|
|
30293
|
-
style: [styles$
|
|
30294
|
-
border: `4px solid ${
|
|
30295
|
-
backgroundColor: filled ?
|
|
30308
|
+
style: [styles$g.colorSwatch, {
|
|
30309
|
+
border: `4px solid ${perseus.lockedFigureColors[color]}`,
|
|
30310
|
+
backgroundColor: filled ? perseus.lockedFigureColors[color] : wonderBlocksTokens.color.white
|
|
30296
30311
|
}]
|
|
30297
30312
|
});
|
|
30298
30313
|
};
|
|
30299
|
-
const styles$
|
|
30300
|
-
|
|
30301
|
-
// Add a white outline so that the color
|
|
30314
|
+
const styles$g = aphrodite.StyleSheet.create({
|
|
30315
|
+
colorSwatch: {
|
|
30316
|
+
// Add a white outline so that the color swatch is visible when
|
|
30302
30317
|
// the dropdown option is highlighted with its blue background.
|
|
30303
30318
|
outline: `2px solid ${wonderBlocksTokens.color.offWhite}`,
|
|
30304
30319
|
borderRadius: "50%",
|
|
@@ -30307,6 +30322,7 @@ const styles$f = aphrodite.StyleSheet.create({
|
|
|
30307
30322
|
}
|
|
30308
30323
|
});
|
|
30309
30324
|
|
|
30325
|
+
const possibleColors = Object.keys(perseus.lockedFigureColors);
|
|
30310
30326
|
const ColorSelect = props => {
|
|
30311
30327
|
const {
|
|
30312
30328
|
id,
|
|
@@ -30314,10 +30330,10 @@ const ColorSelect = props => {
|
|
|
30314
30330
|
onChange
|
|
30315
30331
|
} = props;
|
|
30316
30332
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30317
|
-
style: styles$
|
|
30333
|
+
style: styles$f.row
|
|
30318
30334
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
30319
30335
|
htmlFor: id,
|
|
30320
|
-
style: styles$
|
|
30336
|
+
style: styles$f.label,
|
|
30321
30337
|
tag: "label"
|
|
30322
30338
|
}, "Color"), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
|
|
30323
30339
|
id: id,
|
|
@@ -30326,17 +30342,17 @@ const ColorSelect = props => {
|
|
|
30326
30342
|
// Placeholder is required, but never gets used.
|
|
30327
30343
|
,
|
|
30328
30344
|
placeholder: ""
|
|
30329
|
-
},
|
|
30345
|
+
}, possibleColors.map(colorName => /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
30330
30346
|
key: colorName,
|
|
30331
30347
|
value: colorName,
|
|
30332
30348
|
label: colorName,
|
|
30333
|
-
leftAccessory: /*#__PURE__*/React__namespace.createElement(
|
|
30349
|
+
leftAccessory: /*#__PURE__*/React__namespace.createElement(ColorSwatch, {
|
|
30334
30350
|
color: colorName,
|
|
30335
30351
|
decorative: true
|
|
30336
30352
|
})
|
|
30337
30353
|
}, colorName))));
|
|
30338
30354
|
};
|
|
30339
|
-
const styles$
|
|
30355
|
+
const styles$f = aphrodite.StyleSheet.create({
|
|
30340
30356
|
row: {
|
|
30341
30357
|
flexDirection: "row",
|
|
30342
30358
|
alignItems: "center"
|
|
@@ -30387,7 +30403,7 @@ function focusWithChromeStickyFocusBugWorkaround(element) {
|
|
|
30387
30403
|
});
|
|
30388
30404
|
}
|
|
30389
30405
|
function getValidNumberFromString(value) {
|
|
30390
|
-
const parsed =
|
|
30406
|
+
const parsed = parseFloat(value);
|
|
30391
30407
|
// If the value is not a number, return 0.
|
|
30392
30408
|
return isNaN(parsed) ? 0 : parsed;
|
|
30393
30409
|
}
|
|
@@ -30478,28 +30494,28 @@ const LockedPointSettings = props => {
|
|
|
30478
30494
|
, {
|
|
30479
30495
|
className: "locked-figure-accordion"
|
|
30480
30496
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksAccordion.AccordionSection, {
|
|
30481
|
-
style: [styles$
|
|
30482
|
-
headerStyle: styles$
|
|
30497
|
+
style: [styles$e.container, style],
|
|
30498
|
+
headerStyle: styles$e.accordionHeader,
|
|
30483
30499
|
header:
|
|
30484
30500
|
/*#__PURE__*/
|
|
30485
30501
|
// Summary: Point, coords, color (filled/open)
|
|
30486
30502
|
React__namespace.createElement(wonderBlocksCore.View, {
|
|
30487
|
-
style: styles$
|
|
30503
|
+
style: styles$e.row
|
|
30488
30504
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, `${label || "Point"} (${coord[0]}, ${coord[1]})`), /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30489
30505
|
size: wonderBlocksTokens.spacing.xSmall_8
|
|
30490
|
-
}), toggled && /*#__PURE__*/React__namespace.createElement(
|
|
30506
|
+
}), toggled && /*#__PURE__*/React__namespace.createElement(ColorSwatch, {
|
|
30491
30507
|
color: pointColor,
|
|
30492
30508
|
filled: filled
|
|
30493
30509
|
}))
|
|
30494
30510
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30495
|
-
style: styles$
|
|
30511
|
+
style: styles$e.accordionPanel
|
|
30496
30512
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30497
|
-
style: styles$
|
|
30513
|
+
style: styles$e.row
|
|
30498
30514
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30499
|
-
style: [styles$
|
|
30515
|
+
style: [styles$e.row, styles$e.spaceUnder]
|
|
30500
30516
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
30501
30517
|
htmlFor: xCoordId,
|
|
30502
|
-
style: styles$
|
|
30518
|
+
style: styles$e.label,
|
|
30503
30519
|
tag: "label"
|
|
30504
30520
|
}, "x Coord"), /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.TextField, {
|
|
30505
30521
|
id: xCoordId,
|
|
@@ -30507,14 +30523,14 @@ const LockedPointSettings = props => {
|
|
|
30507
30523
|
value: coordState[0],
|
|
30508
30524
|
onChange: newValue => handleCoordChange(newValue, 0),
|
|
30509
30525
|
onBlur: handleBlur,
|
|
30510
|
-
style: styles$
|
|
30526
|
+
style: styles$e.textField
|
|
30511
30527
|
})), /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30512
30528
|
size: wonderBlocksTokens.spacing.medium_16
|
|
30513
30529
|
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30514
|
-
style: [styles$
|
|
30530
|
+
style: [styles$e.row, styles$e.spaceUnder]
|
|
30515
30531
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
30516
30532
|
htmlFor: yCoordId,
|
|
30517
|
-
style: styles$
|
|
30533
|
+
style: styles$e.label,
|
|
30518
30534
|
tag: "label"
|
|
30519
30535
|
}, "y Coord"), /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.TextField, {
|
|
30520
30536
|
id: yCoordId,
|
|
@@ -30522,9 +30538,9 @@ const LockedPointSettings = props => {
|
|
|
30522
30538
|
value: coordState[1],
|
|
30523
30539
|
onChange: newValue => handleCoordChange(newValue, 1),
|
|
30524
30540
|
onBlur: handleBlur,
|
|
30525
|
-
style: styles$
|
|
30541
|
+
style: styles$e.textField
|
|
30526
30542
|
}))), onToggle && /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30527
|
-
style: [styles$
|
|
30543
|
+
style: [styles$e.row, styles$e.spaceUnder]
|
|
30528
30544
|
}, /*#__PURE__*/React__namespace.createElement(Switch__default["default"], {
|
|
30529
30545
|
id: showPointToggleId,
|
|
30530
30546
|
checked: !!toggled,
|
|
@@ -30548,15 +30564,15 @@ const LockedPointSettings = props => {
|
|
|
30548
30564
|
filled: !newValue
|
|
30549
30565
|
});
|
|
30550
30566
|
},
|
|
30551
|
-
style: styles$
|
|
30567
|
+
style: styles$e.spaceUnder
|
|
30552
30568
|
})), onRemove && /*#__PURE__*/React__namespace.createElement(IconButton__default["default"], {
|
|
30553
30569
|
icon: trashIcon__default["default"],
|
|
30554
30570
|
"aria-label": `Delete locked point at ${coordState[0]}, ${coordState[1]}`,
|
|
30555
30571
|
onClick: onRemove,
|
|
30556
|
-
style: styles$
|
|
30572
|
+
style: styles$e.deleteButton
|
|
30557
30573
|
}))));
|
|
30558
30574
|
};
|
|
30559
|
-
const styles$
|
|
30575
|
+
const styles$e = aphrodite.StyleSheet.create({
|
|
30560
30576
|
container: {
|
|
30561
30577
|
backgroundColor: wonderBlocksTokens.color.fadedBlue8,
|
|
30562
30578
|
marginBottom: wonderBlocksTokens.spacing.small_12
|
|
@@ -30565,7 +30581,7 @@ const styles$d = aphrodite.StyleSheet.create({
|
|
|
30565
30581
|
paddingTop: wonderBlocksTokens.spacing.small_12,
|
|
30566
30582
|
paddingBottom: wonderBlocksTokens.spacing.small_12,
|
|
30567
30583
|
paddingInlineStart: wonderBlocksTokens.spacing.medium_16,
|
|
30568
|
-
// Fixed height so the addition of the color
|
|
30584
|
+
// Fixed height so the addition of the color swatch doesn't
|
|
30569
30585
|
// change the height of the header when toggling.
|
|
30570
30586
|
height: wonderBlocksTokens.spacing.xxLarge_48
|
|
30571
30587
|
},
|
|
@@ -30593,6 +30609,194 @@ const styles$d = aphrodite.StyleSheet.create({
|
|
|
30593
30609
|
}
|
|
30594
30610
|
});
|
|
30595
30611
|
|
|
30612
|
+
const LockedLineSettings = props => {
|
|
30613
|
+
const {
|
|
30614
|
+
kind,
|
|
30615
|
+
points,
|
|
30616
|
+
color: lineColor = "blue",
|
|
30617
|
+
lineStyle = "solid",
|
|
30618
|
+
showArrows,
|
|
30619
|
+
showStartPoint,
|
|
30620
|
+
showEndPoint,
|
|
30621
|
+
onChangeProps,
|
|
30622
|
+
onRemove
|
|
30623
|
+
} = props;
|
|
30624
|
+
const [startPoint, endPoint] = points;
|
|
30625
|
+
|
|
30626
|
+
// Generate unique IDs so that the programmatic labels can be associated
|
|
30627
|
+
// with their respective text fields.
|
|
30628
|
+
const ids = wonderBlocksCore.useUniqueIdWithMock();
|
|
30629
|
+
const kindSelectId = ids.get("line-kind-select");
|
|
30630
|
+
const colorSelectId = ids.get("line-color-select");
|
|
30631
|
+
const styleSelectId = ids.get("line-style-select");
|
|
30632
|
+
const lineLabel = `Line (${startPoint.coord[0]}, ${startPoint.coord[1]}),
|
|
30633
|
+
(${endPoint.coord[0]}, ${endPoint.coord[1]})`;
|
|
30634
|
+
function handleChangePoint(newPointProps, index) {
|
|
30635
|
+
const newPoints = [...points];
|
|
30636
|
+
newPoints[index] = {
|
|
30637
|
+
...points[index],
|
|
30638
|
+
...newPointProps
|
|
30639
|
+
};
|
|
30640
|
+
onChangeProps({
|
|
30641
|
+
points: newPoints
|
|
30642
|
+
});
|
|
30643
|
+
}
|
|
30644
|
+
function handleColorChange(newColor) {
|
|
30645
|
+
onChangeProps({
|
|
30646
|
+
color: newColor,
|
|
30647
|
+
// Keep the line's points' colors in sync with the line color.
|
|
30648
|
+
points: [{
|
|
30649
|
+
...startPoint,
|
|
30650
|
+
color: newColor
|
|
30651
|
+
}, {
|
|
30652
|
+
...endPoint,
|
|
30653
|
+
color: newColor
|
|
30654
|
+
}]
|
|
30655
|
+
});
|
|
30656
|
+
}
|
|
30657
|
+
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View
|
|
30658
|
+
// More specificity so that we can override the default
|
|
30659
|
+
// .heading > h2 > .header styles from the articles.less
|
|
30660
|
+
// file (which is imported in perseus-renderer.less).
|
|
30661
|
+
, {
|
|
30662
|
+
className: "locked-figure-accordion"
|
|
30663
|
+
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksAccordion.AccordionSection, {
|
|
30664
|
+
style: styles$d.container,
|
|
30665
|
+
headerStyle: styles$d.accordionHeader,
|
|
30666
|
+
header: /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30667
|
+
style: styles$d.row
|
|
30668
|
+
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, lineLabel), /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30669
|
+
size: wonderBlocksTokens.spacing.xSmall_8
|
|
30670
|
+
}), /*#__PURE__*/React__namespace.createElement(ColorSwatch, {
|
|
30671
|
+
color: lineColor
|
|
30672
|
+
}))
|
|
30673
|
+
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30674
|
+
style: styles$d.accordionPanel
|
|
30675
|
+
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30676
|
+
style: [styles$d.row, styles$d.spaceUnder]
|
|
30677
|
+
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
30678
|
+
htmlFor: kindSelectId,
|
|
30679
|
+
style: styles$d.label,
|
|
30680
|
+
tag: "label"
|
|
30681
|
+
}, "Kind"), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
|
|
30682
|
+
id: kindSelectId,
|
|
30683
|
+
selectedValue: kind,
|
|
30684
|
+
onChange: value => onChangeProps({
|
|
30685
|
+
kind: value
|
|
30686
|
+
})
|
|
30687
|
+
// Placeholder is required, but never gets used.
|
|
30688
|
+
,
|
|
30689
|
+
placeholder: ""
|
|
30690
|
+
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
30691
|
+
value: "line",
|
|
30692
|
+
label: "line"
|
|
30693
|
+
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
30694
|
+
value: "segment",
|
|
30695
|
+
label: "segment"
|
|
30696
|
+
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
30697
|
+
value: "ray",
|
|
30698
|
+
label: "ray"
|
|
30699
|
+
}))), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30700
|
+
style: [styles$d.row, styles$d.spaceUnder]
|
|
30701
|
+
}, /*#__PURE__*/React__namespace.createElement(ColorSelect, {
|
|
30702
|
+
id: colorSelectId,
|
|
30703
|
+
selectedValue: lineColor || "blue",
|
|
30704
|
+
onChange: handleColorChange
|
|
30705
|
+
}), /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30706
|
+
size: wonderBlocksTokens.spacing.medium_16
|
|
30707
|
+
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30708
|
+
style: styles$d.row
|
|
30709
|
+
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
30710
|
+
htmlFor: styleSelectId,
|
|
30711
|
+
style: styles$d.label,
|
|
30712
|
+
tag: "label"
|
|
30713
|
+
}, "Style"), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
|
|
30714
|
+
id: styleSelectId,
|
|
30715
|
+
selectedValue: lineStyle,
|
|
30716
|
+
onChange: value => onChangeProps({
|
|
30717
|
+
lineStyle: value
|
|
30718
|
+
})
|
|
30719
|
+
// Placeholder is required, but never gets used.
|
|
30720
|
+
,
|
|
30721
|
+
placeholder: ""
|
|
30722
|
+
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
30723
|
+
value: "solid",
|
|
30724
|
+
label: "solid"
|
|
30725
|
+
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
30726
|
+
value: "dashed",
|
|
30727
|
+
label: "dashed"
|
|
30728
|
+
})))), /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
|
|
30729
|
+
label: "Show arrows",
|
|
30730
|
+
checked: showArrows,
|
|
30731
|
+
onChange: newValue => onChangeProps({
|
|
30732
|
+
showArrows: newValue
|
|
30733
|
+
}),
|
|
30734
|
+
style: styles$d.spaceUnder
|
|
30735
|
+
}), /*#__PURE__*/React__namespace.createElement(LockedPointSettings, _extends({
|
|
30736
|
+
label: "Start point",
|
|
30737
|
+
toggled: showStartPoint
|
|
30738
|
+
}, startPoint, {
|
|
30739
|
+
onToggle: newValue => onChangeProps({
|
|
30740
|
+
showStartPoint: newValue
|
|
30741
|
+
}),
|
|
30742
|
+
onChangeProps: newProps => handleChangePoint(newProps, 0),
|
|
30743
|
+
style: styles$d.lockedPointSettingsContainer
|
|
30744
|
+
})), /*#__PURE__*/React__namespace.createElement(LockedPointSettings, _extends({
|
|
30745
|
+
label: "End point",
|
|
30746
|
+
toggled: showEndPoint
|
|
30747
|
+
}, endPoint, {
|
|
30748
|
+
onToggle: newValue => onChangeProps({
|
|
30749
|
+
showEndPoint: newValue
|
|
30750
|
+
}),
|
|
30751
|
+
onChangeProps: newProps => handleChangePoint(newProps, 1),
|
|
30752
|
+
style: styles$d.lockedPointSettingsContainer
|
|
30753
|
+
})), /*#__PURE__*/React__namespace.createElement(IconButton__default["default"], {
|
|
30754
|
+
icon: trashIcon__default["default"],
|
|
30755
|
+
"aria-label": `Delete locked line defined by
|
|
30756
|
+
${startPoint.coord[0]}, ${startPoint.coord[1]} and
|
|
30757
|
+
${endPoint.coord[0]}, ${endPoint.coord[1]}.`,
|
|
30758
|
+
onClick: onRemove,
|
|
30759
|
+
style: styles$d.deleteButton
|
|
30760
|
+
}))));
|
|
30761
|
+
};
|
|
30762
|
+
const styles$d = aphrodite.StyleSheet.create({
|
|
30763
|
+
container: {
|
|
30764
|
+
backgroundColor: wonderBlocksTokens.color.fadedBlue8,
|
|
30765
|
+
marginBottom: wonderBlocksTokens.spacing.xSmall_8
|
|
30766
|
+
},
|
|
30767
|
+
accordionHeader: {
|
|
30768
|
+
paddingTop: wonderBlocksTokens.spacing.small_12,
|
|
30769
|
+
paddingBottom: wonderBlocksTokens.spacing.small_12,
|
|
30770
|
+
paddingInlineStart: wonderBlocksTokens.spacing.medium_16
|
|
30771
|
+
},
|
|
30772
|
+
accordionPanel: {
|
|
30773
|
+
padding: wonderBlocksTokens.spacing.medium_16,
|
|
30774
|
+
paddingBottom: wonderBlocksTokens.spacing.xSmall_8
|
|
30775
|
+
},
|
|
30776
|
+
lockedPointSettingsContainer: {
|
|
30777
|
+
marginTop: wonderBlocksTokens.spacing.xSmall_8,
|
|
30778
|
+
marginBottom: wonderBlocksTokens.spacing.xSmall_8,
|
|
30779
|
+
marginLeft: -wonderBlocksTokens.spacing.xxxSmall_4,
|
|
30780
|
+
marginRight: -wonderBlocksTokens.spacing.xxxSmall_4,
|
|
30781
|
+
backgroundColor: wonderBlocksTokens.color.white
|
|
30782
|
+
},
|
|
30783
|
+
row: {
|
|
30784
|
+
flexDirection: "row",
|
|
30785
|
+
alignItems: "center"
|
|
30786
|
+
},
|
|
30787
|
+
spaceUnder: {
|
|
30788
|
+
marginBottom: wonderBlocksTokens.spacing.xSmall_8
|
|
30789
|
+
},
|
|
30790
|
+
label: {
|
|
30791
|
+
marginInlineEnd: wonderBlocksTokens.spacing.xSmall_8
|
|
30792
|
+
},
|
|
30793
|
+
deleteButton: {
|
|
30794
|
+
position: "absolute",
|
|
30795
|
+
top: wonderBlocksTokens.spacing.small_12,
|
|
30796
|
+
right: wonderBlocksTokens.spacing.small_12
|
|
30797
|
+
}
|
|
30798
|
+
});
|
|
30799
|
+
|
|
30596
30800
|
/**
|
|
30597
30801
|
* LockedFigureSettings takes in a figure and renders the
|
|
30598
30802
|
* respective settings for that figure type.
|
|
@@ -30606,6 +30810,8 @@ const LockedFigureSettings = props => {
|
|
|
30606
30810
|
switch (props.type) {
|
|
30607
30811
|
case "point":
|
|
30608
30812
|
return /*#__PURE__*/React__namespace.createElement(LockedPointSettings, props);
|
|
30813
|
+
case "line":
|
|
30814
|
+
return /*#__PURE__*/React__namespace.createElement(LockedLineSettings, props);
|
|
30609
30815
|
}
|
|
30610
30816
|
return null;
|
|
30611
30817
|
};
|
|
@@ -30644,19 +30850,12 @@ const LockedFiguresSection = props => {
|
|
|
30644
30850
|
}
|
|
30645
30851
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30646
30852
|
style: styles$c.container
|
|
30647
|
-
}, figures?.map((figure, index) => {
|
|
30648
|
-
|
|
30649
|
-
|
|
30650
|
-
|
|
30651
|
-
|
|
30652
|
-
|
|
30653
|
-
return /*#__PURE__*/React__namespace.createElement(LockedFigureSettings, _extends({
|
|
30654
|
-
key: `${uniqueId}-locked-${figure}-${index}`
|
|
30655
|
-
}, figure, {
|
|
30656
|
-
onChangeProps: newProps => changeProps(index, newProps),
|
|
30657
|
-
onRemove: () => removeLockedFigure(index)
|
|
30658
|
-
}));
|
|
30659
|
-
}), /*#__PURE__*/React__namespace.createElement(LockedFigureSelect, {
|
|
30853
|
+
}, figures?.map((figure, index) => /*#__PURE__*/React__namespace.createElement(LockedFigureSettings, _extends({
|
|
30854
|
+
key: `${uniqueId}-locked-${figure}-${index}`
|
|
30855
|
+
}, figure, {
|
|
30856
|
+
onChangeProps: newProps => changeProps(index, newProps),
|
|
30857
|
+
onRemove: () => removeLockedFigure(index)
|
|
30858
|
+
}))), /*#__PURE__*/React__namespace.createElement(LockedFigureSelect, {
|
|
30660
30859
|
id: `${uniqueId}-select`,
|
|
30661
30860
|
onChange: addLockedFigure
|
|
30662
30861
|
}));
|
|
@@ -31005,8 +31204,8 @@ class InteractiveGraphEditor extends React__namespace.Component {
|
|
|
31005
31204
|
borderWidth: 1
|
|
31006
31205
|
}
|
|
31007
31206
|
}, equationString), /*#__PURE__*/React__namespace.createElement(InfoTip$b, null, /*#__PURE__*/React__namespace.createElement("p", null, "Graph the correct answer in the graph below and ensure the equation or point coordinates displayed represent the correct answer."))), graph,
|
|
31008
|
-
// Only show the "Add locked figure" dropdown if the graph
|
|
31009
|
-
// using Mafs.
|
|
31207
|
+
// Only show the "Add locked figure" dropdown if the graph
|
|
31208
|
+
// is using Mafs.
|
|
31010
31209
|
this.props.graph && this.props.apiOptions?.flags?.mafs?.["interactive-graph-locked-features-m1"] && this.props.apiOptions?.flags?.mafs?.[this.props.graph.type] && /*#__PURE__*/React__namespace.createElement(LockedFiguresSection, {
|
|
31011
31210
|
figures: this.props.lockedFigures,
|
|
31012
31211
|
onChange: this.props.onChange
|
|
@@ -31508,9 +31707,9 @@ class HoverBehavior extends React__namespace.Component {
|
|
|
31508
31707
|
}
|
|
31509
31708
|
|
|
31510
31709
|
// @ts-expect-error - TS2564 - Property 'focusFlag' has no initializer and is not definitely assigned in the constructor.
|
|
31511
|
-
|
|
31710
|
+
focusFlag;
|
|
31512
31711
|
// @ts-expect-error - TS2564 - Property 'waitingForClick' has no initializer and is not definitely assigned in the constructor.
|
|
31513
|
-
|
|
31712
|
+
waitingForClick;
|
|
31514
31713
|
handleClick = e => {
|
|
31515
31714
|
if (!this.props.disabled) {
|
|
31516
31715
|
if (this.props.shouldUpdate()) {
|
|
@@ -31821,7 +32020,7 @@ const check = `M10,3.8C10,4,9.9,4.2,9.8,4.3L5.1,8.9L4.3,9.8C4.2,9.9,4,10,3.8,10
|
|
|
31821
32020
|
const optionHeight = 30;
|
|
31822
32021
|
class Option extends React__namespace.Component {
|
|
31823
32022
|
// @ts-expect-error - TS2564 - Property 'node' has no initializer and is not definitely assigned in the constructor.
|
|
31824
|
-
|
|
32023
|
+
node;
|
|
31825
32024
|
handleKeyDown(event) {
|
|
31826
32025
|
const {
|
|
31827
32026
|
onDropdownClose
|
|
@@ -31900,7 +32099,7 @@ class Option extends React__namespace.Component {
|
|
|
31900
32099
|
// - how does the drop down interact with tooltips? what's the z-index order?
|
|
31901
32100
|
class OptionGroup extends React__namespace.Component {
|
|
31902
32101
|
// @ts-expect-error - TS2564 - Property 'focusedElement' has no initializer and is not definitely assigned in the constructor.
|
|
31903
|
-
|
|
32102
|
+
focusedElement;
|
|
31904
32103
|
componentDidMount() {
|
|
31905
32104
|
if (this.focusedElement) {
|
|
31906
32105
|
findAndFocusElement(this.focusedElement);
|
|
@@ -32005,6 +32204,7 @@ const {
|
|
|
32005
32204
|
borderRadius
|
|
32006
32205
|
} = perseus.globalStyles;
|
|
32007
32206
|
class Marker extends React__namespace.Component {
|
|
32207
|
+
_marker;
|
|
32008
32208
|
constructor(props) {
|
|
32009
32209
|
super(props);
|
|
32010
32210
|
this.state = {
|
|
@@ -32229,8 +32429,7 @@ class QuestionMarkers extends React__namespace.Component {
|
|
|
32229
32429
|
// Open answer selection dropdown for each of the specified markers.
|
|
32230
32430
|
indices.forEach(index => {
|
|
32231
32431
|
if (this._markers[index]) {
|
|
32232
|
-
|
|
32233
|
-
this._markers[index].openDropdown();
|
|
32432
|
+
this._markers[index]?.openDropdown();
|
|
32234
32433
|
}
|
|
32235
32434
|
});
|
|
32236
32435
|
}
|
|
@@ -32385,6 +32584,7 @@ const styles$1 = aphrodite.StyleSheet.create({
|
|
|
32385
32584
|
* knowledge by directly interacting with the image.
|
|
32386
32585
|
*/
|
|
32387
32586
|
class LabelImageEditor extends React__namespace.Component {
|
|
32587
|
+
_questionMarkers;
|
|
32388
32588
|
static defaultProps = {
|
|
32389
32589
|
choices: [],
|
|
32390
32590
|
imageAlt: "",
|
|
@@ -33284,6 +33484,9 @@ const {
|
|
|
33284
33484
|
const {
|
|
33285
33485
|
firstNumericalParse
|
|
33286
33486
|
} = perseus.Util;
|
|
33487
|
+
|
|
33488
|
+
// NOTE(john): Copied from perseus-types.d.ts in the Perseus package.
|
|
33489
|
+
// I'm unable to find a good way of importing these types into this project.
|
|
33287
33490
|
const answerFormButtons = [{
|
|
33288
33491
|
title: "Integers",
|
|
33289
33492
|
value: "integer",
|
|
@@ -33320,30 +33523,25 @@ const initAnswer = status => {
|
|
|
33320
33523
|
maxError: null
|
|
33321
33524
|
};
|
|
33322
33525
|
};
|
|
33323
|
-
|
|
33324
|
-
|
|
33325
|
-
|
|
33326
|
-
|
|
33327
|
-
|
|
33328
|
-
|
|
33329
|
-
|
|
33330
|
-
|
|
33331
|
-
|
|
33332
|
-
|
|
33333
|
-
|
|
33334
|
-
|
|
33335
|
-
|
|
33336
|
-
|
|
33337
|
-
rightAlign: false
|
|
33338
|
-
};
|
|
33339
|
-
},
|
|
33340
|
-
getInitialState: function () {
|
|
33341
|
-
return {
|
|
33526
|
+
class NumericInputEditor extends React__namespace.Component {
|
|
33527
|
+
static contextType = perseus.PerseusI18nContext;
|
|
33528
|
+
static widgetName = "numeric-input";
|
|
33529
|
+
static displayName = "NumericInputEditor";
|
|
33530
|
+
static defaultProps = {
|
|
33531
|
+
answers: [initAnswer("correct")],
|
|
33532
|
+
size: "normal",
|
|
33533
|
+
coefficient: false,
|
|
33534
|
+
labelText: "",
|
|
33535
|
+
rightAlign: false
|
|
33536
|
+
};
|
|
33537
|
+
constructor(props) {
|
|
33538
|
+
super(props);
|
|
33539
|
+
this.state = {
|
|
33342
33540
|
lastStatus: "wrong",
|
|
33343
33541
|
showOptions: ___default["default"].map(this.props.answers, () => false)
|
|
33344
33542
|
};
|
|
33345
|
-
}
|
|
33346
|
-
render
|
|
33543
|
+
}
|
|
33544
|
+
render() {
|
|
33347
33545
|
const answers = this.props.answers;
|
|
33348
33546
|
const unsimplifiedAnswers = i => /*#__PURE__*/React__namespace.createElement("div", {
|
|
33349
33547
|
className: "perseus-widget-row"
|
|
@@ -33360,14 +33558,14 @@ const NumericInputEditor = createReactClass__default["default"]({
|
|
|
33360
33558
|
value: "enforced",
|
|
33361
33559
|
content: "wrong"
|
|
33362
33560
|
}],
|
|
33363
|
-
onChange: this.updateAnswer(i, "simplify")
|
|
33561
|
+
onChange: this.updateAnswer(i, "simplify") || (() => {})
|
|
33364
33562
|
}), /*#__PURE__*/React__namespace.createElement(InfoTip$7, null, /*#__PURE__*/React__namespace.createElement("p", null, "Normally select \"ungraded\". This will give the user a message saying the answer is correct but not simplified. The user will then have to simplify it and re-enter, but will not be penalized. (5th grade and after)"), /*#__PURE__*/React__namespace.createElement("p", null, "Select \"accepted\" only if the user is not expected to know how to simplify fractions yet. (Anything prior to 5th grade)"), /*#__PURE__*/React__namespace.createElement("p", null, "Select \"wrong\" ", /*#__PURE__*/React__namespace.createElement("em", null, "only"), " if we are specifically assessing the ability to simplify.")));
|
|
33365
33563
|
const suggestedAnswerTypes = i => /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("div", {
|
|
33366
33564
|
className: "perseus-widget-row"
|
|
33367
33565
|
}, /*#__PURE__*/React__namespace.createElement("label", null, "Choose the suggested answer formats"), /*#__PURE__*/React__namespace.createElement(MultiButtonGroup, {
|
|
33368
33566
|
buttons: answerFormButtons,
|
|
33369
33567
|
values: answers[i]["answerForms"],
|
|
33370
|
-
onChange: this.updateAnswer(i, "answerForms")
|
|
33568
|
+
onChange: this.updateAnswer(i, "answerForms") || (() => {})
|
|
33371
33569
|
}), /*#__PURE__*/React__namespace.createElement(InfoTip$7, null, /*#__PURE__*/React__namespace.createElement("p", null, "Formats will be autoselected for you based on the given answer; to show no suggested formats and accept all types, simply have a decimal/integer be the answer. Values with \u03C0 will have format \"pi\", and values that are fractions will have some subset (mixed will be \"mixed\" and \"proper\"; improper/proper will both be \"improper\" and \"proper\"). If you would like to specify that it is only a proper fraction (or only a mixed/improper fraction), deselect the other format. Except for specific cases, you should not need to change the autoselected formats."), /*#__PURE__*/React__namespace.createElement("p", null, "To restrict the answer to ", /*#__PURE__*/React__namespace.createElement("em", null, "only"), " an improper fraction (i.e. 7/4), select the improper fraction and toggle \"strict\" to true. This ", /*#__PURE__*/React__namespace.createElement("b", null, "will not"), " ", "accept 1.75 as an answer.", " "), /*#__PURE__*/React__namespace.createElement("p", null, "Unless you are testing that specific skill, please do not restrict the answer format."))), /*#__PURE__*/React__namespace.createElement("div", {
|
|
33372
33570
|
className: "perseus-widget-row"
|
|
33373
33571
|
}, /*#__PURE__*/React__namespace.createElement(PropCheckBox$3, {
|
|
@@ -33453,7 +33651,7 @@ const NumericInputEditor = createReactClass__default["default"]({
|
|
|
33453
33651
|
value: answer.value,
|
|
33454
33652
|
className: "numeric-input-value",
|
|
33455
33653
|
placeholder: "answer",
|
|
33456
|
-
format: ___default["default"].last(answer.answerForms),
|
|
33654
|
+
format: ___default["default"].last(answer.answerForms || []),
|
|
33457
33655
|
onFormatChange: (newValue, format) => {
|
|
33458
33656
|
// NOTE(charlie): The mobile web expression
|
|
33459
33657
|
// editor relies on this automatic answer
|
|
@@ -33477,13 +33675,13 @@ const NumericInputEditor = createReactClass__default["default"]({
|
|
|
33477
33675
|
forms = ["proper", "improper"];
|
|
33478
33676
|
}
|
|
33479
33677
|
this.updateAnswer(i, {
|
|
33480
|
-
value: firstNumericalParse(newValue),
|
|
33678
|
+
value: firstNumericalParse(newValue, this.context.strings),
|
|
33481
33679
|
answerForms: forms
|
|
33482
33680
|
});
|
|
33483
33681
|
},
|
|
33484
33682
|
onChange: newValue => {
|
|
33485
33683
|
this.updateAnswer(i, {
|
|
33486
|
-
value: firstNumericalParse(newValue)
|
|
33684
|
+
value: firstNumericalParse(newValue, this.context.strings)
|
|
33487
33685
|
});
|
|
33488
33686
|
}
|
|
33489
33687
|
}), answer.strict && /*#__PURE__*/React__namespace.createElement("div", {
|
|
@@ -33499,7 +33697,7 @@ const NumericInputEditor = createReactClass__default["default"]({
|
|
|
33499
33697
|
}, "\xB1"), /*#__PURE__*/React__namespace.createElement(NumberInput$5, {
|
|
33500
33698
|
placeholder: 0,
|
|
33501
33699
|
value: answers[i]["maxError"],
|
|
33502
|
-
format: ___default["default"].last(answer.answerForms),
|
|
33700
|
+
format: ___default["default"].last(answer.answerForms || []),
|
|
33503
33701
|
onChange: this.updateAnswer(i, "maxError")
|
|
33504
33702
|
})) : null, /*#__PURE__*/React__namespace.createElement("div", {
|
|
33505
33703
|
className: "value-divider"
|
|
@@ -33507,19 +33705,19 @@ const NumericInputEditor = createReactClass__default["default"]({
|
|
|
33507
33705
|
href: "javascript:void(0)",
|
|
33508
33706
|
className: "answer-status " + answer.status,
|
|
33509
33707
|
onClick: () => this.onStatusChange(i),
|
|
33510
|
-
onKeyDown: e => this.onSpace(e, this.onStatusChange
|
|
33708
|
+
onKeyDown: e => this.onSpace(e, this.onStatusChange)
|
|
33511
33709
|
}, answer.status), /*#__PURE__*/React__namespace.createElement("a", {
|
|
33512
33710
|
href: "javascript:void(0)",
|
|
33513
33711
|
className: "answer-trash",
|
|
33514
33712
|
"aria-label": "Delete answer",
|
|
33515
33713
|
onClick: () => this.onTrashAnswer(i),
|
|
33516
|
-
onKeyDown: e => this.onSpace(e, this.onTrashAnswer
|
|
33714
|
+
onKeyDown: e => this.onSpace(e, this.onTrashAnswer)
|
|
33517
33715
|
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$2, iconTrash$1)), /*#__PURE__*/React__namespace.createElement("a", {
|
|
33518
33716
|
href: "javascript:void(0)",
|
|
33519
33717
|
className: "options-toggle",
|
|
33520
33718
|
"aria-label": "Toggle options",
|
|
33521
33719
|
onClick: () => this.onToggleOptions(i),
|
|
33522
|
-
onKeyDown: e => this.onSpace(e, this.onToggleOptions
|
|
33720
|
+
onKeyDown: e => this.onSpace(e, this.onToggleOptions)
|
|
33523
33721
|
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$2, iconGear))), /*#__PURE__*/React__namespace.createElement("div", {
|
|
33524
33722
|
className: "input-answer-editor-message"
|
|
33525
33723
|
}, editor), this.state.showOptions[i] && /*#__PURE__*/React__namespace.createElement("div", {
|
|
@@ -33533,21 +33731,21 @@ const NumericInputEditor = createReactClass__default["default"]({
|
|
|
33533
33731
|
}, "User input"), /*#__PURE__*/React__namespace.createElement("div", {
|
|
33534
33732
|
className: "msg-title"
|
|
33535
33733
|
}, "Message shown to user on attempt"), generateInputAnswerEditors(), addAnswerButton, inputSize, rightAlign, coefficientCheck, labelText);
|
|
33536
|
-
}
|
|
33734
|
+
}
|
|
33537
33735
|
change() {
|
|
33538
33736
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
33539
33737
|
args[_key] = arguments[_key];
|
|
33540
33738
|
}
|
|
33541
33739
|
return perseus.Changeable.change.apply(this, args);
|
|
33542
|
-
}
|
|
33543
|
-
onToggleOptions
|
|
33740
|
+
}
|
|
33741
|
+
onToggleOptions(choiceIndex) {
|
|
33544
33742
|
const showOptions = this.state.showOptions.slice();
|
|
33545
33743
|
showOptions[choiceIndex] = !showOptions[choiceIndex];
|
|
33546
33744
|
this.setState({
|
|
33547
33745
|
showOptions: showOptions
|
|
33548
33746
|
});
|
|
33549
|
-
}
|
|
33550
|
-
onTrashAnswer
|
|
33747
|
+
}
|
|
33748
|
+
onTrashAnswer(choiceIndex) {
|
|
33551
33749
|
if (choiceIndex >= 0 && choiceIndex < this.props.answers.length) {
|
|
33552
33750
|
const answers = this.props.answers.slice(0);
|
|
33553
33751
|
answers.splice(choiceIndex, 1);
|
|
@@ -33555,16 +33753,16 @@ const NumericInputEditor = createReactClass__default["default"]({
|
|
|
33555
33753
|
answers: answers
|
|
33556
33754
|
});
|
|
33557
33755
|
}
|
|
33558
|
-
}
|
|
33559
|
-
onSpace
|
|
33756
|
+
}
|
|
33757
|
+
onSpace(e, callback) {
|
|
33560
33758
|
if (e.key === " ") {
|
|
33561
33759
|
e.preventDefault(); // prevent page shifting
|
|
33562
33760
|
// eslint-disable-next-line prefer-rest-params
|
|
33563
33761
|
const args = ___default["default"].toArray(arguments).slice(2);
|
|
33564
33762
|
callback.apply(this, args);
|
|
33565
33763
|
}
|
|
33566
|
-
}
|
|
33567
|
-
onStatusChange
|
|
33764
|
+
}
|
|
33765
|
+
onStatusChange(choiceIndex) {
|
|
33568
33766
|
const statuses = ["wrong", "ungraded", "correct"];
|
|
33569
33767
|
const answers = this.props.answers;
|
|
33570
33768
|
const i = ___default["default"].indexOf(statuses, answers[choiceIndex].status);
|
|
@@ -33573,8 +33771,8 @@ const NumericInputEditor = createReactClass__default["default"]({
|
|
|
33573
33771
|
status: newStatus,
|
|
33574
33772
|
simplify: newStatus === "correct" ? "required" : "accepted"
|
|
33575
33773
|
});
|
|
33576
|
-
}
|
|
33577
|
-
updateAnswer
|
|
33774
|
+
}
|
|
33775
|
+
updateAnswer(choiceIndex, update) {
|
|
33578
33776
|
if (!___default["default"].isObject(update)) {
|
|
33579
33777
|
return ___default["default"].partial((choiceIndex, key, value) => {
|
|
33580
33778
|
const update = {};
|
|
@@ -33582,7 +33780,9 @@ const NumericInputEditor = createReactClass__default["default"]({
|
|
|
33582
33780
|
this.updateAnswer(choiceIndex, update);
|
|
33583
33781
|
}, choiceIndex, update);
|
|
33584
33782
|
}
|
|
33585
|
-
let answers =
|
|
33783
|
+
let answers = [
|
|
33784
|
+
// Have to do this to remove the `readonly` state from the prop
|
|
33785
|
+
...this.props.answers];
|
|
33586
33786
|
|
|
33587
33787
|
// Don't bother to make a new answer box unless we are editing the last
|
|
33588
33788
|
// one.
|
|
@@ -33595,15 +33795,15 @@ const NumericInputEditor = createReactClass__default["default"]({
|
|
|
33595
33795
|
this.props.onChange({
|
|
33596
33796
|
answers: answers
|
|
33597
33797
|
});
|
|
33598
|
-
}
|
|
33599
|
-
addAnswer
|
|
33798
|
+
}
|
|
33799
|
+
addAnswer() {
|
|
33600
33800
|
const lastAnswer = initAnswer(this.state.lastStatus);
|
|
33601
33801
|
const answers = this.props.answers.concat(lastAnswer);
|
|
33602
33802
|
this.props.onChange({
|
|
33603
33803
|
answers: answers
|
|
33604
33804
|
});
|
|
33605
|
-
}
|
|
33606
|
-
getSaveWarnings
|
|
33805
|
+
}
|
|
33806
|
+
getSaveWarnings() {
|
|
33607
33807
|
// Filter out all the empty answers
|
|
33608
33808
|
const warnings = [];
|
|
33609
33809
|
// TODO(emily): This doesn't actually work, because the value is either
|
|
@@ -33621,11 +33821,11 @@ const NumericInputEditor = createReactClass__default["default"]({
|
|
|
33621
33821
|
}
|
|
33622
33822
|
});
|
|
33623
33823
|
return warnings;
|
|
33624
|
-
}
|
|
33824
|
+
}
|
|
33625
33825
|
serialize() {
|
|
33626
33826
|
return perseus.EditorJsonify.serialize.call(this);
|
|
33627
33827
|
}
|
|
33628
|
-
}
|
|
33828
|
+
}
|
|
33629
33829
|
|
|
33630
33830
|
/* eslint-disable @khanacademy/ts-no-error-suppressions */
|
|
33631
33831
|
const {
|
|
@@ -34321,9 +34521,7 @@ class ChoiceEditor extends React__namespace.Component {
|
|
|
34321
34521
|
apiOptions: this.props.apiOptions,
|
|
34322
34522
|
content: this.props.choice.clue || "",
|
|
34323
34523
|
widgetEnabled: false,
|
|
34324
|
-
placeholder:
|
|
34325
|
-
correctOrIncorrect: checkedClass
|
|
34326
|
-
}),
|
|
34524
|
+
placeholder: `Why is this choice ${checkedClass}?`,
|
|
34327
34525
|
onChange: this.props.onClueChange
|
|
34328
34526
|
});
|
|
34329
34527
|
const deleteLink = /*#__PURE__*/React__namespace.createElement("a", {
|
|
@@ -34367,7 +34565,7 @@ class RadioEditor extends React__namespace.Component {
|
|
|
34367
34565
|
};
|
|
34368
34566
|
static widgetName = "radio";
|
|
34369
34567
|
static defaultProps = {
|
|
34370
|
-
choices: [{}, {}],
|
|
34568
|
+
choices: [{}, {}, {}, {}],
|
|
34371
34569
|
displayCount: null,
|
|
34372
34570
|
randomize: false,
|
|
34373
34571
|
hasNoneOfTheAbove: false,
|
|
@@ -34892,6 +35090,9 @@ class UnitExample extends React__namespace.Component {
|
|
|
34892
35090
|
}
|
|
34893
35091
|
}
|
|
34894
35092
|
class UnitInputEditor extends React__namespace.Component {
|
|
35093
|
+
parsed;
|
|
35094
|
+
groupId;
|
|
35095
|
+
original;
|
|
34895
35096
|
static propTypes = {
|
|
34896
35097
|
...perseus.Changeable.propTypes,
|
|
34897
35098
|
value: PropTypes__default["default"].string,
|