@ai-matrx/associations 0.7.3 → 0.7.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.
@@ -2487,27 +2487,35 @@ function UniversalAssociationPicker(props) {
2487
2487
  ),
2488
2488
  loading && browseToken === null && /* @__PURE__ */ jsx8(SpinnerIcon, { className: "absolute right-2.5 top-1/2 h-4 w-4 -translate-y-1/2 animate-spin text-muted-foreground" })
2489
2489
  ] }),
2490
- /* @__PURE__ */ jsx8("div", { className: "flex flex-wrap gap-1", children: tokens.map((t) => {
2491
- const info = store.registry.getEntityInfo(t);
2492
- const ChipIcon = info.Icon ?? DefaultEntityIcon;
2493
- const active = browseToken === t;
2494
- return /* @__PURE__ */ jsxs6(
2495
- "button",
2496
- {
2497
- type: "button",
2498
- onClick: () => setBrowseToken(active ? null : t),
2499
- className: cn4(
2500
- "inline-flex items-center gap-1 rounded-md border px-1.5 py-0.5 text-[11px] transition-colors",
2501
- active ? "border-primary/50 bg-primary/10 text-foreground" : "border-border text-muted-foreground hover:text-foreground hover:bg-accent"
2502
- ),
2503
- children: [
2504
- /* @__PURE__ */ jsx8(ChipIcon, { className: "h-3 w-3" }),
2505
- info.labelPlural
2506
- ]
2507
- },
2508
- t
2509
- );
2510
- }) }),
2490
+ /* @__PURE__ */ jsx8(
2491
+ "div",
2492
+ {
2493
+ role: "group",
2494
+ "aria-label": "Entity type filters",
2495
+ className: "flex shrink-0 flex-nowrap gap-1 overflow-x-auto pb-1",
2496
+ children: tokens.map((t) => {
2497
+ const info = store.registry.getEntityInfo(t);
2498
+ const ChipIcon = info.Icon ?? DefaultEntityIcon;
2499
+ const active = browseToken === t;
2500
+ return /* @__PURE__ */ jsxs6(
2501
+ "button",
2502
+ {
2503
+ type: "button",
2504
+ onClick: () => setBrowseToken(active ? null : t),
2505
+ className: cn4(
2506
+ "inline-flex shrink-0 items-center gap-1 rounded-md border px-1.5 py-0.5 text-[11px] transition-colors",
2507
+ active ? "border-primary/50 bg-primary/10 text-foreground" : "border-border text-muted-foreground hover:text-foreground hover:bg-accent"
2508
+ ),
2509
+ children: [
2510
+ /* @__PURE__ */ jsx8(ChipIcon, { className: "h-3 w-3" }),
2511
+ info.labelPlural
2512
+ ]
2513
+ },
2514
+ t
2515
+ );
2516
+ })
2517
+ }
2518
+ ),
2511
2519
  browseToken && BrowseOverride ? (
2512
2520
  // The token's canonical host picker (e.g. the stored-files browser)
2513
2521
  // owns per-token browsing when registered — never a plain list twin.
@@ -2540,71 +2548,79 @@ function UniversalAssociationPicker(props) {
2540
2548
  onAttach: (id, title) => onAttach(browseToken, id, title),
2541
2549
  onDetach: (id) => onDetach(browseToken, id)
2542
2550
  }
2543
- ) }) : /* @__PURE__ */ jsx8("div", { className: "-mx-1 min-h-0 flex-1 overflow-y-auto px-1", children: results.length === 0 ? /* @__PURE__ */ jsx8("p", { className: "py-6 text-center text-[12px] text-muted-foreground", children: loading ? "Searching\u2026" : query.trim() ? "No matches \u2014 narrow with a type chip to browse." : "No recent items. Type to search, or pick a type to browse." }) : /* @__PURE__ */ jsxs6("div", { className: "space-y-2", children: [
2544
- isRecents && /* @__PURE__ */ jsx8("p", { className: "px-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground/60", children: "Recent" }),
2545
- [...groups.entries()].map(([token, items]) => {
2546
- const info = store.registry.getEntityInfo(token);
2547
- const GroupIcon = info.Icon ?? DefaultEntityIcon;
2548
- return /* @__PURE__ */ jsxs6("div", { className: "space-y-0.5", children: [
2549
- /* @__PURE__ */ jsxs6("p", { className: "flex items-center gap-1 px-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground/70", children: [
2550
- /* @__PURE__ */ jsx8(GroupIcon, { className: "h-3 w-3" }),
2551
- info.labelPlural
2552
- ] }),
2553
- /* @__PURE__ */ jsx8("ul", { className: "space-y-0.5", children: items.map((c) => {
2554
- const key = attachedKey(c.token, c.id);
2555
- const attached = attachedKeys.has(key);
2556
- const busy = busyKey === key;
2557
- return /* @__PURE__ */ jsxs6(
2558
- "li",
2559
- {
2560
- className: cn4(
2561
- "group/entity-ref group flex items-center gap-1 rounded-md pr-1.5 transition-colors",
2562
- "hover:bg-accent",
2563
- attached && "bg-accent/40"
2564
- ),
2565
- children: [
2566
- /* @__PURE__ */ jsxs6(
2567
- "button",
2568
- {
2569
- type: "button",
2570
- disabled: busy,
2571
- onClick: () => toggle(c),
2572
- title: attached ? `Detach "${c.title}"` : `Attach "${c.title}"`,
2573
- className: cn4(
2574
- "flex min-w-0 flex-1 items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm",
2575
- "disabled:opacity-50"
2551
+ ) }) : /* @__PURE__ */ jsx8(
2552
+ "div",
2553
+ {
2554
+ role: "region",
2555
+ "aria-label": "Association search results",
2556
+ className: "-mx-1 min-h-24 flex-1 overflow-y-auto overscroll-contain px-1",
2557
+ children: results.length === 0 ? /* @__PURE__ */ jsx8("p", { className: "py-6 text-center text-[12px] text-muted-foreground", children: loading ? "Searching\u2026" : query.trim() ? "No matches \u2014 narrow with a type chip to browse." : "No recent items. Type to search, or pick a type to browse." }) : /* @__PURE__ */ jsxs6("div", { className: "space-y-2", children: [
2558
+ isRecents && /* @__PURE__ */ jsx8("p", { className: "px-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground/60", children: "Recent" }),
2559
+ [...groups.entries()].map(([token, items]) => {
2560
+ const info = store.registry.getEntityInfo(token);
2561
+ const GroupIcon = info.Icon ?? DefaultEntityIcon;
2562
+ return /* @__PURE__ */ jsxs6("div", { className: "space-y-0.5", children: [
2563
+ /* @__PURE__ */ jsxs6("p", { className: "flex items-center gap-1 px-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground/70", children: [
2564
+ /* @__PURE__ */ jsx8(GroupIcon, { className: "h-3 w-3" }),
2565
+ info.labelPlural
2566
+ ] }),
2567
+ /* @__PURE__ */ jsx8("ul", { className: "space-y-0.5", children: items.map((c) => {
2568
+ const key = attachedKey(c.token, c.id);
2569
+ const attached = attachedKeys.has(key);
2570
+ const busy = busyKey === key;
2571
+ return /* @__PURE__ */ jsxs6(
2572
+ "li",
2573
+ {
2574
+ className: cn4(
2575
+ "group/entity-ref group flex items-center gap-1 rounded-md pr-1.5 transition-colors",
2576
+ "hover:bg-accent",
2577
+ attached && "bg-accent/40"
2578
+ ),
2579
+ children: [
2580
+ /* @__PURE__ */ jsxs6(
2581
+ "button",
2582
+ {
2583
+ type: "button",
2584
+ disabled: busy,
2585
+ onClick: () => toggle(c),
2586
+ title: attached ? `Detach "${c.title}"` : `Attach "${c.title}"`,
2587
+ className: cn4(
2588
+ "flex min-w-0 flex-1 items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm",
2589
+ "disabled:opacity-50"
2590
+ ),
2591
+ children: [
2592
+ /* @__PURE__ */ jsx8("span", { className: "min-w-0 flex-1 truncate text-foreground", children: c.title }),
2593
+ /* @__PURE__ */ jsx8(
2594
+ "span",
2595
+ {
2596
+ className: cn4(
2597
+ "flex h-5 w-5 shrink-0 items-center justify-center rounded-full",
2598
+ attached ? "bg-primary text-primary-foreground" : "border border-border text-muted-foreground group-hover:border-primary/60"
2599
+ ),
2600
+ children: busy ? /* @__PURE__ */ jsx8(SpinnerIcon, { className: "h-3 w-3 animate-spin" }) : attached ? /* @__PURE__ */ jsx8(CheckIcon, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx8(PlusIcon, { className: "h-3 w-3" })
2601
+ }
2602
+ )
2603
+ ]
2604
+ }
2576
2605
  ),
2577
- children: [
2578
- /* @__PURE__ */ jsx8("span", { className: "min-w-0 flex-1 truncate text-foreground", children: c.title }),
2579
- /* @__PURE__ */ jsx8(
2580
- "span",
2581
- {
2582
- className: cn4(
2583
- "flex h-5 w-5 shrink-0 items-center justify-center rounded-full",
2584
- attached ? "bg-primary text-primary-foreground" : "border border-border text-muted-foreground group-hover:border-primary/60"
2585
- ),
2586
- children: busy ? /* @__PURE__ */ jsx8(SpinnerIcon, { className: "h-3 w-3 animate-spin" }) : attached ? /* @__PURE__ */ jsx8(CheckIcon, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx8(PlusIcon, { className: "h-3 w-3" })
2587
- }
2588
- )
2589
- ]
2590
- }
2591
- ),
2592
- /* @__PURE__ */ jsx8(
2593
- DoorControlsSlot,
2594
- {
2595
- token: c.token,
2596
- id: c.id,
2597
- name: c.title
2598
- }
2599
- )
2600
- ]
2601
- },
2602
- key
2603
- );
2604
- }) })
2605
- ] }, token);
2606
- })
2607
- ] }) })
2606
+ /* @__PURE__ */ jsx8(
2607
+ DoorControlsSlot,
2608
+ {
2609
+ token: c.token,
2610
+ id: c.id,
2611
+ name: c.title
2612
+ }
2613
+ )
2614
+ ]
2615
+ },
2616
+ key
2617
+ );
2618
+ }) })
2619
+ ] }, token);
2620
+ })
2621
+ ] })
2622
+ }
2623
+ )
2608
2624
  ] });
2609
2625
  }
2610
2626