@danxbot/ui 3.12.1 → 3.13.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.
@@ -5,6 +5,19 @@ export interface PopoverProps {
5
5
  align?: "start" | "center" | "end";
6
6
  /** Draws the little pointer at the trigger. Off by default — see below. */
7
7
  arrow?: boolean;
8
+ /**
9
+ * The panel's DESIGN width — any CSS length, e.g. `"30rem"`.
10
+ *
11
+ * A prop rather than a `max-w-*` in `className`, and the difference is not
12
+ * cosmetic: `className` is merged last and would take the viewport clamp
13
+ * with it (see THE SIZE CLAMP above). This writes `--dx-popover-w`, which
14
+ * sits INSIDE the `min()` — so a design size can be as large as it likes and
15
+ * still cannot render wider than 80vw or than the room the positioner found.
16
+ *
17
+ * Unset, the popup keeps the library default of 20rem at the current
18
+ * `--ui-scale`.
19
+ */
20
+ width?: string;
8
21
  className?: string;
9
22
  children: ReactNode;
10
23
  ref?: Ref<HTMLDivElement>;
@@ -43,7 +56,7 @@ export interface PopoverProps {
43
56
  "aria-labelledby"?: string;
44
57
  "aria-label"?: string;
45
58
  }
46
- export declare function Popover({ trigger, side, align, arrow, className, children, ref, defaultOpen, onOpenChange, "aria-labelledby": ariaLabelledBy, "aria-label": ariaLabel, }: PopoverProps): import("react").JSX.Element;
59
+ export declare function Popover({ trigger, side, align, arrow, width, className, children, ref, defaultOpen, onOpenChange, "aria-labelledby": ariaLabelledBy, "aria-label": ariaLabel, }: PopoverProps): import("react").JSX.Element;
47
60
  /** Closes the nearest Popover. */
48
61
  export declare function PopoverClose({ children }: {
49
62
  children: ReactNode;
@@ -0,0 +1,62 @@
1
+ import { type ReactNode } from "react";
2
+ import type { ProvenanceRecord } from "./types";
3
+ /** The level the field name renders at. See "NO DIALOG ASSUMPTIONS" above. */
4
+ export type ProvenanceDetailTitleAs = "h2" | "h3" | "h4" | "h5" | "h6";
5
+ export interface ProvenanceDetailProps {
6
+ record: ProvenanceRecord;
7
+ /**
8
+ * Rendered at the foot — sign-off, correction, the cited pages themselves.
9
+ *
10
+ * A slot rather than props, because the actions a consumer offers over an
11
+ * extracted value are theirs: this library has no idea who is allowed to sign
12
+ * one, or what correcting it should do. It is also where a consumer puts the
13
+ * evidence it had to go and FETCH — the cited pages, their thumbnails, the
14
+ * audit trail — none of which this library can name.
15
+ */
16
+ actions?: ReactNode;
17
+ /** Shown in place of the value when there is none and it did not fail. */
18
+ emptyLabel?: string;
19
+ /** Shown in place of the value when the viewer may not see it. */
20
+ redactedLabel?: string;
21
+ /**
22
+ * Draw the VALUE yourself — an editor, most usefully.
23
+ *
24
+ * This replaces the one paragraph that prints the value, and nothing else:
25
+ * the field name above it, the state badge beside it, the confidence meter
26
+ * under it, and every row below the separator are still the component's.
27
+ *
28
+ * IT MAY BE INTERACTIVE. An `InlineEdit`, a select, a confirm/cancel pair are
29
+ * all legitimate — correcting a value in the surface somebody opened to judge
30
+ * it is the whole point of opening it, and the observed alternative is a
31
+ * consumer putting its editor in `actions`, which reads as "here is the
32
+ * value, and separately, down here, a form about some value".
33
+ *
34
+ * IT OVERRIDES THE ABSENCES TOO — redacted, empty and failed alike. A slot
35
+ * that disappeared whenever the value was missing would vanish in exactly the
36
+ * case a value editor is most wanted: a field that was never extracted is the
37
+ * one somebody actually has to type.
38
+ *
39
+ * The redaction gate cannot police a node you built yourself, so a consumer
40
+ * rendering this against a redactable record owns that one decision —
41
+ * `record.redacted` is right there to branch on.
42
+ *
43
+ * Passing `null` or `undefined` falls back to the built-in paragraph, so
44
+ * gating editability is `canEdit ? <Editor … /> : null` rather than two
45
+ * spellings of the whole component.
46
+ */
47
+ valueContent?: ReactNode;
48
+ /**
49
+ * Put a known id on the field-name heading, so something WRAPPING this can be
50
+ * labelled by it.
51
+ *
52
+ * `ProvenanceDisclosure` passes one: its popup takes `role="dialog"`, and an
53
+ * unlabelled dialog announces itself as nothing. An inline render normally
54
+ * has nothing to label and can leave this alone — a generated id is used, so
55
+ * the heading always has one.
56
+ */
57
+ titleId?: string;
58
+ /** @default "h2" */
59
+ titleAs?: ProvenanceDetailTitleAs;
60
+ className?: string;
61
+ }
62
+ export declare function ProvenanceDetail({ record, actions, emptyLabel, redactedLabel, valueContent, titleId, titleAs: Title, className, }: ProvenanceDetailProps): import("react").JSX.Element;
@@ -4,13 +4,7 @@ import type { ProvenanceRecord } from "./types";
4
4
  export type ProvenanceTriggerBadge = "icon" | "word" | "none";
5
5
  export interface ProvenanceDisclosureProps {
6
6
  record: ProvenanceRecord;
7
- /**
8
- * Rendered at the foot of the panel — sign-off, correction, "open the source".
9
- *
10
- * A slot rather than props, because the actions a consumer offers over an
11
- * extracted value are theirs: this library has no idea who is allowed to sign
12
- * one, or what correcting it should do.
13
- */
7
+ /** Rendered at the foot of the panel. {@link ProvenanceDetailProps.actions} */
14
8
  actions?: ReactNode;
15
9
  /** Shown in place of the value when there is none and it did not fail. */
16
10
  emptyLabel?: string;
@@ -61,50 +55,12 @@ export interface ProvenanceDisclosureProps {
61
55
  triggerContent?: ReactNode;
62
56
  /**
63
57
  * Draw the PANEL HEADER'S VALUE yourself — an editor, most usefully.
58
+ * {@link ProvenanceDetailProps.valueContent}
64
59
  *
65
- * This replaces the one paragraph that prints the value inside the open
66
- * panel, and nothing else: the field name above it, the state badge beside
67
- * it, the confidence meter under it, and every row below the separator are
68
- * still the component's. It does not touch the trigger — the value on the
69
- * page is still drawn from `record`, still truncated or wrapped per
70
- * `valueWrap`, still announced as part of the trigger's own name. The
71
- * closed page does not change because a consumer supplied this.
72
- *
73
- * UNLIKE `triggerContent`, THIS MAY BE INTERACTIVE, and that is the entire
74
- * reason it exists. `triggerContent` sits inside the disclosure's `<button>`,
75
- * so a control there would nest a control inside a control — invalid and
76
- * unfocusable. This sits in the panel body, which Base UI gives
77
- * `role="dialog"` and full focus management: an `InlineEdit`, a select, a
78
- * confirm/cancel pair are all legitimate here.
79
- *
80
- * WHY A SLOT AND NOT AN `onCorrect` PROP. The same reason `actions` is a
81
- * slot: this library has no idea who is allowed to correct an extracted
82
- * value, what the permitted values are, or what writing one costs. What it
83
- * does know is WHERE the correction belongs — against the value, in the
84
- * surface someone opened to judge it — and the observed alternative is a
85
- * consumer putting its editor in `actions`, which reads as "here is the
86
- * value, and separately, down here, a form about some value".
87
- *
88
- * IT OVERRIDES THE ABSENCES TOO — redacted, empty and failed alike — and
89
- * that is a deliberate choice rather than an oversight. A slot that
90
- * disappeared whenever the value was missing would vanish in exactly the
91
- * case a value editor is most wanted: a field that was never extracted is
92
- * the one somebody actually has to type. It would also make the header's
93
- * shape depend on a state the consumer did not ask about, so an editor would
94
- * silently become a read-only word for reasons invisible at the call site.
95
- * The absence vocabulary is not lost — the struck-through eye, the dash and
96
- * the triangle still do their whole job on the trigger, which is the surface
97
- * the density argument was ever about.
98
- *
99
- * The redaction gate is unchanged and still worth knowing about: the panel
100
- * keeps withholding the quote, the reasoning and the sign-off note from a
101
- * record marked `redacted`. It cannot police a node you built yourself, so
102
- * a consumer rendering this against a redactable record owns that one
103
- * decision — `record.redacted` is right there to branch on.
104
- *
105
- * Passing `null` or `undefined` falls back to the built-in paragraph, so
106
- * gating editability is `canEdit ? <Editor … /> : null` rather than two
107
- * spellings of the whole component.
60
+ * It does not touch the trigger — the value on the page is still drawn from
61
+ * `record`, still truncated or wrapped per `valueWrap`, still announced as
62
+ * part of the trigger's own name. The closed page does not change because a
63
+ * consumer supplied this.
108
64
  */
109
65
  valueContent?: ReactNode;
110
66
  /**
@@ -0,0 +1,36 @@
1
+ import type { ReactNode } from "react";
2
+ import { type IconName } from "../Icon";
3
+ import type { ProvenanceRecord } from "./types";
4
+ declare const ABSENCE: Record<"redacted" | "empty" | "failed", {
5
+ icon: IconName;
6
+ className: string;
7
+ }>;
8
+ export declare function Absence({ kind, children }: {
9
+ kind: keyof typeof ABSENCE;
10
+ children: ReactNode;
11
+ }): import("react").JSX.Element;
12
+ /** Whether the record is withheld from this viewer. The first gate, everywhere. */
13
+ export declare function isRedacted(record: ProvenanceRecord): boolean;
14
+ /**
15
+ * Whether the record's own check disproved it.
16
+ *
17
+ * Precedence matters and is asserted: a record that is BOTH withheld and failed
18
+ * reads as withheld, because that is the fact about this viewer. The failure is
19
+ * still true, but it is not theirs to act on — and showing them a failure reason
20
+ * drawn from a value they may not see is the leak the panel is supposed to
21
+ * close.
22
+ */
23
+ export declare function isFailed(record: ProvenanceRecord): boolean;
24
+ /**
25
+ * What a reader is shown IN PLACE OF the value — or the value itself.
26
+ *
27
+ * Each of the three absences says which one it is: withheld from you, never
28
+ * extracted, or extracted and disproved. Rendering all three as an empty cell
29
+ * would make them indistinguishable, and they call for completely different
30
+ * next actions.
31
+ */
32
+ export declare function shownValue(record: ProvenanceRecord, { emptyLabel, redactedLabel }: {
33
+ emptyLabel: string;
34
+ redactedLabel: string;
35
+ }): ReactNode;
36
+ export {};
@@ -1,4 +1,5 @@
1
1
  export * from "./types";
2
2
  export * from "./ConfidenceMeter";
3
3
  export * from "./ProvenanceBadge";
4
+ export * from "./ProvenanceDetail";
4
5
  export * from "./ProvenanceDisclosure";
@@ -109,7 +109,7 @@ export { AmbiguousTimeError, addDays, addDuration, addMonths, atMidnight, atTime
109
109
  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";
110
110
  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";
111
111
  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";
112
- export { ProvenanceDisclosure, ProvenanceBadge, ConfidenceMeter, provenanceStateLabel, confidenceBand, type ProvenanceRecord, type ProvenanceState, type ProvenanceSource, type ProvenanceCheck, type ProvenanceCall, type ProvenanceSignoff, type ConfidenceBand, type ProvenanceDisclosureProps, type ProvenanceTriggerBadge, type ProvenanceBadgeProps, type ProvenanceBadgeAppearance, type ConfidenceMeterProps, } from "./components/provenance";
112
+ export { ProvenanceDisclosure, ProvenanceDetail, ProvenanceBadge, ConfidenceMeter, provenanceStateLabel, confidenceBand, type ProvenanceRecord, type ProvenanceState, type ProvenanceSource, type ProvenanceCheck, type ProvenanceCall, type ProvenanceSignoff, type ConfidenceBand, type ProvenanceDisclosureProps, type ProvenanceDetailProps, type ProvenanceDetailTitleAs, type ProvenanceTriggerBadge, type ProvenanceBadgeProps, type ProvenanceBadgeAppearance, type ConfidenceMeterProps, } from "./components/provenance";
113
113
  export { createSimStore, resetSimStores, useSimSettings, setSimSettings, getNetworkSpeed, getDataSource, simulateLatency, SimNetworkError, type SimStore, type SimStoreOptions, type SimSettings, type NetworkSpeed, type DataSource, type SimNamespace, } from "./lib/sim";
114
114
  export { NodeCanvas, LAYOUT_DEFAULTS, layoutTree, pathToNode, type NodeCanvasProps, type CanvasEdge, type CanvasLayout, type CanvasNode, type CanvasOrientation, type LayoutOptions, type NodeRenderContext, type NodeRenderer, type PlacedNode, } from "./components/node-canvas";
115
115
  export { defineRecordType, resetRecordTypes, useRecord, useRecords, useStaleness, write, writeAll, peekRecord, readState, readStaleness, subscribeToKey, subscribeToStaleness, retainKeys, sweepRecords, setRecordStoreTenant, getRecordStoreTenant, flushRecordNotifications, resetRecordStore, recordStoreStats, UNKNOWN_STATE, normalizeTypeName, normalizeTimestamp, recordKey, isRecordRef, type RecordRef, type ReadOptions, type RecordPayload, type RecordState, type RecordTypeOptions, type RecordTypeToken, type StalenessEntry, type WriteAllResult, type WriteOptions, type WriteResult, type WriteSource, type WriteVerdict, } from "./lib/records";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danxbot/ui",
3
- "version": "3.12.1",
3
+ "version": "3.13.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",
@@ -73,7 +73,7 @@
73
73
  "gates": "npm run shoot && npm run a11y && node scripts/shoot-overlays.mjs && npm run probe",
74
74
  "a11y": "node scripts/a11y-scan.mjs",
75
75
  "shoot": "node scripts/shoot.mjs",
76
- "probe": "node scripts/probe-scale.mjs && node scripts/probe-switch.mjs && node scripts/probe-slider.mjs && node scripts/probe-panel.mjs && node scripts/probe-popover-width.mjs && node scripts/probe-api.mjs && node scripts/probe-api-live.mjs && node scripts/probe-tabs-overflow.mjs && node scripts/probe-stat-row.mjs && node scripts/probe-packaging.mjs && node scripts/probe-containment.mjs && node scripts/probe-shell.mjs && node scripts/probe-card-header.mjs && node scripts/probe-inline-edit.mjs",
76
+ "probe": "node scripts/probe-scale.mjs && node scripts/probe-switch.mjs && node scripts/probe-slider.mjs && node scripts/probe-panel.mjs && node scripts/probe-popover-width.mjs && node scripts/probe-api.mjs && node scripts/probe-api-live.mjs && node scripts/probe-tabs-overflow.mjs && node scripts/probe-stat-row.mjs && node scripts/probe-packaging.mjs && node scripts/probe-containment.mjs && node scripts/probe-popover-containment.mjs && node scripts/probe-shell.mjs && node scripts/probe-card-header.mjs && node scripts/probe-inline-edit.mjs",
77
77
  "sync": "node scripts/sync.mjs",
78
78
  "visual": "node scripts/visual-docker.mjs",
79
79
  "visual:update": "node scripts/visual-docker.mjs --update-snapshots",