@danxbot/ui 14.0.1 → 14.2.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.
- package/dist/index.js +1421 -1407
- package/dist/index.js.map +1 -1
- package/dist/types/components/rbac/Can.d.ts +19 -0
- package/dist/types/components/rbac/DevToolsPopover.d.ts +15 -1
- package/dist/types/components/rbac/index.d.ts +1 -0
- package/dist/types/components/rbac/types.d.ts +27 -0
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export interface CanProps {
|
|
3
|
+
/** A single permission key the effective role must carry. */
|
|
4
|
+
permission?: string;
|
|
5
|
+
/** Rendered when the effective role carries ANY of these keys. */
|
|
6
|
+
anyOf?: string[];
|
|
7
|
+
/** Shown when the permission check fails. Defaults to nothing at all. */
|
|
8
|
+
fallback?: ReactNode;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Reads `hasPermission` off `useRBAC()` directly — the same derived function
|
|
13
|
+
* `Can` itself calls — so a consumer that needs the boolean without wanting
|
|
14
|
+
* `Can`'s all-or-nothing render (to feed a `disabled` prop, a tooltip, a
|
|
15
|
+
* conditional menu section) never has to reach past this component's own
|
|
16
|
+
* public surface to get it.
|
|
17
|
+
*/
|
|
18
|
+
export declare function useHasPermission(key: string): boolean;
|
|
19
|
+
export declare function Can({ permission, anyOf, fallback, children }: CanProps): ReactNode;
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
export interface DevToolsPopoverProps {
|
|
2
2
|
/** Deep link to the dev-only Use Case Ledger. Omit and the row does not render. */
|
|
3
3
|
onOpenUseCaseLedger?: () => void;
|
|
4
|
+
/**
|
|
5
|
+
* Shows the Data source / Network speed / Regenerate demo data section —
|
|
6
|
+
* all three read and write THIS LIBRARY's OWN `src/lib/sim/` layer
|
|
7
|
+
* (`createSimStore`), which exists for the pitch-deck demo and has nothing
|
|
8
|
+
* to do with role-based access control. Defaults `true` so this package's
|
|
9
|
+
* own demo pages need no change. A consuming app with a real backend and no
|
|
10
|
+
* `createSimStore` usage of its own sets this `false` — otherwise the panel
|
|
11
|
+
* shows a "Simulated ↔ Live" toggle and a "Regenerate demo data" button
|
|
12
|
+
* that do nothing observable in that app, which reads as broken rather than
|
|
13
|
+
* inert. "View as" role impersonation (the RBAC feature this component
|
|
14
|
+
* exists to gate) and "Reset to actual" are unaffected either way — they
|
|
15
|
+
* have nothing to do with the sim layer.
|
|
16
|
+
*/
|
|
17
|
+
showSimControls?: boolean;
|
|
4
18
|
}
|
|
5
|
-
export declare function DevToolsPopover({ onOpenUseCaseLedger }?: DevToolsPopoverProps): import("react").JSX.Element | null;
|
|
19
|
+
export declare function DevToolsPopover({ onOpenUseCaseLedger, showSimControls }?: DevToolsPopoverProps): import("react").JSX.Element | null;
|
|
@@ -3,21 +3,48 @@ export interface Permission {
|
|
|
3
3
|
key: string;
|
|
4
4
|
label: string;
|
|
5
5
|
category?: string;
|
|
6
|
+
/** Longer prose for a permission-matrix cell or a "what does this grant"
|
|
7
|
+
* tooltip. Optional — a consumer with nothing more to say than `label`
|
|
8
|
+
* omits it and every reader (`RolePermissionMatrix`, `AccountMenu`) falls
|
|
9
|
+
* back to `label` alone, exactly as before this field existed. */
|
|
10
|
+
description?: string;
|
|
6
11
|
}
|
|
7
12
|
export interface Role {
|
|
8
13
|
id: string;
|
|
9
14
|
label: string;
|
|
10
15
|
permissionKeys: string[];
|
|
16
|
+
/** Longer prose about what this role is for. Optional, same fallback rule
|
|
17
|
+
* as `Permission.description`. */
|
|
18
|
+
description?: string;
|
|
19
|
+
/** True for a role the consumer seeds rather than a person authors — the
|
|
20
|
+
* library draws no behavior from this beyond what a consumer's own UI
|
|
21
|
+
* (a "System" badge, a disabled rename field) chooses to key off it. */
|
|
22
|
+
system?: boolean;
|
|
23
|
+
/** True for a role a consumer's own rules forbid editing or deleting
|
|
24
|
+
* outright (the immutable "every permission, always" role a system tends
|
|
25
|
+
* to keep one of). Distinct from `system`: a system role can still be
|
|
26
|
+
* editable (its permission set changed, even reset to default), while a
|
|
27
|
+
* locked role cannot be touched at all. Never derived here — the library
|
|
28
|
+
* has no opinion on which role, if any, deserves this. */
|
|
29
|
+
locked?: boolean;
|
|
11
30
|
}
|
|
12
31
|
export interface User {
|
|
13
32
|
id: string;
|
|
14
33
|
name: string;
|
|
15
34
|
email: string;
|
|
16
35
|
avatarUrl?: string;
|
|
36
|
+
/** A stable handle distinct from the display `name`, when a consumer's
|
|
37
|
+
* account model has one (sign-in identifier, `@handle`). Optional — a
|
|
38
|
+
* consumer with no separate concept of a username omits it. */
|
|
39
|
+
username?: string;
|
|
17
40
|
}
|
|
18
41
|
export interface Team {
|
|
19
42
|
id: string;
|
|
20
43
|
name: string;
|
|
44
|
+
/** The team's own brand mark, when it has uploaded one. `undefined`
|
|
45
|
+
* (never `null`) is "no logo set" — the same optional-field convention
|
|
46
|
+
* every other field on this type already uses. */
|
|
47
|
+
logoUrl?: string;
|
|
21
48
|
}
|
|
22
49
|
export interface TeamMembership {
|
|
23
50
|
userId: string;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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, AccountMenu, DevToolsPopover, RolePermissionMatrix, ProfilePage, RolesPermissionsPage, type RBACProviderProps, type RBACHookResult, type AccountMenuProps, type DevToolsPopoverProps, type RolePermissionMatrixProps, type Permission, type Role, type User, type Team, type TeamMembership, } from "./components/rbac";
|
|
127
|
+
export { RBACProvider, useRBAC, Can, useHasPermission, AccountMenu, DevToolsPopover, RolePermissionMatrix, ProfilePage, RolesPermissionsPage, type RBACProviderProps, type RBACHookResult, type CanProps, type AccountMenuProps, type DevToolsPopoverProps, type RolePermissionMatrixProps, 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";
|