@khanacademy/perseus 77.0.3 → 77.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.
package/dist/types.d.ts CHANGED
@@ -64,11 +64,6 @@ export type ImageDict = {
64
64
  export type EditorMode = "edit" | "preview" | "json";
65
65
  export type ChoiceState = {
66
66
  selected: boolean;
67
- highlighted: boolean;
68
- rationaleShown: boolean;
69
- correctnessShown: boolean;
70
- previouslyAnswered: boolean;
71
- readOnly: boolean;
72
67
  };
73
68
  /**
74
69
  * TODO(LEMS-3245) remove ChangeHandler
@@ -392,7 +387,6 @@ type UniversalWidgetProps<TUserInput = Empty, TrackingExtraArgs = Empty> = {
392
387
  problemNum: number | null | undefined;
393
388
  apiOptions: APIOptionsWithDefaults;
394
389
  keypadElement?: any;
395
- questionCompleted?: boolean;
396
390
  onFocus: (blurPath: FocusPath) => void;
397
391
  onBlur: (blurPath: FocusPath) => void;
398
392
  findWidgets: (criterion: FilterCriterion) => ReadonlyArray<Widget>;
@@ -1,4 +1,4 @@
1
- import type radio from "../../widgets/radio/radio";
1
+ import type radio from "../../widgets/radio";
2
2
  import type { PerseusRadioUserInput, RecursiveReadonly } from "@khanacademy/perseus-core";
3
3
  import type React from "react";
4
4
  type BasicOption = {
@@ -66,7 +66,6 @@ declare const _default: {
66
66
  showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
67
67
  }>;
68
68
  keypadElement?: any;
69
- questionCompleted?: boolean;
70
69
  onFocus: (blurPath: import("../..").FocusPath) => void;
71
70
  onBlur: (blurPath: import("../..").FocusPath) => void;
72
71
  findWidgets: (criterion: import("../../types").FilterCriterion) => ReadonlyArray<Widget>;
@@ -56,7 +56,6 @@ export declare const Expression: React.ForwardRefExoticComponent<PerseusExpressi
56
56
  showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
57
57
  }>;
58
58
  keypadElement?: any;
59
- questionCompleted?: boolean;
60
59
  onFocus: (blurPath: FocusPath) => void;
61
60
  onBlur: (blurPath: FocusPath) => void;
62
61
  findWidgets: (criterion: import("../../types").FilterCriterion) => ReadonlyArray<Widget>;
@@ -136,7 +135,6 @@ declare const _default: {
136
135
  showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
137
136
  }>;
138
137
  keypadElement?: any;
139
- questionCompleted?: boolean;
140
138
  onFocus: (blurPath: FocusPath) => void;
141
139
  onBlur: (blurPath: FocusPath) => void;
142
140
  findWidgets: (criterion: import("../../types").FilterCriterion) => ReadonlyArray<Widget>;
@@ -161,7 +161,9 @@ declare class InteractiveGraph extends React.Component<Props, State> {
161
161
  problemNum: number | null | undefined;
162
162
  apiOptions: Readonly<Readonly<{
163
163
  isArticle?: boolean;
164
- onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
164
+ onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight? /**
165
+ * Whether to show the arrows on the axis.
166
+ */: number, focusedElement?: HTMLElement) => unknown;
165
167
  showAlignmentOptions?: boolean;
166
168
  readOnly?: boolean;
167
169
  editingDisabled?: boolean;
@@ -206,7 +208,6 @@ declare class InteractiveGraph extends React.Component<Props, State> {
206
208
  showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
207
209
  }>;
208
210
  keypadElement?: any;
209
- questionCompleted?: boolean;
210
211
  onFocus: (blurPath: import("../..").FocusPath) => void;
211
212
  onBlur: (blurPath: import("../..").FocusPath) => void;
212
213
  findWidgets: (criterion: import("../../types").FilterCriterion) => ReadonlyArray<import("../../types").Widget>;
@@ -165,7 +165,6 @@ declare const _default: {
165
165
  showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
166
166
  }>;
167
167
  keypadElement?: any;
168
- questionCompleted?: boolean;
169
168
  onFocus: (blurPath: import("../..").FocusPath) => void;
170
169
  onBlur: (blurPath: import("../..").FocusPath) => void;
171
170
  findWidgets: (criterion: import("../../types").FilterCriterion) => ReadonlyArray<Widget>;
