mirror of
https://github.com/bitwarden/browser
synced 2025-12-20 02:03:39 +00:00
* Add tooltip to icon button to display label * remove legacy cdr variable * create overlay on focus or hover * attach describdedby ids * fix type errors * remove aria-describedby when not necessary * fix failing tests * implement Claude feedback * fixing broken specs * remove host attr binding * Simplify directive aria logic * Move id to statis number * do not render empty tooltip * pass id to tooltip component * remove pointer-events none to allow tooltip on normal buttons * exclude some tooltip stories * change describedby input name * add story with tooltip on regular button * enhanced tooltip docs * set model directly * change model to input
40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
import { CommonModule } from "@angular/common";
|
|
import {
|
|
Component,
|
|
ElementRef,
|
|
inject,
|
|
InjectionToken,
|
|
Signal,
|
|
TemplateRef,
|
|
viewChild,
|
|
} from "@angular/core";
|
|
|
|
import { TooltipPosition } from "./tooltip-positions";
|
|
|
|
type TooltipData = {
|
|
content: Signal<string>;
|
|
isVisible: Signal<boolean>;
|
|
tooltipPosition: Signal<TooltipPosition>;
|
|
id: Signal<string>;
|
|
};
|
|
|
|
export const TOOLTIP_DATA = new InjectionToken<TooltipData>("TOOLTIP_DATA");
|
|
|
|
/**
|
|
* tooltip component used internally by the tooltip.directive. Not meant to be used explicitly
|
|
*/
|
|
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
|
|
// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection
|
|
@Component({
|
|
selector: "bit-tooltip",
|
|
templateUrl: "./tooltip.component.html",
|
|
imports: [CommonModule],
|
|
})
|
|
export class TooltipComponent {
|
|
readonly templateRef = viewChild.required(TemplateRef);
|
|
|
|
private elementRef = inject(ElementRef<HTMLDivElement>);
|
|
|
|
readonly tooltipData = inject<TooltipData>(TOOLTIP_DATA);
|
|
}
|