UNPKG

@up-group/react-controls

Version:

We know that there are a ton of react UI library projects to choose from. Our hope with this one is to provide the next generation of react components that you can use to bootstrap your next project, or as a reference for building a UIKit. Read on to get

38 lines 2.48 kB
"use strict"; var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]]; return t; }; Object.defineProperty(exports, "__esModule", { value: true }); var React = require("react"); var themedComponents_1 = require("../../../Common/theming/themedComponents"); var icons_1 = require("./icons"); var SvgIconWrapper = (_a = ["\n float: ", ";\n display: inline;\n width: ", "px ;\n height:", "px ;\n margin: 1px;\n svg {\n fill:", " ;\n }\n"], _a.raw = ["\n float: ", ";\n display: inline;\n width: ", "px ;\n height:", "px ;\n margin: 1px;\n svg {\n fill:", " ;\n }\n"], themedComponents_1.default.div(_a, function (props) { return props.position ? props.position : "left"; }, function (props) { return props.width; }, function (props) { return props.height; }, function (props) { return props.color; })); function SvgIcon(_a) { var children = _a.children, viewBox = _a.viewBox, iconName = _a.iconName, className = _a.className, color = _a.color, position = _a.position, dataFor = _a.dataFor, others = __rest(_a, ["children", "viewBox", "iconName", "className", "color", "position", "dataFor"]); var height = others.height || 20; var width = others.height || 20; if (iconName) { var SvgIconElement = function () { return React.createElement(SvgIconWrapper, { position: position, className: className, color: color, height: height, width: width, dangerouslySetInnerHTML: { __html: icons_1.default[iconName] } }); }; if (dataFor != null) { return (React.createElement("div", { style: { display: "inline-block" }, "data-for": dataFor, "data-tip": "tooltip" }, React.createElement(SvgIconElement, null))); } else { return (React.createElement(SvgIconElement, null)); } } else { var defaultViewBox = "0 0 " + width + " " + height; var viewBoxProps = viewBox || defaultViewBox; return (React.createElement("svg", { fill: color, viewBox: viewBoxProps }, children)); } } exports.default = SvgIcon; var _a; //# sourceMappingURL=index.js.map