@khanacademy/perseus 60.0.2 → 61.0.1
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.css +1 -3184
- package/dist/es/index.js +58 -30
- package/dist/es/index.js.map +1 -1
- package/dist/index.css +1 -3184
- package/dist/index.d.ts +2 -2
- package/dist/index.js +58 -33
- package/dist/index.js.map +1 -1
- package/dist/perseus-version.d.ts +0 -4
- package/dist/types.d.ts +0 -1
- package/dist/util/test-utils.d.ts +1 -12
- package/dist/util.d.ts +6 -1
- package/dist/widget-ai-utils/radio/radio-ai-utils.d.ts +2 -2
- package/dist/widgets/expression/expression.d.ts +3 -3
- package/dist/widgets/graded-group/graded-group.d.ts +2 -2
- package/dist/widgets/graded-group-set/graded-group-set.d.ts +2 -2
- package/dist/widgets/grapher/grapher.d.ts +2 -2
- package/dist/widgets/group/group.d.ts +2 -2
- package/dist/widgets/input-number/input-number.d.ts +3 -3
- package/dist/widgets/interactive-graph.d.ts +13 -13
- package/dist/widgets/interactive-graphs/types.d.ts +1 -1
- package/dist/widgets/matcher/matcher.d.ts +2 -2
- package/dist/widgets/matrix/matrix.d.ts +2 -2
- package/dist/widgets/measurer/measurer.d.ts +1 -1
- package/dist/widgets/mock-widgets/mock-widget.d.ts +2 -2
- package/dist/widgets/number-line/number-line.d.ts +2 -2
- package/dist/widgets/numeric-input/numeric-input.class.d.ts +1 -1
- package/dist/widgets/numeric-input/numeric-input.d.ts +1 -1
- package/dist/widgets/orderer/orderer.d.ts +2 -2
- package/dist/widgets/phet-simulation/phet-simulation.d.ts +1 -1
- package/dist/widgets/plotter/plotter.d.ts +3 -3
- package/dist/widgets/radio/base-radio.new.d.ts +49 -0
- package/dist/widgets/radio/choice-a11y-text.new.d.ts +14 -0
- package/dist/widgets/radio/choice-icon/choice-icon.new.d.ts +23 -0
- package/dist/widgets/radio/choice-none-above.new.d.ts +6 -0
- package/dist/widgets/radio/choice.new.d.ts +23 -0
- package/dist/widgets/radio/focus-ring.new.d.ts +19 -0
- package/dist/widgets/radio/option-status.new.d.ts +24 -0
- package/dist/widgets/radio/radio-component.d.ts +4 -4
- package/dist/widgets/radio/radio-component.new.d.ts +63 -0
- package/dist/widgets/radio/radio.d.ts +1 -1
- package/dist/widgets/radio/radio.ff.d.ts +24 -0
- package/dist/widgets/sorter/sorter.d.ts +2 -2
- package/dist/widgets/table/table.d.ts +23 -17
- package/dist/widgets/table/test-util.d.ts +2 -0
- package/package.json +11 -11
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
|
+
import type { FocusFunction } from "./base-radio.new";
|
|
4
|
+
import type { WidgetProps, ChoiceState, Widget } from "../../types";
|
|
5
|
+
import type { RadioPromptJSON } from "../../widget-ai-utils/radio/radio-ai-utils";
|
|
6
|
+
import type { PerseusRadioChoice, ShowSolutions, PerseusRadioRubric, PerseusRadioUserInput, RecursiveReadonly } from "@khanacademy/perseus-core";
|
|
7
|
+
export type RenderProps = {
|
|
8
|
+
numCorrect: number;
|
|
9
|
+
hasNoneOfTheAbove?: boolean;
|
|
10
|
+
multipleSelect?: boolean;
|
|
11
|
+
countChoices?: boolean;
|
|
12
|
+
deselectEnabled?: boolean;
|
|
13
|
+
choices: ReadonlyArray<RadioChoiceWithMetadata>;
|
|
14
|
+
selectedChoices: ReadonlyArray<PerseusRadioChoice["correct"]>;
|
|
15
|
+
showSolutions?: ShowSolutions;
|
|
16
|
+
choiceStates?: ReadonlyArray<ChoiceState>;
|
|
17
|
+
values?: ReadonlyArray<boolean>;
|
|
18
|
+
};
|
|
19
|
+
type Props = WidgetProps<RenderProps, PerseusRadioRubric>;
|
|
20
|
+
type DefaultProps = Required<Pick<Props, "choices" | "multipleSelect" | "countChoices" | "deselectEnabled" | "linterContext" | "showSolutions">>;
|
|
21
|
+
export type RadioChoiceWithMetadata = PerseusRadioChoice & {
|
|
22
|
+
originalIndex: number;
|
|
23
|
+
correct?: boolean;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* This component is a duplicate of the Radio component in radio.tsx
|
|
27
|
+
* for the Radio Revitalization Project. (LEMS-2933)
|
|
28
|
+
* This component will be split up to move the rendering logic to a new functional component.
|
|
29
|
+
* This file will be renamed to radio.class.tsx and will supercede radio-component.tsx when
|
|
30
|
+
* the feature flag is no longer needed.
|
|
31
|
+
*
|
|
32
|
+
* TODO(LEMS-2994): Clean up this file.
|
|
33
|
+
*/
|
|
34
|
+
declare class Radio extends React.Component<Props> implements Widget {
|
|
35
|
+
static contextType: React.Context<import("../../components/i18n-context").I18nContextType>;
|
|
36
|
+
context: React.ContextType<typeof PerseusI18nContext>;
|
|
37
|
+
focusFunction: FocusFunction;
|
|
38
|
+
static defaultProps: DefaultProps;
|
|
39
|
+
static getUserInputFromProps(props: Props, unshuffle?: boolean): PerseusRadioUserInput;
|
|
40
|
+
componentDidUpdate(prevProps: Props): void;
|
|
41
|
+
_renderRenderer: (content?: string) => React.ReactElement;
|
|
42
|
+
focus(choiceIndex?: number | null): boolean;
|
|
43
|
+
registerFocusFunction(fun: FocusFunction): void;
|
|
44
|
+
updateChoices: (newValueLists: Readonly<{
|
|
45
|
+
checked: ReadonlyArray<boolean>;
|
|
46
|
+
crossedOut: ReadonlyArray<boolean>;
|
|
47
|
+
}>) => void;
|
|
48
|
+
getUserInput(): PerseusRadioUserInput;
|
|
49
|
+
getPromptJSON(): RadioPromptJSON;
|
|
50
|
+
/**
|
|
51
|
+
* Turn on rationale display for the currently selected choices. Note that
|
|
52
|
+
* this leaves rationales on for choices that are already showing
|
|
53
|
+
* rationales.
|
|
54
|
+
* @deprecated Internal only. Use `showSolutions` prop instead.
|
|
55
|
+
*/
|
|
56
|
+
showRationalesForCurrentlySelectedChoices: (arg1: RecursiveReadonly<PerseusRadioRubric>) => void;
|
|
57
|
+
/**
|
|
58
|
+
* Deselects any currently-selected choices that are not correct choices.
|
|
59
|
+
*/
|
|
60
|
+
deselectIncorrectSelectedChoices: () => void;
|
|
61
|
+
render(): React.ReactNode;
|
|
62
|
+
}
|
|
63
|
+
export default Radio;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import RadioOld from "./radio-component";
|
|
3
|
+
import RadioNew from "./radio-component.new";
|
|
4
|
+
import type { RenderProps } from "./radio-component";
|
|
5
|
+
import type { WidgetProps } from "../../types";
|
|
6
|
+
import type { PerseusRadioRubric } from "@khanacademy/perseus-core";
|
|
7
|
+
type Props = WidgetProps<RenderProps, PerseusRadioRubric>;
|
|
8
|
+
/**
|
|
9
|
+
* This is a wrapper around the old radio widget that allows us to
|
|
10
|
+
* conditionally render the new radio widget when the feature flag is on.
|
|
11
|
+
*
|
|
12
|
+
* This is necessary to ensure that we do not interrupt the assessment studies
|
|
13
|
+
* that are currently running.
|
|
14
|
+
*
|
|
15
|
+
* TODO(LEMS-2994): Clean up this file.
|
|
16
|
+
*/
|
|
17
|
+
declare class Radio extends RadioOld {
|
|
18
|
+
ffIsOn: boolean;
|
|
19
|
+
radioRef: React.RefObject<RadioOld | RadioNew>;
|
|
20
|
+
constructor(props: Props);
|
|
21
|
+
focus(choiceIndex?: number | null): boolean;
|
|
22
|
+
render(): React.ReactNode;
|
|
23
|
+
}
|
|
24
|
+
export default Radio;
|
|
@@ -2,9 +2,9 @@ import * as React from "react";
|
|
|
2
2
|
import type { SortableOption } from "../../components/sortable";
|
|
3
3
|
import type { Widget, WidgetProps } from "../../types";
|
|
4
4
|
import type { SorterPromptJSON } from "../../widget-ai-utils/sorter/sorter-ai-utils";
|
|
5
|
-
import type { PerseusSorterWidgetOptions,
|
|
5
|
+
import type { PerseusSorterWidgetOptions, PerseusSorterUserInput } from "@khanacademy/perseus-core";
|
|
6
6
|
type RenderProps = PerseusSorterWidgetOptions;
|
|
7
|
-
type Props = WidgetProps<RenderProps
|
|
7
|
+
type Props = WidgetProps<RenderProps>;
|
|
8
8
|
type DefaultProps = {
|
|
9
9
|
correct: Props["correct"];
|
|
10
10
|
layout: Props["layout"];
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import ReactDOM from "react-dom";
|
|
2
3
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
4
|
import type { ChangeableProps } from "../../mixins/changeable";
|
|
4
|
-
import type { Widget, WidgetProps } from "../../types";
|
|
5
|
-
import type { PerseusTableWidgetOptions,
|
|
6
|
-
type
|
|
5
|
+
import type { FocusPath, Widget, WidgetProps } from "../../types";
|
|
6
|
+
import type { PerseusTableWidgetOptions, PerseusTableUserInput } from "@khanacademy/perseus-core";
|
|
7
|
+
type EditorProps = {
|
|
7
8
|
editableHeaders: boolean;
|
|
8
9
|
Editor: any;
|
|
9
10
|
};
|
|
10
|
-
type
|
|
11
|
+
type RenderProps = PerseusTableWidgetOptions & EditorProps;
|
|
12
|
+
type Props = WidgetProps<PerseusTableWidgetOptions> & ChangeableProps & EditorProps;
|
|
11
13
|
type DefaultProps = {
|
|
12
14
|
apiOptions: Props["apiOptions"];
|
|
13
15
|
headers: Props["headers"];
|
|
@@ -20,28 +22,32 @@ type DefaultProps = {
|
|
|
20
22
|
declare class Table extends React.Component<Props> implements Widget {
|
|
21
23
|
static contextType: React.Context<import("../../components/i18n-context").I18nContextType>;
|
|
22
24
|
context: React.ContextType<typeof PerseusI18nContext>;
|
|
25
|
+
headerRefs: Record<string, any>;
|
|
26
|
+
answerRefs: Record<string, any>;
|
|
23
27
|
static defaultProps: DefaultProps;
|
|
24
|
-
_getRows
|
|
25
|
-
_getColumns
|
|
28
|
+
_getRows(): number;
|
|
29
|
+
_getColumns(): number;
|
|
30
|
+
_getAnswersClone(): PerseusTableUserInput;
|
|
26
31
|
getUserInput(): PerseusTableUserInput;
|
|
27
|
-
onValueChange
|
|
28
|
-
onHeaderChange
|
|
29
|
-
_handleFocus
|
|
30
|
-
_handleBlur
|
|
31
|
-
focus
|
|
32
|
-
focusInputPath
|
|
33
|
-
blurInputPath
|
|
34
|
-
getDOMNodeForPath(path:
|
|
35
|
-
getInputPaths
|
|
36
|
-
setInputValue
|
|
32
|
+
onValueChange(row: number, column: number, eventOrValue: any): void;
|
|
33
|
+
onHeaderChange(index: number, e: any): void;
|
|
34
|
+
_handleFocus(inputPath: any): void;
|
|
35
|
+
_handleBlur(inputPath: any): void;
|
|
36
|
+
focus(): boolean;
|
|
37
|
+
focusInputPath(path: FocusPath): void;
|
|
38
|
+
blurInputPath(path: FocusPath): void;
|
|
39
|
+
getDOMNodeForPath(path: FocusPath): ReturnType<typeof ReactDOM.findDOMNode>;
|
|
40
|
+
getInputPaths(): string[][];
|
|
41
|
+
setInputValue(path: FocusPath, newValue: string, cb: any): void;
|
|
37
42
|
render(): React.ReactNode;
|
|
38
43
|
}
|
|
44
|
+
declare function propTransform(options: Props): RenderProps;
|
|
39
45
|
declare const _default: {
|
|
40
46
|
name: string;
|
|
41
47
|
displayName: string;
|
|
42
48
|
accessible: true;
|
|
43
49
|
widget: typeof Table;
|
|
44
|
-
transform:
|
|
50
|
+
transform: typeof propTransform;
|
|
45
51
|
hidden: true;
|
|
46
52
|
isLintable: true;
|
|
47
53
|
};
|
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": "
|
|
6
|
+
"version": "61.0.1",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -40,16 +40,16 @@
|
|
|
40
40
|
"@use-gesture/react": "^10.2.27",
|
|
41
41
|
"mafs": "0.19.0",
|
|
42
42
|
"uuid": "^10.0.0",
|
|
43
|
-
"@khanacademy/kas": "2.0.
|
|
44
|
-
"@khanacademy/keypad-context": "3.0.
|
|
45
|
-
"@khanacademy/kmath": "2.0.
|
|
46
|
-
"@khanacademy/math-input": "25.0
|
|
47
|
-
"@khanacademy/perseus-core": "
|
|
48
|
-
"@khanacademy/perseus-linter": "3.0.
|
|
49
|
-
"@khanacademy/perseus-score": "5.0.
|
|
43
|
+
"@khanacademy/kas": "2.0.2",
|
|
44
|
+
"@khanacademy/keypad-context": "3.0.6",
|
|
45
|
+
"@khanacademy/kmath": "2.0.6",
|
|
46
|
+
"@khanacademy/math-input": "25.1.0",
|
|
47
|
+
"@khanacademy/perseus-core": "9.0.0",
|
|
48
|
+
"@khanacademy/perseus-linter": "3.0.6",
|
|
49
|
+
"@khanacademy/perseus-score": "5.0.3",
|
|
50
50
|
"@khanacademy/perseus-utils": "2.0.1",
|
|
51
|
-
"@khanacademy/pure-markdown": "2.0.
|
|
52
|
-
"@khanacademy/simple-markdown": "2.0.
|
|
51
|
+
"@khanacademy/pure-markdown": "2.0.2",
|
|
52
|
+
"@khanacademy/simple-markdown": "2.0.2"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@khanacademy/wonder-blocks-banner": "4.1.6",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"react-dom": "^18.2.0",
|
|
85
85
|
"react-popper": "^2.2.5",
|
|
86
86
|
"underscore": "^1.4.4",
|
|
87
|
-
"perseus-build-settings": "0.6.
|
|
87
|
+
"perseus-build-settings": "0.6.1"
|
|
88
88
|
},
|
|
89
89
|
"peerDependencies": {
|
|
90
90
|
"@khanacademy/wonder-blocks-banner": "4.1.6",
|