@khanacademy/perseus-editor 46.1.3 → 46.1.4

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.
@@ -1,8 +1,8 @@
1
1
  import * as React from "react";
2
- import type { Alignment, PerseusWidget } from "@khanacademy/perseus-core";
2
+ import type { Alignment, PerseusWidget, SupportedAlignments } from "@khanacademy/perseus-core";
3
3
  import type { StyleType } from "@khanacademy/wonder-blocks-core";
4
4
  interface Props {
5
- supportedAlignments: ReadonlyArray<Alignment>;
5
+ supportedAlignments: SupportedAlignments;
6
6
  widgetInfo: PerseusWidget;
7
7
  isEditingDisabled: boolean;
8
8
  onChange: (newAlignment: Alignment) => void;
@@ -10,4 +10,4 @@ import type { Alignment } from "@khanacademy/perseus-core";
10
10
  * in the alignment select, they're only used as default alignments
11
11
  * within the Exercise editor.
12
12
  */
13
- export declare const alignmentInfoMap: Record<Exclude<Alignment, "default" | "inline-block" | "inline">, string>;
13
+ export declare const alignmentInfoMap: Record<Exclude<Alignment, "inline-block" | "inline">, string>;
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import "./widget-editor-settings.css";
3
- import type { Alignment, PerseusWidget } from "@khanacademy/perseus-core";
3
+ import type { Alignment, PerseusWidget, SupportedAlignments } from "@khanacademy/perseus-core";
4
4
  interface BestPracticesLink {
5
5
  url: string;
6
6
  label: string;
@@ -13,7 +13,7 @@ interface WidgetEditorSettingsProps {
13
13
  supportsGradedToggle: boolean;
14
14
  isGraded: boolean;
15
15
  onGradedChange: (value: boolean) => unknown;
16
- supportedAlignments: ReadonlyArray<Alignment>;
16
+ supportedAlignments: SupportedAlignments;
17
17
  widgetInfo: PerseusWidget;
18
18
  onAlignmentChange: (newAlignment: Alignment) => unknown;
19
19
  isEditingDisabled: boolean;
package/dist/index.js CHANGED
@@ -68,7 +68,7 @@ import bn from "@phosphor-icons/core/regular/arrow-up.svg";
68
68
  var xn = Object.defineProperty, __name = (e, t) => xn(e, "name", {
69
69
  value: t,
70
70
  configurable: !0
71
- }), Sn = "@khanacademy/perseus-editor", Cn = "46.1.3";
71
+ }), Sn = "@khanacademy/perseus-editor", Cn = "46.1.4";
72
72
  e(Sn, Cn);
73
73
  //#endregion
74
74
  //#region packages/perseus-editor/src/styles/constants.ts
@@ -629,10 +629,9 @@ function AlignmentSelect({ supportedAlignments: e, widgetInfo: t, isEditingDisab
629
629
  }),
630
630
  /* @__PURE__ */ w(TypedSingleSelect, {
631
631
  "aria-labelledby": a,
632
- selectedValue: t.alignment ?? "default",
632
+ selectedValue: t.alignment ?? e[0],
633
633
  disabled: n,
634
634
  options: {
635
- default: e.includes("default") && "default",
636
635
  block: e.includes("block") && "block",
637
636
  "inline-block": e.includes("inline-block") && "inline-block",
638
637
  inline: e.includes("inline") && "inline",
@@ -735,8 +734,11 @@ var WidgetEditorContainer = class extends S.Component {
735
734
  return je(this.props.widgetInfo);
736
735
  }
737
736
  render() {
738
- let e = this.getWidgetInfo(), t = this.props.apiOptions.editingDisabled ?? !1, n = getEditor(e.type) ?? UnsupportedWidgetEditor, r;
739
- r = this.props.apiOptions.showAlignmentOptions ? Ce.getSupportedAlignments(e.type) : ["default"];
737
+ let e = this.getWidgetInfo(), t = this.props.apiOptions.editingDisabled ?? !1, n = getEditor(e.type) ?? UnsupportedWidgetEditor, r = Ce.getSupportedAlignments(e.type);
738
+ if (!this.props.apiOptions.showAlignmentOptions) {
739
+ let [e] = r;
740
+ r = [e];
741
+ }
740
742
  let i = v.supportsStaticMode(e.type), a = v.supportsUngraded(e.type);
741
743
  return /* @__PURE__ */ T("div", {
742
744
  className: "perseus-widget-editor",