@dev-tcloud/tcloud-ui 6.15.0 → 6.18.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/docs/tcloud-ui-accordion.md +345 -0
- package/docs/tcloud-ui-actions.md +88 -0
- package/docs/tcloud-ui-alert-banner.md +104 -0
- package/docs/tcloud-ui-array-to-text.md +361 -0
- package/docs/tcloud-ui-breadcrumb.md +103 -0
- package/docs/tcloud-ui-bytes.md +109 -0
- package/docs/tcloud-ui-calendar.md +387 -0
- package/docs/tcloud-ui-card-accordion.md +266 -0
- package/docs/tcloud-ui-card-title.md +47 -0
- package/docs/tcloud-ui-card.md +40 -0
- package/docs/tcloud-ui-choice-issues.md +59 -0
- package/docs/tcloud-ui-cnpj.md +102 -0
- package/docs/tcloud-ui-container.md +171 -0
- package/docs/tcloud-ui-cpf.md +102 -0
- package/docs/tcloud-ui-currency.md +271 -0
- package/docs/tcloud-ui-data-list.md +91 -0
- package/docs/tcloud-ui-datebr.md +139 -0
- package/docs/tcloud-ui-datepicker-time.md +191 -0
- package/docs/tcloud-ui-datepicker.md +186 -0
- package/docs/tcloud-ui-dropdown-multi.md +444 -0
- package/docs/tcloud-ui-dropdown.md +369 -0
- package/docs/tcloud-ui-el-copy.md +113 -0
- package/docs/tcloud-ui-empty-content.md +412 -0
- package/docs/tcloud-ui-faq.md +496 -0
- package/docs/tcloud-ui-filter-bar.md +86 -0
- package/docs/tcloud-ui-filters.md +337 -0
- package/docs/tcloud-ui-hover-parent.md +467 -0
- package/docs/tcloud-ui-icon-button.md +104 -0
- package/docs/tcloud-ui-input-container.md +520 -0
- package/docs/tcloud-ui-input-password.md +258 -0
- package/docs/tcloud-ui-input-search.md +314 -0
- package/docs/tcloud-ui-label-token.md +286 -0
- package/docs/tcloud-ui-legend.md +72 -0
- package/docs/tcloud-ui-line-step-circle.md +98 -0
- package/docs/tcloud-ui-line-step-title.md +194 -0
- package/docs/tcloud-ui-linha-logo.md +550 -0
- package/docs/tcloud-ui-loading.md +88 -0
- package/docs/tcloud-ui-message.md +539 -0
- package/docs/tcloud-ui-modal.md +196 -0
- package/docs/tcloud-ui-monthname.md +123 -0
- package/docs/tcloud-ui-multi-input.md +290 -0
- package/docs/tcloud-ui-multi-select.md +311 -0
- package/docs/tcloud-ui-multiples-values.md +157 -0
- package/docs/tcloud-ui-not-found.md +88 -0
- package/docs/tcloud-ui-number-step.md +134 -0
- package/docs/tcloud-ui-pagination.md +579 -0
- package/docs/tcloud-ui-progress-bar.md +65 -0
- package/docs/tcloud-ui-radio.md +83 -0
- package/docs/tcloud-ui-reorder-items.md +418 -0
- package/docs/tcloud-ui-respective.md +167 -0
- package/docs/tcloud-ui-scroll-box.md +109 -0
- package/docs/tcloud-ui-search-bar.md +88 -0
- package/docs/tcloud-ui-search-in-object.md +143 -0
- package/docs/tcloud-ui-search-input.md +74 -0
- package/docs/tcloud-ui-skeleton-loading.md +394 -0
- package/docs/tcloud-ui-slide-toggle.md +210 -0
- package/docs/tcloud-ui-statusinfo.md +138 -0
- package/docs/tcloud-ui-tab-group.md +376 -0
- package/docs/tcloud-ui-tab-menu.md +109 -0
- package/docs/tcloud-ui-table.md +96 -0
- package/docs/tcloud-ui-tag.md +379 -0
- package/docs/tcloud-ui-tc-badge.md +168 -0
- package/docs/tcloud-ui-tc-btn.md +189 -0
- package/docs/tcloud-ui-tc-colors.md +204 -0
- package/docs/tcloud-ui-tc-form-control.md +200 -0
- package/docs/tcloud-ui-tc-text.md +139 -0
- package/docs/tcloud-ui-tc-title.md +118 -0
- package/docs/tcloud-ui-tcloud-form.md +55 -0
- package/docs/tcloud-ui-toast.md +83 -0
- package/docs/tcloud-ui-tooltip.md +88 -0
- package/docs/tcloud-ui-topology.md +232 -0
- package/docs/tcloud-ui-upload-area.md +195 -0
- package/docs/tcloud-ui-welcome.md +112 -0
- package/docs/tcloud-ui-wizard-steps.md +103 -0
- package/js/tcloud-ui-app.js +11 -0
- package/package.json +1 -1
- package/scss/tcloud-revitalizacao/components/_tcloud-ui-table.scss +95 -0
- package/scss/tcloud-revitalizacao/tc-rev-styles.scss +1 -1
- package/scss/tcloud-revitalizacao/components/_tc-rev-table.scss +0 -57
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
# Calendar
|
|
2
|
+
|
|
3
|
+
## Características
|
|
4
|
+
|
|
5
|
+
O componente `tcloud-ui-calendar` é um componente calendário interativo com suporte a navegação entre meses e anos, seleção de datas e indicadores de compromissos. Implementa uma interface responsiva com mudança de visualização (dias, meses, anos) facilitando a seleção rápida de datas.
|
|
6
|
+
|
|
7
|
+
## Instalação
|
|
8
|
+
|
|
9
|
+
Para utilizar o componente Calendar, importe o módulo `TCloudUiModule`:
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import { TCloudUiModule } from '@tcloud-ui/lib';
|
|
13
|
+
import { Component } from '@angular/core';
|
|
14
|
+
|
|
15
|
+
@Component({
|
|
16
|
+
selector: 'app-example',
|
|
17
|
+
standalone: true,
|
|
18
|
+
imports: [TCloudUiModule],
|
|
19
|
+
template: `<tcloud-ui-calendar ...></tcloud-ui-calendar>`
|
|
20
|
+
})
|
|
21
|
+
export class ExampleComponent {}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Ou importe diretamente o componente e a interface de dados:
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
import { TCloudUiCalendarComponent, CalendarAppointment } from '@tcloud-ui/lib';
|
|
28
|
+
|
|
29
|
+
@Component({
|
|
30
|
+
selector: 'app-example',
|
|
31
|
+
standalone: true,
|
|
32
|
+
imports: [TCloudUiCalendarComponent],
|
|
33
|
+
template: `<tcloud-ui-calendar ...></tcloud-ui-calendar>`
|
|
34
|
+
})
|
|
35
|
+
export class ExampleComponent {}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Propriedades (API)
|
|
39
|
+
|
|
40
|
+
### Inputs
|
|
41
|
+
|
|
42
|
+
| Nome | Tipo | Descrição | Valor Default |
|
|
43
|
+
|------|------|-----------|---------------|
|
|
44
|
+
| `appointments` | `CalendarAppointment[]` | Lista de compromissos/eventos a exibir no calendário | `[]` |
|
|
45
|
+
| `activeDate` | `string` | Data ativa em formato `YYYY-MM-DD` para pré-seleção | `undefined` |
|
|
46
|
+
|
|
47
|
+
### Outputs
|
|
48
|
+
|
|
49
|
+
| Nome | Tipo de Evento | Descrição |
|
|
50
|
+
|------|----------------|-----------|
|
|
51
|
+
| `onSelectDate` | `Date` | Emitido quando uma data é selecionada, retorna objeto completo Date |
|
|
52
|
+
|
|
53
|
+
### Interfaces e Tipos Exportados
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
export interface CalendarAppointment {
|
|
57
|
+
appointmentDate: string; // Formato: YYYY-MM-DD
|
|
58
|
+
type: 'info' | 'alert' | 'danger' | 'success';
|
|
59
|
+
description: string; // Texto do compromisso (exibido no tooltip)
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Comportamento
|
|
64
|
+
|
|
65
|
+
- **Navegação de Meses**: Clique nas setas para navegar entre meses quando em visualização de dias
|
|
66
|
+
- **Navegação de Anos**: Clique nas setas para navegar entre anos quando em visualização de meses/anos
|
|
67
|
+
- **Modo de Visualização**:
|
|
68
|
+
- **Dias (padrão)**: Seleção de data diária
|
|
69
|
+
- **Meses**: Clique no mês no cabeçalho para alternar
|
|
70
|
+
- **Anos**: Clique no ano no cabeçalho para alternar
|
|
71
|
+
- **Indicadores de Compromissos**: Pontos coloridos indicam compromissos (info=azul, alert=laranja, danger=vermelho, success=verde)
|
|
72
|
+
- **Tooltip**: Passe o mouse sobre um dia com compromisso para ver a descrição
|
|
73
|
+
|
|
74
|
+
## Exemplos de Uso
|
|
75
|
+
|
|
76
|
+
### Uso Básico
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
import { Component } from '@angular/core';
|
|
80
|
+
import { TCloudUiModule } from '@tcloud-ui/lib';
|
|
81
|
+
import { CommonModule } from '@angular/common';
|
|
82
|
+
|
|
83
|
+
@Component({
|
|
84
|
+
selector: 'app-basic-calendar',
|
|
85
|
+
standalone: true,
|
|
86
|
+
imports: [CommonModule, TCloudUiModule],
|
|
87
|
+
template: `
|
|
88
|
+
<tcloud-ui-calendar></tcloud-ui-calendar>
|
|
89
|
+
`
|
|
90
|
+
})
|
|
91
|
+
export class BasicCalendarComponent {}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Com Seleção de Data
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
import { Component, signal } from '@angular/core';
|
|
98
|
+
import { TCloudUiModule } from '@tcloud-ui/lib';
|
|
99
|
+
import { CommonModule } from '@angular/common';
|
|
100
|
+
|
|
101
|
+
@Component({
|
|
102
|
+
selector: 'app-select-calendar',
|
|
103
|
+
standalone: true,
|
|
104
|
+
imports: [CommonModule, TCloudUiModule],
|
|
105
|
+
template: `
|
|
106
|
+
<div>
|
|
107
|
+
<tcloud-ui-calendar
|
|
108
|
+
(onSelectDate)="onDateSelected($event)">
|
|
109
|
+
</tcloud-ui-calendar>
|
|
110
|
+
|
|
111
|
+
<p *ngIf="selectedDate()">
|
|
112
|
+
Data selecionada: {{ selectedDate() | date: 'dd/MM/yyyy' }}
|
|
113
|
+
</p>
|
|
114
|
+
</div>
|
|
115
|
+
`
|
|
116
|
+
})
|
|
117
|
+
export class SelectCalendarComponent {
|
|
118
|
+
selectedDate = signal<Date | null>(null);
|
|
119
|
+
|
|
120
|
+
onDateSelected(date: Date): void {
|
|
121
|
+
this.selectedDate.set(date);
|
|
122
|
+
console.log('Data selecionada:', date);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Com Compromissos
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
import { Component, signal } from '@angular/core';
|
|
131
|
+
import { TCloudUiModule, CalendarAppointment } from '@tcloud-ui/lib';
|
|
132
|
+
import { CommonModule } from '@angular/common';
|
|
133
|
+
|
|
134
|
+
@Component({
|
|
135
|
+
selector: 'app-appointments-calendar',
|
|
136
|
+
standalone: true,
|
|
137
|
+
imports: [CommonModule, TCloudUiModule],
|
|
138
|
+
template: `
|
|
139
|
+
<tcloud-ui-calendar
|
|
140
|
+
[appointments]="appointments()"
|
|
141
|
+
(onSelectDate)="onDateSelected($event)">
|
|
142
|
+
</tcloud-ui-calendar>
|
|
143
|
+
`,
|
|
144
|
+
styles: [`
|
|
145
|
+
:host {
|
|
146
|
+
display: block;
|
|
147
|
+
padding: 20px;
|
|
148
|
+
}
|
|
149
|
+
`]
|
|
150
|
+
})
|
|
151
|
+
export class AppointmentsCalendarComponent {
|
|
152
|
+
selectedDate = signal<Date | null>(null);
|
|
153
|
+
|
|
154
|
+
appointments = signal<CalendarAppointment[]>([
|
|
155
|
+
{
|
|
156
|
+
appointmentDate: new Date().toISOString().split('T')[0],
|
|
157
|
+
type: 'info',
|
|
158
|
+
description: 'Reunião de planejamento'
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
appointmentDate: new Date(new Date().getTime() + 2*24*60*60*1000).toISOString().split('T')[0],
|
|
162
|
+
type: 'success',
|
|
163
|
+
description: 'Projeto aprovado'
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
appointmentDate: new Date(new Date().getTime() + 5*24*60*60*1000).toISOString().split('T')[0],
|
|
167
|
+
type: 'alert',
|
|
168
|
+
description: 'Atenção: Prazo próximo'
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
appointmentDate: new Date(new Date().getTime() + 10*24*60*60*1000).toISOString().split('T')[0],
|
|
172
|
+
type: 'danger',
|
|
173
|
+
description: 'Urgente: Revisão necessária'
|
|
174
|
+
}
|
|
175
|
+
]);
|
|
176
|
+
|
|
177
|
+
onDateSelected(date: Date): void {
|
|
178
|
+
this.selectedDate.set(date);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Com Data Ativa Pré-selecionada
|
|
184
|
+
|
|
185
|
+
```typescript
|
|
186
|
+
import { Component, signal } from '@angular/core';
|
|
187
|
+
import { TCloudUiModule } from '@tcloud-ui/lib';
|
|
188
|
+
import { CommonModule } from '@angular/common';
|
|
189
|
+
|
|
190
|
+
@Component({
|
|
191
|
+
selector: 'app-preset-calendar',
|
|
192
|
+
standalone: true,
|
|
193
|
+
imports: [CommonModule, TCloudUiModule],
|
|
194
|
+
template: `
|
|
195
|
+
<tcloud-ui-calendar
|
|
196
|
+
[activeDate]="activeDate()"
|
|
197
|
+
(onSelectDate)="onDateSelected($event)">
|
|
198
|
+
</tcloud-ui-calendar>
|
|
199
|
+
`
|
|
200
|
+
})
|
|
201
|
+
export class PresetCalendarComponent {
|
|
202
|
+
activeDate = signal('2024-12-25'); // Data pré-selecionada
|
|
203
|
+
|
|
204
|
+
onDateSelected(date: Date): void {
|
|
205
|
+
console.log('Data selecionada:', date);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Múltiplos Calendários com Diferentes Estados
|
|
211
|
+
|
|
212
|
+
```typescript
|
|
213
|
+
import { Component, signal } from '@angular/core';
|
|
214
|
+
import { TCloudUiModule, CalendarAppointment } from '@tcloud-ui/lib';
|
|
215
|
+
import { CommonModule } from '@angular/common';
|
|
216
|
+
|
|
217
|
+
@Component({
|
|
218
|
+
selector: 'app-multi-calendar',
|
|
219
|
+
standalone: true,
|
|
220
|
+
imports: [CommonModule, TCloudUiModule],
|
|
221
|
+
template: `
|
|
222
|
+
<div class="calendars-grid">
|
|
223
|
+
<div class="calendar-box">
|
|
224
|
+
<h3>Calendário Simples</h3>
|
|
225
|
+
<tcloud-ui-calendar></tcloud-ui-calendar>
|
|
226
|
+
</div>
|
|
227
|
+
|
|
228
|
+
<div class="calendar-box">
|
|
229
|
+
<h3>Calendário com Compromissos</h3>
|
|
230
|
+
<tcloud-ui-calendar
|
|
231
|
+
[appointments]="appointments()">
|
|
232
|
+
</tcloud-ui-calendar>
|
|
233
|
+
</div>
|
|
234
|
+
|
|
235
|
+
<div class="calendar-box">
|
|
236
|
+
<h3>Calendário com Seleção</h3>
|
|
237
|
+
<tcloud-ui-calendar
|
|
238
|
+
[appointments]="appointments()"
|
|
239
|
+
(onSelectDate)="onDateSelected($event)">
|
|
240
|
+
</tcloud-ui-calendar>
|
|
241
|
+
<p *ngIf="selectedDate()">
|
|
242
|
+
Selecionado: {{ selectedDate() | date: 'dd/MM/yyyy' }}
|
|
243
|
+
</p>
|
|
244
|
+
</div>
|
|
245
|
+
</div>
|
|
246
|
+
`,
|
|
247
|
+
styles: [`
|
|
248
|
+
.calendars-grid {
|
|
249
|
+
display: grid;
|
|
250
|
+
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
|
251
|
+
gap: 20px;
|
|
252
|
+
padding: 20px;
|
|
253
|
+
}
|
|
254
|
+
.calendar-box {
|
|
255
|
+
padding: 20px;
|
|
256
|
+
border: 1px solid var(--c-neutral-200);
|
|
257
|
+
border-radius: 8px;
|
|
258
|
+
background: var(--c-neutral-50);
|
|
259
|
+
}
|
|
260
|
+
h3 {
|
|
261
|
+
margin-top: 0;
|
|
262
|
+
color: var(--c-neutral-800);
|
|
263
|
+
}
|
|
264
|
+
`]
|
|
265
|
+
})
|
|
266
|
+
export class MultiCalendarComponent {
|
|
267
|
+
selectedDate = signal<Date | null>(null);
|
|
268
|
+
|
|
269
|
+
appointments = signal<CalendarAppointment[]>([
|
|
270
|
+
{
|
|
271
|
+
appointmentDate: new Date().toISOString().split('T')[0],
|
|
272
|
+
type: 'success',
|
|
273
|
+
description: 'Disponível'
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
appointmentDate: new Date(new Date().getTime() + 3*24*60*60*1000).toISOString().split('T')[0],
|
|
277
|
+
type: 'danger',
|
|
278
|
+
description: 'Ocupado'
|
|
279
|
+
}
|
|
280
|
+
]);
|
|
281
|
+
|
|
282
|
+
onDateSelected(date: Date): void {
|
|
283
|
+
this.selectedDate.set(date);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### Em Formulário Reativo
|
|
289
|
+
|
|
290
|
+
```typescript
|
|
291
|
+
import { Component, signal, OnInit } from '@angular/core';
|
|
292
|
+
import { TCloudUiModule } from '@tcloud-ui/lib';
|
|
293
|
+
import { CommonModule } from '@angular/common';
|
|
294
|
+
import { FormBuilder, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
|
|
295
|
+
|
|
296
|
+
@Component({
|
|
297
|
+
selector: 'app-form-calendar',
|
|
298
|
+
standalone: true,
|
|
299
|
+
imports: [CommonModule, TCloudUiModule, ReactiveFormsModule],
|
|
300
|
+
template: `
|
|
301
|
+
<form [formGroup]="form">
|
|
302
|
+
<div>
|
|
303
|
+
<label>Selecione uma data de início:</label>
|
|
304
|
+
|
|
305
|
+
<tcloud-ui-calendar
|
|
306
|
+
(onSelectDate)="setStartDate($event)">
|
|
307
|
+
</tcloud-ui-calendar>
|
|
308
|
+
|
|
309
|
+
<p>Data selecionada: {{ form.get('startDate')?.value | date: 'dd/MM/yyyy' }}</p>
|
|
310
|
+
</div>
|
|
311
|
+
|
|
312
|
+
<button (click)="submitForm()" [disabled]="!form.valid">
|
|
313
|
+
Confirmar
|
|
314
|
+
</button>
|
|
315
|
+
</form>
|
|
316
|
+
`,
|
|
317
|
+
styles: [`
|
|
318
|
+
form {
|
|
319
|
+
padding: 20px;
|
|
320
|
+
background: var(--c-neutral-50);
|
|
321
|
+
border-radius: 8px;
|
|
322
|
+
}
|
|
323
|
+
div {
|
|
324
|
+
margin-bottom: 20px;
|
|
325
|
+
}
|
|
326
|
+
label {
|
|
327
|
+
display: block;
|
|
328
|
+
margin-bottom: 10px;
|
|
329
|
+
font-weight: 600;
|
|
330
|
+
color: var(--c-neutral-700);
|
|
331
|
+
}
|
|
332
|
+
button {
|
|
333
|
+
padding: 10px 20px;
|
|
334
|
+
background: var(--c-primary-500);
|
|
335
|
+
color: white;
|
|
336
|
+
border: none;
|
|
337
|
+
border-radius: 4px;
|
|
338
|
+
cursor: pointer;
|
|
339
|
+
}
|
|
340
|
+
`]
|
|
341
|
+
})
|
|
342
|
+
export class FormCalendarComponent implements OnInit {
|
|
343
|
+
form!: FormGroup;
|
|
344
|
+
|
|
345
|
+
constructor(private fb: FormBuilder) {}
|
|
346
|
+
|
|
347
|
+
ngOnInit(): void {
|
|
348
|
+
this.form = this.fb.group({
|
|
349
|
+
startDate: [null, Validators.required]
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
setStartDate(date: Date): void {
|
|
354
|
+
this.form.patchValue({ startDate: date });
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
submitForm(): void {
|
|
358
|
+
if (this.form.valid) {
|
|
359
|
+
console.log('Formulário enviado:', this.form.value);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
## Estilos e Customização
|
|
366
|
+
|
|
367
|
+
O componente utiliza variáveis CSS do tema para composição visual:
|
|
368
|
+
- `--c-neutral-50`: Fundo do calendário
|
|
369
|
+
- `--c-neutral-300`: Borda
|
|
370
|
+
- `--c-primary-500`: Cor primária (hover/seleção)
|
|
371
|
+
- `--c-info-500`, `--c-alert-500`, `--c-danger-500`, `--c-success-500`: Cores dos indicadores de compromissos
|
|
372
|
+
|
|
373
|
+
Você pode sobrescrever essas variáveis no seu escopo CSS para customizar o calendário.
|
|
374
|
+
|
|
375
|
+
## Notas Importantes
|
|
376
|
+
|
|
377
|
+
- O componente é **standalone** e não requer NgModule
|
|
378
|
+
- As datas devem estar no formato `YYYY-MM-DD` quando utilisadas como string
|
|
379
|
+
- O objeto Date emitido em `onSelectDate` pode ser formatado com pipes (date, etc)
|
|
380
|
+
- Compromise dates devem estar sincronizadas com o formato esperado (YYYY-MM-DD)
|
|
381
|
+
- O componente é responsivo e se adapta ao tamanho do container
|
|
382
|
+
|
|
383
|
+
## Acessibilidade
|
|
384
|
+
|
|
385
|
+
- Navegação via teclado (em desenvolvimento)
|
|
386
|
+
- Aria-labels para leitores de tela (em desenvolvimento)
|
|
387
|
+
- Alto contraste em modo noturno
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
# Card Accordion
|
|
2
|
+
|
|
3
|
+
## Características
|
|
4
|
+
|
|
5
|
+
O componente `tcloud-ui-card-accordion` é um accordion estilizado em formato de cartão com suporte a título, ícone customizável, badge informativo e comportamento responsivo. Implementa controle de estado aberto/fechado com two-way binding, facilitando a criação de listas expansíveis de informações organizadas em cartões.
|
|
6
|
+
|
|
7
|
+
## Instalação
|
|
8
|
+
|
|
9
|
+
Para utilizar o componente Card Accordion, importe o módulo `TCloudUiModule`:
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import { TCloudUiModule } from '@tcloud-ui/lib';
|
|
13
|
+
import { Component } from '@angular/core';
|
|
14
|
+
|
|
15
|
+
@Component({
|
|
16
|
+
selector: 'app-example',
|
|
17
|
+
standalone: true,
|
|
18
|
+
imports: [TCloudUiModule],
|
|
19
|
+
template: `<tcloud-ui-card-accordion ...></tcloud-ui-card-accordion>`
|
|
20
|
+
})
|
|
21
|
+
export class ExampleComponent {}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Ou importe diretamente o componente:
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
import { TCloudUiCardAccordionComponent } from '@tcloud-ui/lib';
|
|
28
|
+
|
|
29
|
+
@Component({
|
|
30
|
+
selector: 'app-example',
|
|
31
|
+
standalone: true,
|
|
32
|
+
imports: [TCloudUiCardAccordionComponent],
|
|
33
|
+
template: `<tcloud-ui-card-accordion ...></tcloud-ui-card-accordion>`
|
|
34
|
+
})
|
|
35
|
+
export class ExampleComponent {}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Propriedades (API)
|
|
39
|
+
|
|
40
|
+
### Inputs
|
|
41
|
+
|
|
42
|
+
| Nome | Tipo | Descrição | Valor Default |
|
|
43
|
+
|------|------|-----------|---------------|
|
|
44
|
+
| `title` | `string` | Título principal do accordion | `''` (vazio) |
|
|
45
|
+
| `iconClass` | `string` | Classe CSS do ícone FontAwesome a exibir | `'fa-light fa-hard-drive'` |
|
|
46
|
+
| `showMoreText` | `string` | Texto do botão para expandir (desktop) | `'Exibir mais'` |
|
|
47
|
+
| `showLessText` | `string` | Texto do botão para retrair (desktop) | `'Exibir menos'` |
|
|
48
|
+
| `badge` | `{text: string; class: string} \| null` | Objeto com texto e classe CSS do badge | `null` |
|
|
49
|
+
|
|
50
|
+
### Two-Way Binding (Model)
|
|
51
|
+
|
|
52
|
+
| Nome | Tipo | Descrição |
|
|
53
|
+
|------|------|-----------|
|
|
54
|
+
| `isOpen` | `boolean` | Controla se o accordion está expandido ou retraído |
|
|
55
|
+
|
|
56
|
+
### Outputs
|
|
57
|
+
|
|
58
|
+
| Nome | Tipo de Evento | Descrição |
|
|
59
|
+
|------|----------------|-----------|
|
|
60
|
+
| `toggle` | `boolean` | Emitido quando o accordion é expandido ou retraído, com o novo estado |
|
|
61
|
+
|
|
62
|
+
## Exemplos de Uso
|
|
63
|
+
|
|
64
|
+
### Uso Básico
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
import { Component } from '@angular/core';
|
|
68
|
+
import { TCloudUiModule } from '@tcloud-ui/lib';
|
|
69
|
+
import { CommonModule } from '@angular/common';
|
|
70
|
+
|
|
71
|
+
@Component({
|
|
72
|
+
selector: 'app-basic-example',
|
|
73
|
+
standalone: true,
|
|
74
|
+
imports: [CommonModule, TCloudUiModule],
|
|
75
|
+
template: `
|
|
76
|
+
<tcloud-ui-card-accordion [title]="'Informações Gerais'">
|
|
77
|
+
<p>Conteúdo do accordion aqui</p>
|
|
78
|
+
</tcloud-ui-card-accordion>
|
|
79
|
+
`
|
|
80
|
+
})
|
|
81
|
+
export class BasicExampleComponent {}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Uso com Badge
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
import { Component } from '@angular/core';
|
|
88
|
+
import { TCloudUiModule } from '@tcloud-ui/lib';
|
|
89
|
+
import { CommonModule } from '@angular/common';
|
|
90
|
+
|
|
91
|
+
@Component({
|
|
92
|
+
selector: 'app-badge-example',
|
|
93
|
+
standalone: true,
|
|
94
|
+
imports: [CommonModule, TCloudUiModule],
|
|
95
|
+
template: `
|
|
96
|
+
<tcloud-ui-card-accordion
|
|
97
|
+
[title]="'ID: 12345 - Topologia Prod'"
|
|
98
|
+
[badge]="{ text: 'Ativo', class: 'c-success-500 bor-c-success-500' }"
|
|
99
|
+
>
|
|
100
|
+
<p>Detalhes da topologia em produção</p>
|
|
101
|
+
</tcloud-ui-card-accordion>
|
|
102
|
+
`
|
|
103
|
+
})
|
|
104
|
+
export class BadgeExampleComponent {}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Uso Avançado com Two-Way Binding
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
import { Component } from '@angular/core';
|
|
111
|
+
import { TCloudUiModule } from '@tcloud-ui/lib';
|
|
112
|
+
import { CommonModule } from '@angular/common';
|
|
113
|
+
|
|
114
|
+
@Component({
|
|
115
|
+
selector: 'app-advanced-example',
|
|
116
|
+
standalone: true,
|
|
117
|
+
imports: [CommonModule, TCloudUiModule],
|
|
118
|
+
template: `
|
|
119
|
+
<div>
|
|
120
|
+
<button (click)="toggleAll()">
|
|
121
|
+
{{ allOpen ? 'Retrair Tudo' : 'Expandir Tudo' }}
|
|
122
|
+
</button>
|
|
123
|
+
|
|
124
|
+
<tcloud-ui-card-accordion
|
|
125
|
+
*ngFor="let item of items; let i = index"
|
|
126
|
+
[(isOpen)]="items[i].isOpen"
|
|
127
|
+
[title]="item.title"
|
|
128
|
+
[iconClass]="item.icon"
|
|
129
|
+
[badge]="item.badge"
|
|
130
|
+
(toggle)="onToggle(i, $event)"
|
|
131
|
+
class="mar-t-16"
|
|
132
|
+
>
|
|
133
|
+
<p>{{ item.content }}</p>
|
|
134
|
+
</tcloud-ui-card-accordion>
|
|
135
|
+
</div>
|
|
136
|
+
`
|
|
137
|
+
})
|
|
138
|
+
export class AdvancedExampleComponent {
|
|
139
|
+
allOpen = false;
|
|
140
|
+
|
|
141
|
+
items = [
|
|
142
|
+
{
|
|
143
|
+
title: 'ID: 001 - Ambiente Produção',
|
|
144
|
+
icon: 'fa-light fa-server',
|
|
145
|
+
badge: { text: 'Ativo', class: 'c-success-500 bor-c-success-500' },
|
|
146
|
+
content: 'Informações do ambiente de produção',
|
|
147
|
+
isOpen: false
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
title: 'ID: 002 - Ambiente Homologação',
|
|
151
|
+
icon: 'fa-light fa-flask',
|
|
152
|
+
badge: { text: 'Pendente', class: 'c-warning-500 bor-c-warning-500' },
|
|
153
|
+
content: 'Informações do ambiente de homologação',
|
|
154
|
+
isOpen: false
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
title: 'ID: 003 - Ambiente Desenvolvimento',
|
|
158
|
+
icon: 'fa-light fa-laptop',
|
|
159
|
+
badge: null,
|
|
160
|
+
content: 'Informações do ambiente de desenvolvimento',
|
|
161
|
+
isOpen: false
|
|
162
|
+
}
|
|
163
|
+
];
|
|
164
|
+
|
|
165
|
+
toggleAll(): void {
|
|
166
|
+
this.allOpen = !this.allOpen;
|
|
167
|
+
this.items.forEach(item => {
|
|
168
|
+
item.isOpen = this.allOpen;
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
onToggle(index: number, isOpen: boolean): void {
|
|
173
|
+
console.log(`Accordion ${index} toggled to:`, isOpen);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Customização de Ícones e Textos
|
|
179
|
+
|
|
180
|
+
```typescript
|
|
181
|
+
import { Component } from '@angular/core';
|
|
182
|
+
import { TCloudUiModule } from '@tcloud-ui/lib';
|
|
183
|
+
import { CommonModule } from '@angular/common';
|
|
184
|
+
|
|
185
|
+
@Component({
|
|
186
|
+
selector: 'app-custom-example',
|
|
187
|
+
standalone: true,
|
|
188
|
+
imports: [CommonModule, TCloudUiModule],
|
|
189
|
+
template: `
|
|
190
|
+
<tcloud-ui-card-accordion
|
|
191
|
+
[title]="'Configurações Avançadas'"
|
|
192
|
+
[iconClass]="'fa-light fa-gear'"
|
|
193
|
+
[showMoreText]="'Mostrar detalhes'"
|
|
194
|
+
[showLessText]="'Ocultar detalhes'"
|
|
195
|
+
>
|
|
196
|
+
<div>
|
|
197
|
+
<label>Configuração 1: <input type="checkbox" /></label>
|
|
198
|
+
<label>Configuração 2: <input type="checkbox" /></label>
|
|
199
|
+
<label>Configuração 3: <input type="checkbox" /></label>
|
|
200
|
+
</div>
|
|
201
|
+
</tcloud-ui-card-accordion>
|
|
202
|
+
`
|
|
203
|
+
})
|
|
204
|
+
export class CustomExampleComponent {}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Controle Programático de Estado
|
|
208
|
+
|
|
209
|
+
```typescript
|
|
210
|
+
import { Component } from '@angular/core';
|
|
211
|
+
import { TCloudUiModule } from '@tcloud-ui/lib';
|
|
212
|
+
import { CommonModule } from '@angular/common';
|
|
213
|
+
import { signal } from '@angular/core';
|
|
214
|
+
|
|
215
|
+
@Component({
|
|
216
|
+
selector: 'app-programmatic-example',
|
|
217
|
+
standalone: true,
|
|
218
|
+
imports: [CommonModule, TCloudUiModule],
|
|
219
|
+
template: `
|
|
220
|
+
<button (click)="expandAccordion()">Expandir</button>
|
|
221
|
+
<button (click)="collapseAccordion()">Retrair</button>
|
|
222
|
+
|
|
223
|
+
<tcloud-ui-card-accordion
|
|
224
|
+
[(isOpen)]="isExpanded"
|
|
225
|
+
[title]="'Estado Controlado Programaticamente'"
|
|
226
|
+
class="mar-t-16"
|
|
227
|
+
>
|
|
228
|
+
<p>Este accordion está expandido: {{ isExpanded }}</p>
|
|
229
|
+
</tcloud-ui-card-accordion>
|
|
230
|
+
`
|
|
231
|
+
})
|
|
232
|
+
export class ProgrammaticExampleComponent {
|
|
233
|
+
isExpanded = signal(false);
|
|
234
|
+
|
|
235
|
+
expandAccordion(): void {
|
|
236
|
+
this.isExpanded.set(true);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
collapseAccordion(): void {
|
|
240
|
+
this.isExpanded.set(false);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## Comportamento Responsivo
|
|
246
|
+
|
|
247
|
+
O componente implementa diferentes comportamentos para desktop e mobile:
|
|
248
|
+
|
|
249
|
+
- **Desktop**: Exibe botão com texto "Exibir mais" / "Exibir menos" e aplicam-se classes de padding maiores
|
|
250
|
+
- **Mobile (< 480px)**: Exibe botão reduzido apenas com ícone de chevron para economizar espaço
|
|
251
|
+
|
|
252
|
+
O componente utiliza o serviço `TCloudUiDeviceUtilsService` para detectar o tamanho da viewport e aplicar os estilos adequados automaticamente.
|
|
253
|
+
|
|
254
|
+
## Conteúdo Dinâmico
|
|
255
|
+
|
|
256
|
+
O conteúdo do accordion é projetado usando `<ng-content>`, permitindo qualquer conteúdo HTML ou componentes Angular dentro:
|
|
257
|
+
|
|
258
|
+
```typescript
|
|
259
|
+
<tcloud-ui-card-accordion [title]="'Seção Dinâmica'">
|
|
260
|
+
<app-custom-component></app-custom-component>
|
|
261
|
+
<table>...</table>
|
|
262
|
+
<form>...</form>
|
|
263
|
+
</tcloud-ui-card-accordion>
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
O conteúdo será exibido ou ocultado conforme o estado `isOpen` do accordion.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Card Title
|
|
2
|
+
|
|
3
|
+
## Características
|
|
4
|
+
- Cabeçalho de cartão com ícone projetado e texto obrigatório.
|
|
5
|
+
- Projeção flexível: aceita conteúdo extra (ex.: botões) após o título.
|
|
6
|
+
- Responsivo: reduz dimensões do ícone e tipografia em telas menores.
|
|
7
|
+
- Standalone, pronto para importação direta.
|
|
8
|
+
|
|
9
|
+
## Instalação
|
|
10
|
+
```ts
|
|
11
|
+
import { TCloudUiCardTitleComponent } from 'projects/tcloud-ui/src/public-api';
|
|
12
|
+
|
|
13
|
+
@Component({
|
|
14
|
+
selector: 'app-example',
|
|
15
|
+
standalone: true,
|
|
16
|
+
imports: [TCloudUiCardTitleComponent],
|
|
17
|
+
template: `<tcloud-ui-card-title title="Title"></tcloud-ui-card-title>`
|
|
18
|
+
})
|
|
19
|
+
export class ExampleComponent {}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Propriedades (API)
|
|
23
|
+
### Inputs
|
|
24
|
+
| Nome | Tipo | Descrição | Valor Default |
|
|
25
|
+
| --- | --- | --- | --- |
|
|
26
|
+
| title | string (obrigatório) | Texto exibido como título. | - |
|
|
27
|
+
|
|
28
|
+
### Outputs
|
|
29
|
+
| Nome | Tipo de Evento | Descrição |
|
|
30
|
+
| --- | --- | --- |
|
|
31
|
+
| (não possui) | - | Componente não emite eventos. |
|
|
32
|
+
|
|
33
|
+
## Exemplos de Uso
|
|
34
|
+
### Uso Básico
|
|
35
|
+
```html
|
|
36
|
+
<tcloud-ui-card-title title="Card Title">
|
|
37
|
+
<i class="fas fa-times" icon></i>
|
|
38
|
+
</tcloud-ui-card-title>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Uso Avançado
|
|
42
|
+
```html
|
|
43
|
+
<tcloud-ui-card-title title="Relatório Semanal">
|
|
44
|
+
<i class="fa-light fa-chart-line" icon></i>
|
|
45
|
+
<button type="button" class="tc-btn tc-btn-primary mar-l-a">Ação</button>
|
|
46
|
+
</tcloud-ui-card-title>
|
|
47
|
+
```
|