@khanacademy/perseus 47.0.0 → 47.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/index.js CHANGED
@@ -27616,7 +27616,7 @@ class Dropdown extends React__namespace.Component {
27616
27616
  key: "placeholder",
27617
27617
  value: "0",
27618
27618
  disabled: true,
27619
- label: this.props.placeholder
27619
+ label: this.props.placeholder || " "
27620
27620
  }), ...this.props.choices.map((choice, i) => /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
27621
27621
  key: String(i + 1),
27622
27622
  value: String(i + 1),
@@ -27637,15 +27637,14 @@ class Dropdown extends React__namespace.Component {
27637
27637
  }
27638
27638
  }, this.props.visibleLabel && /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, {
27639
27639
  tag: "label",
27640
- id: ids.get("dropdown-label")
27640
+ htmlFor: ids.get("dropdown")
27641
27641
  }, this.props.visibleLabel), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
27642
27642
  id: ids.get("dropdown"),
27643
27643
  placeholder: "",
27644
27644
  onChange: value => this._handleChange(parseInt(value)),
27645
27645
  selectedValue: String(this.props.selected),
27646
27646
  disabled: this.props.apiOptions.readOnly,
27647
- "aria-label": this.props.ariaLabel || this.context.strings.selectAnAnswer,
27648
- "aria-labelledby": ids.get("dropdown-label")
27647
+ "aria-label": this.props.ariaLabel || this.props.visibleLabel || this.context.strings.selectAnAnswer
27649
27648
  // This is currently necessary for SRs to read the labels properly.
27650
27649
  // However, WB is working on a change to add the "combobox" role to
27651
27650
  // all dropdowns.
@@ -32532,11 +32531,39 @@ const LegacyGrid = _ref => {
32532
32531
  return null;
32533
32532
  };
32534
32533
 
32534
+ /**
32535
+ * The Perseus "data schema" file.
32536
+ *
32537
+ * This file, and the types in it, represents the "data schema" that Perseus
32538
+ * uses. The @khanacademy/perseus-editor package edits and produces objects
32539
+ * that conform to the types in this file. Similarly, the top-level renderers
32540
+ * in @khanacademy/perseus, consume objects that conform to these types.
32541
+ *
32542
+ * WARNING: This file should not import any types from elsewhere so that it is
32543
+ * easy to reason about changes that alter the Perseus schema. This helps
32544
+ * ensure that it is not changed accidentally when upgrading a dependant
32545
+ * package or other part of Perseus code. Note that TypeScript does type
32546
+ * checking via something called "structural typing". This means that as long
32547
+ * as the shape of a type matches, the name it goes by doesn't matter. As a
32548
+ * result, a `Coord` type that looks like this `[x: number, y: number]` is
32549
+ * _identical_, in TypeScript's eyes, to this `Vector2` type `[x: number, y:
32550
+ * number]`. Also, with tuples, the labels for each entry is ignored, so `[x:
32551
+ * number, y: number]` is compatible with `[min: number, max: number]`. The
32552
+ * labels are for humans, not TypeScript. :)
32553
+ *
32554
+ * If you make changes to types in this file, be very sure that:
32555
+ *
32556
+ * a) the changes are backwards compatible. If they are not, old data from
32557
+ * previous versions of the "schema" could become unrenderable, or worse,
32558
+ * introduce hard-to-diagnose bugs.
32559
+ * b) the parsing code (`util/parse-perseus-json/`) is updated to handle
32560
+ * the new format _as well as_ the old format.
32561
+ */
32562
+
32535
32563
  // TODO(FEI-4010): Remove `Perseus` prefix for all types here
32536
- // TODO(FEI-4011): Use types generated by https://github.com/jaredly/generate-perseus-flowtypes
32537
32564
 
32538
- // Range is replaced within this file with Interval, but it is used elsewhere
32539
- // and exported from the package, so we need to keep it around.
32565
+ // Same name as Mafs
32566
+
32540
32567
  /**
32541
32568
  * Our core set of Perseus widgets.
32542
32569
  *
@@ -32580,6 +32607,7 @@ const LegacyGrid = _ref => {
32580
32607
  *
32581
32608
  * @see {@link https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation}
32582
32609
  */
32610
+
32583
32611
  /**
32584
32612
  * A map of widget IDs to widget options. This is most often used as the type
32585
32613
  * for a set of widgets defined in a `PerseusItem` but can also be useful to
@@ -32592,6 +32620,7 @@ const LegacyGrid = _ref => {
32592
32620
  * @see {@link PerseusWidgetTypes} additional widgets can be added to this map type
32593
32621
  * by augmenting the PerseusWidgetTypes with new widget types!
32594
32622
  */
32623
+
32595
32624
  /**
32596
32625
  * A "PerseusItem" is a classic Perseus item. It is rendered by the
32597
32626
  * `ServerItemRenderer` and the layout is pre-set.
@@ -32599,10 +32628,12 @@ const LegacyGrid = _ref => {
32599
32628
  * To render more complex Perseus items, see the `Item` type in the multi item
32600
32629
  * area.
32601
32630
  */
32631
+
32602
32632
  /**
32603
32633
  * A "PerseusArticle" is an item that is meant to be rendered as an article.
32604
32634
  * This item is never scored and is rendered by the `ArticleRenderer`.
32605
32635
  */
32636
+
32606
32637
  const ItemExtras = [
32607
32638
  // The user might benefit from using a Scientific Calculator. Provided on Khan Academy when true
32608
32639
  "calculator",
@@ -45446,7 +45477,7 @@ const init = function () {
45446
45477
 
45447
45478
  // This file is processed by a Rollup plugin (replace) to inject the production
45448
45479
  const libName = "@khanacademy/perseus";
45449
- const libVersion = "47.0.0";
45480
+ const libVersion = "47.0.1";
45450
45481
  perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
45451
45482
 
45452
45483
  const apiVersion = {