feat(icon-button): add bordered variant style and update product ticket selector to use it

This commit is contained in:
2026-08-18 11:43:49 -03:00
parent 6b2f8de210
commit 92ad7340fe
4 changed files with 30 additions and 1 deletions

View File

@@ -48,6 +48,17 @@
}
}
.icon-btn--bordered {
width: 38px;
height: 38px;
border: 1px solid var(--border-color);
&:hover:not(:disabled),
&:focus-visible:not(:disabled) {
border-color: currentcolor;
}
}
// Hover/Active/Focus colors (non-disabled)
.icon-btn:hover:not(:disabled),
.icon-btn:focus-visible:not(:disabled),

View File

@@ -22,6 +22,7 @@ export type IconButtonVariant =
})
export class IconButtonComponent {
readonly variant = input.required<IconButtonVariant>();
readonly bordered = input(false);
readonly disabled = input(false);
readonly ariaLabel = input<string>('');
readonly ariaExpanded = input<boolean | null>(null);
@@ -45,6 +46,10 @@ export class IconButtonComponent {
});
protected readonly buttonClasses = computed(() => {
return ['icon-btn', `icon-btn--${this.variant()}`];
return {
'icon-btn': true,
[`icon-btn--${this.variant()}`]: true,
'icon-btn--bordered': this.bordered(),
};
});
}

View File

@@ -58,6 +58,7 @@
</div>
<app-icon-button
variant="trash"
[bordered]="true"
ariaLabel="Eliminar entrada"
[disabled]="rowDisabled(row)"
(clicked)="removeRow(row.id)"

View File

@@ -197,6 +197,18 @@ describe('ProductTicketSelectorComponent', () => {
expect(fixture.nativeElement.querySelector('.ticket-selector__row-status')).toBeNull();
});
it('shows the remove action as a bordered icon button', async () => {
const { fixture } = await createComponent({
maps: [mapResponse([variant(401, 'general', 'A', '1', '1')])],
});
const removeButton = fixture.nativeElement.querySelector(
'app-icon-button[ariaLabel="Eliminar entrada"] button',
) as HTMLButtonElement | null;
expect(removeButton?.classList.contains('icon-btn--bordered')).toBe(true);
});
it('clears only the seat after a stock conflict when the row still has alternatives', async () => {
const failed = variant(401, 'general', 'A', '1', '1');
const alternative = variant(402, 'general', 'A', '1', '2');