@khanacademy/perseus 11.5.1 → 11.6.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/index.css CHANGED
@@ -10,6 +10,12 @@ var {
10
10
  font-style: normal;
11
11
  }
12
12
 
13
+ .hint.last-hint {
14
+ .paragraph {
15
+ font-weight: bold;
16
+ }
17
+ }
18
+
13
19
  .hint_blue {
14
20
  color: #6495ed;
15
21
  }
@@ -32,10 +38,6 @@ var {
32
38
  color: #9d38bd;
33
39
  }
34
40
 
35
- .last-hint {
36
- font-weight: bold;
37
- }
38
-
39
41
  div.subhint {
40
42
  border: 1px solid #aaaaaa;
41
43
  background: #f9f9f9;
@@ -2393,8 +2395,6 @@ img.zoom-img {
2393
2395
  margin: -11px 0px 22px 0px;
2394
2396
  }
2395
2397
  .framework-perseus .paragraph ul:not(.perseus-widget-radio) {
2396
- font-size: 14px;
2397
- line-height: 19.6px;
2398
2398
  padding-left: 35px;
2399
2399
  list-style-type: disc;
2400
2400
  }
package/dist/index.js CHANGED
@@ -21656,27 +21656,39 @@ class NumericInput extends React__namespace.Component {
21656
21656
  }
21657
21657
  return answerStrings[0];
21658
21658
  }
21659
- static validate(useInput, rubric) {
21660
- const allAnswerForms = answerFormButtons.map(e => e["value"])
21659
+ static validate(userInput, rubric) {
21660
+ const defaultAnswerForms = answerFormButtons.map(e => e["value"])
21661
21661
  // Don't default to validating the answer as a pi answer
21662
21662
  // if answerForm isn't set on the answer
21663
21663
  // https://khanacademy.atlassian.net/browse/LC-691
21664
21664
  .filter(e => e !== "pi");
21665
21665
  const createValidator = answer => {
21666
+ var _answer$answerForms;
21666
21667
  const stringAnswer = "".concat(answer.value);
21668
+
21669
+ // Always validate against the provided answer forms (pi, decimal, etc.)
21670
+ const validatorForms = [...((_answer$answerForms = answer.answerForms) !== null && _answer$answerForms !== void 0 ? _answer$answerForms : [])];
21671
+
21672
+ // When an answer is set to strict, we validate using ONLY
21673
+ // the provided answerForms. If strict is false, or if there
21674
+ // were no provided answer forms, we will include all
21675
+ // of the default answer forms in our validator.
21676
+ if (!answer.strict || validatorForms.length === 0) {
21677
+ validatorForms.push(...defaultAnswerForms);
21678
+ }
21667
21679
  return KhanAnswerTypes.number.createValidatorFunctional(stringAnswer, {
21668
21680
  message: answer.message,
21669
21681
  simplify: answer.status === "correct" ? answer.simplify : "optional",
21670
21682
  inexact: true,
21671
21683
  // TODO(merlob) backfill / delete
21672
21684
  maxError: answer.maxError,
21673
- forms: answer.strict && answer.answerForms && answer.answerForms.length !== 0 ? answer.answerForms : allAnswerForms
21685
+ forms: validatorForms
21674
21686
  });
21675
21687
  };
21676
21688
 
21677
21689
  // We may have received TeX; try to parse it before grading.
21678
21690
  // If `currentValue` is not TeX, this should be a no-op.
21679
- const currentValue = ParseTex(useInput.currentValue);
21691
+ const currentValue = ParseTex(userInput.currentValue);
21680
21692
  const correctAnswers = rubric.answers.filter(answer => answer.status === "correct");
21681
21693
  const normalizedAnswerExpected = correctAnswers.every(answer => Math.abs(answer.value) <= 1);
21682
21694
 
@@ -44327,7 +44339,7 @@ class HintRenderer extends React__namespace.Component {
44327
44339
  const {
44328
44340
  isMobile
44329
44341
  } = apiOptions;
44330
- const classNames = classNames__default["default"](!isMobile && "perseus-hint-renderer", isMobile && aphrodite.css(styles$5.newHint), isMobile && lastRendered && aphrodite.css(styles$5.lastRenderedNewHint), lastHint && "last-hint", lastRendered && "last-rendered", className);
44342
+ const classNames = classNames__default["default"]("hint", !isMobile && "perseus-hint-renderer", isMobile && aphrodite.css(styles$5.newHint), isMobile && lastRendered && aphrodite.css(styles$5.lastRenderedNewHint), lastHint && "last-hint", lastRendered && "last-rendered", className);
44331
44343
 
44332
44344
  // TODO(charlie): Allowing `customKeypad` would require that we
44333
44345
  // extend `ItemRenderer` to support nested inputs in the `HintsRenderer`.