@coderabbitai/carrot-ui 0.1.19
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 +86 -0
- package/dist/index.d.ts +1821 -0
- package/dist/index.js +2731 -0
- package/package.json +83 -0
- package/src/scales.css +198 -0
- package/src/styles.css +13 -0
- package/src/theme.css +433 -0
package/README.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Carrot UI
|
|
2
|
+
|
|
3
|
+
React component library for CodeRabbit. Built on [Base UI](https://base-ui.com/), styled with [Tailwind CSS v4](https://tailwindcss.com/), themed with an OKLCH color system.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
### 1. Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add @coderabbitai/carrot-ui
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Peer dependencies:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add react react-dom tailwindcss @tailwindcss/vite
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### 2. Configure CSS
|
|
20
|
+
|
|
21
|
+
In your CSS entry point (e.g. `index.css`):
|
|
22
|
+
|
|
23
|
+
```css
|
|
24
|
+
@import "tailwindcss";
|
|
25
|
+
@import "@coderabbitai/carrot-ui/css";
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
This imports the theme tokens, color scales, dark mode variant, and tells Tailwind to scan the library for utility classes.
|
|
29
|
+
|
|
30
|
+
### 3. Set up Vite
|
|
31
|
+
|
|
32
|
+
Add the Tailwind CSS Vite plugin:
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import tailwindcss from "@tailwindcss/vite"
|
|
36
|
+
|
|
37
|
+
export default defineConfig({
|
|
38
|
+
plugins: [tailwindcss(), react()],
|
|
39
|
+
})
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 4. Dark mode
|
|
43
|
+
|
|
44
|
+
Carrot UI uses `data-theme="dark"` for dark mode. It must be set on the `<html>` element so CSS variable overrides resolve correctly at `:root`:
|
|
45
|
+
|
|
46
|
+
```html
|
|
47
|
+
<html data-theme="dark">
|
|
48
|
+
...
|
|
49
|
+
</html>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
In React, set it on `document.documentElement`:
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
document.documentElement.setAttribute("data-theme", "dark")
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Usage
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
import { Button, Badge, Avatar } from "@coderabbitai/carrot-ui"
|
|
62
|
+
|
|
63
|
+
function App() {
|
|
64
|
+
return (
|
|
65
|
+
<div className="bg-cui-base-1 text-cui-primary min-h-screen p-8">
|
|
66
|
+
<Button>Click me</Button>
|
|
67
|
+
<Badge variant="accent">New</Badge>
|
|
68
|
+
<Avatar seed="user@example.com" />
|
|
69
|
+
</div>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Development
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
pnpm install
|
|
78
|
+
pnpm dev # playground dev server
|
|
79
|
+
pnpm build # library build (dist/)
|
|
80
|
+
pnpm typecheck # type checking
|
|
81
|
+
pnpm lint # linting
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Publishing
|
|
85
|
+
|
|
86
|
+
Publishing runs when a `v*` tag is pushed. The workflow publishes to GitHub Packages and the public npm registry, then creates a GitHub release with the packed tarball.
|