| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246 | 
							- /*!
 
-  * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
 
-  * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
 
-  * v1.0.0-beta.82
 
-  */
 
- import { Component, Element, h, Host, Method, Prop } from "@stencil/core";
 
- import { focusElement, getElementDir } from "../../utils/dom";
 
- import { CSS_UTILITY } from "../../utils/resources";
 
- import { updateHostInteraction } from "../../utils/interactive";
 
- /** Any attributes placed on <calcite-link> component will propagate to the rendered child */
 
- /** Passing a 'href' will render an anchor link, instead of a span. Role will be set to link, or link, depending on this. */
 
- /** It is the consumers responsibility to add aria information, rel, target, for links, and any link attributes for form submission */
 
- /** @slot - A slot for adding text. */
 
- export class Link {
 
-   constructor() {
 
-     //--------------------------------------------------------------------------
 
-     //
 
-     //  Properties
 
-     //
 
-     //--------------------------------------------------------------------------
 
-     /** is the link disabled  */
 
-     this.disabled = false;
 
-     /** Prompts the user to save the linked URL instead of navigating to it. Can be used with or without a value:
 
-      * Without a value, the browser will suggest a filename/extension
 
-      * See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-download
 
-      */
 
-     this.download = false;
 
-     //--------------------------------------------------------------------------
 
-     //
 
-     //  Private Methods
 
-     //
 
-     //--------------------------------------------------------------------------
 
-     this.storeTagRef = (el) => {
 
-       this.childEl = el;
 
-     };
 
-   }
 
-   //--------------------------------------------------------------------------
 
-   //
 
-   //  Lifecycle
 
-   //
 
-   //--------------------------------------------------------------------------
 
-   componentDidRender() {
 
-     updateHostInteraction(this);
 
-   }
 
-   render() {
 
-     const { download, el } = this;
 
-     const dir = getElementDir(el);
 
-     const childElType = this.href ? "a" : "span";
 
-     const iconStartEl = (h("calcite-icon", { class: "calcite-link--icon icon-start", flipRtl: this.iconFlipRtl === "start" || this.iconFlipRtl === "both", icon: this.iconStart, scale: "s" }));
 
-     const iconEndEl = (h("calcite-icon", { class: "calcite-link--icon icon-end", flipRtl: this.iconFlipRtl === "end" || this.iconFlipRtl === "both", icon: this.iconEnd, scale: "s" }));
 
-     const Tag = childElType;
 
-     const role = childElType === "span" ? "link" : null;
 
-     const tabIndex = childElType === "span" ? 0 : null;
 
-     return (h(Host, { role: "presentation" },
 
-       h(Tag, { class: { [CSS_UTILITY.rtl]: dir === "rtl" }, 
 
-         /*
 
-         When the 'download' property of type 'boolean | string' is set to true, the value is "".
 
-         This works around that issue for now.
 
-         */
 
-         download: Tag === "a" && (download === "" || download) ? download : null, href: Tag === "a" && this.href, ref: this.storeTagRef, rel: Tag === "a" && this.rel, role: role, tabIndex: tabIndex, target: Tag === "a" && this.target },
 
-         this.iconStart ? iconStartEl : null,
 
-         h("slot", null),
 
-         this.iconEnd ? iconEndEl : null)));
 
-   }
 
-   //--------------------------------------------------------------------------
 
-   //
 
-   //  Public Methods
 
-   //
 
-   //--------------------------------------------------------------------------
 
-   /** Sets focus on the component. */
 
-   async setFocus() {
 
-     focusElement(this.childEl);
 
-   }
 
-   static get is() { return "calcite-link"; }
 
-   static get encapsulation() { return "shadow"; }
 
-   static get originalStyleUrls() { return {
 
-     "$": ["link.scss"]
 
-   }; }
 
-   static get styleUrls() { return {
 
-     "$": ["link.css"]
 
-   }; }
 
-   static get properties() { return {
 
-     "disabled": {
 
-       "type": "boolean",
 
-       "mutable": false,
 
-       "complexType": {
 
-         "original": "boolean",
 
-         "resolved": "boolean",
 
-         "references": {}
 
-       },
 
-       "required": false,
 
-       "optional": false,
 
-       "docs": {
 
-         "tags": [],
 
-         "text": "is the link disabled"
 
-       },
 
-       "attribute": "disabled",
 
-       "reflect": true,
 
-       "defaultValue": "false"
 
-     },
 
-     "download": {
 
-       "type": "any",
 
-       "mutable": false,
 
-       "complexType": {
 
-         "original": "string | boolean",
 
-         "resolved": "boolean | string",
 
-         "references": {}
 
-       },
 
-       "required": false,
 
-       "optional": false,
 
-       "docs": {
 
-         "tags": [],
 
-         "text": "Prompts the user to save the linked URL instead of navigating to it. Can be used with or without a value:\nWithout a value, the browser will suggest a filename/extension\nSee: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-download"
 
-       },
 
-       "attribute": "download",
 
-       "reflect": true,
 
-       "defaultValue": "false"
 
-     },
 
-     "href": {
 
-       "type": "string",
 
-       "mutable": false,
 
-       "complexType": {
 
-         "original": "string",
 
-         "resolved": "string",
 
-         "references": {}
 
-       },
 
-       "required": false,
 
-       "optional": true,
 
-       "docs": {
 
-         "tags": [],
 
-         "text": "optionally pass a href - used to determine if the component should render as a link or an anchor"
 
-       },
 
-       "attribute": "href",
 
-       "reflect": true
 
-     },
 
-     "iconEnd": {
 
-       "type": "string",
 
-       "mutable": false,
 
-       "complexType": {
 
-         "original": "string",
 
-         "resolved": "string",
 
-         "references": {}
 
-       },
 
-       "required": false,
 
-       "optional": true,
 
-       "docs": {
 
-         "tags": [],
 
-         "text": "optionally pass an icon to display at the end of a button - accepts calcite ui icon names"
 
-       },
 
-       "attribute": "icon-end",
 
-       "reflect": true
 
-     },
 
-     "iconFlipRtl": {
 
-       "type": "string",
 
-       "mutable": false,
 
-       "complexType": {
 
-         "original": "FlipContext",
 
-         "resolved": "\"both\" | \"end\" | \"start\"",
 
-         "references": {
 
-           "FlipContext": {
 
-             "location": "import",
 
-             "path": "../interfaces"
 
-           }
 
-         }
 
-       },
 
-       "required": false,
 
-       "optional": true,
 
-       "docs": {
 
-         "tags": [],
 
-         "text": "flip the icon(s) in rtl"
 
-       },
 
-       "attribute": "icon-flip-rtl",
 
-       "reflect": true
 
-     },
 
-     "iconStart": {
 
-       "type": "string",
 
-       "mutable": false,
 
-       "complexType": {
 
-         "original": "string",
 
-         "resolved": "string",
 
-         "references": {}
 
-       },
 
-       "required": false,
 
-       "optional": true,
 
-       "docs": {
 
-         "tags": [],
 
-         "text": "optionally pass an icon to display at the start of a button - accepts calcite ui icon names"
 
-       },
 
-       "attribute": "icon-start",
 
-       "reflect": true
 
-     },
 
-     "rel": {
 
-       "type": "string",
 
-       "mutable": false,
 
-       "complexType": {
 
-         "original": "string",
 
-         "resolved": "string",
 
-         "references": {}
 
-       },
 
-       "required": false,
 
-       "optional": true,
 
-       "docs": {
 
-         "tags": [],
 
-         "text": "The rel attribute to apply to the hyperlink"
 
-       },
 
-       "attribute": "rel",
 
-       "reflect": false
 
-     },
 
-     "target": {
 
-       "type": "string",
 
-       "mutable": false,
 
-       "complexType": {
 
-         "original": "string",
 
-         "resolved": "string",
 
-         "references": {}
 
-       },
 
-       "required": false,
 
-       "optional": true,
 
-       "docs": {
 
-         "tags": [],
 
-         "text": "The target attribute to apply to the hyperlink"
 
-       },
 
-       "attribute": "target",
 
-       "reflect": false
 
-     }
 
-   }; }
 
-   static get methods() { return {
 
-     "setFocus": {
 
-       "complexType": {
 
-         "signature": "() => Promise<void>",
 
-         "parameters": [],
 
-         "references": {
 
-           "Promise": {
 
-             "location": "global"
 
-           }
 
-         },
 
-         "return": "Promise<void>"
 
-       },
 
-       "docs": {
 
-         "text": "Sets focus on the component.",
 
-         "tags": []
 
-       }
 
-     }
 
-   }; }
 
-   static get elementRef() { return "el"; }
 
- }
 
 
  |