@7onic-ui/react 0.2.9 → 0.3.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/llms.txt CHANGED
@@ -388,28 +388,9 @@ For detailed token reference, see: https://7onic.design/llms.txt
388
388
  import { Button, Card, Input, Toast } from '@7onic-ui/react'
389
389
  ```
390
390
 
391
- ## Compound Component Import Patterns
391
+ ## Component Import
392
392
 
393
- 24 compound components support **two equivalent import patterns** — choose based on your rendering context:
394
-
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)
393
+ All components use Named imports. Works in every environment (Next.js App Router RSC, Client Components, Pages Router, Vite, CRA, CJS).
413
394
 
414
395
  ```tsx
415
396
  import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from '@7onic-ui/react'
@@ -424,41 +405,13 @@ import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter }
424
405
  </Card>
425
406
  ```
426
407
 
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`).
430
-
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
- }
408
+ ### Compound Components (24)
440
409
 
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)
410
+ Components that provide sub-components. Each sub is a Named export (`CardHeader`, `ModalContent`, `TabsList`, etc.).
458
411
 
459
412
  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
413
 
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.
414
+ Prefer dot-notation (`<Card.Header>`)? See **Compound Recipe** section at end of this document.
462
415
 
463
416
  ### Standalone Components (16)
464
417
 
@@ -2319,6 +2272,35 @@ import { ChatMessage } from '@7onic-ui/react'
2319
2272
 
2320
2273
  ---
2321
2274
 
2275
+ ## Compound Recipe (opt-in self-wrapper)
2276
+
2277
+ v0.3.0+ library exports Named only (`<CardHeader>`). To restore dot-notation (`<Card.Header>`) in your project, add a 5-line wrapper file:
2278
+
2279
+ ```tsx
2280
+ // lib/card.tsx
2281
+ 'use client'
2282
+ import {
2283
+ Card as CardBase,
2284
+ CardHeader, CardTitle, CardDescription,
2285
+ CardContent, CardFooter, CardImage, CardAction,
2286
+ } from '@7onic-ui/react'
2287
+
2288
+ export const Card = Object.assign(CardBase, {
2289
+ Header: CardHeader, Title: CardTitle,
2290
+ Description: CardDescription, Content: CardContent,
2291
+ Footer: CardFooter, Image: CardImage, Action: CardAction,
2292
+ })
2293
+ // Then: <Card.Header>, <Card.Title>, etc. — Client Components only.
2294
+ ```
2295
+
2296
+ **Rules**:
2297
+ - Wrapper file must start with `'use client'` — Next.js Client Manifest cannot track `Object.assign` properties across RSC boundaries.
2298
+ - Recipe works only in Client Components. Server Components must use Named imports (`<CardHeader>`).
2299
+ - If you don't need dot-notation, skip this entirely — Named imports (`<CardHeader>`) work everywhere: RSC, Client, Vite, CRA, CJS.
2300
+ - 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.
2301
+
2302
+ ---
2303
+
2322
2304
  ## Links
2323
2305
 
2324
2306
  - 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.0",
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",