@dev-tcloud/tcloud-ui 6.15.0 → 6.17.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
|
@@ -0,0 +1,467 @@
|
|
|
1
|
+
# Hover Parent
|
|
2
|
+
|
|
3
|
+
A diretiva **Hover Parent** permite aplicar uma classe CSS a um elemento pai quando o usuário passa o mouse (hover) sobre o elemento que possui a diretiva. É útil para criar efeitos visuais coordenados entre elementos relacionados, como mudança de cor ou estilo quando o mouse atravessa um componente filho.
|
|
4
|
+
|
|
5
|
+
## Características
|
|
6
|
+
|
|
7
|
+
- **Interação mouse coordenada**: Aplica classes ao elemento pai em resposta ao hover do filho
|
|
8
|
+
- **Identificação por ID**: Usa ID do elemento para localizar o alvo pai
|
|
9
|
+
- **Classe personalizável**: Permite definir qualquer classe CSS via input
|
|
10
|
+
- **Classe padrão**: Utiliza `tcloud-hover-parent` se nenhuma classe for especificada
|
|
11
|
+
- **Removção automática**: Remove a classe quando o mouse sai do elemento
|
|
12
|
+
- **Sem acoplamento**: Funciona com qualquer elemento HTML e estrutura de componentes
|
|
13
|
+
|
|
14
|
+
## Instalação
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import { TCloudUiModule } from 'projects/tcloud-ui/src/public-api';
|
|
18
|
+
|
|
19
|
+
@Component({
|
|
20
|
+
imports: [TCloudUiModule],
|
|
21
|
+
// ... resto da configuração
|
|
22
|
+
})
|
|
23
|
+
export class MyComponent {}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Propriedades (API)
|
|
27
|
+
|
|
28
|
+
### Seletor
|
|
29
|
+
|
|
30
|
+
| Seletor | Descrição |
|
|
31
|
+
|---------|-----------|
|
|
32
|
+
| `[TCHoverParent]` | Atributo aplicado a um elemento para ativar a diretiva de hover parent |
|
|
33
|
+
|
|
34
|
+
### Inputs
|
|
35
|
+
|
|
36
|
+
| Nome | Tipo | Descrição | Obrigatório |
|
|
37
|
+
|------|------|-----------|-------------|
|
|
38
|
+
| `TCHoverParent` | `string` | ID do elemento pai que receberá a classe de hover | ✓ Sim |
|
|
39
|
+
| `TCHoverParentClass` | `string` | Nome da classe CSS a ser aplicada ao elemento pai. Se não fornecida, usa `tcloud-hover-parent` | ✗ Não |
|
|
40
|
+
|
|
41
|
+
### Listeners do Host
|
|
42
|
+
|
|
43
|
+
| Evento | Descrição |
|
|
44
|
+
|--------|-----------|
|
|
45
|
+
| `@HostListener('mouseover')` | Acionado quando o mouse entra no elemento, adiciona a classe ao pai |
|
|
46
|
+
| `@HostListener('mouseout')` | Acionado quando o mouse sai do elemento, remove a classe do pai |
|
|
47
|
+
|
|
48
|
+
## Comportamento
|
|
49
|
+
|
|
50
|
+
- Quando o mouse entra no elemento com a diretiva, a classe especificada é adicionada ao elemento pai
|
|
51
|
+
- Quando o mouse sai do elemento, a classe é removida do elemento pai
|
|
52
|
+
- A diretiva localiza o elemento pai usando `document.getElementById()` no ID fornecido
|
|
53
|
+
- Se o elemento pai não for encontrado, nenhuma classe é aplicada (silenciosamente ignorado)
|
|
54
|
+
- Se nenhuma classe for especificada em `TCHoverParentClass`, a classe padrão `tcloud-hover-parent` é utilizada
|
|
55
|
+
|
|
56
|
+
## Exemplos de Uso
|
|
57
|
+
|
|
58
|
+
### Uso Básico
|
|
59
|
+
|
|
60
|
+
Aplicar a classe padrão a um elemento pai ao fazer hover em um botão:
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
@Component({
|
|
64
|
+
selector: 'app-hover-basic',
|
|
65
|
+
imports: [CommonModule, TCloudUiModule],
|
|
66
|
+
template: `
|
|
67
|
+
<div class="parent-box" id="parent1">
|
|
68
|
+
<button
|
|
69
|
+
[TCHoverParent]="'parent1'"
|
|
70
|
+
>
|
|
71
|
+
Passe o mouse aqui
|
|
72
|
+
</button>
|
|
73
|
+
|
|
74
|
+
<p>O elemento pai receberá a classe 'tcloud-hover-parent'</p>
|
|
75
|
+
</div>
|
|
76
|
+
`,
|
|
77
|
+
styles: [`
|
|
78
|
+
.parent-box {
|
|
79
|
+
padding: 16px;
|
|
80
|
+
background: #f5f5f5;
|
|
81
|
+
border: 1px solid #ddd;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.parent-box.tcloud-hover-parent {
|
|
85
|
+
background: #e3f2fd;
|
|
86
|
+
border-color: #1976d2;
|
|
87
|
+
}
|
|
88
|
+
`]
|
|
89
|
+
})
|
|
90
|
+
export class HoverBasicComponent {}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Uso com Classe Personalizada
|
|
94
|
+
|
|
95
|
+
Aplicar uma classe específica ao elemento pai durante hover:
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
@Component({
|
|
99
|
+
selector: 'app-hover-custom',
|
|
100
|
+
imports: [CommonModule, TCloudUiModule],
|
|
101
|
+
template: `
|
|
102
|
+
<div class="container" id="myContainer">
|
|
103
|
+
<button
|
|
104
|
+
[TCHoverParent]="'myContainer'"
|
|
105
|
+
[TCHoverParentClass]="'hover-active'"
|
|
106
|
+
>
|
|
107
|
+
Hover com Classe Customizada
|
|
108
|
+
</button>
|
|
109
|
+
</div>
|
|
110
|
+
`,
|
|
111
|
+
styles: [`
|
|
112
|
+
.container {
|
|
113
|
+
padding: 20px;
|
|
114
|
+
background: #f5f5f5;
|
|
115
|
+
border-radius: 4px;
|
|
116
|
+
transition: all 0.3s ease;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.container.hover-active {
|
|
120
|
+
background: #ffeb3b;
|
|
121
|
+
box-shadow: 0 4px 8px rgba(0,0,0,0.2);
|
|
122
|
+
transform: scale(1.02);
|
|
123
|
+
}
|
|
124
|
+
`]
|
|
125
|
+
})
|
|
126
|
+
export class HoverCustomComponent {}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Uso Avançado com Múltiplos Elementos
|
|
130
|
+
|
|
131
|
+
Múltiplos elementos filhos acionando hover no mesmo elemento pai:
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
@Component({
|
|
135
|
+
selector: 'app-hover-advanced',
|
|
136
|
+
imports: [CommonModule, TCloudUiModule],
|
|
137
|
+
template: `
|
|
138
|
+
<div class="card" id="cardContainer">
|
|
139
|
+
<div class="card-header">
|
|
140
|
+
<h2>Título do Card</h2>
|
|
141
|
+
<button
|
|
142
|
+
[TCHoverParent]="'cardContainer'"
|
|
143
|
+
[TCHoverParentClass]="'card-hover'"
|
|
144
|
+
title="Fechar"
|
|
145
|
+
>
|
|
146
|
+
✕
|
|
147
|
+
</button>
|
|
148
|
+
</div>
|
|
149
|
+
|
|
150
|
+
<div class="card-content">
|
|
151
|
+
<p>Conteúdo do card</p>
|
|
152
|
+
|
|
153
|
+
<button
|
|
154
|
+
[TCHoverParent]="'cardContainer'"
|
|
155
|
+
[TCHoverParentClass]="'card-hover'"
|
|
156
|
+
class="tc-btn"
|
|
157
|
+
>
|
|
158
|
+
Ação Primária
|
|
159
|
+
</button>
|
|
160
|
+
|
|
161
|
+
<button
|
|
162
|
+
[TCHoverParent]="'cardContainer'"
|
|
163
|
+
[TCHoverParentClass]="'card-hover'"
|
|
164
|
+
class="tc-btn tc-btn-secondary"
|
|
165
|
+
>
|
|
166
|
+
Ação Secundária
|
|
167
|
+
</button>
|
|
168
|
+
</div>
|
|
169
|
+
</div>
|
|
170
|
+
`,
|
|
171
|
+
styles: [`
|
|
172
|
+
.card {
|
|
173
|
+
background: white;
|
|
174
|
+
border: 1px solid #e0e0e0;
|
|
175
|
+
border-radius: 8px;
|
|
176
|
+
padding: 16px;
|
|
177
|
+
transition: all 0.2s ease;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.card.card-hover {
|
|
181
|
+
background: #fafafa;
|
|
182
|
+
border-color: #1976d2;
|
|
183
|
+
box-shadow: 0 2px 12px rgba(25, 118, 210, 0.15);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.card-header {
|
|
187
|
+
display: flex;
|
|
188
|
+
justify-content: space-between;
|
|
189
|
+
align-items: center;
|
|
190
|
+
margin-bottom: 12px;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.card-content {
|
|
194
|
+
display: flex;
|
|
195
|
+
gap: 8px;
|
|
196
|
+
justify-content: flex-end;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.card-content button {
|
|
200
|
+
cursor: pointer;
|
|
201
|
+
}
|
|
202
|
+
`]
|
|
203
|
+
})
|
|
204
|
+
export class HoverAdvancedComponent {}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Uso com Estados Condicional de Hover
|
|
208
|
+
|
|
209
|
+
Aplicar diferentes classes baseado em contexto:
|
|
210
|
+
|
|
211
|
+
```typescript
|
|
212
|
+
@Component({
|
|
213
|
+
selector: 'app-hover-conditional',
|
|
214
|
+
imports: [CommonModule, TCloudUiModule],
|
|
215
|
+
template: `
|
|
216
|
+
<div class="list-container">
|
|
217
|
+
<div
|
|
218
|
+
*ngFor="let item of items"
|
|
219
|
+
class="list-item"
|
|
220
|
+
[id]="'item-' + item.id"
|
|
221
|
+
>
|
|
222
|
+
<span class="item-title">{{ item.title }}</span>
|
|
223
|
+
|
|
224
|
+
<div class="item-actions">
|
|
225
|
+
<button
|
|
226
|
+
*ngFor="let action of item.actions"
|
|
227
|
+
[TCHoverParent]="'item-' + item.id"
|
|
228
|
+
[TCHoverParentClass]="'item-' + item.status"
|
|
229
|
+
[class]="'action-btn action-' + action.type"
|
|
230
|
+
>
|
|
231
|
+
{{ action.label }}
|
|
232
|
+
</button>
|
|
233
|
+
</div>
|
|
234
|
+
</div>
|
|
235
|
+
</div>
|
|
236
|
+
`,
|
|
237
|
+
styles: [`
|
|
238
|
+
.list-container {
|
|
239
|
+
display: flex;
|
|
240
|
+
flex-direction: column;
|
|
241
|
+
gap: 8px;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.list-item {
|
|
245
|
+
display: flex;
|
|
246
|
+
justify-content: space-between;
|
|
247
|
+
align-items: center;
|
|
248
|
+
padding: 12px;
|
|
249
|
+
background: #f9f9f9;
|
|
250
|
+
border-left: 4px solid #ddd;
|
|
251
|
+
border-radius: 4px;
|
|
252
|
+
transition: all 0.2s ease;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.list-item.item-success {
|
|
256
|
+
background: #e8f5e9;
|
|
257
|
+
border-left-color: #4caf50;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.list-item.item-warning {
|
|
261
|
+
background: #fff3e0;
|
|
262
|
+
border-left-color: #ff9800;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.list-item.item-danger {
|
|
266
|
+
background: #ffebee;
|
|
267
|
+
border-left-color: #f44336;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.item-title {
|
|
271
|
+
font-weight: 500;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.item-actions {
|
|
275
|
+
display: flex;
|
|
276
|
+
gap: 4px;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.action-btn {
|
|
280
|
+
padding: 4px 8px;
|
|
281
|
+
cursor: pointer;
|
|
282
|
+
border: 1px solid #ddd;
|
|
283
|
+
background: white;
|
|
284
|
+
border-radius: 3px;
|
|
285
|
+
font-size: 12px;
|
|
286
|
+
}
|
|
287
|
+
`]
|
|
288
|
+
})
|
|
289
|
+
export class HoverConditionalComponent {
|
|
290
|
+
items = [
|
|
291
|
+
{
|
|
292
|
+
id: 1,
|
|
293
|
+
title: 'Exemplo Sucesso',
|
|
294
|
+
status: 'item-success',
|
|
295
|
+
actions: [
|
|
296
|
+
{ label: 'Editar', type: 'edit' },
|
|
297
|
+
{ label: 'Excluir', type: 'delete' }
|
|
298
|
+
]
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
id: 2,
|
|
302
|
+
title: 'Exemplo Aviso',
|
|
303
|
+
status: 'item-warning',
|
|
304
|
+
actions: [
|
|
305
|
+
{ label: 'Revisão', type: 'review' },
|
|
306
|
+
{ label: 'Descartar', type: 'dismiss' }
|
|
307
|
+
]
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
id: 3,
|
|
311
|
+
title: 'Exemplo Erro',
|
|
312
|
+
status: 'item-danger',
|
|
313
|
+
actions: [
|
|
314
|
+
{ label: 'Tentar Novamente', type: 'retry' }
|
|
315
|
+
]
|
|
316
|
+
}
|
|
317
|
+
];
|
|
318
|
+
}
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### Uso com Row Interativa de Tabela
|
|
322
|
+
|
|
323
|
+
Destaque de linha ao interagir com elementos dentro de uma tabela:
|
|
324
|
+
|
|
325
|
+
```typescript
|
|
326
|
+
@Component({
|
|
327
|
+
selector: 'app-hover-table-row',
|
|
328
|
+
imports: [CommonModule, TCloudUiModule],
|
|
329
|
+
template: `
|
|
330
|
+
<table class="data-table">
|
|
331
|
+
<thead>
|
|
332
|
+
<tr>
|
|
333
|
+
<th>ID</th>
|
|
334
|
+
<th>Nome</th>
|
|
335
|
+
<th>Status</th>
|
|
336
|
+
<th>Ações</th>
|
|
337
|
+
</tr>
|
|
338
|
+
</thead>
|
|
339
|
+
<tbody>
|
|
340
|
+
<tr *ngFor="let row of tableData" [id]="'row-' + row.id" class="table-row">
|
|
341
|
+
<td>{{ row.id }}</td>
|
|
342
|
+
<td>{{ row.name }}</td>
|
|
343
|
+
<td>
|
|
344
|
+
<span [class]="'badge badge-' + row.status">
|
|
345
|
+
{{ row.status }}
|
|
346
|
+
</span>
|
|
347
|
+
</td>
|
|
348
|
+
<td class="actions-cell">
|
|
349
|
+
<button
|
|
350
|
+
[TCHoverParent]="'row-' + row.id"
|
|
351
|
+
[TCHoverParentClass]="'row-hover'"
|
|
352
|
+
class="action-icon"
|
|
353
|
+
title="Visualizar"
|
|
354
|
+
>
|
|
355
|
+
👁️
|
|
356
|
+
</button>
|
|
357
|
+
<button
|
|
358
|
+
[TCHoverParent]="'row-' + row.id"
|
|
359
|
+
[TCHoverParentClass]="'row-hover'"
|
|
360
|
+
class="action-icon"
|
|
361
|
+
title="Editar"
|
|
362
|
+
>
|
|
363
|
+
✏️
|
|
364
|
+
</button>
|
|
365
|
+
<button
|
|
366
|
+
[TCHoverParent]="'row-' + row.id"
|
|
367
|
+
[TCHoverParentClass]="'row-hover'"
|
|
368
|
+
class="action-icon danger"
|
|
369
|
+
title="Excluir"
|
|
370
|
+
>
|
|
371
|
+
🗑️
|
|
372
|
+
</button>
|
|
373
|
+
</td>
|
|
374
|
+
</tr>
|
|
375
|
+
</tbody>
|
|
376
|
+
</table>
|
|
377
|
+
`,
|
|
378
|
+
styles: [`
|
|
379
|
+
.data-table {
|
|
380
|
+
width: 100%;
|
|
381
|
+
border-collapse: collapse;
|
|
382
|
+
background: white;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
.table-row {
|
|
386
|
+
border-bottom: 1px solid #eee;
|
|
387
|
+
transition: all 0.2s ease;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
.table-row.row-hover {
|
|
391
|
+
background: #e3f2fd;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
.table-row td {
|
|
395
|
+
padding: 12px;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
.actions-cell {
|
|
399
|
+
text-align: center;
|
|
400
|
+
display: flex;
|
|
401
|
+
gap: 8px;
|
|
402
|
+
justify-content: center;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
.action-icon {
|
|
406
|
+
background: none;
|
|
407
|
+
border: none;
|
|
408
|
+
cursor: pointer;
|
|
409
|
+
font-size: 16px;
|
|
410
|
+
opacity: 0.6;
|
|
411
|
+
transition: opacity 0.2s;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.action-icon:hover {
|
|
415
|
+
opacity: 1;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
.action-icon.danger:hover {
|
|
419
|
+
color: #f44336;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
.badge {
|
|
423
|
+
display: inline-block;
|
|
424
|
+
padding: 4px 8px;
|
|
425
|
+
border-radius: 3px;
|
|
426
|
+
font-size: 12px;
|
|
427
|
+
font-weight: 500;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
.badge-active {
|
|
431
|
+
background: #c8e6c9;
|
|
432
|
+
color: #2e7d32;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
.badge-inactive {
|
|
436
|
+
background: #ffccbc;
|
|
437
|
+
color: #d84315;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
.badge-pending {
|
|
441
|
+
background: #fff9c4;
|
|
442
|
+
color: #f57f17;
|
|
443
|
+
}
|
|
444
|
+
`]
|
|
445
|
+
})
|
|
446
|
+
export class HoverTableRowComponent {
|
|
447
|
+
tableData = [
|
|
448
|
+
{ id: 1, name: 'Usuário A', status: 'active' },
|
|
449
|
+
{ id: 2, name: 'Usuário B', status: 'inactive' },
|
|
450
|
+
{ id: 3, name: 'Usuário C', status: 'pending' },
|
|
451
|
+
{ id: 4, name: 'Usuário D', status: 'active' }
|
|
452
|
+
];
|
|
453
|
+
}
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
## Notas de Implementação
|
|
457
|
+
|
|
458
|
+
- A diretiva utiliza `Renderer2` do Angular para adicionar/remover classes de forma segura
|
|
459
|
+
- O elemento pai é localizado dinamicamente via `document.getElementById()`, permitindo qualquer elemento com ID como alvo
|
|
460
|
+
- Se o elemento pai não existir no DOM no momento do evento, a operação é silenciosamente ignorada
|
|
461
|
+
- A diretiva é **standalone** e pode ser usada em qualquer componente sem requerer um módulo
|
|
462
|
+
- Não há validação se a classe CSS existe - qualquer string é aceita como nome de classe
|
|
463
|
+
- Múltiplos elementos podem apontar para o mesmo elemento pai com a mesma ou diferentes classes
|
|
464
|
+
- As classes são adicionadas/removidas usando `Renderer2.addClass()` e `Renderer2.removeClass()`, respeitando a segurança do Angular
|
|
465
|
+
- Não há efeitos de transição ou animação na diretiva em si - use CSS `transition` no elemento pai para animar mudanças
|
|
466
|
+
- A diretiva não interfere com outras diretivas ou listeners de mouse no mesmo elemento
|
|
467
|
+
- O ID passado em `TCHoverParent` é sensível a maiúsculas/minúsculas
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Icon Button
|
|
2
|
+
|
|
3
|
+
## Características
|
|
4
|
+
|
|
5
|
+
A diretiva `tcloudUiIconButton` transforma um elemento `<button>` em um botão de ícone estilizado. Ela aplica automaticamente classes CSS para controlar a variante (filled, outline, link), a cor (primary, light, danger, dark) e o tamanho (sm, md, lg). A diretiva utiliza signals e `effect()` para reagir a mudanças nos inputs e atualizar as classes dinamicamente.
|
|
6
|
+
|
|
7
|
+
## Instalação
|
|
8
|
+
|
|
9
|
+
Importe o `TCloudUiModule` ou a diretiva standalone `TCloudUiIconButtonDirective`:
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import { TCloudUiModule } from 'tcloud-ui';
|
|
13
|
+
// ou
|
|
14
|
+
import { TCloudUiIconButtonDirective } from 'tcloud-ui';
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## API
|
|
18
|
+
|
|
19
|
+
### Inputs
|
|
20
|
+
|
|
21
|
+
| Nome | Tipo | Descrição | Valor Default |
|
|
22
|
+
| -------------------- | -------------------------------------------- | ---------------------------------------------- | ------------- |
|
|
23
|
+
| `color` | `'primary' \| 'light' \| 'danger' \| 'dark'` | Define a cor do botão. | `'primary'` |
|
|
24
|
+
| `size` | `'lg' \| 'md' \| 'sm'` | Define o tamanho do botão. | `'sm'` |
|
|
25
|
+
| `tcloudUiIconButton` | `'filled' \| 'outline' \| 'link'` | Define a variante visual do botão (selector). | `'filled'` |
|
|
26
|
+
|
|
27
|
+
## Exemplos de Uso
|
|
28
|
+
|
|
29
|
+
### Uso Básico
|
|
30
|
+
|
|
31
|
+
Botão de ícone com configuração padrão (filled, primary, sm):
|
|
32
|
+
|
|
33
|
+
```html
|
|
34
|
+
<button tcloudUiIconButton>
|
|
35
|
+
<i class="fa-solid fa-plus"></i>
|
|
36
|
+
</button>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Variantes
|
|
40
|
+
|
|
41
|
+
Botões com diferentes variantes visuais:
|
|
42
|
+
|
|
43
|
+
```html
|
|
44
|
+
<!-- Filled (padrão) -->
|
|
45
|
+
<button tcloudUiIconButton>
|
|
46
|
+
<i class="fa-solid fa-plus"></i>
|
|
47
|
+
</button>
|
|
48
|
+
|
|
49
|
+
<!-- Outline -->
|
|
50
|
+
<button tcloudUiIconButton="outline">
|
|
51
|
+
<i class="fa-solid fa-pencil"></i>
|
|
52
|
+
</button>
|
|
53
|
+
|
|
54
|
+
<!-- Link -->
|
|
55
|
+
<button tcloudUiIconButton="link">
|
|
56
|
+
<i class="fa-solid fa-trash"></i>
|
|
57
|
+
</button>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Cores
|
|
61
|
+
|
|
62
|
+
```html
|
|
63
|
+
<button tcloudUiIconButton color="primary">
|
|
64
|
+
<i class="fa-solid fa-plus"></i>
|
|
65
|
+
</button>
|
|
66
|
+
|
|
67
|
+
<button tcloudUiIconButton color="light">
|
|
68
|
+
<i class="fa-solid fa-pencil"></i>
|
|
69
|
+
</button>
|
|
70
|
+
|
|
71
|
+
<button tcloudUiIconButton color="danger">
|
|
72
|
+
<i class="fa-solid fa-trash"></i>
|
|
73
|
+
</button>
|
|
74
|
+
|
|
75
|
+
<button tcloudUiIconButton color="dark">
|
|
76
|
+
<i class="fa-solid fa-gear"></i>
|
|
77
|
+
</button>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Tamanhos
|
|
81
|
+
|
|
82
|
+
```html
|
|
83
|
+
<button tcloudUiIconButton size="sm">
|
|
84
|
+
<i class="fa-solid fa-plus"></i>
|
|
85
|
+
</button>
|
|
86
|
+
|
|
87
|
+
<button tcloudUiIconButton size="md">
|
|
88
|
+
<i class="fa-solid fa-plus"></i>
|
|
89
|
+
</button>
|
|
90
|
+
|
|
91
|
+
<button tcloudUiIconButton size="lg">
|
|
92
|
+
<i class="fa-solid fa-plus"></i>
|
|
93
|
+
</button>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Uso Avançado
|
|
97
|
+
|
|
98
|
+
Combinando cor, tamanho e variante:
|
|
99
|
+
|
|
100
|
+
```html
|
|
101
|
+
<button tcloudUiIconButton="outline" color="danger" size="lg">
|
|
102
|
+
<i class="fa-solid fa-trash"></i>
|
|
103
|
+
</button>
|
|
104
|
+
```
|