diff --git a/src/lib/buttons/chevron-button/chevron-button.component.html b/src/lib/buttons/chevron-button/chevron-button.component.html index f70975c..212f433 100644 --- a/src/lib/buttons/chevron-button/chevron-button.component.html +++ b/src/lib/buttons/chevron-button/chevron-button.component.html @@ -1,4 +1,4 @@ - diff --git a/src/lib/buttons/chevron-button/chevron-button.component.ts b/src/lib/buttons/chevron-button/chevron-button.component.ts index c06e345..be2d549 100644 --- a/src/lib/buttons/chevron-button/chevron-button.component.ts +++ b/src/lib/buttons/chevron-button/chevron-button.component.ts @@ -1,14 +1,15 @@ -import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; +import { Component, Input } from '@angular/core'; +import { randomString } from '../../utils'; @Component({ selector: 'iqser-chevron-button [label]', templateUrl: './chevron-button.component.html', styleUrls: ['./chevron-button.component.scss'], - changeDetection: ChangeDetectionStrategy.OnPush, }) export class ChevronButtonComponent { @Input() label!: string; @Input() showDot = false; @Input() primary = false; @Input() disabled = false; + @Input() buttonId = `${randomString()}-chevron-button`; } diff --git a/src/lib/buttons/circle-button/circle-button.component.html b/src/lib/buttons/circle-button/circle-button.component.html index de0dc40..9bd6478 100644 --- a/src/lib/buttons/circle-button/circle-button.component.html +++ b/src/lib/buttons/circle-button/circle-button.component.html @@ -13,11 +13,12 @@ [class.primary]="type === circleButtonTypes.primary" [class.warn]="type === circleButtonTypes.warn" [disabled]="disabled" - [id]="id ? id : buttonId" + [id]="buttonId" [type]="isSubmit ? 'submit' : 'button'" mat-icon-button > +
diff --git a/src/lib/buttons/circle-button/circle-button.component.ts b/src/lib/buttons/circle-button/circle-button.component.ts index 1fdb07d..9ec9fb8 100644 --- a/src/lib/buttons/circle-button/circle-button.component.ts +++ b/src/lib/buttons/circle-button/circle-button.component.ts @@ -1,18 +1,17 @@ -import { ChangeDetectionStrategy, Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'; +import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'; import { MatLegacyTooltip as MatTooltip } from '@angular/material/legacy-tooltip'; import { CircleButtonType, CircleButtonTypes } from '../types/circle-button.type'; -import { IqserTooltipPosition, IqserTooltipPositions } from '../../utils'; +import { IqserTooltipPosition, IqserTooltipPositions, randomString } from '../../utils'; @Component({ selector: 'iqser-circle-button [icon]', templateUrl: './circle-button.component.html', styleUrls: ['./circle-button.component.scss'], - changeDetection: ChangeDetectionStrategy.OnPush, }) export class CircleButtonComponent implements OnInit { readonly circleButtonTypes = CircleButtonTypes; - @Input() id!: string; + @Input() buttonId = `${randomString()}-circle-button`; @Input() icon!: string; @Input() tooltip?: string; @Input() tooltipClass?: string; @@ -32,10 +31,6 @@ export class CircleButtonComponent implements OnInit { constructor(private readonly _elementRef: ElementRef) {} - get buttonId(): string { - return `${Math.random().toString(36).substring(2, 9)}-button`; - } - ngOnInit(): void { (this._elementRef.nativeElement as HTMLElement).style.setProperty('--size', `${this.size}px`); (this._elementRef.nativeElement as HTMLElement).style.setProperty('--iconSize', `${this.iconSize}px`); diff --git a/src/lib/buttons/icon-button/icon-button.component.html b/src/lib/buttons/icon-button/icon-button.component.html index 9510afe..1f79488 100644 --- a/src/lib/buttons/icon-button/icon-button.component.html +++ b/src/lib/buttons/icon-button/icon-button.component.html @@ -1,7 +1,7 @@