mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-22 02:21:34 +01:00
[PM-17346] Move A11yTitle and CopyClick to CL (#12936)
* Move A11yTitle and CopyClick to CL
This commit is contained in:
parent
43a6a93944
commit
d820bfb691
@ -25,15 +25,15 @@ import {
|
||||
TableModule,
|
||||
ToastModule,
|
||||
TypographyModule,
|
||||
CopyClickDirective,
|
||||
A11yTitleDirective,
|
||||
} from "@bitwarden/components";
|
||||
|
||||
import { TwoFactorIconComponent } from "./auth/components/two-factor-icon.component";
|
||||
import { DeprecatedCalloutComponent } from "./components/callout.component";
|
||||
import { A11yInvalidDirective } from "./directives/a11y-invalid.directive";
|
||||
import { A11yTitleDirective } from "./directives/a11y-title.directive";
|
||||
import { ApiActionDirective } from "./directives/api-action.directive";
|
||||
import { BoxRowDirective } from "./directives/box-row.directive";
|
||||
import { CopyClickDirective } from "./directives/copy-click.directive";
|
||||
import { CopyTextDirective } from "./directives/copy-text.directive";
|
||||
import { FallbackSrcDirective } from "./directives/fallback-src.directive";
|
||||
import { IfFeatureDirective } from "./directives/if-feature.directive";
|
||||
@ -83,10 +83,11 @@ import { IconComponent } from "./vault/components/icon.component";
|
||||
LinkModule,
|
||||
IconModule,
|
||||
TextDragDirective,
|
||||
CopyClickDirective,
|
||||
A11yTitleDirective,
|
||||
],
|
||||
declarations: [
|
||||
A11yInvalidDirective,
|
||||
A11yTitleDirective,
|
||||
ApiActionDirective,
|
||||
AutofocusDirective,
|
||||
BoxRowDirective,
|
||||
@ -105,7 +106,6 @@ import { IconComponent } from "./vault/components/icon.component";
|
||||
StopClickDirective,
|
||||
StopPropDirective,
|
||||
TrueFalseValueDirective,
|
||||
CopyClickDirective,
|
||||
LaunchClickDirective,
|
||||
UserNamePipe,
|
||||
PasswordStrengthComponent,
|
||||
|
@ -4,6 +4,7 @@ import { Directive, ElementRef, Input, OnInit, Renderer2 } from "@angular/core";
|
||||
|
||||
@Directive({
|
||||
selector: "[appA11yTitle]",
|
||||
standalone: true,
|
||||
})
|
||||
export class A11yTitleDirective implements OnInit {
|
||||
@Input() set appA11yTitle(title: string) {
|
1
libs/components/src/a11y/index.ts
Normal file
1
libs/components/src/a11y/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from "./a11y-title.directive";
|
@ -3,7 +3,8 @@ import { ComponentFixture, TestBed } from "@angular/core/testing";
|
||||
|
||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
import { ToastService } from "@bitwarden/components";
|
||||
|
||||
import { ToastService } from "../";
|
||||
|
||||
import { CopyClickDirective } from "./copy-click.directive";
|
||||
|
||||
@ -20,12 +21,14 @@ import { CopyClickDirective } from "./copy-click.directive";
|
||||
#toastWithLabel
|
||||
></button>
|
||||
`,
|
||||
standalone: true,
|
||||
imports: [CopyClickDirective],
|
||||
})
|
||||
class TestCopyClickComponent {
|
||||
@ViewChild("noToast") noToastButton: ElementRef<HTMLButtonElement>;
|
||||
@ViewChild("infoToast") infoToastButton: ElementRef<HTMLButtonElement>;
|
||||
@ViewChild("successToast") successToastButton: ElementRef<HTMLButtonElement>;
|
||||
@ViewChild("toastWithLabel") toastWithLabelButton: ElementRef<HTMLButtonElement>;
|
||||
@ViewChild("noToast") noToastButton!: ElementRef<HTMLButtonElement>;
|
||||
@ViewChild("infoToast") infoToastButton!: ElementRef<HTMLButtonElement>;
|
||||
@ViewChild("successToast") successToastButton!: ElementRef<HTMLButtonElement>;
|
||||
@ViewChild("toastWithLabel") toastWithLabelButton!: ElementRef<HTMLButtonElement>;
|
||||
}
|
||||
|
||||
describe("CopyClickDirective", () => {
|
||||
@ -38,7 +41,7 @@ describe("CopyClickDirective", () => {
|
||||
showToast.mockClear();
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [CopyClickDirective, TestCopyClickComponent],
|
||||
imports: [TestCopyClickComponent],
|
||||
providers: [
|
||||
{
|
||||
provide: I18nService,
|
@ -4,10 +4,12 @@ import { Directive, HostListener, Input } from "@angular/core";
|
||||
|
||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
import { ToastService, ToastVariant } from "@bitwarden/components";
|
||||
|
||||
import { ToastService, ToastVariant } from "../";
|
||||
|
||||
@Directive({
|
||||
selector: "[appCopyClick]",
|
||||
standalone: true,
|
||||
})
|
||||
export class CopyClickDirective {
|
||||
private _showToast = false;
|
1
libs/components/src/copy-click/index.ts
Normal file
1
libs/components/src/copy-click/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from "./copy-click.directive";
|
@ -1,3 +1,5 @@
|
||||
export { ButtonType } from "./shared/button-like.abstraction";
|
||||
export * from "./a11y";
|
||||
export * from "./async-actions";
|
||||
export * from "./avatar";
|
||||
export * from "./badge-list";
|
||||
@ -5,13 +7,13 @@ export * from "./badge";
|
||||
export * from "./banner";
|
||||
export * from "./breadcrumbs";
|
||||
export * from "./button";
|
||||
export { ButtonType } from "./shared/button-like.abstraction";
|
||||
export * from "./callout";
|
||||
export * from "./card";
|
||||
export * from "./checkbox";
|
||||
export * from "./chip-select";
|
||||
export * from "./color-password";
|
||||
export * from "./container";
|
||||
export * from "./copy-click";
|
||||
export * from "./dialog";
|
||||
export * from "./disclosure";
|
||||
export * from "./drawer";
|
||||
|
@ -4,7 +4,6 @@ import { By } from "@angular/platform-browser";
|
||||
import { mock } from "jest-mock-extended";
|
||||
import { BehaviorSubject } from "rxjs";
|
||||
|
||||
import { CopyClickDirective } from "@bitwarden/angular/directives/copy-click.directive";
|
||||
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
|
||||
import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions";
|
||||
@ -17,7 +16,7 @@ import { CipherType } from "@bitwarden/common/vault/enums";
|
||||
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
|
||||
import { Fido2CredentialView } from "@bitwarden/common/vault/models/view/fido2-credential.view";
|
||||
import { LoginView } from "@bitwarden/common/vault/models/view/login.view";
|
||||
import { BitFormFieldComponent, ToastService } from "@bitwarden/components";
|
||||
import { CopyClickDirective, BitFormFieldComponent, ToastService } from "@bitwarden/components";
|
||||
// FIXME: remove `src` and fix import
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import { ColorPasswordComponent } from "@bitwarden/components/src/color-password/color-password.component";
|
||||
|
Loading…
Reference in New Issue
Block a user