@danxbot/ui 13.1.0 → 13.3.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.
@@ -21,6 +21,7 @@ declare const button: import("tailwind-variants").TVReturnType<{
21
21
  md: "h-control-md rounded-md px-5 text-sm";
22
22
  lg: "h-control-lg rounded-lg px-6 text-md";
23
23
  xl: "h-control-xl rounded-lg px-8 text-lg";
24
+ list: "h-auto w-full items-start justify-start gap-3 rounded-md px-3 py-2 text-left text-sm whitespace-normal";
24
25
  };
25
26
  iconOnly: {
26
27
  true: "px-0 aspect-square";
@@ -50,6 +51,7 @@ declare const button: import("tailwind-variants").TVReturnType<{
50
51
  md: "h-control-md rounded-md px-5 text-sm";
51
52
  lg: "h-control-lg rounded-lg px-6 text-md";
52
53
  xl: "h-control-xl rounded-lg px-8 text-lg";
54
+ list: "h-auto w-full items-start justify-start gap-3 rounded-md px-3 py-2 text-left text-sm whitespace-normal";
53
55
  };
54
56
  iconOnly: {
55
57
  true: "px-0 aspect-square";
@@ -79,6 +81,7 @@ declare const button: import("tailwind-variants").TVReturnType<{
79
81
  md: "h-control-md rounded-md px-5 text-sm";
80
82
  lg: "h-control-lg rounded-lg px-6 text-md";
81
83
  xl: "h-control-xl rounded-lg px-8 text-lg";
84
+ list: "h-auto w-full items-start justify-start gap-3 rounded-md px-3 py-2 text-left text-sm whitespace-normal";
82
85
  };
83
86
  iconOnly: {
84
87
  true: "px-0 aspect-square";
@@ -146,3 +149,42 @@ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, Va
146
149
  }
147
150
  export declare function Button({ className, variant, size, iconOnly, fullWidth, render, loading, leadingIcon, trailingIcon, disabled, children, onPointerDown, onClick, disabledReason, disabledReasonTooltip, ref, "aria-disabled": ariaDisabled, ...props }: ButtonProps): import("react").JSX.Element;
148
151
  export { button as buttonVariants };
152
+ export interface ListItemButtonProps extends Omit<ButtonProps, "size" | "iconOnly" | "fullWidth" | "children"> {
153
+ /**
154
+ * The row's bold leading identifier — an actor name, a from-state, a
155
+ * category label. Always rendered `font-semibold`, on the same wrapping
156
+ * line as `detail`.
157
+ */
158
+ leading: ReactNode;
159
+ /**
160
+ * Secondary text following `leading` on the SAME wrapping line — the
161
+ * action, the target, whatever finishes the sentence `leading` starts.
162
+ * Rendered `font-normal`; wraps together with `leading` as one line of
163
+ * text, not as a separate flex item.
164
+ */
165
+ detail?: ReactNode;
166
+ /**
167
+ * A muted line rendered on its OWN row below `leading`/`detail` — a
168
+ * trigger, a guard clause, any extra context. Never inlined with the line
169
+ * above, unlike `detail`.
170
+ */
171
+ subline?: ReactNode;
172
+ /**
173
+ * Marks this row as the current selection. Stamps `data-selected="true"`
174
+ * on the rendered `<button>` (omitted entirely, not `"false"`, when unset —
175
+ * the same convention the native `docs-step-list__item` buttons this
176
+ * replaces already used, so an existing `[data-selected]` CSS selector
177
+ * keeps working unchanged) and applies the library's own selected
178
+ * treatment rather than leaving every consumer to invent one.
179
+ */
180
+ selected?: boolean;
181
+ }
182
+ /**
183
+ * A list-item trigger for multi-line, rich-content rows that `Button`'s
184
+ * fixed single-line sizes cannot fit — see the file header above.
185
+ *
186
+ * `fullWidth` is not a prop here: a list-item row always spans its `<li>`,
187
+ * which is the entire reason this exists, so it's forced rather than left
188
+ * for every caller to remember.
189
+ */
190
+ export declare function ListItemButton({ leading, detail, subline, selected, variant, className, ...props }: ListItemButtonProps): import("react").JSX.Element;
@@ -1,4 +1,5 @@
1
- import type { ReactNode, Ref } from "react";
1
+ import type { ComponentProps, ReactNode, Ref } from "react";
2
+ import { Collapsible as BaseCollapsible } from "@base-ui/react/collapsible";
2
3
  export interface SeparatorProps {
3
4
  orientation?: "horizontal" | "vertical";
4
5
  /** Text or a chip centred on the line — "or", "Today", a count. */
@@ -33,6 +34,37 @@ export interface ScrollAreaProps {
33
34
  * present when you are steering, invisible when you are reading.
34
35
  */
35
36
  export declare function ScrollArea({ children, maxHeight, className }: ScrollAreaProps): import("react").JSX.Element;
37
+ export interface CollapsibleRootProps extends Omit<ComponentProps<typeof BaseCollapsible.Root>, "render"> {
38
+ }
39
+ /**
40
+ * Groups a `CollapsibleTrigger` and a `CollapsiblePanel` (or several of
41
+ * either) that can live anywhere as siblings underneath it — the headless
42
+ * counterpart to the fully-composed `Collapsible` below. Renders a plain
43
+ * `<div>` (Base UI's own default); pass `className` for whatever layout the
44
+ * trigger row and panel need to share, or leave it unset to render no box
45
+ * at all beyond that default.
46
+ */
47
+ export declare function CollapsibleRoot({ className, ...props }: CollapsibleRootProps): import("react").JSX.Element;
48
+ export interface CollapsibleTriggerProps extends Omit<ComponentProps<typeof BaseCollapsible.Trigger>, "render"> {
49
+ }
50
+ /**
51
+ * The bare trigger `<button>` half of the headless `Collapsible` parts —
52
+ * real Base UI `aria-controls`/`aria-expanded` wiring, zero imposed layout.
53
+ * Unlike `Collapsible`'s own trigger, this draws no chevron and forces no
54
+ * flex row: the caller's `children` are the ENTIRE button content, laid out
55
+ * however the caller wants (e.g. sharing a row with an unrelated `action`
56
+ * control that is NOT itself part of this button, rendered as a sibling
57
+ * outside it).
58
+ */
59
+ export declare function CollapsibleTrigger({ className, ...props }: CollapsibleTriggerProps): import("react").JSX.Element;
60
+ export interface CollapsiblePanelProps extends Omit<ComponentProps<typeof BaseCollapsible.Panel>, "render"> {
61
+ }
62
+ /**
63
+ * The bare panel half of the headless `Collapsible` parts — same
64
+ * height-animation recipe `Collapsible`'s own panel uses, with no forced
65
+ * inner padding wrapper, so the caller controls its own spacing.
66
+ */
67
+ export declare function CollapsiblePanel({ className, ...props }: CollapsiblePanelProps): import("react").JSX.Element;
36
68
  export interface CollapsibleProps {
37
69
  /**
38
70
  * The trigger's CONTENT — not a button.
@@ -64,7 +96,10 @@ export interface CollapsibleProps {
64
96
  * One disclosure, without the accordion around it.
65
97
  *
66
98
  * Height animates from `--collapsible-panel-height`, which Base UI publishes —
67
- * no measuring, no effect, no frame of lag on first open.
99
+ * no measuring, no effect, no frame of lag on first open. Built on the
100
+ * headless `CollapsibleRoot`/`CollapsibleTrigger`/`CollapsiblePanel` parts
101
+ * above — see their own doc if this fixed trigger-row-plus-nested-panel
102
+ * shape doesn't fit your consumer.
68
103
  */
69
104
  export declare function Collapsible({ trigger, defaultOpen, open, onOpenChange, triggerClassName, chevron, children, className, }: CollapsibleProps): import("react").JSX.Element;
70
105
  export interface EmptyStateProps {
@@ -0,0 +1,3 @@
1
+ import type { FocusWebProps } from "./types";
2
+ export type { FocusWebProps } from "./types";
3
+ export declare function FocusWeb<Extra = unknown>({ center, ring, parent, onSelect, onUp, renderNode, label, className, }: FocusWebProps<Extra>): import("react").JSX.Element;
@@ -0,0 +1,4 @@
1
+ export { FocusWeb } from "./FocusWeb";
2
+ export { CENTER_POSITION, PARENT_POSITION, WIDE_RING_THRESHOLD, layoutRing } from "./layout";
3
+ export type { PlacedRingNode } from "./layout";
4
+ export type { FocusNodeRenderContext, FocusNodeRenderer, FocusNodeRole, FocusWebNode, FocusWebProps, } from "./types";
@@ -0,0 +1,28 @@
1
+ /** Ids at or below this count get ONE ring; more get two concentric ones. */
2
+ export declare const WIDE_RING_THRESHOLD = 10;
3
+ /** Fixed corner slot for the "up" affordance — matches the legacy page's own
4
+ placement (`left: 7%, top: 10%`), never part of the ring itself. */
5
+ export declare const PARENT_POSITION: {
6
+ leftPct: number;
7
+ topPct: number;
8
+ };
9
+ export declare const CENTER_POSITION: {
10
+ leftPct: number;
11
+ topPct: number;
12
+ };
13
+ export interface PlacedRingNode {
14
+ id: string;
15
+ leftPct: number;
16
+ topPct: number;
17
+ /** Which concentric ring this sits on. `0` (outer) for every node while the
18
+ ring is at or below `WIDE_RING_THRESHOLD`. */
19
+ tier: 0 | 1;
20
+ }
21
+ /**
22
+ * Places `ids` (already in the caller's desired order — see `types.ts`'s
23
+ * module doc) around one or two concentric rings. Pure and total: an empty
24
+ * array places nothing, and the result is always the same length as `ids`,
25
+ * in the SAME order, so a caller can zip it back against its own node array
26
+ * by index without a lookup.
27
+ */
28
+ export declare function layoutRing(ids: readonly string[], threshold?: number): PlacedRingNode[];
@@ -0,0 +1,66 @@
1
+ import type { ReactNode } from "react";
2
+ import type { CanvasNode } from "../node-canvas/types";
3
+ /**
4
+ * One node FocusWeb draws — the centre, a ring member, or the "up" parent.
5
+ * Same `Extra`-carrying shape as `CanvasNode` everywhere else in this library
6
+ * (`node-canvas/types.ts`'s own module doc explains why): a consumer's own
7
+ * fields (an icon name, a type, a colour) come back untouched through
8
+ * `renderNode`, and the library assigns no meaning to any of them.
9
+ */
10
+ export type FocusWebNode<Extra = unknown> = CanvasNode<Extra>;
11
+ /** Which of the three roles a rendered node is playing this frame. */
12
+ export type FocusNodeRole = "center" | "ring" | "parent";
13
+ /**
14
+ * What `renderNode` is told about the node it is drawing — structural facts
15
+ * about the node's place in THIS frame's layout, mirroring
16
+ * `ExplorerNodeRenderContext` / `NodeRenderContext` elsewhere in the library.
17
+ */
18
+ export interface FocusNodeRenderContext {
19
+ role: FocusNodeRole;
20
+ /** 0-based position in `ring`, in the order the caller supplied. `null` for `center`/`parent`. */
21
+ index: number | null;
22
+ /** Which of the (possibly two) concentric rings this ring node sits on — see `layoutRing`. `null` off the ring. */
23
+ tier: 0 | 1 | null;
24
+ /** This ring node currently carries the roving tab stop. Always `false` for `center`/`parent` (neither is ring-navigable). */
25
+ isTabStop: boolean;
26
+ /**
27
+ * The viewport is narrow enough (< 640px) that FocusWeb has switched to its
28
+ * own compact layout (a taller plane, giving a wide two-tier ring more
29
+ * vertical room to spread into — PLN-12 architecture §4 "works at 375px").
30
+ * `renderNode` gets this so a custom body can shrink its own icon/label
31
+ * the same way `DefaultFocusNodeBody` shrinks itself — a body that ignores
32
+ * it still renders correctly, just at its normal size in less headroom.
33
+ */
34
+ compact: boolean;
35
+ }
36
+ export type FocusNodeRenderer<Extra = unknown> = (node: FocusWebNode<Extra>, context: FocusNodeRenderContext) => ReactNode;
37
+ export interface FocusWebProps<Extra = unknown> {
38
+ /** The node currently centred. Controlled — FocusWeb never picks its own centre. */
39
+ center: FocusWebNode<Extra>;
40
+ /**
41
+ * The centre's one-hop neighbours, already in the exact order to draw.
42
+ * FocusWeb does not sort, dedupe or reorder this — see the module doc.
43
+ */
44
+ ring: readonly FocusWebNode<Extra>[];
45
+ /** The "up" affordance's target. `null`/`undefined` at the root — no parent, no up button. */
46
+ parent?: FocusWebNode<Extra> | null;
47
+ /**
48
+ * Fired when a ring node is activated (click, or Enter/Space while it
49
+ * carries the roving tab stop). FocusWeb does not recentre itself — the
50
+ * caller responds by changing `center`/`ring`/`parent`, which is what makes
51
+ * the position change and glide.
52
+ */
53
+ onSelect: (id: string) => void;
54
+ /**
55
+ * Fired when the "up" affordance is activated. Ignored (and the button
56
+ * inert to the keyboard shortcut) while `parent` is absent — see
57
+ * `FocusWebProps.parent`.
58
+ */
59
+ onUp?: () => void;
60
+ /** Custom node body. Omit for a plain label pill — the same "falls back to
61
+ label" rule as `CanvasNode.label` everywhere else in this library. */
62
+ renderNode?: FocusNodeRenderer<Extra>;
63
+ /** Accessible name for the whole widget (an `aria-label`, `role="group"`). */
64
+ label: string;
65
+ className?: string;
66
+ }
@@ -13,6 +13,7 @@ export { Icon, type IconProps, type IconSize, type IconName } from "./components
13
13
  export { getIcon, hasIcon, iconNames, type IconNode, type IconNodeChild, } from "./lib/icons";
14
14
  export { coreIcons, type CoreIconName } from "./icons/data";
15
15
  export { Button, type ButtonProps } from "./components/Button";
16
+ export { ListItemButton, type ListItemButtonProps } from "./components/Button";
16
17
  export { IconButton, type IconButtonProps, type IconButtonVariant, type IconButtonTone, } from "./components/IconButton";
17
18
  export { Badge, type BadgeProps, type BadgeDismiss, } from "./components/Badge";
18
19
  export { Callout, type CalloutProps } from "./components/Callout";
@@ -59,7 +60,7 @@ export { PaginationBar, type PaginationBarProps, type PaginationBarMode, } from
59
60
  export { Stepper, stepStatus, stepperProgress, advanceBlockReason, assertSteps, type StepperProps, type Step, type StepStatus, type StepperProgress, } from "./components/stepper";
60
61
  export { StatusChecklist, tallyChecklist, type StatusChecklistProps, type ChecklistItem, type ChecklistState, type ChecklistTally, } from "./components/checklist";
61
62
  export { Toggle, ToggleGroup, Toolbar, ToolbarButton, ToolbarGroup, ToolbarInput, ToolbarSeparator, type ToggleProps, type ToggleGroupProps, type ToolbarProps, type ToolbarButtonProps, type ToolbarGroupProps, type ToolbarInputProps, } from "./components/Toggle";
62
- export { Separator, ScrollArea, Collapsible, EmptyState, Timeline, type SeparatorProps, type ScrollAreaProps, type CollapsibleProps, type EmptyStateProps, type TimelineProps, type TimelineItem, } from "./components/Surface";
63
+ export { Separator, ScrollArea, Collapsible, CollapsibleRoot, CollapsibleTrigger, CollapsiblePanel, EmptyState, Timeline, type SeparatorProps, type ScrollAreaProps, type CollapsibleProps, type CollapsibleRootProps, type CollapsibleTriggerProps, type CollapsiblePanelProps, type EmptyStateProps, type TimelineProps, type TimelineItem, } from "./components/Surface";
63
64
  export { PanelGroup, Panel, PanelResizer, type PanelGroupProps, type PanelProps, type PanelResizerProps, type PanelDirection, type PanelNarrowMode, } from "./components/Panel";
64
65
  export { Avatar, AvatarGroup, type AvatarProps, type AvatarGroupProps, type AvatarStatus, } from "./components/Avatar";
65
66
  export { Progress, Meter, ProgressRing, type ProgressProps, type MeterProps, type ProgressRingProps, type ProgressRingValueProps, type ProgressRingSegmentsProps, type ProgressRingSegment, type ProgressTone, } from "./components/Progress";
@@ -130,6 +131,7 @@ export { confidenceLevel, CONFIDENCE_LEVEL_LABELS, type ConfidenceLevel } from "
130
131
  export { createSimStore, resetSimStores, useSimSettings, setSimSettings, getNetworkSpeed, getDataSource, simulateLatency, SimNetworkError, type SimStore, type SimStoreOptions, type SimSettings, type NetworkSpeed, type DataSource, type SimNamespace, } from "./lib/sim";
131
132
  export { NodeCanvas, LAYOUT_DEFAULTS, edgePath, layoutGraph, neighbourhood, type NodeCanvasProps, type CanvasCycleScope, type CanvasEdge, type CanvasGraph, type CanvasGroup, type CanvasLayout, type CanvasNode, type CanvasOrientation, type CanvasPlacedEdge, type CanvasScope, type LayoutOptions, type NodeRenderContext, type NodeRenderer, type PlacedNode, } from "./components/node-canvas";
132
133
  export { GraphExplorer, frameBoxFor, layoutExplorerTree, neighbourhoodTree, CAMERA_DEFAULTS, centerOn, clampScale, fitBox, fitBoxWithFloor, toContentPoint, toScreenPoint, unionBox, zoomAtPoint, type GraphExplorerProps, type Box, type CameraState, type FitOptions, type FitWithFloorOptions, type FitWithFloorResult, type FrameOverflow, type Point, type ScaleBounds, type Size, type CrossLink, type ExplorerLayout, type ExplorerNodeRenderContext, type ExplorerNodeRenderer, type ExplorerTree, type GraphExplorerVariant, type TreeNode as ExplorerTreeNode, } from "./components/graph-explorer";
134
+ export { FocusWeb, CENTER_POSITION, PARENT_POSITION, WIDE_RING_THRESHOLD, layoutRing, type FocusNodeRenderContext, type FocusNodeRenderer, type FocusNodeRole, type FocusWebNode, type FocusWebProps, type PlacedRingNode, } from "./components/focus-web";
133
135
  export { SequenceDiagram, type SequenceDiagramProps, type SequenceStep, } from "./components/SequenceDiagram";
134
136
  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";
135
137
  export { RealtimeProvider, useRealtime, useRealtimeEpoch, useRealtimeHealth, useRealtimeRegistry, SubscriptionRegistry, normalizeScope, scopeKey, subscriptionKey, readRealtimeEpoch, subscribeToRealtimeEpoch, subscribeToRealtimeEvents, resetRealtimeSignals, type RealtimeChannel, type RealtimeConnectionState, type RealtimeDiagnostic, type RealtimeEvent, type RealtimeHealth, type RealtimeProviderProps, type RealtimeScope, type RealtimeScopeInput, type RealtimeStatus, type RealtimeTransport, type RegistryOptions, type SubscriptionHealth, type SubscriptionLease, type SubscriptionRequest, } from "./lib/realtime";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danxbot/ui",
3
- "version": "13.1.0",
3
+ "version": "13.3.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",