@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.
@@ -4,7 +4,7 @@ export declare class ListBoxItemIdManager {
4
4
  private readonly _observers;
5
5
  private generateDuplicateId;
6
6
  private generateMissingId;
7
- register(id?: string): string;
7
+ register(id?: unknown): string;
8
8
  unregister(id: string): void;
9
9
  subscribe(observer: Observer): void;
10
10
  notify(): void;
@@ -1280,13 +1280,14 @@ class ListBoxItemIdManager {
1280
1280
  }
1281
1281
  }
1282
1282
  register(id) {
1283
+ const idStr = id === void 0 ? void 0 : String(id).trim();
1283
1284
  let newId;
1284
- if (!id) {
1285
+ if (!idStr) {
1285
1286
  newId = this.generateMissingId();
1286
- } else if (this._ids.has(id)) {
1287
- newId = this.generateDuplicateId(id);
1287
+ } else if (this._ids.has(idStr)) {
1288
+ newId = this.generateDuplicateId(idStr);
1288
1289
  } else {
1289
- newId = id;
1290
+ newId = idStr;
1290
1291
  }
1291
1292
  this._ids.add(newId);
1292
1293
  this.notify();
@@ -1525,8 +1526,21 @@ function BaseListBoxItem(props) {
1525
1526
  };
1526
1527
  }, [id]);
1527
1528
  setControlContextData == null ? void 0 : setControlContextData({
1528
- // this means that a unique id was registered, different from the provided id
1529
- hasDuplicateId: !isStandalone && id !== registeredId
1529
+ idError: (() => {
1530
+ if (id === void 0) {
1531
+ return "ID must be defined";
1532
+ }
1533
+ if (typeof id !== "string") {
1534
+ return "ID must be a string";
1535
+ }
1536
+ if (!id.trim()) {
1537
+ return "ID must be defined";
1538
+ }
1539
+ if (!isStandalone && id != registeredId) {
1540
+ return "ID must be unique";
1541
+ }
1542
+ return void 0;
1543
+ })()
1530
1544
  });
1531
1545
  const listboxItem = /* @__PURE__ */ React.createElement(ListBoxItem, __spreadValues$j({ key: registeredId, id: registeredId }, rest), ({
1532
1546
  isHovered,
@@ -1602,11 +1616,11 @@ function registerListBoxItem(loader, overrides) {
1602
1616
  props: {
1603
1617
  id: {
1604
1618
  type: "string",
1605
- description: "The id of the item",
1619
+ description: "The ID of the item",
1606
1620
  required: true,
1607
1621
  validator: (_value, _props, ctx) => {
1608
- if (ctx == null ? void 0 : ctx.hasDuplicateId) {
1609
- return "Please make sure the id is unique!";
1622
+ if (ctx == null ? void 0 : ctx.idError) {
1623
+ return ctx.idError;
1610
1624
  }
1611
1625
  return true;
1612
1626
  }