@funidata/ngx-fudis
Version:
Funidata Design System.
76 lines (75 loc) • 2.92 kB
TypeScript
import { OnInit, AfterViewInit, ElementRef, OnChanges } from '@angular/core';
import { FudisComponentChanges } from '../../types/miscellaneous';
import { FudisFocusService } from '../../services/focus/focus.service';
import { FudisIdService } from '../../services/id/id.service';
import { FudisTranslationService } from '../../services/translation/translation.service';
import * as i0 from "@angular/core";
export declare class LinkDirective implements OnInit, OnChanges, AfterViewInit {
private _document;
private _bindedElement;
private _focusService;
private _idService;
private _translationService;
constructor(_document: Document, _bindedElement: ElementRef<HTMLAnchorElement>, _focusService: FudisFocusService, _idService: FudisIdService, _translationService: FudisTranslationService);
/**
* Link default size is 'md' (14px) which is the default size of <fudis-body-text> component. If
* link is used inside of Body Text it will always inherit its parent's font-size.
*/
size: 'inherit' | 'md' | 'lg';
/**
* Set browser focus to link on the first load.
*/
initialFocus: boolean;
/**
* Id for the anchor element. By default generated with FudisIdService
*/
id: string;
/**
* If link opens in a new tab
*/
external: boolean;
/**
* Title for the link
*/
title: string;
/**
* Helper class for link size
*/
private _sizeCssClass;
/**
* Container ref to attach Icon Component
*/
private _viewContainerRef;
/**
* Icon Component reference which will be attached to the View Container
*/
private _iconComponentRef;
/**
* Helper array for parsing long link texts with new-tab icon
*/
private _parsedTitle;
/**
* Aria-label for the external link
*/
private _externalLinkAriaLabel;
ngAfterViewInit(): void;
ngOnInit(): void;
ngOnChanges(changes: FudisComponentChanges<LinkDirective>): void;
private _updateTitleHtml;
/**
* Set size CSS class
*/
private _setSizeClass;
/**
* Add to remove relevant HTML attributes from binded element.
*/
private _setHtmlAttributes;
private _setExternalHtml;
/**
* Used with external links to split the last word of the title to be paired with the Icon, so
* that on line break, the icon sticks with the last word of the title.
*/
private _parseTitle;
static ɵfac: i0.ɵɵFactoryDeclaration<LinkDirective, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<LinkDirective, "[fudisLink]", never, { "size": { "alias": "size"; "required": false; }; "initialFocus": { "alias": "initialFocus"; "required": false; }; "id": { "alias": "id"; "required": false; }; "external": { "alias": "external"; "required": false; }; "title": { "alias": "title"; "required": true; }; }, {}, never, never, false, never>;
}