@danxbot/ui 14.4.0 → 15.0.0

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.
@@ -0,0 +1,28 @@
1
+ import type { Role } from "./types";
2
+ export interface RoleEditorDialogSubmitInput {
3
+ label: string;
4
+ description: string;
5
+ /** Only ever sent from CREATE mode — see this file's own header. `undefined` when no clone-from role was picked. */
6
+ cloneFromRoleId?: string;
7
+ }
8
+ export interface RoleEditorDialogProps {
9
+ mode: "create" | "edit";
10
+ open: boolean;
11
+ onOpenChange: (open: boolean) => void;
12
+ /**
13
+ * CREATE mode only — the roles offered as "clone permissions from" (a
14
+ * consumer typically hands every role the matrix already shows, owner
15
+ * included: cloning owner's COMPUTED set is a legitimate way to seed a
16
+ * near-owner role). Omitted or empty simply hides the field — a consumer
17
+ * with nothing to clone from does not owe this dialog an empty array.
18
+ */
19
+ cloneFromRoles?: Role[];
20
+ /** EDIT mode — the role's current values, so the fields open pre-filled rather than blank. */
21
+ initialLabel?: string;
22
+ initialDescription?: string;
23
+ /** Disables the form and shows a busy submit button while a save is in flight. */
24
+ loading?: boolean;
25
+ onSubmit: (input: RoleEditorDialogSubmitInput) => void;
26
+ className?: string;
27
+ }
28
+ export declare function RoleEditorDialog({ mode, open, onOpenChange, cloneFromRoles, initialLabel, initialDescription, loading, onSubmit, className, }: RoleEditorDialogProps): import("react").JSX.Element;
@@ -2,5 +2,20 @@ import type { Permission, Role } from "./types";
2
2
  export interface RolePermissionMatrixProps {
3
3
  roles: Role[];
4
4
  permissions: Permission[];
5
+ /**
6
+ * DX-3414 — turns each cell into a toggle. Defaults to `false` (the
7
+ * original read-only matrix, unchanged pixel-for-pixel and test-for-test).
8
+ * A `role.locked` column stays READ-ONLY even when `editable` — see
9
+ * `Role.locked`'s own doc comment (`types.ts`): a consumer's rules forbid
10
+ * touching that role at all, and the matrix has no business knowing why.
11
+ */
12
+ editable?: boolean;
13
+ /**
14
+ * Fired when an editable, unlocked cell is toggled. `granted` is the NEW
15
+ * value the caller should persist — the matrix holds no state of its own
16
+ * (PLN-13 R-3: presentational, no fetch); a consumer wires this to its own
17
+ * mutation and re-renders with the updated `roles` once it lands.
18
+ */
19
+ onChange?: (roleId: string, permissionKey: string, granted: boolean) => void;
5
20
  }
6
- export declare function RolePermissionMatrix({ roles, permissions }: RolePermissionMatrixProps): import("react").JSX.Element;
21
+ export declare function RolePermissionMatrix({ roles, permissions, editable, onChange, }: RolePermissionMatrixProps): import("react").JSX.Element;
@@ -1 +1,22 @@
1
- export declare function RolesPermissionsPage(): import("react").JSX.Element;
1
+ import { type RoleEditorDialogSubmitInput } from "./RoleEditorDialog";
2
+ import type { Permission, Role } from "./types";
3
+ export interface RolesPermissionsPageProps {
4
+ roles: Role[];
5
+ permissions: Permission[];
6
+ /** Gates the "New role" button, the manage-roles list, and the matrix's own `editable`. Defaults to `false` — read-only, pixel-identical to the page before this card. */
7
+ editable?: boolean;
8
+ /** Fired when an editable, unlocked matrix cell is toggled. Required to make the matrix respond; omit alongside `editable={false}`. */
9
+ onChangePermission?: (roleId: string, permissionKey: string, granted: boolean) => void;
10
+ onCreateRole?: (input: RoleEditorDialogSubmitInput) => void;
11
+ onRenameRole?: (roleId: string, input: {
12
+ label: string;
13
+ description: string;
14
+ }) => void;
15
+ onDeleteRole?: (roleId: string) => void;
16
+ /** Restores a SYSTEM role's seeded permission set — offered only for a role with `role.system` true (never `locked`; see `Role.locked`'s own doc comment for why owner never reaches this list at all). */
17
+ onResetRole?: (roleId: string) => void;
18
+ /** The id of a role currently mid-mutation. Disables just that row's controls, not the whole page. */
19
+ busyRoleId?: string | null;
20
+ className?: string;
21
+ }
22
+ export declare function RolesPermissionsPage({ roles, permissions, editable, onChangePermission, onCreateRole, onRenameRole, onDeleteRole, onResetRole, busyRoleId, className, }: RolesPermissionsPageProps): import("react").JSX.Element;
@@ -5,6 +5,7 @@ export * from "./AccountMenu";
5
5
  export * from "./TeamSwitcher";
6
6
  export * from "./DevToolsPopover";
7
7
  export * from "./RolePermissionMatrix";
8
+ export * from "./RoleEditorDialog";
8
9
  export * from "./ProfilePage";
9
10
  export * from "./RolesPermissionsPage";
10
11
  export * from "./MembersPanel";
@@ -124,7 +124,7 @@ export { cellLabel, eventLabel, formatDateRange, longDate, monthTitle, timeOfDay
124
124
  export { initialFocusDay, isInMonth, nextDayForKey, useGridNavigation, type GridNavigation, type GridNavigationOptions, } from "./components/calendar/use-grid-navigation";
125
125
  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";
126
126
  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";
127
- export { RBACProvider, useRBAC, Can, useHasPermission, AccountMenu, TeamSwitcher, DevToolsPopover, RolePermissionMatrix, ProfilePage, RolesPermissionsPage, MembersPanel, type RBACProviderProps, type RBACHookResult, type CanProps, type AccountMenuProps, type TeamSwitcherProps, type DevToolsPopoverProps, type RolePermissionMatrixProps, type MembersPanelProps, type MembersPanelMember, type Permission, type Role, type User, type Team, type TeamMembership, } from "./components/rbac";
127
+ export { RBACProvider, useRBAC, Can, useHasPermission, AccountMenu, TeamSwitcher, DevToolsPopover, RolePermissionMatrix, RoleEditorDialog, ProfilePage, RolesPermissionsPage, MembersPanel, type RBACProviderProps, type RBACHookResult, type CanProps, type AccountMenuProps, type TeamSwitcherProps, type DevToolsPopoverProps, type RolePermissionMatrixProps, type RoleEditorDialogProps, type RoleEditorDialogSubmitInput, type RolesPermissionsPageProps, type MembersPanelProps, type MembersPanelMember, type Permission, type Role, type User, type Team, type TeamMembership, } from "./components/rbac";
128
128
  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";
129
129
  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";
130
130
  export { confidenceLevel, CONFIDENCE_LEVEL_LABELS, type ConfidenceLevel } from "./lib/confidence";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danxbot/ui",
3
- "version": "14.4.0",
3
+ "version": "15.0.0",
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",