@khanacademy/perseus-editor 45.0.1 → 45.0.3

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.
Files changed (40) hide show
  1. package/dist/all-editors.d.ts +1 -78
  2. package/dist/index.css +1 -1
  3. package/dist/index.css.map +1 -1
  4. package/dist/index.d.ts +1 -1
  5. package/dist/index.js +13 -13
  6. package/dist/index.js.map +1 -1
  7. package/dist/testing/feature-flags-util.d.ts +1 -1
  8. package/dist/widgets/categorizer-editor/categorizer-editor.d.ts +2 -5
  9. package/dist/widgets/cs-program-editor/cs-program-editor.d.ts +3 -4
  10. package/dist/widgets/definition-editor/definition-editor.d.ts +2 -5
  11. package/dist/widgets/dropdown-editor/dropdown-editor.d.ts +2 -5
  12. package/dist/widgets/explanation-editor/explanation-editor.d.ts +2 -5
  13. package/dist/widgets/expression-editor/expression-editor.d.ts +2 -5
  14. package/dist/widgets/fill-in-the-blank-editor/fill-in-the-blank-editor.d.ts +6 -5
  15. package/dist/widgets/free-response-editor/free-response-editor.d.ts +2 -5
  16. package/dist/widgets/graded-group-editor/graded-group-editor.d.ts +2 -5
  17. package/dist/widgets/graded-group-set-editor/graded-group-set-editor.d.ts +2 -5
  18. package/dist/widgets/grapher-editor/grapher-editor.d.ts +2 -5
  19. package/dist/widgets/group-editor/group-editor.d.ts +2 -5
  20. package/dist/widgets/iframe-editor/iframe-editor.d.ts +2 -3
  21. package/dist/widgets/image-editor/image-editor.d.ts +2 -5
  22. package/dist/widgets/interaction-editor/color-picker.d.ts +1 -1
  23. package/dist/widgets/interaction-editor/interaction-editor.d.ts +2 -3
  24. package/dist/widgets/interactive-graph-editor/interactive-graph-editor.d.ts +2 -6
  25. package/dist/widgets/label-image-editor/label-image-editor.d.ts +2 -5
  26. package/dist/widgets/matcher-editor/matcher-editor.d.ts +2 -3
  27. package/dist/widgets/matrix-editor/matrix-editor.d.ts +2 -5
  28. package/dist/widgets/measurer-editor/measurer-editor.d.ts +2 -3
  29. package/dist/widgets/number-line-editor/number-line-editor.d.ts +2 -4
  30. package/dist/widgets/numeric-input-editor/numeric-input-editor.d.ts +2 -5
  31. package/dist/widgets/orderer-editor/orderer-editor.d.ts +2 -3
  32. package/dist/widgets/phet-simulation-editor/phet-simulation-editor.d.ts +2 -3
  33. package/dist/widgets/plotter-editor/plotter-editor.d.ts +2 -6
  34. package/dist/widgets/python-program-editor/python-program-editor.d.ts +2 -3
  35. package/dist/widgets/radio-editor/radio-editor.d.ts +4 -12
  36. package/dist/widgets/sorter-editor/sorter-editor.d.ts +4 -3
  37. package/dist/widgets/table-editor/table-editor.d.ts +3 -5
  38. package/dist/widgets/video-editor/video-editor.d.ts +2 -3
  39. package/dist/widgets/widget-editor-props.d.ts +6 -0
  40. package/package.json +7 -7
@@ -5,10 +5,10 @@ declare const DEFAULT_FEATURE_FLAGS: Record<"perseus-test-flag-1" | "perseus-tes
5
5
  * getFeatureFlags({"image-widget-upgrade": true})
6
6
  */
7
7
  export declare function getFeatureFlags(overrides?: Partial<typeof DEFAULT_FEATURE_FLAGS>): {
8
- "perseus-renderer-upgrade": boolean;
9
8
  "desmos-calculator": boolean;
10
9
  "article-extras": boolean;
11
10
  "dnd-widget-fitb": boolean;
11
+ "dnd-widget-sorter": boolean;
12
12
  "perseus-test-flag-1": boolean;
13
13
  "perseus-test-flag-2": boolean;
14
14
  };
