@7onic-ui/react 0.1.0 → 0.1.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.
Files changed (3) hide show
  1. package/README.md +122 -161
  2. package/llms.txt +474 -0
  3. package/package.json +3 -2
package/README.md CHANGED
@@ -1,115 +1,63 @@
1
- # [7onic Design System](https://7onic.design)
1
+ <h1 align="center"><a href="https://7onic.design">7onic Design System</a></h1>
2
2
 
3
- > **🚀 First npm release coming April 2026**
3
+ <p align="center">
4
+ <strong>Just take a look. Don't say I didn't warn you.</strong>
5
+ </p>
4
6
 
5
- One JSON, every format. AI-optimized design system with Figma-synced token pipeline — accessible React components on Radix UI, and the ecosystem's only Tailwind v3+v4 dual support.
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
- ## Features
19
+ ---
10
20
 
11
- - **Figma-Synced Token Pipeline** — Single source of truth. One JSON powers CSS, Tailwind, JS, and TypeScript
12
- - **Only Tailwind v3+v4 Dual Support** — The ecosystem's only design system supporting both versions
13
- - **AI-Optimized Components** Structured for AI coding tools (Claude, Copilot) with predictable patterns
14
- - **Namespace + Named Exports** — Both `<Card.Header>` and `<CardHeader>` work. Use whichever you prefer
15
- - **100% TypeScript** — Full type safety with IntelliSense support
16
- - **Dark Mode Built-in** Light/dark themes with system preference detection
17
- - **Radix UI Primitives** — Accessible, keyboard-navigable components out of the box
18
- - **Charts Included** Bar, Line, Area, Pie, MetricCard with design token integration
19
- - **Tokens-only Distribution** Use CSS variables without Tailwind or React
20
- - **Zero Runtime CSS** No CSS-in-JS runtime overhead. Pure Tailwind classes
21
- - **Multilingual** English, Japanese, Korean with automatic locale detection
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
- ## Quick Start
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
- ```tsx
34
- // Standalone components
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
- #### Tailwind v3
65
-
66
- ```css
67
- @tailwind base;
68
- @tailwind components;
69
- @tailwind utilities;
70
-
71
- @import '@7onic-ui/tokens/css/all.css';
72
- ```
73
-
74
- ```js
75
- // tailwind.config.js
76
- module.exports = {
77
- presets: [require('@7onic-ui/tokens/tailwind/v3-preset')],
78
- content: [
79
- './node_modules/@7onic-ui/react/dist/**/*.{js,mjs}',
80
- ],
81
- }
82
- ```
83
-
84
- #### Body Style
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
54
+ <details>
55
+ <summary><strong>Tailwind v3</strong></summary>
107
56
 
108
57
  ```css
109
58
  @tailwind base;
110
59
  @tailwind components;
111
60
  @tailwind utilities;
112
-
113
61
  @import '@7onic-ui/tokens/css/all.css';
114
62
  ```
115
63
 
@@ -117,10 +65,13 @@ npm install @7onic-ui/tokens
117
65
  // tailwind.config.js
118
66
  module.exports = {
119
67
  presets: [require('@7onic-ui/tokens/tailwind/v3-preset')],
68
+ content: ['./node_modules/@7onic-ui/react/dist/**/*.{js,mjs}'],
120
69
  }
121
70
  ```
71
+ </details>
122
72
 
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
- #### JavaScript / TypeScript
87
+ Apply base theme colors to `<body>` — enables dark mode and consistent backgrounds:
136
88
 
137
- ```ts
138
- import { colors, spacing, typography } from '@7onic-ui/tokens'
89
+ ```html
90
+ <body class="bg-background text-foreground">
139
91
  ```
140
92
 
141
- ---
142
-
143
- ## Package Structure
93
+ Use components:
144
94
 
145
- ### `@7onic-ui/react` — Component Library
95
+ ```tsx
96
+ import { Button, Card } from '@7onic-ui/react'
146
97
 
