UNPKG

antd-omi-icons

Version:
76 lines (75 loc) 3.62 kB
var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; import { h } from 'omi'; import { generate as generateColor } from '@ant-design/colors'; export function warn(valid, message) { // Support uglify if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) { console.error("Warning: ".concat(message)); } } export function warning(valid, message) { warn(valid, "[antd-icons-omi] ".concat(message)); } export function isIconDefinition(target) { return target && (typeof target === 'object' && typeof target.name === 'string' && typeof target.theme === 'string' && (typeof target.icon === 'object' || typeof target.icon === 'function')); } export function normalizeAttrs(attrs) { if (attrs === void 0) { attrs = {}; } return Object.keys(attrs).reduce(function (acc, key) { var val = attrs[key]; switch (key) { case 'class': acc.className = val; delete acc.class; break; default: acc[key] = val; } return acc; }, {}); } export function generate(node, key, rootProps) { if (!rootProps) { return h(node.tag, __assign({ key: key }, node.attrs), (node.children || []).map(function (child, index) { return generate(child, "".concat(key, "-").concat(node.tag, "-").concat(index)); })); } return h(node.tag, __assign(__assign({ key: key }, rootProps), node.attrs), (node.children || []).map(function (child, index) { return generate(child, "".concat(key, "-").concat(node.tag, "-").concat(index)); })); } export function getSecondaryColor(primaryColor) { // choose the second color return generateColor(primaryColor)[0]; } export function normalizeTwoToneColors(twoToneColor) { if (!twoToneColor) { return []; } return Array.isArray(twoToneColor) ? twoToneColor : [twoToneColor]; } // These props make sure that the SVG behaviours like general text. // Reference: https://blog.prototypr.io/align-svg-icons-to-text-and-say-goodbye-to-font-icons-d44b3d7b26b4 export var svgBaseProps = { width: '1em', height: '1em', fill: 'currentColor', 'aria-hidden': 'true', focusable: 'false', }; export var iconStyles = "\nsvg.anticon {\n display: inline-block;\n color: inherit;\n font-style: normal;\n line-height: 0;\n text-align: center;\n text-transform: none;\n vertical-align: -0.125em;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\nsvg.anticon > * {\n line-height: 1;\n}\n\nsvg.anticon svg {\n display: inline-block;\n}\n\nsvg.anticon::before {\n display: none;\n}\n\nsvg.anticon .anticon-icon {\n display: block;\n}\n\nsvg.anticon[tabindex] {\n cursor: pointer;\n}\n\nsvg.anticon-spin::before,\nsvg.anticon-spin {\n display: inline-block;\n -webkit-animation: loadingCircle 1s infinite linear;\n animation: loadingCircle 1s infinite linear;\n}\n\n@-webkit-keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n@keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n";