@telekom/scale-components
Version:
Scale is the digital design system for Telekom products and experiences.
178 lines (177 loc) • 6.46 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 ContentLanguage {
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: "M1.5 1.5v15a3 3 0 003 3H6v2.275A1.755 1.755 0 009 23l3.5-3.5h7a3 3 0 003-3v-15h-21zM12 5c.795 0 2 2 2.095 5h-4.19c.12-3 1.3-5 2.095-5zm-1.89.34A9.81 9.81 0 008.905 10h-2.38a5.5 5.5 0 013.585-4.66zM6.525 11h2.38a9.81 9.81 0 001.205 4.66A5.5 5.5 0 016.525 11zM12 16c-.795 0-1.975-1.975-2.095-5h4.19c-.095 3.025-1.3 5-2.095 5zm1.89-.34A9.81 9.81 0 0015.095 11H17.5a5.5 5.5 0 01-3.61 4.66zM15.095 10a9.81 9.81 0 00-1.205-4.66A5.5 5.5 0 0117.5 10h-2.405z", "fill-rule": "evenodd" }))) : (h("g", null,
h("path", { d: "M22.5 1.5v15a3 3 0 01-2.824 2.995l-.176.005h-7l-3.513 3.512a1.715 1.715 0 01-1.225.517c-.854 0-1.676-.63-1.756-1.598L6 21.775V19.5H4.5a3 3 0 01-2.995-2.824L1.5 16.5v-15h21zM21 3H3v13.5c0 .778.596 1.42 1.356 1.493L4.5 18h3v3.775c0 .184.205.32.373.22l.053-.043L11.88 18h7.62c.778 0 1.42-.596 1.493-1.356L21 16.5V3zm-6.903 8c-.12 3.024-1.3 5-2.097 5-.77 0-1.901-1.85-2.082-4.71L9.903 11h4.194zm3.378 0a5.497 5.497 0 01-3.587 4.66c.638-1.025 1.081-2.556 1.191-4.307l.018-.353h2.378zm-8.572 0c.07 1.898.528 3.568 1.209 4.66a5.501 5.501 0 01-3.56-4.422L6.525 11h2.378zM12 5c.77 0 1.901 1.85 2.082 4.71l.015.29H9.903c.12-3.025 1.3-5 2.097-5zm1.888.34a5.5 5.5 0 013.56 4.422l.027.238h-2.379c-.069-1.898-.527-3.568-1.208-4.66zm-3.776 0c-.638 1.025-1.081 2.556-1.191 4.307L8.903 10H6.525a5.497 5.497 0 013.587-4.66z", "fill-rule": "evenodd" })))))));
}
static get is() { return "scale-icon-content-language"; }
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"; }
}