UNPKG

@elf-framework/icon

Version:

Icon library for sapa that use material icons

24 lines (23 loc) 1.13 kB
(function(global, factory) { typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@elf-framework/sapa")) : typeof define === "function" && define.amd ? define(["exports", "@elf-framework/sapa"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["components/SvgIcon"] = {}, global.sapa)); })(this, function(exports2, sapa) { "use strict"; function makeElement(node) { return sapa.createElementJsx(node.tag, node.attributes, node.children.map(makeElement)); } function SvgIcon(node, props = {}) { if (props.width && !props.height) { props.height = props.width; } return /* @__PURE__ */ sapa.createElementJsx("span", { class: `elf--icon ${node.theme}`, "data-name": node.name }, /* @__PURE__ */ sapa.createElementJsx("svg", { ...node.icon.attributes, fill: "currentColor", ...props }, node.icon.children.map(makeElement))); } exports2.SvgIcon = SvgIcon; Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); });