@khanacademy/perseus-editor 18.2.3 → 20.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/index.js +85 -16
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +599 -497
- package/dist/index.js.map +1 -1
- package/package.json +12 -12
package/dist/es/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { addLibraryVersionToPerseusDebug } from '@khanacademy/perseus-utils';
|
|
2
2
|
import _extends from '@babel/runtime/helpers/extends';
|
|
3
|
-
import { components, Widgets, iconChevronDown, iconTrash, WIDGET_PROP_DENYLIST, Util, Log, PerseusMarkdown, preprocessTex, ApiOptions, itemDataVersion, ClassNames, usePerseusI18n, Renderer, Categorizer as Categorizer$1, Changeable, EditorJsonify, Dependencies, Expression, interactiveSizes, GrapherWidget, containerSizeClass, getInteractiveBoxFromSizeClass,
|
|
3
|
+
import { components, Widgets, iconChevronDown, iconTrash, WIDGET_PROP_DENYLIST, Util, Log, PerseusMarkdown, preprocessTex, ApiOptions, itemDataVersion, ClassNames, usePerseusI18n, Renderer, Categorizer as Categorizer$1, Changeable, EditorJsonify, Dependencies, Expression, interactiveSizes, GrapherWidget, GrapherUtil, containerSizeClass, getInteractiveBoxFromSizeClass, PerseusI18nContext, KhanColors, mathOnlyParser, getAngleCoords, getPolygonCoords, getPointCoords, getQuadraticCoords, getSinusoidCoords, getCircleCoords, getLinearSystemCoords, getSegmentCoords, getLineCoords, InteractiveGraphWidget, bodyXsmallBold, MatrixWidget, makeSafeUrl, PlotterWidget, BaseRadio, TableWidget, widgets } from '@khanacademy/perseus';
|
|
4
4
|
export { widgets } from '@khanacademy/perseus';
|
|
5
|
-
import { CoreWidgetRegistry, upgradeWidgetInfoToLatestVersion, PerseusError, Errors, ItemExtras, categorizerLogic, csProgramLogic, definitionLogic, dropdownLogic, explanationLogic, expressionLogic, deriveExtraKeys, PerseusExpressionAnswerFormConsidered, gradedGroupLogic, gradedGroupSetLogic, grapherLogic, GrapherUtil, groupLogic, iframeLogic, imageLogic, inputNumberLogic, interactionLogic, lockedFigureColors, lockedFigureFillStyles, interactiveGraphLogic, labelImageLogic, matcherLogic, matrixLogic, getMatrixSize, measurerLogic, numberLineLogic, numericInputLogic, ordererLogic, passageLogic, passageRefLogic, passageRefTargetLogic, phetSimulationLogic, plotterLogic, plotterPlotTypes, pythonProgramLogic, radioLogic, deriveNumCorrect, sorterLogic, tableLogic, videoLogic } from '@khanacademy/perseus-core';
|
|
5
|
+
import { CoreWidgetRegistry, upgradeWidgetInfoToLatestVersion, PerseusError, Errors, ItemExtras, categorizerLogic, csProgramLogic, definitionLogic, dropdownLogic, explanationLogic, expressionLogic, deriveExtraKeys, PerseusExpressionAnswerFormConsidered, gradedGroupLogic, gradedGroupSetLogic, grapherLogic, GrapherUtil as GrapherUtil$1, groupLogic, iframeLogic, imageLogic, inputNumberLogic, interactionLogic, lockedFigureColors, lockedFigureFillStyles, interactiveGraphLogic, labelImageLogic, matcherLogic, matrixLogic, getMatrixSize, measurerLogic, numberLineLogic, numericInputLogic, ordererLogic, passageLogic, passageRefLogic, passageRefTargetLogic, phetSimulationLogic, plotterLogic, plotterPlotTypes, pythonProgramLogic, radioLogic, deriveNumCorrect, sorterLogic, tableLogic, videoLogic } from '@khanacademy/perseus-core';
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import { useId, useRef, useEffect, useState } from 'react';
|
|
8
8
|
import _ from 'underscore';
|
|
@@ -53,8 +53,11 @@ import minusCircle from '@phosphor-icons/core/regular/minus-circle.svg';
|
|
|
53
53
|
import arrowCounterClockwise from '@phosphor-icons/core/bold/arrow-counter-clockwise-bold.svg';
|
|
54
54
|
|
|
55
55
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
56
|
+
// version number during the release build.
|
|
57
|
+
// In dev, you'll never see the version number.
|
|
58
|
+
|
|
56
59
|
const libName = "@khanacademy/perseus-editor";
|
|
57
|
-
const libVersion = "
|
|
60
|
+
const libVersion = "20.0.0";
|
|
58
61
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
59
62
|
|
|
60
63
|
const devices = {
|
|
@@ -132,6 +135,7 @@ const DeviceFramer = ({
|
|
|
132
135
|
};
|
|
133
136
|
|
|
134
137
|
/* eslint-disable @babel/no-invalid-this */
|
|
138
|
+
/* eslint-disable react/no-unsafe */
|
|
135
139
|
class JsonEditor extends React.Component {
|
|
136
140
|
constructor(props) {
|
|
137
141
|
super(props);
|
|
@@ -3076,6 +3080,8 @@ var texify = {
|
|
|
3076
3080
|
};
|
|
3077
3081
|
|
|
3078
3082
|
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
|
|
3083
|
+
/* vim: set ts=2 et sw=2 tw=80: */
|
|
3084
|
+
|
|
3079
3085
|
|
|
3080
3086
|
// Add \ce, \pu, and \tripledash to the KaTeX macros.
|
|
3081
3087
|
|
|
@@ -4504,6 +4510,7 @@ class ArticleEditor extends React.Component {
|
|
|
4504
4510
|
paths: this.props.contentPaths
|
|
4505
4511
|
},
|
|
4506
4512
|
// @ts-expect-error - TS2339 - Property 'getSaveWarnings' does not exist on type 'ReactInstance'.
|
|
4513
|
+
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
4507
4514
|
legacyPerseusLint: editor ? editor.getSaveWarnings() : []
|
|
4508
4515
|
};
|
|
4509
4516
|
}
|
|
@@ -5182,6 +5189,8 @@ const splitDiff = function splitDiff(diffEntries) {
|
|
|
5182
5189
|
currentLine.push(newEntry);
|
|
5183
5190
|
});
|
|
5184
5191
|
});
|
|
5192
|
+
|
|
5193
|
+
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
5185
5194
|
if (currentLine.length) {
|
|
5186
5195
|
// @ts-expect-error - TS2345 - Argument of type 'any[]' is not assignable to parameter of type 'never'.
|
|
5187
5196
|
lines.push(currentLine);
|
|
@@ -5690,6 +5699,7 @@ WidgetDiff.defaultProps = {
|
|
|
5690
5699
|
/**
|
|
5691
5700
|
* A side by side diff view for Perseus renderers.
|
|
5692
5701
|
*/
|
|
5702
|
+
|
|
5693
5703
|
// In diffs, only show the widgetInfo props that can change
|
|
5694
5704
|
const filterWidgetInfo = function filterWidgetInfo(widgetInfo, showAlignmentOptions) {
|
|
5695
5705
|
const {
|
|
@@ -5743,6 +5753,8 @@ class RendererDiff extends React.Component {
|
|
|
5743
5753
|
}
|
|
5744
5754
|
const beforeWidgets = Object.keys((_before$widgets = before.widgets) != null ? _before$widgets : {}).filter(widget => before.content.includes(widget));
|
|
5745
5755
|
const afterWidgets = Object.keys((_after$widgets = after.widgets) != null ? _after$widgets : {}).filter(widget => after.content.includes(widget));
|
|
5756
|
+
|
|
5757
|
+
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
5746
5758
|
if (beforeWidgets.length || afterWidgets.length) {
|
|
5747
5759
|
const widgets = _.union(beforeWidgets, afterWidgets);
|
|
5748
5760
|
widgetsDiff = widgets.map(widget => {
|
|
@@ -5777,6 +5789,10 @@ RendererDiff.defaultProps = {
|
|
|
5777
5789
|
};
|
|
5778
5790
|
|
|
5779
5791
|
/* eslint-disable react/no-unsafe */
|
|
5792
|
+
/**
|
|
5793
|
+
* A side by side diff view for Perseus articles.
|
|
5794
|
+
*/
|
|
5795
|
+
|
|
5780
5796
|
const rendererProps = PropTypes.shape({
|
|
5781
5797
|
content: PropTypes.string,
|
|
5782
5798
|
images: PropTypes.objectOf(PropTypes.any),
|
|
@@ -5830,6 +5846,7 @@ ArticleDiff._stateFromProps = props => {
|
|
|
5830
5846
|
* A side by side diff view for Perseus exercise items
|
|
5831
5847
|
* in the standard layout.
|
|
5832
5848
|
*/
|
|
5849
|
+
|
|
5833
5850
|
const itemProps = PropTypes.shape({
|
|
5834
5851
|
question: PropTypes.shape({}).isRequired,
|
|
5835
5852
|
answerArea: PropTypes.shape({}).isRequired,
|
|
@@ -5877,6 +5894,11 @@ ItemDiff.propTypes = {
|
|
|
5877
5894
|
};
|
|
5878
5895
|
|
|
5879
5896
|
/* eslint-disable @khanacademy/ts-no-error-suppressions */
|
|
5897
|
+
/* eslint-disable @babel/no-invalid-this */
|
|
5898
|
+
/**
|
|
5899
|
+
* Collection of classes for rendering the hint editor area,
|
|
5900
|
+
* hint editor boxes, and hint previews
|
|
5901
|
+
*/
|
|
5880
5902
|
const {
|
|
5881
5903
|
InfoTip: InfoTip$p,
|
|
5882
5904
|
InlineIcon: InlineIcon$5
|
|
@@ -6822,7 +6844,7 @@ const DEFAULT_HEIGHT = 400;
|
|
|
6822
6844
|
/**
|
|
6823
6845
|
* This is used for editing a name/value pair.
|
|
6824
6846
|
*/
|
|
6825
|
-
|
|
6847
|
+
let PairEditor$1 = class PairEditor extends React.Component {
|
|
6826
6848
|
constructor(..._args) {
|
|
6827
6849
|
super(..._args);
|
|
6828
6850
|
this.change = (...args) => {
|
|
@@ -6843,7 +6865,7 @@ class PairEditor$1 extends React.Component {
|
|
|
6843
6865
|
onChange: this.change("value")
|
|
6844
6866
|
})));
|
|
6845
6867
|
}
|
|
6846
|
-
}
|
|
6868
|
+
};
|
|
6847
6869
|
|
|
6848
6870
|
/**
|
|
6849
6871
|
* This is used for editing a set of name/value pairs.
|
|
@@ -6856,7 +6878,7 @@ PairEditor$1.defaultProps = {
|
|
|
6856
6878
|
name: "",
|
|
6857
6879
|
value: ""
|
|
6858
6880
|
};
|
|
6859
|
-
|
|
6881
|
+
let PairsEditor$1 = class PairsEditor extends React.Component {
|
|
6860
6882
|
constructor(..._args2) {
|
|
6861
6883
|
super(..._args2);
|
|
6862
6884
|
this.change = (...args) => {
|
|
@@ -6892,7 +6914,7 @@ class PairsEditor$1 extends React.Component {
|
|
|
6892
6914
|
});
|
|
6893
6915
|
return /*#__PURE__*/React.createElement("div", null, editors);
|
|
6894
6916
|
}
|
|
6895
|
-
}
|
|
6917
|
+
};
|
|
6896
6918
|
PairsEditor$1.propTypes = _extends({}, Changeable.propTypes, {
|
|
6897
6919
|
pairs: PropTypes.arrayOf(PropTypes.shape({
|
|
6898
6920
|
name: PropTypes.string,
|
|
@@ -8331,6 +8353,9 @@ GradedGroupSetEditor.defaultProps = gradedGroupSetLogic.defaultWidgetOptions;
|
|
|
8331
8353
|
const setArrayItem = (list, i, value) => [...list.slice(0, i), value, ...list.slice(i + 1)];
|
|
8332
8354
|
|
|
8333
8355
|
/* eslint-disable react/forbid-prop-types, react/no-unsafe */
|
|
8356
|
+
/**
|
|
8357
|
+
* Used in the editors for the Grapher and Interaction widgets.
|
|
8358
|
+
*/
|
|
8334
8359
|
const {
|
|
8335
8360
|
ButtonGroup: ButtonGroup$6,
|
|
8336
8361
|
InfoTip: InfoTip$k,
|
|
@@ -8849,7 +8874,7 @@ const {
|
|
|
8849
8874
|
defaultPlotProps,
|
|
8850
8875
|
getEquationString,
|
|
8851
8876
|
typeToButton
|
|
8852
|
-
} = GrapherUtil
|
|
8877
|
+
} = GrapherUtil;
|
|
8853
8878
|
class GrapherEditor extends React.Component {
|
|
8854
8879
|
constructor(..._args) {
|
|
8855
8880
|
super(..._args);
|
|
@@ -8939,7 +8964,7 @@ class GrapherEditor extends React.Component {
|
|
|
8939
8964
|
}, /*#__PURE__*/React.createElement("label", null, "Available functions: "), /*#__PURE__*/React.createElement(MultiButtonGroup, {
|
|
8940
8965
|
allowEmpty: false,
|
|
8941
8966
|
values: this.props.availableTypes,
|
|
8942
|
-
buttons: _.map(GrapherUtil.allTypes, typeToButton),
|
|
8967
|
+
buttons: _.map(GrapherUtil$1.allTypes, typeToButton),
|
|
8943
8968
|
onChange: this.handleAvailableTypesChange
|
|
8944
8969
|
})), graph);
|
|
8945
8970
|
}
|
|
@@ -9471,6 +9496,7 @@ InputNumberEditor.widgetName = "input-number";
|
|
|
9471
9496
|
InputNumberEditor.defaultProps = inputNumberLogic.defaultWidgetOptions;
|
|
9472
9497
|
|
|
9473
9498
|
/* eslint-disable jsx-a11y/anchor-is-valid */
|
|
9499
|
+
|
|
9474
9500
|
const {
|
|
9475
9501
|
InlineIcon: InlineIcon$1
|
|
9476
9502
|
} = components;
|
|
@@ -14129,6 +14155,7 @@ const styles$j = StyleSheet.create({
|
|
|
14129
14155
|
* Used in the interactive graph editor's locked figures section.
|
|
14130
14156
|
*/
|
|
14131
14157
|
|
|
14158
|
+
|
|
14132
14159
|
// Union this type with other locked figure types when they are added.
|
|
14133
14160
|
|
|
14134
14161
|
const LockedFigureSettings = props => {
|
|
@@ -14920,8 +14947,10 @@ class InteractiveGraphEditor extends React.Component {
|
|
|
14920
14947
|
|
|
14921
14948
|
// eslint-disable-next-line react/no-string-refs
|
|
14922
14949
|
const graph = this.refs.graph;
|
|
14950
|
+
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
14923
14951
|
if (graph) {
|
|
14924
14952
|
// @ts-expect-error TS2339 Property 'getUserInput' does not exist on type 'ReactInstance'. Property 'getUserInput' does not exist on type 'Component<any, {}, any>'.
|
|
14953
|
+
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
14925
14954
|
const correct = graph && graph.getUserInput();
|
|
14926
14955
|
_.extend(json, {
|
|
14927
14956
|
graph: {
|
|
@@ -14943,8 +14972,12 @@ class InteractiveGraphEditor extends React.Component {
|
|
|
14943
14972
|
render() {
|
|
14944
14973
|
let graph;
|
|
14945
14974
|
let equationString;
|
|
14946
|
-
const gridStep =
|
|
14947
|
-
|
|
14975
|
+
const gridStep =
|
|
14976
|
+
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
14977
|
+
this.props.gridStep || Util.getGridStep(this.props.range, this.props.step, interactiveSizes.defaultBoxSize);
|
|
14978
|
+
const snapStep =
|
|
14979
|
+
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
14980
|
+
this.props.snapStep || Util.snapStepFromGridStep(gridStep);
|
|
14948
14981
|
const sizeClass = containerSizeClass.SMALL;
|
|
14949
14982
|
if (this.props.valid === true) {
|
|
14950
14983
|
const correct = this.props.correct;
|
|
@@ -15093,7 +15126,9 @@ class InteractiveGraphEditor extends React.Component {
|
|
|
15093
15126
|
label: "Number of sides:"
|
|
15094
15127
|
}, /*#__PURE__*/React.createElement(SingleSelect, {
|
|
15095
15128
|
key: "polygon-select",
|
|
15096
|
-
selectedValue:
|
|
15129
|
+
selectedValue:
|
|
15130
|
+
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
15131
|
+
(_this$props$correct7 = this.props.correct) != null && _this$props$correct7.numSides ? `${this.props.correct.numSides}` : "3",
|
|
15097
15132
|
placeholder: "",
|
|
15098
15133
|
onChange: newValue => {
|
|
15099
15134
|
var _this$props$graph7;
|
|
@@ -15424,12 +15459,18 @@ class FormWrappedTextField extends React.Component {
|
|
|
15424
15459
|
} = this.state;
|
|
15425
15460
|
const extraStyles = {};
|
|
15426
15461
|
const spanStyle = [styles$9.input, styles$9.container];
|
|
15462
|
+
|
|
15463
|
+
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
15427
15464
|
if (width) {
|
|
15428
15465
|
extraStyles.width = width;
|
|
15429
15466
|
}
|
|
15467
|
+
|
|
15468
|
+
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
15430
15469
|
if (grow) {
|
|
15431
15470
|
extraStyles.flexGrow = grow === true ? 1 : grow;
|
|
15432
15471
|
}
|
|
15472
|
+
|
|
15473
|
+
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
15433
15474
|
if (shrink || shrink === 0) {
|
|
15434
15475
|
extraStyles.flexShrink = shrink === true ? 0 : shrink;
|
|
15435
15476
|
}
|
|
@@ -16172,6 +16213,7 @@ const findAndFocusElement = component => {
|
|
|
16172
16213
|
const DOMNode = ReactDOM.findDOMNode(component);
|
|
16173
16214
|
const button = DOMNode;
|
|
16174
16215
|
// @ts-expect-error - TS2774 - This condition will always return true since this function is always defined. Did you mean to call it instead?
|
|
16216
|
+
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
16175
16217
|
if (button.focus) {
|
|
16176
16218
|
focusWithChromeStickyFocusBugWorkaround(button);
|
|
16177
16219
|
}
|
|
@@ -16263,6 +16305,7 @@ class OptionGroup extends React.Component {
|
|
|
16263
16305
|
this.focusedElement = void 0;
|
|
16264
16306
|
}
|
|
16265
16307
|
componentDidMount() {
|
|
16308
|
+
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
16266
16309
|
if (this.focusedElement) {
|
|
16267
16310
|
findAndFocusElement(this.focusedElement);
|
|
16268
16311
|
}
|
|
@@ -16725,6 +16768,7 @@ const styles$1 = StyleSheet.create({
|
|
|
16725
16768
|
* that involve the use of images, and enable learners to demonstrate their
|
|
16726
16769
|
* knowledge by directly interacting with the image.
|
|
16727
16770
|
*/
|
|
16771
|
+
|
|
16728
16772
|
class LabelImageEditor extends React.Component {
|
|
16729
16773
|
constructor(...args) {
|
|
16730
16774
|
super(...args);
|
|
@@ -16745,12 +16789,15 @@ class LabelImageEditor extends React.Component {
|
|
|
16745
16789
|
} else if (!imageAlt) {
|
|
16746
16790
|
warnings.push("Question image has no alt text");
|
|
16747
16791
|
}
|
|
16792
|
+
|
|
16793
|
+
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
16748
16794
|
if (!markers.length) {
|
|
16749
16795
|
warnings.push("Question has no markers, to label answers on image");
|
|
16750
16796
|
} else {
|
|
16751
16797
|
let numNoAnswers = 0;
|
|
16752
16798
|
let numNoLabels = 0;
|
|
16753
16799
|
for (const marker of markers) {
|
|
16800
|
+
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
16754
16801
|
if (!marker.answers.length) {
|
|
16755
16802
|
numNoAnswers++;
|
|
16756
16803
|
}
|
|
@@ -16758,9 +16805,13 @@ class LabelImageEditor extends React.Component {
|
|
|
16758
16805
|
numNoLabels++;
|
|
16759
16806
|
}
|
|
16760
16807
|
}
|
|
16808
|
+
|
|
16809
|
+
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
16761
16810
|
if (numNoAnswers) {
|
|
16762
16811
|
warnings.push(`Question has ${numNoAnswers} markers with no ` + "answers selected");
|
|
16763
16812
|
}
|
|
16813
|
+
|
|
16814
|
+
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
16764
16815
|
if (numNoLabels) {
|
|
16765
16816
|
warnings.push(`Question has ${numNoLabels} markers with no ` + "ARIA label");
|
|
16766
16817
|
}
|
|
@@ -16822,6 +16873,7 @@ class LabelImageEditor extends React.Component {
|
|
|
16822
16873
|
|
|
16823
16874
|
// Automatically reveal their dropdowns as a prompt to the content
|
|
16824
16875
|
// creator to select answers and set the ARIA label.
|
|
16876
|
+
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
16825
16877
|
if (newIndices.length && this._questionMarkers) {
|
|
16826
16878
|
this._questionMarkers.openDropdownForMarkerIndices(newIndices);
|
|
16827
16879
|
}
|
|
@@ -16854,7 +16906,9 @@ class LabelImageEditor extends React.Component {
|
|
|
16854
16906
|
}), /*#__PURE__*/React.createElement("div", {
|
|
16855
16907
|
className: css(styles.largeSpacer)
|
|
16856
16908
|
}), /*#__PURE__*/React.createElement(QuestionMarkers, {
|
|
16857
|
-
choices: choices
|
|
16909
|
+
choices: choices
|
|
16910
|
+
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
16911
|
+
,
|
|
16858
16912
|
imageUrl: imageSelected ? imageUrl : "",
|
|
16859
16913
|
imageWidth: imageWidth,
|
|
16860
16914
|
imageHeight: imageHeight,
|
|
@@ -17326,6 +17380,7 @@ class NumberLineEditor extends React.Component {
|
|
|
17326
17380
|
numDivisions = numDivisions < 0 ? numDivisions * -1 : numDivisions;
|
|
17327
17381
|
|
|
17328
17382
|
// If the number of divisions isn't blank, update the number line
|
|
17383
|
+
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
17329
17384
|
if (numDivisions) {
|
|
17330
17385
|
// Constrain numDivisions to be within the allowed range
|
|
17331
17386
|
numDivisions = Math.min(divRange[1], Math.max(divRange[0], numDivisions));
|
|
@@ -17372,6 +17427,7 @@ class NumberLineEditor extends React.Component {
|
|
|
17372
17427
|
let step;
|
|
17373
17428
|
if (!isTickCtrl) {
|
|
17374
17429
|
// this will help constrain the answer to what is reachable
|
|
17430
|
+
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
17375
17431
|
step = tickStep ? tickStep / snapDivisions : width / numDivisions / snapDivisions;
|
|
17376
17432
|
} else {
|
|
17377
17433
|
// but if tickCtrl is on, the range of what is reachable is
|
|
@@ -17511,7 +17567,9 @@ class NumberLineEditor extends React.Component {
|
|
|
17511
17567
|
}
|
|
17512
17568
|
})), /*#__PURE__*/React.createElement("div", {
|
|
17513
17569
|
className: "perseus-widget-row"
|
|
17514
|
-
}, isTickCtrl && /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("label", null, "Start num divisions at", " ", /*#__PURE__*/React.createElement(NumberInput$5
|
|
17570
|
+
}, isTickCtrl && /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("label", null, "Start num divisions at", " ", /*#__PURE__*/React.createElement(NumberInput$5
|
|
17571
|
+
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
17572
|
+
, {
|
|
17515
17573
|
value: this.props.numDivisions || null,
|
|
17516
17574
|
format: "decimal",
|
|
17517
17575
|
onChange: this.onNumDivisionsChange,
|
|
@@ -17520,7 +17578,9 @@ class NumberLineEditor extends React.Component {
|
|
|
17520
17578
|
},
|
|
17521
17579
|
placeholder: width / this.props.tickStep,
|
|
17522
17580
|
useArrowKeys: true
|
|
17523
|
-
})), /*#__PURE__*/React.createElement(InfoTip$8, null, /*#__PURE__*/React.createElement("p", null, "This controls the number (and position) of the tick marks. The number of divisions is constrained to", " " + divisionRange[0] + EN_DASH + divisionRange[1], ".", /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("strong", null, "Note:"), " The user will be able to specify the number of divisions in a number input."))), !isTickCtrl && /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("label", null, "Num divisions:", " ", /*#__PURE__*/React.createElement(NumberInput$5
|
|
17581
|
+
})), /*#__PURE__*/React.createElement(InfoTip$8, null, /*#__PURE__*/React.createElement("p", null, "This controls the number (and position) of the tick marks. The number of divisions is constrained to", " " + divisionRange[0] + EN_DASH + divisionRange[1], ".", /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("strong", null, "Note:"), " The user will be able to specify the number of divisions in a number input."))), !isTickCtrl && /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("label", null, "Num divisions:", " ", /*#__PURE__*/React.createElement(NumberInput$5
|
|
17582
|
+
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
17583
|
+
, {
|
|
17524
17584
|
value: this.props.numDivisions || null,
|
|
17525
17585
|
format: "decimal",
|
|
17526
17586
|
onChange: this.onNumDivisionsChange,
|
|
@@ -17529,7 +17589,9 @@ class NumberLineEditor extends React.Component {
|
|
|
17529
17589
|
},
|
|
17530
17590
|
placeholder: width / this.props.tickStep,
|
|
17531
17591
|
useArrowKeys: true
|
|
17532
|
-
})), " ", /*#__PURE__*/React.createElement("label", null, "or tick step:", " ", /*#__PURE__*/React.createElement(NumberInput$5
|
|
17592
|
+
})), " ", /*#__PURE__*/React.createElement("label", null, "or tick step:", " ", /*#__PURE__*/React.createElement(NumberInput$5
|
|
17593
|
+
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
17594
|
+
, {
|
|
17533
17595
|
value: this.props.tickStep || null,
|
|
17534
17596
|
format: this.props.labelStyle,
|
|
17535
17597
|
onChange: this.onTickStepChange,
|
|
@@ -18036,6 +18098,7 @@ NumericInputEditor.displayName = "NumericInputEditor";
|
|
|
18036
18098
|
NumericInputEditor.defaultProps = numericInputLogic.defaultWidgetOptions;
|
|
18037
18099
|
|
|
18038
18100
|
/* eslint-disable @khanacademy/ts-no-error-suppressions */
|
|
18101
|
+
/* eslint-disable react/forbid-prop-types */
|
|
18039
18102
|
const {
|
|
18040
18103
|
InfoTip: InfoTip$6,
|
|
18041
18104
|
TextListEditor: TextListEditor$2
|
|
@@ -18458,6 +18521,7 @@ class PlotterEditor extends React.Component {
|
|
|
18458
18521
|
};
|
|
18459
18522
|
this.changeScale = e => {
|
|
18460
18523
|
const oldScale = this.props.scaleY;
|
|
18524
|
+
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
18461
18525
|
const newScale = +e.target.value || editorDefaults.scaleY;
|
|
18462
18526
|
const scale = function scale(value) {
|
|
18463
18527
|
return value * newScale / oldScale;
|
|
@@ -18475,11 +18539,13 @@ class PlotterEditor extends React.Component {
|
|
|
18475
18539
|
};
|
|
18476
18540
|
this.changeMax = e => {
|
|
18477
18541
|
this.props.onChange({
|
|
18542
|
+
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
18478
18543
|
maxY: +e.target.value || editorDefaults.maxY
|
|
18479
18544
|
});
|
|
18480
18545
|
};
|
|
18481
18546
|
this.changeSnaps = e => {
|
|
18482
18547
|
this.props.onChange({
|
|
18548
|
+
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
18483
18549
|
snapsPerLine: +e.target.value || editorDefaults.snapsPerLine
|
|
18484
18550
|
});
|
|
18485
18551
|
};
|
|
@@ -18962,6 +19028,7 @@ RadioEditor.widgetName = "radio";
|
|
|
18962
19028
|
RadioEditor.defaultProps = radioLogic.defaultWidgetOptions;
|
|
18963
19029
|
|
|
18964
19030
|
/* eslint-disable @khanacademy/ts-no-error-suppressions */
|
|
19031
|
+
/* eslint-disable react/forbid-prop-types */
|
|
18965
19032
|
const {
|
|
18966
19033
|
InfoTip: InfoTip$2,
|
|
18967
19034
|
TextListEditor
|
|
@@ -19034,7 +19101,9 @@ class TableEditor extends React.Component {
|
|
|
19034
19101
|
(_this$numberOfColumns = this.numberOfColumns.current) == null || _this$numberOfColumns.focus();
|
|
19035
19102
|
};
|
|
19036
19103
|
this.onSizeInput = (numRawRows, numRawColumns) => {
|
|
19104
|
+
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
19037
19105
|
let rows = +numRawRows || 0;
|
|
19106
|
+
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
19038
19107
|
let columns = +numRawColumns || 0;
|
|
19039
19108
|
rows = Math.min(Math.max(1, rows), 30);
|
|
19040
19109
|
columns = Math.min(Math.max(1, columns), 6);
|