@khanacademy/perseus-editor 6.3.0 → 6.4.1
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/components/color-select.d.ts +0 -1
- package/dist/components/coordinate-pair-input.d.ts +8 -0
- package/dist/components/defining-point-settings.d.ts +24 -0
- package/dist/components/locked-figure-settings-accordion.d.ts +2 -0
- package/dist/components/locked-figure-settings.d.ts +11 -1
- package/dist/components/locked-line-settings.d.ts +8 -1
- package/dist/components/locked-point-settings.d.ts +9 -7
- package/dist/es/index.js +452 -333
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +452 -334
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -25,10 +25,10 @@ var wonderBlocksDropdown = require('@khanacademy/wonder-blocks-dropdown');
|
|
|
25
25
|
var wonderBlocksForm = require('@khanacademy/wonder-blocks-form');
|
|
26
26
|
var wonderBlocksTypography = require('@khanacademy/wonder-blocks-typography');
|
|
27
27
|
var Banner = require('@khanacademy/wonder-blocks-banner');
|
|
28
|
-
var wonderBlocksAccordion = require('@khanacademy/wonder-blocks-accordion');
|
|
29
28
|
var Button = require('@khanacademy/wonder-blocks-button');
|
|
30
|
-
var trashIcon = require('@phosphor-icons/core/bold/trash-bold.svg');
|
|
31
29
|
var Switch = require('@khanacademy/wonder-blocks-switch');
|
|
30
|
+
var wonderBlocksAccordion = require('@khanacademy/wonder-blocks-accordion');
|
|
31
|
+
var trashIcon = require('@phosphor-icons/core/bold/trash-bold.svg');
|
|
32
32
|
|
|
33
33
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
34
34
|
|
|
@@ -62,12 +62,12 @@ var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
|
62
62
|
var KAS__namespace = /*#__PURE__*/_interopNamespace(KAS);
|
|
63
63
|
var Banner__default = /*#__PURE__*/_interopDefaultLegacy(Banner);
|
|
64
64
|
var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
|
|
65
|
-
var trashIcon__default = /*#__PURE__*/_interopDefaultLegacy(trashIcon);
|
|
66
65
|
var Switch__default = /*#__PURE__*/_interopDefaultLegacy(Switch);
|
|
66
|
+
var trashIcon__default = /*#__PURE__*/_interopDefaultLegacy(trashIcon);
|
|
67
67
|
|
|
68
68
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
69
69
|
const libName = "@khanacademy/perseus-editor";
|
|
70
|
-
const libVersion = "6.
|
|
70
|
+
const libVersion = "6.4.1";
|
|
71
71
|
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
72
72
|
|
|
73
73
|
function _extends() {
|
|
@@ -262,13 +262,13 @@ class SectionControlButton extends React__namespace.Component {
|
|
|
262
262
|
role: "button",
|
|
263
263
|
hideDefaultFocusRing: true,
|
|
264
264
|
"aria-label": title,
|
|
265
|
-
style: styles$
|
|
265
|
+
style: styles$y.button
|
|
266
266
|
}, _ref => {
|
|
267
267
|
return /*#__PURE__*/React__namespace.createElement(InlineIcon$b, icon);
|
|
268
268
|
});
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
|
-
const styles$
|
|
271
|
+
const styles$y = aphrodite.StyleSheet.create({
|
|
272
272
|
button: {
|
|
273
273
|
backgroundColor: wonderBlocksTokens.color.gold,
|
|
274
274
|
margin: 2,
|
|
@@ -20787,19 +20787,19 @@ class TexErrorView extends React__namespace.Component {
|
|
|
20787
20787
|
const {
|
|
20788
20788
|
showErrors
|
|
20789
20789
|
} = this.state;
|
|
20790
|
-
const iconStyle = showErrors ? styles$
|
|
20790
|
+
const iconStyle = showErrors ? styles$x.iconExpanded : styles$x.iconCollapsed;
|
|
20791
20791
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
20792
|
-
style: styles$
|
|
20792
|
+
style: styles$x.errorContainer
|
|
20793
20793
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
20794
|
-
style: styles$
|
|
20794
|
+
style: styles$x.title,
|
|
20795
20795
|
onClick: this.handleToggleTexErrors
|
|
20796
20796
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksIcon.PhosphorIcon, {
|
|
20797
20797
|
icon: caretRight__default["default"],
|
|
20798
20798
|
style: iconStyle
|
|
20799
20799
|
}), "\xA0 TeX Errors (", errorList.length, ")"), showErrors && /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
20800
|
-
style: styles$
|
|
20800
|
+
style: styles$x.errorExplanation
|
|
20801
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, {
|
|
20802
|
-
style: styles$
|
|
20802
|
+
style: styles$x.error,
|
|
20803
20803
|
key: index
|
|
20804
20804
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
20805
20805
|
style: {
|
|
@@ -20808,7 +20808,7 @@ class TexErrorView extends React__namespace.Component {
|
|
|
20808
20808
|
}, e.math), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, null, e.message))));
|
|
20809
20809
|
}
|
|
20810
20810
|
}
|
|
20811
|
-
const styles$
|
|
20811
|
+
const styles$x = aphrodite.StyleSheet.create({
|
|
20812
20812
|
title: {
|
|
20813
20813
|
backgroundColor: "#eee",
|
|
20814
20814
|
fontSize: "1.25em",
|
|
@@ -24565,12 +24565,12 @@ class SimpleButton extends React__namespace.Component {
|
|
|
24565
24565
|
...otherProps
|
|
24566
24566
|
} = this.props;
|
|
24567
24567
|
return /*#__PURE__*/React__namespace.createElement("div", _extends({
|
|
24568
|
-
className: aphrodite.css(styles$
|
|
24568
|
+
className: aphrodite.css(styles$w.baseButton, color === "green" && styles$w.green, color === "orange" && styles$w.orange),
|
|
24569
24569
|
onClick: onClick
|
|
24570
24570
|
}, otherProps), children);
|
|
24571
24571
|
}
|
|
24572
24572
|
}
|
|
24573
|
-
const styles$
|
|
24573
|
+
const styles$w = aphrodite.StyleSheet.create({
|
|
24574
24574
|
baseButton: {
|
|
24575
24575
|
top: "0",
|
|
24576
24576
|
fontSize: "11px",
|
|
@@ -24783,23 +24783,23 @@ const LeafContainer = _ref2 => {
|
|
|
24783
24783
|
} = _ref2;
|
|
24784
24784
|
const hasPreviewHeading = shape.type === "content" || shape.type === "hint";
|
|
24785
24785
|
const previewHeading = hasPreviewHeading && /*#__PURE__*/React__namespace.createElement("div", {
|
|
24786
|
-
className: aphrodite.css(styles$
|
|
24786
|
+
className: aphrodite.css(styles$v.containerHeader)
|
|
24787
24787
|
}, /*#__PURE__*/React__namespace.createElement(Header, {
|
|
24788
24788
|
depth: path.length,
|
|
24789
|
-
className: aphrodite.css(styles$
|
|
24789
|
+
className: aphrodite.css(styles$v.containerTitle)
|
|
24790
24790
|
}, capitalize(name)));
|
|
24791
24791
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
24792
|
-
className: aphrodite.css(styles$
|
|
24792
|
+
className: aphrodite.css(styles$v.container)
|
|
24793
24793
|
}, /*#__PURE__*/React__namespace.createElement("span", {
|
|
24794
|
-
className: aphrodite.css(styles$
|
|
24794
|
+
className: aphrodite.css(styles$v.row, styles$v.rowHeading)
|
|
24795
24795
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
24796
|
-
className: aphrodite.css(styles$
|
|
24796
|
+
className: aphrodite.css(styles$v.columnLeft)
|
|
24797
24797
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
24798
|
-
className: "pod-title " + aphrodite.css(styles$
|
|
24798
|
+
className: "pod-title " + aphrodite.css(styles$v.containerHeader)
|
|
24799
24799
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
24800
|
-
className: aphrodite.css(styles$
|
|
24800
|
+
className: aphrodite.css(styles$v.containerTitle)
|
|
24801
24801
|
}, capitalize(name)), controls)), /*#__PURE__*/React__namespace.createElement("div", {
|
|
24802
|
-
className: aphrodite.css(styles$
|
|
24802
|
+
className: aphrodite.css(styles$v.columnRight)
|
|
24803
24803
|
}, previewHeading)), children);
|
|
24804
24804
|
};
|
|
24805
24805
|
const ArrayContainer = props => {
|
|
@@ -24812,11 +24812,11 @@ const ArrayContainer = props => {
|
|
|
24812
24812
|
actions
|
|
24813
24813
|
} = props;
|
|
24814
24814
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
24815
|
-
className: aphrodite.css(styles$
|
|
24815
|
+
className: aphrodite.css(styles$v.container)
|
|
24816
24816
|
}, controls && /*#__PURE__*/React__namespace.createElement("div", {
|
|
24817
|
-
className: aphrodite.css(styles$
|
|
24817
|
+
className: aphrodite.css(styles$v.columnLeft, styles$v.containerHeader)
|
|
24818
24818
|
}, controls), /*#__PURE__*/React__namespace.createElement("div", null, children), /*#__PURE__*/React__namespace.createElement("div", {
|
|
24819
|
-
className: aphrodite.css(styles$
|
|
24819
|
+
className: aphrodite.css(styles$v.columnLeft)
|
|
24820
24820
|
}, /*#__PURE__*/React__namespace.createElement("a", {
|
|
24821
24821
|
href: "javascript:void 0",
|
|
24822
24822
|
onClick: () => actions.addArrayElement(path, shape.elementShape)
|
|
@@ -24830,28 +24830,28 @@ const ObjectContainer = _ref3 => {
|
|
|
24830
24830
|
path
|
|
24831
24831
|
} = _ref3;
|
|
24832
24832
|
const headingEditor = /*#__PURE__*/React__namespace.createElement("div", {
|
|
24833
|
-
className: aphrodite.css(styles$
|
|
24833
|
+
className: aphrodite.css(styles$v.containerHeader)
|
|
24834
24834
|
}, /*#__PURE__*/React__namespace.createElement(Header, {
|
|
24835
24835
|
depth: path.length,
|
|
24836
|
-
className: aphrodite.css(styles$
|
|
24836
|
+
className: aphrodite.css(styles$v.containerTitle)
|
|
24837
24837
|
}, capitalize(name)), controls);
|
|
24838
24838
|
const headingPreview = (name || controls) && /*#__PURE__*/React__namespace.createElement("div", {
|
|
24839
|
-
className: aphrodite.css(styles$
|
|
24839
|
+
className: aphrodite.css(styles$v.containerHeader, styles$v.previewCollectionHeader)
|
|
24840
24840
|
}, /*#__PURE__*/React__namespace.createElement(Header, {
|
|
24841
24841
|
depth: path.length,
|
|
24842
|
-
className: aphrodite.css(styles$
|
|
24842
|
+
className: aphrodite.css(styles$v.containerTitle)
|
|
24843
24843
|
}, capitalize(name)));
|
|
24844
24844
|
const hasBothHeadings = headingEditor && headingPreview;
|
|
24845
24845
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
24846
|
-
className: aphrodite.css(styles$
|
|
24846
|
+
className: aphrodite.css(styles$v.container)
|
|
24847
24847
|
}, hasBothHeadings && /*#__PURE__*/React__namespace.createElement("span", {
|
|
24848
|
-
className: aphrodite.css(styles$
|
|
24848
|
+
className: aphrodite.css(styles$v.row)
|
|
24849
24849
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
24850
|
-
className: aphrodite.css(styles$
|
|
24850
|
+
className: aphrodite.css(styles$v.columnLeft)
|
|
24851
24851
|
}, headingEditor), /*#__PURE__*/React__namespace.createElement("div", {
|
|
24852
|
-
className: aphrodite.css(styles$
|
|
24852
|
+
className: aphrodite.css(styles$v.columnRight)
|
|
24853
24853
|
}, headingPreview)), /*#__PURE__*/React__namespace.createElement("div", {
|
|
24854
|
-
className: aphrodite.css(path.length > 0 && styles$
|
|
24854
|
+
className: aphrodite.css(path.length > 0 && styles$v.contentIndent)
|
|
24855
24855
|
}, children));
|
|
24856
24856
|
};
|
|
24857
24857
|
|
|
@@ -24971,11 +24971,11 @@ const ItemNodeContent = withStickiness(props => {
|
|
|
24971
24971
|
className: "framework-perseus"
|
|
24972
24972
|
}, lens(renderers).get(path));
|
|
24973
24973
|
return /*#__PURE__*/React__namespace.createElement("span", null, /*#__PURE__*/React__namespace.createElement("div", {
|
|
24974
|
-
className: aphrodite.css(styles$
|
|
24974
|
+
className: aphrodite.css(styles$v.row)
|
|
24975
24975
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
24976
|
-
className: aphrodite.css(styles$
|
|
24976
|
+
className: aphrodite.css(styles$v.columnLeft)
|
|
24977
24977
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
24978
|
-
className: aphrodite.css(sticky && styles$
|
|
24978
|
+
className: aphrodite.css(sticky && styles$v.sticky)
|
|
24979
24979
|
},
|
|
24980
24980
|
/*#__PURE__*/
|
|
24981
24981
|
// @ts-expect-error - TS2769 - No overload matches this call.
|
|
@@ -24983,9 +24983,9 @@ const ItemNodeContent = withStickiness(props => {
|
|
|
24983
24983
|
onChange: newVal => actions.mergeValueAtPath(path, newVal),
|
|
24984
24984
|
apiOptions: apiOptions
|
|
24985
24985
|
})))), /*#__PURE__*/React__namespace.createElement("div", {
|
|
24986
|
-
className: aphrodite.css(styles$
|
|
24986
|
+
className: aphrodite.css(styles$v.columnRight)
|
|
24987
24987
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
24988
|
-
className: aphrodite.css(sticky && styles$
|
|
24988
|
+
className: aphrodite.css(sticky && styles$v.sticky)
|
|
24989
24989
|
}, preview))));
|
|
24990
24990
|
});
|
|
24991
24991
|
const HintNodeContent = withStickiness(props => {
|
|
@@ -25001,13 +25001,13 @@ const HintNodeContent = withStickiness(props => {
|
|
|
25001
25001
|
className: "framework-perseus"
|
|
25002
25002
|
}, lens(renderers).get(path));
|
|
25003
25003
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
25004
|
-
className: aphrodite.css(styles$
|
|
25004
|
+
className: aphrodite.css(styles$v.row)
|
|
25005
25005
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
25006
|
-
className: aphrodite.css(styles$
|
|
25006
|
+
className: aphrodite.css(styles$v.columnLeft)
|
|
25007
25007
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
25008
|
-
className: aphrodite.css(sticky && styles$
|
|
25008
|
+
className: aphrodite.css(sticky && styles$v.sticky)
|
|
25009
25009
|
}, /*#__PURE__*/React__namespace.createElement(HintEditor, _extends({}, data, {
|
|
25010
|
-
className: aphrodite.css(styles$
|
|
25010
|
+
className: aphrodite.css(styles$v.hintEditor),
|
|
25011
25011
|
onChange: newVal => actions.mergeValueAtPath(path, newVal),
|
|
25012
25012
|
apiOptions: apiOptions,
|
|
25013
25013
|
showTitle: false,
|
|
@@ -25022,9 +25022,9 @@ const HintNodeContent = withStickiness(props => {
|
|
|
25022
25022
|
isFirst: true,
|
|
25023
25023
|
isLast: true
|
|
25024
25024
|
})))), /*#__PURE__*/React__namespace.createElement("div", {
|
|
25025
|
-
className: aphrodite.css(styles$
|
|
25025
|
+
className: aphrodite.css(styles$v.columnRight)
|
|
25026
25026
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
25027
|
-
className: aphrodite.css(sticky && styles$
|
|
25027
|
+
className: aphrodite.css(sticky && styles$v.sticky)
|
|
25028
25028
|
}, preview)));
|
|
25029
25029
|
});
|
|
25030
25030
|
const TagsNodeContent = props => {
|
|
@@ -25041,9 +25041,9 @@ const TagsNodeContent = props => {
|
|
|
25041
25041
|
return null;
|
|
25042
25042
|
}
|
|
25043
25043
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
25044
|
-
className: aphrodite.css(styles$
|
|
25044
|
+
className: aphrodite.css(styles$v.columnLeft)
|
|
25045
25045
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
25046
|
-
className: aphrodite.css(styles$
|
|
25046
|
+
className: aphrodite.css(styles$v.tagsEditor)
|
|
25047
25047
|
}, /*#__PURE__*/React__namespace.createElement(GroupMetadataEditor, {
|
|
25048
25048
|
value: data,
|
|
25049
25049
|
onChange: newVal => actions.setValueAtPath(path, newVal),
|
|
@@ -25074,23 +25074,23 @@ const ArrayNodeContent = props => {
|
|
|
25074
25074
|
const subpath = path.concat(i);
|
|
25075
25075
|
const controls = [i > 0 && /*#__PURE__*/React__namespace.createElement("div", {
|
|
25076
25076
|
key: "moveArrayElementUp",
|
|
25077
|
-
className: aphrodite.css(styles$
|
|
25077
|
+
className: aphrodite.css(styles$v.control)
|
|
25078
25078
|
}, /*#__PURE__*/React__namespace.createElement(SimpleButton, {
|
|
25079
25079
|
color: "orange",
|
|
25080
25080
|
title: "Move up",
|
|
25081
25081
|
onClick: () => actions.moveArrayElementUp(subpath)
|
|
25082
25082
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
25083
|
-
className: aphrodite.css(styles$
|
|
25083
|
+
className: aphrodite.css(styles$v.verticalFlip)
|
|
25084
25084
|
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$6, iconChevronDown)))), i < data.length - 1 && /*#__PURE__*/React__namespace.createElement("div", {
|
|
25085
25085
|
key: "moveArrayElementDown",
|
|
25086
|
-
className: aphrodite.css(styles$
|
|
25086
|
+
className: aphrodite.css(styles$v.control)
|
|
25087
25087
|
}, /*#__PURE__*/React__namespace.createElement(SimpleButton, {
|
|
25088
25088
|
color: "orange",
|
|
25089
25089
|
title: "Move down",
|
|
25090
25090
|
onClick: () => actions.moveArrayElementDown(subpath)
|
|
25091
25091
|
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$6, iconChevronDown))), /*#__PURE__*/React__namespace.createElement("div", {
|
|
25092
25092
|
key: "removeArrayElement",
|
|
25093
|
-
className: aphrodite.css(styles$
|
|
25093
|
+
className: aphrodite.css(styles$v.control)
|
|
25094
25094
|
}, /*#__PURE__*/React__namespace.createElement(SimpleButton, {
|
|
25095
25095
|
color: "orange",
|
|
25096
25096
|
title: "Delete",
|
|
@@ -25098,7 +25098,7 @@ const ArrayNodeContent = props => {
|
|
|
25098
25098
|
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$6, iconTrash$4)))];
|
|
25099
25099
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
25100
25100
|
key: i,
|
|
25101
|
-
className: aphrodite.css(styles$
|
|
25101
|
+
className: aphrodite.css(styles$v.arrayElement, !elementIsLeaf && styles$v.arrayElementAndNotLeaf)
|
|
25102
25102
|
}, /*#__PURE__*/React__namespace.createElement(NodeContainer, _extends({}, otherProps, {
|
|
25103
25103
|
key: i,
|
|
25104
25104
|
shape: shape.elementShape,
|
|
@@ -25124,7 +25124,7 @@ const ObjectNodeContent = props => {
|
|
|
25124
25124
|
// made sense to the shape's author is the order in which we'll iterate :)
|
|
25125
25125
|
const children = Object.keys(shape.shape).map(subkey => /*#__PURE__*/React__namespace.createElement("div", {
|
|
25126
25126
|
key: subkey,
|
|
25127
|
-
className: aphrodite.css(styles$
|
|
25127
|
+
className: aphrodite.css(styles$v.objectElement)
|
|
25128
25128
|
}, /*#__PURE__*/React__namespace.createElement(NodeContainer, _extends({}, otherProps, {
|
|
25129
25129
|
shape: shape.shape[subkey],
|
|
25130
25130
|
data: data[subkey],
|
|
@@ -25294,7 +25294,7 @@ class MultiRendererEditor extends React__namespace.Component {
|
|
|
25294
25294
|
}, this._renderContent());
|
|
25295
25295
|
}
|
|
25296
25296
|
}
|
|
25297
|
-
const styles$
|
|
25297
|
+
const styles$v = aphrodite.StyleSheet.create({
|
|
25298
25298
|
// This is used in a number of places throughout this file.
|
|
25299
25299
|
container: {},
|
|
25300
25300
|
// eslint-disable-next-line react-native/no-unused-styles
|
|
@@ -25446,47 +25446,47 @@ const StatefulArticleEditor = createReactClass__default["default"]({
|
|
|
25446
25446
|
screen
|
|
25447
25447
|
} = this.state;
|
|
25448
25448
|
return /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("div", {
|
|
25449
|
-
style: styles$
|
|
25449
|
+
style: styles$u.controlBar
|
|
25450
25450
|
}, /*#__PURE__*/React__namespace.createElement("span", {
|
|
25451
|
-
style: styles$
|
|
25451
|
+
style: styles$u.controls
|
|
25452
25452
|
}, "Mode:", " ", /*#__PURE__*/React__namespace.createElement("span", {
|
|
25453
25453
|
onClick: () => this.setState({
|
|
25454
25454
|
mode: "edit"
|
|
25455
25455
|
}),
|
|
25456
|
-
style: mode === "edit" ? styles$
|
|
25456
|
+
style: mode === "edit" ? styles$u.controlSelected : styles$u.control
|
|
25457
25457
|
}, "EDIT"), " | ", /*#__PURE__*/React__namespace.createElement("span", {
|
|
25458
25458
|
onClick: () => this.setState({
|
|
25459
25459
|
mode: "preview"
|
|
25460
25460
|
}),
|
|
25461
|
-
style: mode === "preview" ? styles$
|
|
25461
|
+
style: mode === "preview" ? styles$u.controlSelected : styles$u.control
|
|
25462
25462
|
}, "PREVIEW"), " | ", /*#__PURE__*/React__namespace.createElement("span", {
|
|
25463
25463
|
onClick: () => this.setState({
|
|
25464
25464
|
mode: "json"
|
|
25465
25465
|
}),
|
|
25466
|
-
style: mode === "json" ? styles$
|
|
25466
|
+
style: mode === "json" ? styles$u.controlSelected : styles$u.control
|
|
25467
25467
|
}, "JSON")), /*#__PURE__*/React__namespace.createElement("span", {
|
|
25468
|
-
style: styles$
|
|
25468
|
+
style: styles$u.controls
|
|
25469
25469
|
}, "Screen:", " ", /*#__PURE__*/React__namespace.createElement("span", {
|
|
25470
25470
|
onClick: () => this.setState({
|
|
25471
25471
|
screen: "phone"
|
|
25472
25472
|
}),
|
|
25473
|
-
style: screen === "phone" ? styles$
|
|
25473
|
+
style: screen === "phone" ? styles$u.controlSelected : styles$u.control
|
|
25474
25474
|
}, "PHONE"), " | ", /*#__PURE__*/React__namespace.createElement("span", {
|
|
25475
25475
|
onClick: () => this.setState({
|
|
25476
25476
|
screen: "tablet"
|
|
25477
25477
|
}),
|
|
25478
|
-
style: screen === "tablet" ? styles$
|
|
25478
|
+
style: screen === "tablet" ? styles$u.controlSelected : styles$u.control
|
|
25479
25479
|
}, "TABLET"), " | ", /*#__PURE__*/React__namespace.createElement("span", {
|
|
25480
25480
|
onClick: () => this.setState({
|
|
25481
25481
|
screen: "desktop"
|
|
25482
25482
|
}),
|
|
25483
|
-
style: screen === "desktop" ? styles$
|
|
25483
|
+
style: screen === "desktop" ? styles$u.controlSelected : styles$u.control
|
|
25484
25484
|
}, "DESKTOP"))), /*#__PURE__*/React__namespace.createElement("div", {
|
|
25485
|
-
style: styles$
|
|
25485
|
+
style: styles$u.editor
|
|
25486
25486
|
}, /*#__PURE__*/React__namespace.createElement(ArticleEditor, this.state)));
|
|
25487
25487
|
}
|
|
25488
25488
|
});
|
|
25489
|
-
const styles$
|
|
25489
|
+
const styles$u = {
|
|
25490
25490
|
controlBar: {
|
|
25491
25491
|
marginBottom: 25,
|
|
25492
25492
|
marginTop: 5
|
|
@@ -27025,10 +27025,10 @@ class GradedGroupEditor extends React__namespace.Component {
|
|
|
27025
27025
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
27026
27026
|
className: "perseus-widget-row"
|
|
27027
27027
|
}, /*#__PURE__*/React__namespace.createElement("label", {
|
|
27028
|
-
className: aphrodite.css(styles$
|
|
27028
|
+
className: aphrodite.css(styles$t.title)
|
|
27029
27029
|
}, "Title:", " ", /*#__PURE__*/React__namespace.createElement(TextInput$6, {
|
|
27030
27030
|
value: this.props.title,
|
|
27031
|
-
className: aphrodite.css(styles$
|
|
27031
|
+
className: aphrodite.css(styles$t.input)
|
|
27032
27032
|
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
27033
27033
|
,
|
|
27034
27034
|
onChange: this.change("title")
|
|
@@ -27053,7 +27053,7 @@ class GradedGroupEditor extends React__namespace.Component {
|
|
|
27053
27053
|
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$4, iconPlus$1), " Add a hint"), this.props.hint && /*#__PURE__*/React__namespace.createElement("div", {
|
|
27054
27054
|
className: "perseus-hint-editor"
|
|
27055
27055
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
27056
|
-
className: aphrodite.css(styles$
|
|
27056
|
+
className: aphrodite.css(styles$t.hintsTitle)
|
|
27057
27057
|
}, "Hint"), /*#__PURE__*/React__namespace.createElement(Editor, {
|
|
27058
27058
|
ref: this.hintEditor,
|
|
27059
27059
|
content: this.props.hint ? this.props.hint.content : "",
|
|
@@ -27085,7 +27085,7 @@ class GradedGroupEditor extends React__namespace.Component {
|
|
|
27085
27085
|
};
|
|
27086
27086
|
};
|
|
27087
27087
|
}
|
|
27088
|
-
const styles$
|
|
27088
|
+
const styles$t = aphrodite.StyleSheet.create({
|
|
27089
27089
|
title: {
|
|
27090
27090
|
fontSize: 18,
|
|
27091
27091
|
fontWeight: "bold"
|
|
@@ -28456,13 +28456,13 @@ function MathquillInput(props) {
|
|
|
28456
28456
|
}
|
|
28457
28457
|
});
|
|
28458
28458
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
28459
|
-
style: styles$
|
|
28459
|
+
style: styles$s.outerWrapper
|
|
28460
28460
|
}, /*#__PURE__*/React__namespace.createElement("span", {
|
|
28461
28461
|
ref: mathFieldWrapperRef,
|
|
28462
28462
|
className: "perseus-math-input mq-editable-field mq-math-mode"
|
|
28463
28463
|
}));
|
|
28464
28464
|
}
|
|
28465
|
-
const styles$
|
|
28465
|
+
const styles$s = aphrodite.StyleSheet.create({
|
|
28466
28466
|
outerWrapper: {
|
|
28467
28467
|
display: "inline-block",
|
|
28468
28468
|
borderStyle: "solid",
|
|
@@ -29548,7 +29548,7 @@ const GraphPointsCountSelector = _ref => {
|
|
|
29548
29548
|
// Never uses placeholder, always has value
|
|
29549
29549
|
,
|
|
29550
29550
|
placeholder: "",
|
|
29551
|
-
style: styles$
|
|
29551
|
+
style: styles$r.singleSelectShort
|
|
29552
29552
|
}, [...[...Array(7).keys()].map(n => /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
29553
29553
|
key: n,
|
|
29554
29554
|
value: `${n}`,
|
|
@@ -29559,7 +29559,7 @@ const GraphPointsCountSelector = _ref => {
|
|
|
29559
29559
|
label: "unlimited"
|
|
29560
29560
|
})]);
|
|
29561
29561
|
};
|
|
29562
|
-
const styles$
|
|
29562
|
+
const styles$r = aphrodite.StyleSheet.create({
|
|
29563
29563
|
singleSelectShort: {
|
|
29564
29564
|
// Non-standard spacing, but it's the smallest we can go
|
|
29565
29565
|
// without running into styling issues with the dropdown.
|
|
@@ -29572,7 +29572,7 @@ const GraphTypeSelector = props => {
|
|
|
29572
29572
|
selectedValue: props.graphType,
|
|
29573
29573
|
onChange: props.onChange,
|
|
29574
29574
|
placeholder: "Select a graph type",
|
|
29575
|
-
style: styles$
|
|
29575
|
+
style: styles$q.singleSelectShort
|
|
29576
29576
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
29577
29577
|
value: "linear",
|
|
29578
29578
|
label: "Linear function"
|
|
@@ -29605,7 +29605,7 @@ const GraphTypeSelector = props => {
|
|
|
29605
29605
|
label: "Angle"
|
|
29606
29606
|
}));
|
|
29607
29607
|
};
|
|
29608
|
-
const styles$
|
|
29608
|
+
const styles$q = aphrodite.StyleSheet.create({
|
|
29609
29609
|
singleSelectShort: {
|
|
29610
29610
|
// Non-standard spacing, but it's the smallest we can go
|
|
29611
29611
|
// without running into styling issues with the dropdown.
|
|
@@ -29622,16 +29622,16 @@ const LabeledRow = props => {
|
|
|
29622
29622
|
style
|
|
29623
29623
|
} = props;
|
|
29624
29624
|
return /*#__PURE__*/React__namespace.createElement("label", {
|
|
29625
|
-
className: aphrodite.css(styles$
|
|
29625
|
+
className: aphrodite.css(styles$p.label)
|
|
29626
29626
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
29627
|
-
style: [styles$
|
|
29627
|
+
style: [styles$p.row, style]
|
|
29628
29628
|
}, labelSide === "start" || /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelSmall, {
|
|
29629
|
-
style: styles$
|
|
29629
|
+
style: styles$p.spaceEnd
|
|
29630
29630
|
}, label), children, labelSide === "end" && /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelSmall, {
|
|
29631
|
-
style: styles$
|
|
29631
|
+
style: styles$p.spaceStart
|
|
29632
29632
|
}, label)));
|
|
29633
29633
|
};
|
|
29634
|
-
const styles$
|
|
29634
|
+
const styles$p = aphrodite.StyleSheet.create({
|
|
29635
29635
|
label: {
|
|
29636
29636
|
width: "fit-content"
|
|
29637
29637
|
},
|
|
@@ -30053,10 +30053,10 @@ class InteractiveGraphSettings extends React__namespace.Component {
|
|
|
30053
30053
|
onChange: this.change
|
|
30054
30054
|
}))), /*#__PURE__*/React__namespace.createElement(LabeledRow, {
|
|
30055
30055
|
label: "Background image URL:",
|
|
30056
|
-
style: styles$
|
|
30056
|
+
style: styles$o.resetSpaceTop
|
|
30057
30057
|
}, /*#__PURE__*/React__namespace.createElement("input", {
|
|
30058
30058
|
type: "text",
|
|
30059
|
-
className: aphrodite.css(styles$
|
|
30059
|
+
className: aphrodite.css(styles$o.backgroundUrlInput),
|
|
30060
30060
|
ref: this.bgUrlRef,
|
|
30061
30061
|
value: this.state.backgroundImage.url || "",
|
|
30062
30062
|
onChange: e => {
|
|
@@ -30072,28 +30072,28 @@ class InteractiveGraphSettings extends React__namespace.Component {
|
|
|
30072
30072
|
onKeyPress: this.changeBackgroundUrl,
|
|
30073
30073
|
onBlur: this.changeBackgroundUrl
|
|
30074
30074
|
}), /*#__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, {
|
|
30075
|
-
style: styles$
|
|
30075
|
+
style: styles$o.rulerSection
|
|
30076
30076
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30077
|
-
style: styles$
|
|
30077
|
+
style: styles$o.checkboxRow
|
|
30078
30078
|
}, /*#__PURE__*/React__namespace.createElement(PropCheckBox$7, {
|
|
30079
30079
|
label: "Show ruler",
|
|
30080
30080
|
showRuler: this.props.showRuler,
|
|
30081
30081
|
onChange: this.change,
|
|
30082
|
-
style: styles$
|
|
30082
|
+
style: styles$o.resetSpaceTop
|
|
30083
30083
|
}), /*#__PURE__*/React__namespace.createElement(PropCheckBox$7, {
|
|
30084
30084
|
label: "Show protractor",
|
|
30085
30085
|
showProtractor: this.props.showProtractor,
|
|
30086
30086
|
onChange: this.change,
|
|
30087
|
-
style: styles$
|
|
30087
|
+
style: styles$o.resetSpaceTop
|
|
30088
30088
|
})), (this.props.showRuler || this.props.showProtractor) && /*#__PURE__*/React__namespace.createElement(Banner__default["default"], {
|
|
30089
30089
|
layout: "floating",
|
|
30090
30090
|
text: "The ruler and protractor are not accessible. Please consider an alternate approach.",
|
|
30091
30091
|
kind: "warning"
|
|
30092
30092
|
}), this.props.showRuler && /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30093
|
-
style: styles$
|
|
30093
|
+
style: styles$o.spaceTop
|
|
30094
30094
|
}, /*#__PURE__*/React__namespace.createElement(LabeledRow, {
|
|
30095
30095
|
label: "Ruler label:",
|
|
30096
|
-
style: styles$
|
|
30096
|
+
style: styles$o.resetSpaceTop
|
|
30097
30097
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
|
|
30098
30098
|
id: "ruler-label-select",
|
|
30099
30099
|
selectedValue: this.props.rulerLabel,
|
|
@@ -30103,7 +30103,7 @@ class InteractiveGraphSettings extends React__namespace.Component {
|
|
|
30103
30103
|
});
|
|
30104
30104
|
},
|
|
30105
30105
|
placeholder: "None",
|
|
30106
|
-
style: styles$
|
|
30106
|
+
style: styles$o.singleSelectShort
|
|
30107
30107
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
30108
30108
|
value: "",
|
|
30109
30109
|
label: "None",
|
|
@@ -30144,7 +30144,7 @@ class InteractiveGraphSettings extends React__namespace.Component {
|
|
|
30144
30144
|
});
|
|
30145
30145
|
},
|
|
30146
30146
|
placeholder: "10",
|
|
30147
|
-
style: styles$
|
|
30147
|
+
style: styles$o.singleSelectShort
|
|
30148
30148
|
}, [1, 2, 4, 8, 10, 16].map(value => /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
30149
30149
|
key: value,
|
|
30150
30150
|
value: `${value}`,
|
|
@@ -30152,7 +30152,7 @@ class InteractiveGraphSettings extends React__namespace.Component {
|
|
|
30152
30152
|
})))))));
|
|
30153
30153
|
}
|
|
30154
30154
|
}
|
|
30155
|
-
const styles$
|
|
30155
|
+
const styles$o = aphrodite.StyleSheet.create({
|
|
30156
30156
|
resetSpaceTop: {
|
|
30157
30157
|
marginTop: 0
|
|
30158
30158
|
},
|
|
@@ -30184,43 +30184,6 @@ const styles$l = aphrodite.StyleSheet.create({
|
|
|
30184
30184
|
}
|
|
30185
30185
|
});
|
|
30186
30186
|
|
|
30187
|
-
/**
|
|
30188
|
-
* Dropdown for selecting a locked figure to add to an interactive graph.
|
|
30189
|
-
* Locked figures are elements (points, segmeents, etc.) that are not
|
|
30190
|
-
* interactive, just present in the graph's background.
|
|
30191
|
-
*
|
|
30192
|
-
* Used in the interactive graph editor's locked figures section.
|
|
30193
|
-
*/
|
|
30194
|
-
const LockedFigureSelect = props => {
|
|
30195
|
-
const {
|
|
30196
|
-
id,
|
|
30197
|
-
onChange
|
|
30198
|
-
} = props;
|
|
30199
|
-
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30200
|
-
style: styles$k.container
|
|
30201
|
-
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.ActionMenu, {
|
|
30202
|
-
menuText: "Add locked figure",
|
|
30203
|
-
style: styles$k.addElementSelect
|
|
30204
|
-
}, [/*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.ActionItem, {
|
|
30205
|
-
key: `${id}-point`,
|
|
30206
|
-
label: "Point",
|
|
30207
|
-
onClick: () => onChange("point")
|
|
30208
|
-
}, "Point"), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.ActionItem, {
|
|
30209
|
-
key: `${id}-line`,
|
|
30210
|
-
label: "Line",
|
|
30211
|
-
onClick: () => onChange("line")
|
|
30212
|
-
}, "Line")]));
|
|
30213
|
-
};
|
|
30214
|
-
const styles$k = aphrodite.StyleSheet.create({
|
|
30215
|
-
container: {
|
|
30216
|
-
marginTop: wonderBlocksTokens.spacing.xSmall_8
|
|
30217
|
-
},
|
|
30218
|
-
addElementSelect: {
|
|
30219
|
-
backgroundColor: wonderBlocksTokens.color.fadedBlue8,
|
|
30220
|
-
borderRadius: wonderBlocksTokens.spacing.xxxSmall_4
|
|
30221
|
-
}
|
|
30222
|
-
});
|
|
30223
|
-
|
|
30224
30187
|
const mediaDefaultSpecLargeMarginWidth = wonderBlocksTokens.spacing.large_24;
|
|
30225
30188
|
const MEDIA_DEFAULT_SPEC = {
|
|
30226
30189
|
small: {
|
|
@@ -30301,6 +30264,43 @@ const strutStyle = size => {
|
|
|
30301
30264
|
};
|
|
30302
30265
|
};
|
|
30303
30266
|
|
|
30267
|
+
/**
|
|
30268
|
+
* Dropdown for selecting a locked figure to add to an interactive graph.
|
|
30269
|
+
* Locked figures are elements (points, segmeents, etc.) that are not
|
|
30270
|
+
* interactive, just present in the graph's background.
|
|
30271
|
+
*
|
|
30272
|
+
* Used in the interactive graph editor's locked figures section.
|
|
30273
|
+
*/
|
|
30274
|
+
const LockedFigureSelect = props => {
|
|
30275
|
+
const {
|
|
30276
|
+
id,
|
|
30277
|
+
onChange
|
|
30278
|
+
} = props;
|
|
30279
|
+
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30280
|
+
style: styles$n.container
|
|
30281
|
+
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.ActionMenu, {
|
|
30282
|
+
menuText: "Add locked figure",
|
|
30283
|
+
style: styles$n.addElementSelect
|
|
30284
|
+
}, [/*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.ActionItem, {
|
|
30285
|
+
key: `${id}-point`,
|
|
30286
|
+
label: "Point",
|
|
30287
|
+
onClick: () => onChange("point")
|
|
30288
|
+
}, "Point"), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.ActionItem, {
|
|
30289
|
+
key: `${id}-line`,
|
|
30290
|
+
label: "Line",
|
|
30291
|
+
onClick: () => onChange("line")
|
|
30292
|
+
}, "Line")]));
|
|
30293
|
+
};
|
|
30294
|
+
const styles$n = aphrodite.StyleSheet.create({
|
|
30295
|
+
container: {
|
|
30296
|
+
marginTop: wonderBlocksTokens.spacing.xSmall_8
|
|
30297
|
+
},
|
|
30298
|
+
addElementSelect: {
|
|
30299
|
+
backgroundColor: wonderBlocksTokens.color.fadedBlue8,
|
|
30300
|
+
borderRadius: wonderBlocksTokens.spacing.xxxSmall_4
|
|
30301
|
+
}
|
|
30302
|
+
});
|
|
30303
|
+
|
|
30304
30304
|
const ColorSwatch = props => {
|
|
30305
30305
|
const {
|
|
30306
30306
|
color,
|
|
@@ -30310,14 +30310,14 @@ const ColorSwatch = props => {
|
|
|
30310
30310
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30311
30311
|
"aria-label":
|
|
30312
30312
|
// Don't include an aria label for decorative circles.
|
|
30313
|
-
!decorative ?
|
|
30314
|
-
style: [styles$
|
|
30313
|
+
!decorative ? `${color}, ${filled ? "filled" : "open"}` : undefined,
|
|
30314
|
+
style: [styles$m.colorSwatch, {
|
|
30315
30315
|
border: `4px solid ${perseus.lockedFigureColors[color]}`,
|
|
30316
30316
|
backgroundColor: filled ? perseus.lockedFigureColors[color] : wonderBlocksTokens.color.white
|
|
30317
30317
|
}]
|
|
30318
30318
|
});
|
|
30319
30319
|
};
|
|
30320
|
-
const styles$
|
|
30320
|
+
const styles$m = aphrodite.StyleSheet.create({
|
|
30321
30321
|
colorSwatch: {
|
|
30322
30322
|
// Add a white outline so that the color swatch is visible when
|
|
30323
30323
|
// the dropdown option is highlighted with its blue background.
|
|
@@ -30331,16 +30331,17 @@ const styles$j = aphrodite.StyleSheet.create({
|
|
|
30331
30331
|
const possibleColors = Object.keys(perseus.lockedFigureColors);
|
|
30332
30332
|
const ColorSelect = props => {
|
|
30333
30333
|
const {
|
|
30334
|
-
id,
|
|
30335
30334
|
selectedValue,
|
|
30336
30335
|
style,
|
|
30337
30336
|
onChange
|
|
30338
30337
|
} = props;
|
|
30338
|
+
const ids = wonderBlocksCore.useUniqueIdWithMock();
|
|
30339
|
+
const id = ids.get("color-select");
|
|
30339
30340
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30340
|
-
style: [styles$
|
|
30341
|
+
style: [styles$l.row, style]
|
|
30341
30342
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
30342
30343
|
htmlFor: id,
|
|
30343
|
-
style: styles$
|
|
30344
|
+
style: styles$l.label,
|
|
30344
30345
|
tag: "label"
|
|
30345
30346
|
}, "color"), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
|
|
30346
30347
|
id: id,
|
|
@@ -30359,7 +30360,7 @@ const ColorSelect = props => {
|
|
|
30359
30360
|
})
|
|
30360
30361
|
}, colorName))));
|
|
30361
30362
|
};
|
|
30362
|
-
const styles$
|
|
30363
|
+
const styles$l = aphrodite.StyleSheet.create({
|
|
30363
30364
|
row: {
|
|
30364
30365
|
flexDirection: "row",
|
|
30365
30366
|
alignItems: "center"
|
|
@@ -30369,31 +30370,110 @@ const styles$i = aphrodite.StyleSheet.create({
|
|
|
30369
30370
|
}
|
|
30370
30371
|
});
|
|
30371
30372
|
|
|
30372
|
-
const
|
|
30373
|
+
const CoordinatePairInput = props => {
|
|
30373
30374
|
const {
|
|
30374
|
-
|
|
30375
|
-
|
|
30375
|
+
coord,
|
|
30376
|
+
onChangeProps
|
|
30376
30377
|
} = props;
|
|
30378
|
+
|
|
30379
|
+
// Keep track of the coordinates via state as the user is editing them,
|
|
30380
|
+
// before they are updated in the props as a valid number.
|
|
30381
|
+
const [coordState, setCoordState] = React__namespace.useState([
|
|
30382
|
+
// Using strings to make it easier to work with the text fields.
|
|
30383
|
+
coord[0].toString(), coord[1].toString()]);
|
|
30384
|
+
|
|
30385
|
+
// Generate unique IDs so that the programmatic labels can be associated
|
|
30386
|
+
// with their respective text fields.
|
|
30387
|
+
const ids = wonderBlocksCore.useUniqueIdWithMock();
|
|
30388
|
+
const xCoordId = ids.get("x-coord");
|
|
30389
|
+
const yCoordId = ids.get("y-coord");
|
|
30390
|
+
function handleCoordChange(newValue, coordIndex) {
|
|
30391
|
+
// Update the local state (update the input field value).
|
|
30392
|
+
const newCoordState = [...coordState];
|
|
30393
|
+
newCoordState[coordIndex] = newValue;
|
|
30394
|
+
setCoordState(newCoordState);
|
|
30395
|
+
|
|
30396
|
+
// If the new value is not a number, don't update the props.
|
|
30397
|
+
// If it's empty, keep the props the same value instead of setting to 0.
|
|
30398
|
+
if (isNaN(+newValue) || newValue === "") {
|
|
30399
|
+
return;
|
|
30400
|
+
}
|
|
30401
|
+
|
|
30402
|
+
// Update the props (update the graph).
|
|
30403
|
+
const newCoords = [...coord];
|
|
30404
|
+
newCoords[coordIndex] = +newValue;
|
|
30405
|
+
onChangeProps({
|
|
30406
|
+
coord: newCoords
|
|
30407
|
+
});
|
|
30408
|
+
}
|
|
30377
30409
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30378
|
-
style: styles$
|
|
30379
|
-
}, /*#__PURE__*/React__namespace.createElement(
|
|
30380
|
-
|
|
30381
|
-
style:
|
|
30382
|
-
|
|
30383
|
-
|
|
30410
|
+
style: [styles$k.row, styles$k.spaceUnder]
|
|
30411
|
+
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
30412
|
+
htmlFor: xCoordId,
|
|
30413
|
+
style: styles$k.label,
|
|
30414
|
+
tag: "label"
|
|
30415
|
+
}, "x coord"), /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.TextField, {
|
|
30416
|
+
id: xCoordId,
|
|
30417
|
+
type: "number",
|
|
30418
|
+
value: coordState[0],
|
|
30419
|
+
onChange: newValue => handleCoordChange(newValue, 0),
|
|
30420
|
+
style: styles$k.textField
|
|
30421
|
+
}), /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30422
|
+
size: wonderBlocksTokens.spacing.medium_16
|
|
30423
|
+
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
30424
|
+
htmlFor: yCoordId,
|
|
30425
|
+
style: styles$k.label,
|
|
30426
|
+
tag: "label"
|
|
30427
|
+
}, "y coord"), /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.TextField, {
|
|
30428
|
+
id: yCoordId,
|
|
30429
|
+
type: "number",
|
|
30430
|
+
value: coordState[1],
|
|
30431
|
+
onChange: newValue => handleCoordChange(newValue, 1),
|
|
30432
|
+
style: styles$k.textField
|
|
30384
30433
|
}));
|
|
30385
30434
|
};
|
|
30386
|
-
const styles$
|
|
30387
|
-
|
|
30388
|
-
|
|
30389
|
-
|
|
30390
|
-
padding: wonderBlocksTokens.spacing.xSmall_8,
|
|
30391
|
-
borderRadius: wonderBlocksTokens.spacing.xxxSmall_4
|
|
30435
|
+
const styles$k = aphrodite.StyleSheet.create({
|
|
30436
|
+
row: {
|
|
30437
|
+
flexDirection: "row",
|
|
30438
|
+
alignItems: "center"
|
|
30392
30439
|
},
|
|
30393
|
-
|
|
30394
|
-
|
|
30395
|
-
|
|
30396
|
-
|
|
30440
|
+
spaceUnder: {
|
|
30441
|
+
marginBottom: wonderBlocksTokens.spacing.xSmall_8
|
|
30442
|
+
},
|
|
30443
|
+
label: {
|
|
30444
|
+
marginInlineEnd: wonderBlocksTokens.spacing.xxSmall_6
|
|
30445
|
+
},
|
|
30446
|
+
textField: {
|
|
30447
|
+
width: wonderBlocksTokens.spacing.xxxLarge_64
|
|
30448
|
+
}
|
|
30449
|
+
});
|
|
30450
|
+
|
|
30451
|
+
const LabeledSwitch = props => {
|
|
30452
|
+
const {
|
|
30453
|
+
checked,
|
|
30454
|
+
label,
|
|
30455
|
+
style,
|
|
30456
|
+
onChange
|
|
30457
|
+
} = props;
|
|
30458
|
+
const ids = wonderBlocksCore.useUniqueIdWithMock();
|
|
30459
|
+
const switchId = ids.get("switch");
|
|
30460
|
+
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30461
|
+
style: [styles$j.row, style]
|
|
30462
|
+
}, /*#__PURE__*/React__namespace.createElement(Switch__default["default"], {
|
|
30463
|
+
id: switchId,
|
|
30464
|
+
checked: checked,
|
|
30465
|
+
onChange: onChange
|
|
30466
|
+
}), /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30467
|
+
size: wonderBlocksTokens.spacing.xSmall_8
|
|
30468
|
+
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
30469
|
+
tag: "label",
|
|
30470
|
+
htmlFor: switchId
|
|
30471
|
+
}, label));
|
|
30472
|
+
};
|
|
30473
|
+
const styles$j = aphrodite.StyleSheet.create({
|
|
30474
|
+
row: {
|
|
30475
|
+
flexDirection: "row",
|
|
30476
|
+
alignItems: "center"
|
|
30397
30477
|
}
|
|
30398
30478
|
});
|
|
30399
30479
|
|
|
@@ -30401,8 +30481,10 @@ const LockedFigureSettingsAccordion = props => {
|
|
|
30401
30481
|
const {
|
|
30402
30482
|
children,
|
|
30403
30483
|
header,
|
|
30484
|
+
expanded,
|
|
30404
30485
|
containerStyle,
|
|
30405
|
-
panelStyle
|
|
30486
|
+
panelStyle,
|
|
30487
|
+
onToggle
|
|
30406
30488
|
} = props;
|
|
30407
30489
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View
|
|
30408
30490
|
// More specificity so that we can override the default
|
|
@@ -30411,14 +30493,16 @@ const LockedFigureSettingsAccordion = props => {
|
|
|
30411
30493
|
, {
|
|
30412
30494
|
className: "locked-figure-accordion"
|
|
30413
30495
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksAccordion.AccordionSection, {
|
|
30414
|
-
|
|
30415
|
-
|
|
30496
|
+
expanded: expanded,
|
|
30497
|
+
onToggle: onToggle,
|
|
30498
|
+
style: [styles$i.container, containerStyle],
|
|
30499
|
+
headerStyle: styles$i.accordionHeader,
|
|
30416
30500
|
header: header
|
|
30417
30501
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30418
|
-
style: [styles$
|
|
30502
|
+
style: [styles$i.accordionPanel, panelStyle]
|
|
30419
30503
|
}, children)));
|
|
30420
30504
|
};
|
|
30421
|
-
const styles$
|
|
30505
|
+
const styles$i = aphrodite.StyleSheet.create({
|
|
30422
30506
|
container: {
|
|
30423
30507
|
backgroundColor: wonderBlocksTokens.color.fadedBlue8,
|
|
30424
30508
|
marginTop: wonderBlocksTokens.spacing.xSmall_8
|
|
@@ -30440,170 +30524,54 @@ const styles$g = aphrodite.StyleSheet.create({
|
|
|
30440
30524
|
});
|
|
30441
30525
|
|
|
30442
30526
|
/**
|
|
30443
|
-
*
|
|
30444
|
-
*
|
|
30445
|
-
* the delete button.
|
|
30446
|
-
*/
|
|
30447
|
-
const LockedFigureSettingsActions = props => {
|
|
30448
|
-
const {
|
|
30449
|
-
onRemove,
|
|
30450
|
-
figureAriaLabel
|
|
30451
|
-
} = props;
|
|
30452
|
-
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30453
|
-
style: styles$f.container
|
|
30454
|
-
}, /*#__PURE__*/React__namespace.createElement(Button__default["default"], {
|
|
30455
|
-
startIcon: trashIcon__default["default"],
|
|
30456
|
-
"aria-label": `Delete ${figureAriaLabel}`,
|
|
30457
|
-
onClick: onRemove,
|
|
30458
|
-
kind: "tertiary",
|
|
30459
|
-
style: styles$f.deleteButton
|
|
30460
|
-
}, "Delete"));
|
|
30461
|
-
};
|
|
30462
|
-
const styles$f = aphrodite.StyleSheet.create({
|
|
30463
|
-
container: {
|
|
30464
|
-
width: "100%",
|
|
30465
|
-
flexDirection: "row",
|
|
30466
|
-
alignItems: "center",
|
|
30467
|
-
marginTop: wonderBlocksTokens.spacing.xxxSmall_4
|
|
30468
|
-
},
|
|
30469
|
-
deleteButton: {
|
|
30470
|
-
// Line up the delete icon with the rest of the content.
|
|
30471
|
-
marginInlineStart: -wonderBlocksTokens.spacing.xxxSmall_4
|
|
30472
|
-
}
|
|
30473
|
-
});
|
|
30474
|
-
|
|
30475
|
-
const LabeledSwitch = props => {
|
|
30476
|
-
const {
|
|
30477
|
-
checked,
|
|
30478
|
-
label,
|
|
30479
|
-
style,
|
|
30480
|
-
onChange
|
|
30481
|
-
} = props;
|
|
30482
|
-
const ids = wonderBlocksCore.useUniqueIdWithMock();
|
|
30483
|
-
const switchId = ids.get("switch");
|
|
30484
|
-
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30485
|
-
style: [styles$e.row, style]
|
|
30486
|
-
}, /*#__PURE__*/React__namespace.createElement(Switch__default["default"], {
|
|
30487
|
-
id: switchId,
|
|
30488
|
-
checked: checked,
|
|
30489
|
-
onChange: onChange
|
|
30490
|
-
}), /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30491
|
-
size: wonderBlocksTokens.spacing.xSmall_8
|
|
30492
|
-
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
30493
|
-
tag: "label",
|
|
30494
|
-
htmlFor: switchId
|
|
30495
|
-
}, label));
|
|
30496
|
-
};
|
|
30497
|
-
const styles$e = aphrodite.StyleSheet.create({
|
|
30498
|
-
row: {
|
|
30499
|
-
flexDirection: "row",
|
|
30500
|
-
alignItems: "center"
|
|
30501
|
-
}
|
|
30502
|
-
});
|
|
30503
|
-
|
|
30504
|
-
/**
|
|
30505
|
-
* LockedPointSettings is a component that allows the user to edit the
|
|
30506
|
-
* settings of specifically a locked point on the graph.
|
|
30527
|
+
* DefiningPointSettings is a component that allows the user to edit the
|
|
30528
|
+
* settings of a point that defines a locked figure (ex. line) on the graph.
|
|
30507
30529
|
*
|
|
30508
30530
|
* Used in the interactive graph editor's locked figures section.
|
|
30509
30531
|
*/
|
|
30510
|
-
const
|
|
30532
|
+
const DefiningPointSettings = props => {
|
|
30511
30533
|
const {
|
|
30512
30534
|
coord,
|
|
30513
30535
|
color: pointColor,
|
|
30514
30536
|
filled = true,
|
|
30515
30537
|
label,
|
|
30516
|
-
|
|
30517
|
-
style,
|
|
30538
|
+
showPoint = "false",
|
|
30518
30539
|
onChangeProps,
|
|
30519
|
-
|
|
30520
|
-
onRemove
|
|
30540
|
+
onTogglePoint
|
|
30521
30541
|
} = props;
|
|
30522
|
-
|
|
30523
|
-
// Keep track of the coordinates via state as the user is editing them,
|
|
30524
|
-
// before they are updated in the props as a valid number.
|
|
30525
|
-
const [coordState, setCoordState] = React__namespace.useState([
|
|
30526
|
-
// Using strings to make it easier to work with the text fields.
|
|
30527
|
-
coord[0].toString(), coord[1].toString()]);
|
|
30528
|
-
|
|
30529
|
-
// Generate unique IDs so that the programmatic labels can be associated
|
|
30530
|
-
// with their respective text fields.
|
|
30531
|
-
const ids = wonderBlocksCore.useUniqueIdWithMock();
|
|
30532
|
-
const xCoordId = ids.get("x-coord");
|
|
30533
|
-
const yCoordId = ids.get("y-coord");
|
|
30534
|
-
const colorSelectId = ids.get("point-color-select");
|
|
30535
|
-
function handleCoordChange(newValue, coordIndex) {
|
|
30536
|
-
// Update the local state (update the input field value).
|
|
30537
|
-
const newCoordState = [...coordState];
|
|
30538
|
-
newCoordState[coordIndex] = newValue;
|
|
30539
|
-
setCoordState(newCoordState);
|
|
30540
|
-
|
|
30541
|
-
// If the new value is not a number, don't update the props.
|
|
30542
|
-
// If it's empty, keep the props the same value instead of setting to 0.
|
|
30543
|
-
if (isNaN(+newValue) || newValue === "") {
|
|
30544
|
-
return;
|
|
30545
|
-
}
|
|
30546
|
-
|
|
30547
|
-
// Update the props (update the graph).
|
|
30548
|
-
const newCoords = [...coord];
|
|
30549
|
-
newCoords[coordIndex] = +newValue;
|
|
30550
|
-
onChangeProps({
|
|
30551
|
-
coord: newCoords
|
|
30552
|
-
});
|
|
30553
|
-
}
|
|
30554
30542
|
function handleColorChange(newValue) {
|
|
30555
30543
|
onChangeProps({
|
|
30556
30544
|
color: newValue
|
|
30557
30545
|
});
|
|
30558
30546
|
}
|
|
30559
30547
|
return /*#__PURE__*/React__namespace.createElement(LockedFigureSettingsAccordion, {
|
|
30560
|
-
|
|
30561
|
-
|
|
30548
|
+
expanded: props.expanded,
|
|
30549
|
+
onToggle: props.onToggle,
|
|
30550
|
+
containerStyle: styles$h.container,
|
|
30551
|
+
panelStyle: styles$h.accordionPanel,
|
|
30562
30552
|
header:
|
|
30563
30553
|
/*#__PURE__*/
|
|
30564
30554
|
// Summary: Point, coords, color (filled/open)
|
|
30565
30555
|
React__namespace.createElement(wonderBlocksCore.View, {
|
|
30566
|
-
style: styles$
|
|
30556
|
+
style: styles$h.row
|
|
30567
30557
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, `${label || "Point"} (${coord[0]}, ${coord[1]})`), /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30568
30558
|
size: wonderBlocksTokens.spacing.xSmall_8
|
|
30569
|
-
}),
|
|
30559
|
+
}), showPoint && /*#__PURE__*/React__namespace.createElement(ColorSwatch, {
|
|
30570
30560
|
color: pointColor,
|
|
30571
30561
|
filled: filled
|
|
30572
30562
|
}))
|
|
30573
|
-
}, /*#__PURE__*/React__namespace.createElement(
|
|
30574
|
-
|
|
30575
|
-
|
|
30576
|
-
|
|
30577
|
-
style: styles$d.label,
|
|
30578
|
-
tag: "label"
|
|
30579
|
-
}, "x coord"), /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.TextField, {
|
|
30580
|
-
id: xCoordId,
|
|
30581
|
-
type: "number",
|
|
30582
|
-
value: coordState[0],
|
|
30583
|
-
onChange: newValue => handleCoordChange(newValue, 0),
|
|
30584
|
-
style: styles$d.textField
|
|
30585
|
-
}), /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30586
|
-
size: wonderBlocksTokens.spacing.medium_16
|
|
30587
|
-
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
30588
|
-
htmlFor: yCoordId,
|
|
30589
|
-
style: styles$d.label,
|
|
30590
|
-
tag: "label"
|
|
30591
|
-
}, "y coord"), /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.TextField, {
|
|
30592
|
-
id: yCoordId,
|
|
30593
|
-
type: "number",
|
|
30594
|
-
value: coordState[1],
|
|
30595
|
-
onChange: newValue => handleCoordChange(newValue, 1),
|
|
30596
|
-
style: styles$d.textField
|
|
30597
|
-
})), onToggle && /*#__PURE__*/React__namespace.createElement(LabeledSwitch, {
|
|
30563
|
+
}, /*#__PURE__*/React__namespace.createElement(CoordinatePairInput, {
|
|
30564
|
+
coord: coord,
|
|
30565
|
+
onChangeProps: onChangeProps
|
|
30566
|
+
}), onTogglePoint && /*#__PURE__*/React__namespace.createElement(LabeledSwitch, {
|
|
30598
30567
|
label: "show point on graph",
|
|
30599
|
-
checked: !!
|
|
30600
|
-
style:
|
|
30601
|
-
onChange:
|
|
30602
|
-
}),
|
|
30603
|
-
id: colorSelectId,
|
|
30568
|
+
checked: !!showPoint,
|
|
30569
|
+
style: showPoint && styles$h.spaceUnder,
|
|
30570
|
+
onChange: onTogglePoint
|
|
30571
|
+
}), showPoint && /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(ColorSelect, {
|
|
30604
30572
|
selectedValue: pointColor,
|
|
30605
30573
|
onChange: handleColorChange,
|
|
30606
|
-
style: styles$
|
|
30574
|
+
style: styles$h.spaceUnder
|
|
30607
30575
|
}), /*#__PURE__*/React__namespace.createElement(LabeledSwitch, {
|
|
30608
30576
|
label: "open point",
|
|
30609
30577
|
checked: !filled,
|
|
@@ -30612,13 +30580,17 @@ const LockedPointSettings = props => {
|
|
|
30612
30580
|
filled: !newValue
|
|
30613
30581
|
});
|
|
30614
30582
|
}
|
|
30615
|
-
}))
|
|
30616
|
-
onRemove: onRemove,
|
|
30617
|
-
figureAriaLabel: `locked point at ${coord[0]}, ${coord[1]}`
|
|
30618
|
-
}));
|
|
30583
|
+
})));
|
|
30619
30584
|
};
|
|
30620
|
-
const styles$
|
|
30621
|
-
|
|
30585
|
+
const styles$h = aphrodite.StyleSheet.create({
|
|
30586
|
+
container: {
|
|
30587
|
+
marginTop: wonderBlocksTokens.spacing.xSmall_8,
|
|
30588
|
+
marginBottom: 0,
|
|
30589
|
+
marginLeft: -wonderBlocksTokens.spacing.xxxSmall_4,
|
|
30590
|
+
marginRight: -wonderBlocksTokens.spacing.xxxSmall_4,
|
|
30591
|
+
backgroundColor: wonderBlocksTokens.color.white
|
|
30592
|
+
},
|
|
30593
|
+
accordionPanel: {
|
|
30622
30594
|
// Need more space since we don't have the actions' margins.
|
|
30623
30595
|
paddingBottom: wonderBlocksTokens.spacing.medium_16
|
|
30624
30596
|
},
|
|
@@ -30628,12 +30600,65 @@ const styles$d = aphrodite.StyleSheet.create({
|
|
|
30628
30600
|
},
|
|
30629
30601
|
spaceUnder: {
|
|
30630
30602
|
marginBottom: wonderBlocksTokens.spacing.xSmall_8
|
|
30603
|
+
}
|
|
30604
|
+
});
|
|
30605
|
+
|
|
30606
|
+
const LineSwatch = props => {
|
|
30607
|
+
const {
|
|
30608
|
+
color,
|
|
30609
|
+
lineStyle
|
|
30610
|
+
} = props;
|
|
30611
|
+
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30612
|
+
style: styles$g.container
|
|
30613
|
+
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30614
|
+
"aria-label": `${color}, ${lineStyle}`,
|
|
30615
|
+
style: [styles$g.lineSwatch, {
|
|
30616
|
+
border: `5px ${lineStyle} ${perseus.lockedFigureColors[color]}`
|
|
30617
|
+
}]
|
|
30618
|
+
}));
|
|
30619
|
+
};
|
|
30620
|
+
const styles$g = aphrodite.StyleSheet.create({
|
|
30621
|
+
container: {
|
|
30622
|
+
backgroundColor: wonderBlocksTokens.color.white,
|
|
30623
|
+
justifyContent: "center",
|
|
30624
|
+
padding: wonderBlocksTokens.spacing.xSmall_8,
|
|
30625
|
+
borderRadius: wonderBlocksTokens.spacing.xxxSmall_4
|
|
30631
30626
|
},
|
|
30632
|
-
|
|
30633
|
-
|
|
30627
|
+
lineSwatch: {
|
|
30628
|
+
width: 40
|
|
30629
|
+
}
|
|
30630
|
+
});
|
|
30631
|
+
|
|
30632
|
+
/**
|
|
30633
|
+
* The part of a locked figure settings panel that contains actions
|
|
30634
|
+
* for this panel and its associated locked figure, including
|
|
30635
|
+
* the delete button.
|
|
30636
|
+
*/
|
|
30637
|
+
const LockedFigureSettingsActions = props => {
|
|
30638
|
+
const {
|
|
30639
|
+
onRemove,
|
|
30640
|
+
figureAriaLabel
|
|
30641
|
+
} = props;
|
|
30642
|
+
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30643
|
+
style: styles$f.container
|
|
30644
|
+
}, /*#__PURE__*/React__namespace.createElement(Button__default["default"], {
|
|
30645
|
+
startIcon: trashIcon__default["default"],
|
|
30646
|
+
"aria-label": `Delete ${figureAriaLabel}`,
|
|
30647
|
+
onClick: onRemove,
|
|
30648
|
+
kind: "tertiary",
|
|
30649
|
+
style: styles$f.deleteButton
|
|
30650
|
+
}, "Delete"));
|
|
30651
|
+
};
|
|
30652
|
+
const styles$f = aphrodite.StyleSheet.create({
|
|
30653
|
+
container: {
|
|
30654
|
+
width: "100%",
|
|
30655
|
+
flexDirection: "row",
|
|
30656
|
+
alignItems: "center",
|
|
30657
|
+
marginTop: wonderBlocksTokens.spacing.xxxSmall_4
|
|
30634
30658
|
},
|
|
30635
|
-
|
|
30636
|
-
|
|
30659
|
+
deleteButton: {
|
|
30660
|
+
// Line up the delete icon with the rest of the content.
|
|
30661
|
+
marginInlineStart: -wonderBlocksTokens.spacing.xxxSmall_4
|
|
30637
30662
|
}
|
|
30638
30663
|
});
|
|
30639
30664
|
|
|
@@ -30654,7 +30679,6 @@ const LockedLineSettings = props => {
|
|
|
30654
30679
|
// with their respective text fields.
|
|
30655
30680
|
const ids = wonderBlocksCore.useUniqueIdWithMock();
|
|
30656
30681
|
const kindSelectId = ids.get("line-kind-select");
|
|
30657
|
-
const colorSelectId = ids.get("line-color-select");
|
|
30658
30682
|
const styleSelectId = ids.get("line-style-select");
|
|
30659
30683
|
const capitalizeKind = kind.charAt(0).toUpperCase() + kind.slice(1);
|
|
30660
30684
|
const lineLabel = `${capitalizeKind} (${point1.coord[0]},
|
|
@@ -30683,8 +30707,10 @@ const LockedLineSettings = props => {
|
|
|
30683
30707
|
});
|
|
30684
30708
|
}
|
|
30685
30709
|
return /*#__PURE__*/React__namespace.createElement(LockedFigureSettingsAccordion, {
|
|
30710
|
+
expanded: props.expanded,
|
|
30711
|
+
onToggle: props.onToggle,
|
|
30686
30712
|
header: /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30687
|
-
style: styles$
|
|
30713
|
+
style: styles$e.row
|
|
30688
30714
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, lineLabel), /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30689
30715
|
size: wonderBlocksTokens.spacing.xSmall_8
|
|
30690
30716
|
}), /*#__PURE__*/React__namespace.createElement(LineSwatch, {
|
|
@@ -30692,10 +30718,10 @@ const LockedLineSettings = props => {
|
|
|
30692
30718
|
lineStyle: lineStyle
|
|
30693
30719
|
}))
|
|
30694
30720
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30695
|
-
style: [styles$
|
|
30721
|
+
style: [styles$e.row, styles$e.spaceUnder]
|
|
30696
30722
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
30697
30723
|
htmlFor: kindSelectId,
|
|
30698
|
-
style: styles$
|
|
30724
|
+
style: styles$e.label,
|
|
30699
30725
|
tag: "label"
|
|
30700
30726
|
}, "kind"), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
|
|
30701
30727
|
id: kindSelectId,
|
|
@@ -30716,18 +30742,17 @@ const LockedLineSettings = props => {
|
|
|
30716
30742
|
value: "ray",
|
|
30717
30743
|
label: "ray"
|
|
30718
30744
|
}))), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30719
|
-
style: [styles$
|
|
30745
|
+
style: [styles$e.row, styles$e.spaceUnder]
|
|
30720
30746
|
}, /*#__PURE__*/React__namespace.createElement(ColorSelect, {
|
|
30721
|
-
id: colorSelectId,
|
|
30722
30747
|
selectedValue: lineColor,
|
|
30723
30748
|
onChange: handleColorChange
|
|
30724
30749
|
}), /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30725
30750
|
size: wonderBlocksTokens.spacing.small_12
|
|
30726
30751
|
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30727
|
-
style: styles$
|
|
30752
|
+
style: styles$e.row
|
|
30728
30753
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
30729
30754
|
htmlFor: styleSelectId,
|
|
30730
|
-
style: styles$
|
|
30755
|
+
style: styles$e.label,
|
|
30731
30756
|
tag: "label"
|
|
30732
30757
|
}, "style"), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
|
|
30733
30758
|
id: styleSelectId,
|
|
@@ -30738,31 +30763,29 @@ const LockedLineSettings = props => {
|
|
|
30738
30763
|
// Placeholder is required, but never gets used.
|
|
30739
30764
|
,
|
|
30740
30765
|
placeholder: "",
|
|
30741
|
-
style: styles$
|
|
30766
|
+
style: styles$e.selectMarginOffset
|
|
30742
30767
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
30743
30768
|
value: "solid",
|
|
30744
30769
|
label: "solid"
|
|
30745
30770
|
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
30746
30771
|
value: "dashed",
|
|
30747
30772
|
label: "dashed"
|
|
30748
|
-
})))), /*#__PURE__*/React__namespace.createElement(
|
|
30773
|
+
})))), /*#__PURE__*/React__namespace.createElement(DefiningPointSettings, _extends({
|
|
30749
30774
|
label: "Point 1",
|
|
30750
|
-
|
|
30775
|
+
showPoint: showPoint1
|
|
30751
30776
|
}, point1, {
|
|
30752
|
-
|
|
30777
|
+
onTogglePoint: newValue => onChangeProps({
|
|
30753
30778
|
showPoint1: newValue
|
|
30754
30779
|
}),
|
|
30755
|
-
onChangeProps: newProps => handleChangePoint(newProps, 0)
|
|
30756
|
-
|
|
30757
|
-
})), /*#__PURE__*/React__namespace.createElement(LockedPointSettings, _extends({
|
|
30780
|
+
onChangeProps: newProps => handleChangePoint(newProps, 0)
|
|
30781
|
+
})), /*#__PURE__*/React__namespace.createElement(DefiningPointSettings, _extends({
|
|
30758
30782
|
label: "Point 2",
|
|
30759
|
-
|
|
30783
|
+
showPoint: showPoint2
|
|
30760
30784
|
}, point2, {
|
|
30761
|
-
|
|
30785
|
+
onTogglePoint: newValue => onChangeProps({
|
|
30762
30786
|
showPoint2: newValue
|
|
30763
30787
|
}),
|
|
30764
|
-
onChangeProps: newProps => handleChangePoint(newProps, 1)
|
|
30765
|
-
style: styles$c.lockedPointSettingsContainer
|
|
30788
|
+
onChangeProps: newProps => handleChangePoint(newProps, 1)
|
|
30766
30789
|
})), /*#__PURE__*/React__namespace.createElement(LockedFigureSettingsActions, {
|
|
30767
30790
|
onRemove: onRemove,
|
|
30768
30791
|
figureAriaLabel: `locked line defined by
|
|
@@ -30770,14 +30793,7 @@ const LockedLineSettings = props => {
|
|
|
30770
30793
|
${point2.coord[0]}, ${point2.coord[1]}.`
|
|
30771
30794
|
}));
|
|
30772
30795
|
};
|
|
30773
|
-
const styles$
|
|
30774
|
-
lockedPointSettingsContainer: {
|
|
30775
|
-
marginTop: wonderBlocksTokens.spacing.xSmall_8,
|
|
30776
|
-
marginBottom: 0,
|
|
30777
|
-
marginLeft: -wonderBlocksTokens.spacing.xxxSmall_4,
|
|
30778
|
-
marginRight: -wonderBlocksTokens.spacing.xxxSmall_4,
|
|
30779
|
-
backgroundColor: wonderBlocksTokens.color.white
|
|
30780
|
-
},
|
|
30796
|
+
const styles$e = aphrodite.StyleSheet.create({
|
|
30781
30797
|
row: {
|
|
30782
30798
|
flexDirection: "row",
|
|
30783
30799
|
alignItems: "center"
|
|
@@ -30794,6 +30810,69 @@ const styles$c = aphrodite.StyleSheet.create({
|
|
|
30794
30810
|
}
|
|
30795
30811
|
});
|
|
30796
30812
|
|
|
30813
|
+
/**
|
|
30814
|
+
* LockedPointSettings is a component that allows the user to edit the
|
|
30815
|
+
* settings of specifically a locked point on the graph.
|
|
30816
|
+
*
|
|
30817
|
+
* Used in the interactive graph editor's locked figures section.
|
|
30818
|
+
*/
|
|
30819
|
+
const LockedPointSettings = props => {
|
|
30820
|
+
const {
|
|
30821
|
+
coord,
|
|
30822
|
+
color: pointColor,
|
|
30823
|
+
filled = true,
|
|
30824
|
+
onChangeProps,
|
|
30825
|
+
onRemove
|
|
30826
|
+
} = props;
|
|
30827
|
+
function handleColorChange(newValue) {
|
|
30828
|
+
onChangeProps({
|
|
30829
|
+
color: newValue
|
|
30830
|
+
});
|
|
30831
|
+
}
|
|
30832
|
+
return /*#__PURE__*/React__namespace.createElement(LockedFigureSettingsAccordion, {
|
|
30833
|
+
expanded: props.expanded,
|
|
30834
|
+
onToggle: props.onToggle,
|
|
30835
|
+
header:
|
|
30836
|
+
/*#__PURE__*/
|
|
30837
|
+
// Summary: Point, coords, color (filled/open)
|
|
30838
|
+
React__namespace.createElement(wonderBlocksCore.View, {
|
|
30839
|
+
style: styles$d.row
|
|
30840
|
+
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, `Point (${coord[0]}, ${coord[1]})`), /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30841
|
+
size: wonderBlocksTokens.spacing.xSmall_8
|
|
30842
|
+
}), /*#__PURE__*/React__namespace.createElement(ColorSwatch, {
|
|
30843
|
+
color: pointColor,
|
|
30844
|
+
filled: filled
|
|
30845
|
+
}))
|
|
30846
|
+
}, /*#__PURE__*/React__namespace.createElement(CoordinatePairInput, {
|
|
30847
|
+
coord: coord,
|
|
30848
|
+
onChangeProps: onChangeProps
|
|
30849
|
+
}), /*#__PURE__*/React__namespace.createElement(ColorSelect, {
|
|
30850
|
+
selectedValue: pointColor,
|
|
30851
|
+
onChange: handleColorChange,
|
|
30852
|
+
style: styles$d.spaceUnder
|
|
30853
|
+
}), /*#__PURE__*/React__namespace.createElement(LabeledSwitch, {
|
|
30854
|
+
label: "open point",
|
|
30855
|
+
checked: !filled,
|
|
30856
|
+
onChange: newValue => {
|
|
30857
|
+
onChangeProps({
|
|
30858
|
+
filled: !newValue
|
|
30859
|
+
});
|
|
30860
|
+
}
|
|
30861
|
+
}), /*#__PURE__*/React__namespace.createElement(LockedFigureSettingsActions, {
|
|
30862
|
+
onRemove: onRemove,
|
|
30863
|
+
figureAriaLabel: `locked point at ${coord[0]}, ${coord[1]}`
|
|
30864
|
+
}));
|
|
30865
|
+
};
|
|
30866
|
+
const styles$d = aphrodite.StyleSheet.create({
|
|
30867
|
+
row: {
|
|
30868
|
+
flexDirection: "row",
|
|
30869
|
+
alignItems: "center"
|
|
30870
|
+
},
|
|
30871
|
+
spaceUnder: {
|
|
30872
|
+
marginBottom: wonderBlocksTokens.spacing.xSmall_8
|
|
30873
|
+
}
|
|
30874
|
+
});
|
|
30875
|
+
|
|
30797
30876
|
/**
|
|
30798
30877
|
* LockedFigureSettings takes in a figure and renders the
|
|
30799
30878
|
* respective settings for that figure type.
|
|
@@ -30882,6 +30961,9 @@ function getDefaultFigureForType(type) {
|
|
|
30882
30961
|
}
|
|
30883
30962
|
|
|
30884
30963
|
const LockedFiguresSection = props => {
|
|
30964
|
+
// Keep track of all figures' accordions' expanded states for the
|
|
30965
|
+
// expand/collapse all button. Set the whole array to false initially.
|
|
30966
|
+
const [expandedStates, setExpandedStates] = React__namespace.useState(Array(props.figures?.length).fill(false));
|
|
30885
30967
|
const uniqueId = wonderBlocksCore.useUniqueIdWithMock().get("locked-figures-section");
|
|
30886
30968
|
const {
|
|
30887
30969
|
figures,
|
|
@@ -30893,6 +30975,7 @@ const LockedFiguresSection = props => {
|
|
|
30893
30975
|
lockedFigures: [...lockedFigures, getDefaultFigureForType(newFigure)]
|
|
30894
30976
|
};
|
|
30895
30977
|
onChange(newProps);
|
|
30978
|
+
setExpandedStates([...expandedStates, true]);
|
|
30896
30979
|
}
|
|
30897
30980
|
function removeLockedFigure(index) {
|
|
30898
30981
|
// eslint-disable-next-line no-alert
|
|
@@ -30901,6 +30984,11 @@ const LockedFiguresSection = props => {
|
|
|
30901
30984
|
onChange({
|
|
30902
30985
|
lockedFigures: [...lockedFigures.slice(0, index), ...lockedFigures.slice(index + 1)]
|
|
30903
30986
|
});
|
|
30987
|
+
|
|
30988
|
+
// Update expanded states
|
|
30989
|
+
const newExpandedStates = [...expandedStates];
|
|
30990
|
+
newExpandedStates.splice(index, 1);
|
|
30991
|
+
setExpandedStates(newExpandedStates);
|
|
30904
30992
|
}
|
|
30905
30993
|
}
|
|
30906
30994
|
function changeProps(index,
|
|
@@ -30916,16 +31004,46 @@ const LockedFiguresSection = props => {
|
|
|
30916
31004
|
};
|
|
30917
31005
|
onChange(newFigures);
|
|
30918
31006
|
}
|
|
31007
|
+
function toggleExpanded(newValue) {
|
|
31008
|
+
setExpandedStates(Array(figures?.length).fill(newValue));
|
|
31009
|
+
}
|
|
31010
|
+
const allCollapsed = expandedStates.every(value => !value);
|
|
31011
|
+
const buttonLabel = allCollapsed ? "Expand all" : "Collapse all";
|
|
31012
|
+
const showExpandButton = !!figures?.length;
|
|
30919
31013
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, null, figures?.map((figure, index) => /*#__PURE__*/React__namespace.createElement(LockedFigureSettings, _extends({
|
|
31014
|
+
expanded: expandedStates[index],
|
|
31015
|
+
onToggle: newValue => {
|
|
31016
|
+
const newExpanded = [...expandedStates];
|
|
31017
|
+
newExpanded[index] = newValue;
|
|
31018
|
+
setExpandedStates(newExpanded);
|
|
31019
|
+
},
|
|
30920
31020
|
key: `${uniqueId}-locked-${figure}-${index}`
|
|
30921
31021
|
}, figure, {
|
|
30922
31022
|
onChangeProps: newProps => changeProps(index, newProps),
|
|
30923
31023
|
onRemove: () => removeLockedFigure(index)
|
|
30924
|
-
}))), /*#__PURE__*/React__namespace.createElement(
|
|
31024
|
+
}))), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
31025
|
+
style: styles$c.buttonContainer
|
|
31026
|
+
}, /*#__PURE__*/React__namespace.createElement(LockedFigureSelect, {
|
|
30925
31027
|
id: `${uniqueId}-select`,
|
|
30926
31028
|
onChange: addLockedFigure
|
|
30927
|
-
})
|
|
31029
|
+
}), /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
31030
|
+
size: wonderBlocksTokens.spacing.small_12
|
|
31031
|
+
}), showExpandButton && /*#__PURE__*/React__namespace.createElement(Button__default["default"], {
|
|
31032
|
+
kind: "secondary",
|
|
31033
|
+
onClick: () => toggleExpanded(allCollapsed),
|
|
31034
|
+
style: styles$c.button
|
|
31035
|
+
}, buttonLabel)));
|
|
30928
31036
|
};
|
|
31037
|
+
const styles$c = aphrodite.StyleSheet.create({
|
|
31038
|
+
buttonContainer: {
|
|
31039
|
+
flexDirection: "row",
|
|
31040
|
+
alignItems: "center"
|
|
31041
|
+
},
|
|
31042
|
+
button: {
|
|
31043
|
+
marginTop: wonderBlocksTokens.spacing.xSmall_8,
|
|
31044
|
+
flexGrow: 1
|
|
31045
|
+
}
|
|
31046
|
+
});
|
|
30929
31047
|
|
|
30930
31048
|
const SegmentCountSelector = _ref => {
|
|
30931
31049
|
let {
|