@stigmer/react 3.0.4 → 3.0.6

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.
Files changed (88) hide show
  1. package/agent/AgentDetailView.d.ts +1 -11
  2. package/agent/AgentDetailView.d.ts.map +1 -1
  3. package/agent/AgentDetailView.js +3 -6
  4. package/agent/AgentDetailView.js.map +1 -1
  5. package/agent-instance/AgentInstanceDetailPanel.d.ts.map +1 -1
  6. package/agent-instance/AgentInstanceDetailPanel.js +2 -6
  7. package/agent-instance/AgentInstanceDetailPanel.js.map +1 -1
  8. package/agent-instance/AgentInstanceList.d.ts.map +1 -1
  9. package/agent-instance/AgentInstanceList.js +2 -6
  10. package/agent-instance/AgentInstanceList.js.map +1 -1
  11. package/iam-policy/useCheckPermission.d.ts +3 -1
  12. package/iam-policy/useCheckPermission.d.ts.map +1 -1
  13. package/iam-policy/useCheckPermission.js +11 -15
  14. package/iam-policy/useCheckPermission.js.map +1 -1
  15. package/index.d.ts +2 -2
  16. package/index.d.ts.map +1 -1
  17. package/index.js +1 -1
  18. package/index.js.map +1 -1
  19. package/library/InstanceVisibilitySelector.d.ts +8 -15
  20. package/library/InstanceVisibilitySelector.d.ts.map +1 -1
  21. package/library/InstanceVisibilitySelector.js +11 -139
  22. package/library/InstanceVisibilitySelector.js.map +1 -1
  23. package/library/ResourceVisibilityControl.d.ts +52 -0
  24. package/library/ResourceVisibilityControl.d.ts.map +1 -0
  25. package/library/ResourceVisibilityControl.js +81 -0
  26. package/library/ResourceVisibilityControl.js.map +1 -0
  27. package/library/ScopeToggle.d.ts +1 -1
  28. package/library/ScopeToggle.js +1 -1
  29. package/library/VisibilitySelector.d.ts +75 -0
  30. package/library/VisibilitySelector.d.ts.map +1 -0
  31. package/library/VisibilitySelector.js +171 -0
  32. package/library/VisibilitySelector.js.map +1 -0
  33. package/library/index.d.ts +6 -2
  34. package/library/index.d.ts.map +1 -1
  35. package/library/index.js +3 -1
  36. package/library/index.js.map +1 -1
  37. package/library/useUpdateVisibility.d.ts +5 -4
  38. package/library/useUpdateVisibility.d.ts.map +1 -1
  39. package/library/useUpdateVisibility.js +5 -4
  40. package/library/useUpdateVisibility.js.map +1 -1
  41. package/library/visibilityLevels.d.ts +74 -0
  42. package/library/visibilityLevels.d.ts.map +1 -0
  43. package/library/visibilityLevels.js +91 -0
  44. package/library/visibilityLevels.js.map +1 -0
  45. package/mcp-server/McpServerDetailView.d.ts +1 -11
  46. package/mcp-server/McpServerDetailView.d.ts.map +1 -1
  47. package/mcp-server/McpServerDetailView.js +3 -6
  48. package/mcp-server/McpServerDetailView.js.map +1 -1
  49. package/package.json +4 -4
  50. package/resource-detail/types.d.ts +1 -1
  51. package/skill/SkillDetailView.d.ts +1 -11
  52. package/skill/SkillDetailView.d.ts.map +1 -1
  53. package/skill/SkillDetailView.js +3 -6
  54. package/skill/SkillDetailView.js.map +1 -1
  55. package/src/agent/AgentDetailView.tsx +10 -35
  56. package/src/agent-instance/AgentInstanceDetailPanel.tsx +2 -7
  57. package/src/agent-instance/AgentInstanceList.tsx +2 -7
  58. package/src/iam-policy/useCheckPermission.ts +10 -15
  59. package/src/index.ts +8 -2
  60. package/src/library/InstanceVisibilitySelector.tsx +19 -276
  61. package/src/library/ResourceVisibilityControl.tsx +145 -0
  62. package/src/library/ScopeToggle.tsx +1 -1
  63. package/src/library/VisibilitySelector.tsx +393 -0
  64. package/src/library/index.ts +16 -2
  65. package/src/library/useUpdateVisibility.ts +5 -4
  66. package/src/library/visibilityLevels.ts +144 -0
  67. package/src/mcp-server/McpServerDetailView.tsx +10 -35
  68. package/src/resource-detail/types.ts +1 -1
  69. package/src/skill/SkillDetailView.tsx +10 -35
  70. package/src/workflow/WorkflowDetailView.tsx +10 -34
  71. package/src/workflow/instance/WorkflowInstanceDetailPanel.tsx +2 -7
  72. package/src/workflow/instance/WorkflowInstanceList.tsx +2 -7
  73. package/styles.css +1 -1
  74. package/workflow/WorkflowDetailView.d.ts +1 -10
  75. package/workflow/WorkflowDetailView.d.ts.map +1 -1
  76. package/workflow/WorkflowDetailView.js +3 -6
  77. package/workflow/WorkflowDetailView.js.map +1 -1
  78. package/workflow/instance/WorkflowInstanceDetailPanel.d.ts.map +1 -1
  79. package/workflow/instance/WorkflowInstanceDetailPanel.js +2 -6
  80. package/workflow/instance/WorkflowInstanceDetailPanel.js.map +1 -1
  81. package/workflow/instance/WorkflowInstanceList.d.ts.map +1 -1
  82. package/workflow/instance/WorkflowInstanceList.js +2 -6
  83. package/workflow/instance/WorkflowInstanceList.js.map +1 -1
  84. package/library/VisibilityToggle.d.ts +0 -42
  85. package/library/VisibilityToggle.d.ts.map +0 -1
  86. package/library/VisibilityToggle.js +0 -89
  87. package/library/VisibilityToggle.js.map +0 -1
  88. package/src/library/VisibilityToggle.tsx +0 -247
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
 
