@loadsmart/miranda-wc
Version:
Miranda Web Components component library
142 lines (141 loc) • 9.06 kB
TypeScript
import type { PropertyValues } from 'lit';
import { Component } from '../component';
import type { LinkReferrerPolicy, LinkTarget } from '../link/link';
export interface SideNavigationItemProps {
href?: string;
target?: LinkTarget;
rel?: string;
download?: string;
ping?: string;
referrerpolicy?: LinkReferrerPolicy;
active?: boolean;
}
export declare class SideNavigationItem extends Component {
#private;
static shadowRootOptions: {
delegatesFocus: boolean;
mode: ShadowRootMode;
serializable?: boolean;
slotAssignment?: SlotAssignmentMode;
};
static styles: import("lit").CSSResult[];
static get properties(): {
href: {
type: StringConstructor;
reflect: boolean;
};
target: {
type: StringConstructor;
reflect: boolean;
};
rel: {
type: StringConstructor;
reflect: boolean;
};
download: {
type: StringConstructor;
reflect: boolean;
};
ping: {
type: StringConstructor;
reflect: boolean;
};
referrerpolicy: {
type: StringConstructor;
reflect: boolean;
};
active: {
type: BooleanConstructor;
reflect: boolean;
};
};
/**
* The URL that the hyperlink points to. Links are not restricted to
* HTTP-based URLs — they can use any URL scheme supported by browsers:
* - Sections of a page with document fragments
* - Specific text portions with [text fragments](https://developer.mozilla.org/en-US/docs/Web/Text_fragments)
* - Pieces of media files with media fragments
* - Telephone numbers with `tel:` URLs
* - Email addresses with `mailto:` URLs
* - While web browsers may not support other URL schemes, websites can with [`registerProtocolHandler()`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/registerProtocolHandler)
*
* If not provided or, for security reasons, the URL starts with the
* `javascript:` scheme, the link will be disabled.
*/
href?: SideNavigationItemProps['href'];
/**
* Where to display the linked URL, as the name for a browsing context (a
* tab, window, or [`<iframe>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe)).
* The following keywords have special meanings for where to load the URL:
* - `_self`: the current browsing context. (Default)
* - `_blank`: usually a new tab, but users can configure browsers to open a new window instead.
* - `_parent`: the parent browsing context of the current one. If no parent, behaves as `_self`.
* - `_top`: the topmost browsing context (the "highest" context that's an ancestor of the current one). If no ancestors, behaves as `_self`.
*/
target?: SideNavigationItemProps['target'];
/**
* The relationship of the linked URL as space-separated link types. You can
* check some possible values for [`rel` on MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel).
*
* Additionally, values may be added if the following criteria are met:
* - If `target` is set to `_blank` and `referrerpolicy` is not set, `noreferrer` will be added.
* - If `target` is set to `_blank` and `rel` do not contains `opener`, `noopener` will be added.
*/
rel?: SideNavigationItemProps['rel'];
/**
* Causes the browser to treat the linked URL as a download. Can be used
* with or without a `filename` value:
* - Without a value, the browser will suggest a filename/extension, generated from various sources:
* - The [Content-Disposition](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition) HTTP header
* - The final segment in the URL [path](https://developer.mozilla.org/en-US/docs/Web/API/URL/pathname)
* - The [media type](https://developer.mozilla.org/en-US/docs/Glossary/MIME_type) (from the [`Content-Type`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type) header, the start of a [`data:` URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs), or [`Blob.type`](https://developer.mozilla.org/en-US/docs/Web/API/Blob/type) for a [`blob:` URL](https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL_static))
* - `filename`: defining a value suggests it as the filename. `/` and `\` characters are converted to underscores (`_`). Filesystems may forbid other characters in filenames, so browsers will adjust the suggested name if necessary.
*
* > Note:
* > - `download` only works for [same-origin URLs](https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy), or the `blob:` and `data:` schemes.
* > - How browsers treat downloads varies by browser, user settings, and other factors. The user may be prompted before a download starts, or the file may be saved automatically, or it may open automatically, either in an external application or in the browser itself.
* > - If the `Content-Disposition` header has different information from the `download` attribute, resulting behavior may differ:
* > - If the header specifies a `filename`, it takes priority over a filename specified in the `download` attribute.
* > - If the header specifies a disposition of `inline`, Chrome and Firefox prioritize the attribute and treat it as a download. Old Firefox versions (before 82) prioritize the header and will display the content inline.
*/
download?: SideNavigationItemProps['download'];
/**
* A space-separated list of URLs. When the link is followed, the browser
* will send [`POST`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST)
* requests with the body `PING` to the URLs. Typically for tracking.
*/
ping?: SideNavigationItemProps['ping'];
/**
* How much of the [referrer](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer)
* to send when following the link.
* - `no-referrer`: The [Referer](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer) header will not be sent.
* - `no-referrer-when-downgrade`: The [Referer](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer) header will not be sent to [origin](https://developer.mozilla.org/en-US/docs/Glossary/Origin)s without [TLS](https://developer.mozilla.org/en-US/docs/Glossary/TLS) ([HTTPS](https://developer.mozilla.org/en-US/docs/Glossary/HTTPS)).
* - `origin`: The sent referrer will be limited to the origin of the referring page: its [scheme](https://developer.mozilla.org/en-US/docs/Learn/Common_questions/Web_mechanics/What_is_a_URL), [host](https://developer.mozilla.org/en-US/docs/Glossary/Host), and [port](https://developer.mozilla.org/en-US/docs/Glossary/Port).
* - `origin-when-cross-origin`: The referrer sent to other origins will be limited to the scheme, the host, and the port. Navigations on the same origin will still include the path.
* - `same-origin`: A referrer will be sent for [same origin](https://developer.mozilla.org/en-US/docs/Glossary/Same-origin_policy), but cross-origin requests will contain no referrer information.
* - `strict-origin`: Only send the origin of the document as the referrer when the protocol security level stays the same (HTTPS→HTTPS), but don't send it to a less secure destination (HTTPS→HTTP).
* - `strict-origin-when-cross-origin` (default): Send a full URL when performing a same-origin request, only send the origin when the protocol security level stays the same (HTTPS→HTTPS), and send no header to a less secure destination (HTTPS→HTTP).
* - `unsafe-url`: The referrer will include the origin and the path (but not the [fragment](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/hash), [password](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/password), or [username](https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/username)). This value is unsafe, because it leaks origins and paths from TLS-protected resources to insecure origins.
*/
referrerpolicy?: SideNavigationItemProps['referrerpolicy'];
/**
* Controlled value of the selected step.
*/
active: SideNavigationItemProps['active'];
static define(): void;
constructor();
connectedCallback(): Promise<void>;
disconnectedCallback(): void;
protected update(changedProperties: PropertyValues): void;
get link(): HTMLInputElement | null;
get href_attribute(): string | undefined;
get rel_attribute(): string | undefined;
renderAsButton(): import("lit-html").TemplateResult<1>;
renderAsLink(): import("lit-html").TemplateResult<1>;
render(): import("lit-html").TemplateResult<1>;
}
declare global {
interface HTMLElementTagNameMap {
'm-side-navigation-item': SideNavigationItem;
}
}