147
- | File | Format | Description |
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
- ```ts
154
- import { Button, Card, Modal } from '@7onic-ui/react'
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
- | **Chart** | BarChart, LineChart, AreaChart, PieChart, MetricCard | 5 |
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** ready. All follow these patterns:
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 (0–9999px) | `none` through `full` |
133
+ | **Radius** | 9 values | `none` through `full` |
226
134
  | **Shadows** | 6 primitives | `xs` through `xl` + `primary-glow` |
227
- | **Duration** | 8 values (0–1000ms) | `instant` through `spin` |
228
- | **Easing** | 5 functions | `linear`, `ease`, `ease-in`, `ease-out`, `ease-in-out` |
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 (0–1) | 5% increments |
232
- | **Animation** | 54 named (1:1) | Component enter/exit, spin, skeleton, progress |
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,23 +147,72 @@ 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 ← Bundle (variables + light + dark)
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 ← Bundle (theme + variables)
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
- CLI supports `--dry-run`, `--force`, `--input`, `--output` flags. Breaking changes are auto-detected with diff visualization and backward-compatible aliases.
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
 
@@ -286,16 +243,19 @@ CLI supports `--dry-run`, `--force`, `--input`, `--output` flags. Breaking chang
286
243
  - [x] Automated doc verification (8 checks, AST-powered, blocks publish on error)
287
244
  - [x] Automated component verification (7 checks — hardcoded colors, tokens, dark mode, dead code)
288
245
  - [x] Multilingual documentation — English, Japanese, Korean (powered by next-intl)
289
- - [ ] npm package distribution (April 2026)
246
+ - [x] npm package distribution `@7onic-ui/react` + `@7onic-ui/tokens` v0.1.0
247
+ - [x] AI integration — `llms.txt` standard, setup guides for Claude Code / Cursor / Copilot / ChatGPT
290
248
  - [ ] Theme Customizer (live color preview)
291
249
  - [ ] `npx 7onic add` CLI (shadcn-style)
292
250
  - [ ] Figma UI Kit
293
251
  - [ ] 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
252
 
297
253
  ---
298
254
 
255
+ ## Contact
256
+
257
+ hello@7onic.io
258
+
299
259
  ## License
300
260
 
301
261
  MIT
@@ -303,5 +263,6 @@ MIT
303
263
  ---
304
264
 
305
265
  <p align="center">
306
- <strong>One JSON, every format — from Figma to production.</strong>
266
+ <strong>One JSON, every format — from Figma to production.</strong><br>
267
+ Independently built.
307
268
  </p>
package/llms.txt ADDED
@@ -0,0 +1,474 @@
1
+ # 7onic Design System — AI Guide (Tokens)
2
+
3
+ ## What is 7onic?
4
+
5
+ Token-driven design system. Single source of truth — design tokens to code.
6
+ Use the token system to style any project with consistent colors, spacing, typography, and more.
7
+
8
+ - Documentation: https://7onic.design
9
+ - npm: `@7onic-ui/tokens` (design tokens)
10
+ - For components + tokens guide, see: https://7onic.design/llms-full.txt
11
+
12
+ ---
13
+
14
+ # ═══ SECTION 1: PROJECT SETUP ═══
15
+
16
+ ## How to Start
17
+
18
+ ### Step 1: Ask the user (setup checklist)
19
+
20
+ Before writing any code, present this checklist and wait for answers:
21
+
22
+ 1. **Framework** — Next.js / Vite (React SPA) / Remix / other?
23
+ 2. **Dark mode** — Yes or no?
24
+ 3. **Font** — Use default, or custom font? If custom, which font?
25
+ 4. **Locale** — Which language(s)? (for CJK font loading)
26
+
27
+ **If the user answers in natural language**, extract the answers. **If any item is missing, ask a follow-up question for the missing items only.** Do not proceed until all 4 items are answered.
28
+
29
+ ### Step 2: Execute full setup (all at once, do not skip any)
30
+
31
+ After receiving answers, execute ALL of the following in order. Every step is mandatory.
32
+
33
+ **2-1. Install package (skip if already installed):**
34
+ ```bash
35
+ npm install @7onic-ui/tokens
36
+ ```
37
+ > Check package.json first. If already listed in dependencies, skip this step.
38
+
39
+ **2-2. Create or update globals.css with token imports:**
40
+
41
+ **How to detect Tailwind version:**
42
+ - `tailwind.config.js` (or `.ts`) exists → **v3**
43
+ - No config file → **v4** (uses CSS-based configuration)
44
+
45
+ **New project (Tailwind v4):**
46
+ ```css
47
+ /* globals.css — ALL imports are required, do not skip any */
48
+ @import "tailwindcss";
49
+ @import "@7onic-ui/tokens/css/variables.css";
50
+ @import "@7onic-ui/tokens/css/themes/light.css";
51
+ @import "@7onic-ui/tokens/css/themes/dark.css"; /* omit ONLY if dark mode = no */
52
+ @import "@7onic-ui/tokens/tailwind/v4-theme.css";
53
+ ```
54
+
55
+ **Existing project with Tailwind v3** (detect from tailwind.config.js):
56
+ ```css
57
+ /* globals.css */
58
+ @tailwind base;
59
+ @tailwind components;
60
+ @tailwind utilities;
61
+ @import '@7onic-ui/tokens/css/variables.css';
62
+ @import '@7onic-ui/tokens/css/themes/light.css';
63
+ @import '@7onic-ui/tokens/css/themes/dark.css'; /* omit ONLY if dark mode = no */
64
+ ```
65
+ ```js
66
+ // tailwind.config.js — add preset
67
+ const preset = require('@7onic-ui/tokens/tailwind/v3-preset')
68
+ module.exports = {
69
+ presets: [preset],
70
+ content: ['./src/**/*.{js,ts,jsx,tsx}'],
71
+ }
72
+ ```
73
+
74
+ **2-3. Set body classes:**
75
+ ```html
76
+ <body class="bg-background text-foreground">
77
+ ```
78
+
79
+ **2-4. Apply user's answers:**
80
+
81
+ - Dark mode = yes → implement dark mode toggle (see below)
82
+ - Custom font → load font (next/font for Next.js, CDN for Vite) + set `--font-family-sans`
83
+ - Locale includes Japanese → load Noto Sans JP font
84
+ - Locale includes Korean → load Noto Sans KR font
85
+
86
+ **2-5. Verify setup is complete before writing any UI code:**
87
+ - [ ] Package installed (@7onic-ui/tokens)
88
+ - [ ] globals.css has ALL required imports in correct order
89
+ - [ ] Body has `bg-background text-foreground`
90
+ - [ ] Dark mode toggle (if selected)
91
+ - [ ] Font loaded (if custom)
92
+ - [ ] CJK fonts loaded (if applicable)
93
+
94
+ ⛔ **Do NOT proceed to Step 3 until all checks pass.**
95
+
96
+ ### Icon Import Pattern (lucide-react)
97
+
98
+ ```tsx
99
+ // ✅ Official pattern — no suffix
100
+ import { Search, Settings, ChevronDown, X } from 'lucide-react'
101
+
102
+ // ❌ Legacy alias — avoid
103
+ import { SearchIcon, SettingsIcon } from 'lucide-react'
104
+
105
+ // ⚠️ Name collision with your own component — use alias
106
+ import { Badge as BadgeIcon } from 'lucide-react'
107
+ ```
108
+
109
+ ### Step 3: Start building
110
+
111
+ Use token classes for all styling. See Token Reference below.
112
+
113
+ ---
114
+
115
+ # ═══ SECTION 2: AI RULES ═══
116
+
117
+ ## ⛔ Core Principle
118
+
119
+ **Token values are user-defined.** Every project has different brand colors, spacing, and design decisions. The token NAMES are the API — never assume or hardcode specific values.
120
+
121
+ ## Whitelist — ONLY These Are Allowed
122
+
123
+ When writing any code, you may ONLY use:
124
+
125
+ 1. **Token classes** — colors, spacing, typography, radius, shadows, z-index, icon sizes, duration, easing, opacity, scale (listed in Token Reference below)
126
+ 2. **Tailwind structural utilities** — layout, positioning, display, overflow, sizing, and more:
127
+ - Layout: flex, grid, block, inline, hidden, container
128
+ - Position: relative, absolute, fixed, sticky, top-0, inset-0
129
+ - Flex/Grid: items-center, justify-between, gap-4, col-span-2
130
+ - Sizing: w-full, h-full, min-h-screen, max-w-7xl
131
+ - Spacing: space-x-*, space-y-*, divide-x, divide-y
132
+ - Overflow: overflow-hidden, overflow-auto, truncate, whitespace-nowrap
133
+ - Interaction: cursor-pointer, pointer-events-none, select-none
134
+ - Accessibility: sr-only
135
+ - Group/Peer: group, group-hover:*, peer, peer-checked:*
136
+ - Aspect: aspect-square, aspect-video
137
+ - Text: line-clamp-*, text-ellipsis
138
+ - Animation: animate-spin, animate-pulse, animate-bounce
139
+ - Any other Tailwind structural/layout utility not listed above is also allowed — as long as it does not hardcode colors, spacing values, font sizes, or other visual values that exist as tokens
140
+ - ⚠️ Utilities that implicitly use color (divide, border) must be paired with a token color:
141
+ `divide-y divide-border` ✅ / `divide-y` alone ❌ (may not adapt to dark mode)
142
+ `border border-border` ✅ / `border` alone ❌
143
+ 3. **Tailwind visual utilities using token values** — gradients, transforms, transitions:
144
+ - Gradient: bg-gradient-to-r, from-primary, to-secondary (token colors only)
145
+ - Transform: rotate-45, translate-x-1
146
+ - Transition: transition-all, transition-colors (with token durations)
147
+ - Backdrop: backdrop-blur, backdrop-blur-sm
148
+ 4. **Responsive prefixes** — sm:, md:, lg:, xl:, 2xl: (on allowed classes only)
149
+ 5. **State prefixes** — hover:, focus:, active:, disabled: (on allowed classes only, token values only)
150
+ 6. **Layout dimension arbitrary values** — height and width ONLY: h-[300px], max-w-[1200px], min-h-screen (when no token fits)
151
+ 7. **Opacity modifier** — append `/0-100` to any token color for transparency:
152
+ - `bg-primary/50`, `text-foreground/70`, `border-border/30`
153
+ - Do NOT use `opacity-*` utility as a workaround — it affects the entire element including children
154
+ - `bg-primary/10` ✅ (only background is transparent) / `bg-primary opacity-10` ❌ (children also become transparent)
155
+
156
+ **Everything not in this list is FORBIDDEN.**
157
+
158
+ ⚠️ **Gradient/visual utilities must use token colors only:** `from-primary to-secondary` ✅ / `from-blue-500 to-purple-600` ❌
159
+
160
+ ## ❌ Forbidden — Never Use These
161
+
162
+ | Category | Forbidden | Use Instead |
163
+ |---|---|---|
164
+ | Raw colors | `bg-blue-500`, `text-gray-700`, `bg-white` | `bg-primary`, `text-foreground`, `bg-background` |
165
+ | Dark prefix | `dark:bg-gray-900`, `dark:text-white` | Semantic tokens auto-adapt |
166
+ | Arbitrary values | `p-[17px]`, `text-[13px]`, `rounded-[7px]`, `z-[999]` | `p-4`, `text-sm`, `rounded-md`, `z-modal` |
167
+ | Icon sizing | `w-4 h-4`, `w-5 h-5` | `icon-sm`, `icon-md` |
168
+ | Raw durations | `duration-150`, `duration-200` | `duration-micro`, `duration-normal` |
169
+ | Raw shadows | `shadow-[0_2px_4px...]` | `shadow-sm` |
170
+ | Inline styles | `style={{ color: '#333' }}` | `className="text-foreground"` |
171
+ | @apply raw | `@apply bg-blue-500` | `@apply bg-primary` |
172
+ | Hardcoded hex | `#FF5733`, `rgb(51,51,51)` | Token classes |
173
+
174
+ ## When User Requests Custom Values
175
+
176
+ If the user explicitly asks for a value outside the token system:
177
+
178
+ ```
179
+ User: "Change this background to #FF5733"
180
+
181
+ AI: "This color is not in the token system.
182
+ Apply this custom value bypassing the tokens?
183
+ Or I can use an existing token (bg-primary, bg-error, etc.)."
184
+
185
+ User: "Apply it"
186
+ AI: → Apply the custom value
187
+ ```
188
+
189
+ **Rule:**
190
+ - User request within token range → execute immediately
191
+ - User request outside token range → ask "custom value, bypass tokens?" → execute only after confirmation
192
+ - AI writing code on its own → token system ONLY, never bypass
193
+
194
+ ---
195
+
196
+ ## Dark Mode
197
+
198
+ Dark mode is **automatic** when using semantic tokens. No `dark:` prefix needed.
199
+
200
+ | ❌ NEVER | ✅ CORRECT |
201
+ |---|---|
202
+ | `bg-white dark:bg-gray-900` | `bg-background` |
203
+ | `text-gray-900 dark:text-gray-100` | `text-foreground` |
204
+ | `text-gray-500 dark:text-gray-400` | `text-muted` |
205
+ | `border-gray-200 dark:border-gray-700` | `border-border` |
206
+
207
+ ### Dark Mode Toggle Implementation
208
+
209
+ Strategy: `dark` class on `<html>` element.
210
+
211
+ **Required behavior:**
212
+ 1. Toggle adds/removes `dark` class on `<html>`
213
+ 2. Persist choice to localStorage (key: `"theme"`)
214
+ 3. On page load: check localStorage first → fallback to system preference
215
+ 4. System preference: `window.matchMedia('(prefers-color-scheme: dark)')`
216
+
217
+ **Three states:** `'light'` | `'dark'` | `'system'`
218
+
219
+ **Minimal logic:**
220
+ - Read: `localStorage.getItem('theme') || 'system'`
221
+ - Apply: `document.documentElement.classList.toggle('dark', isDark)`
222
+ - Save: `localStorage.setItem('theme', newTheme)`
223
+
224
+ **Add a toggle button in the header** that cycles through light → dark → system (or light ↔ dark).
225
+
226
+ ---
227
+
228
+ # ═══ SECTION 3: TOKEN REFERENCE ═══
229
+
230
+ > Token values depend on the user's project configuration.
231
+ > The names below are the API. Never assume specific hex values.
232
+
233
+ ## Colors — Semantic (theme-aware, USE THESE)
234
+
235
+ **Background:**
236
+ - `background` — main page background
237
+ - `background-paper` — card/surface background
238
+ - `background-elevated` — elevated surface (above paper)
239
+ - `background-muted` — subtle/subdued background
240
+
241
+ **Text:**
242
+ - `foreground` (alias: `text`) — primary text
243
+ - `text-muted` — secondary text, lower emphasis
244
+ - `text-subtle` — tertiary text, lowest emphasis
245
+ - `text-link` — link color
246
+ - `text-primary` — brand-colored text
247
+
248
+ **Intent Status:**
249
+ - `text-info` / `text-success` / `text-error` / `text-warning`
250
+
251
+ **Intent Colors (each has 5 variants):**
252
+ - `primary` / `primary-hover` / `primary-active` / `primary-tint` / `primary-foreground`
253
+ - `secondary` / `secondary-hover` / `secondary-active` / `secondary-tint` / `secondary-foreground`
254
+ - `success` / `success-hover` / `success-active` / `success-tint` / `success-foreground`
255
+ - `warning` / `warning-hover` / `warning-active` / `warning-tint` / `warning-foreground`
256
+ - `error` / `error-hover` / `error-active` / `error-tint` / `error-foreground`
257
+ - `info` / `info-hover` / `info-active` / `info-tint` / `info-foreground`
258
+
259
+ **Border:**
260
+ - `border` — default border
261
+ - `border-subtle` — lighter/softer border
262
+ - `border-strong` — stronger/darker border
263
+
264
+ **State:**
265
+ - `disabled` — disabled background
266
+ - `disabled-text` — disabled text
267
+ - `focus-ring` — focus indicator
268
+ - `focus-ring-error` — error focus indicator
269
+
270
+ ## Colors — Primitive (raw palette, use sparingly)
271
+
272
+ 7 color families, each with 50–900 shades (10 steps):
273
+ `gray`, `primary`, `secondary`, `blue`, `green`, `red`, `yellow`
274
+
275
+ Usage: `bg-primary-100`, `text-gray-600`, `border-blue-300`
276
+ **Prefer semantic tokens over primitives** — primitives don't auto-adapt to dark mode.
277
+ **Note:** The actual colors of each palette depend on the user's token configuration.
278
+
279
+ ## Spacing
280
+
281
+ | Token | Value | Common Use |
282
+ |---|---|---|
283
+ | `0` | 0 | Reset |
284
+ | `0.5` | 2px | Micro gap |
285
+ | `1` | 4px | Tight gap |
286
+ | `1.5` | 6px | Small gap |
287
+ | `2` | 8px | Default gap |
288
+ | `2.5` | 10px | — |
289
+ | `3` | 12px | Section gap |
290
+ | `4` | 16px | Card padding |
291
+ | `5` | 20px | — |
292
+ | `6` | 24px | Section padding |
293
+ | `7` | 28px | — |
294
+ | `8` | 32px | Large padding |
295
+ | `10` | 40px | — |
296
+ | `12` | 48px | — |
297
+ | `14` | 56px | — |
298
+ | `16` | 64px | Page margin |
299
+ | `20` | 80px | — |
300
+ | `24` | 96px | Hero spacing |
301
+
302
+ ## Typography
303
+
304
+ **Font Families:**
305
+ - `font-sans` — sans-serif body font (user-defined)
306
+ - `font-mono` — monospace code font (user-defined)
307
+
308
+ **Font Sizes:**
309
+
310
+ | Class | Size | Line Height | Use Case |
311
+ |---|---|---|---|
312
+ | `text-2xs` | 11px | 16px | Fine print |
313
+ | `text-xs` | 12px | 18px | Caption, badge |
314
+ | `text-sm` | 13px | 20px | Body small, table |
315
+ | `text-md` | 14px | 22px | Body default |
316
+ | `text-base` | 16px | 26px | Body large |
317
+ | `text-lg` | 18px | 28px | Subtitle |
318
+ | `text-xl` | 20px | 30px | Title |
319
+ | `text-2xl` | 24px | 34px | Heading |
320
+ | `text-3xl` | 30px | 40px | Hero subtitle |
321
+ | `text-4xl` | 36px | 46px | Hero title |
322
+ | `text-5xl` | 48px | 58px | Display |
323
+
324
+ **Font Weights:**
325
+ - `font-normal` (400) — body text
326
+ - `font-semibold` (600) — labels, emphasis
327
+ - `font-bold` (700) — headings
328
+
329
+ ## Border Radius
330
+
331
+ | Class | Value | Use Case |
332
+ |---|---|---|
333
+ | `rounded-none` | 0px | Square |
334
+ | `rounded-sm` | 2px | Subtle |
335
+ | `rounded-base` | 4px | Default (checkbox) |
336
+ | `rounded-md` | 6px | Default (button) |
337
+ | `rounded-lg` | 8px | Card, input |
338
+ | `rounded-xl` | 12px | Large card |
339
+ | `rounded-2xl` | 16px | Modal |
340
+ | `rounded-3xl` | 24px | Pill shape |
341
+ | `rounded-full` | 9999px | Circle, pill button |
342
+
343
+ ## Shadows
344
+
345
+ | Class | Description |
346
+ |---|---|
347
+ | `shadow-xs` | Barely visible — subtle elevation |
348
+ | `shadow-sm` | Default card shadow |
349
+ | `shadow-md` | Dropdown, popover |
350
+ | `shadow-lg` | Modal, drawer |
351
+ | `shadow-xl` | Floating action |
352
+
353
+ Shadows automatically adapt between light and dark themes.
354
+
355
+ ## Z-Index (named stack)
356
+
357
+ | Class | Value | Use Case |
358
+ |---|---|---|
359
+ | `z-0` | 0 | Default |
360
+ | `z-10`–`z-50` | 10–50 | Layout layers |
361
+ | `z-sticky` | 100 | Sticky header |
362
+ | `z-dropdown` | 1000 | Dropdown menu |
363
+ | `z-overlay` | 1100 | Overlay/backdrop |
364
+ | `z-modal` | 2000 | Modal dialog |
365
+ | `z-popover` | 2100 | Popover |
366
+ | `z-tooltip` | 2200 | Tooltip |
367
+ | `z-toast` | 3000 | Toast notification |
368
+
369
+ **Never use arbitrary z-index values.** Always use these named tokens.
370
+
371
+ ## Icon Sizes (6-step scale)
372
+
373
+ | Class | Size | Use Case |
374
+ |---|---|---|
375
+ | `icon-2xs` | 12px | Badge icon, small indicator |
376
+ | `icon-xs` | 14px | xs/sm button icon, tag |
377
+ | `icon-sm` | 16px | Default button icon, form element |
378
+ | `icon-md` | 20px | Navigation, default icon button |
379
+ | `icon-lg` | 24px | Large icon button, card |
380
+ | `icon-xl` | 32px | Hero, feature icon |
381
+
382
+ **Never use `w-4 h-4` for icons.** Always use `icon-{size}` classes.
383
+
384
+ ## Duration
385
+
386
+ | Class | Value | Use Case |
387
+ |---|---|---|
388
+ | `duration-instant` | 0ms | No animation |
389
+ | `duration-fast` | 100ms | Micro interactions |
390
+ | `duration-micro` | 150ms | Button press, toggle |
391
+ | `duration-normal` | 200ms | Default transition |
392
+ | `duration-slow` | 300ms | Panel slide |
393
+ | `duration-slower` | 400ms | Page transition |
394
+ | `duration-slowest` | 500ms | Complex animation |
395
+ | `duration-spin` | 1000ms | Spinner rotation |
396
+
397
+ ## Easing
398
+
399
+ - `ease-linear` — constant speed
400
+ - `ease-ease` — natural acceleration/deceleration
401
+ - `ease-ease-in` — slow start
402
+ - `ease-ease-out` — slow end
403
+ - `ease-ease-in-out` — slow start and end
404
+
405
+ ## Opacity
406
+
407
+ 21-step scale: `opacity-0`, `opacity-5`, `opacity-10` ... `opacity-95`, `opacity-100`
408
+ Each 5% increment. Values: 0, 0.05, 0.10 ... 0.95, 1.0
409
+
410
+ ## Scale (Transform)
411
+
412
+ | Class | Value | Use Case |
413
+ |---|---|---|
414
+ | `scale-50` | 0.5 | Half size |
415
+ | `scale-75` | 0.75 | Reduced |
416
+ | `scale-95` | 0.95 | Hover shrink |
417
+ | `scale-pressed` | 0.98 | Button press effect |
418
+
419
+ ## Breakpoints
420
+
421
+ | Class | Min Width | Use Case |
422
+ |---|---|---|
423
+ | `sm:` | 640px | Mobile landscape |
424
+ | `md:` | 768px | Tablet |
425
+ | `lg:` | 1024px | Desktop |
426
+ | `xl:` | 1280px | Wide desktop |
427
+ | `2xl:` | 1536px | Ultra-wide |
428
+
429
+ ---
430
+
431
+ # ═══ SECTION 4: TOKEN CUSTOMIZATION ═══
432
+
433
+ ## ⛔ Rule for AI: Use Existing Tokens Only
434
+
435
+ The token system is comprehensive — semantic colors, primitives, spacing, typography, radius, shadows, z-index, icon sizes, duration, easing, opacity, scale, and breakpoints cover all UI needs.
436
+
437
+ **Every visual value you need already exists as a token.** Use it.
438
+
439
+ - **Always use token names** (`bg-primary`, `text-foreground`, `rounded-lg`) — never hardcode values
440
+ - **Never assume specific color values** — token values are defined by the user's project
441
+ - **Never add CSS variables, hex values, or arbitrary Tailwind values**
442
+ - **Token customization is the user's responsibility** — if the user needs custom values, they will handle it separately. See: https://7onic.design/components/theming
443
+ - **Never modify generated token files** — the following files are auto-generated from figma-tokens.json via sync-tokens. AI must never edit, add to, or delete from these files: `variables.css`, `light.css`, `dark.css`, `v3-preset.js`, `v4-theme.css`, `index.js`, `index.mjs`, `index.d.ts`, `tokens.json`
444
+
445
+ ### Self-Check (after writing ANY code)
446
+
447
+ Before presenting code to the user, scan your own output for violations:
448
+
449
+ - [ ] Any raw color class? (`bg-blue-*`, `text-gray-*`, `bg-white`, `border-gray-*`)
450
+ - [ ] Any arbitrary value? (`p-[*]`, `text-[*]`, `rounded-[*]`, `z-[*]`)
451
+ - [ ] Any inline style? (`style={{ }}`)
452
+ - [ ] Any `dark:` prefix?
453
+ - [ ] Any `w-N h-N` for icons instead of `icon-*`?
454
+ - [ ] Any `divide-*` or `border` without a token color? (`divide-y` alone → `divide-y divide-border`)
455
+ - [ ] Any `opacity-*` on element instead of color modifier? (`bg-primary opacity-10` → `bg-primary/10`)
456
+
457
+ **If ANY violation is found → fix it before showing code to the user.**
458
+ **Do NOT present code with violations. Fix first, then present.**
459
+
460
+ ---
461
+
462
+ - **When in doubt, check the documentation** — if token usage is unclear, refer to the official docs:
463
+ - Token pages: `https://7onic.design/design-tokens/{name}` (e.g., `/design-tokens/colors`, `/design-tokens/spacing`)
464
+ - Do not guess token values or usage — verify from the documentation first
465
+
466
+ ---
467
+
468
+ ## Links
469
+
470
+ - Documentation: https://7onic.design
471
+ - npm (tokens): https://npmjs.com/package/@7onic-ui/tokens
472
+ - npm (react): https://npmjs.com/package/@7onic-ui/react
473
+ - GitHub: https://github.com/itonys/7onic
474
+ - Full AI guide (tokens + components): https://7onic.design/llms-full.txt
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@7onic-ui/react",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "private": false,
5
5
  "sideEffects": [
6
6
  "*.css"
@@ -17,7 +17,8 @@
17
17
  }
18
18
  },
19
19
  "files": [
20
- "dist"
20
+ "dist",
21
+ "llms.txt"
21
22
  ],
22
23
  "scripts": {
23
24
  "dev": "next dev",