@carbon/icons-angular
Version:
Angular components for icons in digital and software products using the Carbon Design System
174 lines (171 loc) • 12.6 kB
JavaScript
import { __decorate, __metadata } from 'tslib';
import { Input, Component, ElementRef, Directive, NgModule } from '@angular/core';
import { getAttributes } from '@carbon/icon-helpers';
var DirectionRotaryStraightFilledDirective_1;
let DirectionRotaryStraightFilledComponent = class DirectionRotaryStraightFilledComponent {
constructor() {
this.focusable = false;
}
};
__decorate([
Input(),
__metadata("design:type", String)
], DirectionRotaryStraightFilledComponent.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], DirectionRotaryStraightFilledComponent.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], DirectionRotaryStraightFilledComponent.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], DirectionRotaryStraightFilledComponent.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], DirectionRotaryStraightFilledComponent.prototype, "focusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], DirectionRotaryStraightFilledComponent.prototype, "innerClass", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], DirectionRotaryStraightFilledComponent.prototype, "size", void 0);
DirectionRotaryStraightFilledComponent = __decorate([
Component({
selector: "ibm-icon-direction-rotary-straight-filled",
template: `
<svg
ibmIconDirectionRotaryStraightFilled
[size]="size"
[ariaLabel]="ariaLabel"
[ariaLabelledby]="ariaLabelledby"
[ariaHidden]="ariaHidden"
[title]="title"
[isFocusable]="focusable"
[attr.class]="innerClass">
</svg>
`
})
], DirectionRotaryStraightFilledComponent);
let DirectionRotaryStraightFilledDirective = DirectionRotaryStraightFilledDirective_1 = class DirectionRotaryStraightFilledDirective {
constructor(elementRef) {
this.elementRef = elementRef;
this.isFocusable = false;
this.icons = {
"32": {
metadata: { "moduleName": "DirectionRotaryStraightFilled32", "filepath": "direction--rotary--straight--filled/32.js", "descriptor": { "elem": "svg", "attrs": { "xmlns": "http://www.w3.org/2000/svg", "viewBox": "0 0 32 32", "fill": "currentColor", "width": 32, "height": 32 }, "content": [{ "elem": "circle", "attrs": { "cx": "16", "cy": "19", "r": "3" } }, { "elem": "path", "attrs": { "d": "M28,2H4A2,2,0,0,0,2,4V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V4A2,2,0,0,0,28,2ZM21.5859,12.4141,17,7.8281v6.273a5,5,0,0,1,0,9.7978V28H15V23.8989a5,5,0,0,1,0-9.7978V7.8281l-4.5859,4.586L9,11l7-7,7,7Z" } }, { "elem": "path", "attrs": { "fill": "none", "d": "M21.5859,12.4141,23,11,16,4,9,11l1.4141,1.4141L15,7.8281v6.273a5,5,0,0,0,0,9.7978V28h2V23.8989a5,5,0,0,0,0-9.7978V7.8281ZM19,19a3,3,0,1,1-3-3A3.0033,3.0033,0,0,1,19,19Z", "data-icon-path": "inner-path" } }], "name": "direction--rotary--straight--filled", "size": 32 }, "size": 32 },
svg: `<svg focusable="false" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" fill="currentColor" width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><circle cx="16" cy="19" r="3"></circle><path d="M28,2H4A2,2,0,0,0,2,4V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V4A2,2,0,0,0,28,2ZM21.5859,12.4141,17,7.8281v6.273a5,5,0,0,1,0,9.7978V28H15V23.8989a5,5,0,0,1,0-9.7978V7.8281l-4.5859,4.586L9,11l7-7,7,7Z"></path><path fill="none" d="M21.5859,12.4141,23,11,16,4,9,11l1.4141,1.4141L15,7.8281v6.273a5,5,0,0,0,0,9.7978V28h2V23.8989a5,5,0,0,0,0-9.7978V7.8281ZM19,19a3,3,0,1,1-3-3A3.0033,3.0033,0,0,1,19,19Z" data-icon-path="inner-path"></path></svg>`
},
"24": {
metadata: { "moduleName": "DirectionRotaryStraightFilled24", "filepath": "direction--rotary--straight--filled/24.js", "descriptor": { "elem": "svg", "attrs": { "xmlns": "http://www.w3.org/2000/svg", "viewBox": "0 0 32 32", "fill": "currentColor", "width": 24, "height": 24 }, "content": [{ "elem": "circle", "attrs": { "cx": "16", "cy": "19", "r": "3" } }, { "elem": "path", "attrs": { "d": "M28,2H4A2,2,0,0,0,2,4V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V4A2,2,0,0,0,28,2ZM21.5859,12.4141,17,7.8281v6.273a5,5,0,0,1,0,9.7978V28H15V23.8989a5,5,0,0,1,0-9.7978V7.8281l-4.5859,4.586L9,11l7-7,7,7Z" } }, { "elem": "path", "attrs": { "fill": "none", "d": "M21.5859,12.4141,23,11,16,4,9,11l1.4141,1.4141L15,7.8281v6.273a5,5,0,0,0,0,9.7978V28h2V23.8989a5,5,0,0,0,0-9.7978V7.8281ZM19,19a3,3,0,1,1-3-3A3.0033,3.0033,0,0,1,19,19Z", "data-icon-path": "inner-path" } }], "name": "direction--rotary--straight--filled", "size": 24 }, "size": 24 },
svg: `<svg focusable="false" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" fill="currentColor" width="24" height="24" viewBox="0 0 32 32" aria-hidden="true"><circle cx="16" cy="19" r="3"></circle><path d="M28,2H4A2,2,0,0,0,2,4V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V4A2,2,0,0,0,28,2ZM21.5859,12.4141,17,7.8281v6.273a5,5,0,0,1,0,9.7978V28H15V23.8989a5,5,0,0,1,0-9.7978V7.8281l-4.5859,4.586L9,11l7-7,7,7Z"></path><path fill="none" d="M21.5859,12.4141,23,11,16,4,9,11l1.4141,1.4141L15,7.8281v6.273a5,5,0,0,0,0,9.7978V28h2V23.8989a5,5,0,0,0,0-9.7978V7.8281ZM19,19a3,3,0,1,1-3-3A3.0033,3.0033,0,0,1,19,19Z" data-icon-path="inner-path"></path></svg>`
},
"20": {
metadata: { "moduleName": "DirectionRotaryStraightFilled20", "filepath": "direction--rotary--straight--filled/20.js", "descriptor": { "elem": "svg", "attrs": { "xmlns": "http://www.w3.org/2000/svg", "viewBox": "0 0 32 32", "fill": "currentColor", "width": 20, "height": 20 }, "content": [{ "elem": "circle", "attrs": { "cx": "16", "cy": "19", "r": "3" } }, { "elem": "path", "attrs": { "d": "M28,2H4A2,2,0,0,0,2,4V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V4A2,2,0,0,0,28,2ZM21.5859,12.4141,17,7.8281v6.273a5,5,0,0,1,0,9.7978V28H15V23.8989a5,5,0,0,1,0-9.7978V7.8281l-4.5859,4.586L9,11l7-7,7,7Z" } }, { "elem": "path", "attrs": { "fill": "none", "d": "M21.5859,12.4141,23,11,16,4,9,11l1.4141,1.4141L15,7.8281v6.273a5,5,0,0,0,0,9.7978V28h2V23.8989a5,5,0,0,0,0-9.7978V7.8281ZM19,19a3,3,0,1,1-3-3A3.0033,3.0033,0,0,1,19,19Z", "data-icon-path": "inner-path" } }], "name": "direction--rotary--straight--filled", "size": 20 }, "size": 20 },
svg: `<svg focusable="false" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" fill="currentColor" width="20" height="20" viewBox="0 0 32 32" aria-hidden="true"><circle cx="16" cy="19" r="3"></circle><path d="M28,2H4A2,2,0,0,0,2,4V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V4A2,2,0,0,0,28,2ZM21.5859,12.4141,17,7.8281v6.273a5,5,0,0,1,0,9.7978V28H15V23.8989a5,5,0,0,1,0-9.7978V7.8281l-4.5859,4.586L9,11l7-7,7,7Z"></path><path fill="none" d="M21.5859,12.4141,23,11,16,4,9,11l1.4141,1.4141L15,7.8281v6.273a5,5,0,0,0,0,9.7978V28h2V23.8989a5,5,0,0,0,0-9.7978V7.8281ZM19,19a3,3,0,1,1-3-3A3.0033,3.0033,0,0,1,19,19Z" data-icon-path="inner-path"></path></svg>`
},
"16": {
metadata: { "moduleName": "DirectionRotaryStraightFilled16", "filepath": "direction--rotary--straight--filled/16.js", "descriptor": { "elem": "svg", "attrs": { "xmlns": "http://www.w3.org/2000/svg", "viewBox": "0 0 32 32", "fill": "currentColor", "width": 16, "height": 16 }, "content": [{ "elem": "circle", "attrs": { "cx": "16", "cy": "19", "r": "3" } }, { "elem": "path", "attrs": { "d": "M28,2H4A2,2,0,0,0,2,4V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V4A2,2,0,0,0,28,2ZM21.5859,12.4141,17,7.8281v6.273a5,5,0,0,1,0,9.7978V28H15V23.8989a5,5,0,0,1,0-9.7978V7.8281l-4.5859,4.586L9,11l7-7,7,7Z" } }, { "elem": "path", "attrs": { "fill": "none", "d": "M21.5859,12.4141,23,11,16,4,9,11l1.4141,1.4141L15,7.8281v6.273a5,5,0,0,0,0,9.7978V28h2V23.8989a5,5,0,0,0,0-9.7978V7.8281ZM19,19a3,3,0,1,1-3-3A3.0033,3.0033,0,0,1,19,19Z", "data-icon-path": "inner-path" } }], "name": "direction--rotary--straight--filled", "size": 16 }, "size": 16 },
svg: `<svg focusable="false" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" fill="currentColor" width="16" height="16" viewBox="0 0 32 32" aria-hidden="true"><circle cx="16" cy="19" r="3"></circle><path d="M28,2H4A2,2,0,0,0,2,4V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V4A2,2,0,0,0,28,2ZM21.5859,12.4141,17,7.8281v6.273a5,5,0,0,1,0,9.7978V28H15V23.8989a5,5,0,0,1,0-9.7978V7.8281l-4.5859,4.586L9,11l7-7,7,7Z"></path><path fill="none" d="M21.5859,12.4141,23,11,16,4,9,11l1.4141,1.4141L15,7.8281v6.273a5,5,0,0,0,0,9.7978V28h2V23.8989a5,5,0,0,0,0-9.7978V7.8281ZM19,19a3,3,0,1,1-3-3A3.0033,3.0033,0,0,1,19,19Z" data-icon-path="inner-path"></path></svg>`
},
};
}
ngAfterViewInit() {
const svg = this.elementRef.nativeElement;
svg.setAttribute("xmlns", "http://www.w3.org/2000/svg");
const icon = this.icons[this.size];
const domParser = new DOMParser();
const rawSVG = icon.svg;
const svgElement = domParser.parseFromString(rawSVG, "image/svg+xml").documentElement;
let node = svgElement.firstChild;
while (node) {
// importNode makes a clone of the node
// this ensures we keep looping over the nodes in the parsed document
svg.appendChild(svg.ownerDocument.importNode(node, true));
node = node.nextSibling;
}
const attributes = getAttributes({
width: icon.metadata.descriptor.attrs.height,
height: icon.metadata.descriptor.attrs.height,
viewBox: icon.metadata.descriptor.attrs.viewBox,
title: this.title,
"aria-label": this.ariaLabel,
"aria-labelledby": this.ariaLabelledby,
"aria-hidden": this.ariaHidden,
focusable: this.isFocusable.toString()
});
const attrKeys = Object.keys(attributes);
for (let i = 0; i < attrKeys.length; i++) {
const key = attrKeys[i];
const value = attributes[key];
if (key === "title") {
continue;
}
if (value) {
svg.setAttribute(key, value);
}
}
if (attributes.title) {
const title = document.createElement("title");
title.textContent = attributes.title;
DirectionRotaryStraightFilledDirective_1.titleIdCounter++;
title.setAttribute("id", `direction-rotary-straight-filled-${DirectionRotaryStraightFilledDirective_1.titleIdCounter}`);
svg.appendChild(title);
svg.setAttribute("aria-labelledby", `direction-rotary-straight-filled-${DirectionRotaryStraightFilledDirective_1.titleIdCounter}`);
}
}
};
DirectionRotaryStraightFilledDirective.titleIdCounter = 0;
DirectionRotaryStraightFilledDirective.ctorParameters = () => [
{ type: ElementRef }
];
__decorate([
Input(),
__metadata("design:type", String)
], DirectionRotaryStraightFilledDirective.prototype, "ariaLabel", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], DirectionRotaryStraightFilledDirective.prototype, "ariaLabelledby", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], DirectionRotaryStraightFilledDirective.prototype, "ariaHidden", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], DirectionRotaryStraightFilledDirective.prototype, "title", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], DirectionRotaryStraightFilledDirective.prototype, "isFocusable", void 0);
__decorate([
Input(),
__metadata("design:type", String)
], DirectionRotaryStraightFilledDirective.prototype, "size", void 0);
DirectionRotaryStraightFilledDirective = DirectionRotaryStraightFilledDirective_1 = __decorate([
Directive({
selector: "[ibmIconDirectionRotaryStraightFilled]"
}),
__metadata("design:paramtypes", [ElementRef])
], DirectionRotaryStraightFilledDirective);
let DirectionRotaryStraightFilledModule = class DirectionRotaryStraightFilledModule {
};
DirectionRotaryStraightFilledModule = __decorate([
NgModule({
declarations: [
DirectionRotaryStraightFilledComponent,
DirectionRotaryStraightFilledDirective,
],
exports: [
DirectionRotaryStraightFilledComponent,
DirectionRotaryStraightFilledDirective,
]
})
], DirectionRotaryStraightFilledModule);
export { DirectionRotaryStraightFilledComponent, DirectionRotaryStraightFilledDirective, DirectionRotaryStraightFilledModule };