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