@7onic-ui/react 0.1.0 → 0.2.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 +120 -166
- package/dist/chart.d.mts +163 -0
- package/dist/chart.d.ts +163 -0
- package/dist/chart.js +583 -0
- package/dist/chart.js.map +1 -0
- package/dist/chart.mjs +536 -0
- package/dist/chart.mjs.map +1 -0
- package/dist/index.d.mts +1 -161
- package/dist/index.d.ts +1 -161
- package/dist/index.js +360 -897
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +357 -880
- package/dist/index.mjs.map +1 -1
- package/llms.txt +474 -0
- package/package.json +21 -9
package/README.md
CHANGED
|
@@ -1,73 +1,63 @@
|
|
|
1
|
-
|
|
1
|
+
<h1 align="center"><a href="https://7onic.design">7onic Design System</a></h1>
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
<p align="center">
|
|
4
|
+
<strong>Just take a look. Don't say I didn't warn you.</strong>
|
|
5
|
+
</p>
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://www.npmjs.com/package/@7onic-ui/react"><img src="https://img.shields.io/npm/v/@7onic-ui/react?color=37D8E6&label=react" alt="npm react" /></a>
|
|
9
|
+
<a href="https://www.npmjs.com/package/@7onic-ui/tokens"><img src="https://img.shields.io/npm/v/@7onic-ui/tokens?color=37D8E6&label=tokens" alt="npm tokens" /></a>
|
|
10
|
+
<a href="https://github.com/itonys/7onic/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" alt="MIT License" /></a>
|
|
11
|
+
<a href="https://7onic.design"><img src="https://img.shields.io/badge/docs-7onic.design-black" alt="Documentation" /></a>
|
|
12
|
+
</p>
|
|
6
13
|
|
|
7
|
-
|
|
14
|
+
<p align="center">
|
|
15
|
+
Open-source React design system where design and code never drift.<br>
|
|
16
|
+
Single source of truth from Figma tokens, designer-verified components on Radix UI.
|
|
17
|
+
</p>
|
|
8
18
|
|
|
9
|
-
|
|
19
|
+
---
|
|
10
20
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
- **
|
|
21
|
+
## Why 7onic?
|
|
22
|
+
|
|
23
|
+
| | What | Why it matters |
|
|
24
|
+
|:---:|---|---|
|
|
25
|
+
| **🎯** | **Zero design-code drift** | Design and code from a single vision. No handoff, no drift — every component is pixel-verified against Figma. |
|
|
26
|
+
| **📦** | **One JSON, every format** | `figma-tokens.json` auto-generates CSS, Tailwind v3, Tailwind v4, JS/TS, and JSON — all in sync. |
|
|
27
|
+
| **🧩** | **shadcn freedom + MUI convenience** | Built-in `loading`, `leftIcon`, `pressEffect`, `Field` — no DIY. Override anything with `className`. |
|
|
28
|
+
| **🔀** | **Only Tailwind v3+v4 dual support** | The ecosystem's only design system supporting both Tailwind versions. Same tokens, same DX. |
|
|
29
|
+
| **🎮** | **Built-in playground** | Interactive props editor + live code generation in docs. No Storybook setup needed. |
|
|
30
|
+
| **🌗** | **Dark mode, zero config** | Light/dark themes built into tokens. System preference detection out of the box. |
|
|
31
|
+
| **🔓** | **Framework-agnostic tokens** | Tokens ship as pure CSS variables. Use with Vue, Angular, Svelte, or vanilla CSS — no React required. |
|
|
32
|
+
| **🤖** | **AI-ready** | Ships with `llms.txt` — AI builds with design tokens, not hardcoded values. Zero config for Claude, Cursor, Copilot. |
|
|
33
|
+
| **🌏** | **CJK-first typography** | Type scale tuned for Japanese kanji, Korean hangul, and Latin — not an afterthought. |
|
|
34
|
+
| **🔥** | **Relentlessly updated** | Actively maintained with continuous research, refinement, and new features. Not abandoned — ever. |
|
|
22
35
|
|
|
23
36
|
---
|
|
24
37
|
|
|
25
|
-
##
|
|
26
|
-
|
|
27
|
-
### Components + Tokens
|
|
38
|
+
## Get Started
|
|
28
39
|
|
|
29
40
|
```bash
|
|
30
41
|
npm install @7onic-ui/react @7onic-ui/tokens
|
|
31
42
|
```
|
|
32
43
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
import { Button } from '@7onic-ui/react'
|
|
36
|
-
|
|
37
|
-
<Button>Get Started</Button>
|
|
38
|
-
<Button variant="solid" color="primary">Primary</Button>
|
|
39
|
-
|
|
40
|
-
// Compound components — namespace (recommended)
|
|
41
|
-
import { Card } from '@7onic-ui/react'
|
|
42
|
-
|
|
43
|
-
<Card>
|
|
44
|
-
<Card.Header>
|
|
45
|
-
<Card.Title>Settings</Card.Title>
|
|
46
|
-
</Card.Header>
|
|
47
|
-
<Card.Content>...</Card.Content>
|
|
48
|
-
</Card>
|
|
49
|
-
|
|
50
|
-
// Compound components — named exports (also supported)
|
|
51
|
-
import { Card, CardHeader, CardTitle, CardContent } from '@7onic-ui/react'
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
#### Tailwind v4
|
|
44
|
+
<details>
|
|
45
|
+
<summary><strong>Tailwind v4</strong></summary>
|
|
55
46
|
|
|
56
47
|
```css
|
|
57
48
|
@import "tailwindcss";
|
|
58
|
-
|
|
59
49
|
@import '@7onic-ui/tokens/tailwind/v4.css';
|
|
60
|
-
|
|
61
50
|
@source "../node_modules/@7onic-ui/react/dist";
|
|
62
51
|
```
|
|
52
|
+
</details>
|
|
63
53
|
|
|
64
|
-
|
|
54
|
+
<details>
|
|
55
|
+
<summary><strong>Tailwind v3</strong></summary>
|
|
65
56
|
|
|
66
57
|
```css
|
|
67
58
|
@tailwind base;
|
|
68
59
|
@tailwind components;
|
|
69
60
|
@tailwind utilities;
|
|
70
|
-
|
|
71
61
|
@import '@7onic-ui/tokens/css/all.css';
|
|
72
62
|
```
|
|
73
63
|
|
|
@@ -75,52 +65,13 @@ import { Card, CardHeader, CardTitle, CardContent } from '@7onic-ui/react'
|
|
|
75
65
|
// tailwind.config.js
|
|
76
66
|
module.exports = {
|
|
77
67
|
presets: [require('@7onic-ui/tokens/tailwind/v3-preset')],
|
|
78
|
-
content: [
|
|
79
|
-
'./node_modules/@7onic-ui/react/dist/**/*.{js,mjs}',
|
|
80
|
-
],
|
|
68
|
+
content: ['./node_modules/@7onic-ui/react/dist/**/*.{js,mjs}'],
|
|
81
69
|
}
|
|
82
70
|
```
|
|
71
|
+
</details>
|
|
83
72
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
```html
|
|
87
|
-
<body class="bg-background text-foreground">
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
<br>
|
|
91
|
-
|
|
92
|
-
### Tokens Only
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
npm install @7onic-ui/tokens
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
#### Tailwind v4
|
|
99
|
-
|
|
100
|
-
```css
|
|
101
|
-
@import "tailwindcss";
|
|
102
|
-
|
|
103
|
-
@import '@7onic-ui/tokens/tailwind/v4.css';
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
#### Tailwind v3
|
|
107
|
-
|
|
108
|
-
```css
|
|
109
|
-
@tailwind base;
|
|
110
|
-
@tailwind components;
|
|
111
|
-
@tailwind utilities;
|
|
112
|
-
|
|
113
|
-
@import '@7onic-ui/tokens/css/all.css';
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
```js
|
|
117
|
-
// tailwind.config.js
|
|
118
|
-
module.exports = {
|
|
119
|
-
presets: [require('@7onic-ui/tokens/tailwind/v3-preset')],
|
|
120
|
-
}
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
#### CSS Only
|
|
73
|
+
<details>
|
|
74
|
+
<summary><strong>CSS only (no Tailwind, no React)</strong></summary>
|
|
124
75
|
|
|
125
76
|
```css
|
|
126
77
|
@import '@7onic-ui/tokens/css/all.css';
|
|
@@ -131,66 +82,29 @@ module.exports = {
|
|
|
131
82
|
border-radius: var(--radius-md);
|
|
132
83
|
}
|
|
133
84
|
```
|
|
85
|
+
</details>
|
|
134
86
|
|
|
135
|
-
|
|
87
|
+
Apply base theme colors to `<body>` — enables dark mode and consistent backgrounds:
|
|
136
88
|
|
|
137
|
-
```
|
|
138
|
-
|
|
89
|
+
```html
|
|
90
|
+
<body class="bg-background text-foreground">
|
|
139
91
|
```
|
|
140
92
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
## Package Structure
|
|
93
|
+
Use components:
|
|
144
94
|
|
|
145
|
-
|
|
95
|
+
```tsx
|
|
96
|
+
import { Button, Card } from '@7onic-ui/react'
|
|
146
97
|
|
|
147
|
-
|
|
148
|
-
|------|--------|-------------|
|
|
149
|
-
| `dist/index.js` | CJS | CommonJS for Node.js / require() |
|
|
150
|
-
| `dist/index.mjs` | ESM | ES Modules for bundlers / import |
|
|
151
|
-
| `dist/index.d.ts` | Types | TypeScript definitions |
|
|
98
|
+
<Button variant="solid" color="primary">Get Started</Button>
|
|
152
99
|
|
|
153
|
-
|
|
154
|
-
|
|
100
|
+
<Card>
|
|
101
|
+
<Card.Header>
|
|
102
|
+
<Card.Title>Settings</Card.Title>
|
|
103
|
+
</Card.Header>
|
|
104
|
+
<Card.Content>...</Card.Content>
|
|
105
|
+
</Card>
|
|
155
106
|
```
|
|
156
107
|
|
|
157
|
-
### `@7onic-ui/tokens` — Design Tokens
|
|
158
|
-
|
|
159
|
-
**CSS Variables** — Use with any framework or vanilla CSS
|
|
160
|
-
|
|
161
|
-
| File | Description |
|
|
162
|
-
|------|-------------|
|
|
163
|
-
| `css/all.css` | All-in-one bundle (variables + light + dark) ⭐ |
|
|
164
|
-
| `css/variables.css` | Primitive tokens only |
|
|
165
|
-
| `css/themes/light.css` | Light theme semantics |
|
|
166
|
-
| `css/themes/dark.css` | Dark theme semantics |
|
|
167
|
-
|
|
168
|
-
**Tailwind Presets** — Drop-in presets for v3 and v4
|
|
169
|
-
|
|
170
|
-
| File | Description |
|
|
171
|
-
|------|-------------|
|
|
172
|
-
| `tailwind/v4.css` | All-in-one Tailwind v4 (theme + variables) ⭐ |
|
|
173
|
-
| `tailwind/v3-preset.js` | Tailwind v3 preset for `tailwind.config.js` |
|
|
174
|
-
| `tailwind/v4-theme.css` | Tailwind v4 `@theme` definitions |
|
|
175
|
-
|
|
176
|
-
**JavaScript / TypeScript / JSON**
|
|
177
|
-
|
|
178
|
-
| File | Description |
|
|
179
|
-
|------|-------------|
|
|
180
|
-
| `js/index.js` | CJS export |
|
|
181
|
-
| `js/index.mjs` | ESM export |
|
|
182
|
-
| `types/index.d.ts` | TypeScript definitions |
|
|
183
|
-
| `json/tokens.json` | Flat JSON for custom tooling |
|
|
184
|
-
|
|
185
|
-
**CLI**
|
|
186
|
-
|
|
187
|
-
| File | Description |
|
|
188
|
-
|------|-------------|
|
|
189
|
-
| `cli/sync.js` | `npx sync-tokens` — regenerate all files from source |
|
|
190
|
-
| `figma-tokens.json` | **SSOT** — the only file you edit |
|
|
191
|
-
|
|
192
|
-
> All 9 distribution files + 2 convenience bundles are auto-generated from `figma-tokens.json` via `npx sync-tokens`.
|
|
193
|
-
|
|
194
108
|
---
|
|
195
109
|
|
|
196
110
|
## Components
|
|
@@ -199,37 +113,31 @@ import { Button, Card, Modal } from '@7onic-ui/react'
|
|
|
199
113
|
|----------|-----------|:-----:|
|
|
200
114
|
| **Forms** | Button, IconButton, ButtonGroup, Input, Textarea, Select, Dropdown, Checkbox, Radio, Switch, Toggle, ToggleGroup, Segmented, Slider | 14 |
|
|
201
115
|
| **Data Display** | Avatar, Badge, Card, Table | 4 |
|
|
202
|
-
| **
|
|
116
|
+
| **Charts** | BarChart, LineChart, AreaChart, PieChart, MetricCard | 5 |
|
|
203
117
|
| **Layout** | Tabs, Accordion, Divider | 3 |
|
|
204
118
|
| **Overlay** | Modal, Drawer, Tooltip, Popover | 4 |
|
|
205
119
|
| **Feedback** | Alert, Toast, Progress, Spinner, Skeleton | 5 |
|
|
206
120
|
| **Navigation** | Breadcrumb, NavigationMenu, Pagination | 3 |
|
|
207
121
|
|
|
208
|
-
**38 components**
|
|
209
|
-
|
|
210
|
-
- CVA (class-variance-authority) for variant management
|
|
211
|
-
- Controlled & uncontrolled modes
|
|
212
|
-
- `forwardRef` for ref forwarding
|
|
213
|
-
- `'use client'` directive
|
|
214
|
-
- Namespace compound export (`Card.Header`) + backward-compatible named exports (`CardHeader`)
|
|
122
|
+
**38 components** — all with CVA variants, controlled + uncontrolled modes, `forwardRef`, namespace exports (`Card.Header`) + named exports (`CardHeader`).
|
|
215
123
|
|
|
216
124
|
---
|
|
217
125
|
|
|
218
|
-
## Design Tokens
|
|
126
|
+
## Design Tokens — 14 Categories
|
|
219
127
|
|
|
220
128
|
| Token | Values | Description |
|
|
221
129
|
|-------|--------|-------------|
|
|
222
130
|
| **Colors** | Semantic system | Brand, status, text, background, border |
|
|
223
131
|
| **Typography** | 11 sizes (11–72px) | CJK-optimized: `md`(14px) for UI, `base`(16px) for body |
|
|
224
132
|
| **Spacing** | 18 values (0–96px) | 2px steps (0–12px), 4px steps (12px+) |
|
|
225
|
-
| **Radius** | 9 values
|
|
133
|
+
| **Radius** | 9 values | `none` through `full` |
|
|
226
134
|
| **Shadows** | 6 primitives | `xs` through `xl` + `primary-glow` |
|
|
227
|
-
| **Duration** | 8 values
|
|
228
|
-
| **Easing** | 5 functions | `linear
|
|
135
|
+
| **Duration** | 8 values | `instant` through `spin` |
|
|
136
|
+
| **Easing** | 5 functions | `linear` through `ease-in-out` |
|
|
229
137
|
| **Z-Index** | 13 layers | `0` through `toast`(3000) |
|
|
230
138
|
| **Icon Sizes** | 6 sizes (12–32px) | `2xs` through `xl` |
|
|
231
|
-
| **Opacity** | 21 values
|
|
232
|
-
| **Animation** | 54
|
|
139
|
+
| **Opacity** | 21 values | 5% increments |
|
|
140
|
+
| **Animation** | 54 keyframes | Component enter/exit, spin, skeleton, progress |
|
|
233
141
|
| **Breakpoints** | 5 widths | `sm`(640) through `2xl`(1536) |
|
|
234
142
|
| **Border Width** | 5 values | `0`, `1`, `2`, `4`, `8` |
|
|
235
143
|
| **Scale** | 4 values | `50`, `75`, `95`, `pressed`(0.98) |
|
|
@@ -239,38 +147,83 @@ import { Button, Card, Modal } from '@7onic-ui/react'
|
|
|
239
147
|
## Token Pipeline
|
|
240
148
|
|
|
241
149
|
```
|
|
242
|
-
figma-tokens.json ← SSOT (only file you edit)
|
|
150
|
+
figma-tokens.json ← SSOT (the only file you edit)
|
|
243
151
|
│
|
|
244
152
|
│ npx sync-tokens
|
|
245
153
|
│
|
|
246
154
|
├── css/variables.css ← CSS variables (all primitives)
|
|
247
155
|
├── css/themes/light.css ← Light theme semantics
|
|
248
156
|
├── css/themes/dark.css ← Dark theme semantics
|
|
249
|
-
├── css/all.css ←
|
|
157
|
+
├── css/all.css ← All-in-one bundle
|
|
250
158
|
├── tailwind/v3-preset.js ← Tailwind v3 preset
|
|
251
159
|
├── tailwind/v4-theme.css ← Tailwind v4 theme
|
|
252
|
-
├── tailwind/v4.css ←
|
|
160
|
+
├── tailwind/v4.css ← Tailwind v4 bundle
|
|
253
161
|
├── js/index.js + .mjs ← JavaScript / ESM
|
|
254
162
|
├── types/index.d.ts ← TypeScript definitions
|
|
255
163
|
└── json/tokens.json ← Flat JSON
|
|
256
164
|
```
|
|
257
165
|
|
|
258
|
-
|
|
166
|
+
Breaking changes are auto-detected with diff visualization. Backward-compatible aliases generated automatically.
|
|
167
|
+
|
|
168
|
+
<details>
|
|
169
|
+
<summary><strong>Package structure</strong></summary>
|
|
170
|
+
|
|
171
|
+
### `@7onic-ui/react`
|
|
172
|
+
|
|
173
|
+
| File | Format | Description |
|
|
174
|
+
|------|--------|-------------|
|
|
175
|
+
| `dist/index.js` | CJS | CommonJS for Node.js / require() |
|
|
176
|
+
| `dist/index.mjs` | ESM | ES Modules for bundlers / import |
|
|
177
|
+
| `dist/index.d.ts` | Types | TypeScript definitions |
|
|
178
|
+
| `llms.txt` | Text | AI integration rules (llms.txt standard) |
|
|
179
|
+
|
|
180
|
+
### `@7onic-ui/tokens`
|
|
181
|
+
|
|
182
|
+
| File | Description |
|
|
183
|
+
|------|-------------|
|
|
184
|
+
| `css/all.css` | All-in-one bundle (variables + light + dark) |
|
|
185
|
+
| `css/variables.css` | Primitive tokens only |
|
|
186
|
+
| `css/themes/light.css` | Light theme semantics |
|
|
187
|
+
| `css/themes/dark.css` | Dark theme semantics |
|
|
188
|
+
| `tailwind/v4.css` | All-in-one Tailwind v4 |
|
|
189
|
+
| `tailwind/v3-preset.js` | Tailwind v3 preset |
|
|
190
|
+
| `tailwind/v4-theme.css` | Tailwind v4 theme definitions |
|
|
191
|
+
| `js/index.js` | CJS export |
|
|
192
|
+
| `js/index.mjs` | ESM export |
|
|
193
|
+
| `types/index.d.ts` | TypeScript definitions |
|
|
194
|
+
| `json/tokens.json` | Flat JSON for custom tooling |
|
|
195
|
+
| `cli/sync.js` | `npx sync-tokens` CLI |
|
|
196
|
+
| `figma-tokens.json` | SSOT — the only file you edit |
|
|
197
|
+
|
|
198
|
+
</details>
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## AI Integration
|
|
203
|
+
|
|
204
|
+
7onic ships with `llms.txt` — an open standard that lets AI tools build with design tokens instead of hardcoded values.
|
|
205
|
+
|
|
206
|
+
```
|
|
207
|
+
# In CLAUDE.md, .cursor/rules, or copilot-instructions.md
|
|
208
|
+
Rules: node_modules/@7onic-ui/react/llms.txt
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Once loaded, AI automatically uses `bg-primary` instead of `bg-blue-500`, spacing tokens instead of arbitrary pixels, and skips unnecessary `dark:` prefixes.
|
|
212
|
+
|
|
213
|
+
Works with Claude Code, Cursor, GitHub Copilot, ChatGPT, and any AI tool that reads text files.
|
|
214
|
+
|
|
215
|
+
**Setup guides**: [Tokens](https://7onic.design/design-tokens/ai) · [Components](https://7onic.design/components/ai)
|
|
259
216
|
|
|
260
217
|
---
|
|
261
218
|
|
|
262
219
|
## Tech Stack
|
|
263
220
|
|
|
264
|
-
| | |
|
|
221
|
+
| Category | Technology |
|
|
265
222
|
|---|---|
|
|
266
|
-
| **Framework** | Next.js 14 + React 18 |
|
|
267
|
-
| **Language** | TypeScript 5 |
|
|
268
223
|
| **Styling** | Tailwind CSS v3 / v4 + CSS Variables |
|
|
269
224
|
| **Primitives** | Radix UI |
|
|
270
225
|
| **Charts** | Recharts |
|
|
271
|
-
| **Tokens** | Figma Token Studio → `sync-tokens` |
|
|
272
226
|
| **Variants** | class-variance-authority (CVA) |
|
|
273
|
-
| **Build** | tsup (library), Next.js (docs) |
|
|
274
227
|
|
|
275
228
|
---
|
|
276
229
|
|
|
@@ -286,13 +239,12 @@ CLI supports `--dry-run`, `--force`, `--input`, `--output` flags. Breaking chang
|
|
|
286
239
|
- [x] Automated doc verification (8 checks, AST-powered, blocks publish on error)
|
|
287
240
|
- [x] Automated component verification (7 checks — hardcoded colors, tokens, dark mode, dead code)
|
|
288
241
|
- [x] Multilingual documentation — English, Japanese, Korean (powered by next-intl)
|
|
289
|
-
- [
|
|
242
|
+
- [x] npm package distribution — `@7onic-ui/react` + `@7onic-ui/tokens` v0.1.0
|
|
243
|
+
- [x] AI integration — `llms.txt` standard, setup guides for Claude Code / Cursor / Copilot / ChatGPT
|
|
290
244
|
- [ ] Theme Customizer (live color preview)
|
|
291
245
|
- [ ] `npx 7onic add` CLI (shadcn-style)
|
|
292
246
|
- [ ] Figma UI Kit
|
|
293
247
|
- [ ] Dashboard / landing templates
|
|
294
|
-
- [ ] AI integration guide — `llms.txt` hosting + tool-specific rule files (Claude / Cursor / Copilot)
|
|
295
|
-
- [ ] `/7onic-demo` Claude Code skill — build a full service with zero hardcoding, guided setup
|
|
296
248
|
|
|
297
249
|
---
|
|
298
250
|
|
|
@@ -303,5 +255,7 @@ MIT
|
|
|
303
255
|
---
|
|
304
256
|
|
|
305
257
|
<p align="center">
|
|
306
|
-
<strong>One JSON, every format — from Figma to production.</strong>
|
|
258
|
+
<strong>One JSON, every format — from Figma to production.</strong><br>
|
|
259
|
+
Independently built.<br>
|
|
260
|
+
<sub>Last updated: 2026-04-08</sub>
|
|
307
261
|
</p>
|
package/dist/chart.d.mts
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as RechartsPrimitive from 'recharts';
|
|
3
|
+
|
|
4
|
+
declare const THEMES: {
|
|
5
|
+
readonly light: "";
|
|
6
|
+
readonly dark: ".dark";
|
|
7
|
+
};
|
|
8
|
+
type ChartConfig = {
|
|
9
|
+
[k in string]: {
|
|
10
|
+
label?: React.ReactNode;
|
|
11
|
+
icon?: React.ComponentType;
|
|
12
|
+
} & ({
|
|
13
|
+
color?: string;
|
|
14
|
+
theme?: never;
|
|
15
|
+
} | {
|
|
16
|
+
color?: never;
|
|
17
|
+
theme: Record<keyof typeof THEMES, string>;
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
type ChartContextProps = {
|
|
21
|
+
config: ChartConfig;
|
|
22
|
+
hoverFade: boolean;
|
|
23
|
+
activeIndex: number | null;
|
|
24
|
+
setActiveIndex: (index: number | null) => void;
|
|
25
|
+
activeDataKey: string | null;
|
|
26
|
+
setActiveDataKey: (key: string | null) => void;
|
|
27
|
+
};
|
|
28
|
+
declare function useChart(): ChartContextProps;
|
|
29
|
+
declare function ChartContainer({ id, className, children, config, hoverFade, ...props }: React.ComponentProps<'div'> & {
|
|
30
|
+
config: ChartConfig;
|
|
31
|
+
/** Enable hover-to-highlight: hovered bar group stays full opacity, others fade. */
|
|
32
|
+
hoverFade?: boolean;
|
|
33
|
+
children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>['children'];
|
|
34
|
+
}): React.JSX.Element;
|
|
35
|
+
declare const ChartStyle: ({ id, config }: {
|
|
36
|
+
id: string;
|
|
37
|
+
config: ChartConfig;
|
|
38
|
+
}) => React.JSX.Element;
|
|
39
|
+
type ChartBarRadius = 'none' | 'sm' | 'base' | 'md' | 'lg';
|
|
40
|
+
type ChartBarVariant = 'solid' | 'outline';
|
|
41
|
+
type ChartBarProps = Omit<React.ComponentProps<typeof RechartsPrimitive.Bar>, 'radius'> & {
|
|
42
|
+
/** Named radius token. Auto-adapts corners based on layout and stack position. */
|
|
43
|
+
radius?: ChartBarRadius;
|
|
44
|
+
/** 'horizontal' rounds the right side (away from Y-axis). Default: 'vertical' */
|
|
45
|
+
layout?: 'vertical' | 'horizontal';
|
|
46
|
+
/** 'bottom' rounds the bottom corners (base of a stack). Default: 'top' */
|
|
47
|
+
stackPosition?: 'top' | 'bottom';
|
|
48
|
+
/** 'outline' renders a thick border with a semi-transparent fill. Default: 'solid' */
|
|
49
|
+
variant?: ChartBarVariant;
|
|
50
|
+
};
|
|
51
|
+
declare function ChartBar({ radius, layout, stackPosition, variant, fill, stackId, ...props }: ChartBarProps): React.JSX.Element;
|
|
52
|
+
declare function ChartTooltip(props: React.ComponentProps<typeof RechartsPrimitive.Tooltip>): React.JSX.Element;
|
|
53
|
+
type TooltipPayloadItem = {
|
|
54
|
+
dataKey?: string | number;
|
|
55
|
+
name?: string;
|
|
56
|
+
value?: number | string;
|
|
57
|
+
type?: string;
|
|
58
|
+
color?: string;
|
|
59
|
+
payload?: Record<string, unknown>;
|
|
60
|
+
fill?: string;
|
|
61
|
+
};
|
|
62
|
+
type ChartTooltipContentProps = React.ComponentProps<'div'> & {
|
|
63
|
+
active?: boolean;
|
|
64
|
+
payload?: TooltipPayloadItem[];
|
|
65
|
+
label?: string;
|
|
66
|
+
labelFormatter?: (value: unknown, payload: TooltipPayloadItem[]) => React.ReactNode;
|
|
67
|
+
labelClassName?: string;
|
|
68
|
+
formatter?: (value: unknown, name: string, item: TooltipPayloadItem, index: number, payload: Record<string, unknown>) => React.ReactNode;
|
|
69
|
+
color?: string;
|
|
70
|
+
hideLabel?: boolean;
|
|
71
|
+
hideIndicator?: boolean;
|
|
72
|
+
indicator?: 'line' | 'dot' | 'dashed';
|
|
73
|
+
nameKey?: string;
|
|
74
|
+
labelKey?: string;
|
|
75
|
+
};
|
|
76
|
+
declare function ChartTooltipContent({ active, payload, className, indicator, hideLabel, hideIndicator, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey, }: ChartTooltipContentProps): React.JSX.Element | null;
|
|
77
|
+
declare const ChartLegend: React.MemoExoticComponent<(outsideProps: RechartsPrimitive.LegendProps) => React.ReactPortal | null>;
|
|
78
|
+
type LegendPayloadItem = {
|
|
79
|
+
value?: string;
|
|
80
|
+
type?: string;
|
|
81
|
+
color?: string;
|
|
82
|
+
dataKey?: string;
|
|
83
|
+
};
|
|
84
|
+
type ChartLegendContentProps = React.ComponentProps<'div'> & {
|
|
85
|
+
payload?: LegendPayloadItem[];
|
|
86
|
+
verticalAlign?: 'top' | 'middle' | 'bottom';
|
|
87
|
+
align?: 'left' | 'center' | 'right';
|
|
88
|
+
/** Recharts passes layout when Legend uses layout prop */
|
|
89
|
+
layout?: 'horizontal' | 'vertical';
|
|
90
|
+
hideIcon?: boolean;
|
|
91
|
+
nameKey?: string;
|
|
92
|
+
};
|
|
93
|
+
declare function ChartLegendContent({ className, hideIcon, payload, verticalAlign, align, layout, nameKey, }: ChartLegendContentProps): React.JSX.Element | null;
|
|
94
|
+
type ChartXAxisProps = React.ComponentProps<typeof RechartsPrimitive.XAxis>;
|
|
95
|
+
type ChartYAxisProps = React.ComponentProps<typeof RechartsPrimitive.YAxis>;
|
|
96
|
+
declare function ChartXAxis({ tick, padding, ...props }: ChartXAxisProps): React.JSX.Element;
|
|
97
|
+
declare function ChartYAxis({ tick, width, ...props }: ChartYAxisProps): React.JSX.Element;
|
|
98
|
+
type ChartLineType = 'linear' | 'monotone' | 'step' | 'natural';
|
|
99
|
+
type ChartLineVariant = 'solid' | 'dashed';
|
|
100
|
+
type ChartLineProps = Omit<React.ComponentProps<typeof RechartsPrimitive.Line>, 'type' | 'dot' | 'activeDot'> & {
|
|
101
|
+
/** Curve interpolation type. Default: 'monotone' */
|
|
102
|
+
type?: ChartLineType;
|
|
103
|
+
/** Line style. 'dashed' applies stroke-dasharray. Default: 'solid' */
|
|
104
|
+
variant?: ChartLineVariant;
|
|
105
|
+
/** Show data point dots. Default: true */
|
|
106
|
+
dot?: boolean;
|
|
107
|
+
/** Show highlighted dot on hover. Default: true */
|
|
108
|
+
activeDot?: boolean;
|
|
109
|
+
};
|
|
110
|
+
declare function ChartLine({ type, variant, dot: showDot, activeDot: showActiveDot, stroke, dataKey, ...props }: ChartLineProps): React.JSX.Element;
|
|
111
|
+
type ChartAreaType = 'linear' | 'monotone' | 'step' | 'natural';
|
|
112
|
+
type ChartAreaVariant = 'solid' | 'gradient';
|
|
113
|
+
type ChartAreaProps = Omit<React.ComponentProps<typeof RechartsPrimitive.Area>, 'type' | 'dot' | 'activeDot'> & {
|
|
114
|
+
/** Curve interpolation type. Default: 'monotone' */
|
|
115
|
+
type?: ChartAreaType;
|
|
116
|
+
/** Fill style. 'gradient' auto-generates an SVG linearGradient. Default: 'solid' */
|
|
117
|
+
variant?: ChartAreaVariant;
|
|
118
|
+
/** Show data point dots. Default: true */
|
|
119
|
+
dot?: boolean;
|
|
120
|
+
/** Show highlighted dot on hover. Default: true */
|
|
121
|
+
activeDot?: boolean;
|
|
122
|
+
/** Fill opacity for this area (0–1). Default: 0.4 */
|
|
123
|
+
fillOpacity?: number;
|
|
124
|
+
};
|
|
125
|
+
declare function ChartArea({ type, variant, dot: showDot, activeDot: showActiveDot, fillOpacity, stroke, fill, dataKey, ...props }: ChartAreaProps): React.JSX.Element;
|
|
126
|
+
type ChartPieVariant = 'pie' | 'donut';
|
|
127
|
+
type ChartPieLabel = 'none' | 'outside' | 'inside';
|
|
128
|
+
type ChartPieLabelContent = 'value' | 'percent';
|
|
129
|
+
type ChartPieProps = Omit<React.ComponentProps<typeof RechartsPrimitive.Pie>, 'label' | 'labelLine' | 'activeShape'> & {
|
|
130
|
+
/** 'donut' applies innerRadius automatically. Default: 'pie' */
|
|
131
|
+
variant?: ChartPieVariant;
|
|
132
|
+
/** Label position. Default: 'none' */
|
|
133
|
+
label?: ChartPieLabel;
|
|
134
|
+
/** Label display content. Default: 'value' */
|
|
135
|
+
labelContent?: ChartPieLabelContent;
|
|
136
|
+
/** Hover expand effect. Default: true */
|
|
137
|
+
activeShape?: boolean;
|
|
138
|
+
/** Override inner radius (default: 0 for pie, 60 for donut) */
|
|
139
|
+
innerRadius?: number;
|
|
140
|
+
/** Padding angle between slices (degrees). Default: 0 */
|
|
141
|
+
paddingAngle?: number;
|
|
142
|
+
/** Corner radius for slices. Default: 0 */
|
|
143
|
+
cornerRadius?: number;
|
|
144
|
+
};
|
|
145
|
+
declare function ChartPie({ variant, label: labelMode, labelContent, activeShape: showActiveShape, innerRadius, paddingAngle, cornerRadius, startAngle, endAngle, ...props }: ChartPieProps): React.JSX.Element;
|
|
146
|
+
declare const Chart: typeof ChartContainer & {
|
|
147
|
+
Bar: typeof ChartBar;
|
|
148
|
+
Line: typeof ChartLine;
|
|
149
|
+
Area: typeof ChartArea;
|
|
150
|
+
Pie: typeof ChartPie;
|
|
151
|
+
Tooltip: typeof ChartTooltip;
|
|
152
|
+
TooltipContent: typeof ChartTooltipContent;
|
|
153
|
+
Legend: React.MemoExoticComponent<(outsideProps: RechartsPrimitive.LegendProps) => React.ReactPortal | null>;
|
|
154
|
+
LegendContent: typeof ChartLegendContent;
|
|
155
|
+
XAxis: typeof ChartXAxis;
|
|
156
|
+
YAxis: typeof ChartYAxis;
|
|
157
|
+
Style: ({ id, config }: {
|
|
158
|
+
id: string;
|
|
159
|
+
config: ChartConfig;
|
|
160
|
+
}) => React.JSX.Element;
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
export { Chart, ChartArea, type ChartAreaType, type ChartAreaVariant, ChartBar, type ChartBarRadius, type ChartBarVariant, type ChartConfig, ChartContainer, ChartLegend, ChartLegendContent, ChartLine, type ChartLineType, type ChartLineVariant, ChartPie, type ChartPieLabel, type ChartPieLabelContent, type ChartPieVariant, ChartStyle, ChartTooltip, ChartTooltipContent, ChartXAxis, ChartYAxis, useChart };
|