3
- import { useCallback, useRef, useState } from "react";
4
- import { cn } from "@stigmer/theme";
5
- import { ApiResourceVisibility } from "@stigmer/protos/ai/stigmer/commons/apiresource/enum_pb";
3
+ import type { ApiResourceVisibility } from "@stigmer/protos/ai/stigmer/commons/apiresource/enum_pb";
4
+ import { VisibilitySelector } from "./VisibilitySelector";
5
+ import { INSTANCE_VISIBILITY_LEVELS } from "./visibilityLevels";
6
6
 
7
7
  /** Props for {@link InstanceVisibilitySelector}. */
8
8
  export interface InstanceVisibilitySelectorProps {
@@ -21,44 +21,15 @@ export interface InstanceVisibilitySelectorProps {
21
21
  readonly className?: string;
22
22
  }
23
23
 
24
- const OPTIONS: readonly {
25
- readonly value: ApiResourceVisibility;
26
- readonly label: string;
27
- readonly description: string;
28
- }[] = [
29
- {
30
- value: ApiResourceVisibility.visibility_private,
31
- label: "Private",
32
- description: "Only you can access",
33
- },
34
- {
35
- value: ApiResourceVisibility.visibility_org,
36
- label: "Organization",
37
- description: "All org members can view executions",
38
- },
39
- {
40
- value: ApiResourceVisibility.visibility_public,
41
- label: "Public",
42
- description: "All authenticated users can view",
43
- },
44
- ];
45
-
46
24
  /**
47
- * Three-state visibility selector for instances (AgentInstance,
48
- * WorkflowInstance).
49
- *
50
- * Unlike the binary {@link VisibilityToggle} used for blueprints,
51
- * instances support the full visibility spectrum: Private, Organization,
52
- * and Public. Escalating visibility (private -> org, or any -> public)
53
- * shows an inline confirmation prompt since expanding access is
54
- * consequential.
55
- *
56
- * For workflow instances, ORG visibility has cascading effects:
57
- * all org members automatically see all executions via FGA
58
- * inheritance (zero per-execution tuples needed).
25
+ * Visibility selector for instances (AgentInstance, WorkflowInstance):
26
+ * {@link VisibilitySelector} preconfigured with the instance level set
27
+ * (Private / Organization / Public — platform is excluded by design to
28
+ * preserve tenant isolation).
59
29
  *
60
- * WAI-ARIA Radio Group with roving tabindex. All visual properties
61
- * flow through `--stgm-*` design tokens.
30
+ * For workflow instances, ORG visibility has cascading effects: all org
31
+ * members automatically see all executions via FGA inheritance (zero
32
+ * per-execution tuples needed).
62
33
  *
63
34
  * @example
64
35
  * ```tsx
@@ -81,243 +52,15 @@ export function InstanceVisibilitySelector({
81
52
  disabled = false,
82
53
  className,
83
54
  }: InstanceVisibilitySelectorProps) {
84
- const [confirming, setConfirming] = useState<ApiResourceVisibility | null>(
85
- null,
86
- );
87
- const optionRefs = useRef<(HTMLButtonElement | null)[]>([]);
88
- const effectivelyDisabled = disabled || isPending;
89
-
90
- const isEscalation = useCallback(
91
- (target: ApiResourceVisibility) => {
92
- const order = [
93
- ApiResourceVisibility.visibility_private,
94
- ApiResourceVisibility.visibility_org,
95
- ApiResourceVisibility.visibility_public,
96
- ];
97
- return order.indexOf(target) > order.indexOf(visibility);
98
- },
99
- [visibility],
100
- );
101
-
102
- const handleSelect = useCallback(
103
- (value: ApiResourceVisibility) => {
104
- if (value === visibility) return;
105
-
106
- if (isEscalation(value)) {
107
- setConfirming(value);
108
- return;
109
- }
110
-
111
- onVisibilityChange(value);
112
- },
113
- [visibility, onVisibilityChange, isEscalation],
114
- );
115
-
116
- const confirmChange = useCallback(() => {
117
- if (confirming === null) return;
118
- setConfirming(null);
119
- onVisibilityChange(confirming);
120
- }, [confirming, onVisibilityChange]);
121
-
122
- const cancelConfirm = useCallback(() => {
123
- setConfirming(null);
124
- }, []);
125
-
126
- const handleKeyDown = useCallback(
127
- (e: React.KeyboardEvent<HTMLButtonElement>, index: number) => {
128
- let nextIndex: number | null = null;
129
-
130
- if (e.key === "ArrowRight" || e.key === "ArrowDown") {
131
- e.preventDefault();
132
- nextIndex = (index + 1) % OPTIONS.length;
133
- } else if (e.key === "ArrowLeft" || e.key === "ArrowUp") {
134
- e.preventDefault();
135
- nextIndex = (index - 1 + OPTIONS.length) % OPTIONS.length;
136
- }
137
-
138
- if (nextIndex !== null) {
139
- optionRefs.current[nextIndex]?.focus();
140
- handleSelect(OPTIONS[nextIndex].value);
141
- }
142
- },
143
- [handleSelect],
144
- );
145
-
146
- const confirmingOption = confirming
147
- ? OPTIONS.find((o) => o.value === confirming)
148
- : null;
149
-
150
- return (
151
- <div className={cn("inline-flex flex-col gap-1.5", className)}>
152
- <div
153
- role="radiogroup"
154
- aria-label="Instance visibility"
155
- aria-disabled={effectivelyDisabled || undefined}
156
- className={cn(
157
- "inline-flex rounded-md bg-muted p-0.5",
158
- effectivelyDisabled && "pointer-events-none opacity-50",
159
- )}
160
- >
161
- {OPTIONS.map((option, index) => {
162
- const isSelected = visibility === option.value;
163
-
164
- return (
165
- <button
166
- key={option.value}
167
- ref={(el) => {
168
- optionRefs.current[index] = el;
169
- }}
170
- type="button"
171
- role="radio"
172
- aria-checked={isSelected}
173
- aria-label={`${option.label}: ${option.description}`}
174
- tabIndex={isSelected ? 0 : -1}
175
- disabled={effectivelyDisabled}
176
- onClick={() => handleSelect(option.value)}
177
- onKeyDown={(e) => handleKeyDown(e, index)}
178
- className={cn(
179
- "inline-flex cursor-pointer items-center gap-1 rounded-sm px-2.5 py-1 text-xs font-medium transition-colors",
180
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
181
- isSelected
182
- ? getSelectedStyle(option.value)
183
- : "text-muted-foreground hover:text-foreground",
184
- )}
185
- >
186
- {isPending && isSelected ? (
187
- <span
188
- className="inline-block size-3 animate-spin rounded-full border-2 border-current border-t-transparent"
189
- aria-hidden="true"
190
- />
191
- ) : (
192
- getIcon(option.value)
193
- )}
194
- {option.label}
195
- </button>
196
- );
197
- })}
198
- </div>
199
-
200
- {/* Description of current state */}
201
- {!confirming && (
202
- <p className="text-[0.65rem] text-muted-foreground">
203
- {OPTIONS.find((o) => o.value === visibility)?.description}
204
- </p>
205
- )}
206
-
207
- {/* Confirmation prompt for escalation */}
208
- {confirming !== null && confirmingOption && (
209
- <div
210
- className={cn(
211
- "flex items-center gap-2 rounded-md border px-3 py-1.5 text-xs",
212
- confirming === ApiResourceVisibility.visibility_public
213
- ? "border-amber-200 bg-amber-50 dark:border-amber-800/50 dark:bg-amber-950/30"
214
- : "border-blue-200 bg-blue-50 dark:border-blue-800/50 dark:bg-blue-950/30",
215
- )}
216
- role="alert"
217
- >
218
- <span
219
- className={cn(
220
- confirming === ApiResourceVisibility.visibility_public
221
- ? "text-amber-800 dark:text-amber-200"
222
- : "text-blue-800 dark:text-blue-200",
223
- )}
224
- >
225
- {confirming === ApiResourceVisibility.visibility_public
226
- ? "Make visible to all authenticated users?"
227
- : "Make visible to all org members?"}
228
- </span>
229
- <button
230
- type="button"
231
- onClick={confirmChange}
232
- className={cn(
233
- "rounded px-2 py-0.5 text-xs font-medium text-white",
234
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
235
- confirming === ApiResourceVisibility.visibility_public
236
- ? "bg-amber-600 hover:bg-amber-700 dark:bg-amber-600 dark:hover:bg-amber-500"
237
- : "bg-blue-600 hover:bg-blue-700 dark:bg-blue-600 dark:hover:bg-blue-500",
238
- )}
239
- >
240
- Confirm
241
- </button>
242
- <button
243
- type="button"
244
- onClick={cancelConfirm}
245
- className={cn(
246
- "rounded px-2 py-0.5 text-xs font-medium",
247
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
248
- confirming === ApiResourceVisibility.visibility_public
249
- ? "text-amber-700 hover:text-amber-900 dark:text-amber-300 dark:hover:text-amber-100"
250
- : "text-blue-700 hover:text-blue-900 dark:text-blue-300 dark:hover:text-blue-100",
251
- )}
252
- >
253
- Cancel
254
- </button>
255
- </div>
256
- )}
257
- </div>
258
- );
259
- }
260
-
261
- // ---------------------------------------------------------------------------
262
- // Helpers
263
- // ---------------------------------------------------------------------------
264
-
265
- function getSelectedStyle(value: ApiResourceVisibility): string {
266
- switch (value) {
267
- case ApiResourceVisibility.visibility_private:
268
- return "bg-amber-50 text-amber-800 shadow-sm dark:bg-amber-900/30 dark:text-amber-300";
269
- case ApiResourceVisibility.visibility_org:
270
- return "bg-blue-100 text-blue-800 shadow-sm dark:bg-blue-900/40 dark:text-blue-300";
271
- case ApiResourceVisibility.visibility_public:
272
- return "bg-emerald-100 text-emerald-800 shadow-sm dark:bg-emerald-900/40 dark:text-emerald-300";
273
- default:
274
- return "bg-background text-foreground shadow-sm";
275
- }
276
- }
277
-
278
- function getIcon(value: ApiResourceVisibility) {
279
- switch (value) {
280
- case ApiResourceVisibility.visibility_private:
281
- return <LockIcon className="size-3" />;
282
- case ApiResourceVisibility.visibility_org:
283
- return <UsersIcon className="size-3" />;
284
- case ApiResourceVisibility.visibility_public:
285
- return <GlobeIcon className="size-3" />;
286
- default:
287
- return null;
288
- }
289
- }
290
-
291
- // ---------------------------------------------------------------------------
292
- // Icons
293
- // ---------------------------------------------------------------------------
294
-
295
- function LockIcon({ className }: { readonly className?: string }) {
296
- return (
297
- <svg className={className} viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
298
- <rect x="3.5" y="7" width="9" height="7" rx="1.5" />
299
- <path d="M5.5 7V5a2.5 2.5 0 0 1 5 0v2" />
300
- </svg>
301
- );
302
- }
303
-
304
- function UsersIcon({ className }: { readonly className?: string }) {
305
- return (
306
- <svg className={className} viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
307
- <circle cx="6" cy="5" r="2.5" />
308
- <path d="M2 13c0-2.21 1.79-4 4-4s4 1.79 4 4" />
309
- <circle cx="11.5" cy="5.5" r="2" />
310
- <path d="M14 13c0-1.66-1.12-3-2.5-3-.5 0-1 .14-1.4.4" />
311
- </svg>
312
- );
313
- }
314
-
315
- function GlobeIcon({ className }: { readonly className?: string }) {
316
55
  return (
317
- <svg className={className} viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
318
- <circle cx="8" cy="8" r="6" />
319
- <path d="M2 8h12" />
320
- <path d="M8 2c1.66 1.46 2.6 3.63 2.6 6s-.94 4.54-2.6 6c-1.66-1.46-2.6-3.63-2.6-6s.94-4.54 2.6-6Z" />
321
- </svg>
56
+ <VisibilitySelector
57
+ visibility={visibility}
58
+ options={INSTANCE_VISIBILITY_LEVELS}
59
+ onVisibilityChange={onVisibilityChange}
60
+ isPending={isPending}
61
+ disabled={disabled}
62
+ ariaLabel="Instance visibility"
63
+ className={className}
64
+ />
322
65
  );
323
66
  }
