@khanacademy/perseus-editor 6.7.0 → 6.10.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/components/angle-input.d.ts +7 -0
- package/dist/components/coordinate-pair-input.d.ts +3 -2
- package/dist/components/ellipse-swatch.d.ts +9 -0
- package/dist/components/locked-ellipse-settings.d.ts +15 -0
- package/dist/components/locked-figure-select.d.ts +1 -0
- package/dist/components/locked-figure-settings.d.ts +3 -1
- package/dist/components/locked-figures-section.d.ts +1 -1
- package/dist/components/locked-vector-settings.d.ts +15 -0
- package/dist/components/util.d.ts +3 -1
- package/dist/es/index.js +606 -281
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +604 -278
- package/dist/index.js.map +1 -1
- package/dist/widgets/interactive-graph-editor.d.ts +0 -62
- package/package.json +9 -9
package/dist/es/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { addLibraryVersionToPerseusDebug } from '@khanacademy/perseus-core';
|
|
2
|
-
import { constants, components, Widgets, icons, WIDGET_PROP_DENYLIST, Util, Log, PerseusError, Errors, PerseusMarkdown, preprocessTex, ApiOptions, buildMapper, itemToTree, buildEmptyItemTreeForShape, shapes, ItemExtras, itemDataVersion, ClassNames, MultiItems, traverse, Categorizer as Categorizer$1, Changeable, EditorJsonify, Dependencies, WidgetJsonifyDeprecated, PerseusExpressionAnswerFormConsidered, Expression, interactiveSizes, KhanMath, GrapherWidget, GrapherUtil, SizingUtils, PerseusI18nContext, KhanColors, ColorPicker, DashPicker, ArrowPicker, ElementContainer, lockedFigureColors, InteractiveGraphWidget, globalStyles, globalConstants, MatrixWidget, PlotterWidget, plotterPlotTypes, BaseRadio, TableWidget, displaySigFigs, widgets } from '@khanacademy/perseus';
|
|
2
|
+
import { constants, components, Widgets, icons, WIDGET_PROP_DENYLIST, Util, Log, PerseusError, Errors, PerseusMarkdown, preprocessTex, ApiOptions, buildMapper, itemToTree, buildEmptyItemTreeForShape, shapes, ItemExtras, itemDataVersion, ClassNames, MultiItems, traverse, Categorizer as Categorizer$1, Changeable, EditorJsonify, Dependencies, WidgetJsonifyDeprecated, PerseusExpressionAnswerFormConsidered, Expression, interactiveSizes, KhanMath, GrapherWidget, GrapherUtil, SizingUtils, PerseusI18nContext, KhanColors, ColorPicker, DashPicker, ArrowPicker, ElementContainer, lockedFigureColors, lockedEllipseFillStyles, InteractiveGraphWidget, globalStyles, globalConstants, MatrixWidget, PlotterWidget, plotterPlotTypes, BaseRadio, TableWidget, displaySigFigs, widgets } from '@khanacademy/perseus';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { useRef, useEffect } from 'react';
|
|
5
5
|
import _ from 'underscore';
|
|
@@ -29,7 +29,7 @@ import trashIcon from '@phosphor-icons/core/bold/trash-bold.svg';
|
|
|
29
29
|
|
|
30
30
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
31
31
|
const libName = "@khanacademy/perseus-editor";
|
|
32
|
-
const libVersion = "6.
|
|
32
|
+
const libVersion = "6.10.0";
|
|
33
33
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
34
34
|
|
|
35
35
|
function _extends() {
|
|
@@ -219,7 +219,7 @@ class SectionControlButton extends React.Component {
|
|
|
219
219
|
role: "button",
|
|
220
220
|
hideDefaultFocusRing: true,
|
|
221
221
|
"aria-label": title,
|
|
222
|
-
style: styles$
|
|
222
|
+
style: styles$D.button
|
|
223
223
|
}, ({
|
|
224
224
|
hovered,
|
|
225
225
|
focused,
|
|
@@ -227,7 +227,7 @@ class SectionControlButton extends React.Component {
|
|
|
227
227
|
}) => /*#__PURE__*/React.createElement(InlineIcon$b, icon));
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
|
-
const styles$
|
|
230
|
+
const styles$D = StyleSheet.create({
|
|
231
231
|
button: {
|
|
232
232
|
backgroundColor: color.gold,
|
|
233
233
|
margin: 2,
|
|
@@ -20732,13 +20732,13 @@ class WidgetSelect extends React.Component {
|
|
|
20732
20732
|
* that collapse a region.
|
|
20733
20733
|
*/
|
|
20734
20734
|
function ToggleableCaret(props) {
|
|
20735
|
-
const iconStyle = props.isExpanded ? styles$
|
|
20735
|
+
const iconStyle = props.isExpanded ? styles$C.expanded : styles$C.collapsed;
|
|
20736
20736
|
return /*#__PURE__*/React.createElement(PhosphorIcon, {
|
|
20737
20737
|
icon: caretRight,
|
|
20738
20738
|
style: iconStyle
|
|
20739
20739
|
});
|
|
20740
20740
|
}
|
|
20741
|
-
const styles$
|
|
20741
|
+
const styles$C = StyleSheet.create({
|
|
20742
20742
|
collapsed: {
|
|
20743
20743
|
transition: ".15s"
|
|
20744
20744
|
},
|
|
@@ -20771,16 +20771,16 @@ class TexErrorView extends React.Component {
|
|
|
20771
20771
|
showErrors
|
|
20772
20772
|
} = this.state;
|
|
20773
20773
|
return /*#__PURE__*/React.createElement(View, {
|
|
20774
|
-
style: styles$
|
|
20774
|
+
style: styles$B.errorContainer
|
|
20775
20775
|
}, /*#__PURE__*/React.createElement(View, {
|
|
20776
|
-
style: styles$
|
|
20776
|
+
style: styles$B.title,
|
|
20777
20777
|
onClick: this.handleToggleTexErrors
|
|
20778
20778
|
}, /*#__PURE__*/React.createElement(ToggleableCaret, {
|
|
20779
20779
|
isExpanded: showErrors
|
|
20780
20780
|
}), "\xA0 TeX Errors (", errorList.length, ")"), showErrors && /*#__PURE__*/React.createElement(View, {
|
|
20781
|
-
style: styles$
|
|
20781
|
+
style: styles$B.errorExplanation
|
|
20782
20782
|
}, "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.createElement(View, {
|
|
20783
|
-
style: styles$
|
|
20783
|
+
style: styles$B.error,
|
|
20784
20784
|
key: index
|
|
20785
20785
|
}, /*#__PURE__*/React.createElement(View, {
|
|
20786
20786
|
style: {
|
|
@@ -20789,7 +20789,7 @@ class TexErrorView extends React.Component {
|
|
|
20789
20789
|
}, e.math), /*#__PURE__*/React.createElement(View, null, e.message))));
|
|
20790
20790
|
}
|
|
20791
20791
|
}
|
|
20792
|
-
const styles$
|
|
20792
|
+
const styles$B = StyleSheet.create({
|
|
20793
20793
|
title: {
|
|
20794
20794
|
backgroundColor: "#eee",
|
|
20795
20795
|
fontSize: "1.25em",
|
|
@@ -23445,7 +23445,7 @@ class StructuredItemDiff extends React.Component {
|
|
|
23445
23445
|
|
|
23446
23446
|
/* eslint-disable @khanacademy/ts-no-error-suppressions */
|
|
23447
23447
|
const {
|
|
23448
|
-
InfoTip: InfoTip$
|
|
23448
|
+
InfoTip: InfoTip$n,
|
|
23449
23449
|
InlineIcon: InlineIcon$7
|
|
23450
23450
|
} = components;
|
|
23451
23451
|
const {
|
|
@@ -23517,7 +23517,7 @@ class HintEditor extends React.Component {
|
|
|
23517
23517
|
type: "button",
|
|
23518
23518
|
className: this.props.isFirst ? "hidden" : "",
|
|
23519
23519
|
onClick: _.partial(this.props.onMove, -1)
|
|
23520
|
-
}, /*#__PURE__*/React.createElement(InlineIcon$7, iconCircleArrowUp)), " ", this.props.isLast && /*#__PURE__*/React.createElement(InfoTip$
|
|
23520
|
+
}, /*#__PURE__*/React.createElement(InlineIcon$7, iconCircleArrowUp)), " ", this.props.isLast && /*#__PURE__*/React.createElement(InfoTip$n, null, /*#__PURE__*/React.createElement("p", null, "The last hint is automatically bolded."))), /*#__PURE__*/React.createElement("input", {
|
|
23521
23521
|
type: "checkbox"
|
|
23522
23522
|
// @ts-expect-error - TS2322 - Type 'boolean | null | undefined' is not assignable to type 'boolean | undefined'.
|
|
23523
23523
|
,
|
|
@@ -23770,7 +23770,7 @@ CombinedHintsEditor.defaultProps = {
|
|
|
23770
23770
|
};
|
|
23771
23771
|
|
|
23772
23772
|
const {
|
|
23773
|
-
InfoTip: InfoTip$
|
|
23773
|
+
InfoTip: InfoTip$m
|
|
23774
23774
|
} = components;
|
|
23775
23775
|
class ItemExtrasEditor extends React.Component {
|
|
23776
23776
|
constructor(...args) {
|
|
@@ -23916,7 +23916,7 @@ const ItemExtraCheckbox = props => /*#__PURE__*/React.createElement("div", {
|
|
|
23916
23916
|
type: "checkbox",
|
|
23917
23917
|
checked: props.checked,
|
|
23918
23918
|
onChange: props.onChange
|
|
23919
|
-
})), /*#__PURE__*/React.createElement(InfoTip$
|
|
23919
|
+
})), /*#__PURE__*/React.createElement(InfoTip$m, null, props.infoTip));
|
|
23920
23920
|
|
|
23921
23921
|
const ITEM_DATA_VERSION = itemDataVersion;
|
|
23922
23922
|
class ItemEditor extends React.Component {
|
|
@@ -24583,7 +24583,7 @@ class SimpleButton extends React.Component {
|
|
|
24583
24583
|
} = _this$props,
|
|
24584
24584
|
otherProps = _objectWithoutPropertiesLoose(_this$props, _excluded$3);
|
|
24585
24585
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
24586
|
-
className: css(styles$
|
|
24586
|
+
className: css(styles$A.baseButton, color === "green" && styles$A.green, color === "orange" && styles$A.orange),
|
|
24587
24587
|
onClick: onClick
|
|
24588
24588
|
}, otherProps), children);
|
|
24589
24589
|
}
|
|
@@ -24598,7 +24598,7 @@ SimpleButton.defaultProps = {
|
|
|
24598
24598
|
color: "green",
|
|
24599
24599
|
onClick: () => {}
|
|
24600
24600
|
};
|
|
24601
|
-
const styles$
|
|
24601
|
+
const styles$A = StyleSheet.create({
|
|
24602
24602
|
baseButton: {
|
|
24603
24603
|
top: "0",
|
|
24604
24604
|
fontSize: "11px",
|
|
@@ -24818,23 +24818,23 @@ const LeafContainer = ({
|
|
|
24818
24818
|
}) => {
|
|
24819
24819
|
const hasPreviewHeading = shape.type === "content" || shape.type === "hint";
|
|
24820
24820
|
const previewHeading = hasPreviewHeading && /*#__PURE__*/React.createElement("div", {
|
|
24821
|
-
className: css(styles$
|
|
24821
|
+
className: css(styles$z.containerHeader)
|
|
24822
24822
|
}, /*#__PURE__*/React.createElement(Header, {
|
|
24823
24823
|
depth: path.length,
|
|
24824
|
-
className: css(styles$
|
|
24824
|
+
className: css(styles$z.containerTitle)
|
|
24825
24825
|
}, capitalize(name)));
|
|
24826
24826
|
return /*#__PURE__*/React.createElement("div", {
|
|
24827
|
-
className: css(styles$
|
|
24827
|
+
className: css(styles$z.container)
|
|
24828
24828
|
}, /*#__PURE__*/React.createElement("span", {
|
|
24829
|
-
className: css(styles$
|
|
24829
|
+
className: css(styles$z.row, styles$z.rowHeading)
|
|
24830
24830
|
}, /*#__PURE__*/React.createElement("div", {
|
|
24831
|
-
className: css(styles$
|
|
24831
|
+
className: css(styles$z.columnLeft)
|
|
24832
24832
|
}, /*#__PURE__*/React.createElement("div", {
|
|
24833
|
-
className: "pod-title " + css(styles$
|
|
24833
|
+
className: "pod-title " + css(styles$z.containerHeader)
|
|
24834
24834
|
}, /*#__PURE__*/React.createElement("div", {
|
|
24835
|
-
className: css(styles$
|
|
24835
|
+
className: css(styles$z.containerTitle)
|
|
24836
24836
|
}, capitalize(name)), controls)), /*#__PURE__*/React.createElement("div", {
|
|
24837
|
-
className: css(styles$
|
|
24837
|
+
className: css(styles$z.columnRight)
|
|
24838
24838
|
}, previewHeading)), children);
|
|
24839
24839
|
};
|
|
24840
24840
|
const ArrayContainer = props => {
|
|
@@ -24847,11 +24847,11 @@ const ArrayContainer = props => {
|
|
|
24847
24847
|
actions
|
|
24848
24848
|
} = props;
|
|
24849
24849
|
return /*#__PURE__*/React.createElement("div", {
|
|
24850
|
-
className: css(styles$
|
|
24850
|
+
className: css(styles$z.container)
|
|
24851
24851
|
}, controls && /*#__PURE__*/React.createElement("div", {
|
|
24852
|
-
className: css(styles$
|
|
24852
|
+
className: css(styles$z.columnLeft, styles$z.containerHeader)
|
|
24853
24853
|
}, controls), /*#__PURE__*/React.createElement("div", null, children), /*#__PURE__*/React.createElement("div", {
|
|
24854
|
-
className: css(styles$
|
|
24854
|
+
className: css(styles$z.columnLeft)
|
|
24855
24855
|
}, /*#__PURE__*/React.createElement("a", {
|
|
24856
24856
|
href: "javascript:void 0",
|
|
24857
24857
|
onClick: () => actions.addArrayElement(path, shape.elementShape)
|
|
@@ -24864,28 +24864,28 @@ const ObjectContainer = ({
|
|
|
24864
24864
|
path
|
|
24865
24865
|
}) => {
|
|
24866
24866
|
const headingEditor = /*#__PURE__*/React.createElement("div", {
|
|
24867
|
-
className: css(styles$
|
|
24867
|
+
className: css(styles$z.containerHeader)
|
|
24868
24868
|
}, /*#__PURE__*/React.createElement(Header, {
|
|
24869
24869
|
depth: path.length,
|
|
24870
|
-
className: css(styles$
|
|
24870
|
+
className: css(styles$z.containerTitle)
|
|
24871
24871
|
}, capitalize(name)), controls);
|
|
24872
24872
|
const headingPreview = (name || controls) && /*#__PURE__*/React.createElement("div", {
|
|
24873
|
-
className: css(styles$
|
|
24873
|
+
className: css(styles$z.containerHeader, styles$z.previewCollectionHeader)
|
|
24874
24874
|
}, /*#__PURE__*/React.createElement(Header, {
|
|
24875
24875
|
depth: path.length,
|
|
24876
|
-
className: css(styles$
|
|
24876
|
+
className: css(styles$z.containerTitle)
|
|
24877
24877
|
}, capitalize(name)));
|
|
24878
24878
|
const hasBothHeadings = headingEditor && headingPreview;
|
|
24879
24879
|
return /*#__PURE__*/React.createElement("div", {
|
|
24880
|
-
className: css(styles$
|
|
24880
|
+
className: css(styles$z.container)
|
|
24881
24881
|
}, hasBothHeadings && /*#__PURE__*/React.createElement("span", {
|
|
24882
|
-
className: css(styles$
|
|
24882
|
+
className: css(styles$z.row)
|
|
24883
24883
|
}, /*#__PURE__*/React.createElement("div", {
|
|
24884
|
-
className: css(styles$
|
|
24884
|
+
className: css(styles$z.columnLeft)
|
|
24885
24885
|
}, headingEditor), /*#__PURE__*/React.createElement("div", {
|
|
24886
|
-
className: css(styles$
|
|
24886
|
+
className: css(styles$z.columnRight)
|
|
24887
24887
|
}, headingPreview)), /*#__PURE__*/React.createElement("div", {
|
|
24888
|
-
className: css(path.length > 0 && styles$
|
|
24888
|
+
className: css(path.length > 0 && styles$z.contentIndent)
|
|
24889
24889
|
}, children));
|
|
24890
24890
|
};
|
|
24891
24891
|
|
|
@@ -25008,11 +25008,11 @@ const ItemNodeContent = withStickiness(props => {
|
|
|
25008
25008
|
className: "framework-perseus"
|
|
25009
25009
|
}, lens(renderers).get(path));
|
|
25010
25010
|
return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("div", {
|
|
25011
|
-
className: css(styles$
|
|
25011
|
+
className: css(styles$z.row)
|
|
25012
25012
|
}, /*#__PURE__*/React.createElement("div", {
|
|
25013
|
-
className: css(styles$
|
|
25013
|
+
className: css(styles$z.columnLeft)
|
|
25014
25014
|
}, /*#__PURE__*/React.createElement("div", {
|
|
25015
|
-
className: css(sticky && styles$
|
|
25015
|
+
className: css(sticky && styles$z.sticky)
|
|
25016
25016
|
},
|
|
25017
25017
|
/*#__PURE__*/
|
|
25018
25018
|
// @ts-expect-error - TS2769 - No overload matches this call.
|
|
@@ -25020,9 +25020,9 @@ const ItemNodeContent = withStickiness(props => {
|
|
|
25020
25020
|
onChange: newVal => actions.mergeValueAtPath(path, newVal),
|
|
25021
25021
|
apiOptions: apiOptions
|
|
25022
25022
|
})))), /*#__PURE__*/React.createElement("div", {
|
|
25023
|
-
className: css(styles$
|
|
25023
|
+
className: css(styles$z.columnRight)
|
|
25024
25024
|
}, /*#__PURE__*/React.createElement("div", {
|
|
25025
|
-
className: css(sticky && styles$
|
|
25025
|
+
className: css(sticky && styles$z.sticky)
|
|
25026
25026
|
}, preview))));
|
|
25027
25027
|
});
|
|
25028
25028
|
const HintNodeContent = withStickiness(props => {
|
|
@@ -25038,13 +25038,13 @@ const HintNodeContent = withStickiness(props => {
|
|
|
25038
25038
|
className: "framework-perseus"
|
|
25039
25039
|
}, lens(renderers).get(path));
|
|
25040
25040
|
return /*#__PURE__*/React.createElement("div", {
|
|
25041
|
-
className: css(styles$
|
|
25041
|
+
className: css(styles$z.row)
|
|
25042
25042
|
}, /*#__PURE__*/React.createElement("div", {
|
|
25043
|
-
className: css(styles$
|
|
25043
|
+
className: css(styles$z.columnLeft)
|
|
25044
25044
|
}, /*#__PURE__*/React.createElement("div", {
|
|
25045
|
-
className: css(sticky && styles$
|
|
25045
|
+
className: css(sticky && styles$z.sticky)
|
|
25046
25046
|
}, /*#__PURE__*/React.createElement(HintEditor, _extends({}, data, {
|
|
25047
|
-
className: css(styles$
|
|
25047
|
+
className: css(styles$z.hintEditor),
|
|
25048
25048
|
onChange: newVal => actions.mergeValueAtPath(path, newVal),
|
|
25049
25049
|
apiOptions: apiOptions,
|
|
25050
25050
|
showTitle: false,
|
|
@@ -25059,9 +25059,9 @@ const HintNodeContent = withStickiness(props => {
|
|
|
25059
25059
|
isFirst: true,
|
|
25060
25060
|
isLast: true
|
|
25061
25061
|
})))), /*#__PURE__*/React.createElement("div", {
|
|
25062
|
-
className: css(styles$
|
|
25062
|
+
className: css(styles$z.columnRight)
|
|
25063
25063
|
}, /*#__PURE__*/React.createElement("div", {
|
|
25064
|
-
className: css(sticky && styles$
|
|
25064
|
+
className: css(sticky && styles$z.sticky)
|
|
25065
25065
|
}, preview)));
|
|
25066
25066
|
});
|
|
25067
25067
|
const TagsNodeContent = props => {
|
|
@@ -25078,9 +25078,9 @@ const TagsNodeContent = props => {
|
|
|
25078
25078
|
return null;
|
|
25079
25079
|
}
|
|
25080
25080
|
return /*#__PURE__*/React.createElement("div", {
|
|
25081
|
-
className: css(styles$
|
|
25081
|
+
className: css(styles$z.columnLeft)
|
|
25082
25082
|
}, /*#__PURE__*/React.createElement("div", {
|
|
25083
|
-
className: css(styles$
|
|
25083
|
+
className: css(styles$z.tagsEditor)
|
|
25084
25084
|
}, /*#__PURE__*/React.createElement(GroupMetadataEditor, {
|
|
25085
25085
|
value: data,
|
|
25086
25086
|
onChange: newVal => actions.setValueAtPath(path, newVal),
|
|
@@ -25111,23 +25111,23 @@ const ArrayNodeContent = props => {
|
|
|
25111
25111
|
const subpath = path.concat(i);
|
|
25112
25112
|
const controls = [i > 0 && /*#__PURE__*/React.createElement("div", {
|
|
25113
25113
|
key: "moveArrayElementUp",
|
|
25114
|
-
className: css(styles$
|
|
25114
|
+
className: css(styles$z.control)
|
|
25115
25115
|
}, /*#__PURE__*/React.createElement(SimpleButton, {
|
|
25116
25116
|
color: "orange",
|
|
25117
25117
|
title: "Move up",
|
|
25118
25118
|
onClick: () => actions.moveArrayElementUp(subpath)
|
|
25119
25119
|
}, /*#__PURE__*/React.createElement("div", {
|
|
25120
|
-
className: css(styles$
|
|
25120
|
+
className: css(styles$z.verticalFlip)
|
|
25121
25121
|
}, /*#__PURE__*/React.createElement(InlineIcon$6, iconChevronDown)))), i < data.length - 1 && /*#__PURE__*/React.createElement("div", {
|
|
25122
25122
|
key: "moveArrayElementDown",
|
|
25123
|
-
className: css(styles$
|
|
25123
|
+
className: css(styles$z.control)
|
|
25124
25124
|
}, /*#__PURE__*/React.createElement(SimpleButton, {
|
|
25125
25125
|
color: "orange",
|
|
25126
25126
|
title: "Move down",
|
|
25127
25127
|
onClick: () => actions.moveArrayElementDown(subpath)
|
|
25128
25128
|
}, /*#__PURE__*/React.createElement(InlineIcon$6, iconChevronDown))), /*#__PURE__*/React.createElement("div", {
|
|
25129
25129
|
key: "removeArrayElement",
|
|
25130
|
-
className: css(styles$
|
|
25130
|
+
className: css(styles$z.control)
|
|
25131
25131
|
}, /*#__PURE__*/React.createElement(SimpleButton, {
|
|
25132
25132
|
color: "orange",
|
|
25133
25133
|
title: "Delete",
|
|
@@ -25135,7 +25135,7 @@ const ArrayNodeContent = props => {
|
|
|
25135
25135
|
}, /*#__PURE__*/React.createElement(InlineIcon$6, iconTrash$4)))];
|
|
25136
25136
|
return /*#__PURE__*/React.createElement("div", {
|
|
25137
25137
|
key: i,
|
|
25138
|
-
className: css(styles$
|
|
25138
|
+
className: css(styles$z.arrayElement, !elementIsLeaf && styles$z.arrayElementAndNotLeaf)
|
|
25139
25139
|
}, /*#__PURE__*/React.createElement(NodeContainer, _extends({}, otherProps, {
|
|
25140
25140
|
key: i,
|
|
25141
25141
|
shape: shape.elementShape,
|
|
@@ -25161,7 +25161,7 @@ const ObjectNodeContent = props => {
|
|
|
25161
25161
|
// made sense to the shape's author is the order in which we'll iterate :)
|
|
25162
25162
|
const children = Object.keys(shape.shape).map(subkey => /*#__PURE__*/React.createElement("div", {
|
|
25163
25163
|
key: subkey,
|
|
25164
|
-
className: css(styles$
|
|
25164
|
+
className: css(styles$z.objectElement)
|
|
25165
25165
|
}, /*#__PURE__*/React.createElement(NodeContainer, _extends({}, otherProps, {
|
|
25166
25166
|
shape: shape.shape[subkey],
|
|
25167
25167
|
data: data[subkey],
|
|
@@ -25328,7 +25328,7 @@ class MultiRendererEditor extends React.Component {
|
|
|
25328
25328
|
}, this._renderContent());
|
|
25329
25329
|
}
|
|
25330
25330
|
}
|
|
25331
|
-
const styles$
|
|
25331
|
+
const styles$z = StyleSheet.create({
|
|
25332
25332
|
// This is used in a number of places throughout this file.
|
|
25333
25333
|
container: {},
|
|
25334
25334
|
// eslint-disable-next-line react-native/no-unused-styles
|
|
@@ -25480,47 +25480,47 @@ const StatefulArticleEditor = createReactClass({
|
|
|
25480
25480
|
screen
|
|
25481
25481
|
} = this.state;
|
|
25482
25482
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
25483
|
-
style: styles$
|
|
25483
|
+
style: styles$y.controlBar
|
|
25484
25484
|
}, /*#__PURE__*/React.createElement("span", {
|
|
25485
|
-
style: styles$
|
|
25485
|
+
style: styles$y.controls
|
|
25486
25486
|
}, "Mode:", " ", /*#__PURE__*/React.createElement("span", {
|
|
25487
25487
|
onClick: () => this.setState({
|
|
25488
25488
|
mode: "edit"
|
|
25489
25489
|
}),
|
|
25490
|
-
style: mode === "edit" ? styles$
|
|
25490
|
+
style: mode === "edit" ? styles$y.controlSelected : styles$y.control
|
|
25491
25491
|
}, "EDIT"), " | ", /*#__PURE__*/React.createElement("span", {
|
|
25492
25492
|
onClick: () => this.setState({
|
|
25493
25493
|
mode: "preview"
|
|
25494
25494
|
}),
|
|
25495
|
-
style: mode === "preview" ? styles$
|
|
25495
|
+
style: mode === "preview" ? styles$y.controlSelected : styles$y.control
|
|
25496
25496
|
}, "PREVIEW"), " | ", /*#__PURE__*/React.createElement("span", {
|
|
25497
25497
|
onClick: () => this.setState({
|
|
25498
25498
|
mode: "json"
|
|
25499
25499
|
}),
|
|
25500
|
-
style: mode === "json" ? styles$
|
|
25500
|
+
style: mode === "json" ? styles$y.controlSelected : styles$y.control
|
|
25501
25501
|
}, "JSON")), /*#__PURE__*/React.createElement("span", {
|
|
25502
|
-
style: styles$
|
|
25502
|
+
style: styles$y.controls
|
|
25503
25503
|
}, "Screen:", " ", /*#__PURE__*/React.createElement("span", {
|
|
25504
25504
|
onClick: () => this.setState({
|
|
25505
25505
|
screen: "phone"
|
|
25506
25506
|
}),
|
|
25507
|
-
style: screen === "phone" ? styles$
|
|
25507
|
+
style: screen === "phone" ? styles$y.controlSelected : styles$y.control
|
|
25508
25508
|
}, "PHONE"), " | ", /*#__PURE__*/React.createElement("span", {
|
|
25509
25509
|
onClick: () => this.setState({
|
|
25510
25510
|
screen: "tablet"
|
|
25511
25511
|
}),
|
|
25512
|
-
style: screen === "tablet" ? styles$
|
|
25512
|
+
style: screen === "tablet" ? styles$y.controlSelected : styles$y.control
|
|
25513
25513
|
}, "TABLET"), " | ", /*#__PURE__*/React.createElement("span", {
|
|
25514
25514
|
onClick: () => this.setState({
|
|
25515
25515
|
screen: "desktop"
|
|
25516
25516
|
}),
|
|
25517
|
-
style: screen === "desktop" ? styles$
|
|
25517
|
+
style: screen === "desktop" ? styles$y.controlSelected : styles$y.control
|
|
25518
25518
|
}, "DESKTOP"))), /*#__PURE__*/React.createElement("div", {
|
|
25519
|
-
style: styles$
|
|
25519
|
+
style: styles$y.editor
|
|
25520
25520
|
}, /*#__PURE__*/React.createElement(ArticleEditor, this.state)));
|
|
25521
25521
|
}
|
|
25522
25522
|
});
|
|
25523
|
-
const styles$
|
|
25523
|
+
const styles$y = {
|
|
25524
25524
|
controlBar: {
|
|
25525
25525
|
marginBottom: 25,
|
|
25526
25526
|
marginTop: 5
|
|
@@ -25731,7 +25731,7 @@ class BlurInput extends React.Component {
|
|
|
25731
25731
|
}
|
|
25732
25732
|
|
|
25733
25733
|
const {
|
|
25734
|
-
InfoTip: InfoTip$
|
|
25734
|
+
InfoTip: InfoTip$l,
|
|
25735
25735
|
PropCheckBox: PropCheckBox$b
|
|
25736
25736
|
} = components;
|
|
25737
25737
|
const DEFAULT_WIDTH = 400;
|
|
@@ -25892,7 +25892,7 @@ class CSProgramEditor extends React.Component {
|
|
|
25892
25892
|
label: "Show Editor",
|
|
25893
25893
|
showEditor: this.props.showEditor,
|
|
25894
25894
|
onChange: this.props.onChange
|
|
25895
|
-
}), /*#__PURE__*/React.createElement(InfoTip$
|
|
25895
|
+
}), /*#__PURE__*/React.createElement(InfoTip$l, null, "If you show the editor, you should use the \"full-width\" alignment to make room for the width of the editor."), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(PropCheckBox$b, {
|
|
25896
25896
|
label: "Show Buttons",
|
|
25897
25897
|
showButtons: this.props.showButtons,
|
|
25898
25898
|
onChange: this.props.onChange
|
|
@@ -25900,7 +25900,7 @@ class CSProgramEditor extends React.Component {
|
|
|
25900
25900
|
name: "settings",
|
|
25901
25901
|
pairs: this.props.settings,
|
|
25902
25902
|
onChange: this._handleSettingsChange
|
|
25903
|
-
}), /*#__PURE__*/React.createElement(InfoTip$
|
|
25903
|
+
}), /*#__PURE__*/React.createElement(InfoTip$l, null, "Settings that you add here are available to the program as an object returned by ", /*#__PURE__*/React.createElement("code", null, "Program.settings()"))));
|
|
25904
25904
|
}
|
|
25905
25905
|
}
|
|
25906
25906
|
CSProgramEditor.propTypes = _extends({}, Changeable.propTypes);
|
|
@@ -25986,7 +25986,7 @@ DeprecatedStandinEditor.widgetName = "deprecated-standin";
|
|
|
25986
25986
|
|
|
25987
25987
|
/* eslint-disable @khanacademy/ts-no-error-suppressions */
|
|
25988
25988
|
const {
|
|
25989
|
-
InfoTip: InfoTip$
|
|
25989
|
+
InfoTip: InfoTip$k,
|
|
25990
25990
|
InlineIcon: InlineIcon$5
|
|
25991
25991
|
} = components;
|
|
25992
25992
|
const {
|
|
@@ -26055,14 +26055,14 @@ class DropdownEditor extends React.Component {
|
|
|
26055
26055
|
className: "perseus-widget-dropdown"
|
|
26056
26056
|
}, /*#__PURE__*/React.createElement("div", {
|
|
26057
26057
|
className: "dropdown-info"
|
|
26058
|
-
}, "Dropdown", /*#__PURE__*/React.createElement(InfoTip$
|
|
26058
|
+
}, "Dropdown", /*#__PURE__*/React.createElement(InfoTip$k, null, /*#__PURE__*/React.createElement("p", null, "The drop down is useful for making inequalities in a custom format. We normally use the symbols ", "<", ",", " ", ">", ", \u2264, \u2265 (in that order) which you can copy into the choices. When possible, use the \"multiple choice\" answer type instead."))), /*#__PURE__*/React.createElement("div", {
|
|
26059
26059
|
className: "dropdown-placeholder"
|
|
26060
26060
|
}, /*#__PURE__*/React.createElement("input", {
|
|
26061
26061
|
type: "text",
|
|
26062
26062
|
placeholder: "Placeholder value",
|
|
26063
26063
|
value: this.props.placeholder,
|
|
26064
26064
|
onChange: this.onPlaceholderChange
|
|
26065
|
-
}), /*#__PURE__*/React.createElement(InfoTip$
|
|
26065
|
+
}), /*#__PURE__*/React.createElement(InfoTip$k, null, /*#__PURE__*/React.createElement("p", null, "This value will appear as the drop down default. It should give the user some indication of the values available in the drop down itself, e.g., Yes/No/Maybe."))), /*#__PURE__*/React.createElement("div", {
|
|
26066
26066
|
className: "clearfix"
|
|
26067
26067
|
}), /*#__PURE__*/React.createElement("ul", {
|
|
26068
26068
|
className: "dropdown-choices"
|
|
@@ -26593,7 +26593,7 @@ const SortableItem = createReactClass({
|
|
|
26593
26593
|
});
|
|
26594
26594
|
|
|
26595
26595
|
const {
|
|
26596
|
-
InfoTip: InfoTip$
|
|
26596
|
+
InfoTip: InfoTip$j,
|
|
26597
26597
|
PropCheckBox: PropCheckBox$a
|
|
26598
26598
|
} = components;
|
|
26599
26599
|
|
|
@@ -26847,11 +26847,11 @@ class ExpressionEditor extends React.Component {
|
|
|
26847
26847
|
onChange: this.props.onChange,
|
|
26848
26848
|
labelAlignment: "right",
|
|
26849
26849
|
label: "Use \xD7 for rendering multiplication instead of a center dot."
|
|
26850
|
-
}), /*#__PURE__*/React.createElement(InfoTip$
|
|
26850
|
+
}), /*#__PURE__*/React.createElement(InfoTip$j, null, /*#__PURE__*/React.createElement("p", null, "For pre-algebra problems this option displays multiplication as \\times instead of \\cdot in both the rendered output and the acceptable formats examples."))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", null, "Function variables: ", /*#__PURE__*/React.createElement("input", {
|
|
26851
26851
|
type: "text",
|
|
26852
26852
|
defaultValue: this.props.functions.join(" "),
|
|
26853
26853
|
onChange: this.handleFunctions
|
|
26854
|
-
})), /*#__PURE__*/React.createElement(InfoTip$
|
|
26854
|
+
})), /*#__PURE__*/React.createElement(InfoTip$j, null, /*#__PURE__*/React.createElement("p", null, "Single-letter variables listed here will be interpreted as functions. This let us know that f(x) means \"f of x\" and not \"f times x\"."))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, "Button sets:"), buttonSetChoices), /*#__PURE__*/React.createElement("h3", {
|
|
26855
26855
|
className: "expression-editor-h3"
|
|
26856
26856
|
}, "Answers"), /*#__PURE__*/React.createElement("p", {
|
|
26857
26857
|
style: {
|
|
@@ -26946,14 +26946,14 @@ class AnswerOption extends React.Component {
|
|
|
26946
26946
|
onChange: this.props.onChange,
|
|
26947
26947
|
labelAlignment: "right",
|
|
26948
26948
|
label: "Answer expression must have the same form."
|
|
26949
|
-
}), /*#__PURE__*/React.createElement(InfoTip$
|
|
26949
|
+
}), /*#__PURE__*/React.createElement(InfoTip$j, null, /*#__PURE__*/React.createElement("p", null, "The student's answer must be in the same form. Commutativity and excess negative signs are ignored."))), /*#__PURE__*/React.createElement("div", {
|
|
26950
26950
|
className: "answer-option"
|
|
26951
26951
|
}, /*#__PURE__*/React.createElement(PropCheckBox$a, {
|
|
26952
26952
|
simplify: this.props.simplify,
|
|
26953
26953
|
onChange: this.props.onChange,
|
|
26954
26954
|
labelAlignment: "right",
|
|
26955
26955
|
label: "Answer expression must be fully expanded and simplified."
|
|
26956
|
-
}), /*#__PURE__*/React.createElement(InfoTip$
|
|
26956
|
+
}), /*#__PURE__*/React.createElement(InfoTip$j, null, /*#__PURE__*/React.createElement("p", null, "The student's answer must be fully expanded and simplified. Answering this equation (x^2+2x+1) with this factored equation (x+1)^2 will render this response \"Your answer is not fully expanded and simplified.\""))), /*#__PURE__*/React.createElement("div", {
|
|
26957
26957
|
className: "remove-container"
|
|
26958
26958
|
}, removeButton)));
|
|
26959
26959
|
}
|
|
@@ -27010,10 +27010,10 @@ class GradedGroupEditor extends React.Component {
|
|
|
27010
27010
|
}, /*#__PURE__*/React.createElement("div", {
|
|
27011
27011
|
className: "perseus-widget-row"
|
|
27012
27012
|
}, /*#__PURE__*/React.createElement("label", {
|
|
27013
|
-
className: css(styles$
|
|
27013
|
+
className: css(styles$x.title)
|
|
27014
27014
|
}, "Title:", " ", /*#__PURE__*/React.createElement(TextInput$6, {
|
|
27015
27015
|
value: this.props.title,
|
|
27016
|
-
className: css(styles$
|
|
27016
|
+
className: css(styles$x.input)
|
|
27017
27017
|
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
27018
27018
|
,
|
|
27019
27019
|
onChange: this.change("title")
|
|
@@ -27038,7 +27038,7 @@ class GradedGroupEditor extends React.Component {
|
|
|
27038
27038
|
}, /*#__PURE__*/React.createElement(InlineIcon$4, iconPlus$1), " Add a hint"), this.props.hint && /*#__PURE__*/React.createElement("div", {
|
|
27039
27039
|
className: "perseus-hint-editor"
|
|
27040
27040
|
}, /*#__PURE__*/React.createElement("div", {
|
|
27041
|
-
className: css(styles$
|
|
27041
|
+
className: css(styles$x.hintsTitle)
|
|
27042
27042
|
}, "Hint"), /*#__PURE__*/React.createElement(Editor, {
|
|
27043
27043
|
ref: this.hintEditor,
|
|
27044
27044
|
content: this.props.hint ? this.props.hint.content : "",
|
|
@@ -27075,7 +27075,7 @@ GradedGroupEditor.defaultProps = {
|
|
|
27075
27075
|
images: {},
|
|
27076
27076
|
hint: null
|
|
27077
27077
|
};
|
|
27078
|
-
const styles$
|
|
27078
|
+
const styles$x = StyleSheet.create({
|
|
27079
27079
|
title: {
|
|
27080
27080
|
fontSize: 18,
|
|
27081
27081
|
fontWeight: "bold"
|
|
@@ -27153,7 +27153,7 @@ const setArrayItem = (list, i, value) => [...list.slice(0, i), value, ...list.sl
|
|
|
27153
27153
|
|
|
27154
27154
|
const {
|
|
27155
27155
|
ButtonGroup: ButtonGroup$4,
|
|
27156
|
-
InfoTip: InfoTip$
|
|
27156
|
+
InfoTip: InfoTip$i,
|
|
27157
27157
|
PropCheckBox: PropCheckBox$9,
|
|
27158
27158
|
RangeInput: RangeInput$6
|
|
27159
27159
|
} = components;
|
|
@@ -27609,7 +27609,7 @@ const GraphSettings = createReactClass({
|
|
|
27609
27609
|
},
|
|
27610
27610
|
onKeyPress: this.changeBackgroundUrl,
|
|
27611
27611
|
onBlur: this.changeBackgroundUrl
|
|
27612
|
-
}), /*#__PURE__*/React.createElement(InfoTip$
|
|
27612
|
+
}), /*#__PURE__*/React.createElement(InfoTip$i, null, /*#__PURE__*/React.createElement("p", null, "Create an image in graphie, or use the \"Add image\" function to create a background.")))), _.contains(this.props.editableSettings, "measure") && /*#__PURE__*/React.createElement("div", {
|
|
27613
27613
|
className: "misc-settings"
|
|
27614
27614
|
}, /*#__PURE__*/React.createElement("div", {
|
|
27615
27615
|
className: "perseus-widget-row"
|
|
@@ -27647,7 +27647,7 @@ const GraphSettings = createReactClass({
|
|
|
27647
27647
|
});
|
|
27648
27648
|
|
|
27649
27649
|
const {
|
|
27650
|
-
InfoTip: InfoTip$
|
|
27650
|
+
InfoTip: InfoTip$h,
|
|
27651
27651
|
MultiButtonGroup: MultiButtonGroup$1
|
|
27652
27652
|
} = components;
|
|
27653
27653
|
const {
|
|
@@ -27730,7 +27730,7 @@ class GrapherEditor extends React.Component {
|
|
|
27730
27730
|
className: "perseus-error"
|
|
27731
27731
|
}, this.props.graph.valid);
|
|
27732
27732
|
}
|
|
27733
|
-
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, "Correct answer", " ", /*#__PURE__*/React.createElement(InfoTip$
|
|
27733
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, "Correct answer", " ", /*#__PURE__*/React.createElement(InfoTip$h, null, /*#__PURE__*/React.createElement("p", null, "Graph the correct answer in the graph below and ensure the equation or point coordinates displayed represent the correct answer.")), " ", ": ", equationString), /*#__PURE__*/React.createElement(GraphSettings, {
|
|
27734
27734
|
editableSettings: ["graph", "snap", "image"],
|
|
27735
27735
|
box: getInteractiveBoxFromSizeClass$1(sizeClass),
|
|
27736
27736
|
range: this.props.graph.range,
|
|
@@ -27975,7 +27975,7 @@ IframeEditor.defaultProps = {
|
|
|
27975
27975
|
|
|
27976
27976
|
/* eslint-disable jsx-a11y/anchor-is-valid, react/sort-comp */
|
|
27977
27977
|
const {
|
|
27978
|
-
InfoTip: InfoTip$
|
|
27978
|
+
InfoTip: InfoTip$g,
|
|
27979
27979
|
InlineIcon: InlineIcon$3,
|
|
27980
27980
|
RangeInput: RangeInput$5
|
|
27981
27981
|
} = components;
|
|
@@ -28024,7 +28024,7 @@ class ImageEditor extends React.Component {
|
|
|
28024
28024
|
style: {
|
|
28025
28025
|
width: "100%"
|
|
28026
28026
|
}
|
|
28027
|
-
}))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", null, /*#__PURE__*/React.createElement("div", null, "Dimensions:"), /*#__PURE__*/React.createElement("p", null, backgroundImage.width, "x", backgroundImage.height))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", null, /*#__PURE__*/React.createElement("div", null, "Alt text:", /*#__PURE__*/React.createElement(InfoTip$
|
|
28027
|
+
}))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", null, /*#__PURE__*/React.createElement("div", null, "Dimensions:"), /*#__PURE__*/React.createElement("p", null, backgroundImage.width, "x", backgroundImage.height))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", null, /*#__PURE__*/React.createElement("div", null, "Alt text:", /*#__PURE__*/React.createElement(InfoTip$g, null, "This is important for screenreaders. The content of this alt text will be formatted as markdown (tables, emphasis, etc. are supported).")), /*#__PURE__*/React.createElement(Editor, {
|
|
28028
28028
|
apiOptions: this.props.apiOptions,
|
|
28029
28029
|
content: this.props.alt,
|
|
28030
28030
|
onChange: props => {
|
|
@@ -28048,7 +28048,7 @@ class ImageEditor extends React.Component {
|
|
|
28048
28048
|
}, this.state.backgroundImageError);
|
|
28049
28049
|
return /*#__PURE__*/React.createElement("div", {
|
|
28050
28050
|
className: "perseus-image-editor"
|
|
28051
|
-
}, /*#__PURE__*/React.createElement("label", null, "Image url:", /*#__PURE__*/React.createElement(InfoTip$
|
|
28051
|
+
}, /*#__PURE__*/React.createElement("label", null, "Image url:", /*#__PURE__*/React.createElement(InfoTip$g, null, "Paste an image or graphie image URL."), this.state.backgroundImageError && backgroundImageErrorText, /*#__PURE__*/React.createElement(BlurInput, {
|
|
28052
28052
|
value: backgroundImage.url || "",
|
|
28053
28053
|
style: {
|
|
28054
28054
|
width: 332
|
|
@@ -28212,7 +28212,7 @@ ImageEditor.defaultProps = {
|
|
|
28212
28212
|
|
|
28213
28213
|
/* eslint-disable react/sort-comp */
|
|
28214
28214
|
const {
|
|
28215
|
-
InfoTip: InfoTip$
|
|
28215
|
+
InfoTip: InfoTip$f
|
|
28216
28216
|
} = components;
|
|
28217
28217
|
const answerTypes = {
|
|
28218
28218
|
number: {
|
|
@@ -28298,7 +28298,7 @@ class InputNumberEditor extends React.Component {
|
|
|
28298
28298
|
value: "optional"
|
|
28299
28299
|
}, "will be accepted"), /*#__PURE__*/React.createElement("option", {
|
|
28300
28300
|
value: "enforced"
|
|
28301
|
-
}, "will be marked wrong"))), /*#__PURE__*/React.createElement(InfoTip$
|
|
28301
|
+
}, "will be marked wrong"))), /*#__PURE__*/React.createElement(InfoTip$f, null, /*#__PURE__*/React.createElement("p", null, "Normally select \"will not be graded\". 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 anything after)"), /*#__PURE__*/React.createElement("p", null, "Select \"will be accepted\" only if the user is not expected to know how to simplify fractions yet. (Anything prior to 5th grade)"), /*#__PURE__*/React.createElement("p", null, "Select \"will be marked wrong\" only if we are specifically assessing the ability to simplify."))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", null, /*#__PURE__*/React.createElement("input", {
|
|
28302
28302
|
type: "checkbox",
|
|
28303
28303
|
checked: this.props.inexact,
|
|
28304
28304
|
onChange: e => {
|
|
@@ -28334,7 +28334,7 @@ class InputNumberEditor extends React.Component {
|
|
|
28334
28334
|
});
|
|
28335
28335
|
},
|
|
28336
28336
|
"aria-label": "Answer type"
|
|
28337
|
-
}, answerTypeOptions), /*#__PURE__*/React.createElement(InfoTip$
|
|
28337
|
+
}, answerTypeOptions), /*#__PURE__*/React.createElement(InfoTip$f, null, /*#__PURE__*/React.createElement("p", null, "Use the default \"Numbers\" unless the answer must be in a specific form (e.g., question is about converting decimals to fractions)."))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", null, "Width", " ", /*#__PURE__*/React.createElement("select", {
|
|
28338
28338
|
value: this.props.size,
|
|
28339
28339
|
onChange: e => {
|
|
28340
28340
|
// @ts-expect-error - TS2322 - Type 'string' is not assignable to type '"small" | "normal" | undefined'.
|
|
@@ -28346,7 +28346,7 @@ class InputNumberEditor extends React.Component {
|
|
|
28346
28346
|
value: "normal"
|
|
28347
28347
|
}, "Normal (80px)"), /*#__PURE__*/React.createElement("option", {
|
|
28348
28348
|
value: "small"
|
|
28349
|
-
}, "Small (40px)"))), /*#__PURE__*/React.createElement(InfoTip$
|
|
28349
|
+
}, "Small (40px)"))), /*#__PURE__*/React.createElement(InfoTip$f, null, /*#__PURE__*/React.createElement("p", null, "Use size \"Normal\" for all text boxes, unless there are multiple text boxes in one line and the answer area is too narrow to fit them."))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", null, /*#__PURE__*/React.createElement("input", {
|
|
28350
28350
|
type: "checkbox",
|
|
28351
28351
|
checked: this.props.rightAlign,
|
|
28352
28352
|
onChange: e => {
|
|
@@ -28414,13 +28414,13 @@ function MathquillInput(props) {
|
|
|
28414
28414
|
}
|
|
28415
28415
|
});
|
|
28416
28416
|
return /*#__PURE__*/React.createElement(View, {
|
|
28417
|
-
style: styles$
|
|
28417
|
+
style: styles$w.outerWrapper
|
|
28418
28418
|
}, /*#__PURE__*/React.createElement("span", {
|
|
28419
28419
|
ref: mathFieldWrapperRef,
|
|
28420
28420
|
className: "perseus-math-input mq-editable-field mq-math-mode"
|
|
28421
28421
|
}));
|
|
28422
28422
|
}
|
|
28423
|
-
const styles$
|
|
28423
|
+
const styles$w = StyleSheet.create({
|
|
28424
28424
|
outerWrapper: {
|
|
28425
28425
|
display: "inline-block",
|
|
28426
28426
|
borderStyle: "solid",
|
|
@@ -29481,7 +29481,7 @@ const GraphPointsCountSelector = ({
|
|
|
29481
29481
|
// Never uses placeholder, always has value
|
|
29482
29482
|
,
|
|
29483
29483
|
placeholder: "",
|
|
29484
|
-
style: styles$
|
|
29484
|
+
style: styles$v.singleSelectShort
|
|
29485
29485
|
}, [...[...Array(7).keys()].map(n => /*#__PURE__*/React.createElement(OptionItem, {
|
|
29486
29486
|
key: n,
|
|
29487
29487
|
value: `${n}`,
|
|
@@ -29492,7 +29492,7 @@ const GraphPointsCountSelector = ({
|
|
|
29492
29492
|
label: "unlimited"
|
|
29493
29493
|
})]);
|
|
29494
29494
|
};
|
|
29495
|
-
const styles$
|
|
29495
|
+
const styles$v = StyleSheet.create({
|
|
29496
29496
|
singleSelectShort: {
|
|
29497
29497
|
// Non-standard spacing, but it's the smallest we can go
|
|
29498
29498
|
// without running into styling issues with the dropdown.
|
|
@@ -29505,7 +29505,7 @@ const GraphTypeSelector = props => {
|
|
|
29505
29505
|
selectedValue: props.graphType,
|
|
29506
29506
|
onChange: props.onChange,
|
|
29507
29507
|
placeholder: "Select a graph type",
|
|
29508
|
-
style: styles$
|
|
29508
|
+
style: styles$u.singleSelectShort
|
|
29509
29509
|
}, /*#__PURE__*/React.createElement(OptionItem, {
|
|
29510
29510
|
value: "linear",
|
|
29511
29511
|
label: "Linear function"
|
|
@@ -29538,7 +29538,7 @@ const GraphTypeSelector = props => {
|
|
|
29538
29538
|
label: "Angle"
|
|
29539
29539
|
}));
|
|
29540
29540
|
};
|
|
29541
|
-
const styles$
|
|
29541
|
+
const styles$u = StyleSheet.create({
|
|
29542
29542
|
singleSelectShort: {
|
|
29543
29543
|
// Non-standard spacing, but it's the smallest we can go
|
|
29544
29544
|
// without running into styling issues with the dropdown.
|
|
@@ -29555,16 +29555,16 @@ const LabeledRow = props => {
|
|
|
29555
29555
|
style
|
|
29556
29556
|
} = props;
|
|
29557
29557
|
return /*#__PURE__*/React.createElement("label", {
|
|
29558
|
-
className: css(styles$
|
|
29558
|
+
className: css(styles$t.label)
|
|
29559
29559
|
}, /*#__PURE__*/React.createElement(View, {
|
|
29560
|
-
style: [styles$
|
|
29560
|
+
style: [styles$t.row, style]
|
|
29561
29561
|
}, labelSide === "start" || /*#__PURE__*/React.createElement(LabelSmall, {
|
|
29562
|
-
style: styles$
|
|
29562
|
+
style: styles$t.spaceEnd
|
|
29563
29563
|
}, label), children, labelSide === "end" && /*#__PURE__*/React.createElement(LabelSmall, {
|
|
29564
|
-
style: styles$
|
|
29564
|
+
style: styles$t.spaceStart
|
|
29565
29565
|
}, label)));
|
|
29566
29566
|
};
|
|
29567
|
-
const styles$
|
|
29567
|
+
const styles$t = StyleSheet.create({
|
|
29568
29568
|
label: {
|
|
29569
29569
|
width: "fit-content"
|
|
29570
29570
|
},
|
|
@@ -29584,7 +29584,7 @@ const styles$p = StyleSheet.create({
|
|
|
29584
29584
|
|
|
29585
29585
|
const {
|
|
29586
29586
|
ButtonGroup: ButtonGroup$2,
|
|
29587
|
-
InfoTip: InfoTip$
|
|
29587
|
+
InfoTip: InfoTip$e,
|
|
29588
29588
|
PropCheckBox: PropCheckBox$7,
|
|
29589
29589
|
RangeInput: RangeInput$4
|
|
29590
29590
|
} = components;
|
|
@@ -29990,10 +29990,10 @@ class InteractiveGraphSettings extends React.Component {
|
|
|
29990
29990
|
onChange: this.change
|
|
29991
29991
|
}))), /*#__PURE__*/React.createElement(LabeledRow, {
|
|
29992
29992
|
label: "Background image URL:",
|
|
29993
|
-
style: styles$
|
|
29993
|
+
style: styles$s.resetSpaceTop
|
|
29994
29994
|
}, /*#__PURE__*/React.createElement("input", {
|
|
29995
29995
|
type: "text",
|
|
29996
|
-
className: css(styles$
|
|
29996
|
+
className: css(styles$s.backgroundUrlInput),
|
|
29997
29997
|
ref: this.bgUrlRef,
|
|
29998
29998
|
value: this.state.backgroundImage.url || "",
|
|
29999
29999
|
onChange: e => {
|
|
@@ -30006,29 +30006,29 @@ class InteractiveGraphSettings extends React.Component {
|
|
|
30006
30006
|
},
|
|
30007
30007
|
onKeyPress: this.changeBackgroundUrl,
|
|
30008
30008
|
onBlur: this.changeBackgroundUrl
|
|
30009
|
-
}), /*#__PURE__*/React.createElement(InfoTip$
|
|
30010
|
-
style: styles$
|
|
30009
|
+
}), /*#__PURE__*/React.createElement(InfoTip$e, null, /*#__PURE__*/React.createElement("p", null, "Create an image in graphie, or use the \"Add image\" function to create a background."))), /*#__PURE__*/React.createElement(View, {
|
|
30010
|
+
style: styles$s.rulerSection
|
|
30011
30011
|
}, /*#__PURE__*/React.createElement(View, {
|
|
30012
|
-
style: styles$
|
|
30012
|
+
style: styles$s.checkboxRow
|
|
30013
30013
|
}, /*#__PURE__*/React.createElement(PropCheckBox$7, {
|
|
30014
30014
|
label: "Show ruler",
|
|
30015
30015
|
showRuler: this.props.showRuler,
|
|
30016
30016
|
onChange: this.change,
|
|
30017
|
-
style: styles$
|
|
30017
|
+
style: styles$s.resetSpaceTop
|
|
30018
30018
|
}), /*#__PURE__*/React.createElement(PropCheckBox$7, {
|
|
30019
30019
|
label: "Show protractor",
|
|
30020
30020
|
showProtractor: this.props.showProtractor,
|
|
30021
30021
|
onChange: this.change,
|
|
30022
|
-
style: styles$
|
|
30022
|
+
style: styles$s.resetSpaceTop
|
|
30023
30023
|
})), (this.props.showRuler || this.props.showProtractor) && /*#__PURE__*/React.createElement(Banner, {
|
|
30024
30024
|
layout: "floating",
|
|
30025
30025
|
text: "The ruler and protractor are not accessible. Please consider an alternate approach.",
|
|
30026
30026
|
kind: "warning"
|
|
30027
30027
|
}), this.props.showRuler && /*#__PURE__*/React.createElement(View, {
|
|
30028
|
-
style: styles$
|
|
30028
|
+
style: styles$s.spaceTop
|
|
30029
30029
|
}, /*#__PURE__*/React.createElement(LabeledRow, {
|
|
30030
30030
|
label: "Ruler label:",
|
|
30031
|
-
style: styles$
|
|
30031
|
+
style: styles$s.resetSpaceTop
|
|
30032
30032
|
}, /*#__PURE__*/React.createElement(SingleSelect, {
|
|
30033
30033
|
id: "ruler-label-select",
|
|
30034
30034
|
selectedValue: this.props.rulerLabel,
|
|
@@ -30038,7 +30038,7 @@ class InteractiveGraphSettings extends React.Component {
|
|
|
30038
30038
|
});
|
|
30039
30039
|
},
|
|
30040
30040
|
placeholder: "None",
|
|
30041
|
-
style: styles$
|
|
30041
|
+
style: styles$s.singleSelectShort
|
|
30042
30042
|
}, /*#__PURE__*/React.createElement(OptionItem, {
|
|
30043
30043
|
value: "",
|
|
30044
30044
|
label: "None",
|
|
@@ -30079,7 +30079,7 @@ class InteractiveGraphSettings extends React.Component {
|
|
|
30079
30079
|
});
|
|
30080
30080
|
},
|
|
30081
30081
|
placeholder: "10",
|
|
30082
|
-
style: styles$
|
|
30082
|
+
style: styles$s.singleSelectShort
|
|
30083
30083
|
}, [1, 2, 4, 8, 10, 16].map(value => /*#__PURE__*/React.createElement(OptionItem, {
|
|
30084
30084
|
key: value,
|
|
30085
30085
|
value: `${value}`,
|
|
@@ -30103,7 +30103,7 @@ InteractiveGraphSettings.defaultProps = {
|
|
|
30103
30103
|
rulerLabel: "",
|
|
30104
30104
|
rulerTicks: 10
|
|
30105
30105
|
};
|
|
30106
|
-
const styles$
|
|
30106
|
+
const styles$s = StyleSheet.create({
|
|
30107
30107
|
resetSpaceTop: {
|
|
30108
30108
|
marginTop: 0
|
|
30109
30109
|
},
|
|
@@ -30227,22 +30227,19 @@ const LockedFigureSelect = props => {
|
|
|
30227
30227
|
id,
|
|
30228
30228
|
onChange
|
|
30229
30229
|
} = props;
|
|
30230
|
+
const figureTypes = props.showM2Features ? ["point", "line", "ellipse", "vector"] : ["point", "line"];
|
|
30230
30231
|
return /*#__PURE__*/React.createElement(View, {
|
|
30231
|
-
style: styles$
|
|
30232
|
+
style: styles$r.container
|
|
30232
30233
|
}, /*#__PURE__*/React.createElement(ActionMenu, {
|
|
30233
30234
|
menuText: "Add locked figure",
|
|
30234
|
-
style: styles$
|
|
30235
|
-
},
|
|
30236
|
-
key: `${id}
|
|
30237
|
-
label:
|
|
30238
|
-
onClick: () => onChange(
|
|
30239
|
-
},
|
|
30240
|
-
key: `${id}-line`,
|
|
30241
|
-
label: "Line",
|
|
30242
|
-
onClick: () => onChange("line")
|
|
30243
|
-
}, "Line")]));
|
|
30235
|
+
style: styles$r.addElementSelect
|
|
30236
|
+
}, figureTypes.map(figureType => /*#__PURE__*/React.createElement(ActionItem, {
|
|
30237
|
+
key: `${id}-${figureType}`,
|
|
30238
|
+
label: figureType,
|
|
30239
|
+
onClick: () => onChange(figureType)
|
|
30240
|
+
}, figureType))));
|
|
30244
30241
|
};
|
|
30245
|
-
const styles$
|
|
30242
|
+
const styles$r = StyleSheet.create({
|
|
30246
30243
|
container: {
|
|
30247
30244
|
marginTop: spacing.xSmall_8
|
|
30248
30245
|
},
|
|
@@ -30252,6 +30249,79 @@ const styles$n = StyleSheet.create({
|
|
|
30252
30249
|
}
|
|
30253
30250
|
});
|
|
30254
30251
|
|
|
30252
|
+
const {
|
|
30253
|
+
InfoTip: InfoTip$d
|
|
30254
|
+
} = components;
|
|
30255
|
+
const degreeToRadian = degrees => {
|
|
30256
|
+
return degrees / 180 * Math.PI;
|
|
30257
|
+
};
|
|
30258
|
+
const AngleInput = props => {
|
|
30259
|
+
const {
|
|
30260
|
+
angle,
|
|
30261
|
+
onChange
|
|
30262
|
+
} = props;
|
|
30263
|
+
const [angleInput, setAngleInput] = React.useState(angle.toString());
|
|
30264
|
+
const [isInDegrees, setIsInDegrees] = React.useState(false);
|
|
30265
|
+
function handleAngleChange(newValue, useDegrees = isInDegrees) {
|
|
30266
|
+
// Update the local state (update the input field value).
|
|
30267
|
+
setAngleInput(newValue);
|
|
30268
|
+
try {
|
|
30269
|
+
// If the new value is a valid expression, update the props.
|
|
30270
|
+
// Save the angle in radians.
|
|
30271
|
+
const evaluatedAngle = KAS.parse(newValue).expr.eval();
|
|
30272
|
+
if (useDegrees) {
|
|
30273
|
+
onChange(degreeToRadian(evaluatedAngle));
|
|
30274
|
+
} else {
|
|
30275
|
+
onChange(evaluatedAngle);
|
|
30276
|
+
}
|
|
30277
|
+
} catch (e) {
|
|
30278
|
+
// The user likely has not finished typing the expression.
|
|
30279
|
+
// Do nothing.
|
|
30280
|
+
return;
|
|
30281
|
+
}
|
|
30282
|
+
}
|
|
30283
|
+
function handleAngleTypeChange() {
|
|
30284
|
+
// Change the angle based on the new angle type.
|
|
30285
|
+
handleAngleChange(angleInput, !isInDegrees);
|
|
30286
|
+
|
|
30287
|
+
// Update the angle to the new type.
|
|
30288
|
+
setIsInDegrees(usingDegrees => !usingDegrees);
|
|
30289
|
+
}
|
|
30290
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
30291
|
+
style: [styles$q.row, styles$q.spaceUnder]
|
|
30292
|
+
}, /*#__PURE__*/React.createElement(LabelMedium, {
|
|
30293
|
+
tag: "label",
|
|
30294
|
+
style: styles$q.row
|
|
30295
|
+
}, "angle", /*#__PURE__*/React.createElement(Strut, {
|
|
30296
|
+
size: spacing.xxSmall_6
|
|
30297
|
+
}), /*#__PURE__*/React.createElement(TextField, {
|
|
30298
|
+
value: angleInput,
|
|
30299
|
+
onChange: handleAngleChange,
|
|
30300
|
+
style: styles$q.textField
|
|
30301
|
+
})), /*#__PURE__*/React.createElement(Strut, {
|
|
30302
|
+
size: spacing.xxSmall_6
|
|
30303
|
+
}), /*#__PURE__*/React.createElement(LabelSmall, null, "radians"), /*#__PURE__*/React.createElement(View, {
|
|
30304
|
+
style: styles$q.switch
|
|
30305
|
+
}, /*#__PURE__*/React.createElement(Switch, {
|
|
30306
|
+
onChange: handleAngleTypeChange,
|
|
30307
|
+
checked: isInDegrees
|
|
30308
|
+
})), /*#__PURE__*/React.createElement(LabelSmall, null, "degrees"), /*#__PURE__*/React.createElement(InfoTip$d, null, /*#__PURE__*/React.createElement("p", null, "The angle of rotation for the ellipse (if the x radius and y radius are different)."), /*#__PURE__*/React.createElement("p", null, "Expressions will be evaluted (e.g. \"pi/2\" or \"5pi/4\").")));
|
|
30309
|
+
};
|
|
30310
|
+
const styles$q = StyleSheet.create({
|
|
30311
|
+
row: {
|
|
30312
|
+
display: "flex",
|
|
30313
|
+
flexDirection: "row",
|
|
30314
|
+
alignItems: "center"
|
|
30315
|
+
},
|
|
30316
|
+
switch: {
|
|
30317
|
+
marginLeft: spacing.xxSmall_6,
|
|
30318
|
+
marginRight: spacing.xxSmall_6
|
|
30319
|
+
},
|
|
30320
|
+
textField: {
|
|
30321
|
+
maxWidth: spacing.xxxLarge_64
|
|
30322
|
+
}
|
|
30323
|
+
});
|
|
30324
|
+
|
|
30255
30325
|
const ColorSwatch = props => {
|
|
30256
30326
|
const {
|
|
30257
30327
|
color: color$1,
|
|
@@ -30262,13 +30332,13 @@ const ColorSwatch = props => {
|
|
|
30262
30332
|
"aria-label":
|
|
30263
30333
|
// Don't include an aria label for decorative circles.
|
|
30264
30334
|
!decorative ? `${color$1}, ${filled ? "filled" : "open"}` : undefined,
|
|
30265
|
-
style: [styles$
|
|
30335
|
+
style: [styles$p.colorSwatch, {
|
|
30266
30336
|
border: `4px solid ${lockedFigureColors[color$1]}`,
|
|
30267
30337
|
backgroundColor: filled ? lockedFigureColors[color$1] : color.white
|
|
30268
30338
|
}]
|
|
30269
30339
|
});
|
|
30270
30340
|
};
|
|
30271
|
-
const styles$
|
|
30341
|
+
const styles$p = StyleSheet.create({
|
|
30272
30342
|
colorSwatch: {
|
|
30273
30343
|
// Add a white outline so that the color swatch is visible when
|
|
30274
30344
|
// the dropdown option is highlighted with its blue background.
|
|
@@ -30286,16 +30356,14 @@ const ColorSelect = props => {
|
|
|
30286
30356
|
style,
|
|
30287
30357
|
onChange
|
|
30288
30358
|
} = props;
|
|
30289
|
-
const ids = useUniqueIdWithMock();
|
|
30290
|
-
const id = ids.get("color-select");
|
|
30291
30359
|
return /*#__PURE__*/React.createElement(View, {
|
|
30292
|
-
style: [styles$
|
|
30360
|
+
style: [styles$o.row, style]
|
|
30293
30361
|
}, /*#__PURE__*/React.createElement(LabelMedium, {
|
|
30294
|
-
|
|
30295
|
-
style: styles$
|
|
30296
|
-
|
|
30297
|
-
|
|
30298
|
-
|
|
30362
|
+
tag: "label",
|
|
30363
|
+
style: styles$o.row
|
|
30364
|
+
}, "color", /*#__PURE__*/React.createElement(Strut, {
|
|
30365
|
+
size: spacing.xxSmall_6
|
|
30366
|
+
}), /*#__PURE__*/React.createElement(SingleSelect, {
|
|
30299
30367
|
selectedValue: selectedValue,
|
|
30300
30368
|
onChange: onChange
|
|
30301
30369
|
// Placeholder is required, but never gets used.
|
|
@@ -30309,23 +30377,22 @@ const ColorSelect = props => {
|
|
|
30309
30377
|
color: colorName,
|
|
30310
30378
|
decorative: true
|
|
30311
30379
|
})
|
|
30312
|
-
}, colorName))));
|
|
30380
|
+
}, colorName)))));
|
|
30313
30381
|
};
|
|
30314
|
-
const styles$
|
|
30382
|
+
const styles$o = StyleSheet.create({
|
|
30315
30383
|
row: {
|
|
30384
|
+
display: "flex",
|
|
30316
30385
|
flexDirection: "row",
|
|
30317
30386
|
alignItems: "center"
|
|
30318
|
-
},
|
|
30319
|
-
label: {
|
|
30320
|
-
marginInlineEnd: spacing.xxxSmall_4
|
|
30321
30387
|
}
|
|
30322
30388
|
});
|
|
30323
30389
|
|
|
30324
30390
|
const CoordinatePairInput = props => {
|
|
30325
30391
|
const {
|
|
30326
30392
|
coord,
|
|
30393
|
+
labels,
|
|
30327
30394
|
error,
|
|
30328
|
-
|
|
30395
|
+
onChange
|
|
30329
30396
|
} = props;
|
|
30330
30397
|
|
|
30331
30398
|
// Keep track of the coordinates via state as the user is editing them,
|
|
@@ -30333,12 +30400,6 @@ const CoordinatePairInput = props => {
|
|
|
30333
30400
|
const [coordState, setCoordState] = React.useState([
|
|
30334
30401
|
// Using strings to make it easier to work with the text fields.
|
|
30335
30402
|
coord[0].toString(), coord[1].toString()]);
|
|
30336
|
-
|
|
30337
|
-
// Generate unique IDs so that the programmatic labels can be associated
|
|
30338
|
-
// with their respective text fields.
|
|
30339
|
-
const ids = useUniqueIdWithMock();
|
|
30340
|
-
const xCoordId = ids.get("x-coord");
|
|
30341
|
-
const yCoordId = ids.get("y-coord");
|
|
30342
30403
|
function handleCoordChange(newValue, coordIndex) {
|
|
30343
30404
|
// Update the local state (update the input field value).
|
|
30344
30405
|
const newCoordState = [...coordState];
|
|
@@ -30354,47 +30415,43 @@ const CoordinatePairInput = props => {
|
|
|
30354
30415
|
// Update the props (update the graph).
|
|
30355
30416
|
const newCoords = [...coord];
|
|
30356
30417
|
newCoords[coordIndex] = +newValue;
|
|
30357
|
-
|
|
30358
|
-
coord: newCoords
|
|
30359
|
-
});
|
|
30418
|
+
onChange(newCoords);
|
|
30360
30419
|
}
|
|
30361
30420
|
return /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(View, {
|
|
30362
|
-
style: [styles$
|
|
30421
|
+
style: [styles$n.row, styles$n.spaceUnder]
|
|
30363
30422
|
}, /*#__PURE__*/React.createElement(LabelMedium, {
|
|
30364
|
-
|
|
30365
|
-
style: styles$
|
|
30366
|
-
|
|
30367
|
-
|
|
30368
|
-
|
|
30423
|
+
tag: "label",
|
|
30424
|
+
style: styles$n.row
|
|
30425
|
+
}, labels ? labels[0] : "x coord", /*#__PURE__*/React.createElement(Strut, {
|
|
30426
|
+
size: spacing.xxSmall_6
|
|
30427
|
+
}), /*#__PURE__*/React.createElement(TextField, {
|
|
30369
30428
|
type: "number",
|
|
30370
30429
|
value: coordState[0],
|
|
30371
30430
|
onChange: newValue => handleCoordChange(newValue, 0),
|
|
30372
|
-
style: [styles$
|
|
30373
|
-
}), /*#__PURE__*/React.createElement(Strut, {
|
|
30431
|
+
style: [styles$n.textField, error ? styles$n.errorField : undefined]
|
|
30432
|
+
})), /*#__PURE__*/React.createElement(Strut, {
|
|
30374
30433
|
size: spacing.medium_16
|
|
30375
30434
|
}), /*#__PURE__*/React.createElement(LabelMedium, {
|
|
30376
|
-
|
|
30377
|
-
style: styles$
|
|
30378
|
-
|
|
30379
|
-
|
|
30380
|
-
|
|
30435
|
+
tag: "label",
|
|
30436
|
+
style: styles$n.row
|
|
30437
|
+
}, labels ? labels[1] : "y coord", /*#__PURE__*/React.createElement(Strut, {
|
|
30438
|
+
size: spacing.xxSmall_6
|
|
30439
|
+
}), /*#__PURE__*/React.createElement(TextField, {
|
|
30381
30440
|
type: "number",
|
|
30382
30441
|
value: coordState[1],
|
|
30383
30442
|
onChange: newValue => handleCoordChange(newValue, 1),
|
|
30384
|
-
style: [styles$
|
|
30385
|
-
})));
|
|
30443
|
+
style: [styles$n.textField, error ? styles$n.errorField : undefined]
|
|
30444
|
+
}))));
|
|
30386
30445
|
};
|
|
30387
|
-
const styles$
|
|
30446
|
+
const styles$n = StyleSheet.create({
|
|
30388
30447
|
row: {
|
|
30448
|
+
display: "flex",
|
|
30389
30449
|
flexDirection: "row",
|
|
30390
30450
|
alignItems: "center"
|
|
30391
30451
|
},
|
|
30392
30452
|
spaceUnder: {
|
|
30393
30453
|
marginBottom: spacing.xSmall_8
|
|
30394
30454
|
},
|
|
30395
|
-
label: {
|
|
30396
|
-
marginInlineEnd: spacing.xxSmall_6
|
|
30397
|
-
},
|
|
30398
30455
|
textField: {
|
|
30399
30456
|
width: spacing.xxxLarge_64
|
|
30400
30457
|
},
|
|
@@ -30404,32 +30461,40 @@ const styles$k = StyleSheet.create({
|
|
|
30404
30461
|
}
|
|
30405
30462
|
});
|
|
30406
30463
|
|
|
30407
|
-
const
|
|
30464
|
+
const EllipseSwatch = props => {
|
|
30408
30465
|
const {
|
|
30409
|
-
|
|
30410
|
-
|
|
30411
|
-
|
|
30412
|
-
onChange
|
|
30466
|
+
color,
|
|
30467
|
+
fillStyle,
|
|
30468
|
+
strokeStyle
|
|
30413
30469
|
} = props;
|
|
30414
|
-
const ids = useUniqueIdWithMock();
|
|
30415
|
-
const switchId = ids.get("switch");
|
|
30416
30470
|
return /*#__PURE__*/React.createElement(View, {
|
|
30417
|
-
|
|
30418
|
-
|
|
30419
|
-
|
|
30420
|
-
|
|
30421
|
-
|
|
30422
|
-
|
|
30423
|
-
|
|
30424
|
-
|
|
30425
|
-
|
|
30426
|
-
|
|
30427
|
-
}, label));
|
|
30471
|
+
"aria-label": `${color}, stroke ${strokeStyle}, fill ${fillStyle}`,
|
|
30472
|
+
style: [styles$m.container, {
|
|
30473
|
+
border: `4px ${strokeStyle} ${lockedFigureColors[color]}`
|
|
30474
|
+
}]
|
|
30475
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
30476
|
+
style: [styles$m.innerCircle, {
|
|
30477
|
+
backgroundColor: lockedFigureColors[color],
|
|
30478
|
+
opacity: lockedEllipseFillStyles[fillStyle]
|
|
30479
|
+
}]
|
|
30480
|
+
}));
|
|
30428
30481
|
};
|
|
30429
|
-
const styles$
|
|
30430
|
-
|
|
30431
|
-
|
|
30432
|
-
|
|
30482
|
+
const styles$m = StyleSheet.create({
|
|
30483
|
+
container: {
|
|
30484
|
+
// Add a white outline so that the color swatch is visible when
|
|
30485
|
+
// the dropdown option is highlighted with its blue background.
|
|
30486
|
+
outline: `2px solid ${color.offWhite}`,
|
|
30487
|
+
borderRadius: "50%",
|
|
30488
|
+
width: spacing.xLarge_32,
|
|
30489
|
+
height: spacing.large_24,
|
|
30490
|
+
backgroundColor: color.white,
|
|
30491
|
+
alignItems: "center",
|
|
30492
|
+
justifyContent: "center"
|
|
30493
|
+
},
|
|
30494
|
+
innerCircle: {
|
|
30495
|
+
width: 28,
|
|
30496
|
+
height: 20,
|
|
30497
|
+
borderRadius: "50%"
|
|
30433
30498
|
}
|
|
30434
30499
|
});
|
|
30435
30500
|
|
|
@@ -30451,14 +30516,14 @@ const LockedFigureSettingsAccordion = props => {
|
|
|
30451
30516
|
}, /*#__PURE__*/React.createElement(AccordionSection, {
|
|
30452
30517
|
expanded: expanded,
|
|
30453
30518
|
onToggle: onToggle,
|
|
30454
|
-
style: [styles$
|
|
30455
|
-
headerStyle: styles$
|
|
30519
|
+
style: [styles$l.container, containerStyle],
|
|
30520
|
+
headerStyle: styles$l.accordionHeader,
|
|
30456
30521
|
header: header
|
|
30457
30522
|
}, /*#__PURE__*/React.createElement(View, {
|
|
30458
|
-
style: [styles$
|
|
30523
|
+
style: [styles$l.accordionPanel, panelStyle]
|
|
30459
30524
|
}, children)));
|
|
30460
30525
|
};
|
|
30461
|
-
const styles$
|
|
30526
|
+
const styles$l = StyleSheet.create({
|
|
30462
30527
|
container: {
|
|
30463
30528
|
backgroundColor: color.fadedBlue8,
|
|
30464
30529
|
marginTop: spacing.xSmall_8
|
|
@@ -30479,6 +30544,185 @@ const styles$i = StyleSheet.create({
|
|
|
30479
30544
|
}
|
|
30480
30545
|
});
|
|
30481
30546
|
|
|
30547
|
+
/**
|
|
30548
|
+
* The part of a locked figure settings panel that contains actions
|
|
30549
|
+
* for this panel and its associated locked figure, including
|
|
30550
|
+
* the delete button.
|
|
30551
|
+
*/
|
|
30552
|
+
const LockedFigureSettingsActions = props => {
|
|
30553
|
+
const {
|
|
30554
|
+
onRemove,
|
|
30555
|
+
figureAriaLabel
|
|
30556
|
+
} = props;
|
|
30557
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
30558
|
+
style: styles$k.container
|
|
30559
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
30560
|
+
startIcon: trashIcon,
|
|
30561
|
+
"aria-label": `Delete ${figureAriaLabel}`,
|
|
30562
|
+
onClick: onRemove,
|
|
30563
|
+
kind: "tertiary",
|
|
30564
|
+
style: styles$k.deleteButton
|
|
30565
|
+
}, "Delete"));
|
|
30566
|
+
};
|
|
30567
|
+
const styles$k = StyleSheet.create({
|
|
30568
|
+
container: {
|
|
30569
|
+
width: "100%",
|
|
30570
|
+
flexDirection: "row",
|
|
30571
|
+
alignItems: "center",
|
|
30572
|
+
marginTop: spacing.xxxSmall_4
|
|
30573
|
+
},
|
|
30574
|
+
deleteButton: {
|
|
30575
|
+
// Line up the delete icon with the rest of the content.
|
|
30576
|
+
marginInlineStart: -spacing.xxxSmall_4
|
|
30577
|
+
}
|
|
30578
|
+
});
|
|
30579
|
+
|
|
30580
|
+
const {
|
|
30581
|
+
InfoTip: InfoTip$c
|
|
30582
|
+
} = components;
|
|
30583
|
+
const LockedEllipseSettings = props => {
|
|
30584
|
+
const {
|
|
30585
|
+
center,
|
|
30586
|
+
radius,
|
|
30587
|
+
angle,
|
|
30588
|
+
color,
|
|
30589
|
+
fillStyle,
|
|
30590
|
+
strokeStyle,
|
|
30591
|
+
expanded,
|
|
30592
|
+
onToggle,
|
|
30593
|
+
onChangeProps,
|
|
30594
|
+
onRemove
|
|
30595
|
+
} = props;
|
|
30596
|
+
function handleColorChange(newValue) {
|
|
30597
|
+
onChangeProps({
|
|
30598
|
+
color: newValue
|
|
30599
|
+
});
|
|
30600
|
+
}
|
|
30601
|
+
return /*#__PURE__*/React.createElement(LockedFigureSettingsAccordion, {
|
|
30602
|
+
expanded: expanded,
|
|
30603
|
+
onToggle: onToggle,
|
|
30604
|
+
header:
|
|
30605
|
+
/*#__PURE__*/
|
|
30606
|
+
// Summary: Ellipse, center, radius, color (opacity, dashed)
|
|
30607
|
+
React.createElement(View, {
|
|
30608
|
+
style: styles$j.row
|
|
30609
|
+
}, /*#__PURE__*/React.createElement(LabelLarge, null, `Ellipse (${center[0]}, ${center[1]}), radius ${radius[0]}, ${radius[1]}`), /*#__PURE__*/React.createElement(Strut, {
|
|
30610
|
+
size: spacing.xSmall_8
|
|
30611
|
+
}), /*#__PURE__*/React.createElement(EllipseSwatch, {
|
|
30612
|
+
color: props.color,
|
|
30613
|
+
fillStyle: fillStyle,
|
|
30614
|
+
strokeStyle: strokeStyle
|
|
30615
|
+
}))
|
|
30616
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
30617
|
+
style: styles$j.row
|
|
30618
|
+
}, /*#__PURE__*/React.createElement(CoordinatePairInput, {
|
|
30619
|
+
coord: center,
|
|
30620
|
+
onChange: newCoords => onChangeProps({
|
|
30621
|
+
center: newCoords
|
|
30622
|
+
})
|
|
30623
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
30624
|
+
style: styles$j.spaceUnder
|
|
30625
|
+
}, /*#__PURE__*/React.createElement(InfoTip$c, null, "The coordinates for the center of the ellipse."))), /*#__PURE__*/React.createElement(CoordinatePairInput, {
|
|
30626
|
+
coord: radius,
|
|
30627
|
+
labels: ["x radius", "y radius"],
|
|
30628
|
+
onChange: newCoords => onChangeProps({
|
|
30629
|
+
radius: newCoords
|
|
30630
|
+
})
|
|
30631
|
+
}), /*#__PURE__*/React.createElement(AngleInput, {
|
|
30632
|
+
angle: angle,
|
|
30633
|
+
onChange: newAngle => onChangeProps({
|
|
30634
|
+
angle: newAngle
|
|
30635
|
+
})
|
|
30636
|
+
}), /*#__PURE__*/React.createElement(Strut, {
|
|
30637
|
+
size: spacing.xSmall_8
|
|
30638
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
30639
|
+
style: [styles$j.row, styles$j.spaceUnder]
|
|
30640
|
+
}, /*#__PURE__*/React.createElement(ColorSelect, {
|
|
30641
|
+
selectedValue: color,
|
|
30642
|
+
onChange: handleColorChange
|
|
30643
|
+
}), /*#__PURE__*/React.createElement(Strut, {
|
|
30644
|
+
size: spacing.medium_16
|
|
30645
|
+
}), /*#__PURE__*/React.createElement(LabelMedium, {
|
|
30646
|
+
tag: "label",
|
|
30647
|
+
style: styles$j.row
|
|
30648
|
+
}, "fill", /*#__PURE__*/React.createElement(Strut, {
|
|
30649
|
+
size: spacing.xxSmall_6
|
|
30650
|
+
}), /*#__PURE__*/React.createElement(SingleSelect, {
|
|
30651
|
+
selectedValue: fillStyle,
|
|
30652
|
+
onChange: value => onChangeProps({
|
|
30653
|
+
fillStyle: value
|
|
30654
|
+
})
|
|
30655
|
+
// Placeholder is required, but never gets used.
|
|
30656
|
+
,
|
|
30657
|
+
placeholder: ""
|
|
30658
|
+
}, Object.keys(lockedEllipseFillStyles).map(option => /*#__PURE__*/React.createElement(OptionItem, {
|
|
30659
|
+
key: option,
|
|
30660
|
+
value: option,
|
|
30661
|
+
label: option
|
|
30662
|
+
}, option))))), /*#__PURE__*/React.createElement(LabelMedium, {
|
|
30663
|
+
tag: "label",
|
|
30664
|
+
style: styles$j.row
|
|
30665
|
+
}, "stroke", /*#__PURE__*/React.createElement(Strut, {
|
|
30666
|
+
size: spacing.xxSmall_6
|
|
30667
|
+
}), /*#__PURE__*/React.createElement(SingleSelect, {
|
|
30668
|
+
selectedValue: strokeStyle,
|
|
30669
|
+
onChange: value => onChangeProps({
|
|
30670
|
+
strokeStyle: value
|
|
30671
|
+
})
|
|
30672
|
+
// Placeholder is required, but never gets used.
|
|
30673
|
+
,
|
|
30674
|
+
placeholder: ""
|
|
30675
|
+
}, /*#__PURE__*/React.createElement(OptionItem, {
|
|
30676
|
+
value: "solid",
|
|
30677
|
+
label: "solid"
|
|
30678
|
+
}, "solid"), /*#__PURE__*/React.createElement(OptionItem, {
|
|
30679
|
+
value: "dashed",
|
|
30680
|
+
label: "dashed"
|
|
30681
|
+
}, "dashed"))), /*#__PURE__*/React.createElement(LockedFigureSettingsActions, {
|
|
30682
|
+
onRemove: onRemove,
|
|
30683
|
+
figureAriaLabel: `locked ellipse at ${center[0]}, ${center[1]}`
|
|
30684
|
+
}));
|
|
30685
|
+
};
|
|
30686
|
+
const styles$j = StyleSheet.create({
|
|
30687
|
+
row: {
|
|
30688
|
+
display: "flex",
|
|
30689
|
+
flexDirection: "row",
|
|
30690
|
+
alignItems: "center"
|
|
30691
|
+
},
|
|
30692
|
+
spaceUnder: {
|
|
30693
|
+
marginBottom: spacing.xSmall_8
|
|
30694
|
+
}
|
|
30695
|
+
});
|
|
30696
|
+
|
|
30697
|
+
const LabeledSwitch = props => {
|
|
30698
|
+
const {
|
|
30699
|
+
checked,
|
|
30700
|
+
label,
|
|
30701
|
+
style,
|
|
30702
|
+
onChange
|
|
30703
|
+
} = props;
|
|
30704
|
+
const ids = useUniqueIdWithMock();
|
|
30705
|
+
const switchId = ids.get("switch");
|
|
30706
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
30707
|
+
style: [styles$i.row, style]
|
|
30708
|
+
}, /*#__PURE__*/React.createElement(Switch, {
|
|
30709
|
+
id: switchId,
|
|
30710
|
+
checked: checked,
|
|
30711
|
+
onChange: onChange
|
|
30712
|
+
}), /*#__PURE__*/React.createElement(Strut, {
|
|
30713
|
+
size: spacing.xSmall_8
|
|
30714
|
+
}), /*#__PURE__*/React.createElement(LabelMedium, {
|
|
30715
|
+
tag: "label",
|
|
30716
|
+
htmlFor: switchId
|
|
30717
|
+
}, label));
|
|
30718
|
+
};
|
|
30719
|
+
const styles$i = StyleSheet.create({
|
|
30720
|
+
row: {
|
|
30721
|
+
flexDirection: "row",
|
|
30722
|
+
alignItems: "center"
|
|
30723
|
+
}
|
|
30724
|
+
});
|
|
30725
|
+
|
|
30482
30726
|
/**
|
|
30483
30727
|
* DefiningPointSettings is a component that allows the user to edit the
|
|
30484
30728
|
* settings of a point that defines a locked figure (ex. line) on the graph.
|
|
@@ -30520,7 +30764,11 @@ const DefiningPointSettings = props => {
|
|
|
30520
30764
|
}, /*#__PURE__*/React.createElement(CoordinatePairInput, {
|
|
30521
30765
|
coord: coord,
|
|
30522
30766
|
error: !!error,
|
|
30523
|
-
|
|
30767
|
+
onChange: newCoords => {
|
|
30768
|
+
onChangeProps({
|
|
30769
|
+
coord: newCoords
|
|
30770
|
+
});
|
|
30771
|
+
}
|
|
30524
30772
|
}), onTogglePoint && /*#__PURE__*/React.createElement(LabeledSwitch, {
|
|
30525
30773
|
label: "show point on graph",
|
|
30526
30774
|
checked: !!showPoint,
|
|
@@ -30587,39 +30835,6 @@ const styles$g = StyleSheet.create({
|
|
|
30587
30835
|
}
|
|
30588
30836
|
});
|
|
30589
30837
|
|
|
30590
|
-
/**
|
|
30591
|
-
* The part of a locked figure settings panel that contains actions
|
|
30592
|
-
* for this panel and its associated locked figure, including
|
|
30593
|
-
* the delete button.
|
|
30594
|
-
*/
|
|
30595
|
-
const LockedFigureSettingsActions = props => {
|
|
30596
|
-
const {
|
|
30597
|
-
onRemove,
|
|
30598
|
-
figureAriaLabel
|
|
30599
|
-
} = props;
|
|
30600
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
30601
|
-
style: styles$f.container
|
|
30602
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
30603
|
-
startIcon: trashIcon,
|
|
30604
|
-
"aria-label": `Delete ${figureAriaLabel}`,
|
|
30605
|
-
onClick: onRemove,
|
|
30606
|
-
kind: "tertiary",
|
|
30607
|
-
style: styles$f.deleteButton
|
|
30608
|
-
}, "Delete"));
|
|
30609
|
-
};
|
|
30610
|
-
const styles$f = StyleSheet.create({
|
|
30611
|
-
container: {
|
|
30612
|
-
width: "100%",
|
|
30613
|
-
flexDirection: "row",
|
|
30614
|
-
alignItems: "center",
|
|
30615
|
-
marginTop: spacing.xxxSmall_4
|
|
30616
|
-
},
|
|
30617
|
-
deleteButton: {
|
|
30618
|
-
// Line up the delete icon with the rest of the content.
|
|
30619
|
-
marginInlineStart: -spacing.xxxSmall_4
|
|
30620
|
-
}
|
|
30621
|
-
});
|
|
30622
|
-
|
|
30623
30838
|
const lengthZeroStr = "The line cannot have length 0.";
|
|
30624
30839
|
const LockedLineSettings = props => {
|
|
30625
30840
|
const {
|
|
@@ -30633,12 +30848,6 @@ const LockedLineSettings = props => {
|
|
|
30633
30848
|
onRemove
|
|
30634
30849
|
} = props;
|
|
30635
30850
|
const [point1, point2] = points;
|
|
30636
|
-
|
|
30637
|
-
// Generate unique IDs so that the programmatic labels can be associated
|
|
30638
|
-
// with their respective text fields.
|
|
30639
|
-
const ids = useUniqueIdWithMock();
|
|
30640
|
-
const kindSelectId = ids.get("line-kind-select");
|
|
30641
|
-
const styleSelectId = ids.get("line-style-select");
|
|
30642
30851
|
const capitalizeKind = kind.charAt(0).toUpperCase() + kind.slice(1);
|
|
30643
30852
|
const lineLabel = `${capitalizeKind} (${point1.coord[0]},
|
|
30644
30853
|
${point1.coord[1]}), (${point2.coord[0]}, ${point2.coord[1]})`;
|
|
@@ -30667,21 +30876,19 @@ const LockedLineSettings = props => {
|
|
|
30667
30876
|
expanded: props.expanded,
|
|
30668
30877
|
onToggle: props.onToggle,
|
|
30669
30878
|
header: /*#__PURE__*/React.createElement(View, {
|
|
30670
|
-
style: styles$
|
|
30879
|
+
style: styles$f.row
|
|
30671
30880
|
}, /*#__PURE__*/React.createElement(LabelLarge, null, lineLabel), /*#__PURE__*/React.createElement(Strut, {
|
|
30672
30881
|
size: spacing.xSmall_8
|
|
30673
30882
|
}), /*#__PURE__*/React.createElement(LineSwatch, {
|
|
30674
30883
|
color: lineColor,
|
|
30675
30884
|
lineStyle: lineStyle
|
|
30676
30885
|
}))
|
|
30677
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
30678
|
-
style: [styles$e.row, styles$e.spaceUnder]
|
|
30679
30886
|
}, /*#__PURE__*/React.createElement(LabelMedium, {
|
|
30680
|
-
|
|
30681
|
-
style: styles$
|
|
30682
|
-
|
|
30683
|
-
|
|
30684
|
-
|
|
30887
|
+
tag: "label",
|
|
30888
|
+
style: [styles$f.row, styles$f.spaceUnder]
|
|
30889
|
+
}, "kind", /*#__PURE__*/React.createElement(Strut, {
|
|
30890
|
+
size: spacing.xxxSmall_4
|
|
30891
|
+
}), /*#__PURE__*/React.createElement(SingleSelect, {
|
|
30685
30892
|
selectedValue: kind,
|
|
30686
30893
|
onChange: value => onChangeProps({
|
|
30687
30894
|
kind: value
|
|
@@ -30699,20 +30906,18 @@ const LockedLineSettings = props => {
|
|
|
30699
30906
|
value: "segment",
|
|
30700
30907
|
label: "segment"
|
|
30701
30908
|
}))), /*#__PURE__*/React.createElement(View, {
|
|
30702
|
-
style:
|
|
30909
|
+
style: styles$f.row
|
|
30703
30910
|
}, /*#__PURE__*/React.createElement(ColorSelect, {
|
|
30704
30911
|
selectedValue: lineColor,
|
|
30705
30912
|
onChange: handleColorChange
|
|
30706
30913
|
}), /*#__PURE__*/React.createElement(Strut, {
|
|
30707
30914
|
size: spacing.small_12
|
|
30708
|
-
}), /*#__PURE__*/React.createElement(
|
|
30709
|
-
|
|
30710
|
-
|
|
30711
|
-
|
|
30712
|
-
|
|
30713
|
-
|
|
30714
|
-
}, "style"), /*#__PURE__*/React.createElement(SingleSelect, {
|
|
30715
|
-
id: styleSelectId,
|
|
30915
|
+
}), /*#__PURE__*/React.createElement(LabelMedium, {
|
|
30916
|
+
tag: "label",
|
|
30917
|
+
style: styles$f.row
|
|
30918
|
+
}, "style", /*#__PURE__*/React.createElement(Strut, {
|
|
30919
|
+
size: spacing.xxxSmall_4
|
|
30920
|
+
}), /*#__PURE__*/React.createElement(SingleSelect, {
|
|
30716
30921
|
selectedValue: lineStyle,
|
|
30717
30922
|
onChange: value => onChangeProps({
|
|
30718
30923
|
lineStyle: value
|
|
@@ -30720,7 +30925,7 @@ const LockedLineSettings = props => {
|
|
|
30720
30925
|
// Placeholder is required, but never gets used.
|
|
30721
30926
|
,
|
|
30722
30927
|
placeholder: "",
|
|
30723
|
-
style: styles$
|
|
30928
|
+
style: styles$f.selectMarginOffset
|
|
30724
30929
|
}, /*#__PURE__*/React.createElement(OptionItem, {
|
|
30725
30930
|
value: "solid",
|
|
30726
30931
|
label: "solid"
|
|
@@ -30728,7 +30933,7 @@ const LockedLineSettings = props => {
|
|
|
30728
30933
|
value: "dashed",
|
|
30729
30934
|
label: "dashed"
|
|
30730
30935
|
})))), isInvalid && /*#__PURE__*/React.createElement(LabelMedium, {
|
|
30731
|
-
style: styles$
|
|
30936
|
+
style: styles$f.errorText
|
|
30732
30937
|
}, lengthZeroStr), /*#__PURE__*/React.createElement(DefiningPointSettings, _extends({
|
|
30733
30938
|
label: "Point 1",
|
|
30734
30939
|
showPoint: showPoint1,
|
|
@@ -30754,7 +30959,7 @@ const LockedLineSettings = props => {
|
|
|
30754
30959
|
${point2.coord[0]}, ${point2.coord[1]}.`
|
|
30755
30960
|
}));
|
|
30756
30961
|
};
|
|
30757
|
-
const styles$
|
|
30962
|
+
const styles$f = StyleSheet.create({
|
|
30758
30963
|
row: {
|
|
30759
30964
|
flexDirection: "row",
|
|
30760
30965
|
alignItems: "center"
|
|
@@ -30762,9 +30967,6 @@ const styles$e = StyleSheet.create({
|
|
|
30762
30967
|
spaceUnder: {
|
|
30763
30968
|
marginBottom: spacing.xSmall_8
|
|
30764
30969
|
},
|
|
30765
|
-
label: {
|
|
30766
|
-
marginInlineEnd: spacing.xxxSmall_4
|
|
30767
|
-
},
|
|
30768
30970
|
selectMarginOffset: {
|
|
30769
30971
|
// Align with the point settings accordions.
|
|
30770
30972
|
marginInlineEnd: -spacing.xxxSmall_4
|
|
@@ -30800,7 +31002,7 @@ const LockedPointSettings = props => {
|
|
|
30800
31002
|
/*#__PURE__*/
|
|
30801
31003
|
// Summary: Point, coords, color (filled/open)
|
|
30802
31004
|
React.createElement(View, {
|
|
30803
|
-
style: styles$
|
|
31005
|
+
style: styles$e.row
|
|
30804
31006
|
}, /*#__PURE__*/React.createElement(LabelLarge, null, `Point (${coord[0]}, ${coord[1]})`), /*#__PURE__*/React.createElement(Strut, {
|
|
30805
31007
|
size: spacing.xSmall_8
|
|
30806
31008
|
}), /*#__PURE__*/React.createElement(ColorSwatch, {
|
|
@@ -30809,11 +31011,15 @@ const LockedPointSettings = props => {
|
|
|
30809
31011
|
}))
|
|
30810
31012
|
}, /*#__PURE__*/React.createElement(CoordinatePairInput, {
|
|
30811
31013
|
coord: coord,
|
|
30812
|
-
|
|
31014
|
+
onChange: newCoord => {
|
|
31015
|
+
onChangeProps({
|
|
31016
|
+
coord: newCoord
|
|
31017
|
+
});
|
|
31018
|
+
}
|
|
30813
31019
|
}), /*#__PURE__*/React.createElement(ColorSelect, {
|
|
30814
31020
|
selectedValue: pointColor,
|
|
30815
31021
|
onChange: handleColorChange,
|
|
30816
|
-
style: styles$
|
|
31022
|
+
style: styles$e.spaceUnder
|
|
30817
31023
|
}), /*#__PURE__*/React.createElement(LabeledSwitch, {
|
|
30818
31024
|
label: "open point",
|
|
30819
31025
|
checked: !filled,
|
|
@@ -30827,7 +31033,7 @@ const LockedPointSettings = props => {
|
|
|
30827
31033
|
figureAriaLabel: `locked point at ${coord[0]}, ${coord[1]}`
|
|
30828
31034
|
}));
|
|
30829
31035
|
};
|
|
30830
|
-
const styles$
|
|
31036
|
+
const styles$e = StyleSheet.create({
|
|
30831
31037
|
row: {
|
|
30832
31038
|
flexDirection: "row",
|
|
30833
31039
|
alignItems: "center"
|
|
@@ -30837,6 +31043,113 @@ const styles$d = StyleSheet.create({
|
|
|
30837
31043
|
}
|
|
30838
31044
|
});
|
|
30839
31045
|
|
|
31046
|
+
/**
|
|
31047
|
+
* LockedVectorSettings is a component that allows the user to edit the
|
|
31048
|
+
* settings of specifically a locked vector on the graph.
|
|
31049
|
+
*
|
|
31050
|
+
* Used in the interactive graph editor's locked figures section.
|
|
31051
|
+
*/
|
|
31052
|
+
const lengthErrorMessage = "The vector cannot have length 0.";
|
|
31053
|
+
const LockedVectorSettings = props => {
|
|
31054
|
+
const {
|
|
31055
|
+
points,
|
|
31056
|
+
color: lineColor,
|
|
31057
|
+
onChangeProps,
|
|
31058
|
+
onRemove
|
|
31059
|
+
} = props;
|
|
31060
|
+
const [tail, tip] = points;
|
|
31061
|
+
const lineLabel = `Vector (${tail[0]}, ${tail[1]}), (${tip[0]}, ${tip[1]})`;
|
|
31062
|
+
|
|
31063
|
+
// Check if the line has length 0.
|
|
31064
|
+
const isInvalid = vector.equal(tail, tip);
|
|
31065
|
+
function handleChangePoint(newCoord, index) {
|
|
31066
|
+
if (typeof newCoord !== "undefined") {
|
|
31067
|
+
const newPoints = [...points];
|
|
31068
|
+
newPoints[index] = [...newCoord];
|
|
31069
|
+
onChangeProps({
|
|
31070
|
+
points: newPoints
|
|
31071
|
+
});
|
|
31072
|
+
}
|
|
31073
|
+
}
|
|
31074
|
+
function handleColorChange(newColor) {
|
|
31075
|
+
onChangeProps({
|
|
31076
|
+
color: newColor
|
|
31077
|
+
});
|
|
31078
|
+
}
|
|
31079
|
+
return /*#__PURE__*/React.createElement(LockedFigureSettingsAccordion, {
|
|
31080
|
+
expanded: props.expanded,
|
|
31081
|
+
onToggle: props.onToggle,
|
|
31082
|
+
header: /*#__PURE__*/React.createElement(View, {
|
|
31083
|
+
style: styles$d.row
|
|
31084
|
+
}, /*#__PURE__*/React.createElement(LabelLarge, null, lineLabel), /*#__PURE__*/React.createElement(Strut, {
|
|
31085
|
+
size: spacing.xSmall_8
|
|
31086
|
+
}), /*#__PURE__*/React.createElement(LineSwatch, {
|
|
31087
|
+
color: lineColor,
|
|
31088
|
+
lineStyle: "solid"
|
|
31089
|
+
}))
|
|
31090
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
31091
|
+
style: [styles$d.row, styles$d.spaceUnder]
|
|
31092
|
+
}, /*#__PURE__*/React.createElement(ColorSelect, {
|
|
31093
|
+
selectedValue: lineColor,
|
|
31094
|
+
onChange: handleColorChange
|
|
31095
|
+
})), isInvalid && /*#__PURE__*/React.createElement(LabelMedium, {
|
|
31096
|
+
style: styles$d.errorText
|
|
31097
|
+
}, lengthErrorMessage), /*#__PURE__*/React.createElement(LockedFigureSettingsAccordion, {
|
|
31098
|
+
expanded: true // Initial state is expanded
|
|
31099
|
+
,
|
|
31100
|
+
containerStyle: styles$d.container,
|
|
31101
|
+
panelStyle: styles$d.accordionPanel,
|
|
31102
|
+
header: /*#__PURE__*/React.createElement(View, {
|
|
31103
|
+
style: styles$d.row
|
|
31104
|
+
}, /*#__PURE__*/React.createElement(LabelLarge, null, `Tail (${tail[0]}, ${tail[1]})`))
|
|
31105
|
+
}, /*#__PURE__*/React.createElement(CoordinatePairInput, {
|
|
31106
|
+
coord: tail,
|
|
31107
|
+
error: isInvalid,
|
|
31108
|
+
onChange: newProps => {
|
|
31109
|
+
handleChangePoint(newProps, 0);
|
|
31110
|
+
}
|
|
31111
|
+
})), /*#__PURE__*/React.createElement(LockedFigureSettingsAccordion, {
|
|
31112
|
+
expanded: true // Initial state is expanded
|
|
31113
|
+
,
|
|
31114
|
+
containerStyle: styles$d.container,
|
|
31115
|
+
panelStyle: styles$d.accordionPanel,
|
|
31116
|
+
header: /*#__PURE__*/React.createElement(View, {
|
|
31117
|
+
style: styles$d.row
|
|
31118
|
+
}, /*#__PURE__*/React.createElement(LabelLarge, null, `Tip (${tip[0]}, ${tip[1]})`))
|
|
31119
|
+
}, /*#__PURE__*/React.createElement(CoordinatePairInput, {
|
|
31120
|
+
coord: tip,
|
|
31121
|
+
error: isInvalid,
|
|
31122
|
+
onChange: newProps => {
|
|
31123
|
+
handleChangePoint(newProps, 1);
|
|
31124
|
+
}
|
|
31125
|
+
})), /*#__PURE__*/React.createElement(LockedFigureSettingsActions, {
|
|
31126
|
+
onRemove: onRemove,
|
|
31127
|
+
figureAriaLabel: `locked vector defined by starting point
|
|
31128
|
+
${tail[0]}, ${tail[1]} and extending to
|
|
31129
|
+
${tip[0]}, ${tip[1]}.`
|
|
31130
|
+
}));
|
|
31131
|
+
};
|
|
31132
|
+
const styles$d = StyleSheet.create({
|
|
31133
|
+
accordionPanel: {
|
|
31134
|
+
paddingBottom: spacing.medium_16
|
|
31135
|
+
},
|
|
31136
|
+
container: {
|
|
31137
|
+
marginTop: spacing.xSmall_8,
|
|
31138
|
+
marginBottom: 0,
|
|
31139
|
+
marginLeft: -spacing.xxxSmall_4,
|
|
31140
|
+
marginRight: -spacing.xxxSmall_4,
|
|
31141
|
+
backgroundColor: color.white
|
|
31142
|
+
},
|
|
31143
|
+
errorText: {
|
|
31144
|
+
color: color.red,
|
|
31145
|
+
marginTop: spacing.xSmall_8
|
|
31146
|
+
},
|
|
31147
|
+
row: {
|
|
31148
|
+
flexDirection: "row",
|
|
31149
|
+
alignItems: "center"
|
|
31150
|
+
}
|
|
31151
|
+
});
|
|
31152
|
+
|
|
30840
31153
|
/**
|
|
30841
31154
|
* LockedFigureSettings takes in a figure and renders the
|
|
30842
31155
|
* respective settings for that figure type.
|
|
@@ -30852,6 +31165,16 @@ const LockedFigureSettings = props => {
|
|
|
30852
31165
|
return /*#__PURE__*/React.createElement(LockedPointSettings, props);
|
|
30853
31166
|
case "line":
|
|
30854
31167
|
return /*#__PURE__*/React.createElement(LockedLineSettings, props);
|
|
31168
|
+
case "ellipse":
|
|
31169
|
+
if (props.showM2Features) {
|
|
31170
|
+
return /*#__PURE__*/React.createElement(LockedEllipseSettings, props);
|
|
31171
|
+
}
|
|
31172
|
+
break;
|
|
31173
|
+
case "vector":
|
|
31174
|
+
if (props.showM2Features) {
|
|
31175
|
+
return /*#__PURE__*/React.createElement(LockedVectorSettings, props);
|
|
31176
|
+
}
|
|
31177
|
+
break;
|
|
30855
31178
|
}
|
|
30856
31179
|
return null;
|
|
30857
31180
|
};
|
|
@@ -30918,15 +31241,22 @@ function getDefaultFigureForType(type) {
|
|
|
30918
31241
|
showPoint1: false,
|
|
30919
31242
|
showPoint2: false
|
|
30920
31243
|
};
|
|
30921
|
-
case "
|
|
31244
|
+
case "ellipse":
|
|
30922
31245
|
return {
|
|
30923
|
-
type: "
|
|
31246
|
+
type: "ellipse",
|
|
30924
31247
|
center: [0, 0],
|
|
30925
|
-
radius: 1,
|
|
31248
|
+
radius: [1, 1],
|
|
31249
|
+
angle: 0,
|
|
30926
31250
|
color: DEFAULT_COLOR,
|
|
30927
31251
|
fillStyle: "none",
|
|
30928
31252
|
strokeStyle: "solid"
|
|
30929
31253
|
};
|
|
31254
|
+
case "vector":
|
|
31255
|
+
return {
|
|
31256
|
+
type: "vector",
|
|
31257
|
+
points: [[0, 0], [2, 2]],
|
|
31258
|
+
color: DEFAULT_COLOR
|
|
31259
|
+
};
|
|
30930
31260
|
default:
|
|
30931
31261
|
throw new UnreachableCaseError(type);
|
|
30932
31262
|
}
|
|
@@ -30982,21 +31312,15 @@ const LockedFiguresSection = props => {
|
|
|
30982
31312
|
const buttonLabel = allCollapsed ? "Expand all" : "Collapse all";
|
|
30983
31313
|
const showExpandButton = !!(figures != null && figures.length);
|
|
30984
31314
|
return /*#__PURE__*/React.createElement(View, null, figures == null ? void 0 : figures.map((figure, index) => {
|
|
30985
|
-
if (figure.type === "circle") {
|
|
30986
|
-
// TODO(LEMS-1941): Implement circle locked figure settings.
|
|
30987
|
-
// Remove this block once circle locked figure settings are
|
|
30988
|
-
// implemented.
|
|
30989
|
-
return;
|
|
30990
|
-
}
|
|
30991
31315
|
return /*#__PURE__*/React.createElement(LockedFigureSettings, _extends({
|
|
31316
|
+
key: `${uniqueId}-locked-${figure}-${index}`,
|
|
30992
31317
|
showM2Features: props.showM2Features,
|
|
30993
31318
|
expanded: expandedStates[index],
|
|
30994
31319
|
onToggle: newValue => {
|
|
30995
31320
|
const newExpanded = [...expandedStates];
|
|
30996
31321
|
newExpanded[index] = newValue;
|
|
30997
31322
|
setExpandedStates(newExpanded);
|
|
30998
|
-
}
|
|
30999
|
-
key: `${uniqueId}-locked-${figure}-${index}`
|
|
31323
|
+
}
|
|
31000
31324
|
}, figure, {
|
|
31001
31325
|
onChangeProps: newProps => changeProps(index, newProps),
|
|
31002
31326
|
onRemove: () => removeLockedFigure(index)
|
|
@@ -31004,6 +31328,7 @@ const LockedFiguresSection = props => {
|
|
|
31004
31328
|
}), /*#__PURE__*/React.createElement(View, {
|
|
31005
31329
|
style: styles$c.buttonContainer
|
|
31006
31330
|
}, /*#__PURE__*/React.createElement(LockedFigureSelect, {
|
|
31331
|
+
showM2Features: props.showM2Features,
|
|
31007
31332
|
id: `${uniqueId}-select`,
|
|
31008
31333
|
onChange: addLockedFigure
|
|
31009
31334
|
}), /*#__PURE__*/React.createElement(Strut, {
|
|
@@ -31117,7 +31442,7 @@ class InteractiveGraphEditor extends React.Component {
|
|
|
31117
31442
|
DeprecationMixin.UNSAFE_componentWillMount.call(this);
|
|
31118
31443
|
}
|
|
31119
31444
|
render() {
|
|
31120
|
-
var _this$props$graph$typ, _this$props$graph, _this$props$correct, _this$props$correct2, _this$props$correct3, _this$props$correct4, _this$props$correct5, _this$props$correct6, _this$props$correct7, _this$props$correct8, _this$props$correct9, _this$props$correct10, _this$props$correct11, _this$props$apiOption, _this$props$apiOption2
|
|
31445
|
+
var _this$props$graph$typ, _this$props$graph, _this$props$correct, _this$props$correct2, _this$props$correct3, _this$props$correct4, _this$props$correct5, _this$props$correct6, _this$props$correct7, _this$props$correct8, _this$props$correct9, _this$props$correct10, _this$props$correct11, _this$props$apiOption, _this$props$apiOption2;
|
|
31121
31446
|
let graph;
|
|
31122
31447
|
let equationString;
|
|
31123
31448
|
const gridStep = this.props.gridStep || Util.getGridStep(this.props.range, this.props.step, interactiveSizes.defaultBoxSize);
|
|
@@ -31368,8 +31693,8 @@ class InteractiveGraphEditor extends React.Component {
|
|
|
31368
31693
|
}, equationString), /*#__PURE__*/React.createElement(InfoTip$b, null, /*#__PURE__*/React.createElement("p", null, "Graph the correct answer in the graph below and ensure the equation or point coordinates displayed represent the correct answer."))), graph,
|
|
31369
31694
|
// Only show the "Add locked figure" dropdown if the graph
|
|
31370
31695
|
// is using Mafs.
|
|
31371
|
-
this.props.graph && ((_this$props$apiOption = this.props.apiOptions) == null || (_this$props$apiOption = _this$props$apiOption.flags) == null || (_this$props$apiOption = _this$props$apiOption.mafs) == null ? void 0 : _this$props$apiOption[
|
|
31372
|
-
showM2Features: (_this$props$
|
|
31696
|
+
this.props.graph && ((_this$props$apiOption = this.props.apiOptions) == null || (_this$props$apiOption = _this$props$apiOption.flags) == null || (_this$props$apiOption = _this$props$apiOption.mafs) == null ? void 0 : _this$props$apiOption[this.props.graph.type]) && /*#__PURE__*/React.createElement(LockedFiguresSection, {
|
|
31697
|
+
showM2Features: (_this$props$apiOption2 = this.props.apiOptions) == null || (_this$props$apiOption2 = _this$props$apiOption2.flags) == null || (_this$props$apiOption2 = _this$props$apiOption2.mafs) == null ? void 0 : _this$props$apiOption2["interactive-graph-locked-features-m2"],
|
|
31373
31698
|
figures: this.props.lockedFigures,
|
|
31374
31699
|
onChange: this.props.onChange
|
|
31375
31700
|
}));
|