@@ -89,7 +89,6 @@ declare class MockWidgetComponent extends React.Component<Props> implements Widg
89
89
  showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
90
90
  }>;
91
91
  keypadElement?: any;
92
- questionCompleted?: boolean;
93
92
  onFocus: (blurPath: import("../..").FocusPath) => void;
94
93
  onBlur: (blurPath: import("../..").FocusPath) => void;
95
94
  findWidgets: (criterion: import("../../types").FilterCriterion) => ReadonlyArray<Widget>;
@@ -96,7 +96,6 @@ export declare class NumericInput extends React.Component<NumericInputProps> imp
96
96
  showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
97
97
  }>;
98
98
  keypadElement?: any;
99
- questionCompleted?: boolean;
100
99
  onFocus: (blurPath: import("../..").FocusPath) => void;
101
100
  onBlur: (blurPath: import("../..").FocusPath) => void;
102
101
  findWidgets: (criterion: import("../../types").FilterCriterion) => ReadonlyArray<Widget>;
@@ -59,7 +59,6 @@ export declare const NumericInputComponent: React.ForwardRefExoticComponent<impo
59
59
  showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
60
60
  }>;
61
61
  keypadElement?: any;
62
- questionCompleted?: boolean;
63
62
  onFocus: (blurPath: import("../..").FocusPath) => void;
64
63
  onBlur: (blurPath: import("../..").FocusPath) => void;
65
64
  findWidgets: (criterion: import("../../types").FilterCriterion) => ReadonlyArray<import("../../types").Widget>;
@@ -1 +1,16 @@
1
- export { default } from "./radio";
1
+ import Radio from "./radio-widget";
2
+ import type { PerseusRadioUserInput } from "@khanacademy/perseus-core";
3
+ declare function getStartUserInput(): PerseusRadioUserInput;
4
+ declare const _default: {
5
+ name: string;
6
+ displayName: string;
7
+ widget: typeof Radio;
8
+ getStartUserInput: typeof getStartUserInput;
9
+ version: import("@khanacademy/perseus-core").Version | undefined;
10
+ isLintable: true;
11
+ /**
12
+ * @deprecated - do not use in new code.
13
+ */
14
+ getUserInputFromSerializedState: (serializedState: unknown) => PerseusRadioUserInput;
15
+ };
16
+ export default _default;
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
- import type { ChoiceType } from "./multiple-choice-widget";
2
+ import type { ChoiceType } from "./radio-widget";
3
3
  /**
4
- * Props for the MultipleChoiceComponent
4
+ * Props for the RadioComponent
5
5
  */
