@khanacademy/perseus 26.0.0 → 26.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.
@@ -61,6 +61,13 @@ type Props = Partial<React.ContextType<typeof DependenciesContext>> & {
61
61
  problemNum?: number;
62
62
  questionCompleted?: boolean;
63
63
  reviewMode?: boolean | null | undefined;
64
+ /**
65
+ * Some widgets (e.g. InteractiveGraph) support "hint mode", a state where
66
+ * the widget is non-editable, may have a partial solution filled in,
67
+ * and may have special styling. Setting hintMode to true will turn on hint
68
+ * mode for all rendered widgets.
69
+ */
70
+ hintMode?: boolean;
64
71
  /**
65
72
  * If set to "all", all rationales or solutions will be shown. If set to
66
73
  * "selected", soltions will only be shown for selected choices. If set to
@@ -100,7 +107,7 @@ type State = {
100
107
  jiptContent: any;
101
108
  lastUsedWidgetId: string | null | undefined;
102
109
  };
103
- type DefaultProps = Required<Pick<Props, "alwaysUpdate" | "content" | "findExternalWidgets" | "highlightedWidgets" | "images" | "linterContext" | "onInteractWithWidget" | "onRender" | "onSerializedStateUpdated" | "questionCompleted" | "showSolutions" | "reviewMode" | "serializedState" | "widgets">>;
110
+ type DefaultProps = Required<Pick<Props, "alwaysUpdate" | "content" | "findExternalWidgets" | "highlightedWidgets" | "images" | "linterContext" | "onInteractWithWidget" | "onRender" | "onSerializedStateUpdated" | "questionCompleted" | "showSolutions" | "reviewMode" | "hintMode" | "serializedState" | "widgets">>;
104
111
  declare class Renderer extends React.Component<Props, State> {
105
112
  _currentFocus: FocusPath | null | undefined;
106
113
  _foundTextNodes: boolean;
package/dist/types.d.ts CHANGED
@@ -373,6 +373,7 @@ export type WidgetProps<RenderProps, Rubric, TrackingExtraArgs = Empty> = Render
373
373
  onBlur: (blurPath: FocusPath) => void;
374
374
  findWidgets: (arg1: FilterCriterion) => ReadonlyArray<Widget>;
375
375
  reviewModeRubric: Rubric;
376
+ hintMode: boolean;
376
377
  onChange: ChangeHandler;
377
378
  trackInteraction: (extraData?: TrackingExtraArgs) => void;
378
379
  isLastUsedWidget: boolean;
@@ -19,7 +19,7 @@ type State = {
19
19
  declare class WidgetContainer extends React.Component<Props, State> {
20
20
  widgetRef: React.RefObject<React.ComponentType<any>>;
21
21
  static defaultProps: DefaultProps;
22
- state: any;
22
+ state: State;
23
23
  componentDidMount(): void;
24
24
  render(): React.ReactNode;
25
25
  UNSAFE_componentWillReceiveProps(nextProps: Props): void;
@@ -175,6 +175,7 @@ declare const _default: Readonly<{
175
175
  onBlur: (blurPath: import("../types").FocusPath) => void;
176
176
  findWidgets: (arg1: import("../types").FilterCriterion) => readonly any[];
177
177
  reviewModeRubric: PerseusExpressionWidgetOptions;
178
+ hintMode: boolean;
178
179
  onChange: import("../types").ChangeHandler;
179
180
  trackInteraction: (extraData?: Empty | undefined) => void;
180
181
  isLastUsedWidget: boolean;
@@ -257,7 +258,7 @@ declare const _default: Readonly<{
257
258
  onFocus: (blurPath: import("../types").FocusPath) => void;
258
259
  times: boolean;
259
260
  value: string;
260
- }, "analytics" | "onChange" | "buttonsVisible" | "static" | "containerSizeClass" | "widgetId" | "problemNum" | "questionCompleted" | "findWidgets" | "trackInteraction" | "keypadElement" | "keypadConfiguration" | "alignment" | "reviewModeRubric" | "isLastUsedWidget"> & {
261
+ }, "analytics" | "onChange" | "buttonsVisible" | "static" | "containerSizeClass" | "widgetId" | "problemNum" | "questionCompleted" | "findWidgets" | "hintMode" | "trackInteraction" | "keypadElement" | "keypadConfiguration" | "alignment" | "reviewModeRubric" | "isLastUsedWidget"> & {
261
262
  value?: string | undefined;
262
263
  buttonSets?: import("../perseus-types").LegacyButtonSets | undefined;
263
264
  onFocus?: ((blurPath: import("../types").FocusPath) => void) | undefined;
@@ -415,6 +416,7 @@ declare const _default: Readonly<{
415
416
  onBlur: (blurPath: import("../types").FocusPath) => void;
416
417
  findWidgets: (arg1: import("../types").FilterCriterion) => readonly any[];
417
418
  reviewModeRubric: PerseusExpressionWidgetOptions;
419
+ hintMode: boolean;
418
420
  onChange: import("../types").ChangeHandler;
419
421
  trackInteraction: (extraData?: Empty | undefined) => void;
420
422
  isLastUsedWidget: boolean;
@@ -497,7 +499,7 @@ declare const _default: Readonly<{
497
499
  onFocus: (blurPath: import("../types").FocusPath) => void;
498
500
  times: boolean;
499
501
  value: string;
500
- }, "analytics" | "onChange" | "buttonsVisible" | "static" | "containerSizeClass" | "widgetId" | "problemNum" | "questionCompleted" | "findWidgets" | "trackInteraction" | "keypadElement" | "keypadConfiguration" | "alignment" | "reviewModeRubric" | "isLastUsedWidget"> & {
502
+ }, "analytics" | "onChange" | "buttonsVisible" | "static" | "containerSizeClass" | "widgetId" | "problemNum" | "questionCompleted" | "findWidgets" | "hintMode" | "trackInteraction" | "keypadElement" | "keypadConfiguration" | "alignment" | "reviewModeRubric" | "isLastUsedWidget"> & {
501
503
  value?: string | undefined;
502
504
  buttonSets?: import("../perseus-types").LegacyButtonSets | undefined;
503
505
  onFocus?: ((blurPath: import("../types").FocusPath) => void) | undefined;
@@ -16,5 +16,6 @@ export type MafsGraphProps = {
16
16
  labels: InteractiveGraphProps["labels"];
17
17
  state: InteractiveGraphState;
18
18
  dispatch: React.Dispatch<InteractiveGraphAction>;
19
+ hintMode: boolean;
19
20
  };
20
21
  export declare const MafsGraph: (props: MafsGraphProps) => React.JSX.Element;
@@ -17,5 +17,6 @@ export type StatefulMafsGraphProps = {
17
17
  showTooltips: Required<InteractiveGraphProps["showTooltips"]>;
18
18
  showProtractor: boolean;
19
19
  labels: InteractiveGraphProps["labels"];
20
+ hintMode: boolean;
20
21
  };
21
22
  export declare const StatefulMafsGraph: React.ForwardRefExoticComponent<StatefulMafsGraphProps & React.RefAttributes<Partial<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": "26.0.0",
6
+ "version": "26.1.0",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -41,7 +41,7 @@
41
41
  "dependencies": {
42
42
  "@khanacademy/kas": "^0.3.10",
43
43
  "@khanacademy/kmath": "^0.1.13",
44
- "@khanacademy/math-input": "^20.0.0",
44
+ "@khanacademy/math-input": "^20.0.1",
45
45
  "@khanacademy/perseus-core": "1.5.0",
46
46
  "@khanacademy/perseus-linter": "^1.0.0",
47
47
  "@khanacademy/pure-markdown": "^0.3.7",
@@ -61,7 +61,7 @@
61
61
  "@khanacademy/wonder-blocks-layout": "2.0.32",
62
62
  "@khanacademy/wonder-blocks-link": "6.1.1",
63
63
  "@khanacademy/wonder-blocks-pill": "2.2.1",
64
- "@khanacademy/wonder-blocks-popover": "3.2.2",
64
+ "@khanacademy/wonder-blocks-popover": "3.2.9",
65
65
  "@khanacademy/wonder-blocks-progress-spinner": "2.1.1",
66
66
  "@khanacademy/wonder-blocks-switch": "1.1.16",
67
67
  "@khanacademy/wonder-blocks-tokens": "1.3.0",
@@ -96,7 +96,7 @@
96
96
  "@khanacademy/wonder-blocks-layout": "2.0.32",
97
97
  "@khanacademy/wonder-blocks-link": "6.1.1",
98
98
  "@khanacademy/wonder-blocks-pill": "2.2.1",
99
- "@khanacademy/wonder-blocks-popover": "3.2.2",
99
+ "@khanacademy/wonder-blocks-popover": "3.2.9",
100
100
  "@khanacademy/wonder-blocks-progress-spinner": "2.1.1",
101
101
  "@khanacademy/wonder-blocks-switch": "1.1.16",
102
102
  "@khanacademy/wonder-blocks-tokens": "1.3.0",