@plasmicpkgs/react-aria 0.0.55 → 0.0.56

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.
@@ -1288,13 +1288,14 @@ class ListBoxItemIdManager {
1288
1288
  }
1289
1289
  }
1290
1290
  register(id) {
1291
+ const idStr = id === void 0 ? void 0 : String(id).trim();
1291
1292
  let newId;
1292
- if (!id) {
1293
+ if (!idStr) {
1293
1294
  newId = this.generateMissingId();
1294
- } else if (this._ids.has(id)) {
1295
- newId = this.generateDuplicateId(id);
1295
+ } else if (this._ids.has(idStr)) {
1296
+ newId = this.generateDuplicateId(idStr);
1296
1297
  } else {
1297
- newId = id;
1298
+ newId = idStr;
1298
1299
  }
1299
1300
  this._ids.add(newId);
1300
1301
  this.notify();
@@ -1533,8 +1534,21 @@ function BaseListBoxItem(props) {
1533
1534
  };
1534
1535
  }, [id]);
1535
1536
  setControlContextData == null ? void 0 : setControlContextData({
1536
- // this means that a unique id was registered, different from the provided id
1537
- hasDuplicateId: !isStandalone && id !== registeredId
1537
+ idError: (() => {
1538
+ if (id === void 0) {
1539
+ return "ID must be defined";
1540
+ }
1541
+ if (typeof id !== "string") {
1542
+ return "ID must be a string";
1543
+ }
1544
+ if (!id.trim()) {
1545
+ return "ID must be defined";
1546
+ }
1547
+ if (!isStandalone && id != registeredId) {
1548
+ return "ID must be unique";
1549
+ }
1550
+ return void 0;
1551
+ })()
1538
1552
  });
1539
1553
  const listboxItem = /* @__PURE__ */ React__default.default.createElement(reactAriaComponents.ListBoxItem, __spreadValues$j({ key: registeredId, id: registeredId }, rest), ({
1540
1554
  isHovered,
@@ -1610,11 +1624,11 @@ function registerListBoxItem(loader, overrides) {
1610
1624
  props: {
1611
1625
  id: {
1612
1626
  type: "string",
1613
- description: "The id of the item",
1627
+ description: "The ID of the item",
1614
1628
  required: true,
1615
1629
  validator: (_value, _props, ctx) => {
1616
- if (ctx == null ? void 0 : ctx.hasDuplicateId) {
1617
- return "Please make sure the id is unique!";
1630
+ if (ctx == null ? void 0 : ctx.idError) {
1631
+ return ctx.idError;
1618
1632
  }
1619
1633
  return true;
1620
1634
  }