@usetheo/ui 0.6.3-next.0 → 0.8.0-next.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/CHANGELOG.md CHANGED
@@ -7,6 +7,206 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.8.0-next.0] - 2026-05-23
11
+
12
+ Minor — adds eight cross-cutting primitives revealed by the systematic
13
+ review of the remaining 11 dashboard pages (Projects, Environments,
14
+ Team, Billing, Domains, Settings, Profile, Login, Register,
15
+ Verification, Recovery, DeviceSuccess) + recurring PaaS UI patterns.
16
+ Each component is used in ≥3 distinct sites in the consumer dashboard.
17
+ 6 are true primitives (Table, StatusDot, CopyButton, Timestamp,
18
+ StatTile, DangerZone); 2 are composites by taxonomy gate
19
+ (ConfirmDialog depends on Dialog/Input/Button; CodeBlock depends on
20
+ CopyButton). Zero breaking change; zero new peer-deps.
21
+
22
+ Plan: `.claude/knowledge-base/plans/dashboard-paas-primitives-2-plan.md`.
23
+ Edge-case review: `.claude/knowledge-base/reviews/edge-cases/dashboard-paas-primitives-2-edge-cases-2026-05-23.md`.
24
+ Consumer brief: `theo/docs/handoff/2026-05-23-theo-ui-cloud-dashboard-gaps-brief-2.md`.
25
+
26
+ ### Added
27
+
28
+ - **`<Table>` primitive (NEW)** — semantic data-table with sub-components
29
+ `Table.Header`, `Table.Body`, `Table.Row`, `Table.Cell`,
30
+ `Table.HeaderCell`. Supports `density` (`default` / `compact` via
31
+ Context), per-cell `align` (`left` / `center` / `right`), `numeric`
32
+ cells (`font-mono tabular-nums`), and sortable header cells
33
+ (`onSort` + `sortDirection` with ChevronUp/ChevronDown affordance
34
+ + `aria-sort`). `sortDirection` without `onSort` is a no-op (header
35
+ stays static); `sortDirection="none"` with `onSort` renders both
36
+ chevrons dimmed (`opacity-30`). 10 unit tests + 4 Ladle stories.
37
+ Brief #2 consumer: TheoCloud dashboard.
38
+ - **`<StatusDot>` primitive (NEW)** — semantic status indicator
39
+ (small colored circle + optional label). Five `status` kinds:
40
+ `live` (success), `building` (warning, auto-pulses), `failed`
41
+ (destructive), `idle` (muted), `warning` (warning, static). Three
42
+ sizes (`xs` 6px / `sm` 8px default / `md` 10px). When neither
43
+ `label` nor `aria-label` is provided, auto-applies
44
+ `aria-label={status}` + emits a dev-only warning (color-only
45
+ status is invisible to screen readers). 12 unit tests + 3 stories.
46
+ Brief #2 consumer: TheoCloud dashboard (7+ sites).
47
+ - **`<CopyButton>` primitive (NEW)** — click-to-copy primitive wrapping
48
+ `navigator.clipboard.writeText`. Icon swap (Copy → Check on success,
49
+ Copy → X on failure), `aria-live="polite"` announcement for screen
50
+ readers, optional `label`, `ghost`/`outline` variants, two sizes,
51
+ `onCopied` callback, configurable `feedbackDuration` (default
52
+ 1500ms). SSR-safe (guards `navigator?.clipboard?.writeText`); HTTP
53
+ non-localhost contexts (where the Clipboard API is undefined) fall
54
+ back to the failed state instead of throwing. Auto-cleans the
55
+ revert timer on unmount; debounces double-clicks. 12 unit tests +
56
+ 4 Ladle stories. Brief #2 consumer: TheoCloud dashboard.
57
+ - **`<Timestamp>` primitive (NEW)** — accessible `<time datetime>`
58
+ element with `relative` (default) / `absolute` / `both` formats.
59
+ Uses zero-dep `Intl.RelativeTimeFormat`. Auto-refreshes via
60
+ `setInterval` (default 60s, `refreshInterval={0}` disables).
61
+ Native `title` HTML attribute carries the absolute time on hover
62
+ (no Tooltip component dependency — keeps Timestamp a true
63
+ primitive). `aria-label` always carries the full date. Invalid
64
+ date renders an empty `<time>` element; invalid locale falls back
65
+ to default with a dev warning. `value` accepts ISO string, Date,
66
+ or **Unix milliseconds** (documented in JSDoc — passing seconds
67
+ renders ~1970). 13 unit tests + 4 Ladle stories. Brief #2
68
+ consumer: TheoCloud dashboard (every dashboard page).
69
+ - **`<StatTile>` primitive (NEW)** — big-number stat tile for
70
+ dashboard summary rows. `value` + `label` + optional `icon` +
71
+ optional `delta` (`{value, trend}` with `trend: "up" | "down" |
72
+ "flat"` driving TrendingUp/TrendingDown/Minus icons and
73
+ success/destructive/muted color). Dual mode (button/div) based on
74
+ `onClick` — same pattern as `AccountMenu`/`ProjectSwitcher`. Value
75
+ uses `font-display tabular-nums whitespace-nowrap`. 7 unit tests
76
+ + 4 Ladle stories. Brief #2 consumer: TheoCloud Overview
77
+ dashboard (3 tiles per page).
78
+ - **`<DangerZone>` primitive (NEW)** — destructive-actions section
79
+ with sub-component `DangerZone.Action`. Red-bordered container
80
+ (`border-destructive/30`) with title bar (default `"Danger Zone"`)
81
+ and action rows. Each row carries `title` + `description` +
82
+ consumer-provided `action` slot (typically a destructive
83
+ `<Button>`). Rows separated by hairline dividers; last row drops
84
+ the bottom border via `last:border-b-0`. Consumer supplies the
85
+ destructive button — DangerZone never imports `<Button>`, keeping
86
+ it a true primitive. 6 unit tests + 3 Ladle stories. Brief #2
87
+ consumer: Settings + Profile + Team + Billing pages.
88
+ - **`<ConfirmDialog>` composite (NEW)** — controlled confirmation
89
+ modal built on `Dialog`. Auto-focuses Cancel on open (deliberate
90
+ — NOT the destructive button). `intent="destructive"` styles the
91
+ confirm button with the destructive variant. `confirmationPhrase`
92
+ enables typed-confirmation guard (case-sensitive, empty string
93
+ treated as no phrase). Pressing Enter in the input triggers
94
+ confirm when matched. Async `onConfirm` shows `Loader2` spinner
95
+ while pending; resolve closes the dialog; reject keeps it open
96
+ so consumers can surface their own error. Phrase input resets
97
+ whenever the dialog closes. 13 unit tests + 4 Ladle stories.
98
+ Composite (depends on Dialog + Button + Input). Brief #2
99
+ consumer: 6+ destructive flows (Settings delete, Team remove,
100
+ Billing cancel, Profile delete, Domains remove, Environments
101
+ delete).
102
+ - **`<CodeBlock>` composite (NEW)** — terminal command / code-snippet
103
+ surface. Pre-rendered code inside a `<pre>` with optional
104
+ `terminal` prefix per line (`"$ "`), optional `caption` (file
105
+ name), and optional inline `<CopyButton>` positioned top-right.
106
+ The CopyButton receives the RAW `code` (without the visual `"$ "`
107
+ prefix) — consumers paste only the executable command. `language`
108
+ prop is reserved for future syntax highlighting (v1 ignored).
109
+ 7 unit tests + 4 Ladle stories. Composite (depends on
110
+ CopyButton). Brief #2 consumer: Overview EmptyState, Projects
111
+ EmptyState, Domains DNS records, API token display, LoginPage
112
+ CLI hint.
113
+
114
+ ### Implementation notes
115
+
116
+ - **Taxonomy gate** classified ConfirmDialog + CodeBlock as composites
117
+ (D2 in the plan). Brief #2 listed all 8 as primitives, but the
118
+ validate-quality-gates.ts script is hard-fail for any
119
+ `primitives/` file that imports another `@usetheo/ui` component.
120
+ - **Timestamp uses native `title` HTML attribute** (D3) instead of
121
+ the `<Tooltip>` component, to keep the file a true primitive
122
+ without sibling-primitive imports.
123
+ - **Zero new peer-deps.** Every component uses only `lucide-react`
124
+ + Radix (both already peer) + `cn()`.
125
+ - **Bundle delta** — `dist/index.js` grew from 395763 B to 417113 B
126
+ (+21350 B / +5.4%); `dist/index.d.ts` grew +11808 B / +7.5%. Both
127
+ exceeded the ±5% tolerance by a small margin (8 components ≈ +2.5 KB
128
+ each on average). The baseline was rebaselined in the same release
129
+ (`scripts/baselines/bundle-sizes.json`) — expected and explicit per
130
+ plan D6.
131
+ - 10 SHOULD TEST edge cases from the `/edge-case-plan` review
132
+ incorporated into the TDD blocks (EC-1 through EC-10 — empty
133
+ CopyButton value, unmount during timer, clipboard undefined,
134
+ Table sort direction without onSort, dimmed affordance for
135
+ `none`, StatusDot dev warning, Timestamp Unix seconds vs ms,
136
+ invalid locale fallback, ConfirmDialog empty phrase semantics,
137
+ Enter-to-confirm in phrase input).
138
+
139
+ ## [0.7.0-next.0] - 2026-05-23
140
+
141
+ Minor — adds four PaaS-shape primitives to cover the gaps surfaced by the
142
+ TheoCloud dashboard migration: multi-metric `UsageMeter`, standalone
143
+ `Progress` bar, semantic `PlanBadge`, and sidebar `AccountMenu`. Each
144
+ primitive is a SIBLING of an existing agent-shape primitive — no breaking
145
+ changes, no modifications to current components. The library's
146
+ agent-first positioning (per `PITCH.md`) stays intact; both shapes now
147
+ coexist with TypeScript dispatch by name.
148
+
149
+ Plan: `.claude/knowledge-base/plans/dashboard-paas-primitives-plan.md`.
150
+ Consumer brief: `theo/docs/handoff/2026-05-23-theo-ui-cloud-dashboard-gaps-brief.md`.
151
+
152
+ ### Added
153
+
154
+ - **`<Progress>` primitive (NEW)** — accessible progress bar built on
155
+ `<div role="progressbar">` (not native `<progress>` — Tailwind classes
156
+ style cross-browser reliably). Variants:
157
+ - `intent`: `default` / `success` / `warning` / `destructive`
158
+ - `height`: `h-1` (default) / `h-1.5` / `h-2` / `h-3`
159
+ - `indeterminate`: animated bar with no value (omits `aria-valuenow`,
160
+ sets `aria-busy="true"`)
161
+ Clamping handles `value > max` (clamps to max) + `value < 0` (clamps to
162
+ 0) + `max = 0` (no NaN/Infinity). Respects `prefers-reduced-motion`.
163
+ 14 unit tests + 6 Ladle stories. (#TBD)
164
+ - **`<UsageMeter>` primitive (NEW)** — multi-metric stacked usage card
165
+ for PaaS dashboards. Renders N metrics (data transfer, requests, build
166
+ minutes, seats, …) each with `label + value/max + <Progress>` bar.
167
+ Supports custom per-metric `formatter`, automatic over-quota warning
168
+ (value text gets `text-warning`, `<Progress>` uses `intent="warning"`
169
+ AND clamps the bar at 100%), and a `compact` bars-only mode. PaaS-shape
170
+ sibling of `<CostMeter>` (which stays single-USD-mono for agent token
171
+ spend). 12 unit tests + 4 Ladle stories. (#TBD)
172
+ - **`<PlanBadge>` primitive (NEW)** — semantic pricing-tier badge with 5
173
+ canonical tiers (`free`, `hobby`, `pro`, `team`, `enterprise`) and two
174
+ sizes (`sm`, `md`). Each tier carries distinct color tokens. Consumers
175
+ self-document intent (`plan="hobby"`) instead of mapping a generic
176
+ `<Badge variant="outline">` to colors per app — future rebrand /
177
+ dark-mode tweaks propagate automatically. Default label capitalizes
178
+ the tier; `label` prop overrides. Runtime fallback to `free` styling
179
+ for unknown tier (TypeScript prevents this at compile time). 16 unit
180
+ tests + 2 Ladle stories. (#TBD)
181
+ - **`<AccountMenu>` primitive (NEW)** — sidebar header for PaaS surfaces.
182
+ Avatar + name + (optional) `<PlanBadge>` + (optional) secondary line.
183
+ Dual mode: with `onClick`, renders as `<button>` with trailing
184
+ `ChevronsUpDown` icon; without, renders as a static `<div>` (not
185
+ focusable, no chevron). Avatar handling auto-detects URL vs short
186
+ string (≤2 chars treated as initials) vs undefined (derives initials
187
+ from `name`). PaaS-shape sibling of `<ProjectSwitcher>` (which stays
188
+ workspace+branch+agent-status for code-agent surfaces). 13 unit tests
189
+ + 4 Ladle stories. (#TBD)
190
+
191
+ ### Notes
192
+
193
+ - **No breaking change.** `CostMeter`, `ProgressChecklist`, `Badge`,
194
+ `ProjectSwitcher` are untouched. Consumers on 0.6.x see only new
195
+ exports.
196
+ - **Taxonomy invariant preserved.** `UsageMeter → Progress` and
197
+ `AccountMenu → Avatar + PlanBadge` use relative-path imports
198
+ (`../{slug}/index.js`), not barrel imports, so primitives still have
199
+ zero `@usetheo/ui` cross-dependencies per the structural gate.
200
+ - **Bundle delta.** `dist/index.js` grows by ~6 KB (4 primitives + types
201
+ + small imports). Within the ±5% baseline tolerance (rebaselined).
202
+ - **Subpath exports.** `package.json#exports` gains `./usage-meter`,
203
+ `./progress`, `./plan-badge`, `./account-menu` per existing
204
+ convention (auto-synced by `scripts/sync-exports.ts`).
205
+ - **Registry items.** Four new `registry/r/*.json` descriptors ship for
206
+ shadcn-style copy-paste install. `usage-meter` declares `progress` as
207
+ a `registryDependencies`; `account-menu` declares `avatar` +
208
+ `plan-badge`.
209
+
10
210
  ## [0.6.3-next.0] - 2026-05-23
11
211
 
12
212
  Patch — eliminate React hydration mismatch in `<ThemeProvider>`. Reported
package/README.md CHANGED
@@ -13,8 +13,8 @@ A React component library built for AI agent surfaces and cloud dashboards. **10
13
13
  <!-- BEGIN:counts -->
14
14
  [![license](https://img.shields.io/badge/license-Apache--2.0-7C3AED?style=flat-square)](./LICENSE)
15
15
  [![react](https://img.shields.io/badge/react-18+-7C3AED?style=flat-square&logo=react&logoColor=white)](https://react.dev)
16
- [![tests](https://img.shields.io/badge/tests-1123%20passing-success?style=flat-square)](#quality-gates)
17
- [![components](https://img.shields.io/badge/components-120-7C3AED?style=flat-square)](#component-catalog)
16
+ [![tests](https://img.shields.io/badge/tests-1250%20passing-success?style=flat-square)](#quality-gates)
17
+ [![components](https://img.shields.io/badge/components-132-7C3AED?style=flat-square)](#component-catalog)
18
18
  [![shadcn](https://img.shields.io/badge/shadcn-compatible-000?style=flat-square)](https://ui.shadcn.com/docs/registry)
19
19
  <!-- END:counts -->
20
20
 
@@ -133,13 +133,13 @@ import { ThemeProvider, ThemeScript } from "@usetheo/ui";
133
133
  ## Component catalog
134
134
 
135
135
  <!-- BEGIN:component-catalog-intro -->
136
- **120 components**, organized by mechanical rule: a *primitive* imports no other `@usetheo/ui` component; a *composite* does.
136
+ **132 components**, organized by mechanical rule: a *primitive* imports no other `@usetheo/ui` component; a *composite* does.
137
137
  <!-- END:component-catalog-intro -->
138
138
 
139
139
  <details>
140
140
  <summary>
141
141
  <!-- BEGIN:primitives-count -->
142
- **Primitives** (79) — building blocks
142
+ **Primitives** (87) — building blocks
143
143
  <!-- END:primitives-count -->
144
144
  </summary>
145
145
 
@@ -147,17 +147,18 @@ import { ThemeProvider, ThemeScript } from "@usetheo/ui";
147
147
  `AgentErrorCard` · `AgentEvent` · `AgentHandoff` · `AgentProfile` · `AgentStartingState` · `AgentStreaming`
148
148
  `ArtifactPreview` · `AttachmentChip` · `AuditLogEntry` · `AutoCompactNotice` · `Avatar` · `Badge`
149
149
  `BrowserControls` · `BuildLogStream` · `Button` · `CapabilityIndicator` · `Card` · `ChatThread`
150
- `Checkbox` · `ContextCard` · `ContextWindowBar` · `CostMeter` · `CreatedFilesCard` · `CronJobCard`
151
- `Dialog` · `DiffViewer` · `EmptyState` · `FolderContextCard` · `FolderSelector` · `FormField`
152
- `HookConfig` · `HookEventLog` · `Input` · `IntentSelector` · `Label` · `LaneBoard`
153
- `LoginSplit` · `MCPServerCard` · `MemoryEditor` · `MentionMenu` · `MetricsPanel` · `ModelCard`
154
- `ModelSelector` · `PermissionMatrix` · `ProgressChecklist` · `ProjectSwitcher` · `QuickActionChips` · `RadioGroup`
155
- `RecentFoldersList` · `RuleCard` · `RunStats` · `RunningTasksPanel` · `ScrollArea` · `Select`
156
- `SessionListItem` · `SessionTimeline` · `Sheet` · `Sidebar` · `Skeleton` · `SkillCard`
157
- `SocialAuthRow` · `StepsRail` · `SubAgentDispatch` · `Switch` · `SystemPromptEditor` · `Tabs`
158
- `TaskNode` · `TaskPlan` · `TerminalPanel` · `Textarea` · `Toast` · `Toaster`
159
- `TokenUsageChart` · `ToolCall` · `ToolCallCard` · `ToolResult` · `ToolsList` · `Tooltip`
160
- `TopNav`
150
+ `Checkbox` · `ContextCard` · `ContextWindowBar` · `CopyButton` · `CostMeter` · `CreatedFilesCard`
151
+ `CronJobCard` · `DangerZone` · `Dialog` · `DiffViewer` · `EmptyState` · `FolderContextCard`
152
+ `FolderSelector` · `FormField` · `HookConfig` · `HookEventLog` · `Input` · `IntentSelector`
153
+ `Label` · `LaneBoard` · `LoginSplit` · `MCPServerCard` · `MemoryEditor` · `MentionMenu`
154
+ `MetricsPanel` · `ModelCard` · `ModelSelector` · `PermissionMatrix` · `PlanBadge` · `Progress`
155
+ `ProgressChecklist` · `ProjectSwitcher` · `QuickActionChips` · `RadioGroup` · `RecentFoldersList` · `RuleCard`
156
+ `RunStats` · `RunningTasksPanel` · `ScrollArea` · `Select` · `SessionListItem` · `SessionTimeline`
157
+ `Sheet` · `Sidebar` · `Skeleton` · `SkillCard` · `SocialAuthRow` · `StatTile`
158
+ `StatusDot` · `StepsRail` · `SubAgentDispatch` · `Switch` · `SystemPromptEditor` · `Table`
159
+ `Tabs` · `TaskNode` · `TaskPlan` · `TerminalPanel` · `Textarea` · `Timestamp`
160
+ `Toast` · `Toaster` · `TokenUsageChart` · `ToolCall` · `ToolCallCard` · `ToolResult`
161
+ `ToolsList` · `Tooltip` · `TopNav`
161
162
  <!-- END:primitives -->
162
163
 
163
164
  </details>
@@ -165,12 +166,12 @@ import { ThemeProvider, ThemeScript } from "@usetheo/ui";
165
166
  <details>
166
167
  <summary>
167
168
  <!-- BEGIN:composites-count -->
168
- **Composites** (41) — assembled flows
169
+ **Composites** (45) — assembled flows
169
170
  <!-- END:composites-count -->
170
171
  </summary>
171
172
 
172
173
  <!-- BEGIN:composites -->
173
- `AgentComposer` · `AgentEditor` · `AgentStream` · `AgentTimeline` · `ApprovalCard` · `ChatComposer` · `ChatMessage` · `ChatMessageAction` · `ChatMessageActions` · `ChatMessageBranch` · `ChatMessageBranchContent` · `ChatMessageBranchNext` · `ChatMessageBranchPage` · `ChatMessageBranchPrevious` · `ChatMessageBranchSelector` · `ChatMessageContent` · `ChatMessageResponse` · `ChatMessageRoot` · `ChatMessageToolbar` · `CommandPalette` · `CronJobsList` · `DataPart` · `DeploymentRow` · `DomainConfig` · `EnvVarEditor` · `FilePart` · `MCPServerList` · `PermissionModal` · `PreviewEnvCard` · `PreviewPanel` · `ProjectCard` · `ReasoningPart` · `RollbackUI` · `RuleEditor` · `SkillEditor` · `SkillsList` · `SourceDocumentPart` · `SourceUrlPart` · `TaskHeader` · `TextPart` · `ToolCallPart`
174
+ `AccountMenu` · `AgentComposer` · `AgentEditor` · `AgentStream` · `AgentTimeline` · `ApprovalCard` · `ChatComposer` · `ChatMessage` · `ChatMessageAction` · `ChatMessageActions` · `ChatMessageBranch` · `ChatMessageBranchContent` · `ChatMessageBranchNext` · `ChatMessageBranchPage` · `ChatMessageBranchPrevious` · `ChatMessageBranchSelector` · `ChatMessageContent` · `ChatMessageResponse` · `ChatMessageRoot` · `ChatMessageToolbar` · `CodeBlock` · `CommandPalette` · `ConfirmDialog` · `CronJobsList` · `DataPart` · `DeploymentRow` · `DomainConfig` · `EnvVarEditor` · `FilePart` · `MCPServerList` · `PermissionModal` · `PreviewEnvCard` · `PreviewPanel` · `ProjectCard` · `ReasoningPart` · `RollbackUI` · `RuleEditor` · `SkillEditor` · `SkillsList` · `SourceDocumentPart` · `SourceUrlPart` · `TaskHeader` · `TextPart` · `ToolCallPart` · `UsageMeter`
174
175
  <!-- END:composites -->
175
176
 
176
177
  </details>