UNPKG

@telekom/scale-components

Version:

Scale is the digital design system for Telekom products and experiences.

178 lines (177 loc) 6.11 kB
/** * @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 ActionLoop { 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: "M8.265 6.612h5.211v2.302l5.388-3.526-5.388-3.527v2.302H8.285A7.998 7.998 0 00.28 11.29a7.807 7.807 0 001.582 5.451 1.22 1.22 0 001.66.28c.269-.188.446-.48.49-.804a1.234 1.234 0 00-.24-.98A5.358 5.358 0 012.702 12a5.554 5.554 0 015.564-5.388zm13.886.647a1.224 1.224 0 00-1.656-.27 1.176 1.176 0 00-.49.804 1.24 1.24 0 00.24.98A5.358 5.358 0 0121.313 12a5.554 5.554 0 01-5.564 5.388h-5.211v-2.302L5.15 18.612l5.388 3.527v-2.302h5.191a7.998 7.998 0 008.004-7.127 7.807 7.807 0 00-1.583-5.45z", "fill-rule": "evenodd" }))) : (h("g", null, h("path", { d: "M20.945 7.3a.747.747 0 011.015.165 7.442 7.442 0 011.51 5.215c-.343 3.817-3.611 6.695-7.42 6.816l-.25.004h-5.3v2.85L5 18.75l5.5-3.6V18h5.32c3.295 0 6.175-2.695 6.18-5.99 0-1.36-.45-2.62-1.215-3.625-.265-.35-.2-.84.16-1.085zM13.5 1.65l5.5 3.6-5.5 3.6V6H8.18C4.885 6 2.005 8.695 2 11.99c0 1.36.45 2.62 1.215 3.625.265.35.2.84-.16 1.085a.747.747 0 01-1.015-.165A7.45 7.45 0 01.53 11.32c.343-3.817 3.611-6.695 7.42-6.816L8.2 4.5h5.3V1.65z", "fill-rule": "evenodd" }))))))); } static get is() { return "scale-icon-action-loop"; } 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"; } }