@khanacademy/perseus-editor 11.2.0 → 11.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/article-editor.d.ts +2 -2
- package/dist/components/graph-locked-figures/line-stroke-select.d.ts +8 -0
- package/dist/components/graph-locked-figures/locked-figure-settings.d.ts +2 -1
- package/dist/components/graph-locked-figures/locked-function-settings.d.ts +11 -0
- package/dist/components/scrollless-number-text-field.d.ts +21 -0
- package/dist/components/sortable.d.ts +6 -0
- package/dist/components/start-coords-angle.d.ts +8 -0
- package/dist/components/start-coords-point.d.ts +8 -0
- package/dist/components/util.d.ts +1 -0
- package/dist/components/widget-editor.d.ts +1 -1
- package/dist/editor.d.ts +2 -2
- package/dist/es/index.css +3 -79
- package/dist/es/index.js +1128 -639
- package/dist/es/index.js.map +1 -1
- package/dist/hint-editor.d.ts +1 -2
- package/dist/index.css +3 -79
- package/dist/index.js +1126 -632
- package/dist/index.js.map +1 -1
- package/dist/item-editor.d.ts +2 -2
- package/dist/widgets/expression-editor.d.ts +6 -2
- package/dist/widgets/interactive-graph-editor.d.ts +517 -129
- package/package.json +12 -3
package/dist/es/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { addLibraryVersionToPerseusDebug, PerseusError, Errors } from '@khanacademy/perseus-core';
|
|
2
|
-
import { constants, components, Widgets, icons, WIDGET_PROP_DENYLIST, Util, Log, 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, getQuadraticCoords, getSinusoidCoords, getCircleCoords, getLinearSystemCoords, getSegmentCoords, getLineCoords, lockedFigureColors, lockedFigureFillStyles, InteractiveGraphWidget, globalStyles, globalConstants, MatrixWidget, PlotterWidget, plotterPlotTypes, BaseRadio, TableWidget, widgets } from '@khanacademy/perseus';
|
|
2
|
+
import { constants, components, Widgets, icons, WIDGET_PROP_DENYLIST, Util, Log, 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, getAngleCoords, getPolygonCoords, getPointCoords, getQuadraticCoords, getSinusoidCoords, getCircleCoords, getLinearSystemCoords, getSegmentCoords, getLineCoords, lockedFigureColors, lockedFigureFillStyles, InteractiveGraphWidget, globalStyles, globalConstants, MatrixWidget, PlotterWidget, plotterPlotTypes, BaseRadio, TableWidget, widgets } from '@khanacademy/perseus';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import { useRef, useEffect } from 'react';
|
|
4
|
+
import { useRef, useEffect, useState } from 'react';
|
|
5
5
|
import _ from 'underscore';
|
|
6
6
|
import createReactClass from 'create-react-class';
|
|
7
7
|
import Clickable from '@khanacademy/wonder-blocks-clickable';
|
|
@@ -13,15 +13,15 @@ import { View, useUniqueIdWithMock } from '@khanacademy/wonder-blocks-core';
|
|
|
13
13
|
import { PhosphorIcon } from '@khanacademy/wonder-blocks-icon';
|
|
14
14
|
import caretRight from '@phosphor-icons/core/bold/caret-right-bold.svg';
|
|
15
15
|
import classNames from 'classnames';
|
|
16
|
+
import { Checkbox as Checkbox$1, LabeledTextField, TextField } from '@khanacademy/wonder-blocks-form';
|
|
16
17
|
import ReactDOM from 'react-dom';
|
|
17
18
|
import { point, vector, number } from '@khanacademy/kmath';
|
|
18
19
|
import * as KAS from '@khanacademy/kas';
|
|
20
|
+
import Button from '@khanacademy/wonder-blocks-button';
|
|
21
|
+
import { HeadingSmall, HeadingXSmall, LabelSmall, LabelLarge, LabelMedium, LabelXSmall, BodyMonospace } from '@khanacademy/wonder-blocks-typography';
|
|
19
22
|
import { isTruthy, UnreachableCaseError } from '@khanacademy/wonder-stuff-core';
|
|
20
23
|
import { useMathInputI18n, createMathField } from '@khanacademy/math-input';
|
|
21
24
|
import { ActionMenu, ActionItem, SingleSelect, OptionItem } from '@khanacademy/wonder-blocks-dropdown';
|
|
22
|
-
import { TextField, Checkbox as Checkbox$1 } from '@khanacademy/wonder-blocks-form';
|
|
23
|
-
import { LabelSmall, LabelLarge, LabelMedium, LabelXSmall, BodyMonospace } from '@khanacademy/wonder-blocks-typography';
|
|
24
|
-
import Button from '@khanacademy/wonder-blocks-button';
|
|
25
25
|
import { AccordionSection } from '@khanacademy/wonder-blocks-accordion';
|
|
26
26
|
import IconButton from '@khanacademy/wonder-blocks-icon-button';
|
|
27
27
|
import caretDoubleDownIcon from '@phosphor-icons/core/bold/caret-double-down-bold.svg';
|
|
@@ -37,7 +37,7 @@ import arrowCounterClockwise from '@phosphor-icons/core/bold/arrow-counter-clock
|
|
|
37
37
|
|
|
38
38
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
39
39
|
const libName = "@khanacademy/perseus-editor";
|
|
40
|
-
const libVersion = "11.
|
|
40
|
+
const libVersion = "11.4.0";
|
|
41
41
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
42
42
|
|
|
43
43
|
function _extends() {
|
|
@@ -227,7 +227,7 @@ class SectionControlButton extends React.Component {
|
|
|
227
227
|
role: "button",
|
|
228
228
|
hideDefaultFocusRing: true,
|
|
229
229
|
"aria-label": title,
|
|
230
|
-
style: styles$
|
|
230
|
+
style: styles$R.button
|
|
231
231
|
}, ({
|
|
232
232
|
hovered,
|
|
233
233
|
focused,
|
|
@@ -235,7 +235,7 @@ class SectionControlButton extends React.Component {
|
|
|
235
235
|
}) => /*#__PURE__*/React.createElement(InlineIcon$a, icon));
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
|
-
const styles$
|
|
238
|
+
const styles$R = StyleSheet.create({
|
|
239
239
|
button: {
|
|
240
240
|
backgroundColor: color.gold,
|
|
241
241
|
margin: 2,
|
|
@@ -20740,13 +20740,13 @@ class WidgetSelect extends React.Component {
|
|
|
20740
20740
|
* that collapse a region.
|
|
20741
20741
|
*/
|
|
20742
20742
|
function ToggleableCaret(props) {
|
|
20743
|
-
const iconStyle = props.isExpanded ? styles$
|
|
20743
|
+
const iconStyle = props.isExpanded ? styles$Q.expanded : styles$Q.collapsed;
|
|
20744
20744
|
return /*#__PURE__*/React.createElement(PhosphorIcon, {
|
|
20745
20745
|
icon: caretRight,
|
|
20746
20746
|
style: iconStyle
|
|
20747
20747
|
});
|
|
20748
20748
|
}
|
|
20749
|
-
const styles$
|
|
20749
|
+
const styles$Q = StyleSheet.create({
|
|
20750
20750
|
collapsed: {
|
|
20751
20751
|
transition: ".15s"
|
|
20752
20752
|
},
|
|
@@ -20779,16 +20779,16 @@ class TexErrorView extends React.Component {
|
|
|
20779
20779
|
showErrors
|
|
20780
20780
|
} = this.state;
|
|
20781
20781
|
return /*#__PURE__*/React.createElement(View, {
|
|
20782
|
-
style: styles$
|
|
20782
|
+
style: styles$P.errorContainer
|
|
20783
20783
|
}, /*#__PURE__*/React.createElement(View, {
|
|
20784
|
-
style: styles$
|
|
20784
|
+
style: styles$P.title,
|
|
20785
20785
|
onClick: this.handleToggleTexErrors
|
|
20786
20786
|
}, /*#__PURE__*/React.createElement(ToggleableCaret, {
|
|
20787
20787
|
isExpanded: showErrors
|
|
20788
20788
|
}), "\xA0 TeX Errors (", errorList.length, ")"), showErrors && /*#__PURE__*/React.createElement(View, {
|
|
20789
|
-
style: styles$
|
|
20789
|
+
style: styles$P.errorExplanation
|
|
20790
20790
|
}, "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, {
|
|
20791
|
-
style: styles$
|
|
20791
|
+
style: styles$P.error,
|
|
20792
20792
|
key: index
|
|
20793
20793
|
}, /*#__PURE__*/React.createElement(View, {
|
|
20794
20794
|
style: {
|
|
@@ -20797,7 +20797,7 @@ class TexErrorView extends React.Component {
|
|
|
20797
20797
|
}, e.math), /*#__PURE__*/React.createElement(View, null, e.message))));
|
|
20798
20798
|
}
|
|
20799
20799
|
}
|
|
20800
|
-
const styles$
|
|
20800
|
+
const styles$P = StyleSheet.create({
|
|
20801
20801
|
title: {
|
|
20802
20802
|
backgroundColor: "#eee",
|
|
20803
20803
|
fontSize: "1.25em",
|
|
@@ -23638,12 +23638,10 @@ class CombinedHintsEditor extends React.Component {
|
|
|
23638
23638
|
super(...args);
|
|
23639
23639
|
this.handleHintChange = (i, newProps, cb, silent) => {
|
|
23640
23640
|
// TODO(joel) - lens
|
|
23641
|
-
const hints =
|
|
23641
|
+
const hints = [...this.props.hints];
|
|
23642
23642
|
hints[i] = _.extend({}, this.serializeHint(i, {
|
|
23643
23643
|
keepDeletedWidgets: true
|
|
23644
23644
|
}), newProps);
|
|
23645
|
-
|
|
23646
|
-
// @ts-expect-error - TS2740 - Type 'Hint' is missing the following properties from type 'readonly Hint[]': length, concat, join, slice, and 18 more.
|
|
23647
23645
|
this.props.onChange({
|
|
23648
23646
|
hints: hints
|
|
23649
23647
|
}, cb, silent);
|
|
@@ -23653,21 +23651,16 @@ class CombinedHintsEditor extends React.Component {
|
|
|
23653
23651
|
if (!confirm("Are you sure you want to delete this hint?")) {
|
|
23654
23652
|
return;
|
|
23655
23653
|
}
|
|
23656
|
-
const hints =
|
|
23657
|
-
// @ts-expect-error - TS2339 - Property 'splice' does not exist on type 'Hint'.
|
|
23654
|
+
const hints = [...this.props.hints];
|
|
23658
23655
|
hints.splice(i, 1);
|
|
23659
|
-
// @ts-expect-error - TS2322 - Type 'Hint' is not assignable to type 'readonly Hint[]'.
|
|
23660
23656
|
this.props.onChange({
|
|
23661
23657
|
hints: hints
|
|
23662
23658
|
});
|
|
23663
23659
|
};
|
|
23664
23660
|
this.handleHintMove = (i, dir) => {
|
|
23665
|
-
const hints =
|
|
23666
|
-
// @ts-expect-error - TS2339 - Property 'splice' does not exist on type 'Hint'.
|
|
23661
|
+
const hints = [...this.props.hints];
|
|
23667
23662
|
const hint = hints.splice(i, 1)[0];
|
|
23668
|
-
// @ts-expect-error - TS2339 - Property 'splice' does not exist on type 'Hint'.
|
|
23669
23663
|
hints.splice(i + dir, 0, hint);
|
|
23670
|
-
// @ts-expect-error - TS2322 - Type 'Hint' is not assignable to type 'readonly Hint[]'.
|
|
23671
23664
|
this.props.onChange({
|
|
23672
23665
|
hints: hints
|
|
23673
23666
|
}, () => {
|
|
@@ -23677,10 +23670,10 @@ class CombinedHintsEditor extends React.Component {
|
|
|
23677
23670
|
});
|
|
23678
23671
|
};
|
|
23679
23672
|
this.addHint = () => {
|
|
23680
|
-
const hints =
|
|
23681
|
-
|
|
23682
|
-
|
|
23683
|
-
|
|
23673
|
+
const hints = this.props.hints.concat([{
|
|
23674
|
+
content: "",
|
|
23675
|
+
images: {},
|
|
23676
|
+
widgets: {}
|
|
23684
23677
|
}]);
|
|
23685
23678
|
this.props.onChange({
|
|
23686
23679
|
hints: hints
|
|
@@ -23800,65 +23793,65 @@ class ItemExtrasEditor extends React.Component {
|
|
|
23800
23793
|
}, /*#__PURE__*/React.createElement("div", {
|
|
23801
23794
|
className: "perseus-answer-options"
|
|
23802
23795
|
}, /*#__PURE__*/React.createElement(ItemExtraCheckbox, {
|
|
23803
|
-
label: "Show calculator
|
|
23796
|
+
label: "Show calculator",
|
|
23804
23797
|
infoTip: "Use the calculator when completing difficult calculations is NOT the intent of the question. DON\u2019T use the calculator when testing the student\u2019s ability to complete different types of computations.",
|
|
23805
23798
|
checked: this.props.calculator,
|
|
23806
|
-
onChange:
|
|
23799
|
+
onChange: newCheckedState => {
|
|
23807
23800
|
this.props.onChange({
|
|
23808
|
-
calculator:
|
|
23801
|
+
calculator: newCheckedState
|
|
23809
23802
|
});
|
|
23810
23803
|
}
|
|
23811
23804
|
}), /*#__PURE__*/React.createElement(ItemExtraCheckbox, {
|
|
23812
|
-
label: "Show financial calculator
|
|
23805
|
+
label: "Show financial calculator",
|
|
23813
23806
|
infoTip: "This provides the student with the ability to view a financial calculator, e.g., for answering financial questions. Once checked, requires at least one of the three options below to be checked.",
|
|
23814
23807
|
checked: this.shouldShowFinancialCalculatorOptions(),
|
|
23815
|
-
onChange:
|
|
23808
|
+
onChange: newCheckedState => {
|
|
23816
23809
|
// If the financial calculator is unchecked,
|
|
23817
23810
|
// these need to be reset. All checked by
|
|
23818
23811
|
// default.
|
|
23819
23812
|
this.props.onChange({
|
|
23820
|
-
financialCalculatorMonthlyPayment:
|
|
23821
|
-
financialCalculatorTotalAmount:
|
|
23822
|
-
financialCalculatorTimeToPayOff:
|
|
23813
|
+
financialCalculatorMonthlyPayment: newCheckedState,
|
|
23814
|
+
financialCalculatorTotalAmount: newCheckedState,
|
|
23815
|
+
financialCalculatorTimeToPayOff: newCheckedState
|
|
23823
23816
|
});
|
|
23824
23817
|
}
|
|
23825
23818
|
}), this.shouldShowFinancialCalculatorOptions() && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ItemExtraCheckbox, {
|
|
23826
|
-
label: "Include monthly payment
|
|
23819
|
+
label: "Include monthly payment",
|
|
23827
23820
|
infoTip: "This provides the student with the ability to view a monthly payment calculator; e.g., given a loan amount, interest rate, and term, what is the monthly payment?",
|
|
23828
23821
|
checked: this.props.financialCalculatorMonthlyPayment,
|
|
23829
|
-
onChange:
|
|
23822
|
+
onChange: newCheckedState => {
|
|
23830
23823
|
this.props.onChange({
|
|
23831
|
-
financialCalculatorMonthlyPayment:
|
|
23824
|
+
financialCalculatorMonthlyPayment: newCheckedState
|
|
23832
23825
|
});
|
|
23833
23826
|
},
|
|
23834
23827
|
indent: true
|
|
23835
23828
|
}), /*#__PURE__*/React.createElement(ItemExtraCheckbox, {
|
|
23836
|
-
label: "Include total amount
|
|
23829
|
+
label: "Include total amount",
|
|
23837
23830
|
infoTip: "This provides the student with the ability to view a total amount calculator; e.g., given a monthly payment, interest rate, and term, what is the total amount to be paid?",
|
|
23838
23831
|
checked: this.props.financialCalculatorTotalAmount,
|
|
23839
|
-
onChange:
|
|
23832
|
+
onChange: newCheckedState => {
|
|
23840
23833
|
this.props.onChange({
|
|
23841
|
-
financialCalculatorTotalAmount:
|
|
23834
|
+
financialCalculatorTotalAmount: newCheckedState
|
|
23842
23835
|
});
|
|
23843
23836
|
},
|
|
23844
23837
|
indent: true
|
|
23845
23838
|
}), /*#__PURE__*/React.createElement(ItemExtraCheckbox, {
|
|
23846
|
-
label: "Include time-to-pay-off
|
|
23839
|
+
label: "Include time-to-pay-off",
|
|
23847
23840
|
infoTip: "This provides the student with the ability to view a time to pay off calculator; e.g., given a loan amount, interest rate, and monthly payment, how long will it take to pay off the loan?",
|
|
23848
23841
|
checked: this.props.financialCalculatorTimeToPayOff,
|
|
23849
|
-
onChange:
|
|
23842
|
+
onChange: newCheckedState => {
|
|
23850
23843
|
this.props.onChange({
|
|
23851
|
-
financialCalculatorTimeToPayOff:
|
|
23844
|
+
financialCalculatorTimeToPayOff: newCheckedState
|
|
23852
23845
|
});
|
|
23853
23846
|
},
|
|
23854
23847
|
indent: true
|
|
23855
23848
|
})), /*#__PURE__*/React.createElement(ItemExtraCheckbox, {
|
|
23856
|
-
label: "Show periodic table
|
|
23849
|
+
label: "Show periodic table",
|
|
23857
23850
|
infoTip: "This provides the student with the ability to view a periodic table of the elements, e.g., for answering chemistry questions.",
|
|
23858
23851
|
checked: this.props.periodicTable,
|
|
23859
|
-
onChange:
|
|
23852
|
+
onChange: newCheckedState => {
|
|
23860
23853
|
this.props.onChange({
|
|
23861
|
-
periodicTable:
|
|
23854
|
+
periodicTable: newCheckedState,
|
|
23862
23855
|
// If the periodic table is unchecked,
|
|
23863
23856
|
// this needs to be reset. If table is
|
|
23864
23857
|
// checked, it should already be false.
|
|
@@ -23866,40 +23859,40 @@ class ItemExtrasEditor extends React.Component {
|
|
|
23866
23859
|
});
|
|
23867
23860
|
}
|
|
23868
23861
|
}), this.props.periodicTable && /*#__PURE__*/React.createElement(ItemExtraCheckbox, {
|
|
23869
|
-
label: "Include key/legend with periodic table
|
|
23862
|
+
label: "Include key/legend with periodic table",
|
|
23870
23863
|
infoTip: "Include a key for HS courses; omit for AP chemistry.",
|
|
23871
23864
|
checked: this.props.periodicTableWithKey,
|
|
23872
|
-
onChange:
|
|
23865
|
+
onChange: newCheckedState => {
|
|
23873
23866
|
this.props.onChange({
|
|
23874
|
-
periodicTableWithKey:
|
|
23867
|
+
periodicTableWithKey: newCheckedState
|
|
23875
23868
|
});
|
|
23876
23869
|
},
|
|
23877
23870
|
indent: true
|
|
23878
23871
|
}), /*#__PURE__*/React.createElement(ItemExtraCheckbox, {
|
|
23879
|
-
label: "Show z table (statistics)
|
|
23872
|
+
label: "Show z table (statistics)",
|
|
23880
23873
|
infoTip: "This provides the student with the ability to view a table of critical values for the z distribution, e.g. for answering statistics questions.",
|
|
23881
23874
|
checked: this.props.zTable,
|
|
23882
|
-
onChange:
|
|
23875
|
+
onChange: newCheckedState => {
|
|
23883
23876
|
this.props.onChange({
|
|
23884
|
-
zTable:
|
|
23877
|
+
zTable: newCheckedState
|
|
23885
23878
|
});
|
|
23886
23879
|
}
|
|
23887
23880
|
}), /*#__PURE__*/React.createElement(ItemExtraCheckbox, {
|
|
23888
|
-
label: "Show t table (statistics)
|
|
23881
|
+
label: "Show t table (statistics)",
|
|
23889
23882
|
infoTip: "This provides the student with the ability to view a table of critical values for the Student's t distribution, e.g. for answering statistics questions.",
|
|
23890
23883
|
checked: this.props.tTable,
|
|
23891
|
-
onChange:
|
|
23884
|
+
onChange: newCheckedState => {
|
|
23892
23885
|
this.props.onChange({
|
|
23893
|
-
tTable:
|
|
23886
|
+
tTable: newCheckedState
|
|
23894
23887
|
});
|
|
23895
23888
|
}
|
|
23896
23889
|
}), /*#__PURE__*/React.createElement(ItemExtraCheckbox, {
|
|
23897
|
-
label: "Show chi-squared table (statistics)
|
|
23890
|
+
label: "Show chi-squared table (statistics)",
|
|
23898
23891
|
infoTip: "This provides the student with the ability to view a table of critical values for the chi-squared distribution, e.g. for answering statistics questions.",
|
|
23899
23892
|
checked: this.props.chi2Table,
|
|
23900
|
-
onChange:
|
|
23893
|
+
onChange: newCheckedState => {
|
|
23901
23894
|
this.props.onChange({
|
|
23902
|
-
chi2Table:
|
|
23895
|
+
chi2Table: newCheckedState
|
|
23903
23896
|
});
|
|
23904
23897
|
}
|
|
23905
23898
|
})));
|
|
@@ -23916,15 +23909,22 @@ ItemExtrasEditor.defaultProps = {
|
|
|
23916
23909
|
tTable: false,
|
|
23917
23910
|
zTable: false
|
|
23918
23911
|
};
|
|
23919
|
-
const ItemExtraCheckbox = props => /*#__PURE__*/React.createElement(
|
|
23920
|
-
style:
|
|
23921
|
-
|
|
23922
|
-
|
|
23923
|
-
|
|
23924
|
-
|
|
23912
|
+
const ItemExtraCheckbox = props => /*#__PURE__*/React.createElement(View, {
|
|
23913
|
+
style: [styles$O.checkbox, props.indent ? styles$O.indented : undefined]
|
|
23914
|
+
}, /*#__PURE__*/React.createElement(Checkbox$1, {
|
|
23915
|
+
label: /*#__PURE__*/React.createElement(View, {
|
|
23916
|
+
style: {
|
|
23917
|
+
flexDirection: "row"
|
|
23918
|
+
}
|
|
23919
|
+
}, props.label, " ", /*#__PURE__*/React.createElement(InfoTip$l, null, props.infoTip)),
|
|
23925
23920
|
checked: props.checked,
|
|
23926
|
-
onChange: props.onChange
|
|
23927
|
-
}))
|
|
23921
|
+
onChange: newCheckedState => props.onChange(newCheckedState)
|
|
23922
|
+
}));
|
|
23923
|
+
const styles$O = StyleSheet.create({
|
|
23924
|
+
indented: {
|
|
23925
|
+
marginInlineStart: spacing.large_24
|
|
23926
|
+
}
|
|
23927
|
+
});
|
|
23928
23928
|
|
|
23929
23929
|
const ITEM_DATA_VERSION = itemDataVersion;
|
|
23930
23930
|
class ItemEditor extends React.Component {
|
|
@@ -24591,7 +24591,7 @@ class SimpleButton extends React.Component {
|
|
|
24591
24591
|
} = _this$props,
|
|
24592
24592
|
otherProps = _objectWithoutPropertiesLoose(_this$props, _excluded$3);
|
|
24593
24593
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
24594
|
-
className: css(styles$
|
|
24594
|
+
className: css(styles$N.baseButton, color === "green" && styles$N.green, color === "orange" && styles$N.orange),
|
|
24595
24595
|
onClick: onClick
|
|
24596
24596
|
}, otherProps), children);
|
|
24597
24597
|
}
|
|
@@ -24606,7 +24606,7 @@ SimpleButton.defaultProps = {
|
|
|
24606
24606
|
color: "green",
|
|
24607
24607
|
onClick: () => {}
|
|
24608
24608
|
};
|
|
24609
|
-
const styles$
|
|
24609
|
+
const styles$N = StyleSheet.create({
|
|
24610
24610
|
baseButton: {
|
|
24611
24611
|
top: "0",
|
|
24612
24612
|
fontSize: "11px",
|
|
@@ -24826,23 +24826,23 @@ const LeafContainer = ({
|
|
|
24826
24826
|
}) => {
|
|
24827
24827
|
const hasPreviewHeading = shape.type === "content" || shape.type === "hint";
|
|
24828
24828
|
const previewHeading = hasPreviewHeading && /*#__PURE__*/React.createElement("div", {
|
|
24829
|
-
className: css(styles$
|
|
24829
|
+
className: css(styles$M.containerHeader)
|
|
24830
24830
|
}, /*#__PURE__*/React.createElement(Header, {
|
|
24831
24831
|
depth: path.length,
|
|
24832
|
-
className: css(styles$
|
|
24832
|
+
className: css(styles$M.containerTitle)
|
|
24833
24833
|
}, capitalize(name)));
|
|
24834
24834
|
return /*#__PURE__*/React.createElement("div", {
|
|
24835
|
-
className: css(styles$
|
|
24835
|
+
className: css(styles$M.container)
|
|
24836
24836
|
}, /*#__PURE__*/React.createElement("span", {
|
|
24837
|
-
className: css(styles$
|
|
24837
|
+
className: css(styles$M.row, styles$M.rowHeading)
|
|
24838
24838
|
}, /*#__PURE__*/React.createElement("div", {
|
|
24839
|
-
className: css(styles$
|
|
24839
|
+
className: css(styles$M.columnLeft)
|
|
24840
24840
|
}, /*#__PURE__*/React.createElement("div", {
|
|
24841
|
-
className: "pod-title " + css(styles$
|
|
24841
|
+
className: "pod-title " + css(styles$M.containerHeader)
|
|
24842
24842
|
}, /*#__PURE__*/React.createElement("div", {
|
|
24843
|
-
className: css(styles$
|
|
24843
|
+
className: css(styles$M.containerTitle)
|
|
24844
24844
|
}, capitalize(name)), controls)), /*#__PURE__*/React.createElement("div", {
|
|
24845
|
-
className: css(styles$
|
|
24845
|
+
className: css(styles$M.columnRight)
|
|
24846
24846
|
}, previewHeading)), children);
|
|
24847
24847
|
};
|
|
24848
24848
|
const ArrayContainer = props => {
|
|
@@ -24855,11 +24855,11 @@ const ArrayContainer = props => {
|
|
|
24855
24855
|
actions
|
|
24856
24856
|
} = props;
|
|
24857
24857
|
return /*#__PURE__*/React.createElement("div", {
|
|
24858
|
-
className: css(styles$
|
|
24858
|
+
className: css(styles$M.container)
|
|
24859
24859
|
}, controls && /*#__PURE__*/React.createElement("div", {
|
|
24860
|
-
className: css(styles$
|
|
24860
|
+
className: css(styles$M.columnLeft, styles$M.containerHeader)
|
|
24861
24861
|
}, controls), /*#__PURE__*/React.createElement("div", null, children), /*#__PURE__*/React.createElement("div", {
|
|
24862
|
-
className: css(styles$
|
|
24862
|
+
className: css(styles$M.columnLeft)
|
|
24863
24863
|
}, /*#__PURE__*/React.createElement("a", {
|
|
24864
24864
|
href: "javascript:void 0",
|
|
24865
24865
|
onClick: () => actions.addArrayElement(path, shape.elementShape)
|
|
@@ -24872,28 +24872,28 @@ const ObjectContainer = ({
|
|
|
24872
24872
|
path
|
|
24873
24873
|
}) => {
|
|
24874
24874
|
const headingEditor = /*#__PURE__*/React.createElement("div", {
|
|
24875
|
-
className: css(styles$
|
|
24875
|
+
className: css(styles$M.containerHeader)
|
|
24876
24876
|
}, /*#__PURE__*/React.createElement(Header, {
|
|
24877
24877
|
depth: path.length,
|
|
24878
|
-
className: css(styles$
|
|
24878
|
+
className: css(styles$M.containerTitle)
|
|
24879
24879
|
}, capitalize(name)), controls);
|
|
24880
24880
|
const headingPreview = (name || controls) && /*#__PURE__*/React.createElement("div", {
|
|
24881
|
-
className: css(styles$
|
|
24881
|
+
className: css(styles$M.containerHeader, styles$M.previewCollectionHeader)
|
|
24882
24882
|
}, /*#__PURE__*/React.createElement(Header, {
|
|
24883
24883
|
depth: path.length,
|
|
24884
|
-
className: css(styles$
|
|
24884
|
+
className: css(styles$M.containerTitle)
|
|
24885
24885
|
}, capitalize(name)));
|
|
24886
24886
|
const hasBothHeadings = headingEditor && headingPreview;
|
|
24887
24887
|
return /*#__PURE__*/React.createElement("div", {
|
|
24888
|
-
className: css(styles$
|
|
24888
|
+
className: css(styles$M.container)
|
|
24889
24889
|
}, hasBothHeadings && /*#__PURE__*/React.createElement("span", {
|
|
24890
|
-
className: css(styles$
|
|
24890
|
+
className: css(styles$M.row)
|
|
24891
24891
|
}, /*#__PURE__*/React.createElement("div", {
|
|
24892
|
-
className: css(styles$
|
|
24892
|
+
className: css(styles$M.columnLeft)
|
|
24893
24893
|
}, headingEditor), /*#__PURE__*/React.createElement("div", {
|
|
24894
|
-
className: css(styles$
|
|
24894
|
+
className: css(styles$M.columnRight)
|
|
24895
24895
|
}, headingPreview)), /*#__PURE__*/React.createElement("div", {
|
|
24896
|
-
className: css(path.length > 0 && styles$
|
|
24896
|
+
className: css(path.length > 0 && styles$M.contentIndent)
|
|
24897
24897
|
}, children));
|
|
24898
24898
|
};
|
|
24899
24899
|
|
|
@@ -25016,11 +25016,11 @@ const ItemNodeContent = withStickiness(props => {
|
|
|
25016
25016
|
className: "framework-perseus"
|
|
25017
25017
|
}, lens(renderers).get(path));
|
|
25018
25018
|
return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("div", {
|
|
25019
|
-
className: css(styles$
|
|
25019
|
+
className: css(styles$M.row)
|
|
25020
25020
|
}, /*#__PURE__*/React.createElement("div", {
|
|
25021
|
-
className: css(styles$
|
|
25021
|
+
className: css(styles$M.columnLeft)
|
|
25022
25022
|
}, /*#__PURE__*/React.createElement("div", {
|
|
25023
|
-
className: css(sticky && styles$
|
|
25023
|
+
className: css(sticky && styles$M.sticky)
|
|
25024
25024
|
},
|
|
25025
25025
|
/*#__PURE__*/
|
|
25026
25026
|
// @ts-expect-error - TS2769 - No overload matches this call.
|
|
@@ -25028,9 +25028,9 @@ const ItemNodeContent = withStickiness(props => {
|
|
|
25028
25028
|
onChange: newVal => actions.mergeValueAtPath(path, newVal),
|
|
25029
25029
|
apiOptions: apiOptions
|
|
25030
25030
|
})))), /*#__PURE__*/React.createElement("div", {
|
|
25031
|
-
className: css(styles$
|
|
25031
|
+
className: css(styles$M.columnRight)
|
|
25032
25032
|
}, /*#__PURE__*/React.createElement("div", {
|
|
25033
|
-
className: css(sticky && styles$
|
|
25033
|
+
className: css(sticky && styles$M.sticky)
|
|
25034
25034
|
}, preview))));
|
|
25035
25035
|
});
|
|
25036
25036
|
const HintNodeContent = withStickiness(props => {
|
|
@@ -25046,13 +25046,13 @@ const HintNodeContent = withStickiness(props => {
|
|
|
25046
25046
|
className: "framework-perseus"
|
|
25047
25047
|
}, lens(renderers).get(path));
|
|
25048
25048
|
return /*#__PURE__*/React.createElement("div", {
|
|
25049
|
-
className: css(styles$
|
|
25049
|
+
className: css(styles$M.row)
|
|
25050
25050
|
}, /*#__PURE__*/React.createElement("div", {
|
|
25051
|
-
className: css(styles$
|
|
25051
|
+
className: css(styles$M.columnLeft)
|
|
25052
25052
|
}, /*#__PURE__*/React.createElement("div", {
|
|
25053
|
-
className: css(sticky && styles$
|
|
25053
|
+
className: css(sticky && styles$M.sticky)
|
|
25054
25054
|
}, /*#__PURE__*/React.createElement(HintEditor, _extends({}, data, {
|
|
25055
|
-
className: css(styles$
|
|
25055
|
+
className: css(styles$M.hintEditor),
|
|
25056
25056
|
onChange: newVal => actions.mergeValueAtPath(path, newVal),
|
|
25057
25057
|
apiOptions: apiOptions,
|
|
25058
25058
|
showTitle: false,
|
|
@@ -25067,9 +25067,9 @@ const HintNodeContent = withStickiness(props => {
|
|
|
25067
25067
|
isFirst: true,
|
|
25068
25068
|
isLast: true
|
|
25069
25069
|
})))), /*#__PURE__*/React.createElement("div", {
|
|
25070
|
-
className: css(styles$
|
|
25070
|
+
className: css(styles$M.columnRight)
|
|
25071
25071
|
}, /*#__PURE__*/React.createElement("div", {
|
|
25072
|
-
className: css(sticky && styles$
|
|
25072
|
+
className: css(sticky && styles$M.sticky)
|
|
25073
25073
|
}, preview)));
|
|
25074
25074
|
});
|
|
25075
25075
|
const TagsNodeContent = props => {
|
|
@@ -25086,9 +25086,9 @@ const TagsNodeContent = props => {
|
|
|
25086
25086
|
return null;
|
|
25087
25087
|
}
|
|
25088
25088
|
return /*#__PURE__*/React.createElement("div", {
|
|
25089
|
-
className: css(styles$
|
|
25089
|
+
className: css(styles$M.columnLeft)
|
|
25090
25090
|
}, /*#__PURE__*/React.createElement("div", {
|
|
25091
|
-
className: css(styles$
|
|
25091
|
+
className: css(styles$M.tagsEditor)
|
|
25092
25092
|
}, /*#__PURE__*/React.createElement(GroupMetadataEditor, {
|
|
25093
25093
|
value: data,
|
|
25094
25094
|
onChange: newVal => actions.setValueAtPath(path, newVal),
|
|
@@ -25119,23 +25119,23 @@ const ArrayNodeContent = props => {
|
|
|
25119
25119
|
const subpath = path.concat(i);
|
|
25120
25120
|
const controls = [i > 0 && /*#__PURE__*/React.createElement("div", {
|
|
25121
25121
|
key: "moveArrayElementUp",
|
|
25122
|
-
className: css(styles$
|
|
25122
|
+
className: css(styles$M.control)
|
|
25123
25123
|
}, /*#__PURE__*/React.createElement(SimpleButton, {
|
|
25124
25124
|
color: "orange",
|
|
25125
25125
|
title: "Move up",
|
|
25126
25126
|
onClick: () => actions.moveArrayElementUp(subpath)
|
|
25127
25127
|
}, /*#__PURE__*/React.createElement("div", {
|
|
25128
|
-
className: css(styles$
|
|
25128
|
+
className: css(styles$M.verticalFlip)
|
|
25129
25129
|
}, /*#__PURE__*/React.createElement(InlineIcon$5, iconChevronDown)))), i < data.length - 1 && /*#__PURE__*/React.createElement("div", {
|
|
25130
25130
|
key: "moveArrayElementDown",
|
|
25131
|
-
className: css(styles$
|
|
25131
|
+
className: css(styles$M.control)
|
|
25132
25132
|
}, /*#__PURE__*/React.createElement(SimpleButton, {
|
|
25133
25133
|
color: "orange",
|
|
25134
25134
|
title: "Move down",
|
|
25135
25135
|
onClick: () => actions.moveArrayElementDown(subpath)
|
|
25136
25136
|
}, /*#__PURE__*/React.createElement(InlineIcon$5, iconChevronDown))), /*#__PURE__*/React.createElement("div", {
|
|
25137
25137
|
key: "removeArrayElement",
|
|
25138
|
-
className: css(styles$
|
|
25138
|
+
className: css(styles$M.control)
|
|
25139
25139
|
}, /*#__PURE__*/React.createElement(SimpleButton, {
|
|
25140
25140
|
color: "orange",
|
|
25141
25141
|
title: "Delete",
|
|
@@ -25143,7 +25143,7 @@ const ArrayNodeContent = props => {
|
|
|
25143
25143
|
}, /*#__PURE__*/React.createElement(InlineIcon$5, iconTrash$4)))];
|
|
25144
25144
|
return /*#__PURE__*/React.createElement("div", {
|
|
25145
25145
|
key: i,
|
|
25146
|
-
className: css(styles$
|
|
25146
|
+
className: css(styles$M.arrayElement, !elementIsLeaf && styles$M.arrayElementAndNotLeaf)
|
|
25147
25147
|
}, /*#__PURE__*/React.createElement(NodeContainer, _extends({}, otherProps, {
|
|
25148
25148
|
key: i,
|
|
25149
25149
|
shape: shape.elementShape,
|
|
@@ -25169,7 +25169,7 @@ const ObjectNodeContent = props => {
|
|
|
25169
25169
|
// made sense to the shape's author is the order in which we'll iterate :)
|
|
25170
25170
|
const children = Object.keys(shape.shape).map(subkey => /*#__PURE__*/React.createElement("div", {
|
|
25171
25171
|
key: subkey,
|
|
25172
|
-
className: css(styles$
|
|
25172
|
+
className: css(styles$M.objectElement)
|
|
25173
25173
|
}, /*#__PURE__*/React.createElement(NodeContainer, _extends({}, otherProps, {
|
|
25174
25174
|
shape: shape.shape[subkey],
|
|
25175
25175
|
data: data[subkey],
|
|
@@ -25336,7 +25336,7 @@ class MultiRendererEditor extends React.Component {
|
|
|
25336
25336
|
}, this._renderContent());
|
|
25337
25337
|
}
|
|
25338
25338
|
}
|
|
25339
|
-
const styles$
|
|
25339
|
+
const styles$M = StyleSheet.create({
|
|
25340
25340
|
// This is used in a number of places throughout this file.
|
|
25341
25341
|
container: {},
|
|
25342
25342
|
// eslint-disable-next-line react-native/no-unused-styles
|
|
@@ -25500,7 +25500,6 @@ const StatefulEditorPage = createReactClass({
|
|
|
25500
25500
|
});
|
|
25501
25501
|
|
|
25502
25502
|
const {
|
|
25503
|
-
PropCheckBox: PropCheckBox$c,
|
|
25504
25503
|
TextListEditor: TextListEditor$4
|
|
25505
25504
|
} = components;
|
|
25506
25505
|
const Categorizer = Categorizer$1.widget;
|
|
@@ -25517,11 +25516,14 @@ class CategorizerEditor extends React.Component {
|
|
|
25517
25516
|
render() {
|
|
25518
25517
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
25519
25518
|
className: "perseus-widget-row"
|
|
25520
|
-
}, /*#__PURE__*/React.createElement(
|
|
25519
|
+
}, /*#__PURE__*/React.createElement(Checkbox$1, {
|
|
25521
25520
|
label: "Randomize item order",
|
|
25522
|
-
|
|
25523
|
-
|
|
25524
|
-
|
|
25521
|
+
checked: this.props.randomizeItems,
|
|
25522
|
+
onChange: value => {
|
|
25523
|
+
this.props.onChange({
|
|
25524
|
+
randomizeItems: value
|
|
25525
|
+
});
|
|
25526
|
+
}
|
|
25525
25527
|
})), "Categories:", /*#__PURE__*/React.createElement(TextListEditor$4, {
|
|
25526
25528
|
options: this.props.categories,
|
|
25527
25529
|
onChange: cat => {
|
|
@@ -25629,8 +25631,7 @@ class BlurInput extends React.Component {
|
|
|
25629
25631
|
}
|
|
25630
25632
|
|
|
25631
25633
|
const {
|
|
25632
|
-
InfoTip: InfoTip$k
|
|
25633
|
-
PropCheckBox: PropCheckBox$b
|
|
25634
|
+
InfoTip: InfoTip$k
|
|
25634
25635
|
} = components;
|
|
25635
25636
|
const DEFAULT_WIDTH = 400;
|
|
25636
25637
|
const DEFAULT_HEIGHT = 400;
|
|
@@ -25786,14 +25787,22 @@ class CSProgramEditor extends React.Component {
|
|
|
25786
25787
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", null, "Url or Program ID:", " ", /*#__PURE__*/React.createElement(BlurInput, {
|
|
25787
25788
|
value: this.props.programID,
|
|
25788
25789
|
onChange: this._handleProgramIDChange
|
|
25789
|
-
})), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(
|
|
25790
|
+
})), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Checkbox$1, {
|
|
25790
25791
|
label: "Show Editor",
|
|
25791
|
-
|
|
25792
|
-
onChange:
|
|
25793
|
-
|
|
25792
|
+
checked: this.props.showEditor,
|
|
25793
|
+
onChange: value => {
|
|
25794
|
+
this.props.onChange({
|
|
25795
|
+
showEditor: value
|
|
25796
|
+
});
|
|
25797
|
+
}
|
|
25798
|
+
}), /*#__PURE__*/React.createElement(InfoTip$k, 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(Checkbox$1, {
|
|
25794
25799
|
label: "Show Buttons",
|
|
25795
|
-
|
|
25796
|
-
onChange:
|
|
25800
|
+
checked: this.props.showButtons,
|
|
25801
|
+
onChange: value => {
|
|
25802
|
+
this.props.onChange({
|
|
25803
|
+
showButtons: value
|
|
25804
|
+
});
|
|
25805
|
+
}
|
|
25797
25806
|
}), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("label", null, "Settings:", /*#__PURE__*/React.createElement(PairsEditor$1, {
|
|
25798
25807
|
name: "settings",
|
|
25799
25808
|
pairs: this.props.settings,
|
|
@@ -25817,7 +25826,7 @@ CSProgramEditor.defaultProps = {
|
|
|
25817
25826
|
};
|
|
25818
25827
|
|
|
25819
25828
|
const {
|
|
25820
|
-
TextInput: TextInput$
|
|
25829
|
+
TextInput: TextInput$8
|
|
25821
25830
|
} = components;
|
|
25822
25831
|
class DefinitionEditor extends React.Component {
|
|
25823
25832
|
constructor(..._args) {
|
|
@@ -25837,7 +25846,7 @@ class DefinitionEditor extends React.Component {
|
|
|
25837
25846
|
target: "_blank"
|
|
25838
25847
|
}, "Definition style guide"), /*#__PURE__*/React.createElement("div", {
|
|
25839
25848
|
className: "perseus-widget-row"
|
|
25840
|
-
}, /*#__PURE__*/React.createElement("label", null, "Word to be defined:", " ", /*#__PURE__*/React.createElement(TextInput$
|
|
25849
|
+
}, /*#__PURE__*/React.createElement("label", null, "Word to be defined:", " ", /*#__PURE__*/React.createElement(TextInput$8, {
|
|
25841
25850
|
value: this.props.togglePrompt
|
|
25842
25851
|
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
25843
25852
|
,
|
|
@@ -26246,7 +26255,7 @@ ExampleWidgetEditor.defaultProps = {
|
|
|
26246
26255
|
};
|
|
26247
26256
|
|
|
26248
26257
|
const {
|
|
26249
|
-
TextInput: TextInput$
|
|
26258
|
+
TextInput: TextInput$7
|
|
26250
26259
|
} = components;
|
|
26251
26260
|
const defaultExplanationProps = {
|
|
26252
26261
|
showPrompt: "Explain",
|
|
@@ -26270,14 +26279,14 @@ class ExplanationEditor extends React.Component {
|
|
|
26270
26279
|
className: "perseus-widget-explanation-editor"
|
|
26271
26280
|
}, /*#__PURE__*/React.createElement("div", {
|
|
26272
26281
|
className: "perseus-widget-row"
|
|
26273
|
-
}, /*#__PURE__*/React.createElement("label", null, "Prompt to show explanation:", " ", /*#__PURE__*/React.createElement(TextInput$
|
|
26282
|
+
}, /*#__PURE__*/React.createElement("label", null, "Prompt to show explanation:", " ", /*#__PURE__*/React.createElement(TextInput$7, {
|
|
26274
26283
|
value: this.props.showPrompt
|
|
26275
26284
|
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
26276
26285
|
,
|
|
26277
26286
|
onChange: this.change("showPrompt")
|
|
26278
26287
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
26279
26288
|
className: "perseus-widget-row"
|
|
26280
|
-
}, /*#__PURE__*/React.createElement("label", null, "Prompt to hide explanation:", " ", /*#__PURE__*/React.createElement(TextInput$
|
|
26289
|
+
}, /*#__PURE__*/React.createElement("label", null, "Prompt to hide explanation:", " ", /*#__PURE__*/React.createElement(TextInput$7, {
|
|
26281
26290
|
value: this.props.hidePrompt
|
|
26282
26291
|
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
26283
26292
|
,
|
|
@@ -26314,9 +26323,106 @@ ExplanationEditor.propTypes = _extends({}, Changeable.propTypes, {
|
|
|
26314
26323
|
ExplanationEditor.widgetName = "explanation";
|
|
26315
26324
|
ExplanationEditor.defaultProps = defaultExplanationProps;
|
|
26316
26325
|
|
|
26326
|
+
const mediaDefaultSpecLargeMarginWidth = spacing.large_24;
|
|
26327
|
+
const MEDIA_DEFAULT_SPEC = {
|
|
26328
|
+
small: {
|
|
26329
|
+
query: "(max-width: 767px)",
|
|
26330
|
+
totalColumns: 4,
|
|
26331
|
+
gutterWidth: spacing.medium_16,
|
|
26332
|
+
marginWidth: spacing.medium_16
|
|
26333
|
+
},
|
|
26334
|
+
medium: {
|
|
26335
|
+
query: "(min-width: 768px) and (max-width: 1023px)",
|
|
26336
|
+
totalColumns: 8,
|
|
26337
|
+
gutterWidth: spacing.xLarge_32,
|
|
26338
|
+
marginWidth: spacing.large_24
|
|
26339
|
+
},
|
|
26340
|
+
large: {
|
|
26341
|
+
query: "(min-width: 1024px)",
|
|
26342
|
+
totalColumns: 12,
|
|
26343
|
+
gutterWidth: spacing.xLarge_32,
|
|
26344
|
+
marginWidth: mediaDefaultSpecLargeMarginWidth,
|
|
26345
|
+
maxWidth: 1120 + mediaDefaultSpecLargeMarginWidth * 2
|
|
26346
|
+
}
|
|
26347
|
+
};
|
|
26348
|
+
({
|
|
26349
|
+
large: {
|
|
26350
|
+
query: "(min-width: 1px)",
|
|
26351
|
+
totalColumns: 12,
|
|
26352
|
+
gutterWidth: spacing.xLarge_32,
|
|
26353
|
+
marginWidth: spacing.medium_16
|
|
26354
|
+
}
|
|
26355
|
+
});
|
|
26356
|
+
({
|
|
26357
|
+
small: {
|
|
26358
|
+
query: "(max-width: 767px)",
|
|
26359
|
+
totalColumns: 4,
|
|
26360
|
+
gutterWidth: spacing.medium_16,
|
|
26361
|
+
marginWidth: spacing.medium_16
|
|
26362
|
+
},
|
|
26363
|
+
large: {
|
|
26364
|
+
query: "(min-width: 768px)",
|
|
26365
|
+
totalColumns: 12,
|
|
26366
|
+
gutterWidth: spacing.xLarge_32,
|
|
26367
|
+
marginWidth: spacing.xxLarge_48
|
|
26368
|
+
}
|
|
26369
|
+
});
|
|
26370
|
+
|
|
26371
|
+
const defaultContext = {
|
|
26372
|
+
ssrSize: "large",
|
|
26373
|
+
mediaSpec: MEDIA_DEFAULT_SPEC
|
|
26374
|
+
};
|
|
26375
|
+
const MediaLayoutContext = React.createContext(defaultContext);
|
|
26376
|
+
MediaLayoutContext.displayName = "MediaLayoutContext";
|
|
26377
|
+
|
|
26378
|
+
class Spring extends React.Component {
|
|
26379
|
+
render() {
|
|
26380
|
+
const {
|
|
26381
|
+
style
|
|
26382
|
+
} = this.props;
|
|
26383
|
+
return React.createElement(View, {
|
|
26384
|
+
"aria-hidden": "true",
|
|
26385
|
+
style: [styles$L.grow, style]
|
|
26386
|
+
});
|
|
26387
|
+
}
|
|
26388
|
+
}
|
|
26389
|
+
const styles$L = StyleSheet.create({
|
|
26390
|
+
grow: {
|
|
26391
|
+
flexGrow: 1
|
|
26392
|
+
}
|
|
26393
|
+
});
|
|
26394
|
+
|
|
26395
|
+
class Strut extends React.Component {
|
|
26396
|
+
render() {
|
|
26397
|
+
const {
|
|
26398
|
+
size,
|
|
26399
|
+
style
|
|
26400
|
+
} = this.props;
|
|
26401
|
+
return React.createElement(View, {
|
|
26402
|
+
"aria-hidden": "true",
|
|
26403
|
+
style: [strutStyle(size), style]
|
|
26404
|
+
});
|
|
26405
|
+
}
|
|
26406
|
+
}
|
|
26407
|
+
const strutStyle = size => {
|
|
26408
|
+
return {
|
|
26409
|
+
width: size,
|
|
26410
|
+
MsFlexBasis: size,
|
|
26411
|
+
MsFlexPreferredSize: size,
|
|
26412
|
+
WebkitFlexBasis: size,
|
|
26413
|
+
flexBasis: size,
|
|
26414
|
+
flexShrink: 0
|
|
26415
|
+
};
|
|
26416
|
+
};
|
|
26417
|
+
|
|
26317
26418
|
const PT = PropTypes;
|
|
26318
26419
|
|
|
26319
|
-
|
|
26420
|
+
/**
|
|
26421
|
+
* Takes an array of components to sort.
|
|
26422
|
+
* As of 08/05/24, there are two sortable components
|
|
26423
|
+
* (one in perseus and one in perseus-editor).
|
|
26424
|
+
* As far as I can tell, this one is only used in ExpressionEditor.
|
|
26425
|
+
*/
|
|
26320
26426
|
// eslint-disable-next-line react/no-unsafe
|
|
26321
26427
|
const SortableArea = createReactClass({
|
|
26322
26428
|
displayName: "SortableArea",
|
|
@@ -26473,6 +26579,7 @@ const SortableItem = createReactClass({
|
|
|
26473
26579
|
e.preventDefault();
|
|
26474
26580
|
},
|
|
26475
26581
|
render: function () {
|
|
26582
|
+
// I think these might be getting styles from Webapp
|
|
26476
26583
|
let dragState = "sortable-disabled";
|
|
26477
26584
|
if (this.props.dragging) {
|
|
26478
26585
|
dragState = "sortable-dragging";
|
|
@@ -26481,7 +26588,7 @@ const SortableItem = createReactClass({
|
|
|
26481
26588
|
}
|
|
26482
26589
|
return /*#__PURE__*/React.createElement("li", {
|
|
26483
26590
|
draggable: this.props.draggable,
|
|
26484
|
-
className: dragState,
|
|
26591
|
+
className: [dragState, css(styles$K.sortableListItem)].join(" "),
|
|
26485
26592
|
onDragStart: this.handleDragStart,
|
|
26486
26593
|
onDrop: this.handleDrop,
|
|
26487
26594
|
onDragEnter: this.handleDragEnter,
|
|
@@ -26489,11 +26596,14 @@ const SortableItem = createReactClass({
|
|
|
26489
26596
|
}, this.props.component);
|
|
26490
26597
|
}
|
|
26491
26598
|
});
|
|
26599
|
+
const styles$K = StyleSheet.create({
|
|
26600
|
+
sortableListItem: {
|
|
26601
|
+
margin: "5px 0"
|
|
26602
|
+
}
|
|
26603
|
+
});
|
|
26492
26604
|
|
|
26493
26605
|
const {
|
|
26494
|
-
InfoTip: InfoTip$i
|
|
26495
|
-
PropCheckBox: PropCheckBox$a,
|
|
26496
|
-
TextInput: TextInput$7
|
|
26606
|
+
InfoTip: InfoTip$i
|
|
26497
26607
|
} = components;
|
|
26498
26608
|
|
|
26499
26609
|
// types for iterables
|
|
@@ -26532,8 +26642,8 @@ const _makeNewKey = answerForms => {
|
|
|
26532
26642
|
return usedKeys.length;
|
|
26533
26643
|
};
|
|
26534
26644
|
class ExpressionEditor extends React.Component {
|
|
26535
|
-
constructor(
|
|
26536
|
-
super(
|
|
26645
|
+
constructor(_props) {
|
|
26646
|
+
super(_props);
|
|
26537
26647
|
this.serialize = () => {
|
|
26538
26648
|
const formSerializables = ["value", "form", "simplify", "considered",
|
|
26539
26649
|
// it's a little weird to serialize the react key, but saves some
|
|
@@ -26662,11 +26772,17 @@ class ExpressionEditor extends React.Component {
|
|
|
26662
26772
|
this.refs.expression.insert(str);
|
|
26663
26773
|
};
|
|
26664
26774
|
// called when the function variables change
|
|
26665
|
-
this.handleFunctions =
|
|
26775
|
+
this.handleFunctions = value => {
|
|
26776
|
+
this.setState({
|
|
26777
|
+
functionsInternal: value
|
|
26778
|
+
});
|
|
26666
26779
|
const newProps = {};
|
|
26667
|
-
newProps.functions =
|
|
26780
|
+
newProps.functions = value.split(/[ ,]+/).filter(isTruthy);
|
|
26668
26781
|
this.props.onChange(newProps);
|
|
26669
26782
|
};
|
|
26783
|
+
this.state = {
|
|
26784
|
+
functionsInternal: this.props.functions.join(" ")
|
|
26785
|
+
};
|
|
26670
26786
|
}
|
|
26671
26787
|
change(...args) {
|
|
26672
26788
|
return Changeable.change.apply(this, args);
|
|
@@ -26704,78 +26820,69 @@ class ExpressionEditor extends React.Component {
|
|
|
26704
26820
|
}, obj)));
|
|
26705
26821
|
const sortable = /*#__PURE__*/React.createElement(SortableArea, {
|
|
26706
26822
|
components: answerOptions,
|
|
26707
|
-
onReorder: this.handleReorder
|
|
26708
|
-
className: "answer-options-list"
|
|
26823
|
+
onReorder: this.handleReorder
|
|
26709
26824
|
});
|
|
26710
26825
|
|
|
26711
26826
|
// checkboxes to choose which sets of input buttons are shown
|
|
26712
26827
|
const buttonSetChoices = buttonSetsList.map(name => {
|
|
26713
26828
|
// The first one gets special cased to always be checked, disabled,
|
|
26714
26829
|
// and float left.
|
|
26715
|
-
const
|
|
26716
|
-
const checked = this.props.buttonSets.includes(name) ||
|
|
26717
|
-
return /*#__PURE__*/React.createElement(
|
|
26718
|
-
|
|
26719
|
-
|
|
26720
|
-
}, /*#__PURE__*/React.createElement("input", {
|
|
26721
|
-
type: "checkbox",
|
|
26830
|
+
const isBasic = name === "basic";
|
|
26831
|
+
const checked = this.props.buttonSets.includes(name) || isBasic;
|
|
26832
|
+
return /*#__PURE__*/React.createElement(Checkbox$1, {
|
|
26833
|
+
key: name,
|
|
26834
|
+
label: name,
|
|
26722
26835
|
checked: checked,
|
|
26723
|
-
disabled:
|
|
26836
|
+
disabled: isBasic,
|
|
26724
26837
|
onChange: () => this.handleButtonSet(name)
|
|
26725
|
-
})
|
|
26838
|
+
});
|
|
26726
26839
|
});
|
|
26727
|
-
|
|
26728
|
-
|
|
26729
|
-
|
|
26730
|
-
|
|
26731
|
-
buttonSetChoices.unshift( /*#__PURE__*/React.createElement("label", {
|
|
26732
|
-
className: "button-set-label",
|
|
26733
|
-
key: "show-div"
|
|
26734
|
-
}, /*#__PURE__*/React.createElement("input", {
|
|
26735
|
-
type: "checkbox",
|
|
26840
|
+
buttonSetChoices.unshift( /*#__PURE__*/React.createElement(Checkbox$1, {
|
|
26841
|
+
key: "show \xF7 button",
|
|
26842
|
+
label: "show \xF7 button",
|
|
26843
|
+
checked: this.props.buttonSets.includes("basic+div"),
|
|
26736
26844
|
onChange: this.handleToggleDiv
|
|
26737
|
-
})
|
|
26738
|
-
|
|
26739
|
-
|
|
26740
|
-
|
|
26741
|
-
|
|
26742
|
-
|
|
26743
|
-
className: "expression-editor-h3"
|
|
26744
|
-
}, "Global Options"), /*#__PURE__*/React.createElement("div", {
|
|
26745
|
-
className: "perseus-widget-row"
|
|
26746
|
-
}, /*#__PURE__*/React.createElement("label", null, "Visible label:", " ", /*#__PURE__*/React.createElement(TextInput$7, {
|
|
26747
|
-
value: this.props.visibleLabel,
|
|
26845
|
+
}));
|
|
26846
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(HeadingSmall, null, "Global Options"), /*#__PURE__*/React.createElement("div", {
|
|
26847
|
+
className: css(styles$J.paddedY)
|
|
26848
|
+
}, /*#__PURE__*/React.createElement(LabeledTextField, {
|
|
26849
|
+
label: "Visible label",
|
|
26850
|
+
value: this.props.visibleLabel || "",
|
|
26748
26851
|
onChange: this.change("visibleLabel")
|
|
26749
|
-
})
|
|
26750
|
-
className:
|
|
26751
|
-
}, /*#__PURE__*/React.createElement(
|
|
26752
|
-
|
|
26852
|
+
}), /*#__PURE__*/React.createElement(InfoTip$i, null, /*#__PURE__*/React.createElement("p", null, "Optional visible text; strongly encouraged to help learners using dictation software, but can be omitted if the surrounding content provides enough context."))), /*#__PURE__*/React.createElement("div", {
|
|
26853
|
+
className: css(styles$J.paddedY)
|
|
26854
|
+
}, /*#__PURE__*/React.createElement(LabeledTextField, {
|
|
26855
|
+
label: "Aria label",
|
|
26856
|
+
value: this.props.ariaLabel || "",
|
|
26753
26857
|
onChange: this.change("ariaLabel")
|
|
26754
|
-
})
|
|
26858
|
+
}), /*#__PURE__*/React.createElement(InfoTip$i, null, /*#__PURE__*/React.createElement("p", null, "Label text that's read by screen readers. Highly recommend adding a label here to ensure your exercise is accessible. For more information on writting accessible labels, please see", " ", /*#__PURE__*/React.createElement("a", {
|
|
26755
26859
|
href: "https://www.w3.org/WAI/tips/designing/#ensure-that-form-elements-include-clearly-associated-labels",
|
|
26756
26860
|
target: "_blank"
|
|
26757
|
-
}, "this article.")))), /*#__PURE__*/React.createElement("div",
|
|
26758
|
-
|
|
26759
|
-
|
|
26760
|
-
|
|
26761
|
-
|
|
26762
|
-
}), /*#__PURE__*/React.createElement(InfoTip$i, 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", {
|
|
26763
|
-
type: "text",
|
|
26764
|
-
defaultValue: this.props.functions.join(" "),
|
|
26861
|
+
}, "this article.")))), /*#__PURE__*/React.createElement("div", {
|
|
26862
|
+
className: css(styles$J.paddedY)
|
|
26863
|
+
}, /*#__PURE__*/React.createElement(LabeledTextField, {
|
|
26864
|
+
label: "Function variables",
|
|
26865
|
+
value: this.state.functionsInternal,
|
|
26765
26866
|
onChange: this.handleFunctions
|
|
26766
|
-
})
|
|
26767
|
-
className:
|
|
26768
|
-
},
|
|
26867
|
+
}), /*#__PURE__*/React.createElement(InfoTip$i, 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", {
|
|
26868
|
+
className: css(styles$J.paddedY)
|
|
26869
|
+
}, /*#__PURE__*/React.createElement(Checkbox$1, {
|
|
26870
|
+
label: "Use \xD7 instead of \u22C5 for multiplication",
|
|
26871
|
+
checked: this.props.times,
|
|
26872
|
+
onChange: value => {
|
|
26873
|
+
this.props.onChange({
|
|
26874
|
+
times: value
|
|
26875
|
+
});
|
|
26876
|
+
}
|
|
26877
|
+
}), /*#__PURE__*/React.createElement(InfoTip$i, 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", {
|
|
26878
|
+
className: css(styles$J.paddedY)
|
|
26879
|
+
}, /*#__PURE__*/React.createElement(HeadingXSmall, null, "Button Sets"), buttonSetChoices), /*#__PURE__*/React.createElement(HeadingSmall, null, "Answers"), /*#__PURE__*/React.createElement("p", {
|
|
26769
26880
|
style: {
|
|
26770
26881
|
margin: "4px 0"
|
|
26771
26882
|
}
|
|
26772
|
-
}, "student responses area matched against these from top to bottom"), sortable, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(
|
|
26773
|
-
|
|
26774
|
-
|
|
26775
|
-
fontSize: 13
|
|
26776
|
-
},
|
|
26777
|
-
onClick: this.newAnswer,
|
|
26778
|
-
type: "button"
|
|
26883
|
+
}, "student responses area matched against these from top to bottom"), sortable, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Button, {
|
|
26884
|
+
size: "small",
|
|
26885
|
+
onClick: this.newAnswer
|
|
26779
26886
|
}, "Add new answer")));
|
|
26780
26887
|
}
|
|
26781
26888
|
}
|
|
@@ -26799,17 +26906,17 @@ class AnswerOption extends React.Component {
|
|
|
26799
26906
|
this.state = {
|
|
26800
26907
|
deleteFocused: false
|
|
26801
26908
|
};
|
|
26802
|
-
this.handleDeleteBlur = () => {
|
|
26803
|
-
this.setState({
|
|
26804
|
-
deleteFocused: false
|
|
26805
|
-
});
|
|
26806
|
-
};
|
|
26807
26909
|
this.change = (...args) => {
|
|
26808
26910
|
return Changeable.change.apply(this, args);
|
|
26809
26911
|
};
|
|
26810
26912
|
this.handleImSure = () => {
|
|
26811
26913
|
this.props.onDelete();
|
|
26812
26914
|
};
|
|
26915
|
+
this.handleCancelDelete = () => {
|
|
26916
|
+
this.setState({
|
|
26917
|
+
deleteFocused: false
|
|
26918
|
+
});
|
|
26919
|
+
};
|
|
26813
26920
|
this.handleDelete = () => {
|
|
26814
26921
|
this.setState({
|
|
26815
26922
|
deleteFocused: true
|
|
@@ -26823,53 +26930,100 @@ class AnswerOption extends React.Component {
|
|
|
26823
26930
|
};
|
|
26824
26931
|
}
|
|
26825
26932
|
render() {
|
|
26826
|
-
|
|
26827
|
-
|
|
26828
|
-
|
|
26829
|
-
|
|
26830
|
-
|
|
26831
|
-
|
|
26832
|
-
|
|
26833
|
-
|
|
26834
|
-
|
|
26835
|
-
|
|
26836
|
-
|
|
26837
|
-
|
|
26838
|
-
|
|
26839
|
-
|
|
26840
|
-
|
|
26933
|
+
const removeButton = this.state.deleteFocused ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
26934
|
+
size: "small",
|
|
26935
|
+
onClick: this.handleImSure,
|
|
26936
|
+
color: "destructive"
|
|
26937
|
+
}, "I'm sure!"), /*#__PURE__*/React.createElement(Strut, {
|
|
26938
|
+
size: spacing.small_12
|
|
26939
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
26940
|
+
size: "small",
|
|
26941
|
+
onClick: this.handleCancelDelete,
|
|
26942
|
+
light: true
|
|
26943
|
+
}, "Cancel")) : /*#__PURE__*/React.createElement(Button, {
|
|
26944
|
+
size: "small",
|
|
26945
|
+
onClick: this.handleDelete,
|
|
26946
|
+
color: "destructive",
|
|
26947
|
+
light: true
|
|
26948
|
+
}, "Delete");
|
|
26949
|
+
const answerStatusCss = css(styles$J.answerStatus, this.props.considered === "wrong" && styles$J.answerStatusWrong, this.props.considered === "correct" && styles$J.answerStatusCorrect, this.props.considered === "ungraded" && styles$J.answerStatusUngraded);
|
|
26841
26950
|
return /*#__PURE__*/React.createElement("div", {
|
|
26842
|
-
className:
|
|
26951
|
+
className: css(styles$J.answerOption)
|
|
26843
26952
|
}, /*#__PURE__*/React.createElement("div", {
|
|
26844
|
-
className:
|
|
26953
|
+
className: css(styles$J.answerHandle)
|
|
26845
26954
|
}), /*#__PURE__*/React.createElement("div", {
|
|
26846
|
-
className:
|
|
26847
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
26848
|
-
className: "answer-considered"
|
|
26849
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
26955
|
+
className: css(styles$J.answerBody)
|
|
26956
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("button", {
|
|
26850
26957
|
onClick: this.toggleConsidered,
|
|
26851
|
-
className:
|
|
26852
|
-
}, this.props.considered), /*#__PURE__*/React.createElement("div", {
|
|
26853
|
-
className:
|
|
26854
|
-
}, /*#__PURE__*/React.createElement(
|
|
26855
|
-
|
|
26856
|
-
|
|
26857
|
-
|
|
26858
|
-
|
|
26859
|
-
|
|
26860
|
-
|
|
26958
|
+
className: answerStatusCss
|
|
26959
|
+
}, this.props.considered), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Expression, this.props.expressionProps))), /*#__PURE__*/React.createElement("div", {
|
|
26960
|
+
className: css(styles$J.paddedY, styles$J.paddedX)
|
|
26961
|
+
}, /*#__PURE__*/React.createElement(Checkbox$1, {
|
|
26962
|
+
label: "Answer expression must have the same form.",
|
|
26963
|
+
checked: this.props.form,
|
|
26964
|
+
onChange: value => {
|
|
26965
|
+
this.props.onChange({
|
|
26966
|
+
form: value
|
|
26967
|
+
});
|
|
26968
|
+
}
|
|
26861
26969
|
}), /*#__PURE__*/React.createElement(InfoTip$i, 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", {
|
|
26862
|
-
className:
|
|
26863
|
-
}, /*#__PURE__*/React.createElement(
|
|
26864
|
-
|
|
26865
|
-
|
|
26866
|
-
|
|
26867
|
-
|
|
26970
|
+
className: css(styles$J.paddedY, styles$J.paddedX)
|
|
26971
|
+
}, /*#__PURE__*/React.createElement(Checkbox$1, {
|
|
26972
|
+
label: "Answer expression must be fully expanded and simplified.",
|
|
26973
|
+
checked: this.props.simplify,
|
|
26974
|
+
onChange: value => {
|
|
26975
|
+
this.props.onChange({
|
|
26976
|
+
simplify: value
|
|
26977
|
+
});
|
|
26978
|
+
}
|
|
26868
26979
|
}), /*#__PURE__*/React.createElement(InfoTip$i, 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", {
|
|
26869
|
-
className:
|
|
26980
|
+
className: css(styles$J.buttonRow, styles$J.paddedY)
|
|
26870
26981
|
}, removeButton)));
|
|
26871
26982
|
}
|
|
26872
26983
|
}
|
|
26984
|
+
const styles$J = StyleSheet.create({
|
|
26985
|
+
paddedX: {
|
|
26986
|
+
paddingLeft: spacing.xSmall_8,
|
|
26987
|
+
paddingRight: spacing.xSmall_8
|
|
26988
|
+
},
|
|
26989
|
+
paddedY: {
|
|
26990
|
+
paddingTop: spacing.xxSmall_6,
|
|
26991
|
+
paddingBottom: spacing.xxSmall_6
|
|
26992
|
+
},
|
|
26993
|
+
answerOption: {
|
|
26994
|
+
border: "1px solid #ddd",
|
|
26995
|
+
borderRadius: "3px",
|
|
26996
|
+
display: "flex"
|
|
26997
|
+
},
|
|
26998
|
+
answerHandle: {
|
|
26999
|
+
// textured draggy handle
|
|
27000
|
+
background: "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAAIklEQVQoU2M4c+bMfxAGAgYYmwGrIIiDjrELjpo5aiZeMwF+yNnOs5KSvgAAAABJRU5ErkJggg==) no-repeat 50% 50%",
|
|
27001
|
+
borderRight: "1px solid #ddd",
|
|
27002
|
+
cursor: "move",
|
|
27003
|
+
width: "20px",
|
|
27004
|
+
minWidth: "20px"
|
|
27005
|
+
},
|
|
27006
|
+
answerStatus: {
|
|
27007
|
+
border: "none",
|
|
27008
|
+
userSelect: "none",
|
|
27009
|
+
width: "100px",
|
|
27010
|
+
paddingTop: spacing.small_12,
|
|
27011
|
+
paddingBottom: spacing.small_12
|
|
27012
|
+
},
|
|
27013
|
+
answerStatusWrong: {
|
|
27014
|
+
backgroundColor: color.fadedRed16
|
|
27015
|
+
},
|
|
27016
|
+
answerStatusCorrect: {
|
|
27017
|
+
backgroundColor: color.fadedGreen16
|
|
27018
|
+
},
|
|
27019
|
+
answerStatusUngraded: {
|
|
27020
|
+
backgroundColor: color.fadedBlue16
|
|
27021
|
+
},
|
|
27022
|
+
answerBody: {},
|
|
27023
|
+
buttonRow: {
|
|
27024
|
+
display: "flex"
|
|
27025
|
+
}
|
|
27026
|
+
});
|
|
26873
27027
|
|
|
26874
27028
|
const {
|
|
26875
27029
|
InlineIcon: InlineIcon$3,
|
|
@@ -26922,10 +27076,10 @@ class GradedGroupEditor extends React.Component {
|
|
|
26922
27076
|
}, /*#__PURE__*/React.createElement("div", {
|
|
26923
27077
|
className: "perseus-widget-row"
|
|
26924
27078
|
}, /*#__PURE__*/React.createElement("label", {
|
|
26925
|
-
className: css(styles$
|
|
27079
|
+
className: css(styles$I.title)
|
|
26926
27080
|
}, "Title:", " ", /*#__PURE__*/React.createElement(TextInput$6, {
|
|
26927
27081
|
value: this.props.title,
|
|
26928
|
-
className: css(styles$
|
|
27082
|
+
className: css(styles$I.input)
|
|
26929
27083
|
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
26930
27084
|
,
|
|
26931
27085
|
onChange: this.change("title")
|
|
@@ -26950,7 +27104,7 @@ class GradedGroupEditor extends React.Component {
|
|
|
26950
27104
|
}, /*#__PURE__*/React.createElement(InlineIcon$3, iconPlus$1), " Add a hint"), this.props.hint && /*#__PURE__*/React.createElement("div", {
|
|
26951
27105
|
className: "perseus-hint-editor"
|
|
26952
27106
|
}, /*#__PURE__*/React.createElement("div", {
|
|
26953
|
-
className: css(styles$
|
|
27107
|
+
className: css(styles$I.hintsTitle)
|
|
26954
27108
|
}, "Hint"), /*#__PURE__*/React.createElement(Editor, {
|
|
26955
27109
|
ref: this.hintEditor,
|
|
26956
27110
|
content: this.props.hint ? this.props.hint.content : "",
|
|
@@ -26987,7 +27141,7 @@ GradedGroupEditor.defaultProps = {
|
|
|
26987
27141
|
images: {},
|
|
26988
27142
|
hint: null
|
|
26989
27143
|
};
|
|
26990
|
-
const styles$
|
|
27144
|
+
const styles$I = StyleSheet.create({
|
|
26991
27145
|
title: {
|
|
26992
27146
|
fontSize: 18,
|
|
26993
27147
|
fontWeight: "bold"
|
|
@@ -27066,7 +27220,6 @@ const setArrayItem = (list, i, value) => [...list.slice(0, i), value, ...list.sl
|
|
|
27066
27220
|
const {
|
|
27067
27221
|
ButtonGroup: ButtonGroup$4,
|
|
27068
27222
|
InfoTip: InfoTip$h,
|
|
27069
|
-
PropCheckBox: PropCheckBox$9,
|
|
27070
27223
|
RangeInput: RangeInput$6
|
|
27071
27224
|
} = components;
|
|
27072
27225
|
const defaultBackgroundImage$3 = {
|
|
@@ -27496,10 +27649,14 @@ const GraphSettings = createReactClass({
|
|
|
27496
27649
|
onChange: this.change("markings")
|
|
27497
27650
|
})), /*#__PURE__*/React.createElement("div", {
|
|
27498
27651
|
className: "perseus-widget-left-col"
|
|
27499
|
-
}, /*#__PURE__*/React.createElement(
|
|
27652
|
+
}, /*#__PURE__*/React.createElement(Checkbox$1, {
|
|
27500
27653
|
label: "Show tooltips",
|
|
27501
|
-
|
|
27502
|
-
onChange:
|
|
27654
|
+
checked: this.props.showTooltips,
|
|
27655
|
+
onChange: value => {
|
|
27656
|
+
this.change({
|
|
27657
|
+
showTooltips: value
|
|
27658
|
+
});
|
|
27659
|
+
}
|
|
27503
27660
|
}))), _.contains(this.props.editableSettings, "image") && /*#__PURE__*/React.createElement("div", {
|
|
27504
27661
|
className: "image-settings"
|
|
27505
27662
|
}, /*#__PURE__*/React.createElement("div", null, "Background image:"), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", {
|
|
@@ -27527,16 +27684,24 @@ const GraphSettings = createReactClass({
|
|
|
27527
27684
|
className: "perseus-widget-row"
|
|
27528
27685
|
}, /*#__PURE__*/React.createElement("div", {
|
|
27529
27686
|
className: "perseus-widget-left-col"
|
|
27530
|
-
}, /*#__PURE__*/React.createElement(
|
|
27687
|
+
}, /*#__PURE__*/React.createElement(Checkbox$1, {
|
|
27531
27688
|
label: "Show ruler",
|
|
27532
|
-
|
|
27533
|
-
onChange:
|
|
27689
|
+
checked: this.props.showRuler,
|
|
27690
|
+
onChange: value => {
|
|
27691
|
+
this.change({
|
|
27692
|
+
showRuler: value
|
|
27693
|
+
});
|
|
27694
|
+
}
|
|
27534
27695
|
})), /*#__PURE__*/React.createElement("div", {
|
|
27535
27696
|
className: "perseus-widget-right-col"
|
|
27536
|
-
}, /*#__PURE__*/React.createElement(
|
|
27697
|
+
}, /*#__PURE__*/React.createElement(Checkbox$1, {
|
|
27537
27698
|
label: "Show protractor",
|
|
27538
|
-
|
|
27539
|
-
onChange:
|
|
27699
|
+
checked: this.props.showProtractor,
|
|
27700
|
+
onChange: value => {
|
|
27701
|
+
this.change({
|
|
27702
|
+
showProtractor: value
|
|
27703
|
+
});
|
|
27704
|
+
}
|
|
27540
27705
|
}))), this.props.showRuler && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", null, " ", "Ruler label:", " ", /*#__PURE__*/React.createElement("select", {
|
|
27541
27706
|
onChange: this.changeRulerLabel,
|
|
27542
27707
|
value: this.props.rulerLabel
|
|
@@ -27736,9 +27901,6 @@ GroupEditor.defaultProps = {
|
|
|
27736
27901
|
metadata: undefined
|
|
27737
27902
|
};
|
|
27738
27903
|
|
|
27739
|
-
const {
|
|
27740
|
-
PropCheckBox: PropCheckBox$8
|
|
27741
|
-
} = components;
|
|
27742
27904
|
/**
|
|
27743
27905
|
* This is used for editing a name/value pair.
|
|
27744
27906
|
*/
|
|
@@ -27860,14 +28022,22 @@ class IframeEditor extends React.Component {
|
|
|
27860
28022
|
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
27861
28023
|
,
|
|
27862
28024
|
onChange: this.change("height")
|
|
27863
|
-
})), /*#__PURE__*/React.createElement(
|
|
28025
|
+
})), /*#__PURE__*/React.createElement(Checkbox$1, {
|
|
27864
28026
|
label: "Allow full screen",
|
|
27865
|
-
|
|
27866
|
-
onChange:
|
|
27867
|
-
|
|
28027
|
+
checked: this.props.allowFullScreen,
|
|
28028
|
+
onChange: value => {
|
|
28029
|
+
this.props.onChange({
|
|
28030
|
+
allowFullScreen: value
|
|
28031
|
+
});
|
|
28032
|
+
}
|
|
28033
|
+
}), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Checkbox$1, {
|
|
27868
28034
|
label: "Allow iframe content to redirect the page",
|
|
27869
|
-
|
|
27870
|
-
onChange:
|
|
28035
|
+
checked: this.props.allowTopNavigation,
|
|
28036
|
+
onChange: value => {
|
|
28037
|
+
this.props.onChange({
|
|
28038
|
+
allowTopNavigation: value
|
|
28039
|
+
});
|
|
28040
|
+
}
|
|
27871
28041
|
}));
|
|
27872
28042
|
}
|
|
27873
28043
|
}
|
|
@@ -28326,13 +28496,13 @@ function MathquillInput(props) {
|
|
|
28326
28496
|
}
|
|
28327
28497
|
});
|
|
28328
28498
|
return /*#__PURE__*/React.createElement(View, {
|
|
28329
|
-
style: styles$
|
|
28499
|
+
style: styles$H.outerWrapper
|
|
28330
28500
|
}, /*#__PURE__*/React.createElement("span", {
|
|
28331
28501
|
ref: mathFieldWrapperRef,
|
|
28332
28502
|
className: "perseus-math-input mq-editable-field mq-math-mode"
|
|
28333
28503
|
}));
|
|
28334
28504
|
}
|
|
28335
|
-
const styles$
|
|
28505
|
+
const styles$H = StyleSheet.create({
|
|
28336
28506
|
outerWrapper: {
|
|
28337
28507
|
display: "inline-block",
|
|
28338
28508
|
borderStyle: "solid",
|
|
@@ -29378,16 +29548,16 @@ const LabeledRow = props => {
|
|
|
29378
29548
|
style
|
|
29379
29549
|
} = props;
|
|
29380
29550
|
return /*#__PURE__*/React.createElement("label", {
|
|
29381
|
-
className: css(styles$
|
|
29551
|
+
className: css(styles$G.label)
|
|
29382
29552
|
}, /*#__PURE__*/React.createElement(View, {
|
|
29383
|
-
style: [styles$
|
|
29553
|
+
style: [styles$G.row, style]
|
|
29384
29554
|
}, labelSide === "start" || /*#__PURE__*/React.createElement(LabelSmall, {
|
|
29385
|
-
style: styles$
|
|
29555
|
+
style: styles$G.spaceEnd
|
|
29386
29556
|
}, label), children, labelSide === "end" && /*#__PURE__*/React.createElement(LabelSmall, {
|
|
29387
|
-
style: styles$
|
|
29557
|
+
style: styles$G.spaceStart
|
|
29388
29558
|
}, label)));
|
|
29389
29559
|
};
|
|
29390
|
-
const styles$
|
|
29560
|
+
const styles$G = StyleSheet.create({
|
|
29391
29561
|
label: {
|
|
29392
29562
|
width: "fit-content"
|
|
29393
29563
|
},
|
|
@@ -29405,98 +29575,6 @@ const styles$E = StyleSheet.create({
|
|
|
29405
29575
|
}
|
|
29406
29576
|
});
|
|
29407
29577
|
|
|
29408
|
-
const mediaDefaultSpecLargeMarginWidth = spacing.large_24;
|
|
29409
|
-
const MEDIA_DEFAULT_SPEC = {
|
|
29410
|
-
small: {
|
|
29411
|
-
query: "(max-width: 767px)",
|
|
29412
|
-
totalColumns: 4,
|
|
29413
|
-
gutterWidth: spacing.medium_16,
|
|
29414
|
-
marginWidth: spacing.medium_16
|
|
29415
|
-
},
|
|
29416
|
-
medium: {
|
|
29417
|
-
query: "(min-width: 768px) and (max-width: 1023px)",
|
|
29418
|
-
totalColumns: 8,
|
|
29419
|
-
gutterWidth: spacing.xLarge_32,
|
|
29420
|
-
marginWidth: spacing.large_24
|
|
29421
|
-
},
|
|
29422
|
-
large: {
|
|
29423
|
-
query: "(min-width: 1024px)",
|
|
29424
|
-
totalColumns: 12,
|
|
29425
|
-
gutterWidth: spacing.xLarge_32,
|
|
29426
|
-
marginWidth: mediaDefaultSpecLargeMarginWidth,
|
|
29427
|
-
maxWidth: 1120 + mediaDefaultSpecLargeMarginWidth * 2
|
|
29428
|
-
}
|
|
29429
|
-
};
|
|
29430
|
-
({
|
|
29431
|
-
large: {
|
|
29432
|
-
query: "(min-width: 1px)",
|
|
29433
|
-
totalColumns: 12,
|
|
29434
|
-
gutterWidth: spacing.xLarge_32,
|
|
29435
|
-
marginWidth: spacing.medium_16
|
|
29436
|
-
}
|
|
29437
|
-
});
|
|
29438
|
-
({
|
|
29439
|
-
small: {
|
|
29440
|
-
query: "(max-width: 767px)",
|
|
29441
|
-
totalColumns: 4,
|
|
29442
|
-
gutterWidth: spacing.medium_16,
|
|
29443
|
-
marginWidth: spacing.medium_16
|
|
29444
|
-
},
|
|
29445
|
-
large: {
|
|
29446
|
-
query: "(min-width: 768px)",
|
|
29447
|
-
totalColumns: 12,
|
|
29448
|
-
gutterWidth: spacing.xLarge_32,
|
|
29449
|
-
marginWidth: spacing.xxLarge_48
|
|
29450
|
-
}
|
|
29451
|
-
});
|
|
29452
|
-
|
|
29453
|
-
const defaultContext = {
|
|
29454
|
-
ssrSize: "large",
|
|
29455
|
-
mediaSpec: MEDIA_DEFAULT_SPEC
|
|
29456
|
-
};
|
|
29457
|
-
const MediaLayoutContext = React.createContext(defaultContext);
|
|
29458
|
-
MediaLayoutContext.displayName = "MediaLayoutContext";
|
|
29459
|
-
|
|
29460
|
-
class Spring extends React.Component {
|
|
29461
|
-
render() {
|
|
29462
|
-
const {
|
|
29463
|
-
style
|
|
29464
|
-
} = this.props;
|
|
29465
|
-
return React.createElement(View, {
|
|
29466
|
-
"aria-hidden": "true",
|
|
29467
|
-
style: [styles$D.grow, style]
|
|
29468
|
-
});
|
|
29469
|
-
}
|
|
29470
|
-
}
|
|
29471
|
-
const styles$D = StyleSheet.create({
|
|
29472
|
-
grow: {
|
|
29473
|
-
flexGrow: 1
|
|
29474
|
-
}
|
|
29475
|
-
});
|
|
29476
|
-
|
|
29477
|
-
class Strut extends React.Component {
|
|
29478
|
-
render() {
|
|
29479
|
-
const {
|
|
29480
|
-
size,
|
|
29481
|
-
style
|
|
29482
|
-
} = this.props;
|
|
29483
|
-
return React.createElement(View, {
|
|
29484
|
-
"aria-hidden": "true",
|
|
29485
|
-
style: [strutStyle(size), style]
|
|
29486
|
-
});
|
|
29487
|
-
}
|
|
29488
|
-
}
|
|
29489
|
-
const strutStyle = size => {
|
|
29490
|
-
return {
|
|
29491
|
-
width: size,
|
|
29492
|
-
MsFlexBasis: size,
|
|
29493
|
-
MsFlexPreferredSize: size,
|
|
29494
|
-
WebkitFlexBasis: size,
|
|
29495
|
-
flexBasis: size,
|
|
29496
|
-
flexShrink: 0
|
|
29497
|
-
};
|
|
29498
|
-
};
|
|
29499
|
-
|
|
29500
29578
|
function Heading({
|
|
29501
29579
|
title,
|
|
29502
29580
|
isOpen,
|
|
@@ -29504,11 +29582,11 @@ function Heading({
|
|
|
29504
29582
|
onToggle
|
|
29505
29583
|
}) {
|
|
29506
29584
|
return /*#__PURE__*/React.createElement(Clickable, {
|
|
29507
|
-
style: [styles$
|
|
29585
|
+
style: [styles$F.container, !isCollapsible && styles$F.notClickable],
|
|
29508
29586
|
disabled: !isCollapsible,
|
|
29509
29587
|
onClick: () => isCollapsible && (onToggle == null ? void 0 : onToggle(!isOpen))
|
|
29510
29588
|
}, () => /*#__PURE__*/React.createElement(View, {
|
|
29511
|
-
style: styles$
|
|
29589
|
+
style: styles$F.heading
|
|
29512
29590
|
}, /*#__PURE__*/React.createElement(LabelLarge, {
|
|
29513
29591
|
style: {
|
|
29514
29592
|
fontSize: 14,
|
|
@@ -29518,7 +29596,7 @@ function Heading({
|
|
|
29518
29596
|
isExpanded: isOpen
|
|
29519
29597
|
})));
|
|
29520
29598
|
}
|
|
29521
|
-
const styles$
|
|
29599
|
+
const styles$F = StyleSheet.create({
|
|
29522
29600
|
container: {
|
|
29523
29601
|
marginTop: spacing.small_12,
|
|
29524
29602
|
// NOTE(jeremy): This is the inverse of the @editorPadding CSS
|
|
@@ -29679,6 +29757,22 @@ function getDefaultGraphStartCoords(graph, range, step) {
|
|
|
29679
29757
|
return getQuadraticCoords(_extends({}, graph, {
|
|
29680
29758
|
startCoords: undefined
|
|
29681
29759
|
}), range, step);
|
|
29760
|
+
case "point":
|
|
29761
|
+
return getPointCoords(_extends({}, graph, {
|
|
29762
|
+
startCoords: undefined
|
|
29763
|
+
}), range, step);
|
|
29764
|
+
case "polygon":
|
|
29765
|
+
return getPolygonCoords(_extends({}, graph, {
|
|
29766
|
+
startCoords: undefined
|
|
29767
|
+
}), range, step);
|
|
29768
|
+
case "angle":
|
|
29769
|
+
return getAngleCoords({
|
|
29770
|
+
graph: _extends({}, graph, {
|
|
29771
|
+
startCoords: undefined
|
|
29772
|
+
}),
|
|
29773
|
+
range,
|
|
29774
|
+
step
|
|
29775
|
+
});
|
|
29682
29776
|
default:
|
|
29683
29777
|
return undefined;
|
|
29684
29778
|
}
|
|
@@ -29710,6 +29804,36 @@ const getQuadraticEquation = startCoords => {
|
|
|
29710
29804
|
const c = (p2[0] * p3[0] * (p2[0] - p3[0]) * p1[1] + p3[0] * p1[0] * (p3[0] - p1[0]) * p2[1] + p1[0] * p2[0] * (p1[0] - p2[0]) * p3[1]) / denom;
|
|
29711
29805
|
return "y = " + a.toFixed(3) + "x^2 + " + b.toFixed(3) + "x + " + c.toFixed(3);
|
|
29712
29806
|
};
|
|
29807
|
+
const shouldShowStartCoordsUI = (flags, graph) => {
|
|
29808
|
+
var _flags$mafs, _flags$mafs2, _flags$mafs3, _flags$mafs4, _flags$mafs5;
|
|
29809
|
+
// TODO(LEMS-2228): Remove flags once this is fully released
|
|
29810
|
+
const startCoordsUiPhase1Types = ["linear", "linear-system", "ray", "segment", "circle"];
|
|
29811
|
+
const startCoordsUiPhase2Types = ["sinusoid", "quadratic"];
|
|
29812
|
+
const startCoordsPhase1 = flags == null || (_flags$mafs = flags.mafs) == null ? void 0 : _flags$mafs["start-coords-ui-phase-1"];
|
|
29813
|
+
const startCoordsPhase2 = flags == null || (_flags$mafs2 = flags.mafs) == null ? void 0 : _flags$mafs2["start-coords-ui-phase-2"];
|
|
29814
|
+
const startCoordsPoint = flags == null || (_flags$mafs3 = flags.mafs) == null ? void 0 : _flags$mafs3["start-coords-ui-point"];
|
|
29815
|
+
const startCoordsPolygon = flags == null || (_flags$mafs4 = flags.mafs) == null ? void 0 : _flags$mafs4["start-coords-ui-polygon"];
|
|
29816
|
+
const startCoordsAngle = flags == null || (_flags$mafs5 = flags.mafs) == null ? void 0 : _flags$mafs5["start-coords-ui-angle"];
|
|
29817
|
+
if (startCoordsPhase1 && startCoordsUiPhase1Types.includes(graph.type)) {
|
|
29818
|
+
return true;
|
|
29819
|
+
}
|
|
29820
|
+
if (startCoordsPhase2 && startCoordsUiPhase2Types.includes(graph.type)) {
|
|
29821
|
+
return true;
|
|
29822
|
+
}
|
|
29823
|
+
if (startCoordsAngle && graph.type === "angle") {
|
|
29824
|
+
return true;
|
|
29825
|
+
}
|
|
29826
|
+
if (startCoordsPoint && graph.type === "point" && graph.numPoints !== "unlimited") {
|
|
29827
|
+
return true;
|
|
29828
|
+
}
|
|
29829
|
+
if (startCoordsPolygon && graph.type === "polygon" && graph.numSides !== "unlimited" && (
|
|
29830
|
+
// Pre-initialized graph with undefined snapTo value
|
|
29831
|
+
// initializes to snapTo="grid"
|
|
29832
|
+
graph.snapTo === "grid" || graph.snapTo === undefined)) {
|
|
29833
|
+
return true;
|
|
29834
|
+
}
|
|
29835
|
+
return false;
|
|
29836
|
+
};
|
|
29713
29837
|
|
|
29714
29838
|
/**
|
|
29715
29839
|
* Dropdown for selecting a locked figure to add to an interactive graph.
|
|
@@ -29726,17 +29850,17 @@ const LockedFigureSelect = props => {
|
|
|
29726
29850
|
const figureTypes = ["point", "line", "vector", "ellipse", "polygon"];
|
|
29727
29851
|
const figureTypesCurrent = props.showM2bFeatures ? [...figureTypes, "function"] : figureTypes;
|
|
29728
29852
|
return /*#__PURE__*/React.createElement(View, {
|
|
29729
|
-
style: styles$
|
|
29853
|
+
style: styles$E.container
|
|
29730
29854
|
}, /*#__PURE__*/React.createElement(ActionMenu, {
|
|
29731
29855
|
menuText: "Add locked figure",
|
|
29732
|
-
style: styles$
|
|
29856
|
+
style: styles$E.addElementSelect
|
|
29733
29857
|
}, figureTypesCurrent.map(figureType => /*#__PURE__*/React.createElement(ActionItem, {
|
|
29734
29858
|
key: `${id}-${figureType}`,
|
|
29735
29859
|
label: figureType,
|
|
29736
29860
|
onClick: () => onChange(figureType)
|
|
29737
29861
|
}))));
|
|
29738
29862
|
};
|
|
29739
|
-
const styles$
|
|
29863
|
+
const styles$E = StyleSheet.create({
|
|
29740
29864
|
container: {
|
|
29741
29865
|
marginTop: spacing.xSmall_8
|
|
29742
29866
|
},
|
|
@@ -29746,6 +29870,45 @@ const styles$B = StyleSheet.create({
|
|
|
29746
29870
|
}
|
|
29747
29871
|
});
|
|
29748
29872
|
|
|
29873
|
+
/**
|
|
29874
|
+
* This is a custom text field of type="number" for use in Perseus Editors.
|
|
29875
|
+
*
|
|
29876
|
+
* This makes it so that the text field's input number updates on scroll
|
|
29877
|
+
* without scrolling the page.
|
|
29878
|
+
*
|
|
29879
|
+
* NOTE 1: Native HTML number inputs do not update the number value on scroll,
|
|
29880
|
+
* they only scroll the page. Inputs in React do NOT work this way (explanation
|
|
29881
|
+
* here: https://stackoverflow.com/a/68266494). By default, scrolling on a
|
|
29882
|
+
* focused number input in React causes BOTH the input value to change AND
|
|
29883
|
+
* the page to scroll. The behavior in this component is an improvement on
|
|
29884
|
+
* the React behavior, but it's the opposite of the native HTML behavior.
|
|
29885
|
+
*
|
|
29886
|
+
* NOTE 2: Firefox seems to have a custom override for this. Even with this
|
|
29887
|
+
* stopPropogation, Firefox matches the native HTML behavior.
|
|
29888
|
+
*/
|
|
29889
|
+
const ScrolllessNumberTextField = props => {
|
|
29890
|
+
const inputRef = React.useRef(null);
|
|
29891
|
+
React.useEffect(() => {
|
|
29892
|
+
const ref = inputRef.current;
|
|
29893
|
+
|
|
29894
|
+
// stopPropogation makes it so that the page scroll event is not
|
|
29895
|
+
// triggered when the input is focused and the user scrolls.
|
|
29896
|
+
// The input value will still change on scroll.
|
|
29897
|
+
const ignoreScroll = e => {
|
|
29898
|
+
e.stopPropagation();
|
|
29899
|
+
};
|
|
29900
|
+
ref == null || ref.addEventListener("wheel", ignoreScroll);
|
|
29901
|
+
return () => {
|
|
29902
|
+
ref == null || ref.removeEventListener("wheel", ignoreScroll);
|
|
29903
|
+
};
|
|
29904
|
+
}, [inputRef]);
|
|
29905
|
+
return /*#__PURE__*/React.createElement(TextField, _extends({
|
|
29906
|
+
type: "number"
|
|
29907
|
+
}, props, {
|
|
29908
|
+
ref: inputRef
|
|
29909
|
+
}));
|
|
29910
|
+
};
|
|
29911
|
+
|
|
29749
29912
|
const AngleInput = props => {
|
|
29750
29913
|
const {
|
|
29751
29914
|
angle,
|
|
@@ -29767,19 +29930,18 @@ const AngleInput = props => {
|
|
|
29767
29930
|
}
|
|
29768
29931
|
return /*#__PURE__*/React.createElement(LabelMedium, {
|
|
29769
29932
|
tag: "label",
|
|
29770
|
-
style: styles$
|
|
29933
|
+
style: styles$D.row
|
|
29771
29934
|
}, "angle (degrees)", /*#__PURE__*/React.createElement(Strut, {
|
|
29772
29935
|
size: spacing.xxSmall_6
|
|
29773
|
-
}), /*#__PURE__*/React.createElement(
|
|
29774
|
-
type: "number",
|
|
29936
|
+
}), /*#__PURE__*/React.createElement(ScrolllessNumberTextField, {
|
|
29775
29937
|
value: angleInput,
|
|
29776
29938
|
onChange: handleAngleChange,
|
|
29777
|
-
style: styles$
|
|
29939
|
+
style: styles$D.textField
|
|
29778
29940
|
}), /*#__PURE__*/React.createElement(Strut, {
|
|
29779
29941
|
size: spacing.xxSmall_6
|
|
29780
29942
|
}));
|
|
29781
29943
|
};
|
|
29782
|
-
const styles$
|
|
29944
|
+
const styles$D = StyleSheet.create({
|
|
29783
29945
|
row: {
|
|
29784
29946
|
display: "flex",
|
|
29785
29947
|
flexDirection: "row",
|
|
@@ -29828,32 +29990,30 @@ const CoordinatePairInput = props => {
|
|
|
29828
29990
|
onChange(newCoords);
|
|
29829
29991
|
}
|
|
29830
29992
|
return /*#__PURE__*/React.createElement(View, {
|
|
29831
|
-
style: [styles$
|
|
29993
|
+
style: [styles$C.row, style]
|
|
29832
29994
|
}, /*#__PURE__*/React.createElement(LabelMedium, {
|
|
29833
29995
|
tag: "label",
|
|
29834
|
-
style: styles$
|
|
29996
|
+
style: styles$C.row
|
|
29835
29997
|
}, labels ? labels[0] : "x coord", /*#__PURE__*/React.createElement(Strut, {
|
|
29836
29998
|
size: spacing.xxSmall_6
|
|
29837
|
-
}), /*#__PURE__*/React.createElement(
|
|
29838
|
-
type: "number",
|
|
29999
|
+
}), /*#__PURE__*/React.createElement(ScrolllessNumberTextField, {
|
|
29839
30000
|
value: coordState[0],
|
|
29840
30001
|
onChange: newValue => handleCoordChange(newValue, 0),
|
|
29841
|
-
style: [styles$
|
|
30002
|
+
style: [styles$C.textField, error ? styles$C.errorField : undefined]
|
|
29842
30003
|
})), /*#__PURE__*/React.createElement(Strut, {
|
|
29843
30004
|
size: spacing.medium_16
|
|
29844
30005
|
}), /*#__PURE__*/React.createElement(LabelMedium, {
|
|
29845
30006
|
tag: "label",
|
|
29846
|
-
style: styles$
|
|
30007
|
+
style: styles$C.row
|
|
29847
30008
|
}, labels ? labels[1] : "y coord", /*#__PURE__*/React.createElement(Strut, {
|
|
29848
30009
|
size: spacing.xxSmall_6
|
|
29849
|
-
}), /*#__PURE__*/React.createElement(
|
|
29850
|
-
type: "number",
|
|
30010
|
+
}), /*#__PURE__*/React.createElement(ScrolllessNumberTextField, {
|
|
29851
30011
|
value: coordState[1],
|
|
29852
30012
|
onChange: newValue => handleCoordChange(newValue, 1),
|
|
29853
|
-
style: [styles$
|
|
30013
|
+
style: [styles$C.textField, error ? styles$C.errorField : undefined]
|
|
29854
30014
|
})));
|
|
29855
30015
|
};
|
|
29856
|
-
const styles$
|
|
30016
|
+
const styles$C = StyleSheet.create({
|
|
29857
30017
|
row: {
|
|
29858
30018
|
display: "flex",
|
|
29859
30019
|
flexDirection: "row",
|
|
@@ -29886,14 +30046,14 @@ const PerseusEditorAccordion = props => {
|
|
|
29886
30046
|
}, /*#__PURE__*/React.createElement(AccordionSection, {
|
|
29887
30047
|
expanded: expanded,
|
|
29888
30048
|
onToggle: onToggle,
|
|
29889
|
-
style: [styles$
|
|
29890
|
-
headerStyle: styles$
|
|
30049
|
+
style: [styles$B.container, containerStyle],
|
|
30050
|
+
headerStyle: styles$B.accordionHeader,
|
|
29891
30051
|
header: header
|
|
29892
30052
|
}, /*#__PURE__*/React.createElement(View, {
|
|
29893
|
-
style: [styles$
|
|
30053
|
+
style: [styles$B.accordionPanel, panelStyle]
|
|
29894
30054
|
}, children)));
|
|
29895
30055
|
};
|
|
29896
|
-
const styles$
|
|
30056
|
+
const styles$B = StyleSheet.create({
|
|
29897
30057
|
container: {
|
|
29898
30058
|
backgroundColor: color.fadedBlue8,
|
|
29899
30059
|
marginTop: spacing.xSmall_8
|
|
@@ -29924,13 +30084,13 @@ const ColorSwatch = props => {
|
|
|
29924
30084
|
"aria-label":
|
|
29925
30085
|
// Don't include an aria label for decorative circles.
|
|
29926
30086
|
!decorative ? `${color$1}, ${filled ? "filled" : "open"}` : undefined,
|
|
29927
|
-
style: [styles$
|
|
30087
|
+
style: [styles$A.colorSwatch, {
|
|
29928
30088
|
border: `4px solid ${lockedFigureColors[color$1]}`,
|
|
29929
30089
|
backgroundColor: filled ? lockedFigureColors[color$1] : color.white
|
|
29930
30090
|
}]
|
|
29931
30091
|
});
|
|
29932
30092
|
};
|
|
29933
|
-
const styles$
|
|
30093
|
+
const styles$A = StyleSheet.create({
|
|
29934
30094
|
colorSwatch: {
|
|
29935
30095
|
// Add a white outline so that the color swatch is visible when
|
|
29936
30096
|
// the dropdown option is highlighted with its blue background.
|
|
@@ -29949,10 +30109,10 @@ const ColorSelect = props => {
|
|
|
29949
30109
|
onChange
|
|
29950
30110
|
} = props;
|
|
29951
30111
|
return /*#__PURE__*/React.createElement(View, {
|
|
29952
|
-
style: [styles$
|
|
30112
|
+
style: [styles$z.row, style]
|
|
29953
30113
|
}, /*#__PURE__*/React.createElement(LabelMedium, {
|
|
29954
30114
|
tag: "label",
|
|
29955
|
-
style: styles$
|
|
30115
|
+
style: styles$z.row
|
|
29956
30116
|
}, "color", /*#__PURE__*/React.createElement(Strut, {
|
|
29957
30117
|
size: spacing.xxSmall_6
|
|
29958
30118
|
}), /*#__PURE__*/React.createElement(SingleSelect, {
|
|
@@ -29971,11 +30131,14 @@ const ColorSelect = props => {
|
|
|
29971
30131
|
})
|
|
29972
30132
|
})))));
|
|
29973
30133
|
};
|
|
29974
|
-
const styles$
|
|
30134
|
+
const styles$z = StyleSheet.create({
|
|
29975
30135
|
row: {
|
|
29976
30136
|
display: "flex",
|
|
29977
30137
|
flexDirection: "row",
|
|
29978
|
-
alignItems: "center"
|
|
30138
|
+
alignItems: "center",
|
|
30139
|
+
// Set minWidth to "auto" to prevent the component from bleeding
|
|
30140
|
+
// into the margins. (minWidth is 0 by default.)
|
|
30141
|
+
minWidth: "auto"
|
|
29979
30142
|
}
|
|
29980
30143
|
});
|
|
29981
30144
|
|
|
@@ -29987,17 +30150,17 @@ const EllipseSwatch = props => {
|
|
|
29987
30150
|
} = props;
|
|
29988
30151
|
return /*#__PURE__*/React.createElement(View, {
|
|
29989
30152
|
"aria-label": `${color}, stroke ${strokeStyle}, fill ${fillStyle}`,
|
|
29990
|
-
style: [styles$
|
|
30153
|
+
style: [styles$y.container, {
|
|
29991
30154
|
border: `4px ${strokeStyle} ${lockedFigureColors[color]}`
|
|
29992
30155
|
}]
|
|
29993
30156
|
}, /*#__PURE__*/React.createElement(View, {
|
|
29994
|
-
style: [styles$
|
|
30157
|
+
style: [styles$y.innerCircle, {
|
|
29995
30158
|
backgroundColor: lockedFigureColors[color],
|
|
29996
|
-
opacity: lockedFigureFillStyles[fillStyle]
|
|
30159
|
+
opacity: fillStyle === "white" ? 0 : lockedFigureFillStyles[fillStyle]
|
|
29997
30160
|
}]
|
|
29998
30161
|
}));
|
|
29999
30162
|
};
|
|
30000
|
-
const styles$
|
|
30163
|
+
const styles$y = StyleSheet.create({
|
|
30001
30164
|
container: {
|
|
30002
30165
|
// Add a white outline so that the color swatch is visible when
|
|
30003
30166
|
// the dropdown option is highlighted with its blue background.
|
|
@@ -30016,6 +30179,40 @@ const styles$v = StyleSheet.create({
|
|
|
30016
30179
|
}
|
|
30017
30180
|
});
|
|
30018
30181
|
|
|
30182
|
+
const LineStrokeSelect = props => {
|
|
30183
|
+
const {
|
|
30184
|
+
selectedValue,
|
|
30185
|
+
onChange
|
|
30186
|
+
} = props;
|
|
30187
|
+
return /*#__PURE__*/React.createElement(LabelMedium, {
|
|
30188
|
+
tag: "label",
|
|
30189
|
+
style: styles$x.lineStrokeSelect
|
|
30190
|
+
}, "stroke", /*#__PURE__*/React.createElement(Strut, {
|
|
30191
|
+
size: spacing.xxxSmall_4
|
|
30192
|
+
}), /*#__PURE__*/React.createElement(SingleSelect, {
|
|
30193
|
+
selectedValue: selectedValue,
|
|
30194
|
+
onChange: onChange
|
|
30195
|
+
// Placeholder is required, but never gets used.
|
|
30196
|
+
,
|
|
30197
|
+
placeholder: ""
|
|
30198
|
+
}, /*#__PURE__*/React.createElement(OptionItem, {
|
|
30199
|
+
value: "solid",
|
|
30200
|
+
label: "solid"
|
|
30201
|
+
}), /*#__PURE__*/React.createElement(OptionItem, {
|
|
30202
|
+
value: "dashed",
|
|
30203
|
+
label: "dashed"
|
|
30204
|
+
})));
|
|
30205
|
+
};
|
|
30206
|
+
const styles$x = StyleSheet.create({
|
|
30207
|
+
lineStrokeSelect: {
|
|
30208
|
+
display: "flex",
|
|
30209
|
+
flexDirection: "row",
|
|
30210
|
+
alignItems: "center",
|
|
30211
|
+
// Allow truncation, stop bleeding over the edge.
|
|
30212
|
+
minWidth: 0
|
|
30213
|
+
}
|
|
30214
|
+
});
|
|
30215
|
+
|
|
30019
30216
|
/**
|
|
30020
30217
|
* The part of a locked figure settings panel that contains actions
|
|
30021
30218
|
* for this panel and its associated locked figure, including
|
|
@@ -30028,40 +30225,40 @@ const LockedFigureSettingsActions = props => {
|
|
|
30028
30225
|
onRemove
|
|
30029
30226
|
} = props;
|
|
30030
30227
|
return /*#__PURE__*/React.createElement(View, {
|
|
30031
|
-
style: styles$
|
|
30228
|
+
style: styles$w.container
|
|
30032
30229
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
30033
30230
|
startIcon: trashIcon,
|
|
30034
30231
|
"aria-label": `Delete locked ${figureType}`,
|
|
30035
30232
|
onClick: onRemove,
|
|
30036
30233
|
kind: "tertiary",
|
|
30037
|
-
style: styles$
|
|
30234
|
+
style: styles$w.deleteButton
|
|
30038
30235
|
}, "Delete"), /*#__PURE__*/React.createElement(Spring, null), /*#__PURE__*/React.createElement(IconButton, {
|
|
30039
30236
|
icon: caretDoubleUpIcon,
|
|
30040
30237
|
size: "small",
|
|
30041
30238
|
"aria-label": `Move locked ${figureType} to the back`,
|
|
30042
30239
|
onClick: () => onMove("back"),
|
|
30043
|
-
style: styles$
|
|
30240
|
+
style: styles$w.iconButton
|
|
30044
30241
|
}), /*#__PURE__*/React.createElement(IconButton, {
|
|
30045
30242
|
icon: caretUpIcon,
|
|
30046
30243
|
size: "small",
|
|
30047
30244
|
"aria-label": `Move locked ${figureType} backward`,
|
|
30048
30245
|
onClick: () => onMove("backward"),
|
|
30049
|
-
style: styles$
|
|
30246
|
+
style: styles$w.iconButton
|
|
30050
30247
|
}), /*#__PURE__*/React.createElement(IconButton, {
|
|
30051
30248
|
icon: caretDownIcon,
|
|
30052
30249
|
size: "small",
|
|
30053
30250
|
"aria-label": `Move locked ${figureType} forward`,
|
|
30054
30251
|
onClick: () => onMove("forward"),
|
|
30055
|
-
style: styles$
|
|
30252
|
+
style: styles$w.iconButton
|
|
30056
30253
|
}), /*#__PURE__*/React.createElement(IconButton, {
|
|
30057
30254
|
icon: caretDoubleDownIcon,
|
|
30058
30255
|
size: "small",
|
|
30059
30256
|
"aria-label": `Move locked ${figureType} to the front`,
|
|
30060
30257
|
onClick: () => onMove("front"),
|
|
30061
|
-
style: styles$
|
|
30258
|
+
style: styles$w.iconButton
|
|
30062
30259
|
}));
|
|
30063
30260
|
};
|
|
30064
|
-
const styles$
|
|
30261
|
+
const styles$w = StyleSheet.create({
|
|
30065
30262
|
container: {
|
|
30066
30263
|
width: "100%",
|
|
30067
30264
|
flexDirection: "row",
|
|
@@ -30108,7 +30305,7 @@ const LockedEllipseSettings = props => {
|
|
|
30108
30305
|
/*#__PURE__*/
|
|
30109
30306
|
// Summary: Ellipse, center, radius, color (opacity, dashed)
|
|
30110
30307
|
React.createElement(View, {
|
|
30111
|
-
style: styles$
|
|
30308
|
+
style: styles$v.row
|
|
30112
30309
|
}, /*#__PURE__*/React.createElement(LabelLarge, null, `Ellipse (${center[0]}, ${center[1]}), radius ${radius[0]}, ${radius[1]}`), /*#__PURE__*/React.createElement(Strut, {
|
|
30113
30310
|
size: spacing.xSmall_8
|
|
30114
30311
|
}), /*#__PURE__*/React.createElement(EllipseSwatch, {
|
|
@@ -30117,19 +30314,19 @@ const LockedEllipseSettings = props => {
|
|
|
30117
30314
|
strokeStyle: strokeStyle
|
|
30118
30315
|
}))
|
|
30119
30316
|
}, /*#__PURE__*/React.createElement(View, {
|
|
30120
|
-
style: styles$
|
|
30317
|
+
style: styles$v.row
|
|
30121
30318
|
}, /*#__PURE__*/React.createElement(CoordinatePairInput, {
|
|
30122
30319
|
coord: center,
|
|
30123
|
-
style: styles$
|
|
30320
|
+
style: styles$v.spaceUnder,
|
|
30124
30321
|
onChange: newCoords => onChangeProps({
|
|
30125
30322
|
center: newCoords
|
|
30126
30323
|
})
|
|
30127
30324
|
}), /*#__PURE__*/React.createElement(View, {
|
|
30128
|
-
style: styles$
|
|
30325
|
+
style: styles$v.spaceUnder
|
|
30129
30326
|
}, /*#__PURE__*/React.createElement(InfoTip$d, null, "The coordinates for the center of the ellipse."))), /*#__PURE__*/React.createElement(CoordinatePairInput, {
|
|
30130
30327
|
coord: radius,
|
|
30131
30328
|
labels: ["x radius", "y radius"],
|
|
30132
|
-
style: styles$
|
|
30329
|
+
style: styles$v.spaceUnder,
|
|
30133
30330
|
onChange: newCoords => onChangeProps({
|
|
30134
30331
|
radius: newCoords
|
|
30135
30332
|
})
|
|
@@ -30141,7 +30338,7 @@ const LockedEllipseSettings = props => {
|
|
|
30141
30338
|
}), /*#__PURE__*/React.createElement(Strut, {
|
|
30142
30339
|
size: spacing.xSmall_8
|
|
30143
30340
|
}), /*#__PURE__*/React.createElement(View, {
|
|
30144
|
-
style: [styles$
|
|
30341
|
+
style: [styles$v.row, styles$v.spaceUnder]
|
|
30145
30342
|
}, /*#__PURE__*/React.createElement(ColorSelect, {
|
|
30146
30343
|
selectedValue: color,
|
|
30147
30344
|
onChange: handleColorChange
|
|
@@ -30149,7 +30346,7 @@ const LockedEllipseSettings = props => {
|
|
|
30149
30346
|
size: spacing.medium_16
|
|
30150
30347
|
}), /*#__PURE__*/React.createElement(LabelMedium, {
|
|
30151
30348
|
tag: "label",
|
|
30152
|
-
style: styles$
|
|
30349
|
+
style: [styles$v.row, styles$v.truncatedWidth]
|
|
30153
30350
|
}, "fill", /*#__PURE__*/React.createElement(Strut, {
|
|
30154
30351
|
size: spacing.xxSmall_6
|
|
30155
30352
|
}), /*#__PURE__*/React.createElement(SingleSelect, {
|
|
@@ -30164,25 +30361,200 @@ const LockedEllipseSettings = props => {
|
|
|
30164
30361
|
key: option,
|
|
30165
30362
|
value: option,
|
|
30166
30363
|
label: option
|
|
30167
|
-
}))))), /*#__PURE__*/React.createElement(
|
|
30168
|
-
tag: "label",
|
|
30169
|
-
style: styles$t.row
|
|
30170
|
-
}, "stroke", /*#__PURE__*/React.createElement(Strut, {
|
|
30171
|
-
size: spacing.xxSmall_6
|
|
30172
|
-
}), /*#__PURE__*/React.createElement(SingleSelect, {
|
|
30364
|
+
}))))), /*#__PURE__*/React.createElement(LineStrokeSelect, {
|
|
30173
30365
|
selectedValue: strokeStyle,
|
|
30174
30366
|
onChange: value => onChangeProps({
|
|
30175
30367
|
strokeStyle: value
|
|
30176
30368
|
})
|
|
30369
|
+
}), /*#__PURE__*/React.createElement(LockedFigureSettingsActions, {
|
|
30370
|
+
figureType: props.type,
|
|
30371
|
+
onMove: onMove,
|
|
30372
|
+
onRemove: onRemove
|
|
30373
|
+
}));
|
|
30374
|
+
};
|
|
30375
|
+
const styles$v = StyleSheet.create({
|
|
30376
|
+
row: {
|
|
30377
|
+
display: "flex",
|
|
30378
|
+
flexDirection: "row",
|
|
30379
|
+
alignItems: "center"
|
|
30380
|
+
},
|
|
30381
|
+
spaceUnder: {
|
|
30382
|
+
marginBottom: spacing.xSmall_8
|
|
30383
|
+
},
|
|
30384
|
+
truncatedWidth: {
|
|
30385
|
+
// Allow truncation, stop bleeding over the edge.
|
|
30386
|
+
minWidth: 0
|
|
30387
|
+
}
|
|
30388
|
+
});
|
|
30389
|
+
|
|
30390
|
+
const LineSwatch = props => {
|
|
30391
|
+
const {
|
|
30392
|
+
color,
|
|
30393
|
+
lineStyle
|
|
30394
|
+
} = props;
|
|
30395
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
30396
|
+
style: styles$u.container
|
|
30397
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
30398
|
+
"aria-label": `${color}, ${lineStyle}`,
|
|
30399
|
+
style: [styles$u.lineSwatch, {
|
|
30400
|
+
border: `5px ${lineStyle} ${lockedFigureColors[color]}`
|
|
30401
|
+
}]
|
|
30402
|
+
}));
|
|
30403
|
+
};
|
|
30404
|
+
const styles$u = StyleSheet.create({
|
|
30405
|
+
container: {
|
|
30406
|
+
backgroundColor: color.white,
|
|
30407
|
+
justifyContent: "center",
|
|
30408
|
+
padding: spacing.xSmall_8,
|
|
30409
|
+
borderRadius: spacing.xxxSmall_4
|
|
30410
|
+
},
|
|
30411
|
+
lineSwatch: {
|
|
30412
|
+
width: 40
|
|
30413
|
+
}
|
|
30414
|
+
});
|
|
30415
|
+
|
|
30416
|
+
/**
|
|
30417
|
+
* LockedFunctionSettings is a component that allows the user to edit the
|
|
30418
|
+
* settings of specifically a locked function on the graph.
|
|
30419
|
+
*
|
|
30420
|
+
* Used in the interactive graph editor's locked figures section.
|
|
30421
|
+
*/
|
|
30422
|
+
const LockedFunctionSettings = props => {
|
|
30423
|
+
const {
|
|
30424
|
+
color: lineColor,
|
|
30425
|
+
strokeStyle,
|
|
30426
|
+
equation,
|
|
30427
|
+
directionalAxis,
|
|
30428
|
+
domain,
|
|
30429
|
+
onChangeProps,
|
|
30430
|
+
onMove,
|
|
30431
|
+
onRemove
|
|
30432
|
+
} = props;
|
|
30433
|
+
const equationPrefix = directionalAxis === "x" ? "y=" : "x=";
|
|
30434
|
+
const lineLabel = `Function (${equationPrefix}${equation})`;
|
|
30435
|
+
|
|
30436
|
+
// Tracking the string value of domain constraints to handle interim state of
|
|
30437
|
+
// entering a negative value, as well as representing Infinity as an empty string.
|
|
30438
|
+
// This variable is used when specifying the values of the input fields.
|
|
30439
|
+
const [domainEntries, setDomainEntries] = useState([domain && domain[0] !== -Infinity ? domain[0].toString() : "", domain && domain[1] !== Infinity ? domain[1].toString() : ""]);
|
|
30440
|
+
useEffect(() => {
|
|
30441
|
+
// "useEffect" used to maintain parity between domain constraints and their string representation.
|
|
30442
|
+
setDomainEntries([domain && domain[0] !== -Infinity ? domain[0].toString() : "", domain && domain[1] !== Infinity ? domain[1].toString() : ""]);
|
|
30443
|
+
}, [domain]);
|
|
30444
|
+
|
|
30445
|
+
// Generic function for handling property changes (except for 'domain')
|
|
30446
|
+
function handlePropChange(property, newValue) {
|
|
30447
|
+
const updatedProps = {};
|
|
30448
|
+
updatedProps[property] = newValue;
|
|
30449
|
+
onChangeProps(updatedProps);
|
|
30450
|
+
}
|
|
30451
|
+
|
|
30452
|
+
/*
|
|
30453
|
+
Reason for having a separate 'propChange' function for 'domain':
|
|
30454
|
+
Domain entries are optional. Their default value is +/- Infinity.
|
|
30455
|
+
Since input fields that are empty evaluate to zero, there needs to be
|
|
30456
|
+
dedicated code to convert empty to Infinity.
|
|
30457
|
+
*/
|
|
30458
|
+
function handleDomainChange(limitIndex, newValueString) {
|
|
30459
|
+
const newDomainEntries = [...domainEntries];
|
|
30460
|
+
newDomainEntries[limitIndex] = newValueString;
|
|
30461
|
+
setDomainEntries(newDomainEntries);
|
|
30462
|
+
const newDomain = domain ? [...domain] : [-Infinity, Infinity];
|
|
30463
|
+
let newValue = parseFloat(newValueString);
|
|
30464
|
+
if (newValueString === "" && limitIndex === 0) {
|
|
30465
|
+
newValue = -Infinity;
|
|
30466
|
+
} else if (newValueString === "" && limitIndex === 1) {
|
|
30467
|
+
newValue = Infinity;
|
|
30468
|
+
}
|
|
30469
|
+
newDomain[limitIndex] = newValue;
|
|
30470
|
+
onChangeProps({
|
|
30471
|
+
domain: newDomain
|
|
30472
|
+
});
|
|
30473
|
+
}
|
|
30474
|
+
return /*#__PURE__*/React.createElement(PerseusEditorAccordion, {
|
|
30475
|
+
expanded: props.expanded,
|
|
30476
|
+
onToggle: props.onToggle,
|
|
30477
|
+
header: /*#__PURE__*/React.createElement(View, {
|
|
30478
|
+
style: styles$t.row
|
|
30479
|
+
}, /*#__PURE__*/React.createElement(LabelLarge, {
|
|
30480
|
+
style: styles$t.accordionHeader
|
|
30481
|
+
}, lineLabel), /*#__PURE__*/React.createElement(Strut, {
|
|
30482
|
+
size: spacing.xSmall_8
|
|
30483
|
+
}), /*#__PURE__*/React.createElement(LineSwatch, {
|
|
30484
|
+
color: lineColor,
|
|
30485
|
+
lineStyle: strokeStyle
|
|
30486
|
+
}))
|
|
30487
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
30488
|
+
style: [styles$t.row, styles$t.spaceUnder]
|
|
30489
|
+
}, /*#__PURE__*/React.createElement(ColorSelect, {
|
|
30490
|
+
selectedValue: lineColor,
|
|
30491
|
+
onChange: newValue => {
|
|
30492
|
+
handlePropChange("color", newValue);
|
|
30493
|
+
}
|
|
30494
|
+
}), /*#__PURE__*/React.createElement(Strut, {
|
|
30495
|
+
size: spacing.small_12
|
|
30496
|
+
}), /*#__PURE__*/React.createElement(LineStrokeSelect, {
|
|
30497
|
+
selectedValue: strokeStyle,
|
|
30498
|
+
onChange: newValue => {
|
|
30499
|
+
handlePropChange("strokeStyle", newValue);
|
|
30500
|
+
}
|
|
30501
|
+
})), /*#__PURE__*/React.createElement(View, {
|
|
30502
|
+
style: [styles$t.row, styles$t.rowSpace]
|
|
30503
|
+
}, /*#__PURE__*/React.createElement(SingleSelect, {
|
|
30504
|
+
selectedValue: directionalAxis,
|
|
30505
|
+
onChange: newValue => {
|
|
30506
|
+
handlePropChange("directionalAxis", newValue);
|
|
30507
|
+
},
|
|
30508
|
+
"aria-label": "equation prefix",
|
|
30509
|
+
style: styles$t.equationPrefix
|
|
30177
30510
|
// Placeholder is required, but never gets used.
|
|
30178
30511
|
,
|
|
30179
30512
|
placeholder: ""
|
|
30180
30513
|
}, /*#__PURE__*/React.createElement(OptionItem, {
|
|
30181
|
-
value: "
|
|
30182
|
-
label: "
|
|
30514
|
+
value: "x",
|
|
30515
|
+
label: "y ="
|
|
30183
30516
|
}), /*#__PURE__*/React.createElement(OptionItem, {
|
|
30184
|
-
value: "
|
|
30185
|
-
label: "
|
|
30517
|
+
value: "y",
|
|
30518
|
+
label: "x ="
|
|
30519
|
+
})), /*#__PURE__*/React.createElement(Strut, {
|
|
30520
|
+
size: spacing.xSmall_8
|
|
30521
|
+
}), /*#__PURE__*/React.createElement(TextField, {
|
|
30522
|
+
type: "text",
|
|
30523
|
+
"aria-label": "equation",
|
|
30524
|
+
value: equation,
|
|
30525
|
+
onChange: newValue => {
|
|
30526
|
+
handlePropChange("equation", newValue);
|
|
30527
|
+
},
|
|
30528
|
+
style: [styles$t.textField]
|
|
30529
|
+
})), /*#__PURE__*/React.createElement(View, {
|
|
30530
|
+
style: [styles$t.row, styles$t.rowSpace]
|
|
30531
|
+
}, /*#__PURE__*/React.createElement(LabelMedium, {
|
|
30532
|
+
tag: "label",
|
|
30533
|
+
style: styles$t.domainMin
|
|
30534
|
+
}, "domain min", /*#__PURE__*/React.createElement(Strut, {
|
|
30535
|
+
size: spacing.xxSmall_6
|
|
30536
|
+
}), /*#__PURE__*/React.createElement(TextField, {
|
|
30537
|
+
type: "number",
|
|
30538
|
+
style: styles$t.domainMinField,
|
|
30539
|
+
value: domainEntries[0],
|
|
30540
|
+
onChange: newValue => {
|
|
30541
|
+
handleDomainChange(0, newValue);
|
|
30542
|
+
}
|
|
30543
|
+
})), /*#__PURE__*/React.createElement(Strut, {
|
|
30544
|
+
size: spacing.medium_16
|
|
30545
|
+
}), /*#__PURE__*/React.createElement(LabelMedium, {
|
|
30546
|
+
tag: "label",
|
|
30547
|
+
"aria-label": "domain max",
|
|
30548
|
+
style: styles$t.domainMax
|
|
30549
|
+
}, "max", /*#__PURE__*/React.createElement(Strut, {
|
|
30550
|
+
size: spacing.xxSmall_6
|
|
30551
|
+
}), /*#__PURE__*/React.createElement(TextField, {
|
|
30552
|
+
type: "number",
|
|
30553
|
+
style: styles$t.domainMaxField,
|
|
30554
|
+
value: domainEntries[1],
|
|
30555
|
+
onChange: newValue => {
|
|
30556
|
+
handleDomainChange(1, newValue);
|
|
30557
|
+
}
|
|
30186
30558
|
}))), /*#__PURE__*/React.createElement(LockedFigureSettingsActions, {
|
|
30187
30559
|
figureType: props.type,
|
|
30188
30560
|
onMove: onMove,
|
|
@@ -30190,13 +30562,57 @@ const LockedEllipseSettings = props => {
|
|
|
30190
30562
|
}));
|
|
30191
30563
|
};
|
|
30192
30564
|
const styles$t = StyleSheet.create({
|
|
30565
|
+
accordionHeader: {
|
|
30566
|
+
textOverflow: "ellipsis",
|
|
30567
|
+
// A maximum width needs to be specified in order for the ellipsis to work.
|
|
30568
|
+
// The 64px in the calculation accounts for the line swatch (56px) and the preceding strut (8px).
|
|
30569
|
+
// Margin and padding won't work here because they would create space between the header text and the swatch.
|
|
30570
|
+
maxWidth: "calc(100% - 64px)",
|
|
30571
|
+
overflow: "hidden",
|
|
30572
|
+
whiteSpace: "nowrap"
|
|
30573
|
+
},
|
|
30574
|
+
equationPrefix: {
|
|
30575
|
+
minWidth: "auto"
|
|
30576
|
+
},
|
|
30577
|
+
domainMin: {
|
|
30578
|
+
alignItems: "center",
|
|
30579
|
+
display: "flex",
|
|
30580
|
+
// The 'width' property is applied to the label, which wraps the text and the input field.
|
|
30581
|
+
// The width of the input fields (min/max) should be the same (to have a consistent look),
|
|
30582
|
+
// so the following calculation distributes the space accordingly.
|
|
30583
|
+
// For the "domain min" block, the text is 82.7px, and the strut is 6px (88.7px total).
|
|
30584
|
+
// The "domain max" block is 30.23px, and the strut is 6px (36.23px total).
|
|
30585
|
+
// The calculation takes the remain space after the text & struts (141px total) are removed,
|
|
30586
|
+
// and divides it between the two input fields equally.
|
|
30587
|
+
// The calculation reads: "Take 1/2 of the non-text space, and add the required space for this label's text"
|
|
30588
|
+
width: "calc(((100% - 141px) / 2) + 88.7px)",
|
|
30589
|
+
// @ts-expect-error // TS2353: textWrap does not exist in type CSSProperties
|
|
30590
|
+
textWrap: "nowrap"
|
|
30591
|
+
},
|
|
30592
|
+
domainMinField: {
|
|
30593
|
+
width: "calc(100% - 88.7px)" // make room for the label
|
|
30594
|
+
},
|
|
30595
|
+
|
|
30596
|
+
domainMax: {
|
|
30597
|
+
alignItems: "center",
|
|
30598
|
+
display: "flex",
|
|
30599
|
+
// See explanation for "domainMin" for the calculation below.
|
|
30600
|
+
width: "calc(((100% - 141px) / 2) + 36.2px)"
|
|
30601
|
+
},
|
|
30602
|
+
domainMaxField: {
|
|
30603
|
+
width: "calc(100% - 36.2px)" // make room for the label
|
|
30604
|
+
},
|
|
30605
|
+
|
|
30606
|
+
rowSpace: {
|
|
30607
|
+
marginTop: spacing.xSmall_8
|
|
30608
|
+
},
|
|
30193
30609
|
row: {
|
|
30194
30610
|
display: "flex",
|
|
30195
30611
|
flexDirection: "row",
|
|
30196
30612
|
alignItems: "center"
|
|
30197
30613
|
},
|
|
30198
|
-
|
|
30199
|
-
|
|
30614
|
+
textField: {
|
|
30615
|
+
flexGrow: "1"
|
|
30200
30616
|
}
|
|
30201
30617
|
});
|
|
30202
30618
|
|
|
@@ -30318,32 +30734,6 @@ const styles$r = StyleSheet.create({
|
|
|
30318
30734
|
}
|
|
30319
30735
|
});
|
|
30320
30736
|
|
|
30321
|
-
const LineSwatch = props => {
|
|
30322
|
-
const {
|
|
30323
|
-
color,
|
|
30324
|
-
lineStyle
|
|
30325
|
-
} = props;
|
|
30326
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
30327
|
-
style: styles$q.container
|
|
30328
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
30329
|
-
"aria-label": `${color}, ${lineStyle}`,
|
|
30330
|
-
style: [styles$q.lineSwatch, {
|
|
30331
|
-
border: `5px ${lineStyle} ${lockedFigureColors[color]}`
|
|
30332
|
-
}]
|
|
30333
|
-
}));
|
|
30334
|
-
};
|
|
30335
|
-
const styles$q = StyleSheet.create({
|
|
30336
|
-
container: {
|
|
30337
|
-
backgroundColor: color.white,
|
|
30338
|
-
justifyContent: "center",
|
|
30339
|
-
padding: spacing.xSmall_8,
|
|
30340
|
-
borderRadius: spacing.xxxSmall_4
|
|
30341
|
-
},
|
|
30342
|
-
lineSwatch: {
|
|
30343
|
-
width: 40
|
|
30344
|
-
}
|
|
30345
|
-
});
|
|
30346
|
-
|
|
30347
30737
|
const lengthZeroStr = "The line cannot have length 0.";
|
|
30348
30738
|
const LockedLineSettings = props => {
|
|
30349
30739
|
const {
|
|
@@ -30386,7 +30776,7 @@ const LockedLineSettings = props => {
|
|
|
30386
30776
|
expanded: props.expanded,
|
|
30387
30777
|
onToggle: props.onToggle,
|
|
30388
30778
|
header: /*#__PURE__*/React.createElement(View, {
|
|
30389
|
-
style: styles$
|
|
30779
|
+
style: styles$q.row
|
|
30390
30780
|
}, /*#__PURE__*/React.createElement(LabelLarge, null, lineLabel), /*#__PURE__*/React.createElement(Strut, {
|
|
30391
30781
|
size: spacing.xSmall_8
|
|
30392
30782
|
}), /*#__PURE__*/React.createElement(LineSwatch, {
|
|
@@ -30395,7 +30785,7 @@ const LockedLineSettings = props => {
|
|
|
30395
30785
|
}))
|
|
30396
30786
|
}, /*#__PURE__*/React.createElement(LabelMedium, {
|
|
30397
30787
|
tag: "label",
|
|
30398
|
-
style: [styles$
|
|
30788
|
+
style: [styles$q.row, styles$q.spaceUnder]
|
|
30399
30789
|
}, "kind", /*#__PURE__*/React.createElement(Strut, {
|
|
30400
30790
|
size: spacing.xxxSmall_4
|
|
30401
30791
|
}), /*#__PURE__*/React.createElement(SingleSelect, {
|
|
@@ -30416,34 +30806,19 @@ const LockedLineSettings = props => {
|
|
|
30416
30806
|
value: "segment",
|
|
30417
30807
|
label: "segment"
|
|
30418
30808
|
}))), /*#__PURE__*/React.createElement(View, {
|
|
30419
|
-
style: styles$
|
|
30809
|
+
style: styles$q.row
|
|
30420
30810
|
}, /*#__PURE__*/React.createElement(ColorSelect, {
|
|
30421
30811
|
selectedValue: lineColor,
|
|
30422
30812
|
onChange: handleColorChange
|
|
30423
30813
|
}), /*#__PURE__*/React.createElement(Strut, {
|
|
30424
30814
|
size: spacing.small_12
|
|
30425
|
-
}), /*#__PURE__*/React.createElement(
|
|
30426
|
-
tag: "label",
|
|
30427
|
-
style: styles$p.row
|
|
30428
|
-
}, "style", /*#__PURE__*/React.createElement(Strut, {
|
|
30429
|
-
size: spacing.xxxSmall_4
|
|
30430
|
-
}), /*#__PURE__*/React.createElement(SingleSelect, {
|
|
30815
|
+
}), /*#__PURE__*/React.createElement(LineStrokeSelect, {
|
|
30431
30816
|
selectedValue: lineStyle,
|
|
30432
30817
|
onChange: value => onChangeProps({
|
|
30433
30818
|
lineStyle: value
|
|
30434
30819
|
})
|
|
30435
|
-
|
|
30436
|
-
|
|
30437
|
-
placeholder: "",
|
|
30438
|
-
style: styles$p.selectMarginOffset
|
|
30439
|
-
}, /*#__PURE__*/React.createElement(OptionItem, {
|
|
30440
|
-
value: "solid",
|
|
30441
|
-
label: "solid"
|
|
30442
|
-
}), /*#__PURE__*/React.createElement(OptionItem, {
|
|
30443
|
-
value: "dashed",
|
|
30444
|
-
label: "dashed"
|
|
30445
|
-
})))), isInvalid && /*#__PURE__*/React.createElement(LabelMedium, {
|
|
30446
|
-
style: styles$p.errorText
|
|
30820
|
+
})), isInvalid && /*#__PURE__*/React.createElement(LabelMedium, {
|
|
30821
|
+
style: styles$q.errorText
|
|
30447
30822
|
}, lengthZeroStr), /*#__PURE__*/React.createElement(DefiningPointSettings, _extends({
|
|
30448
30823
|
label: "Point 1",
|
|
30449
30824
|
showPoint: showPoint1,
|
|
@@ -30468,7 +30843,7 @@ const LockedLineSettings = props => {
|
|
|
30468
30843
|
onRemove: onRemove
|
|
30469
30844
|
}));
|
|
30470
30845
|
};
|
|
30471
|
-
const styles$
|
|
30846
|
+
const styles$q = StyleSheet.create({
|
|
30472
30847
|
row: {
|
|
30473
30848
|
display: "flex",
|
|
30474
30849
|
flexDirection: "row",
|
|
@@ -30477,10 +30852,6 @@ const styles$p = StyleSheet.create({
|
|
|
30477
30852
|
spaceUnder: {
|
|
30478
30853
|
marginBottom: spacing.xSmall_8
|
|
30479
30854
|
},
|
|
30480
|
-
selectMarginOffset: {
|
|
30481
|
-
// Align with the point settings accordions.
|
|
30482
|
-
marginInlineEnd: -spacing.xxxSmall_4
|
|
30483
|
-
},
|
|
30484
30855
|
errorText: {
|
|
30485
30856
|
color: color.red
|
|
30486
30857
|
}
|
|
@@ -30513,7 +30884,7 @@ const LockedPointSettings = props => {
|
|
|
30513
30884
|
/*#__PURE__*/
|
|
30514
30885
|
// Summary: Point, coords, color (filled/open)
|
|
30515
30886
|
React.createElement(View, {
|
|
30516
|
-
style: styles$
|
|
30887
|
+
style: styles$p.row
|
|
30517
30888
|
}, /*#__PURE__*/React.createElement(LabelLarge, null, `Point (${coord[0]}, ${coord[1]})`), /*#__PURE__*/React.createElement(Strut, {
|
|
30518
30889
|
size: spacing.xSmall_8
|
|
30519
30890
|
}), /*#__PURE__*/React.createElement(ColorSwatch, {
|
|
@@ -30522,7 +30893,7 @@ const LockedPointSettings = props => {
|
|
|
30522
30893
|
}))
|
|
30523
30894
|
}, /*#__PURE__*/React.createElement(CoordinatePairInput, {
|
|
30524
30895
|
coord: coord,
|
|
30525
|
-
style: styles$
|
|
30896
|
+
style: styles$p.spaceUnder,
|
|
30526
30897
|
onChange: newCoord => {
|
|
30527
30898
|
onChangeProps({
|
|
30528
30899
|
coord: newCoord
|
|
@@ -30531,7 +30902,7 @@ const LockedPointSettings = props => {
|
|
|
30531
30902
|
}), /*#__PURE__*/React.createElement(ColorSelect, {
|
|
30532
30903
|
selectedValue: pointColor,
|
|
30533
30904
|
onChange: handleColorChange,
|
|
30534
|
-
style: styles$
|
|
30905
|
+
style: styles$p.spaceUnder
|
|
30535
30906
|
}), /*#__PURE__*/React.createElement(LabeledSwitch, {
|
|
30536
30907
|
label: "open point",
|
|
30537
30908
|
checked: !filled,
|
|
@@ -30546,7 +30917,7 @@ const LockedPointSettings = props => {
|
|
|
30546
30917
|
onRemove: onRemove
|
|
30547
30918
|
}));
|
|
30548
30919
|
};
|
|
30549
|
-
const styles$
|
|
30920
|
+
const styles$p = StyleSheet.create({
|
|
30550
30921
|
row: {
|
|
30551
30922
|
flexDirection: "row",
|
|
30552
30923
|
alignItems: "center"
|
|
@@ -30564,17 +30935,17 @@ const PolygonSwatch = props => {
|
|
|
30564
30935
|
} = props;
|
|
30565
30936
|
return /*#__PURE__*/React.createElement(View, {
|
|
30566
30937
|
"aria-label": `${color}, stroke ${strokeStyle}, fill ${fillStyle}`,
|
|
30567
|
-
style: [styles$
|
|
30938
|
+
style: [styles$o.container, {
|
|
30568
30939
|
border: `4px ${strokeStyle} ${lockedFigureColors[color]}`
|
|
30569
30940
|
}]
|
|
30570
30941
|
}, /*#__PURE__*/React.createElement(View, {
|
|
30571
|
-
style: [styles$
|
|
30942
|
+
style: [styles$o.innerSquare, {
|
|
30572
30943
|
backgroundColor: lockedFigureColors[color],
|
|
30573
|
-
opacity: lockedFigureFillStyles[fillStyle]
|
|
30944
|
+
opacity: fillStyle === "white" ? 0 : lockedFigureFillStyles[fillStyle]
|
|
30574
30945
|
}]
|
|
30575
30946
|
}));
|
|
30576
30947
|
};
|
|
30577
|
-
const styles$
|
|
30948
|
+
const styles$o = StyleSheet.create({
|
|
30578
30949
|
container: {
|
|
30579
30950
|
// Add a white outline so that the color swatch is visible when
|
|
30580
30951
|
// the dropdown option is highlighted with its blue background.
|
|
@@ -30616,7 +30987,7 @@ const LockedPolygonSettings = props => {
|
|
|
30616
30987
|
/*#__PURE__*/
|
|
30617
30988
|
// Summary: Polygon, number of sides, style swatch
|
|
30618
30989
|
React.createElement(View, {
|
|
30619
|
-
style: styles$
|
|
30990
|
+
style: styles$n.row
|
|
30620
30991
|
}, /*#__PURE__*/React.createElement(LabelLarge, null, `Polygon, ${points.length} sides`), /*#__PURE__*/React.createElement(Strut, {
|
|
30621
30992
|
size: spacing.xSmall_8
|
|
30622
30993
|
}), /*#__PURE__*/React.createElement(PolygonSwatch, {
|
|
@@ -30625,7 +30996,7 @@ const LockedPolygonSettings = props => {
|
|
|
30625
30996
|
strokeStyle: strokeStyle
|
|
30626
30997
|
}))
|
|
30627
30998
|
}, /*#__PURE__*/React.createElement(View, {
|
|
30628
|
-
style: [styles$
|
|
30999
|
+
style: [styles$n.row, styles$n.spaceUnder]
|
|
30629
31000
|
}, /*#__PURE__*/React.createElement(ColorSelect, {
|
|
30630
31001
|
selectedValue: color,
|
|
30631
31002
|
onChange: handleColorChange
|
|
@@ -30633,7 +31004,7 @@ const LockedPolygonSettings = props => {
|
|
|
30633
31004
|
size: spacing.medium_16
|
|
30634
31005
|
}), /*#__PURE__*/React.createElement(LabelMedium, {
|
|
30635
31006
|
tag: "label",
|
|
30636
|
-
style: styles$
|
|
31007
|
+
style: [styles$n.row, styles$n.truncatedWidth]
|
|
30637
31008
|
}, "fill", /*#__PURE__*/React.createElement(Strut, {
|
|
30638
31009
|
size: spacing.xxSmall_6
|
|
30639
31010
|
}), /*#__PURE__*/React.createElement(SingleSelect, {
|
|
@@ -30648,42 +31019,28 @@ const LockedPolygonSettings = props => {
|
|
|
30648
31019
|
key: option,
|
|
30649
31020
|
value: option,
|
|
30650
31021
|
label: option
|
|
30651
|
-
}))))), /*#__PURE__*/React.createElement(
|
|
30652
|
-
tag: "label",
|
|
30653
|
-
style: [styles$m.row, styles$m.spaceUnder]
|
|
30654
|
-
}, "stroke", /*#__PURE__*/React.createElement(Strut, {
|
|
30655
|
-
size: spacing.xxSmall_6
|
|
30656
|
-
}), /*#__PURE__*/React.createElement(SingleSelect, {
|
|
31022
|
+
}))))), /*#__PURE__*/React.createElement(LineStrokeSelect, {
|
|
30657
31023
|
selectedValue: strokeStyle,
|
|
30658
31024
|
onChange: value => onChangeProps({
|
|
30659
31025
|
strokeStyle: value
|
|
30660
31026
|
})
|
|
30661
|
-
|
|
30662
|
-
,
|
|
30663
|
-
placeholder: ""
|
|
30664
|
-
}, /*#__PURE__*/React.createElement(OptionItem, {
|
|
30665
|
-
value: "solid",
|
|
30666
|
-
label: "solid"
|
|
30667
|
-
}), /*#__PURE__*/React.createElement(OptionItem, {
|
|
30668
|
-
value: "dashed",
|
|
30669
|
-
label: "dashed"
|
|
30670
|
-
}))), /*#__PURE__*/React.createElement(LabeledSwitch, {
|
|
31027
|
+
}), /*#__PURE__*/React.createElement(LabeledSwitch, {
|
|
30671
31028
|
label: "show vertices",
|
|
30672
31029
|
checked: showVertices,
|
|
30673
31030
|
onChange: newValue => onChangeProps({
|
|
30674
31031
|
showVertices: newValue
|
|
30675
31032
|
}),
|
|
30676
|
-
style: styles$
|
|
31033
|
+
style: styles$n.spaceUnder
|
|
30677
31034
|
}), /*#__PURE__*/React.createElement(PerseusEditorAccordion, {
|
|
30678
31035
|
header: /*#__PURE__*/React.createElement(LabelLarge, null, "Points"),
|
|
30679
31036
|
expanded: true,
|
|
30680
|
-
containerStyle: styles$
|
|
30681
|
-
panelStyle: styles$
|
|
31037
|
+
containerStyle: styles$n.pointAccordionContainer,
|
|
31038
|
+
panelStyle: styles$n.pointAccordionPanel
|
|
30682
31039
|
}, points.map((point, index) => {
|
|
30683
31040
|
const pointLabel = String.fromCharCode(65 + index);
|
|
30684
31041
|
return /*#__PURE__*/React.createElement(View, {
|
|
30685
|
-
key: `locked-polygon-point
|
|
30686
|
-
style: [styles$
|
|
31042
|
+
key: `locked-polygon-point-index-${index}`,
|
|
31043
|
+
style: [styles$n.row, styles$n.spaceUnder]
|
|
30687
31044
|
}, /*#__PURE__*/React.createElement(LabelLarge, null, `${pointLabel}:`), /*#__PURE__*/React.createElement(Strut, {
|
|
30688
31045
|
size: spacing.medium_16
|
|
30689
31046
|
}), /*#__PURE__*/React.createElement(CoordinatePairInput, {
|
|
@@ -30711,7 +31068,7 @@ const LockedPolygonSettings = props => {
|
|
|
30711
31068
|
points: newPoints
|
|
30712
31069
|
});
|
|
30713
31070
|
},
|
|
30714
|
-
style: styles$
|
|
31071
|
+
style: styles$n.icon
|
|
30715
31072
|
}));
|
|
30716
31073
|
}), /*#__PURE__*/React.createElement(Button, {
|
|
30717
31074
|
kind: "tertiary",
|
|
@@ -30727,7 +31084,7 @@ const LockedPolygonSettings = props => {
|
|
|
30727
31084
|
onRemove: onRemove
|
|
30728
31085
|
}));
|
|
30729
31086
|
};
|
|
30730
|
-
const styles$
|
|
31087
|
+
const styles$n = StyleSheet.create({
|
|
30731
31088
|
row: {
|
|
30732
31089
|
display: "flex",
|
|
30733
31090
|
flexDirection: "row",
|
|
@@ -30744,6 +31101,10 @@ const styles$m = StyleSheet.create({
|
|
|
30744
31101
|
},
|
|
30745
31102
|
spaceUnder: {
|
|
30746
31103
|
marginBottom: spacing.xSmall_8
|
|
31104
|
+
},
|
|
31105
|
+
truncatedWidth: {
|
|
31106
|
+
// Allow truncation, stop bleeding over the edge.
|
|
31107
|
+
minWidth: 0
|
|
30747
31108
|
}
|
|
30748
31109
|
});
|
|
30749
31110
|
|
|
@@ -30785,7 +31146,7 @@ const LockedVectorSettings = props => {
|
|
|
30785
31146
|
expanded: props.expanded,
|
|
30786
31147
|
onToggle: props.onToggle,
|
|
30787
31148
|
header: /*#__PURE__*/React.createElement(View, {
|
|
30788
|
-
style: styles$
|
|
31149
|
+
style: styles$m.row
|
|
30789
31150
|
}, /*#__PURE__*/React.createElement(LabelLarge, null, lineLabel), /*#__PURE__*/React.createElement(Strut, {
|
|
30790
31151
|
size: spacing.xSmall_8
|
|
30791
31152
|
}), /*#__PURE__*/React.createElement(LineSwatch, {
|
|
@@ -30793,19 +31154,19 @@ const LockedVectorSettings = props => {
|
|
|
30793
31154
|
lineStyle: "solid"
|
|
30794
31155
|
}))
|
|
30795
31156
|
}, /*#__PURE__*/React.createElement(View, {
|
|
30796
|
-
style: [styles$
|
|
31157
|
+
style: [styles$m.row, styles$m.spaceUnder]
|
|
30797
31158
|
}, /*#__PURE__*/React.createElement(ColorSelect, {
|
|
30798
31159
|
selectedValue: lineColor,
|
|
30799
31160
|
onChange: handleColorChange
|
|
30800
31161
|
})), isInvalid && /*#__PURE__*/React.createElement(LabelMedium, {
|
|
30801
|
-
style: styles$
|
|
31162
|
+
style: styles$m.errorText
|
|
30802
31163
|
}, lengthErrorMessage), /*#__PURE__*/React.createElement(PerseusEditorAccordion, {
|
|
30803
31164
|
expanded: true // Initial state is expanded
|
|
30804
31165
|
,
|
|
30805
|
-
containerStyle: styles$
|
|
30806
|
-
panelStyle: styles$
|
|
31166
|
+
containerStyle: styles$m.container,
|
|
31167
|
+
panelStyle: styles$m.accordionPanel,
|
|
30807
31168
|
header: /*#__PURE__*/React.createElement(View, {
|
|
30808
|
-
style: styles$
|
|
31169
|
+
style: styles$m.row
|
|
30809
31170
|
}, /*#__PURE__*/React.createElement(LabelLarge, null, `Tail (${tail[0]}, ${tail[1]})`))
|
|
30810
31171
|
}, /*#__PURE__*/React.createElement(CoordinatePairInput, {
|
|
30811
31172
|
coord: tail,
|
|
@@ -30816,10 +31177,10 @@ const LockedVectorSettings = props => {
|
|
|
30816
31177
|
})), /*#__PURE__*/React.createElement(PerseusEditorAccordion, {
|
|
30817
31178
|
expanded: true // Initial state is expanded
|
|
30818
31179
|
,
|
|
30819
|
-
containerStyle: styles$
|
|
30820
|
-
panelStyle: styles$
|
|
31180
|
+
containerStyle: styles$m.container,
|
|
31181
|
+
panelStyle: styles$m.accordionPanel,
|
|
30821
31182
|
header: /*#__PURE__*/React.createElement(View, {
|
|
30822
|
-
style: styles$
|
|
31183
|
+
style: styles$m.row
|
|
30823
31184
|
}, /*#__PURE__*/React.createElement(LabelLarge, null, `Tip (${tip[0]}, ${tip[1]})`))
|
|
30824
31185
|
}, /*#__PURE__*/React.createElement(CoordinatePairInput, {
|
|
30825
31186
|
coord: tip,
|
|
@@ -30833,7 +31194,7 @@ const LockedVectorSettings = props => {
|
|
|
30833
31194
|
onRemove: onRemove
|
|
30834
31195
|
}));
|
|
30835
31196
|
};
|
|
30836
|
-
const styles$
|
|
31197
|
+
const styles$m = StyleSheet.create({
|
|
30837
31198
|
accordionPanel: {
|
|
30838
31199
|
paddingBottom: spacing.medium_16
|
|
30839
31200
|
},
|
|
@@ -30875,6 +31236,11 @@ const LockedFigureSettings = props => {
|
|
|
30875
31236
|
return /*#__PURE__*/React.createElement(LockedEllipseSettings, props);
|
|
30876
31237
|
case "polygon":
|
|
30877
31238
|
return /*#__PURE__*/React.createElement(LockedPolygonSettings, props);
|
|
31239
|
+
case "function":
|
|
31240
|
+
if (props.showM2bFeatures) {
|
|
31241
|
+
return /*#__PURE__*/React.createElement(LockedFunctionSettings, props);
|
|
31242
|
+
}
|
|
31243
|
+
break;
|
|
30878
31244
|
}
|
|
30879
31245
|
return null;
|
|
30880
31246
|
};
|
|
@@ -30978,12 +31344,6 @@ const LockedFiguresSection = props => {
|
|
|
30978
31344
|
onToggle: () => setIsExpanded(!isExpanded),
|
|
30979
31345
|
isCollapsible: true
|
|
30980
31346
|
}), isExpanded && /*#__PURE__*/React.createElement(View, null, figures == null ? void 0 : figures.map((figure, index) => {
|
|
30981
|
-
if (figure.type === "function") {
|
|
30982
|
-
// TODO(LEMS-1947): Add locked function settings.
|
|
30983
|
-
// Remove this block once function locked figure settings are
|
|
30984
|
-
// implemented.
|
|
30985
|
-
return;
|
|
30986
|
-
}
|
|
30987
31347
|
return /*#__PURE__*/React.createElement(LockedFigureSettings, _extends({
|
|
30988
31348
|
key: `${uniqueId}-locked-${figure}-${index}`,
|
|
30989
31349
|
showM2bFeatures: props.showM2bFeatures,
|
|
@@ -30999,7 +31359,7 @@ const LockedFiguresSection = props => {
|
|
|
30999
31359
|
onRemove: () => removeLockedFigure(index)
|
|
31000
31360
|
}));
|
|
31001
31361
|
}), /*#__PURE__*/React.createElement(View, {
|
|
31002
|
-
style: styles$
|
|
31362
|
+
style: styles$l.buttonContainer
|
|
31003
31363
|
}, /*#__PURE__*/React.createElement(LockedFigureSelect, {
|
|
31004
31364
|
showM2bFeatures: props.showM2bFeatures,
|
|
31005
31365
|
id: `${uniqueId}-select`,
|
|
@@ -31009,10 +31369,10 @@ const LockedFiguresSection = props => {
|
|
|
31009
31369
|
}), showExpandButton && /*#__PURE__*/React.createElement(Button, {
|
|
31010
31370
|
kind: "secondary",
|
|
31011
31371
|
onClick: () => toggleExpanded(allCollapsed),
|
|
31012
|
-
style: styles$
|
|
31372
|
+
style: styles$l.button
|
|
31013
31373
|
}, buttonLabel))));
|
|
31014
31374
|
};
|
|
31015
|
-
const styles$
|
|
31375
|
+
const styles$l = StyleSheet.create({
|
|
31016
31376
|
buttonContainer: {
|
|
31017
31377
|
flexDirection: "row",
|
|
31018
31378
|
alignItems: "center"
|
|
@@ -31047,7 +31407,7 @@ const GraphPointsCountSelector = ({
|
|
|
31047
31407
|
// Never uses placeholder, always has value
|
|
31048
31408
|
,
|
|
31049
31409
|
placeholder: "",
|
|
31050
|
-
style: styles$
|
|
31410
|
+
style: styles$k.singleSelectShort
|
|
31051
31411
|
}, [...[...Array(7).keys()].map(n => /*#__PURE__*/React.createElement(OptionItem, {
|
|
31052
31412
|
key: n,
|
|
31053
31413
|
value: `${n}`,
|
|
@@ -31058,7 +31418,7 @@ const GraphPointsCountSelector = ({
|
|
|
31058
31418
|
label: "unlimited"
|
|
31059
31419
|
})]);
|
|
31060
31420
|
};
|
|
31061
|
-
const styles$
|
|
31421
|
+
const styles$k = StyleSheet.create({
|
|
31062
31422
|
singleSelectShort: {
|
|
31063
31423
|
// Non-standard spacing, but it's the smallest we can go
|
|
31064
31424
|
// without running into styling issues with the dropdown.
|
|
@@ -31071,7 +31431,7 @@ const GraphTypeSelector = props => {
|
|
|
31071
31431
|
selectedValue: props.graphType,
|
|
31072
31432
|
onChange: props.onChange,
|
|
31073
31433
|
placeholder: "Select a graph type",
|
|
31074
|
-
style: styles$
|
|
31434
|
+
style: styles$j.singleSelectShort
|
|
31075
31435
|
}, /*#__PURE__*/React.createElement(OptionItem, {
|
|
31076
31436
|
value: "linear",
|
|
31077
31437
|
label: "Linear function"
|
|
@@ -31104,7 +31464,7 @@ const GraphTypeSelector = props => {
|
|
|
31104
31464
|
label: "Angle"
|
|
31105
31465
|
}));
|
|
31106
31466
|
};
|
|
31107
|
-
const styles$
|
|
31467
|
+
const styles$j = StyleSheet.create({
|
|
31108
31468
|
singleSelectShort: {
|
|
31109
31469
|
// Non-standard spacing, but it's the smallest we can go
|
|
31110
31470
|
// without running into styling issues with the dropdown.
|
|
@@ -31138,7 +31498,6 @@ function InteractiveGraphCorrectAnswer(props) {
|
|
|
31138
31498
|
const {
|
|
31139
31499
|
ButtonGroup: ButtonGroup$2,
|
|
31140
31500
|
InfoTip: InfoTip$c,
|
|
31141
|
-
PropCheckBox: PropCheckBox$7,
|
|
31142
31501
|
RangeInput: RangeInput$4
|
|
31143
31502
|
} = components;
|
|
31144
31503
|
const defaultBackgroundImage$1 = {
|
|
@@ -31502,16 +31861,20 @@ class InteractiveGraphSettings extends React.Component {
|
|
|
31502
31861
|
onChange: this.change("markings")
|
|
31503
31862
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
31504
31863
|
className: "perseus-widget-left-col"
|
|
31505
|
-
}, /*#__PURE__*/React.createElement(
|
|
31864
|
+
}, /*#__PURE__*/React.createElement(Checkbox$1, {
|
|
31506
31865
|
label: "Show tooltips",
|
|
31507
|
-
|
|
31508
|
-
onChange:
|
|
31866
|
+
checked: this.props.showTooltips,
|
|
31867
|
+
onChange: value => {
|
|
31868
|
+
this.change({
|
|
31869
|
+
showTooltips: value
|
|
31870
|
+
});
|
|
31871
|
+
}
|
|
31509
31872
|
}))), /*#__PURE__*/React.createElement(LabeledRow, {
|
|
31510
31873
|
label: "Background image URL:",
|
|
31511
|
-
style: styles$
|
|
31874
|
+
style: styles$i.resetSpaceTop
|
|
31512
31875
|
}, /*#__PURE__*/React.createElement("input", {
|
|
31513
31876
|
type: "text",
|
|
31514
|
-
className: css(styles$
|
|
31877
|
+
className: css(styles$i.backgroundUrlInput),
|
|
31515
31878
|
ref: this.bgUrlRef,
|
|
31516
31879
|
value: this.state.backgroundImage.url || "",
|
|
31517
31880
|
onChange: e => {
|
|
@@ -31525,14 +31888,18 @@ class InteractiveGraphSettings extends React.Component {
|
|
|
31525
31888
|
onKeyPress: this.changeBackgroundUrl,
|
|
31526
31889
|
onBlur: this.changeBackgroundUrl
|
|
31527
31890
|
}), /*#__PURE__*/React.createElement(InfoTip$c, 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, {
|
|
31528
|
-
style: styles$
|
|
31891
|
+
style: styles$i.protractorSection
|
|
31529
31892
|
}, /*#__PURE__*/React.createElement(View, {
|
|
31530
|
-
style: styles$
|
|
31531
|
-
}, /*#__PURE__*/React.createElement(
|
|
31893
|
+
style: styles$i.checkboxRow
|
|
31894
|
+
}, /*#__PURE__*/React.createElement(Checkbox$1, {
|
|
31532
31895
|
label: "Show protractor",
|
|
31533
|
-
|
|
31534
|
-
onChange:
|
|
31535
|
-
|
|
31896
|
+
checked: this.props.showProtractor,
|
|
31897
|
+
onChange: value => {
|
|
31898
|
+
this.change({
|
|
31899
|
+
showProtractor: value
|
|
31900
|
+
});
|
|
31901
|
+
},
|
|
31902
|
+
style: styles$i.resetSpaceTop
|
|
31536
31903
|
})), this.props.showProtractor && /*#__PURE__*/React.createElement(Banner, {
|
|
31537
31904
|
layout: "floating",
|
|
31538
31905
|
text: "The protractor is not accessible. Please consider an alternate approach.",
|
|
@@ -31553,7 +31920,7 @@ InteractiveGraphSettings.defaultProps = {
|
|
|
31553
31920
|
showProtractor: false,
|
|
31554
31921
|
showTooltips: false
|
|
31555
31922
|
};
|
|
31556
|
-
const styles$
|
|
31923
|
+
const styles$i = StyleSheet.create({
|
|
31557
31924
|
resetSpaceTop: {
|
|
31558
31925
|
marginTop: 0
|
|
31559
31926
|
},
|
|
@@ -31590,13 +31957,13 @@ const SegmentCountSelector = ({
|
|
|
31590
31957
|
const num = +newValue;
|
|
31591
31958
|
onChange(num);
|
|
31592
31959
|
},
|
|
31593
|
-
style: styles$
|
|
31960
|
+
style: styles$h.singleSelectShort
|
|
31594
31961
|
}, _.range(1, 7).map(n => /*#__PURE__*/React.createElement(OptionItem, {
|
|
31595
31962
|
key: n,
|
|
31596
31963
|
value: `${n}`,
|
|
31597
31964
|
label: `${n} segment${n > 1 ? "s" : ""}`
|
|
31598
31965
|
})));
|
|
31599
|
-
const styles$
|
|
31966
|
+
const styles$h = StyleSheet.create({
|
|
31600
31967
|
singleSelectShort: {
|
|
31601
31968
|
// Non-standard spacing, but it's the smallest we can go
|
|
31602
31969
|
// without running into styling issues with the dropdown.
|
|
@@ -31604,15 +31971,49 @@ const styles$g = StyleSheet.create({
|
|
|
31604
31971
|
}
|
|
31605
31972
|
});
|
|
31606
31973
|
|
|
31974
|
+
const StartCoordsAngle = props => {
|
|
31975
|
+
const {
|
|
31976
|
+
startCoords
|
|
31977
|
+
} = props;
|
|
31978
|
+
return /*#__PURE__*/React.createElement(View, null, "WIP", /*#__PURE__*/React.createElement("br", null), " Start coords:", startCoords.map((coord, index) => {
|
|
31979
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
31980
|
+
key: index
|
|
31981
|
+
}, `Point ${index + 1}: (${coord[0]}, ${coord[1]})`);
|
|
31982
|
+
}));
|
|
31983
|
+
};
|
|
31984
|
+
|
|
31607
31985
|
const StartCoordsCircle = props => {
|
|
31608
31986
|
const {
|
|
31609
31987
|
startCoords,
|
|
31610
31988
|
onChange
|
|
31611
31989
|
} = props;
|
|
31990
|
+
const [radiusState, setRadiusState] = React.useState(startCoords.radius.toString());
|
|
31991
|
+
|
|
31992
|
+
// Update the local state when the props change. (Specifically, when
|
|
31993
|
+
// the radius is reset from the "Use default start coordinates" button.)
|
|
31994
|
+
React.useEffect(() => {
|
|
31995
|
+
setRadiusState(startCoords.radius.toString());
|
|
31996
|
+
}, [startCoords.radius]);
|
|
31997
|
+
function handleRadiuschange(newValue) {
|
|
31998
|
+
// Update the local state to update the input field.
|
|
31999
|
+
setRadiusState(newValue);
|
|
32000
|
+
|
|
32001
|
+
// Assume the user is in the middle of typing. Don't update
|
|
32002
|
+
// the props until they've finished typing a valid number.
|
|
32003
|
+
if (isNaN(+newValue) || newValue === "" || +newValue === 0) {
|
|
32004
|
+
return;
|
|
32005
|
+
}
|
|
32006
|
+
|
|
32007
|
+
// Update the props (update the graph).
|
|
32008
|
+
onChange({
|
|
32009
|
+
center: startCoords.center,
|
|
32010
|
+
radius: parseFloat(newValue)
|
|
32011
|
+
});
|
|
32012
|
+
}
|
|
31612
32013
|
return /*#__PURE__*/React.createElement(View, {
|
|
31613
|
-
style: styles$
|
|
32014
|
+
style: styles$g.tile
|
|
31614
32015
|
}, /*#__PURE__*/React.createElement(View, {
|
|
31615
|
-
style: styles$
|
|
32016
|
+
style: styles$g.row
|
|
31616
32017
|
}, /*#__PURE__*/React.createElement(LabelLarge, null, "Center:"), /*#__PURE__*/React.createElement(Strut, {
|
|
31617
32018
|
size: spacing.small_12
|
|
31618
32019
|
}), /*#__PURE__*/React.createElement(CoordinatePairInput, {
|
|
@@ -31624,23 +32025,18 @@ const StartCoordsCircle = props => {
|
|
|
31624
32025
|
})
|
|
31625
32026
|
})), /*#__PURE__*/React.createElement(Strut, {
|
|
31626
32027
|
size: spacing.small_12
|
|
31627
|
-
}), /*#__PURE__*/React.createElement(
|
|
31628
|
-
|
|
31629
|
-
|
|
32028
|
+
}), /*#__PURE__*/React.createElement(LabelLarge, {
|
|
32029
|
+
tag: "label",
|
|
32030
|
+
style: styles$g.row
|
|
32031
|
+
}, "Radius:", /*#__PURE__*/React.createElement(Strut, {
|
|
31630
32032
|
size: spacing.small_12
|
|
31631
|
-
}), /*#__PURE__*/React.createElement(
|
|
31632
|
-
value:
|
|
31633
|
-
|
|
31634
|
-
|
|
31635
|
-
onChange({
|
|
31636
|
-
center: startCoords.center,
|
|
31637
|
-
radius: parseFloat(value)
|
|
31638
|
-
});
|
|
31639
|
-
},
|
|
31640
|
-
style: styles$f.textField
|
|
32033
|
+
}), /*#__PURE__*/React.createElement(ScrolllessNumberTextField, {
|
|
32034
|
+
value: radiusState,
|
|
32035
|
+
onChange: handleRadiuschange,
|
|
32036
|
+
style: styles$g.textField
|
|
31641
32037
|
})));
|
|
31642
32038
|
};
|
|
31643
|
-
const styles$
|
|
32039
|
+
const styles$g = StyleSheet.create({
|
|
31644
32040
|
tile: {
|
|
31645
32041
|
backgroundColor: color.fadedBlue8,
|
|
31646
32042
|
marginTop: spacing.xSmall_8,
|
|
@@ -31648,6 +32044,7 @@ const styles$f = StyleSheet.create({
|
|
|
31648
32044
|
borderRadius: spacing.xSmall_8
|
|
31649
32045
|
},
|
|
31650
32046
|
row: {
|
|
32047
|
+
display: "flex",
|
|
31651
32048
|
flexDirection: "row",
|
|
31652
32049
|
alignItems: "center"
|
|
31653
32050
|
},
|
|
@@ -31662,7 +32059,7 @@ const StartCoordsLine = props => {
|
|
|
31662
32059
|
onChange
|
|
31663
32060
|
} = props;
|
|
31664
32061
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(View, {
|
|
31665
|
-
style: styles$
|
|
32062
|
+
style: styles$f.tile
|
|
31666
32063
|
}, /*#__PURE__*/React.createElement(LabelLarge, null, "Point 1:"), /*#__PURE__*/React.createElement(Strut, {
|
|
31667
32064
|
size: spacing.small_12
|
|
31668
32065
|
}), /*#__PURE__*/React.createElement(CoordinatePairInput, {
|
|
@@ -31670,7 +32067,7 @@ const StartCoordsLine = props => {
|
|
|
31670
32067
|
labels: ["x", "y"],
|
|
31671
32068
|
onChange: value => onChange([value, startCoords[1]])
|
|
31672
32069
|
})), /*#__PURE__*/React.createElement(View, {
|
|
31673
|
-
style: styles$
|
|
32070
|
+
style: styles$f.tile
|
|
31674
32071
|
}, /*#__PURE__*/React.createElement(LabelLarge, null, "Point 2:"), /*#__PURE__*/React.createElement(Strut, {
|
|
31675
32072
|
size: spacing.small_12
|
|
31676
32073
|
}), /*#__PURE__*/React.createElement(CoordinatePairInput, {
|
|
@@ -31679,7 +32076,7 @@ const StartCoordsLine = props => {
|
|
|
31679
32076
|
onChange: value => onChange([startCoords[0], value])
|
|
31680
32077
|
})));
|
|
31681
32078
|
};
|
|
31682
|
-
const styles$
|
|
32079
|
+
const styles$f = StyleSheet.create({
|
|
31683
32080
|
tile: {
|
|
31684
32081
|
backgroundColor: color.fadedBlue8,
|
|
31685
32082
|
marginTop: spacing.xSmall_8,
|
|
@@ -31702,7 +32099,7 @@ const StartCoordsMultiline = props => {
|
|
|
31702
32099
|
header: /*#__PURE__*/React.createElement(LabelLarge, null, `${graphName} ${i + 1}`),
|
|
31703
32100
|
expanded: true
|
|
31704
32101
|
}, /*#__PURE__*/React.createElement(View, {
|
|
31705
|
-
style: styles$
|
|
32102
|
+
style: styles$e.nestedTile
|
|
31706
32103
|
}, /*#__PURE__*/React.createElement(LabelLarge, null, "Point 1:"), /*#__PURE__*/React.createElement(Strut, {
|
|
31707
32104
|
size: spacing.small_12
|
|
31708
32105
|
}), /*#__PURE__*/React.createElement(CoordinatePairInput, {
|
|
@@ -31714,7 +32111,7 @@ const StartCoordsMultiline = props => {
|
|
|
31714
32111
|
onChange(newCoords);
|
|
31715
32112
|
}
|
|
31716
32113
|
})), /*#__PURE__*/React.createElement(View, {
|
|
31717
|
-
style: styles$
|
|
32114
|
+
style: styles$e.nestedTile
|
|
31718
32115
|
}, /*#__PURE__*/React.createElement(LabelLarge, null, "Point 2:"), /*#__PURE__*/React.createElement(Strut, {
|
|
31719
32116
|
size: spacing.small_12
|
|
31720
32117
|
}), /*#__PURE__*/React.createElement(CoordinatePairInput, {
|
|
@@ -31727,7 +32124,7 @@ const StartCoordsMultiline = props => {
|
|
|
31727
32124
|
}
|
|
31728
32125
|
})))));
|
|
31729
32126
|
};
|
|
31730
|
-
const styles$
|
|
32127
|
+
const styles$e = StyleSheet.create({
|
|
31731
32128
|
nestedTile: {
|
|
31732
32129
|
paddingBottom: spacing.small_12,
|
|
31733
32130
|
flexDirection: "row",
|
|
@@ -31735,6 +32132,39 @@ const styles$d = StyleSheet.create({
|
|
|
31735
32132
|
}
|
|
31736
32133
|
});
|
|
31737
32134
|
|
|
32135
|
+
const StartCoordsPoint = props => {
|
|
32136
|
+
const {
|
|
32137
|
+
startCoords,
|
|
32138
|
+
onChange
|
|
32139
|
+
} = props;
|
|
32140
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, startCoords.map((coord, index) => {
|
|
32141
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
32142
|
+
key: index,
|
|
32143
|
+
style: styles$d.tile
|
|
32144
|
+
}, /*#__PURE__*/React.createElement(LabelLarge, null, `Point ${index + 1}:`), /*#__PURE__*/React.createElement(Strut, {
|
|
32145
|
+
size: spacing.small_12
|
|
32146
|
+
}), /*#__PURE__*/React.createElement(CoordinatePairInput, {
|
|
32147
|
+
coord: coord,
|
|
32148
|
+
labels: ["x", "y"],
|
|
32149
|
+
onChange: newCoord => {
|
|
32150
|
+
const newStartCoords = [...startCoords];
|
|
32151
|
+
newStartCoords[index] = newCoord;
|
|
32152
|
+
onChange(newStartCoords);
|
|
32153
|
+
}
|
|
32154
|
+
}));
|
|
32155
|
+
}));
|
|
32156
|
+
};
|
|
32157
|
+
const styles$d = StyleSheet.create({
|
|
32158
|
+
tile: {
|
|
32159
|
+
backgroundColor: color.fadedBlue8,
|
|
32160
|
+
marginTop: spacing.xSmall_8,
|
|
32161
|
+
padding: spacing.small_12,
|
|
32162
|
+
borderRadius: spacing.xSmall_8,
|
|
32163
|
+
flexDirection: "row",
|
|
32164
|
+
alignItems: "center"
|
|
32165
|
+
}
|
|
32166
|
+
});
|
|
32167
|
+
|
|
31738
32168
|
const StartCoordsQuadratic = props => {
|
|
31739
32169
|
const {
|
|
31740
32170
|
startCoords,
|
|
@@ -31893,6 +32323,24 @@ const StartCoordsSettingsInner = props => {
|
|
|
31893
32323
|
startCoords: quadraticCoords,
|
|
31894
32324
|
onChange: onChange
|
|
31895
32325
|
});
|
|
32326
|
+
// Graphs with startCoords of type ReadonlyArray<Coord>
|
|
32327
|
+
case "point":
|
|
32328
|
+
case "polygon":
|
|
32329
|
+
const pointCoords = type === "point" ? getPointCoords(props, range, step) : getPolygonCoords(props, range, step);
|
|
32330
|
+
return /*#__PURE__*/React.createElement(StartCoordsPoint, {
|
|
32331
|
+
startCoords: pointCoords,
|
|
32332
|
+
onChange: onChange
|
|
32333
|
+
});
|
|
32334
|
+
case "angle":
|
|
32335
|
+
const angleCoords = getAngleCoords({
|
|
32336
|
+
graph: props,
|
|
32337
|
+
range,
|
|
32338
|
+
step
|
|
32339
|
+
});
|
|
32340
|
+
return /*#__PURE__*/React.createElement(StartCoordsAngle, {
|
|
32341
|
+
startCoords: angleCoords,
|
|
32342
|
+
onChange: onChange
|
|
32343
|
+
});
|
|
31896
32344
|
default:
|
|
31897
32345
|
return null;
|
|
31898
32346
|
}
|
|
@@ -31947,10 +32395,6 @@ const POLYGON_SIDES = _.map(_.range(3, 13), function (value) {
|
|
|
31947
32395
|
label: `${value} sides`
|
|
31948
32396
|
});
|
|
31949
32397
|
});
|
|
31950
|
-
|
|
31951
|
-
// TODO(LEMS-2228): Remove flags once this is fully released
|
|
31952
|
-
const startCoordsUiPhase1Types = ["linear", "linear-system", "ray", "segment", "circle"];
|
|
31953
|
-
const startCoordsUiPhase2Types = ["sinusoid", "quadratic"];
|
|
31954
32398
|
/**
|
|
31955
32399
|
* An editor for the InteractiveGraph widget, which allows the user to
|
|
31956
32400
|
* specify the graph's properties and the correct answer.
|
|
@@ -32002,7 +32446,7 @@ class InteractiveGraphEditor extends React.Component {
|
|
|
32002
32446
|
DeprecationMixin.UNSAFE_componentWillMount.call(this);
|
|
32003
32447
|
}
|
|
32004
32448
|
render() {
|
|
32005
|
-
var _this$props$
|
|
32449
|
+
var _this$props$graph$typ, _this$props$graph2, _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$graph5, _this$props$apiOption, _this$props$apiOption2;
|
|
32006
32450
|
let graph;
|
|
32007
32451
|
let equationString;
|
|
32008
32452
|
const gridStep = this.props.gridStep || Util.getGridStep(this.props.range, this.props.step, interactiveSizes.defaultBoxSize);
|
|
@@ -32063,9 +32507,6 @@ class InteractiveGraphEditor extends React.Component {
|
|
|
32063
32507
|
className: "perseus-error"
|
|
32064
32508
|
}, this.props.valid);
|
|
32065
32509
|
}
|
|
32066
|
-
const startCoordsPhase1 = (_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["start-coords-ui-phase-1"];
|
|
32067
|
-
const startCoordsPhase2 = (_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["start-coords-ui-phase-2"];
|
|
32068
|
-
const displayStartCoordsUI = this.props.graph && (startCoordsPhase1 && startCoordsUiPhase1Types.includes(this.props.graph.type) || startCoordsPhase2 && startCoordsUiPhase2Types.includes(this.props.graph.type));
|
|
32069
32510
|
return /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(LabeledRow, {
|
|
32070
32511
|
label: "Type of Graph:"
|
|
32071
32512
|
}, /*#__PURE__*/React.createElement(GraphTypeSelector, {
|
|
@@ -32136,7 +32577,8 @@ class InteractiveGraphEditor extends React.Component {
|
|
|
32136
32577
|
coords: null
|
|
32137
32578
|
});
|
|
32138
32579
|
this.props.onChange({
|
|
32139
|
-
correct: graph
|
|
32580
|
+
correct: graph,
|
|
32581
|
+
graph: graph
|
|
32140
32582
|
});
|
|
32141
32583
|
},
|
|
32142
32584
|
style: styles$a.singleSelectShort
|
|
@@ -32208,7 +32650,7 @@ class InteractiveGraphEditor extends React.Component {
|
|
|
32208
32650
|
}
|
|
32209
32651
|
})), ((_this$props$graph5 = this.props.graph) == null ? void 0 : _this$props$graph5.type) &&
|
|
32210
32652
|
// TODO(LEMS-2228): Remove flags once this is fully released
|
|
32211
|
-
|
|
32653
|
+
shouldShowStartCoordsUI(this.props.apiOptions.flags, this.props.graph) && /*#__PURE__*/React.createElement(StartCoordsSettings, _extends({}, this.props.graph, {
|
|
32212
32654
|
range: this.props.range,
|
|
32213
32655
|
step: this.props.step,
|
|
32214
32656
|
onChange: this.changeStartCoords
|
|
@@ -32264,8 +32706,8 @@ class InteractiveGraphEditor extends React.Component {
|
|
|
32264
32706
|
})), /*#__PURE__*/React.createElement(InfoTip$b, null, /*#__PURE__*/React.createElement("p", null, "Congruency requires only that the angle measures are the same. An exact match implies congruency, but also requires that the angles have the same orientation and that the vertices are in the same position."))),
|
|
32265
32707
|
// Only show the "Add locked figure" dropdown if the graph
|
|
32266
32708
|
// is using Mafs.
|
|
32267
|
-
this.props.graph && ((_this$props$
|
|
32268
|
-
showM2bFeatures: (_this$props$
|
|
32709
|
+
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, {
|
|
32710
|
+
showM2bFeatures: (_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-m2b"],
|
|
32269
32711
|
figures: this.props.lockedFigures,
|
|
32270
32712
|
onChange: this.props.onChange
|
|
32271
32713
|
}));
|
|
@@ -33784,7 +34226,6 @@ const styles = StyleSheet.create({
|
|
|
33784
34226
|
/* eslint-disable react/forbid-prop-types, react/sort-comp */
|
|
33785
34227
|
const {
|
|
33786
34228
|
InfoTip: InfoTip$a,
|
|
33787
|
-
PropCheckBox: PropCheckBox$6,
|
|
33788
34229
|
TextListEditor: TextListEditor$3
|
|
33789
34230
|
} = components;
|
|
33790
34231
|
class MatcherEditor extends React.Component {
|
|
@@ -33840,14 +34281,22 @@ class MatcherEditor extends React.Component {
|
|
|
33840
34281
|
// eslint-disable-next-line react/jsx-no-bind
|
|
33841
34282
|
,
|
|
33842
34283
|
onChange: this.onLabelChange.bind(this, 1)
|
|
33843
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(
|
|
34284
|
+
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Checkbox$1, {
|
|
33844
34285
|
label: "Order of the matched pairs matters:",
|
|
33845
|
-
|
|
33846
|
-
onChange:
|
|
33847
|
-
|
|
34286
|
+
checked: this.props.orderMatters,
|
|
34287
|
+
onChange: value => {
|
|
34288
|
+
this.props.onChange({
|
|
34289
|
+
orderMatters: value
|
|
34290
|
+
});
|
|
34291
|
+
}
|
|
34292
|
+
}), /*#__PURE__*/React.createElement(InfoTip$a, null, /*#__PURE__*/React.createElement("p", null, "With this option enabled, only the order provided above will be treated as correct. This is useful when ordering is significant, such as in the context of a proof."), /*#__PURE__*/React.createElement("p", null, "If disabled, pairwise matching is sufficient. To make this clear, the left column becomes fixed in the provided order and only the cards in the right column can be moved."))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Checkbox$1, {
|
|
33848
34293
|
label: "Padding:",
|
|
33849
|
-
|
|
33850
|
-
onChange:
|
|
34294
|
+
checked: this.props.padding,
|
|
34295
|
+
onChange: value => {
|
|
34296
|
+
this.props.onChange({
|
|
34297
|
+
padding: value
|
|
34298
|
+
});
|
|
34299
|
+
}
|
|
33851
34300
|
}), /*#__PURE__*/React.createElement(InfoTip$a, null, /*#__PURE__*/React.createElement("p", null, "Padding is good for text, but not needed for images."))));
|
|
33852
34301
|
}
|
|
33853
34302
|
}
|
|
@@ -33993,7 +34442,6 @@ MatrixEditor.defaultProps = {
|
|
|
33993
34442
|
const {
|
|
33994
34443
|
InfoTip: InfoTip$9,
|
|
33995
34444
|
NumberInput: NumberInput$7,
|
|
33996
|
-
PropCheckBox: PropCheckBox$5,
|
|
33997
34445
|
RangeInput: RangeInput$2
|
|
33998
34446
|
} = components;
|
|
33999
34447
|
const defaultImage = {
|
|
@@ -34074,16 +34522,24 @@ class MeasurerEditor extends React.Component {
|
|
|
34074
34522
|
className: "perseus-widget-row"
|
|
34075
34523
|
}, /*#__PURE__*/React.createElement("div", {
|
|
34076
34524
|
className: "perseus-widget-left-col"
|
|
34077
|
-
}, /*#__PURE__*/React.createElement(
|
|
34525
|
+
}, /*#__PURE__*/React.createElement(Checkbox$1, {
|
|
34078
34526
|
label: "Show ruler",
|
|
34079
|
-
|
|
34080
|
-
onChange:
|
|
34527
|
+
checked: this.props.showRuler,
|
|
34528
|
+
onChange: value => {
|
|
34529
|
+
this.props.onChange({
|
|
34530
|
+
showRuler: value
|
|
34531
|
+
});
|
|
34532
|
+
}
|
|
34081
34533
|
})), /*#__PURE__*/React.createElement("div", {
|
|
34082
34534
|
className: "perseus-widget-right-col"
|
|
34083
|
-
}, /*#__PURE__*/React.createElement(
|
|
34535
|
+
}, /*#__PURE__*/React.createElement(Checkbox$1, {
|
|
34084
34536
|
label: "Show protractor",
|
|
34085
|
-
|
|
34086
|
-
onChange:
|
|
34537
|
+
checked: this.props.showProtractor,
|
|
34538
|
+
onChange: value => {
|
|
34539
|
+
this.props.onChange({
|
|
34540
|
+
showProtractor: value
|
|
34541
|
+
});
|
|
34542
|
+
}
|
|
34087
34543
|
}))), this.props.showRuler && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", null, " ", "Ruler label:", " ", /*#__PURE__*/React.createElement("select", {
|
|
34088
34544
|
onChange: e =>
|
|
34089
34545
|
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 2.
|
|
@@ -34195,7 +34651,6 @@ const {
|
|
|
34195
34651
|
ButtonGroup: ButtonGroup$1,
|
|
34196
34652
|
InfoTip: InfoTip$8,
|
|
34197
34653
|
NumberInput: NumberInput$5,
|
|
34198
|
-
PropCheckBox: PropCheckBox$4,
|
|
34199
34654
|
RangeInput: RangeInput$1
|
|
34200
34655
|
} = components;
|
|
34201
34656
|
const bound = (x, gt, lt) => Math.min(Math.max(x, gt), lt);
|
|
@@ -34406,22 +34861,34 @@ class NumberLineEditor extends React.Component {
|
|
|
34406
34861
|
className: "perseus-widget-row"
|
|
34407
34862
|
}, !this.props.static && /*#__PURE__*/React.createElement("div", {
|
|
34408
34863
|
className: "perseus-widget-left-col"
|
|
34409
|
-
}, /*#__PURE__*/React.createElement(
|
|
34864
|
+
}, /*#__PURE__*/React.createElement(Checkbox$1, {
|
|
34410
34865
|
label: "Show tick controller",
|
|
34411
|
-
|
|
34412
|
-
onChange:
|
|
34866
|
+
checked: this.props.isTickCtrl,
|
|
34867
|
+
onChange: value => {
|
|
34868
|
+
this.props.onChange({
|
|
34869
|
+
isTickCtrl: value
|
|
34870
|
+
});
|
|
34871
|
+
}
|
|
34413
34872
|
})), /*#__PURE__*/React.createElement("div", {
|
|
34414
34873
|
className: "perseus-widget-right-col"
|
|
34415
|
-
}, /*#__PURE__*/React.createElement(
|
|
34874
|
+
}, /*#__PURE__*/React.createElement(Checkbox$1, {
|
|
34416
34875
|
label: "Show label ticks",
|
|
34417
|
-
|
|
34418
|
-
onChange:
|
|
34876
|
+
checked: this.props.labelTicks,
|
|
34877
|
+
onChange: value => {
|
|
34878
|
+
this.props.onChange({
|
|
34879
|
+
labelTicks: value
|
|
34880
|
+
});
|
|
34881
|
+
}
|
|
34419
34882
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
34420
34883
|
className: "perseus-widget-row"
|
|
34421
|
-
}, !this.props.static && /*#__PURE__*/React.createElement(
|
|
34884
|
+
}, !this.props.static && /*#__PURE__*/React.createElement(Checkbox$1, {
|
|
34422
34885
|
label: "Show tooltips",
|
|
34423
|
-
|
|
34424
|
-
onChange:
|
|
34886
|
+
checked: this.props.showTooltips,
|
|
34887
|
+
onChange: value => {
|
|
34888
|
+
this.props.onChange({
|
|
34889
|
+
showTooltips: value
|
|
34890
|
+
});
|
|
34891
|
+
}
|
|
34425
34892
|
})), /*#__PURE__*/React.createElement("div", {
|
|
34426
34893
|
className: "perseus-widget-row"
|
|
34427
34894
|
}, isTickCtrl && /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("label", null, "Start num divisions at", " ", /*#__PURE__*/React.createElement(NumberInput$5, {
|
|
@@ -34504,7 +34971,6 @@ const {
|
|
|
34504
34971
|
InlineIcon: InlineIcon$1,
|
|
34505
34972
|
MultiButtonGroup,
|
|
34506
34973
|
NumberInput: NumberInput$4,
|
|
34507
|
-
PropCheckBox: PropCheckBox$3,
|
|
34508
34974
|
TextInput: TextInput$3
|
|
34509
34975
|
} = components;
|
|
34510
34976
|
const {
|
|
@@ -34676,12 +35142,14 @@ class NumericInputEditor extends React.Component {
|
|
|
34676
35142
|
onChange: this.updateAnswer(i, "answerForms") || (() => {})
|
|
34677
35143
|
}), /*#__PURE__*/React.createElement(InfoTip$7, null, /*#__PURE__*/React.createElement("p", null, "Formats will be autoselected for you based on the given answer; to show no suggested formats and accept all types, simply have a decimal/integer be the answer. Values with \u03C0 will have format \"pi\", and values that are fractions will have some subset (mixed will be \"mixed\" and \"proper\"; improper/proper will both be \"improper\" and \"proper\"). If you would like to specify that it is only a proper fraction (or only a mixed/improper fraction), deselect the other format. Except for specific cases, you should not need to change the autoselected formats."), /*#__PURE__*/React.createElement("p", null, "To restrict the answer to ", /*#__PURE__*/React.createElement("em", null, "only"), " an improper fraction (i.e. 7/4), select the improper fraction and toggle \"strict\" to true. This ", /*#__PURE__*/React.createElement("b", null, "will not"), " ", "accept 1.75 as an answer.", " "), /*#__PURE__*/React.createElement("p", null, "Unless you are testing that specific skill, please do not restrict the answer format."))), /*#__PURE__*/React.createElement("div", {
|
|
34678
35144
|
className: "perseus-widget-row"
|
|
34679
|
-
}, /*#__PURE__*/React.createElement(
|
|
35145
|
+
}, /*#__PURE__*/React.createElement(Checkbox$1, {
|
|
34680
35146
|
label: "Strictly match only these formats",
|
|
34681
|
-
|
|
34682
|
-
|
|
34683
|
-
|
|
34684
|
-
|
|
35147
|
+
checked: answers[i]["strict"],
|
|
35148
|
+
onChange: value => {
|
|
35149
|
+
this.updateAnswer.bind(this, i)({
|
|
35150
|
+
strict: value
|
|
35151
|
+
});
|
|
35152
|
+
}
|
|
34685
35153
|
})));
|
|
34686
35154
|
const maxError = i => /*#__PURE__*/React.createElement("div", {
|
|
34687
35155
|
className: "perseus-widget-row"
|
|
@@ -34707,23 +35175,31 @@ class NumericInputEditor extends React.Component {
|
|
|
34707
35175
|
}), /*#__PURE__*/React.createElement(InfoTip$7, 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.")));
|
|
34708
35176
|
const rightAlign = /*#__PURE__*/React.createElement("div", {
|
|
34709
35177
|
className: "perseus-widget-row"
|
|
34710
|
-
}, /*#__PURE__*/React.createElement(
|
|
35178
|
+
}, /*#__PURE__*/React.createElement(Checkbox$1, {
|
|
34711
35179
|
label: "Right alignment",
|
|
34712
|
-
|
|
34713
|
-
onChange:
|
|
35180
|
+
checked: this.props.rightAlign,
|
|
35181
|
+
onChange: value => {
|
|
35182
|
+
this.props.onChange({
|
|
35183
|
+
rightAlign: value
|
|
35184
|
+
});
|
|
35185
|
+
}
|
|
34714
35186
|
}));
|
|
34715
35187
|
const labelText = /*#__PURE__*/React.createElement("div", {
|
|
34716
35188
|
className: "perseus-widget-row"
|
|
34717
|
-
}, /*#__PURE__*/React.createElement("label", null, "
|
|
35189
|
+
}, /*#__PURE__*/React.createElement("label", null, "Aria label", /*#__PURE__*/React.createElement(TextInput$3, {
|
|
34718
35190
|
value: this.props.labelText,
|
|
34719
35191
|
onChange: this.change("labelText")
|
|
34720
35192
|
})), /*#__PURE__*/React.createElement(InfoTip$7, null, /*#__PURE__*/React.createElement("p", null, "Text to describe this input. This will be shown to users using screenreaders.")));
|
|
34721
35193
|
const coefficientCheck = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
34722
35194
|
className: "perseus-widget-row"
|
|
34723
|
-
}, /*#__PURE__*/React.createElement(
|
|
35195
|
+
}, /*#__PURE__*/React.createElement(Checkbox$1, {
|
|
34724
35196
|
label: "Coefficient",
|
|
34725
|
-
|
|
34726
|
-
onChange:
|
|
35197
|
+
checked: this.props.coefficient,
|
|
35198
|
+
onChange: value => {
|
|
35199
|
+
this.props.onChange({
|
|
35200
|
+
coefficient: value
|
|
35201
|
+
});
|
|
35202
|
+
}
|
|
34727
35203
|
}), /*#__PURE__*/React.createElement(InfoTip$7, null, /*#__PURE__*/React.createElement("p", null, "A coefficient style number allows the student to use - for -1 and an empty string to mean 1."))));
|
|
34728
35204
|
const addAnswerButton = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("a", {
|
|
34729
35205
|
href: "#",
|
|
@@ -34854,11 +35330,11 @@ class NumericInputEditor extends React.Component {
|
|
|
34854
35330
|
});
|
|
34855
35331
|
return /*#__PURE__*/React.createElement("div", {
|
|
34856
35332
|
className: "perseus-input-number-editor"
|
|
34857
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
35333
|
+
}, labelText, inputSize, rightAlign, coefficientCheck, /*#__PURE__*/React.createElement("div", {
|
|
34858
35334
|
className: "ui-title"
|
|
34859
35335
|
}, "User input"), /*#__PURE__*/React.createElement("div", {
|
|
34860
35336
|
className: "msg-title"
|
|
34861
|
-
}, "Message shown to user on attempt"), generateInputAnswerEditors(), addAnswerButton
|
|
35337
|
+
}, "Message shown to user on attempt"), generateInputAnswerEditors(), addAnswerButton);
|
|
34862
35338
|
}
|
|
34863
35339
|
}
|
|
34864
35340
|
NumericInputEditor.contextType = PerseusI18nContext;
|
|
@@ -34987,8 +35463,7 @@ OrdererEditor.defaultProps = {
|
|
|
34987
35463
|
};
|
|
34988
35464
|
|
|
34989
35465
|
const {
|
|
34990
|
-
InfoTip: InfoTip$5
|
|
34991
|
-
PropCheckBox: PropCheckBox$2
|
|
35466
|
+
InfoTip: InfoTip$5
|
|
34992
35467
|
} = components;
|
|
34993
35468
|
class PassageEditor extends React.Component {
|
|
34994
35469
|
constructor(..._args) {
|
|
@@ -35036,11 +35511,14 @@ class PassageEditor extends React.Component {
|
|
|
35036
35511
|
className: "perseus-widget-passage-editor"
|
|
35037
35512
|
}, /*#__PURE__*/React.createElement("div", {
|
|
35038
35513
|
className: "perseus-widget-row"
|
|
35039
|
-
}, /*#__PURE__*/React.createElement(
|
|
35514
|
+
}, /*#__PURE__*/React.createElement(Checkbox$1, {
|
|
35040
35515
|
label: "Show line numbers",
|
|
35041
|
-
|
|
35042
|
-
|
|
35043
|
-
|
|
35516
|
+
checked: this.props.showLineNumbers,
|
|
35517
|
+
onChange: value => {
|
|
35518
|
+
this.props.onChange({
|
|
35519
|
+
showLineNumbers: value
|
|
35520
|
+
});
|
|
35521
|
+
}
|
|
35044
35522
|
})), /*#__PURE__*/React.createElement("div", null, "Passage title:", /*#__PURE__*/React.createElement(InfoTip$5, null, /*#__PURE__*/React.createElement("p", null, "An optional title that will appear directly above the passage in the same font style. (E.g. Passage 1)")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
|
|
35045
35523
|
type: "text",
|
|
35046
35524
|
defaultValue: this.props.passageTitle,
|
|
@@ -35511,8 +35989,7 @@ PythonProgramEditor.defaultProps = {
|
|
|
35511
35989
|
};
|
|
35512
35990
|
|
|
35513
35991
|
const {
|
|
35514
|
-
InlineIcon
|
|
35515
|
-
PropCheckBox: PropCheckBox$1
|
|
35992
|
+
InlineIcon
|
|
35516
35993
|
} = components;
|
|
35517
35994
|
const {
|
|
35518
35995
|
iconPlus,
|
|
@@ -35701,25 +36178,34 @@ class RadioEditor extends React.Component {
|
|
|
35701
36178
|
target: "_blank"
|
|
35702
36179
|
}, "Multiple choice style guide"), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("div", {
|
|
35703
36180
|
className: "perseus-widget-left-col"
|
|
35704
|
-
}, /*#__PURE__*/React.createElement(
|
|
36181
|
+
}, /*#__PURE__*/React.createElement(Checkbox$1, {
|
|
35705
36182
|
label: "Multiple selections",
|
|
35706
|
-
|
|
35707
|
-
|
|
35708
|
-
|
|
36183
|
+
checked: this.props.multipleSelect,
|
|
36184
|
+
onChange: value => {
|
|
36185
|
+
this.onMultipleSelectChange({
|
|
36186
|
+
multipleSelect: value
|
|
36187
|
+
});
|
|
36188
|
+
}
|
|
35709
36189
|
})), /*#__PURE__*/React.createElement("div", {
|
|
35710
36190
|
className: "perseus-widget-right-col"
|
|
35711
|
-
}, /*#__PURE__*/React.createElement(
|
|
36191
|
+
}, /*#__PURE__*/React.createElement(Checkbox$1, {
|
|
35712
36192
|
label: "Randomize order",
|
|
35713
|
-
|
|
35714
|
-
|
|
35715
|
-
|
|
36193
|
+
checked: this.props.randomize,
|
|
36194
|
+
onChange: value => {
|
|
36195
|
+
this.props.onChange({
|
|
36196
|
+
randomize: value
|
|
36197
|
+
});
|
|
36198
|
+
}
|
|
35716
36199
|
})), this.props.multipleSelect && /*#__PURE__*/React.createElement("div", {
|
|
35717
36200
|
className: "perseus-widget-left-col"
|
|
35718
|
-
}, /*#__PURE__*/React.createElement(
|
|
36201
|
+
}, /*#__PURE__*/React.createElement(Checkbox$1, {
|
|
35719
36202
|
label: "Specify number correct",
|
|
35720
|
-
|
|
35721
|
-
|
|
35722
|
-
|
|
36203
|
+
checked: this.props.countChoices,
|
|
36204
|
+
onChange: value => {
|
|
36205
|
+
this.onCountChoicesChange({
|
|
36206
|
+
countChoices: value
|
|
36207
|
+
});
|
|
36208
|
+
}
|
|
35723
36209
|
}))), /*#__PURE__*/React.createElement(BaseRadio, {
|
|
35724
36210
|
multipleSelect: this.props.multipleSelect,
|
|
35725
36211
|
countChoices: this.props.countChoices,
|
|
@@ -35856,7 +36342,6 @@ SimpleMarkdownTesterEditor.defaultProps = {
|
|
|
35856
36342
|
/* eslint-disable @khanacademy/ts-no-error-suppressions */
|
|
35857
36343
|
const {
|
|
35858
36344
|
InfoTip: InfoTip$2,
|
|
35859
|
-
PropCheckBox,
|
|
35860
36345
|
TextListEditor
|
|
35861
36346
|
} = components;
|
|
35862
36347
|
const HORIZONTAL = "horizontal";
|
|
@@ -35894,10 +36379,14 @@ class SorterEditor extends React.Component {
|
|
|
35894
36379
|
value: HORIZONTAL
|
|
35895
36380
|
}, "Horizontal"), /*#__PURE__*/React.createElement("option", {
|
|
35896
36381
|
value: VERTICAL
|
|
35897
|
-
}, "Vertical"))), /*#__PURE__*/React.createElement(InfoTip$2, null, /*#__PURE__*/React.createElement("p", null, "Use the horizontal layout for short text and small images. The vertical layout is best for longer text and larger images."))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(
|
|
36382
|
+
}, "Vertical"))), /*#__PURE__*/React.createElement(InfoTip$2, null, /*#__PURE__*/React.createElement("p", null, "Use the horizontal layout for short text and small images. The vertical layout is best for longer text and larger images."))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Checkbox$1, {
|
|
35898
36383
|
label: "Padding:",
|
|
35899
|
-
|
|
35900
|
-
onChange:
|
|
36384
|
+
checked: this.props.padding,
|
|
36385
|
+
onChange: value => {
|
|
36386
|
+
this.props.onChange({
|
|
36387
|
+
padding: value
|
|
36388
|
+
});
|
|
36389
|
+
}
|
|
35901
36390
|
}), /*#__PURE__*/React.createElement(InfoTip$2, null, /*#__PURE__*/React.createElement("p", null, "Padding is good for text, but not needed for images."))));
|
|
35902
36391
|
}
|
|
35903
36392
|
}
|