@danxbot/ui 20.3.3 → 20.4.1

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.
@@ -1,6 +1,7 @@
1
+ import { type AccessRequestState } from "./approvalPanelParts";
1
2
  import type { Permission, Role } from "./types";
2
3
  export type AccessRequestKind = "session" | "worker";
3
- export type AccessRequestState = "pending" | "approved" | "denied" | "expired" | "claimed";
4
+ export type { AccessRequestState };
4
5
  export interface AccessRequest {
5
6
  kind: AccessRequestKind;
6
7
  /** The session title or the worker id: what the requester calls itself. */
@@ -4,11 +4,13 @@ export interface AgentKeysListProps {
4
4
  /** The keys agents hold, already scoped to the person. */
5
5
  keys: ApiKey[];
6
6
  onRevoke: (id: number) => Promise<void>;
7
- /** The id of a key currently mid-revoke or mid-role-change. Disables just that row's controls. */
7
+ /** The id of a key currently mid-revoke, mid-role-change or mid-grant-removal. Disables just that row's controls. */
8
8
  busyId?: number | null;
9
9
  /** Makes each key's role editable in place. Omit for a read-only role badge. */
10
10
  roleEditor?: KeyRoleEditor;
11
+ /** Makes each key's grant chips removable (DX-4433). Omit and keys that carry grants show them read-only. */
12
+ onRevokeGrant?: (keyId: number, grantId: number) => Promise<void>;
11
13
  emptyState?: ReactNode;
12
14
  className?: string;
13
15
  }
14
- export declare function AgentKeysList({ keys, onRevoke, busyId, roleEditor, emptyState, className }: AgentKeysListProps): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined>;
16
+ export declare function AgentKeysList({ keys, onRevoke, busyId, roleEditor, onRevokeGrant, emptyState, className }: AgentKeysListProps): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined>;
@@ -13,6 +13,20 @@ export interface ApiKey {
13
13
  lastUsedAt?: string | null;
14
14
  /** ISO instant, or `null`/omitted for a key with no expiry. */
15
15
  expiresAt?: string | null;
16
+ /** Permissions added to this key on top of its role (DX-4433). Omit, or leave empty, for a key that holds only its role. */
17
+ grants?: KeyGrant[];
18
+ }
19
+ /** One permission an approved request added to a key, on top of its role. */
20
+ export interface KeyGrant {
21
+ id: number;
22
+ /** The permission key granted. Compared for equality only. */
23
+ permissionKey: string;
24
+ /** The permission's label, as shown on the chip and in the confirm. */
25
+ label: string;
26
+ /** ISO instant. */
27
+ grantedAt: string;
28
+ /** The reason the agent gave when it asked. Plain text. */
29
+ reason?: string;
16
30
  }
17
31
  /** Makes a key's role editable in place. `roles` are the roles the owner may pick from: one list for every key, or a function
18
32
  * of the key when the keys do not share one (DX-4431: an agent session takes agent roles, a worker a human role that can manage workers). */
@@ -28,10 +42,12 @@ export interface KeyRoleEditor {
28
42
  export interface ApiKeysTableProps {
29
43
  keys: ApiKey[];
30
44
  onRevoke: (id: number) => Promise<void>;
31
- /** The id of a key currently mid-revoke or mid-role-change. Disables just that row's controls. */
45
+ /** The id of a key currently mid-revoke, mid-role-change or mid-grant-removal. Disables just that row's controls. */
32
46
  busyId?: number | null;
33
47
  /** Makes each key's role editable in place (DX-4427). Omit for a read-only role badge. */
34
48
  roleEditor?: KeyRoleEditor;
49
+ /** Makes each grant's chip removable (DX-4433). Fired only after the confirm dialog. Omit for read-only grant chips. */
50
+ onRevokeGrant?: (keyId: number, grantId: number) => Promise<void>;
35
51
  className?: string;
36
52
  }
37
- export declare function ApiKeysTable({ keys, onRevoke, busyId, roleEditor, className }: ApiKeysTableProps): import("react").JSX.Element;
53
+ export declare function ApiKeysTable({ keys, onRevoke, busyId, roleEditor, onRevokeGrant, className }: ApiKeysTableProps): import("react").JSX.Element;
@@ -0,0 +1,31 @@
1
+ import { type AccessRequestState } from "./approvalPanelParts";
2
+ import type { Permission } from "./types";
3
+ export interface PermissionRequest {
4
+ /** The name of the key that is asking: what the agent's key is called. */
5
+ keyName: string;
6
+ /** The agent's stated reason, plain text. */
7
+ reason: string;
8
+ /** The permission keys requested, in the order the agent listed them. */
9
+ permissionKeys: string[];
10
+ /** ISO instant. */
11
+ requestedAt: string;
12
+ /** ISO instant. Shown while the request is pending. */
13
+ expiresAt?: string;
14
+ /** The short code the agent also displays. Compared by eye, never entered. */
15
+ confirmCode: string;
16
+ /** What was actually granted (a subset of `permissionKeys`). Shown once the request is approved or claimed. */
17
+ grantedKeys?: string[];
18
+ }
19
+ export interface PermissionRequestPanelProps {
20
+ request: PermissionRequest;
21
+ state: AccessRequestState;
22
+ /** The permission catalog: labels, categories and descriptions for the requested keys. */
23
+ permissions: Permission[];
24
+ /** What the approver holds. A requested permission outside this set is shown disabled and can never be granted. */
25
+ ownPermissionKeys: string[];
26
+ /** Receives exactly the permission keys left checked. */
27
+ onApprove: (permissionKeys: string[]) => Promise<void>;
28
+ onDeny: () => Promise<void>;
29
+ className?: string;
30
+ }
31
+ export declare function PermissionRequestPanel({ request, state, permissions, ownPermissionKeys, onApprove, onDeny, className, }: PermissionRequestPanelProps): import("react").JSX.Element;
@@ -0,0 +1,43 @@
1
+ import { type ReactNode } from "react";
2
+ export type AccessRequestState = "pending" | "approved" | "denied" | "expired" | "claimed";
3
+ export declare function ApprovalHeader({ title, state }: {
4
+ title: string;
5
+ state: AccessRequestState;
6
+ }): import("react").JSX.Element;
7
+ /** The code is for comparing, never copying: plain large text, no copy control (see `AccessRequestPanel`). */
8
+ export declare function ConfirmCodeCallout({ code }: {
9
+ code: string;
10
+ }): import("react").JSX.Element;
11
+ /** The readout for a settled request: the tone and title are shared, the sentence says what it meant for this requester. */
12
+ export declare function TerminalCallout({ state, children }: {
13
+ state: Exclude<AccessRequestState, "pending">;
14
+ children: ReactNode;
15
+ }): import("react").JSX.Element;
16
+ type ApprovalAction = "approve" | "deny";
17
+ /**
18
+ * Busy / error state around the two decisions. A rejected promise shows its message and re-enables the buttons; a
19
+ * resolved one leaves the panel as it was, because `state` is the consumer's server's answer, never assumed here.
20
+ */
21
+ export declare function useApprovalActions(): {
22
+ busy: ApprovalAction | null;
23
+ error: {
24
+ action: ApprovalAction;
25
+ message: string;
26
+ } | null;
27
+ run: (action: ApprovalAction, call: () => Promise<void>) => Promise<void>;
28
+ };
29
+ export declare function ApprovalError({ error }: {
30
+ error: {
31
+ action: ApprovalAction;
32
+ message: string;
33
+ } | null;
34
+ }): import("react").JSX.Element | null;
35
+ export declare function ApprovalButtons({ busy, run, onApprove, onDeny, approveDisabled, }: {
36
+ busy: ApprovalAction | null;
37
+ run: (action: ApprovalAction, call: () => Promise<void>) => Promise<void>;
38
+ onApprove: () => Promise<void>;
39
+ onDeny: () => Promise<void>;
40
+ /** True when there is nothing valid to approve. Deny is never disabled by this. */
41
+ approveDisabled: boolean;
42
+ }): import("react").JSX.Element;
43
+ export {};
@@ -13,10 +13,11 @@ export * from "./MembersPanel";
13
13
  export * from "./ChangePasswordForm";
14
14
  export * from "./SessionsList";
15
15
  export * from "./RoleKeyPicker";
16
- export type { ApiKey, KeyRoleEditor } from "./ApiKeysTable";
16
+ export type { ApiKey, KeyGrant, KeyRoleEditor } from "./ApiKeysTable";
17
17
  export * from "./ApiKeysPanel";
18
18
  export * from "./AgentKeysList";
19
19
  export * from "./AccessRequestPanel";
20
+ export * from "./PermissionRequestPanel";
20
21
  export * from "./InvitationsList";
21
22
  export * from "./InviteMembersDialog";
22
23
  export * from "./Brand";
@@ -0,0 +1,17 @@
1
+ import type { Permission } from "./types";
2
+ export interface PermissionSection {
3
+ /** `undefined` when nothing in this matrix carries a `category` — see below. */
4
+ label: string | undefined;
5
+ items: Permission[];
6
+ }
7
+ /**
8
+ * Buckets permissions by `category`, preserving first-seen order.
9
+ *
10
+ * Grouping is opt-in as a WHOLE, not per-row: if not a single permission in
11
+ * the set carries a `category`, this returns one ungrouped section rather
12
+ * than inventing an "Uncategorised" heading nobody asked to see. A consumer
13
+ * who supplies categories for some permissions and not others gets an
14
+ * explicit "Other" bucket for the rest, because at that point the absence of
15
+ * a category on a handful of rows is itself information worth a heading.
16
+ */
17
+ export declare function groupByCategory(permissions: Permission[]): PermissionSection[];
@@ -150,7 +150,7 @@ export { cellLabel, eventLabel, formatDateRange, longDate, monthTitle, timeOfDay
150
150
  export { initialFocusDay, isInMonth, nextDayForKey, useGridNavigation, type GridNavigation, type GridNavigationOptions, } from "./components/calendar/use-grid-navigation";
151
151
  export { AmbiguousTimeError, addDays, addDuration, addMonths, atMidnight, atTime, comparePlainDate, dayFraction, dayLengthMs, dayOfWeek, daysBetween, daysInMonth, endOfMonth, hoursInDay, instantAtFraction, instantToPlainDate, instantToPlainDateTime, isSameDate, isoDateString, isoDateTimeString, monthGridDays, nextDay, offsetAt, parsePlainDate, plainDateTimeToInstant, relativeAge, startOfDay, startOfMonth, startOfWeek, weekDays, type CalendarDuration, type Disambiguation, type Instant, type PlainDate, type PlainDateTime, type TimeZone, } from "./lib/time";
152
152
  export { allDayBandSegment, dayKey, daySlots, isAllDay, packBand, packLanes, snapFractionToInstant, timeSegments, timedBandSegment, type AllDayEvent, type BandInput, type BandOptions, type BandPlacement, type BandResult, type BandSegment, type CalendarEvent, type CalendarEventId, type CalendarView, type DaySlot, type DragKind, type EventDraft, type EventPalette, type LaneInput, type LaneOptions, type LanePlacement, type PaletteEntry, type TimeSegment, type TimedEvent, type VisibleRange, } from "./lib/calendar";
153
- export { RBACProvider, useRBAC, Can, useHasPermission, AccountMenu, AccountMenuSection, TeamSwitcher, DevToolsPopover, RolePermissionMatrix, RoleEditorDialog, ProfileForm, ProfilePage, RolesPermissionsPage, MembersPanel, ChangePasswordForm, SessionsList, ApiKeysPanel, AgentKeysList, AccessRequestPanel, RoleKeyPicker, isRoleSelectable, leastPrivilegeRoleId, InvitationsList, InviteMembersDialog, Brand, TeamSettingsForm, DangerZone, type RBACProviderProps, type RBACHookResult, type CanProps, type AccountMenuProps, type TeamSwitcherProps, type DevToolsPopoverProps, type RolePermissionMatrixProps, type RoleEditorDialogProps, type RoleEditorDialogSubmitInput, type ProfileFormProps, type ProfileFormAccount, type ProfileFormSaveInput, type ProfilePageProps, type RolesPermissionsPageProps, type MembersPanelProps, type MembersPanelMember, type ChangePasswordFormProps, type SessionsListProps, type Session, type ApiKeysPanelProps, type AgentKeysListProps, type ApiKey, type KeyRoleEditor, type AccessRequestPanelProps, type AccessRequest, type AccessRequestKind, type AccessRequestState, type RoleKeyPickerProps, type InvitationsListProps, type InvitationsListItem, type InvitationStatus, type InviteMembersDialogProps, type Permission, type Role, type User, type Team, type TeamMembership, type BrandProps, type TeamSettingsFormProps, type TeamSettingsFormTeam, type TeamSettingsFormSaveInput, type DangerZoneProps, } from "./components/rbac";
153
+ export { RBACProvider, useRBAC, Can, useHasPermission, AccountMenu, AccountMenuSection, TeamSwitcher, DevToolsPopover, RolePermissionMatrix, RoleEditorDialog, ProfileForm, ProfilePage, RolesPermissionsPage, MembersPanel, ChangePasswordForm, SessionsList, ApiKeysPanel, AgentKeysList, AccessRequestPanel, PermissionRequestPanel, RoleKeyPicker, isRoleSelectable, leastPrivilegeRoleId, InvitationsList, InviteMembersDialog, Brand, TeamSettingsForm, DangerZone, type RBACProviderProps, type RBACHookResult, type CanProps, type AccountMenuProps, type TeamSwitcherProps, type DevToolsPopoverProps, type RolePermissionMatrixProps, type RoleEditorDialogProps, type RoleEditorDialogSubmitInput, type ProfileFormProps, type ProfileFormAccount, type ProfileFormSaveInput, type ProfilePageProps, type RolesPermissionsPageProps, type MembersPanelProps, type MembersPanelMember, type ChangePasswordFormProps, type SessionsListProps, type Session, type ApiKeysPanelProps, type AgentKeysListProps, type ApiKey, type KeyGrant, type KeyRoleEditor, type AccessRequestPanelProps, type AccessRequest, type AccessRequestKind, type AccessRequestState, type PermissionRequestPanelProps, type PermissionRequest, type RoleKeyPickerProps, type InvitationsListProps, type InvitationsListItem, type InvitationStatus, type InviteMembersDialogProps, type Permission, type Role, type User, type Team, type TeamMembership, type BrandProps, type TeamSettingsFormProps, type TeamSettingsFormTeam, type TeamSettingsFormSaveInput, type DangerZoneProps, } from "./components/rbac";
154
154
  export { AuthLayout, AcceptInvitationCard, SignupCard, TermsAcceptance, LoginForm, ForgotPasswordForm, ResetPasswordForm, type AuthLayoutProps, type AcceptInvitationCardProps, type SignupCardProps, type TermsAcceptanceProps, type LoginFormProps, type ForgotPasswordFormProps, type ResetPasswordFormProps, } from "./components/auth";
155
155
  export { UseCaseCard, RoadmapItemCard, RoadmapSwimlaneBoard, UseCaseLedgerPage, RoadmapPage, PhaseManager, TrackManager, deriveRoadmapItemStatus, isFullyBuilt, isUnbuilt, trackIds, trackProgress, toneForIndex, CATEGORY_TONES, type Domain, type Phase, type Track, type RoadmapItem, type RoadmapItemStatus, type UseCase, type UseCaseStatus, type UseCaseDecision, type UseCaseCardProps, type RoadmapItemCardProps, type RoadmapSwimlaneBoardProps, type UseCaseLedgerPageProps, type RoadmapPageProps, type PhaseManagerProps, type TrackManagerProps, } from "./components/roadmap";
156
156
  export { ProvenanceDisclosure, ProvenanceDetail, ProvenanceBadge, ConfidenceReadout, ConfidenceMeter, ConfidenceBar, provenanceStateLabel, confidenceBand, confidenceScore, scoredConfidence, ratedConfidence, type ProvenanceRecord, type ProvenanceState, type ProvenanceSource, type ProvenanceCheck, type ProvenanceCall, type ProvenanceSignoff, type ConfidenceBand, type ConfidenceScore, type ProvenanceConfidence, type ConfidenceReadoutProps, type ConfidenceBarProps, type ConfidenceBarSize, type ProvenanceDisclosureProps, type ProvenanceDetailProps, type ProvenanceDetailTitleAs, type ProvenanceTriggerBadge, type ProvenanceBadgeProps, type ProvenanceBadgeAppearance, type ConfidenceMeterProps, } from "./components/provenance";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danxbot/ui",
3
- "version": "20.3.3",
3
+ "version": "20.4.1",
4
4
  "type": "module",
5
5
  "description": "Danxbot — a domain-agnostic React design system with motion as a first-class primitive.",
6
6
  "license": "MIT",