chore: copia de libs/shared con prefijo Pi y APIs de terceros actualizadas
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
import { ChangeDetectionStrategy, Component, HostBinding, Input } from '@angular/core';
|
||||
import { buttonSize, mode } from '../../../styles';
|
||||
import { PiBaseButtonComponent } from '../base-button.component';
|
||||
|
||||
@Component({
|
||||
standalone: false,
|
||||
selector: 'pi-action-button',
|
||||
templateUrl: './action-button.component.html',
|
||||
styleUrls: ['./action-button.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class PiActionButtonComponent extends PiBaseButtonComponent {
|
||||
@HostBinding('class') get classes(): string {
|
||||
return ['pi-action-button', this.sizeClass, this.directionClass, this.fontWeightClass].join(
|
||||
' '
|
||||
);
|
||||
}
|
||||
|
||||
@Input() previous = false;
|
||||
@Input() override size: buttonSize = 'medium';
|
||||
@Input() text: string | undefined;
|
||||
@Input() hasPadding = true;
|
||||
@Input() hasIcon = true;
|
||||
@Input() label: string | undefined;
|
||||
@Input() buttonType: 'default' | 'menu-item' = 'default';
|
||||
@Input() mode: mode = 'dark';
|
||||
@Input() direction: 'back' | 'forward' = 'forward';
|
||||
@Input() fontWeight: '300' | '400' | '600' = '600';
|
||||
|
||||
get buttonColorClass(): string | null {
|
||||
return this.color ? `pi-color__${this.color}` : null;
|
||||
}
|
||||
|
||||
get directionClass(): string | null {
|
||||
return this.direction ? `pi-action-button__direction--${this.direction}` : null;
|
||||
}
|
||||
|
||||
override get sizeClass(): string | null {
|
||||
return this.size ? `pi-button__${this.size}` : null;
|
||||
}
|
||||
|
||||
get textClass(): string | null {
|
||||
return this.text ? 'has-text' : null;
|
||||
}
|
||||
|
||||
get fontWeightClass(): string | null {
|
||||
return this.fontWeight ? `pi-action-button__font-weight--${this.fontWeight}` : '';
|
||||
}
|
||||
|
||||
get hasPaddingClass(): string | null {
|
||||
return this.hasPadding ? null : 'pi-button__trimmed';
|
||||
}
|
||||
|
||||
get hasIconClass(): string | null {
|
||||
return this.hasIcon ? null : 'has-icon';
|
||||
}
|
||||
|
||||
override get appearanceClass(): string | null {
|
||||
return this.appearance !== 'fill' ? `pi-button__appearance--${this.appearance}` : null;
|
||||
}
|
||||
|
||||
get buttonTypeClass(): string | null {
|
||||
return this.buttonType !== 'default' ? `pi-button__type--${this.buttonType}` : null;
|
||||
}
|
||||
|
||||
get modeClass(): string | null {
|
||||
return this.mode && `pi-color__mode--${this.mode}`;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user