@@ -1,10 +1,7 @@
1
1
  import * as React from "react";
2
- import type { APIOptionsWithDefaults } from "@khanacademy/perseus";
2
+ import type { WidgetEditorProps } from "../widget-editor-props";
3
3
  import type { PerseusCategorizerWidgetOptions } from "@khanacademy/perseus-core";
4
- interface Props extends PerseusCategorizerWidgetOptions {
5
- apiOptions?: APIOptionsWithDefaults;
6
- onChange: (options: PerseusCategorizerWidgetOptions) => void;
7
- }
4
+ type Props = WidgetEditorProps<PerseusCategorizerWidgetOptions>;
8
5
  /**
9
6
  * An editor for adding a categorizer widget that allows users to sort items into categories.
10
7
  */
@@ -2,14 +2,13 @@
2
2
  * This editor is for embedding Khan Academy CS programs.
3
3
  */
4
4
  import * as React from "react";
5
+ import type { WidgetEditorProps } from "../widget-editor-props";
5
6
  import type { PerseusCSProgramWidgetOptions } from "@khanacademy/perseus-core";
6
- interface CSProgramEditorProps extends PerseusCSProgramWidgetOptions {
7
- onChange: (options: PerseusCSProgramWidgetOptions) => void;
8
- }
7
+ type Props = WidgetEditorProps<PerseusCSProgramWidgetOptions>;
9
8
  /**
10
9
  * This is the main editor for this widget, to specify all the options.
11
10
  */
