@khanacademy/perseus-editor 6.3.0 → 6.5.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.
@@ -2,7 +2,6 @@
2
2
  import type { LockedFigureColor } from "@khanacademy/perseus";
3
3
  import type { StyleType } from "@khanacademy/wonder-blocks-core";
4
4
  type Props = {
5
- id: string;
6
5
  selectedValue: LockedFigureColor;
7
6
  style?: StyleType;
8
7
  onChange: (newValue: string) => void;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import type { LockedPointType } from "@khanacademy/perseus";
3
+ type Props = {
4
+ coord: [number, number];
5
+ error?: boolean;
6
+ onChangeProps: (newProps: Partial<LockedPointType>) => void;
7
+ };
8
+ declare const CoordinatePairInput: (props: Props) => JSX.Element;
9
+ export default CoordinatePairInput;
@@ -0,0 +1,28 @@
1
+ /// <reference types="react" />
2
+ import type { AccordionProps } from "./locked-figure-settings";
3
+ import type { LockedPointType } from "@khanacademy/perseus";
4
+ export type Props = AccordionProps & LockedPointType & {
5
+ /**
6
+ * Optional label for the point to display in the header summary.
7
+ * Defaults to "Point".
8
+ */
9
+ label: string;
10
+ /**
11
+ * Whether the extra point settings are toggled open.
12
+ */
13
+ showPoint?: boolean;
14
+ /**
15
+ * Optional error message to display.
16
+ */
17
+ error?: string | null;
18
+ /**
19
+ * Called when the extra settings toggle switch is changed.
20
+ */
21
+ onTogglePoint?: (newValue: any) => void;
22
+ /**
23
+ * Called when the props (coords, color, etc.) are updated.
24
+ */
25
+ onChangeProps: (newProps: Partial<LockedPointType>) => void;
26
+ };
27
+ declare const DefiningPointSettings: (props: Props) => JSX.Element;
28
+ export default DefiningPointSettings;
@@ -66,6 +66,7 @@ type Props = {
66
66
  onChange: (arg1: Partial<Props>) => void;
67
67
  };
68
68
  type State = {
69
+ isExpanded: boolean;
69
70
  labelsTextbox: ReadonlyArray<string>;
70
71
  gridStepTextbox: [x: number, y: number];
71
72
  snapStepTextbox: [x: number, y: number];
@@ -78,13 +79,21 @@ declare class InteractiveGraphSettings extends React.Component<Props, State> {
78
79
  bgUrlRef: React.RefObject<HTMLInputElement>;
79
80
  labelXRef: React.RefObject<HTMLInputElement>;
80
81
  labelYRef: React.RefObject<HTMLInputElement>;
81
- static stateFromProps(props: any): {
82
- labelsTextbox: any;
83
- gridStepTextbox: any;
84
- snapStepTextbox: any;
85
- stepTextbox: any;
86
- rangeTextbox: any;
87
- backgroundImage: any;
82
+ static stateFromProps(props: Props): {
83
+ labelsTextbox: readonly string[];
84
+ gridStepTextbox: [x: number, y: number];
85
+ snapStepTextbox: [x: number, y: number];
86
+ stepTextbox: [x: number, y: number];
87
+ rangeTextbox: [x: Range, y: Range];
88
+ backgroundImage: {
89
+ url: string | null | undefined;
90
+ width?: number | undefined;
91
+ height?: number | undefined;
92
+ top?: number | undefined;
93
+ left?: number | undefined;
94
+ scale?: string | number | undefined;
95
+ bottom?: number | undefined;
96
+ };
88
97
  };
89
98
  constructor(props: Props);
90
99
  static defaultProps: {
@@ -3,8 +3,10 @@ import type { StyleType } from "@khanacademy/wonder-blocks-core";
3
3
  type Props = {
4
4
  children: React.ReactNode | React.ReactNode[];
5
5
  header: string | React.ReactElement;
6
+ expanded?: boolean;
6
7
  containerStyle?: StyleType;
7
8
  panelStyle?: StyleType;
9
+ onToggle?: (expanded: boolean) => void;
8
10
  };
9
11
  declare const LockedFigureSettingsAccordion: (props: Props) => JSX.Element;
10
12
  export default LockedFigureSettingsAccordion;
@@ -7,6 +7,16 @@
7
7
  /// <reference types="react" />
8
8
  import type { Props as LockedLineProps } from "./locked-line-settings";
9
9
  import type { Props as LockedPointProps } from "./locked-point-settings";
10
- type Props = LockedPointProps | LockedLineProps;
10
+ export type AccordionProps = {
11
+ /**
12
+ * Whether this accordion is expanded.
13
+ */
14
+ expanded?: boolean;
15
+ /**
16
+ * Called when the accordion is expanded or collapsed.
17
+ */
18
+ onToggle?: (expanded: boolean) => void;
19
+ };
20
+ type Props = AccordionProps & (LockedPointProps | LockedLineProps);
11
21
  declare const LockedFigureSettings: (props: Props) => JSX.Element | null;
12
22
  export default LockedFigureSettings;
@@ -1,7 +1,14 @@
1
1
  /// <reference types="react" />
2
+ import type { AccordionProps } from "./locked-figure-settings";
2
3
  import type { LockedFigure, LockedLineType } from "@khanacademy/perseus";
3
- export type Props = LockedLineType & {
4
+ export type Props = LockedLineType & AccordionProps & {
5
+ /**
6
+ * Called when the delete button is pressed.
7
+ */
4
8
  onRemove: () => void;
9
+ /**
10
+ * Called when the props (points, color, etc.) are updated.
11
+ */
5
12
  onChangeProps: (newProps: Partial<LockedFigure>) => void;
6
13
  };
7
14
  declare const LockedLineSettings: (props: Props) => JSX.Element;
@@ -1,12 +1,14 @@
1
1
  /// <reference types="react" />
2
+ import type { AccordionProps } from "./locked-figure-settings";
2
3
  import type { LockedPointType } from "@khanacademy/perseus";
3
- import type { StyleType } from "@khanacademy/wonder-blocks-core";
4
- export type Props = LockedPointType & {
5
- label?: string;
6
- toggled?: boolean;
7
- style?: StyleType;
8
- onRemove?: () => void;
9
- onToggle?: (newValue: any) => void;
4
+ export type Props = AccordionProps & LockedPointType & {
5
+ /**
6
+ * Called when the delete button is pressed.
7
+ */
8
+ onRemove: () => void;
9
+ /**
10
+ * Called when the props (coords, color, etc.) are updated.
11
+ */
10
12
  onChangeProps: (newProps: Partial<LockedPointType>) => void;
11
13
  };
12
14
  declare const LockedPointSettings: (props: Props) => JSX.Element;
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ type Props = {
3
+ isExpanded: boolean;
4
+ };
5
+ /**
6
+ * Displays a caret in either expanded or collapsed state. For use in headings
7
+ * that collapse a region.
8
+ */
9
+ declare function ToggleableCaret(props: Props): JSX.Element;
10
+ export default ToggleableCaret;