@synertech/ui 0.39.0 → 0.40.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/.claude/skills/use-synertech-ui/SKILL.md +147 -4
- package/README.md +14 -4
- package/dist/index.cjs +11 -11
- package/dist/index.d.cts +745 -7
- package/dist/index.d.ts +745 -7
- package/dist/index.js +11 -11
- package/dist/markdown-editor.cjs +1 -0
- package/dist/markdown-editor.d.cts +15 -0
- package/dist/markdown-editor.d.ts +15 -0
- package/dist/markdown-editor.js +1 -0
- package/dist/styles.css +117 -7
- package/dist/types-99-Ej5og.d.cts +15 -0
- package/dist/types-99-Ej5og.d.ts +15 -0
- package/package.json +12 -2
|
@@ -53,17 +53,28 @@ import "@synertech/ui/styles.css";
|
|
|
53
53
|
React >= 18 et React-DOM >= 18 doivent etre installés dans le projet consommateur.
|
|
54
54
|
|
|
55
55
|
`@mdxeditor/editor` est une peer dependency **optionnelle**, utilisée uniquement par
|
|
56
|
-
`<HelpButton markdown editable>`.
|
|
57
|
-
|
|
56
|
+
`<HelpButton markdown editable>`. L'éditeur est publié sur un point d'entrée séparé, pour
|
|
57
|
+
que les applications qui n'éditent pas de Markdown ne l'installent ni ne l'embarquent :
|
|
58
58
|
|
|
59
59
|
```bash
|
|
60
60
|
pnpm add @mdxeditor/editor
|
|
61
61
|
```
|
|
62
62
|
|
|
63
63
|
```tsx
|
|
64
|
-
|
|
64
|
+
"use client";
|
|
65
|
+
|
|
66
|
+
import { HelpButton } from "@synertech/ui";
|
|
67
|
+
import { MarkdownEditor } from "@synertech/ui/markdown-editor";
|
|
68
|
+
|
|
69
|
+
<HelpButton content={aide} markdown editable markdownEditor={MarkdownEditor} />;
|
|
65
70
|
```
|
|
66
71
|
|
|
72
|
+
`markdownEditor` est un composant : passez-le depuis un Client Component. La feuille de
|
|
73
|
+
style de l'éditeur est incluse. Sans cette prop, le mode édition affiche un message.
|
|
74
|
+
|
|
75
|
+
**Anti-pattern** : ne jamais importer `@synertech/ui/markdown-editor` dans une application
|
|
76
|
+
qui n'installe pas `@mdxeditor/editor` — son build échouerait sur un module introuvable.
|
|
77
|
+
|
|
67
78
|
---
|
|
68
79
|
|
|
69
80
|
## Imports
|
|
@@ -136,6 +147,16 @@ import { cn } from "@synertech/ui";
|
|
|
136
147
|
| `Label` | Étiquette de formulaire | Oui |
|
|
137
148
|
| `Banner` | Bannière notification/hero/promotion | Non |
|
|
138
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
|
+
|
|
139
160
|
### Feedback & Overlays
|
|
140
161
|
|
|
141
162
|
| Composant | Description | Server-compatible |
|
|
@@ -513,6 +534,128 @@ import { ImageUploader } from "@synertech/ui";
|
|
|
513
534
|
/>
|
|
514
535
|
```
|
|
515
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
|
+
|
|
516
659
|
### Card (Composable)
|
|
517
660
|
|
|
518
661
|
```tsx
|
|
@@ -1570,7 +1713,7 @@ Un dialogue vraiment specifique se construit avec le hook exporte
|
|
|
1570
1713
|
## Documentation interactive
|
|
1571
1714
|
|
|
1572
1715
|
La documentation Storybook avec tous les composants et leurs variantes est disponible a :
|
|
1573
|
-
**https://ui.synertechweb.com/**
|
|
1716
|
+
**https://ui.synertechweb.com/storybook/**
|
|
1574
1717
|
|
|
1575
1718
|
Chaque composant a une page interactive avec :
|
|
1576
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
|
|
|
@@ -51,15 +51,25 @@ module.exports = {
|
|
|
51
51
|
**optional** peer dependency — it pulls in a large dependency tree, so it is not
|
|
52
52
|
installed with the library. Every other component works without it.
|
|
53
53
|
|
|
54
|
+
The editor ships from its own entry point, so apps that never edit Markdown
|
|
55
|
+
never install or bundle it:
|
|
56
|
+
|
|
54
57
|
```bash
|
|
55
58
|
pnpm add @mdxeditor/editor
|
|
56
59
|
```
|
|
57
60
|
|
|
58
61
|
```tsx
|
|
59
|
-
|
|
62
|
+
"use client";
|
|
63
|
+
|
|
64
|
+
import { HelpButton } from "@synertech/ui";
|
|
65
|
+
import { MarkdownEditor } from "@synertech/ui/markdown-editor";
|
|
66
|
+
|
|
67
|
+
<HelpButton content={help} markdown editable markdownEditor={MarkdownEditor} />;
|
|
60
68
|
```
|
|
61
69
|
|
|
62
|
-
|
|
70
|
+
`markdownEditor` is a component, so pass it from a Client Component. The editor's
|
|
71
|
+
stylesheet is included. Without the prop, the edit mode renders an explanatory
|
|
72
|
+
message instead of the editor.
|
|
63
73
|
|
|
64
74
|
|
|
65
75
|
## Usage
|
|
@@ -235,7 +245,7 @@ Then open [http://localhost:6006](http://localhost:6006).
|
|
|
235
245
|
|
|
236
246
|
Storybook is automatically deployed to GitLab Pages on every push to `main`:
|
|
237
247
|
|
|
238
|
-
👉 **https://ui.synertechweb.com/**
|
|
248
|
+
👉 **https://ui.synertechweb.com/storybook/**
|
|
239
249
|
|
|
240
250
|
## Releasing
|
|
241
251
|
|