12
- declare class CSProgramEditor extends React.Component<CSProgramEditorProps> {
11
+ declare class CSProgramEditor extends React.Component<Props> {
13
12
  change: (...args: ReadonlyArray<unknown>) => any;
14
13
  handleChange(changed: Partial<PerseusCSProgramWidgetOptions>): void;
15
14
  _handleProgramIDChange: (arg1: string) => void;
@@ -1,11 +1,8 @@
1
1
  import * as React from "react";
2
2
  import type { InitializeWidgetOptionsParams } from "../../editor";
3
- import type { APIOptionsWithDefaults } from "@khanacademy/perseus";
3
+ import type { WidgetEditorProps } from "../widget-editor-props";
4
4
  import type { PerseusDefinitionWidgetOptions } from "@khanacademy/perseus-core";
5
- interface Props extends PerseusDefinitionWidgetOptions {
6
- apiOptions?: APIOptionsWithDefaults;
7
- onChange: (options: PerseusDefinitionWidgetOptions) => void;
8
- }
5
+ type Props = WidgetEditorProps<PerseusDefinitionWidgetOptions>;
9
6
  /**
10
7
  * An editor for adding an interactive definition widget that allows content
11
8
  * editors to embed clickable terms with expandable explanations within content.
@@ -1,10 +1,7 @@
1
1
  import { type PerseusDropdownWidgetOptions } from "@khanacademy/perseus-core";
2
2
  import * as React from "react";
3
- import type { APIOptions } from "@khanacademy/perseus";
4
- interface Props extends PerseusDropdownWidgetOptions {
5
- onChange: (options: PerseusDropdownWidgetOptions) => void;
6
- apiOptions?: APIOptions;
7
- }
3
+ import type { WidgetEditorProps } from "../widget-editor-props";
4
+ type Props = WidgetEditorProps<PerseusDropdownWidgetOptions>;
8
5
  /**
9
6
  * An editor for adding a dropdown widget that allows users to select an option from a predefined list.
10
7
  */
@@ -1,10 +1,7 @@
1
1
  import * as React from "react";
2
- import type { APIOptionsWithDefaults } from "@khanacademy/perseus";
2
+ import type { WidgetEditorProps } from "../widget-editor-props";
3
3
  import type { PerseusExplanationWidgetOptions } from "@khanacademy/perseus-core";
4
- interface Props extends PerseusExplanationWidgetOptions {
5
- apiOptions?: APIOptionsWithDefaults;
6
- onChange: (options: PerseusExplanationWidgetOptions) => void;
7
- }
4
+ type Props = WidgetEditorProps<PerseusExplanationWidgetOptions>;
8
5
  /**
9
6
  * An editor for adding an explanation widget that provides supplementary information to users.
10
7
  */
@@ -1,12 +1,9 @@
1
1
  import { PerseusExpressionAnswerFormConsidered } from "@khanacademy/perseus-core";
2
2
  import * as React from "react";
3
- import type { APIOptions } from "@khanacademy/perseus";
3
+ import type { WidgetEditorProps } from "../widget-editor-props";
4
4
  import type { PerseusExpressionWidgetOptions, LegacyButtonSets, PerseusExpressionAnswerForm, PerseusExpressionUserInput } from "@khanacademy/perseus-core";
5
5
  type EditableExpressionWidgetOptions = Omit<PerseusExpressionWidgetOptions, "buttonsVisible">;
6
- type Props = {
7
- apiOptions: APIOptions;
8
- onChange: (newValues: EditableExpressionWidgetOptions) => void;
9
- } & EditableExpressionWidgetOptions;
6
+ type Props = WidgetEditorProps<EditableExpressionWidgetOptions>;
10
7
  type AnswerForm = PerseusExpressionWidgetOptions["answerForms"][number];
11
8
  interface State {
12
9
  functionsInternal: string;
@@ -1,6 +1,10 @@
1
1
  import * as React from "react";
2
- import type { APIOptionsWithDefaults } from "@khanacademy/perseus";
2
+ import type { APIOptions } from "@khanacademy/perseus";
3
3
  import type { PerseusFillInTheBlankWidgetOptions } from "@khanacademy/perseus-core";
4
+ interface Props extends PerseusFillInTheBlankWidgetOptions {
5
+ onChange: (options: PerseusFillInTheBlankWidgetOptions) => void;
6
+ apiOptions?: APIOptions;
7
+ }
4
8
  /**
5
9
  * Imperative API that WidgetEditor calls
6
10
  */
@@ -8,10 +12,7 @@ type FillInTheBlankEditorHandle = {
8
12
  serialize: () => PerseusFillInTheBlankWidgetOptions;
9
13
  getSaveWarnings: () => string[];
10
14
  };
11
- declare const _default: React.ForwardRefExoticComponent<PerseusFillInTheBlankWidgetOptions & {
12
- onChange: (newOptions: PerseusFillInTheBlankWidgetOptions) => void;
13
- apiOptions?: APIOptionsWithDefaults;
14
- } & React.RefAttributes<FillInTheBlankEditorHandle>> & {
15
+ declare const _default: React.ForwardRefExoticComponent<Props & React.RefAttributes<FillInTheBlankEditorHandle>> & {
15
16
  defaultProps: PerseusFillInTheBlankWidgetOptions;
16
17
  };
17
18
  export default _default;
@@ -1,10 +1,7 @@
1
1
  import * as React from "react";
2
- import type { APIOptions } from "@khanacademy/perseus";
2
+ import type { WidgetEditorProps } from "../widget-editor-props";
3
3
  import type { PerseusFreeResponseWidgetOptions, PerseusFreeResponseWidgetScoringCriterion } from "@khanacademy/perseus-core";
4
- type Props = PerseusFreeResponseWidgetOptions & {
5
- apiOptions: APIOptions;
6
- onChange: (options: PerseusFreeResponseWidgetOptions) => void;
7
- };
4
+ type Props = WidgetEditorProps<PerseusFreeResponseWidgetOptions>;
8
5
  /**
9
6
  * An editor for adding a free response widget that allows users to enter open-ended text answers.
10
7
  */
@@ -1,11 +1,8 @@
1
1
  import * as React from "react";
2
2
  import Editor from "../../editor";
3
- import type { APIOptionsWithDefaults } from "@khanacademy/perseus";
3
+ import type { WidgetEditorProps } from "../widget-editor-props";
4
4
  import type { PerseusGradedGroupWidgetOptions } from "@khanacademy/perseus-core";
5
- interface Props extends PerseusGradedGroupWidgetOptions {
6
- apiOptions?: APIOptionsWithDefaults;
7
- onChange: (options: PerseusGradedGroupWidgetOptions) => void;
8
- }
5
+ type Props = WidgetEditorProps<PerseusGradedGroupWidgetOptions>;
9
6
  declare class GradedGroupEditor extends React.Component<Props> {
10
7
  static defaultProps: PerseusGradedGroupWidgetOptions;
11
8
  editor: React.RefObject<Editor>;
@@ -1,11 +1,8 @@
1
1
  import * as React from "react";
2
2
  import GradedGroupEditor from "../graded-group-editor";
3
- import type { APIOptionsWithDefaults } from "@khanacademy/perseus";
3
+ import type { WidgetEditorProps } from "../widget-editor-props";
4
4
  import type { PerseusGradedGroupSetWidgetOptions } from "@khanacademy/perseus-core";
5
- interface Props extends PerseusGradedGroupSetWidgetOptions {
6
- apiOptions?: APIOptionsWithDefaults;
7
- onChange: (options: PerseusGradedGroupSetWidgetOptions) => void;
8
- }
5
+ type Props = WidgetEditorProps<PerseusGradedGroupSetWidgetOptions>;
9
6
  declare class GradedGroupSetEditor extends React.Component<Props> {
10
7
  _editors: Array<GradedGroupEditor | null>;
11
8
  static defaultProps: PerseusGradedGroupSetWidgetOptions;
@@ -1,10 +1,7 @@
1
1
  import * as React from "react";
2
- import type { APIOptionsWithDefaults } from "@khanacademy/perseus";
2
+ import type { WidgetEditorProps } from "../widget-editor-props";
3
3
  import type { PerseusGrapherWidgetOptions, GrapherFunctionType } from "@khanacademy/perseus-core";
4
- interface Props extends PerseusGrapherWidgetOptions {
5
- onChange: (options: PerseusGrapherWidgetOptions) => void;
6
- apiOptions: APIOptionsWithDefaults;
7
- }
4
+ type Props = WidgetEditorProps<PerseusGrapherWidgetOptions>;
8
5
  declare class GrapherEditor extends React.Component<Props> {
9
6
  static defaultProps: PerseusGrapherWidgetOptions;
10
7
  handleChange(changes: Partial<PerseusGrapherWidgetOptions>): void;
@@ -1,11 +1,8 @@
1
1
  import * as React from "react";
2
2
  import Editor from "../../editor";
3
- import type { APIOptionsWithDefaults } from "@khanacademy/perseus";
3
+ import type { WidgetEditorProps } from "../widget-editor-props";
4
4
  import type { PerseusGroupWidgetOptions, PerseusRenderer } from "@khanacademy/perseus-core";
5
- interface Props extends PerseusGroupWidgetOptions {
6
- onChange: (options: PerseusGroupWidgetOptions) => void;
7
- apiOptions: APIOptionsWithDefaults;
8
- }
5
+ type Props = WidgetEditorProps<PerseusGroupWidgetOptions>;
9
6
  declare class GroupEditor extends React.Component<Props> {
10
7
  static defaultProps: PerseusGroupWidgetOptions;
11
8
  editor: React.RefObject<Editor>;
@@ -1,8 +1,7 @@
1
1
  import { type PerseusIFrameWidgetOptions } from "@khanacademy/perseus-core";
2
2
  import * as React from "react";
3
- interface IframeEditorProps extends PerseusIFrameWidgetOptions {
4
- onChange: (options: PerseusIFrameWidgetOptions) => void;
5
- }
3
+ import type { WidgetEditorProps } from "../widget-editor-props";
4
+ type IframeEditorProps = WidgetEditorProps<PerseusIFrameWidgetOptions>;
6
5
  /**
7
6
  * This is the main editor for this widget, to specify all the options.
8
7
  */
@@ -1,10 +1,7 @@
1
1
  import { type PerseusImageWidgetOptions } from "@khanacademy/perseus-core";
2
2
  import * as React from "react";
3
- import type { APIOptions } from "@khanacademy/perseus";
4
- interface Props extends PerseusImageWidgetOptions {
5
- apiOptions: APIOptions;
6
- onChange: (options: PerseusImageWidgetOptions) => void;
7
- }
3
+ import type { WidgetEditorProps } from "../widget-editor-props";
4
+ type Props = WidgetEditorProps<PerseusImageWidgetOptions>;
8
5
  /**
9
6
  * An editor for adding an image widget that allows users to display and configure images within content.
10
7
  */
@@ -7,7 +7,7 @@ type Props = {
7
7
  declare class ColorPicker extends React.Component<Props> {
8
8
  static defaultProps: {
9
9
  lightColors: boolean;
10
- value: any;
10
+ value: string;
11
11
  };
12
12
  render(): React.ReactNode;
13
13
  }
@@ -1,8 +1,7 @@
1
1
  import * as React from "react";
2
+ import type { WidgetEditorProps } from "../widget-editor-props";
2
3
  import type { PerseusInteractionWidgetOptions, PerseusInteractionElement } from "@khanacademy/perseus-core";
3
- interface Props extends PerseusInteractionWidgetOptions {
4
- onChange: (options: PerseusInteractionWidgetOptions) => void;
5
- }
4
+ type Props = WidgetEditorProps<PerseusInteractionWidgetOptions>;
6
5
  type State = any;
7
6
  /**
8
7
  * An editor for the interaction widget that allows users to engage with interactive content.
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import type { InteractiveGraphSettingsData } from "./components/interactive-graph-settings";
3
- import type { APIOptionsWithDefaults } from "@khanacademy/perseus";
3
+ import type { WidgetEditorProps } from "../widget-editor-props";
4
4
  import type { PerseusInteractiveGraphWidgetOptions, PerseusGraphType } from "@khanacademy/perseus-core";
5
5
  interface State {
6
6
  /**
@@ -9,11 +9,7 @@ interface State {
9
9
  */
10
10
  valid: true | string;
11
11
  }
12
- export interface Props extends PerseusInteractiveGraphWidgetOptions {
13
- apiOptions: APIOptionsWithDefaults;
14
- onChange: (options: PerseusInteractiveGraphWidgetOptions) => void;
15
- static?: boolean;
16
- }
12
+ export type Props = WidgetEditorProps<PerseusInteractiveGraphWidgetOptions>;
17
13
  /**
18
14
  * An editor for the InteractiveGraph widget, which allows the user to
19
15
  * specify the graph's properties and the correct answer.
@@ -1,10 +1,7 @@
1
1
  import * as React from "react";
2
- import type { APIOptions } from "@khanacademy/perseus";
2
+ import type { WidgetEditorProps } from "../widget-editor-props";
3
3
  import type { PerseusLabelImageWidgetOptions } from "@khanacademy/perseus-core";
4
- export interface Props extends PerseusLabelImageWidgetOptions {
5
- apiOptions: APIOptions;
6
- onChange: (options: PerseusLabelImageWidgetOptions) => void;
7
- }
4
+ export type Props = WidgetEditorProps<PerseusLabelImageWidgetOptions>;
8
5
  /**
9
6
  * Direct image labeling widget editor.
10
7
  *
@@ -1,8 +1,7 @@
1
1
  import { type PerseusMatcherWidgetOptions } from "@khanacademy/perseus-core";
2
2
  import * as React from "react";
3
- interface Props extends PerseusMatcherWidgetOptions {
4
- onChange: (options: PerseusMatcherWidgetOptions) => void;
5
- }
3
+ import type { WidgetEditorProps } from "../widget-editor-props";
4
+ type Props = WidgetEditorProps<PerseusMatcherWidgetOptions>;
6
5
  /**
7
6
  * An editor for adding a matcher widget that allows users to match items from two different sets.
8
7
  */
@@ -1,10 +1,7 @@
1
1
  import * as React from "react";
2
- import type { APIOptionsWithDefaults } from "@khanacademy/perseus";
2
+ import type { WidgetEditorProps } from "../widget-editor-props";
3
3
  import type { PerseusMatrixWidgetOptions } from "@khanacademy/perseus-core";
4
- interface Props extends PerseusMatrixWidgetOptions {
5
- apiOptions: APIOptionsWithDefaults;
6
- onChange: (options: PerseusMatrixWidgetOptions) => void;
7
- }
4
+ type Props = WidgetEditorProps<PerseusMatrixWidgetOptions>;
8
5
  declare class MatrixEditor extends React.Component<Props> {
9
6
  static defaultProps: PerseusMatrixWidgetOptions;
10
7
  handleChange(changes: Partial<PerseusMatrixWidgetOptions>): void;
@@ -1,8 +1,7 @@
1
1
  import * as React from "react";
2
+ import type { WidgetEditorProps } from "../widget-editor-props";
2
3
  import type { PerseusMeasurerWidgetOptions } from "@khanacademy/perseus-core";
3
- interface Props extends PerseusMeasurerWidgetOptions {
4
- onChange: (options: PerseusMeasurerWidgetOptions) => void;
5
- }
4
+ type Props = WidgetEditorProps<PerseusMeasurerWidgetOptions>;
6
5
  declare class MeasurerEditor extends React.Component<Props> {
7
6
  static defaultProps: PerseusMeasurerWidgetOptions;
8
7
  className: string;
@@ -1,9 +1,7 @@
1
1
  import * as React from "react";
2
+ import type { WidgetEditorProps } from "../widget-editor-props";
2
3
  import type { PerseusNumberLineWidgetOptions, MathFormat } from "@khanacademy/perseus-core";
3
- interface Props extends PerseusNumberLineWidgetOptions {
4
- static?: boolean;
5
- onChange: (options: PerseusNumberLineWidgetOptions) => void;
6
- }
4
+ type Props = WidgetEditorProps<PerseusNumberLineWidgetOptions>;
7
5
  /**
8
6
  * An editor for adding a number line widget that allows users to mark
9
7
  * positions, intervals, and points on a number line.
@@ -1,10 +1,7 @@
1
1
  import { type PerseusNumericInputWidgetOptions } from "@khanacademy/perseus-core";
2
2
  import * as React from "react";
3
- import type { APIOptionsWithDefaults } from "@khanacademy/perseus";
4
- interface Props extends PerseusNumericInputWidgetOptions {
5
- onChange: (options: PerseusNumericInputWidgetOptions) => void;
6
- apiOptions: APIOptionsWithDefaults;
7
- }
3
+ import type { WidgetEditorProps } from "../widget-editor-props";
4
+ type Props = WidgetEditorProps<PerseusNumericInputWidgetOptions>;
8
5
  interface State {
9
6
  lastStatus: string;
10
7
  showAnswerDetails: boolean[];
@@ -1,8 +1,7 @@
1
1
  import { type PerseusOrdererWidgetOptions } from "@khanacademy/perseus-core";
2
2
  import * as React from "react";
3
- interface Props extends PerseusOrdererWidgetOptions {
4
- onChange: (options: PerseusOrdererWidgetOptions) => void;
5
- }
3
+ import type { WidgetEditorProps } from "../widget-editor-props";
4
+ type Props = WidgetEditorProps<PerseusOrdererWidgetOptions>;
6
5
  declare class OrdererEditor extends React.Component<Props> {
7
6
  static defaultProps: PerseusOrdererWidgetOptions;
8
7
  handleChange(changes: Partial<PerseusOrdererWidgetOptions>): void;
@@ -1,8 +1,7 @@
1
1
  import { type PerseusPhetSimulationWidgetOptions } from "@khanacademy/perseus-core";
2
2
  import * as React from "react";
3
- interface Props extends PerseusPhetSimulationWidgetOptions {
4
- onChange: (options: PerseusPhetSimulationWidgetOptions) => void;
5
- }
3
+ import type { WidgetEditorProps } from "../widget-editor-props";
4
+ type Props = WidgetEditorProps<PerseusPhetSimulationWidgetOptions>;
6
5
  /**
7
6
  * An editor for adding a PhET simulation widget that allows users to interact
8
7
  * with physics simulations.
@@ -1,13 +1,9 @@
1
1
  import * as React from "react";
2
- import type { APIOptions } from "@khanacademy/perseus";
2
+ import type { WidgetEditorProps } from "../widget-editor-props";
3
3
  import type { PerseusPlotterWidgetOptions } from "@khanacademy/perseus-core";
4
4
  declare const editingStates: string[];
5
5
  type EditingState = (typeof editingStates)[number];
6
- interface Props extends PerseusPlotterWidgetOptions {
7
- apiOptions: APIOptions;
8
- static: boolean;
9
- onChange: (options: PerseusPlotterWidgetOptions) => void;
10
- }
6
+ type Props = WidgetEditorProps<PerseusPlotterWidgetOptions>;
11
7
  type State = {
12
8
  editing: EditingState;
13
9
  pic: any;
@@ -1,8 +1,7 @@
1
1
  import * as React from "react";
2
+ import type { WidgetEditorProps } from "../widget-editor-props";
2
3
  import type { PerseusPythonProgramWidgetOptions } from "@khanacademy/perseus-core";
3
- interface Props extends PerseusPythonProgramWidgetOptions {
4
- onChange: (options: PerseusPythonProgramWidgetOptions) => void;
5
- }
4
+ type Props = WidgetEditorProps<PerseusPythonProgramWidgetOptions>;
6
5
  export declare function validateOptions(height: Props["height"], programID: Props["programID"]): ReadonlyArray<string>;
7
6
  /**
8
7
  * An editor for adding a Python program widget that allows users to write, edit and execute Python code.
@@ -1,18 +1,9 @@
1
1
  import * as React from "react";
2
2
  import type { RadioOptionSettingsHandle } from "./radio-option-settings";
3
3
  import type { ChoiceMovementType } from "./radio-option-settings-actions";
4
- import type { APIOptions } from "@khanacademy/perseus";
5
- import type { PerseusRadioWidgetOptions, PerseusRadioChoice } from "@khanacademy/perseus-core";
6
- export interface RadioEditorProps {
7
- apiOptions: APIOptions;
8
- countChoices: boolean;
9
- choices: PerseusRadioChoice[];
10
- randomize: boolean;
11
- hasNoneOfTheAbove: boolean;
12
- multipleSelect: boolean;
13
- deselectEnabled: boolean;
14
- onChange: (values: Partial<PerseusRadioWidgetOptions>, callback?: (() => void) | null) => void;
15
- }
4
+ import type { WidgetEditorProps } from "../widget-editor-props";
5
+ import type { PerseusRadioWidgetOptions } from "@khanacademy/perseus-core";
6
+ export type RadioEditorProps = WidgetEditorProps<PerseusRadioWidgetOptions>;
16
7
  /**
17
8
  * An editor for adding a radio widget that allows users to select a single option from multiple choices.
18
9
  */
@@ -24,6 +15,7 @@ declare class RadioEditor extends React.Component<RadioEditorProps> {
24
15
  static defaultProps: PerseusRadioWidgetOptions;
25
16
  choiceRefs: Map<string, React.RefObject<RadioOptionSettingsHandle>>;
26
17
  componentDidMount(): void;
18
+ handleChange(changes: Partial<PerseusRadioWidgetOptions>): void;
27
19
  getChoiceRef: (choiceId: string) => React.RefObject<RadioOptionSettingsHandle>;
28
20
  onMultipleSelectChange: (options: {
29
21
  multipleSelect: boolean;
@@ -1,5 +1,8 @@
1
1
  import { type PerseusSorterWidgetOptions } from "@khanacademy/perseus-core";
2
2
  import * as React from "react";
3
+ interface Props extends PerseusSorterWidgetOptions {
4
+ onChange: (options: PerseusSorterWidgetOptions) => void;
5
+ }
3
6
  /**
4
7
  * Imperative API that WidgetEditor calls
5
8
  */
@@ -7,9 +10,7 @@ type SorterEditorHandle = {
7
10
  serialize: () => PerseusSorterWidgetOptions;
8
11
  getSaveWarnings: () => string[];
9
12
  };
10
- declare const _default: React.ForwardRefExoticComponent<PerseusSorterWidgetOptions & {
11
- onChange: (newOptions: Partial<PerseusSorterWidgetOptions>, callback?: () => void) => void;
12
- } & React.RefAttributes<SorterEditorHandle>> & {
13
+ declare const _default: React.ForwardRefExoticComponent<Props & React.RefAttributes<SorterEditorHandle>> & {
13
14
  defaultProps: PerseusSorterWidgetOptions;
14
15
  };
15
16
  export default _default;
@@ -1,14 +1,12 @@
1
1
  import { components } from "@khanacademy/perseus";
2
2
  import { type PerseusTableWidgetOptions } from "@khanacademy/perseus-core";
3
3
  import * as React from "react";
4
- import type { APIOptionsWithDefaults } from "@khanacademy/perseus";
5
- interface Props extends PerseusTableWidgetOptions {
6
- onChange: (options: Partial<PerseusTableWidgetOptions>) => void;
7
- apiOptions?: APIOptionsWithDefaults;
8
- }
4
+ import type { WidgetEditorProps } from "../widget-editor-props";
5
+ type Props = WidgetEditorProps<PerseusTableWidgetOptions>;
9
6
  declare class TableEditor extends React.Component<Props> {
10
7
  static defaultProps: PerseusTableWidgetOptions;
11
8
  numberOfColumns: React.RefObject<components.NumberInput>;
9
+ handleChange: (changes: Partial<PerseusTableWidgetOptions>) => void;
12
10
  focus: () => void;
13
11
  onSizeInput: (arg1: number, arg2: number) => void;
14
12
  serialize: () => any;
@@ -1,8 +1,7 @@
1
1
  import { type PerseusVideoWidgetOptions } from "@khanacademy/perseus-core";
2
2
  import * as React from "react";
3
- export interface VideoEditorProps extends PerseusVideoWidgetOptions {
4
- onChange: (options: PerseusVideoWidgetOptions) => void;
5
- }
3
+ import type { WidgetEditorProps } from "../widget-editor-props";
4
+ export type VideoEditorProps = WidgetEditorProps<PerseusVideoWidgetOptions>;
6
5
  /**
7
6
  * This is the main editor for this widget, to specify all the options.
8
7
  */
@@ -0,0 +1,6 @@
1
+ import type { APIOptions } from "@khanacademy/perseus";
2
+ export type WidgetEditorProps<TOptions> = TOptions & {
3
+ apiOptions?: APIOptions;
4
+ static?: boolean;
5
+ onChange: (options: TOptions) => void;
6
+ };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Perseus editors",
4
4
  "author": "Khan Academy",
5
5
  "license": "MIT",
6
- "version": "45.0.1",
6
+ "version": "45.0.3",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -25,12 +25,12 @@
25
25
  ],
26
26
  "dependencies": {
27
27
  "@khanacademy/kas": "3.0.2",
28
- "@khanacademy/keypad-context": "6.0.7",
29
- "@khanacademy/kmath": "3.1.0",
30
- "@khanacademy/math-input": "30.1.2",
31
- "@khanacademy/perseus": "92.0.1",
32
- "@khanacademy/perseus-core": "42.0.0",
33
- "@khanacademy/perseus-linter": "6.1.5",
28
+ "@khanacademy/keypad-context": "6.0.8",
29
+ "@khanacademy/kmath": "3.1.1",
30
+ "@khanacademy/math-input": "30.1.3",
31
+ "@khanacademy/perseus": "92.1.0",
32
+ "@khanacademy/perseus-core": "42.0.1",
33
+ "@khanacademy/perseus-linter": "6.2.0",
34
34
  "@khanacademy/perseus-utils": "3.0.1",
35
35
  "axe-core": "^4.11.0",
36
36
  "katex": "0.11.1",