@@ -0,0 +1,145 @@
1
+ "use client";
2
+
3
+ import { useCallback } from "react";
4
+ import type { ApiResourceVisibility } from "@stigmer/protos/ai/stigmer/commons/apiresource/enum_pb";
5
+ import { useDeploymentMode } from "../deployment-mode";
6
+ import { PermissionGate } from "../iam-policy/PermissionGate";
7
+ import { useSsoProvider } from "../identity-provider/useSsoProvider";
8
+ import { VisibilityBadge, VisibilitySelector } from "./VisibilitySelector";
9
+ import {
10
+ blueprintVisibilityLevels,
11
+ INSTANCE_VISIBILITY_LEVELS,
12
+ } from "./visibilityLevels";
13
+ import {
14
+ useUpdateVisibility,
15
+ type VisibilityResourceKind,
16
+ } from "./useUpdateVisibility";
17
+
18
+ /**
19
+ * Maps a {@link VisibilityResourceKind} (which mirrors the SDK method namespace,
20
+ * e.g. `mcpServer`) to the FGA object type used in authorization checks
21
+ * (e.g. `mcp_server`). For the three blueprints these coincide, but the mapping
22
+ * keeps the control correct for every kind it may serve.
23
+ */
24
+ const FGA_KIND: Record<VisibilityResourceKind, string> = {
25
+ agent: "agent",
26
+ workflow: "workflow",
27
+ skill: "skill",
28
+ mcpServer: "mcp_server",
29
+ agentInstance: "agent_instance",
30
+ workflowInstance: "workflow_instance",
31
+ };
32
+
33
+ const INSTANCE_KINDS: ReadonlySet<VisibilityResourceKind> = new Set([
34
+ "agentInstance",
35
+ "workflowInstance",
36
+ ]);
37
+
38
+ /** Props for {@link ResourceVisibilityControl}. */
39
+ export interface ResourceVisibilityControlProps {
40
+ /** Resource kind, selecting both the updateVisibility RPC and the FGA type. */
41
+ readonly kind: VisibilityResourceKind;
42
+ /** Id of the resource whose visibility is shown/edited. */
43
+ readonly resourceId: string;
44
+ /** Current visibility of the resource. */
45
+ readonly visibility: ApiResourceVisibility;
46
+ /**
47
+ * Slug of the organization that OWNS the resource (`metadata.org`).
48
+ * Used to look up whether the org operates an IdentityProvider, which
49
+ * gates the Platform option for blueprints. When omitted, Platform is
50
+ * simply not offered (the other levels need no org context).
51
+ */
52
+ readonly org?: string;
53
+ /**
54
+ * Called after a successful visibility change so the host can refresh the
55
+ * resource (e.g. `refetch`) and reflect the new state.
56
+ */
57
+ readonly onChanged?: () => void;
58
+ /** Additional CSS classes applied to the root element. */
59
+ readonly className?: string;
60
+ }
61
+
62
+ /**
63
+ * Single source of truth for the resource-visibility control in detail headers.
64
+ *
65
+ * Behavior:
66
+ * - Always renders a legible state: a read-only {@link VisibilityBadge}
67
+ * (all four levels) is shown to viewers without `can_edit` and while the
68
+ * permission check is in flight — never a silent blank.
69
+ * - Upgrades to the interactive {@link VisibilitySelector} for users with
70
+ * `can_edit`, persisting changes via {@link useUpdateVisibility} and invoking
71
+ * {@link ResourceVisibilityControlProps.onChanged} on success.
72
+ *
73
+ * Offered levels are kind- and context-aware (`visibilityLevels.ts`):
74
+ * - Blueprints (agent/workflow/skill/mcp_server): Private / Organization /
75
+ * Public, plus Platform when the deployment is `cloud` AND the owning org
76
+ * operates an IdentityProvider (checked via {@link useSsoProvider}, the
77
+ * only permission-free IdP lookup — blueprint owners editing visibility
78
+ * are not necessarily org admins). In `local` mode (OSS Go backend) the
79
+ * set collapses to Private / Public.
80
+ * - Instances: Private / Organization / Public — platform is excluded by
81
+ * design to preserve tenant isolation.
82
+ *
83
+ * The backend remains the enforcer (`ValidateVisibilityStep` rejects
84
+ * platform without an IdP); the gate here only prevents offering an option
85
+ * that is guaranteed to fail.
86
+ */
87
+ export function ResourceVisibilityControl({
88
+ kind,
89
+ resourceId,
90
+ visibility,
91
+ org,
92
+ onChanged,
93
+ className,
94
+ }: ResourceVisibilityControlProps) {
95
+ const { updateVisibility, isPending } = useUpdateVisibility(kind, resourceId);
96
+ const deploymentMode = useDeploymentMode();
97
+
98
+ const isInstance = INSTANCE_KINDS.has(kind);
99
+ // The IdP lookup only matters for blueprints in cloud mode; passing null
100
+ // makes the hook a stable no-op everywhere else.
101
+ const idpLookupOrg =
102
+ !isInstance && deploymentMode === "cloud" ? (org ?? null) : null;
103
+ const { ssoProvider } = useSsoProvider(idpLookupOrg);
104
+
105
+ const options = isInstance
106
+ ? INSTANCE_VISIBILITY_LEVELS
107
+ : blueprintVisibilityLevels({
108
+ deploymentMode,
109
+ hasIdentityProvider: ssoProvider !== null,
110
+ });
111
+
112
+ const handleChange = useCallback(
113
+ async (next: ApiResourceVisibility) => {
114
+ try {
115
+ await updateVisibility(next);
116
+ onChanged?.();
117
+ } catch {
118
+ // The RPC error is captured in useUpdateVisibility's `error` state;
119
+ // swallow here so the selector's promise settles without an unhandled
120
+ // rejection. Surfacing a toast is the host app's concern.
121
+ }
122
+ },
123
+ [updateVisibility, onChanged],
124
+ );
125
+
126
+ const badge = <VisibilityBadge visibility={visibility} className={className} />;
127
+
128
+ return (
129
+ <PermissionGate
130
+ resource={{ kind: FGA_KIND[kind], id: resourceId }}
131
+ relation="can_edit"
132
+ fallback={badge}
133
+ loading={badge}
134
+ >
135
+ <VisibilitySelector
136
+ visibility={visibility}
137
+ options={options}
138
+ onVisibilityChange={handleChange}
139
+ isPending={isPending}
140
+ ariaLabel={isInstance ? "Instance visibility" : "Resource visibility"}
141
+ className={className}
142
+ />
143
+ </PermissionGate>
144
+ );
145
+ }
@@ -48,7 +48,7 @@ const OPTIONS: readonly {
48
48
  *
49
49
  * Renders as a WAI-ARIA Radio Group with roving tabindex and
50
50
  * arrow-key navigation. Follows the same visual pattern as
51
- * {@link VisibilityToggle}.
51
+ * {@link VisibilitySelector}.
52
52
  *
53
53
  * The component is controlled — the consumer owns the `value` state
54
54
  * and handles persistence (e.g., localStorage).