chrv-components 1.11.3 → 1.11.4

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/README.md CHANGED
@@ -37,24 +37,23 @@
37
37
 
38
38
  ### 📊 Affichage de données
39
39
 
40
- - **ChrDataTableComponent** - Nouvelle version de table
40
+ - **ChrDataTable** - Table de données avec fonctionnalités avancées
41
+ - **ChrTableComponent** - Table avec tri et fonctionnalités
41
42
  - **ChrPaginatorComponent** - Pagination avec gestion des cookies
42
43
 
43
44
  ### 🎯 Interface utilisateur
44
45
 
45
46
  - **ChrButtonComponent** - Bouton avec icônes et couleurs personnalisables
46
- - **ChrButtonNewComponent** - Nouvelle version du bouton
47
47
  - **ChrSpinnerComponent** - Indicateur de chargement
48
48
  - **ChrToastComponent** - Notifications toast
49
- - **ChrSeparatorComponent** - Séparateur visuel
50
49
  - **ChrInlineSvgComponent** - Affichage SVG inline
51
50
 
52
51
  ### 🧭 Navigation
53
52
 
54
53
  - **ChrBreadcrumbComponent** - Fil d'Ariane de navigation
55
- - **ChrTabComponent** - Onglet individuel
56
- - **ChrTabGroupComponent** - Groupe d'onglets
57
- - **ChrCarouselComponent** - Carrousel d'images/contenu
54
+ - **TabComponent** - Onglet individuel
55
+ - **TabGroupComponent** - Groupe d'onglets
56
+ - **CarouselComponent** - Carrousel d'images/contenu
58
57
 
59
58
  ### 🎛️ Directives
60
59
 
@@ -137,26 +136,44 @@ Bouton personnalisable avec icônes et couleurs :
137
136
 
138
137
  ### 📝 ChrFormComponent
139
138
 
140
- Formulaire dynamique avec sections et contrôles :
139
+ Formulaire dynamique basé sur l'interface IControl :
140
+
141
+ **Option 1 : Avec sections**
141
142
 
142
143
  ```html
143
- <app-chr-form [sections]="formSections" [controls]="formControls"> </app-chr-form>
144
+ <app-chr-form [sections]="formSections"></app-chr-form>
144
145
  ```
145
146
 
146
147
  ```typescript
147
148
  export class FormExampleComponent {
148
- formSections = [
149
+ formSections: IFormSection[] = [
149
150
  {
150
151
  title: "Informations personnelles",
151
- controls: ["name", "email", "birthDate"],
152
+ controls: [
153
+ { name: "firstName", type: "text", label: "Prénom" },
154
+ { name: "lastName", type: "text", label: "Nom" },
155
+ { name: "email", type: "text", label: "Email" },
156
+ { name: "birthDate", type: "date", label: "Date de naissance" },
157
+ ],
152
158
  },
153
159
  ];
160
+ }
161
+ ```
162
+
163
+ **Option 2 : Avec contrôles directement**
164
+
165
+ ```html
166
+ <app-chr-form [controls]="formControls"></app-chr-form>
167
+ ```
154
168
 
155
- formControls = {
156
- name: { type: "text", label: "Nom", required: true },
157
- email: { type: "email", label: "Email", required: true },
158
- birthDate: { type: "date", label: "Date de naissance" },
159
- };
169
+ ```typescript
170
+ export class FormExampleComponent {
171
+ formControls: IControl[] = [
172
+ { name: "firstName", type: "text", label: "Prénom" },
173
+ { name: "lastName", type: "text", label: "Nom" },
174
+ { name: "email", type: "text", label: "Email" },
175
+ { name: "birthDate", type: "date", label: "Date de naissance" },
176
+ ];
160
177
  }
161
178
  ```
162
179
 
@@ -193,7 +210,7 @@ Service pour gérer les modals avec injection de données :
193
210
 
194
211
  ```typescript
195
212
  import { Component, inject } from "@angular/core";
196
- import { ModalService, MODAL_DATA, MODAL_REF } from "chrv-components";
213
+ import { ModalService, CHR_MODAL_DATA, CHR_MODAL_REF } from "chrv-components";
197
214
 
198
215
  // Composant de modal
199
216
  @Component({
@@ -206,8 +223,8 @@ import { ModalService, MODAL_DATA, MODAL_REF } from "chrv-components";
206
223
  `,
207
224
  })
