@khanacademy/perseus-editor 5.2.10 → 5.2.12

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/index.js CHANGED
@@ -66,7 +66,7 @@ var i18n__namespace = /*#__PURE__*/_interopNamespace(i18n$1);
66
66
 
67
67
  // This file is processed by a Rollup plugin (replace) to inject the production
68
68
  const libName = "@khanacademy/perseus-editor";
69
- const libVersion = "5.2.10";
69
+ const libVersion = "5.2.12";
70
70
  perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
71
71
 
72
72
  function _extends() {
@@ -23768,25 +23768,8 @@ class ItemExtrasEditor extends React__namespace.Component {
23768
23768
  tTable: false,
23769
23769
  zTable: false
23770
23770
  };
23771
- finCalcOptions = [];
23772
- state = {
23773
- financialCalculatorOptionsExpanded: false
23774
- };
23775
- constructor(props) {
23776
- super(props);
23777
- this.finCalcOptions = [props.financialCalculatorMonthlyPayment, props.financialCalculatorTotalAmount, props.financialCalculatorTimeToPayOff];
23778
- this.state = {
23779
- financialCalculatorOptionsExpanded: this.finCalcOptions.some(opt => opt === true)
23780
- };
23781
- }
23782
- componentDidUpdate() {
23783
- // If no financial calculator options are checked, uncheck the
23784
- // financial calculator option.
23785
- if (this.state.financialCalculatorOptionsExpanded && !this.finCalcOptions.some(option => option === true)) {
23786
- this.setState({
23787
- financialCalculatorOptionsExpanded: false
23788
- });
23789
- }
23771
+ shouldShowFinancialCalculatorOptions() {
23772
+ return this.props.financialCalculatorMonthlyPayment || this.props.financialCalculatorTotalAmount || this.props.financialCalculatorTimeToPayOff;
23790
23773
  }
23791
23774
  serialize = () => {
23792
23775
  const data = {
@@ -23814,11 +23797,8 @@ class ItemExtrasEditor extends React__namespace.Component {
23814
23797
  }), /*#__PURE__*/React__namespace.createElement(ItemExtraCheckbox, {
23815
23798
  label: "Show financial calculator:",
23816
23799
  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.",
23817
- checked: this.state.financialCalculatorOptionsExpanded,
23800
+ checked: this.shouldShowFinancialCalculatorOptions(),
23818
23801
  onChange: e => {
23819
- this.setState({
23820
- financialCalculatorOptionsExpanded: e.target.checked
23821
- });
23822
23802
  // If the financial calculator is unchecked,
23823
23803
  // these need to be reset. All checked by
23824
23804
  // default.
@@ -23828,7 +23808,7 @@ class ItemExtrasEditor extends React__namespace.Component {
23828
23808
  financialCalculatorTimeToPayOff: e.target.checked
23829
23809
  });
23830
23810
  }
23831
- }), this.state.financialCalculatorOptionsExpanded && /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(ItemExtraCheckbox, {
23811
+ }), this.shouldShowFinancialCalculatorOptions() && /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(ItemExtraCheckbox, {
23832
23812
  label: "Include monthly payment:",
23833
23813
  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?",
23834
23814
  checked: this.props.financialCalculatorMonthlyPayment,