@cosxai/ui 0.10.2 → 0.10.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosxai/ui",
3
- "version": "0.10.2",
3
+ "version": "0.10.3",
4
4
  "description": "COSX design system — React 19 component primitives shared across product-meta and other consumers",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -209,8 +209,19 @@ export function ActionBar({
209
209
  });
210
210
  }, [storageKey]);
211
211
  const hasAdminItems = useMemo(() => items.some((it) => it.adminOnly === true), [items]);
212
+ // Filter semantics:
213
+ // admin OFF → hide items marked adminOnly (the toggle would reveal them)
214
+ // admin ON → hide items marked hiddenInAdmin (page opted them out of admin view)
215
+ // Together, adminOnly + hiddenInAdmin let pages choose:
216
+ // - additive: normal items unmarked → visible in both modes;
217
+ // admin items marked adminOnly → visible only in admin
218
+ // - exclusive: normal items marked hiddenInAdmin → hidden in admin;
219
+ // admin items marked adminOnly → visible only in admin
212
220
  const visibleItems = useMemo(
213
- () => (adminMode ? items : items.filter((it) => it.adminOnly !== true)),
221
+ () =>
222
+ adminMode
223
+ ? items.filter((it) => it.hiddenInAdmin !== true)
224
+ : items.filter((it) => it.adminOnly !== true),
214
225
  [items, adminMode],
215
226
  );
216
227
 
@@ -60,6 +60,18 @@ export interface ActionBarItem {
60
60
  // (or an equivalent gate) === true. The kit does not check
61
61
  // permissions; it only handles the toggle UX.
62
62
  adminOnly?: boolean;
63
+ // Marks a normally-visible item as hidden when admin mode is on.
64
+ // Symmetric counterpart to `adminOnly`: pages that want an
65
+ // exclusive "different toolset" UX (e.g. Share disappears in favour
66
+ // of Manage Share + Activity + History) mark their regular items
67
+ // hiddenInAdmin=true so they clear when the toggle flips on.
68
+ // Pages that want additive layering (regular items stay + admin
69
+ // items appear alongside) just leave this unset.
70
+ //
71
+ // Per-item because different pages within the same app want
72
+ // different behaviour: block_doc viewer wants exclusive; a
73
+ // hypothetical PDF admin surface might want additive.
74
+ hiddenInAdmin?: boolean;
63
75
  }
64
76
 
65
77
  // Category definition — declared at the provider level. Drives