@7onic-ui/react 0.2.9 → 0.3.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.
package/llms.txt CHANGED
@@ -77,22 +77,16 @@ module.exports = {
77
77
  }
78
78
  ```
79
79
 
80
- **2-3. Set body classes:**
81
- ```html
82
- <body class="bg-background text-foreground">
83
- ```
84
-
85
- **2-4. Apply user's answers:**
80
+ **2-3. Apply user's answers:**
86
81
 
87
82
  - Dark mode = yes → implement dark mode toggle (see below)
88
83
  - Custom font → load font (next/font for Next.js, CDN for Vite) + set `--font-family-sans`
89
84
  - Locale includes Japanese → load Noto Sans JP font
90
85
  - Locale includes Korean → load Noto Sans KR font
91
86
 
92
- **2-5. Verify setup is complete before writing any UI code:**
87
+ **2-4. Verify setup is complete before writing any UI code:**
93
88
  - [ ] Packages installed (@7onic-ui/react, @7onic-ui/tokens, lucide-react)
94
89
  - [ ] globals.css has ALL required imports in correct order
95
- - [ ] Body has `bg-background text-foreground`
96
90
  - [ ] Dark mode toggle (if selected)
97
91
  - [ ] Font loaded (if custom)
98
92
  - [ ] CJK fonts loaded (if applicable)
@@ -121,7 +115,7 @@ Place `<Toaster />` once in your root layout file. Without this, `toast()` calls
121
115
  import { Toaster } from '@7onic-ui/react'
122
116
 
123
117
  // In your root layout (e.g., app/layout.tsx)
124
- <body className="bg-background text-foreground">
118
+ <body>
125
119
  {children}
126
120
  <Toaster position="bottom-right" />
127
121
  </body>
@@ -279,7 +273,7 @@ The token system covers all UI needs out of the box. As AI, use existing tokens
279
273
  If the user needs custom values beyond existing tokens, they will handle it separately.
280
274
  Customization guide: https://7onic.design/components/theming
281
275
 
282
- **Never modify generated token files** — these are auto-generated from figma-tokens.json via sync-tokens. AI must never edit, add to, or delete from: `variables.css`, `light.css`, `dark.css`, `v3-preset.js`, `v4-theme.css`, `index.js`, `index.mjs`, `index.d.ts`, `tokens.json`
276
+ **Never modify generated token files** — these are auto-generated from figma-tokens.json via sync-tokens. AI must never edit, add to, or delete from: `variables.css`, `light.css`, `dark.css`, `reset.css`, `v3-preset.js`, `v4-theme.css`, `index.js`, `index.mjs`, `index.d.ts`, `tokens.json`
283
277
 
284
278
  ### Self-Check (after writing ANY code)
285
279
 
@@ -388,28 +382,9 @@ For detailed token reference, see: https://7onic.design/llms.txt
388
382
  import { Button, Card, Input, Toast } from '@7onic-ui/react'
389
383
  ```
390
384
 
391
- ## Compound Component Import Patterns
392
-
393
- 24 compound components support **two equivalent import patterns** — choose based on your rendering context:
385
+ ## Component Import
394
386
 
395
- ### Pattern A: Namespace (dot notation) — Client Components
396
-
397
- ```tsx
398
- import { Card } from '@7onic-ui/react'
399
-
400
- <Card>
401
- <Card.Header>
402
- <Card.Title>Title</Card.Title>
403
- <Card.Description>Description</Card.Description>
404
- </Card.Header>
405
- <Card.Content>Content</Card.Content>
406
- <Card.Footer>Footer</Card.Footer>
407
- </Card>
408
- ```
409
-
410
- Better name grouping and readability. Works in files with `'use client'` directive.
411
-
412
- ### Pattern B: Named imports — works everywhere (including Server Components)
387
+ All components use Named imports. Works in every environment (Next.js App Router RSC, Client Components, Pages Router, Vite, CRA, CJS).
413
388
 
414
389
  ```tsx
415
390
  import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from '@7onic-ui/react'
@@ -424,41 +399,13 @@ import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter }
424
399
  </Card>
425
400
  ```
426
401
 
427
- ### ⚠️ Next.js Server Components — use Pattern B
428
-
429
- **Namespace pattern (`<Card.Header />`) does NOT work inside Server Components** due to a Next.js Client Manifest limitation (sub-component references cannot be tracked through `Object.assign`).
402
+ ### Compound Components (24)
430
403
 
