@synertech/ui 0.39.1 → 0.40.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/.claude/skills/use-synertech-ui/SKILL.md +133 -1
- package/README.md +2 -2
- package/dist/index.cjs +11 -11
- package/dist/index.d.cts +732 -2
- package/dist/index.d.ts +732 -2
- package/dist/index.js +11 -11
- package/dist/styles.css +117 -7
- package/package.json +1 -1
|
@@ -147,6 +147,16 @@ import { cn } from "@synertech/ui";
|
|
|
147
147
|
| `Label` | Étiquette de formulaire | Oui |
|
|
148
148
|
| `Banner` | Bannière notification/hero/promotion | Non |
|
|
149
149
|
|
|
150
|
+
### Charts
|
|
151
|
+
|
|
152
|
+
- `LineChart` - Évolution dans le temps (multi-séries, steppée, prévision en pointillés)
|
|
153
|
+
- `AreaChart` - Idem avec remplissage : simple, empilée, empilée 100 %
|
|
154
|
+
- `BarChart` - Comparaison entre catégories : verticale/horizontale, groupée, empilée, 100 %
|
|
155
|
+
- `PieChart` - Proportions sur peu de catégories (camembert ou anneau)
|
|
156
|
+
- `ScatterChart` - Corrélation entre deux variables numériques (3 séries max)
|
|
157
|
+
- `StatCard` / `StatCardGroup` - Valeur unique avec variation et sparkline
|
|
158
|
+
- `Sparkline` - Courbe sans axe, pour une cellule ou une carte
|
|
159
|
+
|
|
150
160
|
### Feedback & Overlays
|
|
151
161
|
|
|
152
162
|
| Composant | Description | Server-compatible |
|
|
@@ -524,6 +534,128 @@ import { ImageUploader } from "@synertech/ui";
|
|
|
524
534
|
/>
|
|
525
535
|
```
|
|
526
536
|
|
|
537
|
+
### Charts
|
|
538
|
+
|
|
539
|
+
Tous les graphiques partagent la même forme de données : un tableau de lignes
|
|
540
|
+
et des séries qui pointent un champ, exactement comme `DataGrid`.
|
|
541
|
+
|
|
542
|
+
```tsx
|
|
543
|
+
import { LineChart, AreaChart, BarChart, PieChart, ScatterChart } from "@synertech/ui";
|
|
544
|
+
|
|
545
|
+
const data = [
|
|
546
|
+
{ month: "Jan", revenue: 18400, cost: 12200 },
|
|
547
|
+
{ month: "Fév", revenue: 21100, cost: 13050 },
|
|
548
|
+
];
|
|
549
|
+
|
|
550
|
+
<LineChart
|
|
551
|
+
data={data}
|
|
552
|
+
x={{ key: "month", label: "Mois" }} // scale: "category" | "linear" | "time"
|
|
553
|
+
series={[
|
|
554
|
+
{ key: "revenue", label: "Revenu" },
|
|
555
|
+
{ key: "cost", label: "Coût" },
|
|
556
|
+
]}
|
|
557
|
+
title="Revenu et coût"
|
|
558
|
+
description="Six derniers mois"
|
|
559
|
+
height={260} // la largeur suit toujours le conteneur
|
|
560
|
+
curve="monotone" // "linear" | "monotone" | "step" | "stepAfter"
|
|
561
|
+
forecastFrom="Juin" // la suite passe en pointillés
|
|
562
|
+
forecastLabel="prévision"
|
|
563
|
+
emphasis="revenue" // une série en couleur, les autres en gris
|
|
564
|
+
referenceLines={[{ value: 30000, label: "Objectif" }]}
|
|
565
|
+
tableView="toggle" // le jumeau accessible du graphique
|
|
566
|
+
onPointClick={(point) => console.log(point.value)}
|
|
567
|
+
/>
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
**Props communes** : `data`, `series`, `x`, `y`, `height`, `size`, `grid`,
|
|
571
|
+
`legend`, `tooltip`, `tableView`, `emphasis`, `title`, `description`, `loading`,
|
|
572
|
+
`emptyState`, `locale`, `className`.
|
|
573
|
+
|
|
574
|
+
```tsx
|
|
575
|
+
// Aire : simple, empilée, ou 100 %
|
|
576
|
+
<AreaChart data={data} x={{ key: "month" }} series={series} stack="percent" />
|
|
577
|
+
|
|
578
|
+
// Barres : les deux orientations, groupées ou empilées
|
|
579
|
+
<BarChart
|
|
580
|
+
data={data}
|
|
581
|
+
x={{ key: "region" }}
|
|
582
|
+
series={series}
|
|
583
|
+
orientation="horizontal" // dès que les noms de catégories sont longs
|
|
584
|
+
stack="none" // "none" (groupé) | "stacked" | "percent"
|
|
585
|
+
sort="desc" // le tableau de données suit le même ordre
|
|
586
|
+
showValues
|
|
587
|
+
/>
|
|
588
|
+
|
|
589
|
+
// Camembert ou anneau
|
|
590
|
+
<PieChart
|
|
591
|
+
data={sources}
|
|
592
|
+
x={{ key: "source" }}
|
|
593
|
+
value="visits"
|
|
594
|
+
variant="donut"
|
|
595
|
+
maxSlices={6} // la queue est repliée dans « Autres »
|
|
596
|
+
centerLabel={{ value: "48,1 K", label: "Visites" }}
|
|
597
|
+
/>
|
|
598
|
+
|
|
599
|
+
// Nuage de points — 3 séries maximum
|
|
600
|
+
<ScatterChart
|
|
601
|
+
data={campaigns}
|
|
602
|
+
x={{ key: "budget", scale: "linear", label: "Budget" }}
|
|
603
|
+
series={[{ key: "conversions" }]}
|
|
604
|
+
bubble={{ key: "clients", range: [4, 18] }}
|
|
605
|
+
trendLine
|
|
606
|
+
/>
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
**Ce que les composants refusent de faire, et pourquoi :**
|
|
610
|
+
|
|
611
|
+
- **Pas de second axe Y.** Deux mesures d'échelles différentes inventent une
|
|
612
|
+
corrélation absente des données. Deux graphiques, ou une indexation base 100.
|
|
613
|
+
- **`LineChart` ne s'ancre pas à zéro ; `AreaChart` et `BarChart` si.** Une ligne
|
|
614
|
+
se lit à sa pente, une barre à la longueur de sa marque. `y={{ includeZero: true }}`
|
|
615
|
+
quand le niveau absolu compte.
|
|
616
|
+
- **Au-delà de 8 séries**, la 9ᵉ passe en gris : replier la queue ou facetter.
|
|
617
|
+
Un nuage de points s'arrête à 3 séries.
|
|
618
|
+
- **`PieChart` n'est pas fait pour comparer des valeurs proches** — l'œil compare
|
|
619
|
+
mal des angles. Deux parts, c'est une `StatCard`.
|
|
620
|
+
|
|
621
|
+
### Cartes KPI
|
|
622
|
+
|
|
623
|
+
```tsx
|
|
624
|
+
import { StatCard, StatCardGroup, Sparkline } from "@synertech/ui";
|
|
625
|
+
|
|
626
|
+
<StatCardGroup columns={4}>
|
|
627
|
+
<StatCard
|
|
628
|
+
label="Revenu mensuel"
|
|
629
|
+
value={38400} // exact sous 10 000, compact au-dessus
|
|
630
|
+
delta={{ value: 0.124, period: "vs mois dernier" }}
|
|
631
|
+
trend={last12Months} // dessine une Sparkline
|
|
632
|
+
/>
|
|
633
|
+
<StatCard
|
|
634
|
+
label="Coût serveur"
|
|
635
|
+
value={4200}
|
|
636
|
+
delta={{ value: -0.18, goodWhen: "down" }} // une baisse = bonne nouvelle
|
|
637
|
+
/>
|
|
638
|
+
</StatCardGroup>
|
|
639
|
+
|
|
640
|
+
<Sparkline data={values} area emphasizeLast domain={[0, 100]} />
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
`StatCard` et `Sparkline` n'utilisent aucun hook : ils fonctionnent en composant
|
|
644
|
+
serveur, sans `"use client"`.
|
|
645
|
+
|
|
646
|
+
### Rhabiller la palette
|
|
647
|
+
|
|
648
|
+
Les huit couleurs de séries sont des variables CSS. Un bloc suffit à aligner
|
|
649
|
+
tout le kit sur une charte :
|
|
650
|
+
|
|
651
|
+
```css
|
|
652
|
+
:root {
|
|
653
|
+
--color-chart-1: #0f766e;
|
|
654
|
+
--color-chart-2: #b45309;
|
|
655
|
+
/* ... jusqu'à 8 */
|
|
656
|
+
}
|
|
657
|
+
```
|
|
658
|
+
|
|
527
659
|
### Card (Composable)
|
|
528
660
|
|
|
529
661
|
```tsx
|
|
@@ -1581,7 +1713,7 @@ Un dialogue vraiment specifique se construit avec le hook exporte
|
|
|
1581
1713
|
## Documentation interactive
|
|
1582
1714
|
|
|
1583
1715
|
La documentation Storybook avec tous les composants et leurs variantes est disponible a :
|
|
1584
|
-
**https://ui.synertechweb.com/**
|
|
1716
|
+
**https://ui.synertechweb.com/storybook/**
|
|
1585
1717
|
|
|
1586
1718
|
Chaque composant a une page interactive avec :
|
|
1587
1719
|
- Props table auto-generee
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A TypeScript/React UI component library using Tailwind CSS classes. Published on the public npm registry.
|
|
4
4
|
|
|
5
|
-
📖 **[View Storybook](https://ui.synertechweb.com/)** — Interactive component documentation
|
|
5
|
+
📖 **[View Storybook](https://ui.synertechweb.com/storybook/)** — Interactive component documentation
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
@@ -245,7 +245,7 @@ Then open [http://localhost:6006](http://localhost:6006).
|
|
|
245
245
|
|
|
246
246
|
Storybook is automatically deployed to GitLab Pages on every push to `main`:
|
|
247
247
|
|
|
248
|
-
👉 **https://ui.synertechweb.com/**
|
|
248
|
+
👉 **https://ui.synertechweb.com/storybook/**
|
|
249
249
|
|
|
250
250
|
## Releasing
|
|
251
251
|
|