@danxbot/ui 2.0.2 → 2.1.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.
@@ -18,8 +18,19 @@ export interface PopoverProps {
18
18
  * documentation surface cannot dispatch a click.
19
19
  */
20
20
  defaultOpen?: boolean;
21
+ /**
22
+ * Names the popup for assistive technology.
23
+ *
24
+ * Base UI gives the popup `role="dialog"`, and an unlabelled dialog
25
+ * announces itself as nothing. Declared here rather than left to a caller
26
+ * passing `aria-labelledby` through: an undeclared prop on a component that
27
+ * destructures its props is silently DROPPED — it type-checks, renders, and
28
+ * does nothing, which is how this was shipped once already.
29
+ */
30
+ "aria-labelledby"?: string;
31
+ "aria-label"?: string;
21
32
  }
22
- export declare function Popover({ trigger, side, align, arrow, className, children, ref, defaultOpen, }: PopoverProps): import("react").JSX.Element;
33
+ export declare function Popover({ trigger, side, align, arrow, className, children, ref, defaultOpen, "aria-labelledby": ariaLabelledBy, "aria-label": ariaLabel, }: PopoverProps): import("react").JSX.Element;
23
34
  /** Closes the nearest Popover. */
24
35
  export declare function PopoverClose({ children }: {
25
36
  children: ReactNode;
@@ -0,0 +1,15 @@
1
+ export interface ConfidenceMeterProps {
2
+ /** 0..1, or null when nothing scored it. */
3
+ confidence: number | null;
4
+ /**
5
+ * What to say when there is no score.
6
+ *
7
+ * Rendered as text rather than an empty bar, because a bar at zero and a bar
8
+ * with nothing to show look identical and mean opposite things.
9
+ */
10
+ unscoredLabel?: string;
11
+ /** Hides the band name, for dense rows where the bar is enough. */
12
+ compact?: boolean;
13
+ className?: string;
14
+ }
15
+ export declare function ConfidenceMeter({ confidence, unscoredLabel, compact, className, }: ConfidenceMeterProps): import("react").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import type { ProvenanceState } from "./types";
2
+ export interface ProvenanceBadgeProps {
3
+ state: ProvenanceState;
4
+ /** Render the badge even for states that are quiet by default. */
5
+ alwaysShow?: boolean;
6
+ size?: "sm" | "md";
7
+ className?: string;
8
+ }
9
+ export declare function ProvenanceBadge({ state, alwaysShow, size, className, }: ProvenanceBadgeProps): import("react").JSX.Element | null;
10
+ /** The words this library uses for each state. Exported so a consumer's own
11
+ filters and legends read the same as its badges. */
12
+ export declare function provenanceStateLabel(state: ProvenanceState): string;
@@ -0,0 +1,19 @@
1
+ import { type ReactNode } from "react";
2
+ import type { ProvenanceRecord } from "./types";
3
+ export interface ProvenanceDisclosureProps {
4
+ record: ProvenanceRecord;
5
+ /**
6
+ * Rendered at the foot of the panel — sign-off, correction, "open the source".
7
+ *
8
+ * A slot rather than props, because the actions a consumer offers over an
9
+ * extracted value are theirs: this library has no idea who is allowed to sign
10
+ * one, or what correcting it should do.
11
+ */
12
+ actions?: ReactNode;
13
+ /** Shown in place of the value when there is none and it did not fail. */
14
+ emptyLabel?: string;
15
+ /** Shown in place of the value when the viewer may not see it. */
16
+ redactedLabel?: string;
17
+ className?: string;
18
+ }
19
+ export declare function ProvenanceDisclosure({ record, actions, emptyLabel, redactedLabel, className, }: ProvenanceDisclosureProps): import("react").JSX.Element;
@@ -0,0 +1,4 @@
1
+ export * from "./types";
2
+ export * from "./ConfidenceMeter";
3
+ export * from "./ProvenanceBadge";
4
+ export * from "./ProvenanceDisclosure";
@@ -0,0 +1,78 @@
1
+ import type { ReactNode } from "react";
2
+ export type ProvenanceState =
3
+ /** Machine-extracted, and the check passed. */
4
+ "verified"
5
+ /** A person signed it — on top of the machine's verdict, never instead. */
6
+ | "human"
7
+ /** Extracted, but nothing confirmed it. The value stands, flagged. */
8
+ | "unverified"
9
+ /** The check actively failed. There is no value. */
10
+ | "failed";
11
+ /** Where a value came from, precisely enough to go and look. */
12
+ export interface ProvenanceSource {
13
+ /** The thing it came from — a document title, a URL, a table name. */
14
+ label: string;
15
+ /** Where inside it: "page 4", "line 82", "§3.1". Null when there is no locus. */
16
+ locus: string | null;
17
+ /** The exact text at that locus. */
18
+ quote: string | null;
19
+ }
20
+ /**
21
+ * The verdict of whatever check the consumer ran.
22
+ *
23
+ * `passed` is a tri-state on purpose: `true`, `false`, and `null` for "no check
24
+ * was run" — which is a different claim from "a check ran and failed", and
25
+ * collapsing the two would let an unchecked value read as a passing one.
26
+ */
27
+ export interface ProvenanceCheck {
28
+ passed: boolean | null;
29
+ /** How it was checked, or why it could not be. */
30
+ detail: string;
31
+ }
32
+ /** The model call that produced the value. */
33
+ export interface ProvenanceCall {
34
+ model: string;
35
+ tokensIn: number;
36
+ tokensOut: number;
37
+ latencyMs: number;
38
+ }
39
+ /** A person's signature over the value. */
40
+ export interface ProvenanceSignoff {
41
+ by: string;
42
+ at: string;
43
+ note: string | null;
44
+ /**
45
+ * What the value was before they changed it.
46
+ *
47
+ * Null when they signed without correcting. Present means the value was
48
+ * replaced — and the original is kept, because a correction whose previous
49
+ * value is gone is an assertion rather than a record.
50
+ */
51
+ replaced: string | null;
52
+ }
53
+ export interface ProvenanceRecord {
54
+ /** What this value IS. Always shown, even when the value is hidden. */
55
+ label: string;
56
+ /** Null when it failed, or when the viewer may not see it. */
57
+ value: ReactNode | null;
58
+ state: ProvenanceState;
59
+ /** 0..1. Null when nothing scored it. */
60
+ confidence: number | null;
61
+ source: ProvenanceSource | null;
62
+ reasoning: string | null;
63
+ check: ProvenanceCheck | null;
64
+ call: ProvenanceCall | null;
65
+ signoff: ProvenanceSignoff | null;
66
+ /**
67
+ * Withheld from this viewer.
68
+ *
69
+ * Distinct from a null value: the label and the verification state still
70
+ * render, so a reader can see that a value EXISTS and was checked without
71
+ * seeing it. Hiding the row entirely would make the record look thinner than
72
+ * it is to the person least able to tell.
73
+ */
74
+ redacted?: boolean;
75
+ }
76
+ /** 0..1 to a band. A bare percentage invites false precision. */
77
+ export type ConfidenceBand = "high" | "moderate" | "low";
78
+ export declare function confidenceBand(confidence: number): ConfidenceBand;
@@ -94,4 +94,5 @@ export { AmbiguousTimeError, addDays, addDuration, addMonths, atMidnight, atTime
94
94
  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";
95
95
  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";
96
96
  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";
97
+ export { ProvenanceDisclosure, ProvenanceBadge, ConfidenceMeter, provenanceStateLabel, confidenceBand, type ProvenanceRecord, type ProvenanceState, type ProvenanceSource, type ProvenanceCheck, type ProvenanceCall, type ProvenanceSignoff, type ConfidenceBand, type ProvenanceDisclosureProps, type ProvenanceBadgeProps, type ConfidenceMeterProps, } from "./components/provenance";
97
98
  export { createSimStore, resetSimStores, useSimSettings, setSimSettings, getNetworkSpeed, getDataSource, simulateLatency, SimNetworkError, type SimStore, type SimStoreOptions, type SimSettings, type NetworkSpeed, type DataSource, type SimNamespace, } from "./lib/sim";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danxbot/ui",
3
- "version": "2.0.2",
3
+ "version": "2.1.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",