@usetheo/ui 0.6.2-next.0 → 0.7.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,135 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.7.0-next.0] - 2026-05-23
11
+
12
+ Minor — adds four PaaS-shape primitives to cover the gaps surfaced by the
13
+ TheoCloud dashboard migration: multi-metric `UsageMeter`, standalone
14
+ `Progress` bar, semantic `PlanBadge`, and sidebar `AccountMenu`. Each
15
+ primitive is a SIBLING of an existing agent-shape primitive — no breaking
16
+ changes, no modifications to current components. The library's
17
+ agent-first positioning (per `PITCH.md`) stays intact; both shapes now
18
+ coexist with TypeScript dispatch by name.
19
+
20
+ Plan: `.claude/knowledge-base/plans/dashboard-paas-primitives-plan.md`.
21
+ Consumer brief: `theo/docs/handoff/2026-05-23-theo-ui-cloud-dashboard-gaps-brief.md`.
22
+
23
+ ### Added
24
+
25
+ - **`<Progress>` primitive (NEW)** — accessible progress bar built on
26
+ `<div role="progressbar">` (not native `<progress>` — Tailwind classes
27
+ style cross-browser reliably). Variants:
28
+ - `intent`: `default` / `success` / `warning` / `destructive`
29
+ - `height`: `h-1` (default) / `h-1.5` / `h-2` / `h-3`
30
+ - `indeterminate`: animated bar with no value (omits `aria-valuenow`,
31
+ sets `aria-busy="true"`)
32
+ Clamping handles `value > max` (clamps to max) + `value < 0` (clamps to
33
+ 0) + `max = 0` (no NaN/Infinity). Respects `prefers-reduced-motion`.
34
+ 14 unit tests + 6 Ladle stories. (#TBD)
35
+ - **`<UsageMeter>` primitive (NEW)** — multi-metric stacked usage card
36
+ for PaaS dashboards. Renders N metrics (data transfer, requests, build
37
+ minutes, seats, …) each with `label + value/max + <Progress>` bar.
38
+ Supports custom per-metric `formatter`, automatic over-quota warning
39
+ (value text gets `text-warning`, `<Progress>` uses `intent="warning"`
40
+ AND clamps the bar at 100%), and a `compact` bars-only mode. PaaS-shape
41
+ sibling of `<CostMeter>` (which stays single-USD-mono for agent token
42
+ spend). 12 unit tests + 4 Ladle stories. (#TBD)
43
+ - **`<PlanBadge>` primitive (NEW)** — semantic pricing-tier badge with 5
44
+ canonical tiers (`free`, `hobby`, `pro`, `team`, `enterprise`) and two
45
+ sizes (`sm`, `md`). Each tier carries distinct color tokens. Consumers
46
+ self-document intent (`plan="hobby"`) instead of mapping a generic
47
+ `<Badge variant="outline">` to colors per app — future rebrand /
48
+ dark-mode tweaks propagate automatically. Default label capitalizes
49
+ the tier; `label` prop overrides. Runtime fallback to `free` styling
50
+ for unknown tier (TypeScript prevents this at compile time). 16 unit
51
+ tests + 2 Ladle stories. (#TBD)
52
+ - **`<AccountMenu>` primitive (NEW)** — sidebar header for PaaS surfaces.
53
+ Avatar + name + (optional) `<PlanBadge>` + (optional) secondary line.
54
+ Dual mode: with `onClick`, renders as `<button>` with trailing
55
+ `ChevronsUpDown` icon; without, renders as a static `<div>` (not
56
+ focusable, no chevron). Avatar handling auto-detects URL vs short
57
+ string (≤2 chars treated as initials) vs undefined (derives initials
58
+ from `name`). PaaS-shape sibling of `<ProjectSwitcher>` (which stays
59
+ workspace+branch+agent-status for code-agent surfaces). 13 unit tests
60
+ + 4 Ladle stories. (#TBD)
61
+
62
+ ### Notes
63
+
64
+ - **No breaking change.** `CostMeter`, `ProgressChecklist`, `Badge`,
65
+ `ProjectSwitcher` are untouched. Consumers on 0.6.x see only new
66
+ exports.
67
+ - **Taxonomy invariant preserved.** `UsageMeter → Progress` and
68
+ `AccountMenu → Avatar + PlanBadge` use relative-path imports
69
+ (`../{slug}/index.js`), not barrel imports, so primitives still have
70
+ zero `@usetheo/ui` cross-dependencies per the structural gate.
71
+ - **Bundle delta.** `dist/index.js` grows by ~6 KB (4 primitives + types
72
+ + small imports). Within the ±5% baseline tolerance (rebaselined).
73
+ - **Subpath exports.** `package.json#exports` gains `./usage-meter`,
74
+ `./progress`, `./plan-badge`, `./account-menu` per existing
75
+ convention (auto-synced by `scripts/sync-exports.ts`).
76
+ - **Registry items.** Four new `registry/r/*.json` descriptors ship for
77
+ shadcn-style copy-paste install. `usage-meter` declares `progress` as
78
+ a `registryDependencies`; `account-menu` declares `avatar` +
79
+ `plan-badge`.
80
+
81
+ ## [0.6.3-next.0] - 2026-05-23
82
+
83
+ Patch — eliminate React hydration mismatch in `<ThemeProvider>`. Reported
84
+ by the TheoKit framework team (2026-05-23): every SSR'd app using
85
+ `<ThemeSwitcher>` threw `Hydration failed because the server rendered
86
+ text didn't match the client` on every page reload after a user had
87
+ changed themes, then re-rendered the entire React tree client-side,
88
+ defeating SSR.
89
+
90
+ ### Fixed
91
+
92
+ - **SSR hydration mismatch on `<ThemeProvider>`** — three `useState`
93
+ calls (`themeName`, `mode`, `density`) previously ran their initializer
94
+ on BOTH server (no `window`, returned default) AND client at hydration
95
+ time (with `window`, returned `localStorage.getItem(…)`). The two
96
+ diverged → React threw + discarded the SSR'd tree on every page load.
97
+ Fixed by initializing with the SSR default ALWAYS, then promoting to
98
+ the stored value via a post-mount `useEffect` after hydration. The
99
+ visible-text nodes the React reconciler compares (switcher label,
100
+ `sr-only` announcement, `aria-label`) now match server → client.
101
+ Stored preferences still apply within one render tick of mount;
102
+ `<ThemeScript>` continues to set `data-theme` / `data-mode` /
103
+ `data-density` on `<html>` before React mounts to suppress the
104
+ 1-frame visual flicker. (#TBD)
105
+ - **Persist effect first-mount guard** — a `useRef`-based skip-first
106
+ flag prevents the persist effect from writing the SSR-safe defaults
107
+ to `localStorage` between mount and the post-mount hydration
108
+ setState. Previously, the brief window between commit and the
109
+ hydration effect could clobber the user's stored preference if the
110
+ page closed mid-render. After the first call, every subsequent
111
+ change (user-driven OR hydration-promoted) persists normally. (#TBD)
112
+
113
+ ### Added
114
+
115
+ - **`<ThemeScript defaultDensity>` prop** — the inline `<script>`
116
+ bootstrap now also sets `data-density` on `<html>` from
117
+ `localStorage.getItem(":density")` (or `defaultDensity`, default
118
+ `"comfortable"`) so density-driven layouts have zero FOUC at first
119
+ paint. Mirrors `ThemeProvider`'s `defaultDensity`. (#TBD)
120
+
121
+ ### Notes
122
+
123
+ - Pattern mirrors `next-themes` (Vercel), `MantineProvider`, and
124
+ shadcn/ui's theme scaffold. The 1-frame state-promotion delay is the
125
+ React-canonical price for SSR-safe client-only state. `<ThemeScript>`
126
+ pre-paints the `<html>` attributes so the visible layer doesn't
127
+ flicker.
128
+ - Two new unit tests guard the regression:
129
+ - `does NOT write to localStorage on first mount when nothing changes
130
+ (persist gate)` — verifies the skip-first guard.
131
+ - `writes to localStorage AFTER a user-driven change (persist fires
132
+ post-hydration)` — verifies the gate releases after the first call.
133
+ - Existing `reads initial theme name from localStorage` and `reads
134
+ initial mode from localStorage` tests continue to pass because
135
+ testing-library's `render()` flushes effects synchronously inside
136
+ `act()`, so by the assertion phase the post-mount hydration effect
137
+ has already promoted the stored value.
138
+
10
139
  ## [0.6.2-next.0] - 2026-05-23
11
140
 
12
141
  Patch — restore `cursor: pointer` on interactive buttons. Tailwind v4
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-1174%20passing-success?style=flat-square)](#quality-gates)
17
+ [![components](https://img.shields.io/badge/components-124-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
+ **124 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** (81) — building blocks
143
143
  <!-- END:primitives-count -->
144
144
  </summary>
145
145
 
@@ -151,13 +151,13 @@ import { ThemeProvider, ThemeScript } from "@usetheo/ui";
151
151
  `Dialog` · `DiffViewer` · `EmptyState` · `FolderContextCard` · `FolderSelector` · `FormField`
152
152
  `HookConfig` · `HookEventLog` · `Input` · `IntentSelector` · `Label` · `LaneBoard`
153
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`
154
+ `ModelSelector` · `PermissionMatrix` · `PlanBadge` · `Progress` · `ProgressChecklist` · `ProjectSwitcher`
155
+ `QuickActionChips` · `RadioGroup` · `RecentFoldersList` · `RuleCard` · `RunStats` · `RunningTasksPanel`
156
+ `ScrollArea` · `Select` · `SessionListItem` · `SessionTimeline` · `Sheet` · `Sidebar`
157
+ `Skeleton` · `SkillCard` · `SocialAuthRow` · `StepsRail` · `SubAgentDispatch` · `Switch`
158
+ `SystemPromptEditor` · `Tabs` · `TaskNode` · `TaskPlan` · `TerminalPanel` · `Textarea`
159
+ `Toast` · `Toaster` · `TokenUsageChart` · `ToolCall` · `ToolCallCard` · `ToolResult`
160
+ `ToolsList` · `Tooltip` · `TopNav`
161
161
  <!-- END:primitives -->
162
162
 
163
163
  </details>
@@ -165,12 +165,12 @@ import { ThemeProvider, ThemeScript } from "@usetheo/ui";
165
165
  <details>
166
166
  <summary>
167
167
  <!-- BEGIN:composites-count -->
168
- **Composites** (41) — assembled flows
168
+ **Composites** (43) — assembled flows
169
169
  <!-- END:composites-count -->
170
170
  </summary>
171
171
 
172
172
  <!-- 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`
173
+ `AccountMenu` · `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` · `UsageMeter`
174
174
  <!-- END:composites -->
175
175
 
176
176
  </details>