@7onic-ui/react 0.2.8 → 0.2.9
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/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -1
- package/llms.txt +52 -5
- package/package.json +1 -1
package/llms.txt
CHANGED
|
@@ -388,14 +388,15 @@ 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
|
-
##
|
|
391
|
+
## Compound Component Import Patterns
|
|
392
392
|
|
|
393
|
-
|
|
393
|
+
24 compound components support **two equivalent import patterns** — choose based on your rendering context:
|
|
394
|
+
|
|
395
|
+
### Pattern A: Namespace (dot notation) — Client Components
|
|
394
396
|
|
|
395
397
|
```tsx
|
|
396
398
|
import { Card } from '@7onic-ui/react'
|
|
397
399
|
|
|
398
|
-
// ✅ Namespace usage (preferred)
|
|
399
400
|
<Card>
|
|
400
401
|
<Card.Header>
|
|
401
402
|
<Card.Title>Title</Card.Title>
|
|
@@ -404,15 +405,61 @@ import { Card } from '@7onic-ui/react'
|
|
|
404
405
|
<Card.Content>Content</Card.Content>
|
|
405
406
|
<Card.Footer>Footer</Card.Footer>
|
|
406
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)
|
|
413
|
+
|
|
414
|
+
```tsx
|
|
415
|
+
import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from '@7onic-ui/react'
|
|
407
416
|
|
|
408
|
-
|
|
409
|
-
|
|
417
|
+
<Card>
|
|
418
|
+
<CardHeader>
|
|
419
|
+
<CardTitle>Title</CardTitle>
|
|
420
|
+
<CardDescription>Description</CardDescription>
|
|
421
|
+
</CardHeader>
|
|
422
|
+
<CardContent>Content</CardContent>
|
|
423
|
+
<CardFooter>Footer</CardFooter>
|
|
424
|
+
</Card>
|
|
410
425
|
```
|
|
411
426
|
|
|
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
|
+
}
|
|
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
|
+
|
|
412
457
|
### Compound Components List (24)
|
|
413
458
|
|
|
414
459
|
Accordion, Alert, Avatar, Breadcrumb, Card, ChatInput, ChatMessage, Chart, Drawer, DropdownMenu, Field, MetricCard, Modal, NavigationMenu, Pagination, Popover, QuickReply, RadioGroup, Segmented, Select, Table, Tabs, ToggleGroup, Tooltip
|
|
415
460
|
|
|
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.
|
|
462
|
+
|
|
416
463
|
### Standalone Components (16)
|
|
417
464
|
|
|
418
465
|
Badge, Button, ButtonGroup, Checkbox, Divider, IconButton, Input, Progress, Skeleton, Slider, Spinner, Switch, Textarea, Toast, Toggle, TypingIndicator
|