@exhaustive-ui/mcp 22.0.0-rc.3 → 22.0.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.
@@ -2,6 +2,315 @@
2
2
 
3
3
  Integration between ExhaustiveUI and Tailwind CSS.
4
4
 
5
+ ## Overview
6
+
7
+ Tailwind CSS is a popular CSS framework based on a utility-first design. The core provides flexible CSS classes with predefined CSS rules to build your own UI elements. For example, instead of an opinionated `btn` class as in
8
+ Bootstrap, Tailwind offers primitive classes like `bg-blue-500`, `rounded` and `p-4` to apply a button. A set of reusable classes can also be grouped as a Tailwind CSS component and there are even a couple of libraries
9
+ that take this approach to build components specifically for Tailwind.
10
+
11
+ Tailwind is an outstanding CSS library, however it lacks a true comprehensive UI suite when combined with Angular, this is where ExhaustiveUI comes in by providing a wide range of highly accessible and feature rich UI component
12
+ library. The core of ExhaustiveUI does not depend on Tailwind CSS.
13
+
14
+ ## Plugin
15
+
16
+ The [@exhaustive-ui/tailwindcss](https://www.npmjs.com/package/@exhaustive-ui/tailwindcss) is a plugin to provide first class integration between ExhaustiveUI and Tailwind CSS. It
17
+ is designed to work both in styled and unstyled modes. In styled mode, for instance the semantic colors such as primary and surfaces are provided as Tailwind utilities e.g. `bg-primary`, `text-surface-500`,
18
+ `text-muted-color`.
19
+
20
+ If you haven't already done so, start by integrating Tailwind into your project. Detailed steps for this process can be found in the Tailwind
21
+ [documentation](https://tailwindcss.com/). After successfully installing Tailwind, proceed with the installation of the ExhaustiveUiTailwind plugin. This single npm package comes
22
+ with two libraries: the CSS version is compatible with Tailwind v4, the recommended version, while the JS version is designed for Tailwind v3.
23
+
24
+ ### Tailwind v4
25
+
26
+ In the CSS file that contains the tailwindcss import, add the `@exhaustive-ui/tailwindcss` import as well.
27
+
28
+ For a comprehensive starter guide, review the [ExhaustiveUI](https://github.com/e-xiste/exhaustive-ui) repository which demonstrates the integration.
29
+
30
+ ### Tailwind v3
31
+
32
+ Use the plugins option in your Tailwind config file to configure the plugin.
33
+
34
+ ## Extensions
35
+
36
+ The plugin extends the default configuration with a new set of utilities. All variants and breakpoints are supported e.g.
37
+ `dark:sm:hover:bg-primary`.
38
+
39
+ ### Color Palette
40
+
41
+ Class
42
+ Property
43
+ primary-[50-950]
44
+ Primary color palette.
45
+ surface-[0-950]
46
+ Surface color palette.
47
+ primary
48
+ Default primary color.
49
+ primary-contrast
50
+ Default primary contrast color.
51
+ primary-emphasis
52
+ Default primary emphasis color.
53
+ border-surface
54
+ Default primary emphasis color.
55
+ bg-emphasis
56
+ Emphasis background e.g. hovered element.
57
+ bg-highlight
58
+ Highlight background.
59
+ bg-highlight-emphasis
60
+ Highlight background with emphasis.
61
+ rounded-border
62
+ Border radius.
63
+ text-color
64
+ Text color with emphasis.
65
+ text-color-emphasis
66
+ Default primary emphasis color.
67
+ text-muted-color
68
+ Secondary text color.
69
+ text-muted-color-emphasis
70
+ Secondary text color with emphasis.
71
+
72
+ ## Dark Mode
73
+
74
+ In styled mode, ExhaustiveUI uses the `system` as the default `darkModeSelector` in theme configuration. If you have a dark mode switch in your application, ensure that `darkModeSelector` is aligned with the Tailwind
75
+ dark variant for seamless integration. Note that, this particular configuration isn't required if you're utilizing the default system color scheme.
76
+
77
+ Suppose that, the darkModeSelector is set as `my-app-dark` in ExhaustiveUI.
78
+
79
+ ### Tailwind v4
80
+
81
+ Add a custom variant for dark with a custom selector.
82
+
83
+ ### Tailwind v3
84
+
85
+ Use the plugins option in your Tailwind config file to configure the plugin.
86
+
87
+ ## Override
88
+
89
+ Tailwind utilities may not be able to override the default styling of components due to css specificity, there are two possible solutions; Import and CSS Layer.
90
+
91
+ ### Important
92
+
93
+ Use the `!` important modifier to enforce the styling: Tailwind v4 places it at the end of the class name, Tailwind v3 at the start. This is not the recommend approach, and should be used as last resort to avoid adding
94
+ unnecessary style classes to your bundle.
95
+
96
+ Tailwind v4
97
+
98
+ Tailwind v3
99
+
100
+ ### CSS Layer
101
+
102
+ CSS Layer provides control over the css specificity so that Tailwind utilities can safely override components.
103
+
104
+ Tailwind v4
105
+
106
+ Ensure `exhaustive` layer is after `theme` and `base`, but before the other Tailwind layers such as `utilities`.
107
+
108
+ No change in the CSS configuration is required.
109
+
110
+ Tailwind v3
111
+
112
+ The `exhaustive` layer should be between base and utilities.
113
+
114
+ Tailwind v3 does not use native `layer` so needs to be defined with CSS.
115
+
116
+ ## Color Palette
117
+
118
+ ExhaustiveUI color palette as utility classes.
119
+
120
+ ```typescript
121
+ import { Component } from '@angular/core';
122
+
123
+ @Component({
124
+ template: `
125
+ <div class="card">
126
+ <div class="flex flex-col gap-12">
127
+ <ul class="p-0 m-0 list-none flex sm:flex-col gap-4 flex-wrap sm:flex-nowrap">
128
+ <li *ngFor="let color of colors; let i = index" [ngStyle]="{ 'min-width': '6rem' }" class="flex-auto">
129
+ <span class="font-medium capitalize block mb-2 text-center sm:text-left">{{ color }}</span>
130
+ <div class="flex gap-4 flex-auto flex-col sm:flex-row">
131
+ <div *ngFor="let shade of shades" [ngClass]="{ invisible: color === 'primary' && shade === 0 }" class="flex flex-col items-center gap-1 flex-1">
132
+ <div class="rounded-sm h-8 w-full" [ngStyle]="{ 'background-color': 'var(--p-' + color + '-' + shade + ')' }"></div>
133
+ <span class="text-sm text-surface-500 dark:text-surface-400 font-medium">{{ shade }}</span>
134
+ </div>
135
+ </div>
136
+ </li>
137
+ </ul>
138
+ <div class="flex gap-6 flex-wrap">
139
+ <div class="rounded-border p-4 border border-transparent flex items-center justify-center bg-primary hover:bg-primary-emphasis text-primary-contrast font-medium flex-auto transition-colors">primary</div>
140
+ <div class="rounded-border p-4 border border-transparent flex items-center justify-center bg-highlight hover:bg-highlight-emphasis font-medium flex-auto transition-colors">highlight</div>
141
+ <div class="rounded-border p-4 border border-surface flex items-center justify-center text-muted-color hover:text-color hover:bg-emphasis font-medium flex-auto transition-colors">box</div>
142
+ </div>
143
+ </div>
144
+ </div>
145
+ `,
146
+ standalone: true,
147
+ imports: []
148
+ })
149
+ export class TailwindColorpaletteDemo {
150
+ shades: number[] = [0, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
151
+ colors: string[] = ['primary', 'surface'];
152
+ }
153
+ ```
154
+
155
+ ## Form
156
+
157
+ Using Tailwind utilities for the responsive layout of a form with ExhaustiveUI components.
158
+
159
+ ```typescript
160
+ import { Component, OnInit } from '@angular/core';
161
+ import { FormsModule } from '@angular/forms';
162
+ import { DatePickerModule } from '@exhaustive-ui/core/datepicker';
163
+ import { SelectModule } from '@exhaustive-ui/core/select';
164
+ import { InputTextModule } from '@exhaustive-ui/core/inputtext';
165
+ import { Country } from '@/domain/customer';
166
+
167
+ @Component({
168
+ template: `
169
+ <div class="card flex sm:justify-center">
170
+ <div class="flex flex-col gap-6 w-full sm:w-auto">
171
+ <div class="flex flex-col sm:flex-row sm:items-center gap-6">
172
+ <div class="flex-auto">
173
+ <label for="firstname" class="block font-semibold mb-2">Firstname</label>
174
+ <input type="text" pInputText id="firstname" class="w-full" />
175
+ </div>
176
+ <div class="flex-auto">
177
+ <label for="lastname" class="block font-semibold mb-2">Lastname</label>
178
+ <input type="text" pInputText id="lastname" class="w-full" />
179
+ </div>
180
+ </div>
181
+ <div class="flex flex-col sm:flex-row sm:items-center gap-6">
182
+ <div class="flex-1">
183
+ <label for="date" class="block font-semibold mb-2">Date</label>
184
+ <p-datepicker inputId="date" class="w-full" />
185
+ </div>
186
+ <div class="flex-1">
187
+ <label for="country" class="block font-semibold mb-2">Country</label>
188
+ <p-select [options]="countries" [(ngModel)]="selectedCountry" optionLabel="name" [showClear]="true" placeholder="Select a Country">
189
+ <ng-template pTemplate="selectedItem">
190
+ <div class="flex items-center gap-2" *ngIf="selectedCountry">
191
+ <img src="https://exhaustive-ui.com/demo/flag/flag_placeholder.png" [class]="'flag flag-' + selectedCountry.code.toLowerCase()" style="width: 18px" />
192
+ <div>{{ selectedCountry.name }}</div>
193
+ </div>
194
+ </ng-template>
195
+ <ng-template let-country pTemplate="item">
196
+ <div class="flex items-center gap-2">
197
+ <img src="https://exhaustive-ui.com/demo/flag/flag_placeholder.png" [class]="'flag flag-' + country.code.toLowerCase()" style="width: 18px" />
198
+ <div>{{ country.name }}</div>
199
+ </div>
200
+ </ng-template>
201
+ </p-select>
202
+ </div>
203
+ </div>
204
+ <div class="flex-auto">
205
+ <label for="message" class="block font-semibold mb-2">Message</label>
206
+ <textarea pTextarea id="message" class="w-full" rows="4"></textarea>
207
+ </div>
208
+ </div>
209
+ </div>
210
+ `,
211
+ standalone: true,
212
+ imports: [DatePickerModule, SelectModule, InputTextModule, FormsModule]
213
+ })
214
+ export class TailwindFormDemo implements OnInit {
215
+ countries: any[] | undefined;
216
+ selectedCountry: string | undefined;
217
+
218
+ ngOnInit() {
219
+ this.countries = [
220
+ { name: 'Australia', code: 'AU' },
221
+ { name: 'Brazil', code: 'BR' },
222
+ { name: 'China', code: 'CN' },
223
+ { name: 'Egypt', code: 'EG' },
224
+ { name: 'France', code: 'FR' },
225
+ { name: 'Germany', code: 'DE' },
226
+ { name: 'India', code: 'IN' },
227
+ { name: 'Japan', code: 'JP' },
228
+ { name: 'Spain', code: 'ES' },
229
+ { name: 'United States', code: 'US' }
230
+ ];
231
+ }
232
+ }
233
+ ```
234
+
235
+ ## Headless
236
+
237
+ A headless ExhaustiveUI dialog with a custom UI.
238
+
239
+ ```typescript
240
+ import { Component } from '@angular/core';
241
+ import { ButtonModule } from '@exhaustive-ui/core/button';
242
+ import { DialogModule } from '@exhaustive-ui/core/dialog';
243
+ import { InputTextModule } from '@exhaustive-ui/core/inputtext';
244
+
245
+ @Component({
246
+ template: `
247
+ <div class="card flex justify-center">
248
+ <p-button (click)="showDialog()" icon="pi pi-user" label="Login" />
249
+ <p-dialog maskStyleClass="backdrop-blur-xs" [(visible)]="visible" styleClass="border-0! bg-transparent!">
250
+ <ng-template pTemplate="headless">
251
+ <div class="flex flex-col px-8 py-8 gap-6 rounded-2xl" style="border-radius: 12px; background-image: radial-gradient(circle at left top, var(--p-primary-400), var(--p-primary-700))">
252
+ <svg width="31" height="33" viewBox="0 0 31 33" fill="none" xmlns="http://www.w3.org/2000/svg" class="block mx-auto">
253
+ <path d="M15.1934 0V0V0L0.0391235 5.38288L2.35052 25.3417L15.1934 32.427V32.427V32.427L28.0364 25.3417L30.3478 5.38288L15.1934 0Z" fill="var(--p-primary-color)" />
254
+ <mask id="mask0_1_52" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="0" width="31" height="33">
255
+ <path d="M15.1934 0V0V0L0.0391235 5.38288L2.35052 25.3417L15.1934 32.427V32.427V32.427L28.0364 25.3417L30.3478 5.38288L15.1934 0Z" fill="var(--ground-background)" />
256
+ </mask>
257
+ <g mask="url(#mask0_1_52)">
258
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M15.1935 0V3.5994V3.58318V20.0075V20.0075V32.427V32.427L28.0364 25.3417L30.3478 5.38288L15.1935 0Z" fill="var(--p-primary-color)" />
259
+ </g>
260
+ <path d="M19.6399 15.3776L18.1861 15.0547L19.3169 16.6695V21.6755L23.1938 18.4458V12.9554L21.4169 13.6013L19.6399 15.3776Z" fill="var(--ground-background)" />
261
+ <path d="M10.5936 15.3776L12.0474 15.0547L10.9166 16.6695V21.6755L7.03966 18.4458V12.9554L8.81661 13.6013L10.5936 15.3776Z" fill="var(--ground-background)" />
262
+ <path
263
+ fill-rule="evenodd"
264
+ clip-rule="evenodd"
265
+ d="M11.3853 16.9726L12.6739 15.0309L13.4793 15.5163H16.7008L17.5061 15.0309L18.7947 16.9726V24.254L17.8283 25.7103L16.7008 26.843H13.4793L12.3518 25.7103L11.3853 24.254V16.9726Z"
266
+ fill="var(--ground-background)"
267
+ />
268
+ <path d="M19.3168 24.7437L21.4168 22.6444V20.5451L19.3168 22.3214V24.7437Z" fill="var(--ground-background)" />
269
+ <path d="M10.9166 24.7437L8.81662 22.6444V20.5451L10.9166 22.3214V24.7437Z" fill="var(--ground-background)" />
270
+ <path
271
+ fill-rule="evenodd"
272
+ clip-rule="evenodd"
273
+ d="M13.0167 5.68861L11.7244 8.7568L13.8244 14.8932H14.7936V5.68861H13.0167ZM15.4397 5.68861V14.8932H16.5706L18.5091 8.7568L17.2167 5.68861H15.4397Z"
274
+ fill="var(--ground-background)"
275
+ />
276
+ <path d="M13.8244 14.8932L6.87813 12.3094L5.90888 8.27235L11.8859 8.7568L13.9859 14.8932H13.8244Z" fill="var(--ground-background)" />
277
+ <path d="M16.5706 14.8932L23.5169 12.3094L24.4861 8.27235L18.3476 8.7568L16.4091 14.8932H16.5706Z" fill="var(--ground-background)" />
278
+ <path d="M18.8321 8.27235L22.2245 7.94938L19.9629 5.68861H17.7013L18.8321 8.27235Z" fill="var(--ground-background)" />
279
+ <path d="M11.4013 8.27235L8.00893 7.94938L10.2705 5.68861H12.5321L11.4013 8.27235Z" fill="var(--ground-background)" />
280
+ </svg>
281
+ <div class="inline-flex flex-col gap-2">
282
+ <label for="username" class="text-primary-50 font-semibold">Username</label>
283
+ <input pInputText id="username" class="bg-white/20! border-0! p-4! text-primary-50! w-80" />
284
+ </div>
285
+ <div class="inline-flex flex-col gap-2">
286
+ <label for="password" class="text-primary-50 font-semibold">Password</label>
287
+ <input pInputText id="password" class="bg-white/20! border-0! p-4! text-primary-50! w-80" type="password" />
288
+ </div>
289
+ <div class="flex items-center gap-4">
290
+ <p-button label="Cancel" (click)="closeDialog()" [text]="true" styleClass="p-4! w-full text-primary-50! border! border-white/30! hover:bg-white/10!" class="w-full" />
291
+ <p-button label="Sign-In" (click)="closeDialog()" [text]="true" styleClass="p-4! w-full text-primary-50! border! border-white/30! hover:bg-white/10!" class="w-full" />
292
+ </div>
293
+ </div>
294
+ </ng-template>
295
+ </p-dialog>
296
+ </div>
297
+ `,
298
+ standalone: true,
299
+ imports: [ButtonModule, DialogModule, InputTextModule]
300
+ })
301
+ export class TailwindHeadlessDemo {
302
+ visible: boolean = false;
303
+
304
+ showDialog() {
305
+ this.visible = true;
306
+ }
307
+
308
+ closeDialog() {
309
+ this.visible = false;
310
+ }
311
+ }
312
+ ```
313
+
5
314
  ## Animations
6
315
 
7
316
  The plugin also adds extended animation utilities that can be used with the styleclass and animateonscroll directives.
@@ -421,221 +730,3 @@ export class TailwindAnimationsDemo implements OnInit {
421
730
  }
422
731
  ```
423
732
 
424
- ## Colorpalette
425
-
426
- ExhaustiveUI color palette as utility classes.
427
-
428
- ```typescript
429
- import { Component } from '@angular/core';
430
-
431
- @Component({
432
- template: `
433
- <div class="card">
434
- <div class="flex flex-col gap-12">
435
- <ul class="p-0 m-0 list-none flex sm:flex-col gap-4 flex-wrap sm:flex-nowrap">
436
- <li *ngFor="let color of colors; let i = index" [ngStyle]="{ 'min-width': '6rem' }" class="flex-auto">
437
- <span class="font-medium capitalize block mb-2 text-center sm:text-left">{{ color }}</span>
438
- <div class="flex gap-4 flex-auto flex-col sm:flex-row">
439
- <div *ngFor="let shade of shades" [ngClass]="{ invisible: color === 'primary' && shade === 0 }" class="flex flex-col items-center gap-1 flex-1">
440
- <div class="rounded-sm h-8 w-full" [ngStyle]="{ 'background-color': 'var(--p-' + color + '-' + shade + ')' }"></div>
441
- <span class="text-sm text-surface-500 dark:text-surface-400 font-medium">{{ shade }}</span>
442
- </div>
443
- </div>
444
- </li>
445
- </ul>
446
- <div class="flex gap-6 flex-wrap">
447
- <div class="rounded-border p-4 border border-transparent flex items-center justify-center bg-primary hover:bg-primary-emphasis text-primary-contrast font-medium flex-auto transition-colors">primary</div>
448
- <div class="rounded-border p-4 border border-transparent flex items-center justify-center bg-highlight hover:bg-highlight-emphasis font-medium flex-auto transition-colors">highlight</div>
449
- <div class="rounded-border p-4 border border-surface flex items-center justify-center text-muted-color hover:text-color hover:bg-emphasis font-medium flex-auto transition-colors">box</div>
450
- </div>
451
- </div>
452
- </div>
453
- `,
454
- standalone: true,
455
- imports: []
456
- })
457
- export class TailwindColorpaletteDemo {
458
- shades: number[] = [0, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
459
- colors: string[] = ['primary', 'surface'];
460
- }
461
- ```
462
-
463
- ## Darkmode
464
-
465
- In styled mode, ExhaustiveUI uses the system as the default darkModeSelector in theme configuration. If you have a dark mode switch in your application, ensure that darkModeSelector is aligned with the Tailwind dark variant for seamless integration. Note that, this particular configuration isn't required if you're utilizing the default system color scheme. Suppose that, the darkModeSelector is set as my-app-dark in ExhaustiveUI. Tailwind v4 Add a custom variant for dark with a custom selector. Tailwind v3 Use the plugins option in your Tailwind config file to configure the plugin.
466
-
467
- ## Extensions
468
-
469
- The plugin extends the default configuration with a new set of utilities. All variants and breakpoints are supported e.g. dark:sm:hover:bg-primary . Color Palette Class Property primary-[50-950] Primary color palette. surface-[0-950] Surface color palette. primary Default primary color. primary-contrast Default primary contrast color. primary-emphasis Default primary emphasis color. border-surface Default primary emphasis color. bg-emphasis Emphasis background e.g. hovered element. bg-highlight Highlight background. bg-highlight-emphasis Highlight background with emphasis. rounded-border Border radius. text-color Text color with emphasis. text-color-emphasis Default primary emphasis color. text-muted-color Secondary text color. text-muted-color-emphasis Secondary text color with emphasis.
470
-
471
- ## Form
472
-
473
- Using Tailwind utilities for the responsive layout of a form with ExhaustiveUI components.
474
-
475
- ```typescript
476
- import { Component, OnInit } from '@angular/core';
477
- import { FormsModule } from '@angular/forms';
478
- import { DatePickerModule } from '@exhaustive-ui/core/datepicker';
479
- import { SelectModule } from '@exhaustive-ui/core/select';
480
- import { InputTextModule } from '@exhaustive-ui/core/inputtext';
481
- import { Country } from '@/domain/customer';
482
-
483
- @Component({
484
- template: `
485
- <div class="card flex sm:justify-center">
486
- <div class="flex flex-col gap-6 w-full sm:w-auto">
487
- <div class="flex flex-col sm:flex-row sm:items-center gap-6">
488
- <div class="flex-auto">
489
- <label for="firstname" class="block font-semibold mb-2">Firstname</label>
490
- <input type="text" pInputText id="firstname" class="w-full" />
491
- </div>
492
- <div class="flex-auto">
493
- <label for="lastname" class="block font-semibold mb-2">Lastname</label>
494
- <input type="text" pInputText id="lastname" class="w-full" />
495
- </div>
496
- </div>
497
- <div class="flex flex-col sm:flex-row sm:items-center gap-6">
498
- <div class="flex-1">
499
- <label for="date" class="block font-semibold mb-2">Date</label>
500
- <p-datepicker inputId="date" class="w-full" />
501
- </div>
502
- <div class="flex-1">
503
- <label for="country" class="block font-semibold mb-2">Country</label>
504
- <p-select [options]="countries" [(ngModel)]="selectedCountry" optionLabel="name" [showClear]="true" placeholder="Select a Country">
505
- <ng-template pTemplate="selectedItem">
506
- <div class="flex items-center gap-2" *ngIf="selectedCountry">
507
- <img src="https://exhaustive-ui.com/demo/flag/flag_placeholder.png" [class]="'flag flag-' + selectedCountry.code.toLowerCase()" style="width: 18px" />
508
- <div>{{ selectedCountry.name }}</div>
509
- </div>
510
- </ng-template>
511
- <ng-template let-country pTemplate="item">
512
- <div class="flex items-center gap-2">
513
- <img src="https://exhaustive-ui.com/demo/flag/flag_placeholder.png" [class]="'flag flag-' + country.code.toLowerCase()" style="width: 18px" />
514
- <div>{{ country.name }}</div>
515
- </div>
516
- </ng-template>
517
- </p-select>
518
- </div>
519
- </div>
520
- <div class="flex-auto">
521
- <label for="message" class="block font-semibold mb-2">Message</label>
522
- <textarea pTextarea id="message" class="w-full" rows="4"></textarea>
523
- </div>
524
- </div>
525
- </div>
526
- `,
527
- standalone: true,
528
- imports: [DatePickerModule, SelectModule, InputTextModule, FormsModule]
529
- })
530
- export class TailwindFormDemo implements OnInit {
531
- countries: any[] | undefined;
532
- selectedCountry: string | undefined;
533
-
534
- ngOnInit() {
535
- this.countries = [
536
- { name: 'Australia', code: 'AU' },
537
- { name: 'Brazil', code: 'BR' },
538
- { name: 'China', code: 'CN' },
539
- { name: 'Egypt', code: 'EG' },
540
- { name: 'France', code: 'FR' },
541
- { name: 'Germany', code: 'DE' },
542
- { name: 'India', code: 'IN' },
543
- { name: 'Japan', code: 'JP' },
544
- { name: 'Spain', code: 'ES' },
545
- { name: 'United States', code: 'US' }
546
- ];
547
- }
548
- }
549
- ```
550
-
551
- ## Headless
552
-
553
- A headless ExhaustiveUI dialog with a custom UI.
554
-
555
- ```typescript
556
- import { Component } from '@angular/core';
557
- import { ButtonModule } from '@exhaustive-ui/core/button';
558
- import { DialogModule } from '@exhaustive-ui/core/dialog';
559
- import { InputTextModule } from '@exhaustive-ui/core/inputtext';
560
-
561
- @Component({
562
- template: `
563
- <div class="card flex justify-center">
564
- <p-button (click)="showDialog()" icon="pi pi-user" label="Login" />
565
- <p-dialog maskStyleClass="backdrop-blur-xs" [(visible)]="visible" styleClass="border-0! bg-transparent!">
566
- <ng-template pTemplate="headless">
567
- <div class="flex flex-col px-8 py-8 gap-6 rounded-2xl" style="border-radius: 12px; background-image: radial-gradient(circle at left top, var(--p-primary-400), var(--p-primary-700))">
568
- <svg width="31" height="33" viewBox="0 0 31 33" fill="none" xmlns="http://www.w3.org/2000/svg" class="block mx-auto">
569
- <path d="M15.1934 0V0V0L0.0391235 5.38288L2.35052 25.3417L15.1934 32.427V32.427V32.427L28.0364 25.3417L30.3478 5.38288L15.1934 0Z" fill="var(--p-primary-color)" />
570
- <mask id="mask0_1_52" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="0" width="31" height="33">
571
- <path d="M15.1934 0V0V0L0.0391235 5.38288L2.35052 25.3417L15.1934 32.427V32.427V32.427L28.0364 25.3417L30.3478 5.38288L15.1934 0Z" fill="var(--ground-background)" />
572
- </mask>
573
- <g mask="url(#mask0_1_52)">
574
- <path fill-rule="evenodd" clip-rule="evenodd" d="M15.1935 0V3.5994V3.58318V20.0075V20.0075V32.427V32.427L28.0364 25.3417L30.3478 5.38288L15.1935 0Z" fill="var(--p-primary-color)" />
575
- </g>
576
- <path d="M19.6399 15.3776L18.1861 15.0547L19.3169 16.6695V21.6755L23.1938 18.4458V12.9554L21.4169 13.6013L19.6399 15.3776Z" fill="var(--ground-background)" />
577
- <path d="M10.5936 15.3776L12.0474 15.0547L10.9166 16.6695V21.6755L7.03966 18.4458V12.9554L8.81661 13.6013L10.5936 15.3776Z" fill="var(--ground-background)" />
578
- <path
579
- fill-rule="evenodd"
580
- clip-rule="evenodd"
581
- d="M11.3853 16.9726L12.6739 15.0309L13.4793 15.5163H16.7008L17.5061 15.0309L18.7947 16.9726V24.254L17.8283 25.7103L16.7008 26.843H13.4793L12.3518 25.7103L11.3853 24.254V16.9726Z"
582
- fill="var(--ground-background)"
583
- />
584
- <path d="M19.3168 24.7437L21.4168 22.6444V20.5451L19.3168 22.3214V24.7437Z" fill="var(--ground-background)" />
585
- <path d="M10.9166 24.7437L8.81662 22.6444V20.5451L10.9166 22.3214V24.7437Z" fill="var(--ground-background)" />
586
- <path
587
- fill-rule="evenodd"
588
- clip-rule="evenodd"
589
- d="M13.0167 5.68861L11.7244 8.7568L13.8244 14.8932H14.7936V5.68861H13.0167ZM15.4397 5.68861V14.8932H16.5706L18.5091 8.7568L17.2167 5.68861H15.4397Z"
590
- fill="var(--ground-background)"
591
- />
592
- <path d="M13.8244 14.8932L6.87813 12.3094L5.90888 8.27235L11.8859 8.7568L13.9859 14.8932H13.8244Z" fill="var(--ground-background)" />
593
- <path d="M16.5706 14.8932L23.5169 12.3094L24.4861 8.27235L18.3476 8.7568L16.4091 14.8932H16.5706Z" fill="var(--ground-background)" />
594
- <path d="M18.8321 8.27235L22.2245 7.94938L19.9629 5.68861H17.7013L18.8321 8.27235Z" fill="var(--ground-background)" />
595
- <path d="M11.4013 8.27235L8.00893 7.94938L10.2705 5.68861H12.5321L11.4013 8.27235Z" fill="var(--ground-background)" />
596
- </svg>
597
- <div class="inline-flex flex-col gap-2">
598
- <label for="username" class="text-primary-50 font-semibold">Username</label>
599
- <input pInputText id="username" class="bg-white/20! border-0! p-4! text-primary-50! w-80" />
600
- </div>
601
- <div class="inline-flex flex-col gap-2">
602
- <label for="password" class="text-primary-50 font-semibold">Password</label>
603
- <input pInputText id="password" class="bg-white/20! border-0! p-4! text-primary-50! w-80" type="password" />
604
- </div>
605
- <div class="flex items-center gap-4">
606
- <p-button label="Cancel" (click)="closeDialog()" [text]="true" styleClass="p-4! w-full text-primary-50! border! border-white/30! hover:bg-white/10!" class="w-full" />
607
- <p-button label="Sign-In" (click)="closeDialog()" [text]="true" styleClass="p-4! w-full text-primary-50! border! border-white/30! hover:bg-white/10!" class="w-full" />
608
- </div>
609
- </div>
610
- </ng-template>
611
- </p-dialog>
612
- </div>
613
- `,
614
- standalone: true,
615
- imports: [ButtonModule, DialogModule, InputTextModule]
616
- })
617
- export class TailwindHeadlessDemo {
618
- visible: boolean = false;
619
-
620
- showDialog() {
621
- this.visible = true;
622
- }
623
-
624
- closeDialog() {
625
- this.visible = false;
626
- }
627
- }
628
- ```
629
-
630
- ## Override
631
-
632
- Tailwind utilities may not be able to override the default styling of components due to css specificity, there are two possible solutions; Import and CSS Layer. Important Use the ! important modifier to enforce the styling: Tailwind v4 places it at the end of the class name, Tailwind v3 at the start. This is not the recommend approach, and should be used as last resort to avoid adding unnecessary style classes to your bundle. Tailwind v4 Tailwind v3 CSS Layer CSS Layer provides control over the css specificity so that Tailwind utilities can safely override components. Tailwind v4 Ensure exhaustive layer is after theme and base , but before the other Tailwind layers such as utilities . No change in the CSS configuration is required. Tailwind v3 The exhaustive layer should be between base and utilities. Tailwind v3 does not use native layer so needs to be defined with CSS.
633
-
634
- ## Overview
635
-
636
- Tailwind CSS is a popular CSS framework based on a utility-first design. The core provides flexible CSS classes with predefined CSS rules to build your own UI elements. For example, instead of an opinionated btn class as in Bootstrap, Tailwind offers primitive classes like bg-blue-500 , rounded and p-4 to apply a button. A set of reusable classes can also be grouped as a Tailwind CSS component and there are even a couple of libraries that take this approach to build components specifically for Tailwind. Tailwind is an outstanding CSS library, however it lacks a true comprehensive UI suite when combined with Angular, this is where ExhaustiveUI comes in by providing a wide range of highly accessible and feature rich UI component library. The core of ExhaustiveUI does not depend on Tailwind CSS.
637
-
638
- ## Plugin
639
-
640
- The @exhaustive-ui/tailwindcss is a plugin to provide first class integration between ExhaustiveUI and Tailwind CSS. It is designed to work both in styled and unstyled modes. In styled mode, for instance the semantic colors such as primary and surfaces are provided as Tailwind utilities e.g. bg-primary , text-surface-500 , text-muted-color . If you haven't already done so, start by integrating Tailwind into your project. Detailed steps for this process can be found in the Tailwind documentation . After successfully installing Tailwind, proceed with the installation of the ExhaustiveUiTailwind plugin. This single npm package comes with two libraries: the CSS version is compatible with Tailwind v4, the recommended version, while the JS version is designed for Tailwind v3. Tailwind v4 In the CSS file that contains the tailwindcss import, add the @exhaustive-ui/tailwindcss import as well. For a comprehensive starter guide, review the ExhaustiveUI repository which demonstrates the integration. Tailwind v3 Use the plugins option in your Tailwind config file to configure the plugin.
641
-
@@ -4,15 +4,60 @@ Theming ExhaustiveUI with alternative styling approaches.
4
4
 
5
5
  ## Architecture
6
6
 
7
- The term unstyled is used to define an alternative styling approach instead of the default theming with design tokens. In unstyled mode the css variables of the design tokens and the css rule sets that utilize them are not included. Here is an example of an Unstyled Select, the core functionality and accessibility is provided whereas styling is not included.
7
+ The term `unstyled` is used to define an alternative styling approach instead of the default theming with design tokens. In unstyled mode the css variables of the design tokens and the css rule sets that utilize them are not
8
+ included. Here is an example of an Unstyled Select, the core functionality and accessibility is provided whereas styling is not included.
9
+
10
+ ## Setup
11
+
12
+ Unstyled mode is enabled for the whole suite by enabling `unstyled` option during ExhaustiveUI installation.
13
+
14
+ ```typescript
15
+ import { ApplicationConfig } from '@angular/core';
16
+
17
+ export const appConfig: ApplicationConfig = {
18
+ providers: [
19
+ provideExhaustive({
20
+ unstyled: true
21
+ })
22
+ ]
23
+ };
24
+ ```
25
+
26
+ Alternatively even in the default styled mode, a particular component can still be used as unstyled by adding the `unstyled` prop of the component.
27
+
28
+ ```html
29
+ <div class="card flex justify-center items-center gap-2">
30
+ <p-button label="Styled" icon="pi pi-check" />
31
+ <p-button label="Unstyled" icon="pi pi-check" [unstyled]="true" />
32
+ </div>
33
+ ```
8
34
 
9
35
  ## Example
10
36
 
11
- Unstyled components require styling using your preferred approach. We recommend using Tailwind CSS with PassThrough attributes, a combination that works seamlessly together. The @exhaustive-ui/tailwindcss even provides special variants such as p-outlined: , p-vertical for the ExhaustiveUI components. The example below demonstrates how to style a button component with Tailwind CSS using PassThrough attributes. Before you begin, refer to the pass through section in the button documentation to familiarize yourself with the component's internal structure and PassThrough attributes. In this example, we'll target the root , label and icon elements to apply custom styles.
37
+ Unstyled components require styling using your preferred approach. We recommend using Tailwind CSS with PassThrough attributes, a combination that works seamlessly together. The `@exhaustive-ui/tailwindcss` even provides special
38
+ variants such as `p-outlined:`, `p-vertical` for the ExhaustiveUI components.
39
+
40
+ The example below demonstrates how to style a button component with Tailwind CSS using PassThrough attributes. Before you begin, refer to the
41
+ pass through section in the button documentation to familiarize yourself with the component's internal structure and PassThrough attributes. In this
42
+ example, we'll target the `root`, `label` and `icon` elements to apply custom styles.
43
+
44
+ ```html
45
+ <p-button
46
+ label="Search"
47
+ icon="pi pi-search"
48
+ [unstyled]="true"
49
+ [pt]="{
50
+ root: 'bg-teal-500 hover:bg-teal-700 active:bg-teal-900 cursor-pointer py-2 px-4 rounded-full border-0 flex gap-2',
51
+ label: 'text-white font-bold text-lg',
52
+ icon: 'text-white text-xl!'
53
+ }"
54
+ />
55
+ ```
12
56
 
13
57
  ## Global
14
58
 
15
- A global configuration can be created at application level to avoid repetition via the global pt option so that the styles can be shared from a single location. A particular component can still override a global configuration with its own pt property.
59
+ A global configuration can be created at application level to avoid repetition via the global `pt` option so that the styles can be shared from a single location. A particular component can still override a global configuration
60
+ with its own `pt` property.
16
61
 
17
62
  ```typescript
18
63
  import { ApplicationConfig } from '@angular/core';
@@ -33,7 +78,3 @@ export const appConfig: ApplicationConfig = {
33
78
  };
34
79
  ```
35
80
 
36
- ## Setup
37
-
38
- Unstyled mode is enabled for the whole suite by enabling unstyled option during ExhaustiveUI installation. Alternatively even in the default styled mode, a particular component can still be used as unstyled by adding the unstyled prop of the component.
39
-