mirror of
https://github.com/bitwarden/browser
synced 2026-02-08 20:50:28 +00:00
* add spiner from previous branch * add loading spinner to button * Add spinner to dialog * Add spinner to icon button * add spinner to multi select component * fix spinner positioning * Add mock i18n in stories where needed * round stroke caps. Update classes * fix ts error * fix broken tests * add missing translation keys to stories * Add mising key for layout * Add mising key for nav group * Add mising key for spotlight * Add mising key for product switcher * Add mising key for dialog service * add translation to copy click story
52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
import { CommonModule } from "@angular/common";
|
|
import { Component, HostBinding, Input, booleanAttribute } from "@angular/core";
|
|
|
|
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
|
|
|
@Component({
|
|
selector: "bit-spinner",
|
|
templateUrl: "spinner.component.html",
|
|
standalone: true,
|
|
imports: [CommonModule],
|
|
})
|
|
export class SpinnerComponent {
|
|
/**
|
|
* The size of the spinner. Defaults to `large`.
|
|
*/
|
|
@Input() size: "fill" | "small" | "large" = "large";
|
|
|
|
/**
|
|
* Disable the default color of the spinner, inherits the text color.
|
|
*/
|
|
@Input({ transform: booleanAttribute }) noColor = false;
|
|
|
|
/**
|
|
* Accessibility title. Defaults to `Loading`.
|
|
*/
|
|
@Input() title = this.i18nService.t("loading");
|
|
|
|
/**
|
|
* Display text for screen readers.
|
|
*/
|
|
@Input({ transform: booleanAttribute }) sr = true;
|
|
|
|
@HostBinding("class") get classList() {
|
|
return ["tw-inline-block", "tw-overflow-hidden", "tw-flex", "tw-items-center"]
|
|
.concat(this.sizeClass)
|
|
.concat([this.noColor ? "" : "tw-text-primary-600"]);
|
|
}
|
|
|
|
constructor(private i18nService: I18nService) {}
|
|
|
|
get sizeClass() {
|
|
switch (this.size) {
|
|
case "small":
|
|
return ["tw-h-4"];
|
|
case "large":
|
|
return ["tw-h-16"];
|
|
default:
|
|
return ["tw-h-full", "tw-w-full"];
|
|
}
|
|
}
|
|
}
|