6
- export interface MultipleChoiceComponentProps {
6
+ export interface RadioComponentProps {
7
7
  choices: ReadonlyArray<ChoiceType>;
8
8
  countChoices: boolean | null | undefined;
9
9
  multipleSelect?: boolean;
@@ -12,10 +12,10 @@ export interface MultipleChoiceComponentProps {
12
12
  reviewMode: boolean;
13
13
  }
14
14
  /**
15
- * The MultipleChoiceComponent renders the UI for multiple choice questions.
15
+ * The RadioComponent renders the UI for multiple choice questions.
16
16
  *
17
17
  * This component handles the presentation of choices, user interactions,
18
- * and accessibility features, while the MultipleChoiceWidget manages the
18
+ * and accessibility features, while the RadioWidget manages the
19
19
  * underlying logic and state.
20
20
  *
21
21
  * Supports both radio button (single select) and checkbox (multiple select) modes.
@@ -49,5 +49,5 @@ export interface MultipleChoiceComponentProps {
49
49
  *
50
50
  * Created as part of the Radio Revitalization Project (LEMS-2933).
51
51
  */
52
- declare const MultipleChoiceComponent: ({ choices, countChoices, multipleSelect, numCorrect, onChoiceChange, reviewMode, }: MultipleChoiceComponentProps) => React.ReactElement;
53
- export default MultipleChoiceComponent;
52
+ declare const RadioComponent: ({ choices, countChoices, multipleSelect, numCorrect, onChoiceChange, reviewMode, }: RadioComponentProps) => React.ReactElement;
53
+ export default RadioComponent;
@@ -0,0 +1,49 @@
1
+ import * as React from "react";
2
+ import type { WidgetProps, ChoiceState, Widget } from "../../types";
3
+ import type { RadioPromptJSON } from "../../widget-ai-utils/radio/radio-ai-utils";
4
+ import type { PerseusRadioChoice, PerseusRadioRubric, PerseusRadioUserInput } from "@khanacademy/perseus-core";
5
+ /**
6
+ * Represents a single choice in the RadioComponent
7
+ */
8
+ export interface ChoiceType {
9
+ id: string;
10
+ checked: boolean;
11
+ content: React.ReactNode;
12
+ rationale: React.ReactNode;
13
+ hasRationale: boolean;
14
+ correct: boolean;
15
+ isNoneOfTheAbove: boolean;
16
+ }
17
+ export type RadioProps = {
18
+ numCorrect: number;
19
+ hasNoneOfTheAbove?: boolean;
20
+ multipleSelect?: boolean;
21
+ countChoices?: boolean;
22
+ deselectEnabled?: boolean;
23
+ choices: RadioChoiceWithMetadata[];
24
+ choiceStates?: ChoiceState[];
25
+ randomize?: boolean;
26
+ };
27
+ type RadioWidgetHandle = {
28
+ getSerializedState(): any;
29
+ getPromptJSON(): RadioPromptJSON;
30
+ };
31
+ /**
32
+ * RadioChoiceWithMetadata is used for server-side scoring
33
+ */
34
+ export interface RadioChoiceWithMetadata extends PerseusRadioChoice {
35
+ originalIndex: number;
36
+ correct?: boolean;
37
+ }
38
+ type Props = WidgetProps<RadioProps, PerseusRadioUserInput, PerseusRadioRubric>;
39
+ declare class Radio extends React.Component<Props> implements Widget {
40
+ radioRef: React.RefObject<RadioWidgetHandle>;
41
+ /**
42
+ * @deprecated and likely very broken API
43
+ * [LEMS-3185] do not trust serializedState
44
+ */
45
+ getSerializedState(): any;
46
+ getPromptJSON(): RadioPromptJSON;
47
+ render(): React.ReactNode;
48
+ }
49
+ export default Radio;
@@ -1,5 +1,5 @@
1
1
  import { type PerseusRadioUserInput, type PerseusRadioWidgetOptions } from "@khanacademy/perseus-core";
2
- import type { RadioChoiceWithMetadata } from "./multiple-choice-widget";
2
+ import type { RadioChoiceWithMetadata } from "./radio-widget";
3
3
  import type { PerseusStrings } from "../../strings";
4
4
  /**
5
5
  * Given a choice's position in the radio widget, return the corresponding
@@ -1,5 +1,5 @@
1
1
  import type { ChoiceState } from "../../../types";
2
- import type { RadioChoiceWithMetadata } from "../multiple-choice-widget";
2
+ import type { RadioChoiceWithMetadata } from "../radio-widget";
3
3
  import type { ShowSolutions } from "@khanacademy/perseus-core";
4
4
  interface GetChoiceStatesProps {
5
5
  choices: ReadonlyArray<RadioChoiceWithMetadata>;
@@ -97,7 +97,6 @@ declare class Table extends React.Component<Props> implements Widget {
97
97
  showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
98
98
  }>;
99
99
  keypadElement?: any;
100
- questionCompleted?: boolean;
101
100
  onFocus: (blurPath: FocusPath) => void;
102
101
  onBlur: (blurPath: FocusPath) => void;
103
102
  findWidgets: (criterion: import("../../types").FilterCriterion) => ReadonlyArray<Widget>;
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": "77.0.3",
6
+ "version": "77.1.0",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -43,37 +43,37 @@
43
43
  "uuid": "^10.0.0",
44
44
  "@khanacademy/kas": "2.2.1",
45
45
  "@khanacademy/keypad-context": "3.2.41",
46
- "@khanacademy/math-input": "26.4.11",
47
- "@khanacademy/perseus-core": "24.0.0",
48
46
  "@khanacademy/kmath": "2.3.1",
49
- "@khanacademy/perseus-linter": "4.9.1",
47
+ "@khanacademy/math-input": "26.4.12",
48
+ "@khanacademy/perseus-core": "24.0.0",
49
+ "@khanacademy/perseus-score": "8.5.0",
50
50
  "@khanacademy/perseus-utils": "2.1.5",
51
51
  "@khanacademy/pure-markdown": "2.2.7",
52
52
  "@khanacademy/simple-markdown": "2.2.2",
53
- "@khanacademy/perseus-score": "8.5.0"
53
+ "@khanacademy/perseus-linter": "4.9.1"
54
54
  },
55
55
  "devDependencies": {
56
- "@khanacademy/wonder-blocks-announcer": "1.0.6",
56
+ "@khanacademy/wonder-blocks-announcer": "1.1.0",
57
57
  "@khanacademy/wonder-blocks-banner": "5.0.18",
58
58
  "@khanacademy/wonder-blocks-button": "11.4.2",
59
59
  "@khanacademy/wonder-blocks-clickable": "8.1.5",
60
60
  "@khanacademy/wonder-blocks-core": "12.4.3",
61
61
  "@khanacademy/wonder-blocks-data": "15.0.1",
62
- "@khanacademy/wonder-blocks-dropdown": "10.8.2",
62
+ "@khanacademy/wonder-blocks-dropdown": "10.8.3",
63
63
  "@khanacademy/wonder-blocks-form": "7.5.6",
64
64
  "@khanacademy/wonder-blocks-icon-button": "11.1.6",
65
65
  "@khanacademy/wonder-blocks-icon": "5.3.9",
66
66
  "@khanacademy/wonder-blocks-labeled-field": "4.0.16",
67
67
  "@khanacademy/wonder-blocks-layout": "3.1.46",
68
68
  "@khanacademy/wonder-blocks-link": "10.1.7",
69
- "@khanacademy/wonder-blocks-modal": "8.5.17",
69
+ "@khanacademy/wonder-blocks-modal": "8.6.0",
70
70
  "@khanacademy/wonder-blocks-pill": "3.1.57",
71
- "@khanacademy/wonder-blocks-popover": "6.1.55",
71
+ "@khanacademy/wonder-blocks-popover": "6.1.56",
72
72
  "@khanacademy/wonder-blocks-progress-spinner": "3.1.46",
73
73
  "@khanacademy/wonder-blocks-switch": "3.3.30",
74
74
  "@khanacademy/wonder-blocks-timing": "7.0.4",
75
75
  "@khanacademy/wonder-blocks-tokens": "16.1.0",
76
- "@khanacademy/wonder-blocks-tooltip": "4.1.68",
76
+ "@khanacademy/wonder-blocks-tooltip": "4.1.69",
77
77
  "@khanacademy/wonder-blocks-typography": "4.2.31",
78
78
  "@khanacademy/wonder-stuff-core": "3.0.0",
79
79
  "@phosphor-icons/core": "2.0.2",
@@ -90,27 +90,27 @@
90
90
  "raphael": "1.5.4"
91
91
  },
92
92
  "peerDependencies": {
93
- "@khanacademy/wonder-blocks-announcer": "^1.0.6",
93
+ "@khanacademy/wonder-blocks-announcer": "^1.1.0",
94
94
  "@khanacademy/wonder-blocks-banner": "^5.0.18",
95
95
  "@khanacademy/wonder-blocks-button": "^11.4.2",
96
96
  "@khanacademy/wonder-blocks-clickable": "^8.1.5",
97
97
  "@khanacademy/wonder-blocks-core": "^12.4.3",
98
98
  "@khanacademy/wonder-blocks-data": "^15.0.1",
99
- "@khanacademy/wonder-blocks-dropdown": "^10.8.2",
99
+ "@khanacademy/wonder-blocks-dropdown": "^10.8.3",
100
100
  "@khanacademy/wonder-blocks-form": "^7.5.6",
101
101
  "@khanacademy/wonder-blocks-icon": "^5.3.9",
102
102
  "@khanacademy/wonder-blocks-icon-button": "^11.1.6",
103
103
  "@khanacademy/wonder-blocks-labeled-field": "^4.0.16",
104
104
  "@khanacademy/wonder-blocks-layout": "^3.1.46",
105
105
  "@khanacademy/wonder-blocks-link": "^10.1.7",
106
- "@khanacademy/wonder-blocks-modal": "^8.5.17",
106
+ "@khanacademy/wonder-blocks-modal": "^8.6.0",
107
107
  "@khanacademy/wonder-blocks-pill": "^3.1.57",
108
- "@khanacademy/wonder-blocks-popover": "^6.1.55",
108
+ "@khanacademy/wonder-blocks-popover": "^6.1.56",
109
109
  "@khanacademy/wonder-blocks-progress-spinner": "^3.1.46",
110
110
  "@khanacademy/wonder-blocks-switch": "^3.3.30",
111
111
  "@khanacademy/wonder-blocks-timing": "^7.0.4",
112
112
  "@khanacademy/wonder-blocks-tokens": "^16.1.0",
113
- "@khanacademy/wonder-blocks-tooltip": "^4.1.68",
113
+ "@khanacademy/wonder-blocks-tooltip": "^4.1.69",
114
114
  "@khanacademy/wonder-blocks-typography": "^4.2.31",
115
115
  "@khanacademy/wonder-stuff-core": "^3.0.0",
116
116
  "@phosphor-icons/core": "^2.0.2",
@@ -126,7 +126,7 @@
126
126
  },
127
127
  "keywords": [],
128
128
  "khan": {
129
- "catalogHash": "f59b84a1576ddc86"
129
+ "catalogHash": "a1f429536c944326"
130
130
  },
131
131
  "scripts": {}
132
132
  }
@@ -1,110 +0,0 @@
1
- import * as React from "react";
2
- import type { ChoiceState } from "../../types";
3
- import type { RadioPromptJSON } from "../../widget-ai-utils/radio/radio-ai-utils";
4
- import type { PerseusRadioChoice, PerseusRadioRubric, PerseusRadioUserInput } from "@khanacademy/perseus-core";
5
- import type { LinterContextProps } from "@khanacademy/perseus-linter";
6
- /**
7
- * Represents a single choice in the MultipleChoiceComponent
8
- */
9
- export interface ChoiceType {
10
- id: string;
11
- checked: boolean;
12
- content: React.ReactNode;
13
- rationale: React.ReactNode;
14
- hasRationale: boolean;
15
- showRationale: boolean;
16
- showCorrectness: boolean;
17
- correct: boolean;
18
- isNoneOfTheAbove: boolean;
19
- previouslyAnswered: boolean;
20
- revealNoneOfTheAbove: boolean;
21
- disabled: boolean;
22
- }
23
- export type RadioProps = {
24
- numCorrect: number;
25
- hasNoneOfTheAbove?: boolean;
26
- multipleSelect?: boolean;
27
- countChoices?: boolean;
28
- deselectEnabled?: boolean;
29
- choices: RadioChoiceWithMetadata[];
30
- choiceStates?: ChoiceState[];
31
- editMode?: boolean;
32
- labelWrap?: boolean;
33
- randomize?: boolean;
34
- };
35
- export type RadioWidgetHandle = {
36
- getPromptJSON(): RadioPromptJSON;
37
- };
38
- /**
39
- * RadioChoiceWithMetadata is used for server-side scoring
40
- */
41
- export interface RadioChoiceWithMetadata extends PerseusRadioChoice {
42
- originalIndex: number;
43
- correct?: boolean;
44
- }
45
- declare const Radio: React.ForwardRefExoticComponent<RadioProps & {
46
- trackInteraction: (extraData?: PerseusRadioRubric | undefined) => void;
47
- widgetId: string;
48
- widgetIndex: number;
49
- alignment: string | null | undefined;
50
- static: boolean | null | undefined;
51
- problemNum: number | null | undefined;
52
- apiOptions: Readonly<Readonly<{
53
- isArticle?: boolean;
54
- onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
55
- showAlignmentOptions?: boolean;
56
- readOnly?: boolean;
57
- editingDisabled?: boolean;
58
- answerableCallback?: (arg1: boolean) => unknown;
59
- getAnotherHint?: () => unknown;
60
- interactionCallback?: (widgetData: {
61
- [widgetId: string]: any;
62
- }) => void;
63
- imagePlaceholder?: React.ReactNode;
64
- widgetPlaceholder?: React.ReactNode;
65
- baseElements?: {
66
- Link: React.ComponentType<any>;
67
- };
68
- imagePreloader?: (dimensions: import("../../types").Dimensions) => React.ReactNode;
69
- trackInteraction?: (args: {
70
- type: string;
71
- id: string;
72
- correct?: boolean;
73
- } & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
74
- visible: number;
75
- }>) => void;
76
- customKeypad?: boolean;
77
- nativeKeypadProxy?: (blur: () => void) => import("@khanacademy/math-input").KeypadAPI;
78
- isMobile?: boolean;
79
- isMobileApp?: boolean;
80
- setDrawingAreaAvailable?: (arg1: boolean) => unknown;
81
- hintProgressColor?: string;
82
- canScrollPage?: boolean;
83
- editorChangeDelay?: number;
84
- flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-absolute-value" | "interactive-graph-tangent" | "interactive-graph-logarithm" | "interactive-graph-exponent" | "interactive-graph-vector", boolean>;
85
- }> & {
86
- baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
87
- canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
88
- editorChangeDelay: NonNullable<import("../..").APIOptions["editorChangeDelay"]>;
89
- isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
90
- isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
91
- isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
92
- editingDisabled: NonNullable<import("../..").APIOptions["editingDisabled"]>;
93
- onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
94
- readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
95
- setDrawingAreaAvailable: NonNullable<import("../..").APIOptions["setDrawingAreaAvailable"]>;
96
- showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
97
- }>;
98
- keypadElement?: any;
99
- questionCompleted?: boolean;
100
- onFocus: (blurPath: import("../..").FocusPath) => void;
101
- onBlur: (blurPath: import("../..").FocusPath) => void;
102
- findWidgets: (criterion: import("../../types").FilterCriterion) => ReadonlyArray<import("../../types").Widget>;
103
- reviewMode: boolean;
104
- showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
105
- handleUserInput: (newUserInput: PerseusRadioUserInput, cb?: () => void, silent?: boolean) => void;
106
- userInput: PerseusRadioUserInput;
107
- linterContext: LinterContextProps;
108
- containerSizeClass: import("../../util/sizing-utils").SizeClass;
109
- } & React.RefAttributes<RadioWidgetHandle>>;
110
- export default Radio;
@@ -1,16 +0,0 @@
1
- import Radio from "./radio.ff";
2
- import type { PerseusRadioUserInput } from "@khanacademy/perseus-core";
3
- declare function getStartUserInput(): PerseusRadioUserInput;
4
- declare const _default: {
5
- name: string;
6
- displayName: string;
7
- widget: typeof Radio;
8
- getStartUserInput: typeof getStartUserInput;
9
- version: import("@khanacademy/perseus-core").Version | undefined;
10
- isLintable: true;
11
- /**
12
- * @deprecated - do not use in new code.
13
- */
14
- getUserInputFromSerializedState: (serializedState: unknown) => PerseusRadioUserInput;
15
- };
16
- export default _default;
@@ -1,112 +0,0 @@
1
- import { type PerseusRadioRubric, type PerseusRadioUserInput } from "@khanacademy/perseus-core";
2
- import * as React from "react";
3
- import { PerseusI18nContext } from "../../components/i18n-context";
4
- import type { RadioProps, RadioWidgetHandle } from "./multiple-choice-widget";
5
- import type { ChoiceState, Widget, WidgetProps } from "../../types";
6
- import type { RadioPromptJSON } from "../../widget-ai-utils/radio/radio-ai-utils";
7
- type Props = WidgetProps<RadioProps, PerseusRadioUserInput, PerseusRadioRubric>;
8
- type ChoiceStateWithoutSelected = Omit<ChoiceState, "selected">;
9
- type State = {
10
- choiceStates: ChoiceStateWithoutSelected[];
11
- };
12
- /**
13
- * This is a wrapper around the old radio widget that allows us to
14
- * conditionally render the new radio widget when the feature flag is on.
15
- *
16
- * This is necessary to ensure that we do not interrupt the assessment studies
17
- * that are currently running.
18
- *
19
- * TODO(LEMS-2994): Clean up this file. State, initChoiceStates, the
20
- * constructor, and UNSAFE_componentWillUpdate are all now only providing
21
- * static defaults that never update on user interaction.
22
- */
23
- declare class Radio extends React.Component<Props> implements Widget {
24
- static contextType: React.Context<import("../../components/i18n-context").I18nContextType>;
25
- context: React.ContextType<typeof PerseusI18nContext>;
26
- radioRef: React.RefObject<RadioWidgetHandle>;
27
- state: State;
28
- constructor(props: Props);
29
- UNSAFE_componentWillUpdate(nextProps: Props): void;
30
- /**
31
- * @deprecated and likely very broken API
32
- * [LEMS-3185] do not trust serializedState
33
- */
34
- getSerializedState(): {
35
- hasNoneOfTheAbove: boolean;
36
- numCorrect: number;
37
- multipleSelect?: boolean;
38
- countChoices?: boolean;
39
- deselectEnabled?: boolean;
40
- choices: import("./multiple-choice-widget").RadioChoiceWithMetadata[];
41
- choiceStates?: ChoiceState[];
42
- editMode?: boolean;
43
- labelWrap?: boolean;
44
- trackInteraction: (extraData?: PerseusRadioRubric | undefined) => void;
45
- widgetId: string;
46
- widgetIndex: number;
47
- alignment: string | null | undefined;
48
- problemNum: number | null | undefined;
49
- apiOptions: Readonly<Readonly<{
50
- isArticle?: boolean;
51
- onFocusChange?: (newFocusPath: import("../..").FocusPath, oldFocusPath: import("../..").FocusPath, keypadHeight?: number, focusedElement?: HTMLElement) => unknown;
52
- showAlignmentOptions?: boolean;
53
- readOnly?: boolean;
54
- editingDisabled?: boolean;
55
- answerableCallback?: (arg1: boolean) => unknown;
56
- getAnotherHint?: () => unknown;
57
- interactionCallback?: (widgetData: {
58
- [widgetId: string]: any;
59
- }) => void;
60
- imagePlaceholder?: React.ReactNode;
61
- widgetPlaceholder?: React.ReactNode;
62
- baseElements?: {
63
- Link: React.ComponentType<any>;
64
- };
65
- imagePreloader?: (dimensions: import("../../types").Dimensions) => React.ReactNode;
66
- trackInteraction?: (args: {
67
- type: string;
68
- id: string;
69
- correct?: boolean;
70
- } & Partial<import("../../types").TrackingGradedGroupExtraArguments> & Partial<{
71
- visible: number;
72
- }>) => void;
73
- customKeypad?: boolean;
74
- nativeKeypadProxy?: (blur: () => void) => import("@khanacademy/math-input").KeypadAPI;
75
- isMobile?: boolean;
76
- isMobileApp?: boolean;
77
- setDrawingAreaAvailable?: (arg1: boolean) => unknown;
78
- hintProgressColor?: string;
79
- canScrollPage?: boolean;
80
- editorChangeDelay?: number;
81
- flags?: Record<"new-radio-widget" | "image-widget-upgrade-gif-controls" | "image-widget-upgrade-scale" | "interactive-graph-absolute-value" | "interactive-graph-tangent" | "interactive-graph-logarithm" | "interactive-graph-exponent" | "interactive-graph-vector", boolean>;
82
- }> & {
83
- baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
84
- canScrollPage: NonNullable<import("../..").APIOptions["canScrollPage"]>;
85
- editorChangeDelay: NonNullable<import("../..").APIOptions["editorChangeDelay"]>;
86
- isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
87
- isMobile: NonNullable<import("../..").APIOptions["isMobile"]>;
88
- isMobileApp: NonNullable<import("../..").APIOptions["isMobileApp"]>;
89
- editingDisabled: NonNullable<import("../..").APIOptions["editingDisabled"]>;
90
- onFocusChange: NonNullable<import("../..").APIOptions["onFocusChange"]>;
91
- readOnly: NonNullable<import("../..").APIOptions["readOnly"]>;
92
- setDrawingAreaAvailable: NonNullable<import("../..").APIOptions["setDrawingAreaAvailable"]>;
93
- showAlignmentOptions: NonNullable<import("../..").APIOptions["showAlignmentOptions"]>;
94
- }>;
95
- keypadElement?: any;
96
- questionCompleted?: boolean;
97
- onFocus: (blurPath: import("../..").FocusPath) => void;
98
- onBlur: (blurPath: import("../..").FocusPath) => void;
99
- findWidgets: (criterion: import("../../types").FilterCriterion) => ReadonlyArray<Widget>;
100
- reviewMode: boolean;
101
- showSolutions?: import("@khanacademy/perseus-core").ShowSolutions;
102
- handleUserInput: (newUserInput: PerseusRadioUserInput, cb?: () => void, silent?: boolean) => void;
103
- linterContext: import("@khanacademy/perseus-linter").LinterContextProps;
104
- containerSizeClass: import("../../util/sizing-utils").SizeClass;
105
- };
106
- getPromptJSON(): RadioPromptJSON;
107
- _mergePropsAndState(): Props & {
108
- numCorrect: number;
109
- };
110
- render(): React.ReactNode;
111
- }
112
- export default Radio;