208
225
  export class MyModalComponent {
209
- data = inject(MODAL_DATA);
210
- modalRef = inject(MODAL_REF);
226
+ data = inject(CHR_MODAL_DATA);
227
+ modalRef = inject(CHR_MODAL_REF);
211
228
 
212
229
  close() {
213
230
  this.modalRef.close();
@@ -220,8 +237,10 @@ export class ParentComponent {
220
237
 
221
238
  openModal() {
222
239
  this.modalService.open(MyModalComponent, {
223
- title: "Confirmation",
224
- message: "Êtes-vous sûr de vouloir continuer ?",
240
+ data: {
241
+ title: "Confirmation",
242
+ message: "Êtes-vous sûr de vouloir continuer ?",
243
+ },
225
244
  });
226
245
  }
227
246
  }
@@ -284,28 +303,134 @@ Indicateur de chargement :
284
303
  ```typescript
285
304
  @Component({
286
305
  inputs: {
287
- sections: FormSection[]; // Sections du formulaire
288
- controls: FormControls; // Configuration des contrôles
306
+ sections: IFormSection[]; // Sections avec contrôles groupés
307
+ controls: IControl[]; // Contrôles directs (utiliser l'un OU l'autre)
289
308
  }
290
309
  })
291
310
  ```
292
311
 
312
+ **Interface IControl :**
313
+
314
+ ```typescript
315
+ interface IControl {
316
+ name: string; // Nom unique du contrôle
317
+ type: InputType; // Type d'input
318
+ label?: string; // Label affiché
319
+ value?: any; // Valeur par défaut
320
+ validations?: IControlValidation[]; // Validations
321
+ data?: any[]; // Données pour select/options
322
+ // ... autres propriétés
323
+ }
324
+ ```
325
+
326
+ **Interface IFormSection :**
327
+
328
+ ```typescript
329
+ interface IFormSection {
330
+ title?: string; // Titre de la section
331
+ controls: IControl[]; // Contrôles de la section
332
+ }
333
+ ```
334
+
293
335
  ### ModalService
294
336
 
295
337
  ```typescript
296
338
  class ModalService {
297
- open<T>(component: ComponentType<T>, data?: any): void;
339
+ open<T>(component: ComponentType<T>, options?: ModalOptions): void;
298
340
  close(): void;
299
341
  }
342
+
343
+ interface ModalOptions {
344
+ closeOnBackdropClick?: boolean;
345
+ closeOnEscape?: boolean;
346
+ width?: number;
347
+ height?: number;
348
+ data?: any; // Données injectées via CHR_MODAL_DATA
349
+ }
350
+ ```
351
+
352
+ ## 🎨 Thèmes et personnalisation
353
+
354
+ ### Variables CSS disponibles
355
+
356
+ Les composants utilisent un système de variables CSS pour les couleurs. Vous pouvez les personnaliser en redéfinissant ces variables :
357
+
358
+ ```css
359
+ :root {
360
+ --primary-color: #your-color;
361
+ --primary-contrast-color: #your-contrast-color;
362
+ --secondary-color: #your-secondary;
363
+ --secondary-contrast-color: #your-secondary-contrast;
364
+ --tertiary-color: #your-tertiary;
365
+ --tertiary-contrast-color: #your-tertiary-contrast;
366
+ --warn-color: #your-warn;
367
+ --warn-contrast-color: #your-warn-contrast;
368
+ --error-color: #your-error;
369
+ --error-contrast-color: #your-error-contrast;
370
+ --neutral-color: #your-neutral;
371
+ --text-color: #your-text;
372
+ --text-neutral-color: #your-text-neutral;
373
+ }
374
+ ```
375
+
376
+ ### Classes CSS disponibles
377
+
378
+ La bibliothèque fournit des classes utilitaires pour les couleurs :
379
+
380
+ ```css
381
+ /* Arrière-plans */
382
+ .bg-primary, .bg-secondary, .bg-tertiary, .bg-warn, .bg-error, .bg-neutral
383
+ .bg-primary-contrast, .bg-secondary-contrast, .bg-tertiary-contrast, .bg-warn-contrast, .bg-error-contrast
384
+
385
+ /* Texte */
386
+ .text-primary, .text-secondary, .text-tertiary, .text-warn, .text-error, .text-neutral
387
+ .text-primary-contrast, .text-secondary-contrast, .text-tertiary-contrast, .text-warn-contrast, .text-error-contrast
388
+
389
+ /* Bordures */
390
+ .border-primary, .border-secondary, .border-tertiary, .border-warn, .border-error
391
+ .border-primary-contrast, .border-secondary-contrast, .border-tertiary-contrast, .border-warn-contrast, .border-error-contrast;
300
392
  ```
301
393
 
302
- ## 🎨 Thèmes et styles
394
+ ### Personnalisation avancée avec ::ng-deep
395
+
396
+ Pour modifier les styles des composants compilés, utilisez `::ng-deep` :
397
+
398
+ ```scss
399
+ // Dans votre composant .scss
400
+ ::ng-deep .chr-button {
401
+ border-radius: 8px;
402
+ font-weight: 600;
403
+ }
404
+
405
+ ::ng-deep .chr-form .form-field {
406
+ margin-bottom: 16px;
407
+ }
303
408
 
304
- Les composants utilisent Tailwind CSS et Angular Material. Vous pouvez personnaliser :
409
+ ::ng-deep .chr-modal .modal-backdrop {
410
+ background-color: rgba(0, 0, 0, 0.8);
411
+ }
412
+ ```
305
413
 
306
- - **Couleurs** : Via les tokens de couleur (primary, secondary, warn, etc.)
307
- - **Tailles** : Classes Tailwind CSS
308
- - **Animations** : Animations Angular intégrées
414
+ ### Exemple de thème personnalisé
415
+
416
+ ```css
417
+ /* Thème sombre personnalisé */
418
+ :root {
419
+ --primary-color: #3b82f6;
420
+ --primary-contrast-color: #ffffff;
421
+ --secondary-color: #6b7280;
422
+ --secondary-contrast-color: #ffffff;
423
+ --tertiary-color: #f3f4f6;
424
+ --tertiary-contrast-color: #1f2937;
425
+ --warn-color: #f59e0b;
426
+ --warn-contrast-color: #ffffff;
427
+ --error-color: #ef4444;
428
+ --error-contrast-color: #ffffff;
429
+ --neutral-color: #e5e7eb;
430
+ --text-color: #1f2937;
431
+ --text-neutral-color: #6b7280;
432
+ }
433
+ ```
309
434
 
310
435
  ## 📦 Intégrations
311
436
 
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chrv-components",
3
- "version": "1.11.3",
3
+ "version": "1.11.4",
4
4
  "peerDependencies": {
5
5
  "@angular/common": ">=17.0.0",
6
6
  "@angular/core": ">=17.0.0",
Binary file