@telekom/scale-components
Version:
Scale is the digital design system for Telekom products and experiences.
178 lines (177 loc) • 6.24 kB
JavaScript
/**
* @license
* Scale https://github.com/telekom/scale
*
* Copyright (c) 2021 Egor Kirpichev and contributors, Deutsche Telekom AG
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { Component, Prop, Host, Element, h } from '@stencil/core';
export class NavigationMap {
constructor() {
/** (optional) The width and height in pixels */
this.size = 24;
/** (optional) Sets the icon color via the `fill` attribute */
this.fill = 'currentColor';
/** (optional) Alias for `fill` */
this.color = 'currentColor';
/** (optional) If `true`, the icon changes visually */
this.selected = false;
/** (optional) If `true` the SVG element will get `aria-hidden="true"` */
this.decorative = false;
/** (optional) If `true` the icon can receive focus */
this.focusable = false;
}
connectedCallback() {
if (!this.hostElement.hasAttribute('styles')) {
this.hostElement.style.display = 'inline-flex';
}
}
render() {
const ariaHidden = this.decorative ? { 'aria-hidden': 'true' } : {};
const focusable = this.focusable ? { tabindex: 0 } : {};
return (h(Host, null,
h("svg", Object.assign({ class: "scale-icon", xmlns: "http://www.w3.org/2000/svg", width: this.size, height: this.size, viewBox: "0 0 24 24" }, ariaHidden, focusable),
this.accessibilityTitle && h("title", null, this.accessibilityTitle),
h("g", { fill: ((this.fill === 'currentColor') ? this.color : this.fill) }, this.selected ? (h("g", null,
h("path", { d: "M6.345 12L9.6 17.615a2.77 2.77 0 004.696.167l.104-.167L17.66 12H21l1.84 6.14a3 3 0 01-2.668 3.853L19.97 22H4.03a3 3 0 01-2.921-3.665l.051-.195L3 12h3.345zM12 1c1.481 0 2.906.554 3.995 1.548l.2.192.18.187a5.925 5.925 0 01.885 6.756l-.125.227-4.03 6.955c-.287.496-.87.74-1.425.595l-.138-.045-.132-.06-.075-.045-.09-.064-.155-.131a1.395 1.395 0 01-.136-.162l-.059-.088-4.03-6.955a5.925 5.925 0 01.76-6.983l.18-.187.2-.192A5.925 5.925 0 0112 1zm0 3.6a2.185 2.185 0 100 4.37 2.185 2.185 0 000-4.37z", "fill-rule": "evenodd" }))) : (h("g", null,
h("path", { d: "M6.342 12l.87 1.5H4.116l-1.521 5.069c-.138.459-.053.943.233 1.326.255.342.63.554 1.046.597l.158.008h15.936c.479 0 .918-.22 1.203-.605.254-.341.35-.761.27-1.172l-.037-.154-1.52-5.069h-3.096l.87-1.5H21l1.841 6.138a3 3 0 01-2.697 3.857l-.176.005H4.032a3 3 0 01-2.92-3.692l.046-.17L3 12h3.342zm1.647-9.44a5.936 5.936 0 018.022 0l.186.178.179.187a5.936 5.936 0 01.883 6.76l-.125.227-4.031 6.952c-.468.808-1.6.846-2.131.116l-.075-.116-4.032-6.952a5.935 5.935 0 01.759-6.987l.179-.187.186-.178zM12 4.6a2.186 2.186 0 10.001 4.373A2.186 2.186 0 0012 4.6z", "fill-rule": "evenodd" })))))));
}
static get is() { return "scale-icon-navigation-map"; }
static get originalStyleUrls() { return {
"$": ["../../icon/icon.css"]
}; }
static get styleUrls() { return {
"$": ["../../icon/icon.css"]
}; }
static get properties() { return {
"size": {
"type": "number",
"mutable": false,
"complexType": {
"original": "number",
"resolved": "number",
"references": {}
},
"required": false,
"optional": true,
"docs": {
"tags": [],
"text": "(optional) The width and height in pixels"
},
"attribute": "size",
"reflect": true,
"defaultValue": "24"
},
"fill": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": true,
"docs": {
"tags": [],
"text": "(optional) Sets the icon color via the `fill` attribute"
},
"attribute": "fill",
"reflect": false,
"defaultValue": "'currentColor'"
},
"color": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": true,
"docs": {
"tags": [],
"text": "(optional) Alias for `fill`"
},
"attribute": "color",
"reflect": false,
"defaultValue": "'currentColor'"
},
"selected": {
"type": "boolean",
"mutable": false,
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
},
"required": false,
"optional": true,
"docs": {
"tags": [],
"text": "(optional) If `true`, the icon changes visually"
},
"attribute": "selected",
"reflect": true,
"defaultValue": "false"
},
"decorative": {
"type": "boolean",
"mutable": false,
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
},
"required": false,
"optional": true,
"docs": {
"tags": [],
"text": "(optional) If `true` the SVG element will get `aria-hidden=\"true\"`"
},
"attribute": "decorative",
"reflect": false,
"defaultValue": "false"
},
"accessibilityTitle": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": true,
"docs": {
"tags": [],
"text": "(optional) When using the icon standalone, make it meaningful for accessibility"
},
"attribute": "accessibility-title",
"reflect": false
},
"focusable": {
"type": "boolean",
"mutable": false,
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
},
"required": false,
"optional": true,
"docs": {
"tags": [],
"text": "(optional) If `true` the icon can receive focus"
},
"attribute": "focusable",
"reflect": false,
"defaultValue": "false"
}
}; }
static get elementRef() { return "hostElement"; }
}