@khanacademy/perseus 45.0.0 → 45.1.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.
@@ -1,4 +1,4 @@
1
1
  import type { PerseusScore } from "../../types";
2
- import type { PerseusNumberLineRubric, PerseusNumberLineUserInput } from "../../validation.types";
3
- declare function scoreNumberLine(state: PerseusNumberLineUserInput, rubric: PerseusNumberLineRubric): PerseusScore;
2
+ import type { PerseusNumberLineScoringData, PerseusNumberLineUserInput } from "../../validation.types";
3
+ declare function scoreNumberLine(userInput: PerseusNumberLineUserInput, scoringData: PerseusNumberLineScoringData): PerseusScore;
4
4
  export default scoreNumberLine;
@@ -0,0 +1,12 @@
1
+ import type { PerseusScore } from "../../types";
2
+ import type { PerseusNumberLineUserInput } from "../../validation.types";
3
+ /**
4
+ * Checks user input is within the allowed range and not the same as the initial
5
+ * state.
6
+ * @param userInput
7
+ * @see 'scoreNumberLine' for the scoring logic.
8
+ */
9
+ declare function validateNumberLine(userInput: PerseusNumberLineUserInput): Extract<PerseusScore, {
10
+ type: "invalid";
11
+ }> | null;
12
+ export default validateNumberLine;
@@ -15,7 +15,7 @@ type Props = ExternalProps & {
15
15
  apiOptions: NonNullable<ExternalProps["apiOptions"]>;
16
16
  coefficient: NonNullable<ExternalProps["coefficient"]>;
17
17
  answerForms: NonNullable<ExternalProps["answerForms"]>;
18
- labelText: NonNullable<ExternalProps["labelText"]>;
18
+ labelText: string;
19
19
  linterContext: NonNullable<ExternalProps["linterContext"]>;
20
20
  currentValue: string;
21
21
  };
@@ -31,6 +31,7 @@ type DefaultProps = {
31
31
  };
32
32
  type State = {
33
33
  previousValues: ReadonlyArray<string>;
34
+ isFocused: boolean;
34
35
  };
35
36
  export declare class NumericInput extends React.Component<Props, State> implements Widget {
36
37
  static contextType: React.Context<{
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Core Perseus API (includes renderers and widgets)",
4
4
  "author": "Khan Academy",
5
5
  "license": "MIT",
6
- "version": "45.0.0",
6
+ "version": "45.1.0",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },