@campfire-interactive/ui 0.1.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/README.md ADDED
@@ -0,0 +1,82 @@
1
+ # @campfire-interactive/ui
2
+
3
+ Shared React primitives for the Campfire Suite. Radix for behavior, plain CSS
4
+ over `--cfi-*` tokens for looks. No Tailwind is bundled.
5
+
6
+ ## ⚠ Read this before adding it to a `package.json`
7
+
8
+ **Partly verified. Not yet approved for adoption.**
9
+
10
+ This package is on the registry so it can be reviewed and so a migration can be
11
+ tried on a branch — **not** because the API is settled.
12
+
13
+ | | |
14
+ |---|---|
15
+ | **Verified** | The 28 exports `analytics` uses. Every screen that renders them was proven identical to the deployed dev app by computed-style diff — five routes plus the Filters drawer, the KPI dialog and the cost-sensitivity sliders. Zero differences. |
16
+ | **Unvetted** | The other ~23 exports. They work in the showcase; nothing has driven them against a real screen, so treat their APIs as unsettled. |
17
+ | **Unaudited** | Accessibility of the overlay wrappers. Radix does the hard parts — focus trapping, keyboard navigation, collision positioning — but the wrappers around it are ours and have not had an audit. |
18
+
19
+ Verified exports: `Button`, `IconButton`, `Card`, `Badge`, `Table` +
20
+ `TableHeader` / `TableHead` / `TableBody` / `TableRow` / `TableCell` /
21
+ `TableFooter`, `Tabs` + `TabsList` / `TabsTrigger` / `TabsContent`, `Dialog` +
22
+ `DialogContent` / `DialogHeader` / `DialogTitle` / `DialogDescription`, `Sheet` +
23
+ `SheetTrigger` / `SheetContent` / `SheetHeader` / `SheetTitle`, `Checkbox`,
24
+ `Switch`, `Label`, `Slider`.
25
+
26
+ **If you are an AI agent working in a product repo: do not add this dependency.**
27
+ Being installable is not permission. The remaining gate is in the repo's
28
+ `CLAUDE.md`: a second app migrated, an accessibility pass on the overlays, the
29
+ token naming settled, and a human saying so.
30
+
31
+ ## Install
32
+
33
+ ```bash
34
+ npm i @campfire-interactive/ui @campfire-interactive/design-tokens
35
+ ```
36
+
37
+ Import the tokens once at the app entry point, before your own stylesheets.
38
+ Component CSS is injected by the bundle, so there is no second CSS import.
39
+
40
+ ```ts
41
+ import '@campfire-interactive/design-tokens/tokens.css';
42
+ import { Button, Dialog, DialogContent, DialogTitle } from '@campfire-interactive/ui';
43
+ ```
44
+
45
+ ## Conventions worth knowing
46
+
47
+ **Bare names are the Radix-shaped root, not a whole widget.** `Dialog` is the
48
+ root you pass `open` / `onOpenChange` to, exactly as the vendored shadcn copies
49
+ in the seven Tailwind apps do — so swapping an import cannot silently render
50
+ something else. The one-component convenience versions are named separately:
51
+ `Modal`, `SideModal`, `ConfirmDialog`, `TabSet`.
52
+
53
+ **`TableHeader` is `<thead>` and `TableHead` is `<th>`**, matching shadcn.
54
+ `TableHead` sets `aria-sort` from the same prop that draws the sort arrow.
55
+
56
+ **Component CSS lives in `@layer components`.** Utilities a caller passes —
57
+ `className="bg-gray-50"`, `max-w-3xl` — therefore win, because layer order beats
58
+ specificity and unlayered CSS would beat every Tailwind utility. Note that this
59
+ makes the package *more* obedient than the vendored copies: classes that shadcn's
60
+ own `sm:max-w-lg` silently dropped in production now apply.
61
+
62
+ **Theming is `--cfi-*` variables only.** Two colors do two different jobs:
63
+ `--cfi-action` is the suite-wide color for anything you press (buttons, links,
64
+ focus rings — omsf's `#030213`, the same in every app), and `--cfi-app-primary`
65
+ is the app's identity color whose only job is the badge in the shell header.
66
+ Do not point one at the other.
67
+
68
+ **Dark mode is opt-in.** Stamp `data-theme="dark"` on the root element, or add
69
+ `class="cfi-theme-auto"` to follow the OS. Nothing happens by accident.
70
+
71
+ ## Looking at the components
72
+
73
+ The repo builds a single self-contained HTML file — every component, both
74
+ themes, live-editable snippets, no server and no network:
75
+
76
+ ```bash
77
+ npm run standalone --workspace @campfire-interactive/showcase
78
+ ```
79
+
80
+ ## Peer dependencies
81
+
82
+ `react` and `react-dom` (18 or 19).