v0.1.8 — corrige l'import côté Server Component (Next App Router)
- ToastProvider/useToast déplacés dans @napps/design-system/toast ("use client")
- index principal de nouveau importable depuis un Server Component
- test de non-régression test/run-next-smoke.sh (next build)
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
// Server Component (pas de "use client"). Importe CHAQUE export d'exécution du point d'entrée
|
||||
// principal : si l'un d'eux appelle une API réservée aux composants client au chargement du
|
||||
// module (createContext…), `next build` échoue ici — c'est la régression de la v0.1.7.
|
||||
import {
|
||||
Badge, Button, Card, Checkbox, ColorPicker, Dialog, EmptyState, IconBadge, ListRow, Radio,
|
||||
SegmentedControl, Select, Spinner, Surface, TabBar, Text, TextField, Toast, Toggle, Toolbar,
|
||||
} from '@napps/design-system';
|
||||
import * as DS from '@napps/design-system';
|
||||
import { ClientDemo } from './client-demo';
|
||||
|
||||
// Exports qui ne peuvent qu'être importés côté serveur (props fonctions) : ils doivent au moins exister.
|
||||
const importOnly = { Checkbox, ColorPicker, Dialog, Radio, SegmentedControl, TabBar, Toggle };
|
||||
|
||||
export default function Page() {
|
||||
const missing = Object.entries(importOnly).filter(([, v]) => typeof v !== 'function').map(([k]) => k);
|
||||
if (missing.length) throw new Error(`exports manquants : ${missing.join(', ')}`);
|
||||
// ToastProvider/useToast ne doivent PAS être dans l'index principal (composants client).
|
||||
for (const k of ['ToastProvider', 'useToast']) {
|
||||
if (k in DS) throw new Error(`${k} ne doit pas être exporté par l'index principal`);
|
||||
}
|
||||
return (
|
||||
<Surface level="grouped">
|
||||
<Toolbar title="Smoke" />
|
||||
<Text variant="headline">Titre</Text>
|
||||
<Card>
|
||||
<ListRow title="Ligne" subtitle="sous-titre" trailing={<Badge tone="neutral">1</Badge>} />
|
||||
<IconBadge tone="neutral">i</IconBadge>
|
||||
</Card>
|
||||
<TextField placeholder="champ" />
|
||||
<Select defaultValue="a"><option value="a">A</option></Select>
|
||||
<Button>OK</Button>
|
||||
<Spinner />
|
||||
<EmptyState title="Vide" />
|
||||
<Toast tone="success">Fait</Toast>
|
||||
<ClientDemo />
|
||||
</Surface>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user