feat: add input component and integrate FontAwesome icons

This commit is contained in:
2026-06-24 09:57:24 -03:00
parent e608b31b93
commit 6b4fccbdbb
9 changed files with 550 additions and 7 deletions

View File

@@ -0,0 +1,56 @@
<label [for]="id" class="input-label">
<ng-content />
</label>
<div
class="input-control"
[ngClass]="{
'input-control-currency': type() === 'currency',
'input-control-percent': type() === 'percent',
'input-control-file': type() === 'file',
'input-control-editable': type() === 'editable',
'input-control-disabled': isInputDisabled(),
'input-control-editable-active': isEditableActive()
}"
>
@if (type() === 'currency') {
<span class="input-prefix">$</span>
}
<input
#inputElement
[id]="id"
[name]="id"
[type]="inputType()"
[ngClass]="inputClasses()"
[disabled]="isInputDisabled()"
[placeholder]="placeholder()"
[value]="type() !== 'file' ? value() : null"
(input)="type() !== 'file' ? onValueChange($event) : null"
(change)="type() === 'file' ? onFileChange($event) : null"
[attr.maxlength]="type() !== 'file' ? maxlength() : null"
[attr.accept]="type() === 'file' ? accept() : null"
/>
@if (type() === 'file') {
<span class="input-file-name" [class.input-file-name-empty]="!resolvedFileName()">
{{ resolvedFileName() || 'Sin archivo...' }}
</span>
}
@if (type() === 'percent') {
<span class="input-suffix">%</span>
}
@if (type() === 'editable') {
<button
type="button"
class="input-icon"
[class.input-icon-active]="isEditableActive()"
[attr.aria-label]="isEditableActive() ? 'Deshabilitar edición' : 'Habilitar edición'"
(click)="toggleEditableState()"
>
<i class="fa-solid fa-pen" aria-hidden="true"></i>
</button>
}
</div>