@catiarodrigues/goldfinch 1.0.0 → 1.0.1

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.
@@ -0,0 +1,229 @@
1
+ ---
2
+ name: goldfinch
3
+ description: Use when building or editing UI in a project that has @catiarodrigues/goldfinch installed (or when asked to add it) — a React component library on Base UI + Tailwind CSS v4. Covers import conventions, compound-component APIs, router/portal setup, and theming, so components are used correctly instead of guessed at.
4
+ ---
5
+
6
+ # Goldfinch
7
+
8
+ React component library on [Base UI](https://base-ui.com/) primitives + Tailwind CSS v4.
9
+ 36 components, accessible by default (ARIA, keyboard nav, focus management already handled —
10
+ don't add redundant `aria-*` unless overriding real custom behavior).
11
+
12
+ ## Setup
13
+
14
+ ```bash
15
+ pnpm add @catiarodrigues/goldfinch
16
+ ```
17
+
18
+ Only real peer deps are `react`/`react-dom` (>=18) — `@phosphor-icons/react`, `@base-ui/react`,
19
+ `clsx`, `tailwind-merge` all come along as regular dependencies, don't install them separately.
20
+
21
+ Import the stylesheet **once**, at the app root:
22
+
23
+ ```tsx
24
+ import "@catiarodrigues/goldfinch/styles";
25
+ ```
26
+
27
+ The consuming project does **not** need Tailwind installed — all utility CSS is pre-built into
28
+ that stylesheet. Tailwind is only relevant if the project wants to hand-write its own classes
29
+ alongside Goldfinch's.
30
+
31
+ ## Imports
32
+
33
+ ```tsx
34
+ // Barrel — simplest, fine for most apps
35
+ import { Button, Input, Modal } from "@catiarodrigues/goldfinch";
36
+
37
+ // Granular — tree-shakeable, one component per import
38
+ import { Button } from "@catiarodrigues/goldfinch/components/button";
39
+ ```
40
+
41
+ ## Compound components
42
+
43
+ Sub-parts are attached directly to the import (`Modal.Trigger`, not a separate import). This is
44
+ the #1 thing to get right — don't invent prop-based APIs for things that are actually compound
45
+ children.
46
+
47
+ | Component | Sub-parts |
48
+ | --- | --- |
49
+ | `Modal` | `.Root` `.Trigger` `.Title` `.Description` `.Close` |
50
+ | `Popover` | `.Trigger` `.Content` `.Title` `.Description` `.Close` |
51
+ | `DropdownMenu` | `.Trigger` `.Portal` `.Content` `.Item` `.LinkItem` `.CheckboxItem` `.RadioGroup` `.RadioItem` `.RadioItemIndicator` `.Label` `.Separator` `.Shortcut` `.Group` `.Sub` `.SubTrigger` `.SubContent` |
52
+ | `Select` | `.Option` `.Group` `.GroupLabel` `.Separator` |
53
+ | `Checkbox` | `.Item` `.Group` `.Legend` |
54
+ | `Radio` | `.Item` `.Group` `.Legend` |
55
+ | `Toggle` | `.Item` `.Group` `.Legend` |
56
+ | `Input` | `.Group` (= `InputGroup`) `.Sensitive` (= `SensitiveInput`) |
57
+ | `InputGroup` | `.Input` `.Button` `.Addon` `.Suffix` |
58
+ | `Toolbar` | `.Button` `.Input` `.InputGroup` |
59
+ | `Table` | `.Header` `.Head` `.Row` `.Body` `.Cell` `.CheckCell` `.CheckHead` `.Footer` `.ResizeHandle` |
60
+ | `Page` | `.Title` `.Description` `.Breadcrumbs` |
61
+ | `Pagination` | `.Info` `.PageSize` `.Controls` `.Separator` |
62
+ | `Collapsible` | `.Root` `.Trigger` `.Panel` |
63
+ | `Card` | `.Primary` `.Secondary` |
64
+ | `Link` | `.ExternalIcon` |
65
+ | `TopNavigation` | `.Logo` `.Nav` `.NavItem` `.Actions` |
66
+ | `TableOfContents` | `.Title` `.List` `.Item` `.Group` |
67
+ | `Sidebar` | `.Provider` `.Header` `.Content` `.Footer` `.Group` `.GroupLabel` `.Menu` `.MenuItem` `.MenuButton` `.MenuBadge` `.MenuSub` `.MenuSubItem` `.MenuSubButton` `.Separator` `.Trigger` `.Rail` `.Collapsible` `.CollapsibleTrigger` `.CollapsibleContent` |
68
+
69
+ ### Worked examples
70
+
71
+ ```tsx
72
+ // Modal — Root controls open state, content lives in the default export
73
+ <Modal.Root open={open} onOpenChange={setOpen}>
74
+ <Modal.Trigger><Button>Open</Button></Modal.Trigger>
75
+ <Modal size="sm">
76
+ <Modal.Title>Confirm</Modal.Title>
77
+ <Modal.Description>Are you sure?</Modal.Description>
78
+ <Modal.Close><Button>Close</Button></Modal.Close>
79
+ </Modal>
80
+ </Modal.Root>
81
+
82
+ // Select — items prop auto-generates options, OR compose Select.Option by hand
83
+ <Select label="Country" items={{ us: "United States", uk: "United Kingdom" }} />
84
+ // equivalent, for custom rendering per option:
85
+ <Select label="Country">
86
+ <Select.Option value="us">United States</Select.Option>
87
+ <Select.Option value="uk">United Kingdom</Select.Option>
88
+ </Select>
89
+
90
+ // Checkbox.Group for a labeled set; Checkbox alone for a single bare checkbox
91
+ <Checkbox.Group legend="Notifications" defaultValue={["email"]}>
92
+ <Checkbox.Item label="Email" value="email" />
93
+ <Checkbox.Item label="SMS" value="sms" />
94
+ </Checkbox.Group>
95
+
96
+ // InputGroup merges adjacent controls into one visual unit
97
+ <InputGroup>
98
+ <InputGroup.Input placeholder="Search…" aria-label="Search" />
99
+ <InputGroup.Button variant="primary">Go</InputGroup.Button>
100
+ </InputGroup>
101
+
102
+ // Sidebar — Provider wraps the app shell, collapsible="none" for a static panel
103
+ <Sidebar.Provider defaultOpen>
104
+ <Sidebar>
105
+ <Sidebar.Header>App name</Sidebar.Header>
106
+ <Sidebar.Content>
107
+ <Sidebar.Menu>
108
+ <Sidebar.MenuItem>
109
+ <Sidebar.MenuButton href="/dashboard">Dashboard</Sidebar.MenuButton>
110
+ </Sidebar.MenuItem>
111
+ </Sidebar.Menu>
112
+ </Sidebar.Content>
113
+ </Sidebar>
114
+ </Sidebar.Provider>
115
+ ```
116
+
117
+ ## Toasts
118
+
119
+ `Toasty` (alias `ToastProvider`) wraps the subtree that needs to trigger toasts; call
120
+ `useGoldfinchToastManager()` from inside it, not from the same component that renders `Toasty`.
121
+
122
+ ```tsx
123
+ function App() {
124
+ return (
125
+ <Toasty>
126
+ <Page />
127
+ </Toasty>
128
+ );
129
+ }
130
+
131
+ function SaveButton() {
132
+ const toast = useGoldfinchToastManager();
133
+ return (
134
+ <Button onClick={() => toast.add({ title: "Saved", description: "Changes saved." })}>
135
+ Save
136
+ </Button>
137
+ );
138
+ }
139
+ ```
140
+
141
+ ## Router integration
142
+
143
+ `Link`, `Breadcrumbs`, and `Sidebar.MenuButton` render a plain `<a>` by default. To route through
144
+ React Router / Next.js `Link` / etc. instead, wrap the app in `LinkProvider` once:
145
+
146
+ ```tsx
147
+ import { LinkProvider } from "@catiarodrigues/goldfinch";
148
+ import { Link as RouterLink } from "react-router-dom"; // or your router's Link
149
+
150
+ <LinkProvider component={RouterLink}>
151
+ <App />
152
+ </LinkProvider>;
153
+ ```
154
+
155
+ Don't manually swap `<a href>` for the router's Link inside individual Goldfinch usages — set
156
+ the provider once at the root instead.
157
+
158
+ ## Rendering overlays into Shadow DOM / a custom container
159
+
160
+ Only needed inside a web component or when portalling outside `document.body`. `Modal`, `Toast`,
161
+ `Popover`, `Tooltip`, `Dropdown`, and `Select` all read this automatically:
162
+
163
+ ```tsx
164
+ import { GoldfinchPortalProvider } from "@catiarodrigues/goldfinch";
165
+
166
+ <GoldfinchPortalProvider container={shadowRootRef}>
167
+ <App />
168
+ </GoldfinchPortalProvider>;
169
+ ```
170
+
171
+ Most apps never need this — skip it unless there's an actual Shadow DOM / custom-container
172
+ requirement.
173
+
174
+ ## Theming
175
+
176
+ - Colors are CSS custom properties (`--color-goldfinch-*`), already light/dark aware via
177
+ `light-dark()` — don't hardcode hex colors when composing with Goldfinch components, use the
178
+ same tokens (`bg-goldfinch-base`, `text-goldfinch-subtle`, `border-goldfinch-hairline`, etc.)
179
+ so custom markup matches.
180
+ - Every component accepts `className`, merged safely via `tailwind-merge` — overriding a utility
181
+ class (e.g. `<Button className="px-8">`) replaces the conflicting default rather than fighting
182
+ it with `!important`.
183
+ - Size/variant props are plain strings (`size="sm"`, `variant="primary"`) — check the specific
184
+ component's prop types for the exact allowed values rather than assuming a shared enum across
185
+ components (sizes differ: some use `xs/sm/base/lg`, others `sm/md/lg`).
186
+
187
+ ## Components
188
+
189
+ | Component | Granular import |
190
+ | --- | --- |
191
+ | Alert | `components/alert` |
192
+ | Badge | `components/badge` |
193
+ | Breadcrumbs | `components/breadcrumbs` |
194
+ | Button | `components/button` |
195
+ | Card | `components/card` |
196
+ | Checkbox | `components/checkbox` |
197
+ | Collapsible | `components/collapsible` |
198
+ | CopyToClipboard | `components/copy-to-clipboard` |
199
+ | Dropdown | `components/dropdown` |
200
+ | EmptyState | `components/empty-state` |
201
+ | Field | `components/field` |
202
+ | Grid | `components/grid` |
203
+ | Input | `components/input` |
204
+ | InputGroup | `components/input-group` |
205
+ | Label | `components/label` |
206
+ | Link | `components/link` |
207
+ | Menubar | `components/menubar` |
208
+ | Modal | `components/modal` |
209
+ | Page | `components/page` |
210
+ | Pagination | `components/pagination` |
211
+ | Popover | `components/popover` |
212
+ | Progress | `components/progress` |
213
+ | Radio | `components/radio` |
214
+ | Select | `components/select` |
215
+ | SensitiveInput | `components/sensitive-input` |
216
+ | Sidebar | `components/sidebar` |
217
+ | Spinner | `components/spinner` |
218
+ | Table | `components/table` |
219
+ | TableOfContents | `components/table-of-contents` |
220
+ | Tabs | `components/tabs` |
221
+ | Text | `components/text` |
222
+ | Toast | `components/toast` |
223
+ | Toggle | `components/toggle` |
224
+ | Toolbar | `components/toolbar` |
225
+ | Tooltip | `components/tooltip` |
226
+ | TopNavigation | `components/top-navigation` |
227
+
228
+ Full API reference, props tables, and live examples for every component:
229
+ **[goldfinch.catiarodrigues.dev](https://goldfinch.catiarodrigues.dev/)**
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Goldfinch
2
2
 
3
+ [![npm](https://img.shields.io/npm/v/%40catiarodrigues%2Fgoldfinch.svg)](https://www.npmjs.com/package/@catiarodrigues/goldfinch)
4
+
3
5
  A React component library built on [Base UI](https://base-ui.com/) and Tailwind CSS v4. Accessible, composable, themeable components with keyboard navigation, focus management, and ARIA attributes handled out of the box.
4
6
 
5
7
  ## Features
@@ -27,7 +29,7 @@ pnpm add @catiarodrigues/goldfinch
27
29
  ### Peer Dependencies
28
30
 
29
31
  ```bash
30
- pnpm add react react-dom @phosphor-icons/react
32
+ pnpm add react react-dom
31
33
  ```
32
34
 
33
35
  ## Usage
@@ -88,13 +90,26 @@ import { Button } from "@catiarodrigues/goldfinch/components/button";
88
90
 
89
91
  ## Documentation
90
92
 
91
- Browse interactive docs and live examples by running the docs site locally:
93
+ Full docs, props tables, and live examples: **[goldfinch.catiarodrigues.dev](https://goldfinch.catiarodrigues.dev/)**
94
+
95
+ To run the docs site locally instead:
92
96
 
93
97
  ```bash
94
98
  cd packages/goldfinch-docs-astro
95
99
  pnpm dev
96
100
  ```
97
101
 
102
+ ## AI agent skill
103
+
104
+ The package ships a [Claude Code skill](https://code.claude.com/docs/en/skills) with import
105
+ conventions, compound-component APIs, and setup patterns, so an agent uses Goldfinch correctly
106
+ instead of guessing. After installing, copy it into your project:
107
+
108
+ ```bash
109
+ mkdir -p .claude/skills
110
+ cp -r node_modules/@catiarodrigues/goldfinch/.claude/skills/goldfinch .claude/skills/goldfinch
111
+ ```
112
+
98
113
  ## Development
99
114
 
100
115
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@catiarodrigues/goldfinch",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Goldfinch - A React component library built on Base UI and Tailwind CSS v4",
5
5
  "homepage": "https://goldfinch.catiarodrigues.dev/",
6
6
  "bugs": "https://github.com/catiarodrigues/goldfinch/issues",
@@ -181,7 +181,8 @@
181
181
  },
182
182
  "files": [
183
183
  "dist",
184
- "README.md"
184
+ "README.md",
185
+ ".claude/skills"
185
186
  ],
186
187
  "sideEffects": [
187
188
  "*.css",