431
- ```tsx
432
- // ❌ Server Component (default in App Router) — throws "Unsupported Server Component type: undefined"
433
- export default function Page() {
434
- return (
435
- <Card>
436
- <Card.Header>...</Card.Header>
437
- </Card>
438
- )
439
- }
440
-
441
- // ✅ Server Component — use named imports
442
- import { Card, CardHeader } from '@7onic-ui/react'
443
-
444
- export default function Page() {
445
- return (
446
- <Card>
447
- <CardHeader>...</CardHeader>
448
- </Card>
449
- )
450
- }
451
- ```
452
-
453
- **Rule of thumb:**
454
- - File has `'use client'` at top → either pattern works, namespace preferred
455
- - File has no directive (Server Component default in Next.js App Router) → named imports only
456
-
457
- ### Compound Components List (24)
404
+ Components that provide sub-components. Each sub is a Named export (`CardHeader`, `ModalContent`, `TabsList`, etc.).
458
405
 
459
406
  Accordion, Alert, Avatar, Breadcrumb, Card, ChatInput, ChatMessage, Chart, Drawer, DropdownMenu, Field, MetricCard, Modal, NavigationMenu, Pagination, Popover, QuickReply, RadioGroup, Segmented, Select, Table, Tabs, ToggleGroup, Tooltip
460
407
 
461
- Each compound component's sub-components can be imported as named exports. Example: `Card.Header` ↔ `CardHeader`, `Modal.Content` ↔ `ModalContent`, `Tabs.List` ↔ `TabsList`, etc. The code examples below use the namespace pattern; convert dots to camelCase for named imports when needed for Server Components.
408
+ Prefer dot-notation (`<Card.Header>`)? See **Compound Recipe** section at end of this document.
462
409
 
463
410
  ### Standalone Components (16)
464
411
 
@@ -2319,6 +2266,35 @@ import { ChatMessage } from '@7onic-ui/react'
2319
2266
 
2320
2267
  ---
2321
2268
 
2269
+ ## Compound Recipe (opt-in self-wrapper)
2270
+
2271
+ v0.3.0+ library exports Named only (`<CardHeader>`). To restore dot-notation (`<Card.Header>`) in your project, add a 5-line wrapper file:
2272
+
2273
+ ```tsx
2274
+ // lib/card.tsx
2275
+ 'use client'
2276
+ import {
2277
+ Card as CardBase,
2278
+ CardHeader, CardTitle, CardDescription,
2279
+ CardContent, CardFooter, CardImage, CardAction,
2280
+ } from '@7onic-ui/react'
2281
+
2282
+ export const Card = Object.assign(CardBase, {
2283
+ Header: CardHeader, Title: CardTitle,
2284
+ Description: CardDescription, Content: CardContent,
2285
+ Footer: CardFooter, Image: CardImage, Action: CardAction,
2286
+ })
2287
+ // Then: <Card.Header>, <Card.Title>, etc. — Client Components only.
2288
+ ```
2289
+
2290
+ **Rules**:
2291
+ - Wrapper file must start with `'use client'` — Next.js Client Manifest cannot track `Object.assign` properties across RSC boundaries.
2292
+ - Recipe works only in Client Components. Server Components must use Named imports (`<CardHeader>`).
2293
+ - If you don't need dot-notation, skip this entirely — Named imports (`<CardHeader>`) work everywhere: RSC, Client, Vite, CRA, CJS.
2294
+ - Compound namespaces (component families with sub-components): Accordion, Alert, AlertModal, Avatar, Breadcrumb, Card, Chart, ChatInput, ChatMessage, Drawer, DropdownMenu, Field, MetricCard, Modal, NavigationMenu, Pagination, Popover, QuickReply, RadioGroup, Segmented, Select, Table, Tabs, ToggleGroup, Tooltip.
2295
+
2296
+ ---
2297
+
2322
2298
  ## Links
2323
2299
 
2324
2300
  - Documentation: https://7onic.design
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@7onic-ui/react",
3
- "version": "0.2.9",
3
+ "version": "0.3.1",
4
4
  "private": false,
5
5
  "sideEffects": [
6
6
  "*.css"
@@ -94,6 +94,7 @@
94
94
  "devDependencies": {
95
95
  "@7onic-ui/tokens": "file:./tokens",
96
96
  "@clack/prompts": "^1.2.0",
97
+ "@playwright/test": "^1.59.1",
97
98
  "@types/node": "^20.14.0",
98
99
  "@types/react": "^19.0.0",
99
100
  "@types/react-dom": "^19.0.0",