Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@elvia/elvis-icon

Package Overview
Dependencies
Maintainers
6
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@elvia/elvis-icon - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

10

CHANGELOG.json

@@ -5,2 +5,12 @@ {

{
"date": "26.07.22",
"version": "1.2.1 ",
"changelog": [
{
"type": "patch",
"changes": ["Removed an unnecessarry div element.", "Refactoring. "]
}
]
},
{
"date": "03.05.22",

@@ -7,0 +17,0 @@ "version": "1.2.0 ",

111

dist/react/js/elvia-icon.js

@@ -5,40 +5,59 @@ /*

*/
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
"use strict";
import React from 'react';
import * as elvisIcons from '@elvia/elvis-assets-icons';
export const Icon = ({
name,
color,
size = 'sm',
customSize,
className,
inlineStyle,
...rest
}) => {
const getIcon = (icon, size, color, customSize) => {
let newIcon = undefined; // search and get requested icon in elvis/asses-icons
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
for (const elviaIcon in elvisIcons) {
if (elviaIcon === icon && color !== undefined) {
newIcon = elvisIcons[icon].getIcon(color);
break;
} else if (elviaIcon === icon && color === undefined) {
newIcon = elvisIcons[icon].getIcon();
break;
}
} // console error and return if no available icon from elvis/assets-icons package
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.Icon = void 0;
var _react = _interopRequireDefault(require("react"));
if (newIcon === undefined) {
console.error(`No icon found with the name ${icon}`);
return `No icon found with name ${icon}`;
var elvisIcons = _interopRequireWildcard(require("@elvia/elvis-assets-icons"));
var _excluded = ["name", "color", "size", "customSize", "className", "inlineStyle"],
_excluded2 = ["children"];
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
var Icon = function Icon(_ref) {
var name = _ref.name,
color = _ref.color,
_ref$size = _ref.size,
size = _ref$size === void 0 ? 'sm' : _ref$size,
customSize = _ref.customSize,
className = _ref.className,
inlineStyle = _ref.inlineStyle,
rest = _objectWithoutProperties(_ref, _excluded);
var getIcon = function getIcon(icon, size, color, customSize) {
try {
var newIcon = elvisIcons[icon].getIcon(color);
return getSize(newIcon, size, customSize);
} catch (error) {
var errorMessage = "No icon found with the name ".concat(icon).concat(color ? " and color ".concat(color) : '');
console.error(errorMessage);
return errorMessage;
}
newIcon = getSize(newIcon, size, customSize);
return newIcon;
};
const getSize = (icon, size, customSize) => {
let definedSize; // find correct size according to size prop
var getSize = function getSize(icon, size, customSize) {
var definedSize; // find correct size according to size prop

@@ -82,13 +101,15 @@ if (customSize === undefined) {

const wReg = /width="([^"]*)"/;
const hReg = /height="([^"]*)"/;
icon = icon.replace(wReg, `width="${definedSize}"`).replace(hReg, `height="${definedSize}"`);
var wReg = /width="([^"]*)"/;
var hReg = /height="([^"]*)"/;
icon = icon.replace(wReg, "width=\"".concat(definedSize, "\"")).replace(hReg, "height=\"".concat(definedSize, "\""));
return icon;
};
const displayIcon = getIcon(name, size, color, customSize);
return /*#__PURE__*/React.createElement("div", _extends({
style: inlineStyle,
className: className ? className : ''
}, rest), /*#__PURE__*/React.createElement("i", {
var displayIcon = getIcon(name, size, color, customSize); // Remove children from rest because dangerouslySetInnerHTML is used
// eslint-disable-next-line @typescript-eslint/no-unused-vars
var children = rest.children,
restWithoutChildren = _objectWithoutProperties(rest, _excluded2);
return /*#__PURE__*/_react.default.createElement("i", _extends({
dangerouslySetInnerHTML: {

@@ -98,7 +119,11 @@ __html: displayIcon

"aria-hidden": "true",
style: {
style: _objectSpread({
display: 'flex'
}
}));
}, inlineStyle),
className: className ? className : ''
}, restWithoutChildren));
};
export default Icon;
exports.Icon = Icon;
var _default = Icon;
exports.default = _default;
{
"name": "@elvia/elvis-icon",
"version": "1.2.0",
"version": "1.2.1",
"description": "",

@@ -5,0 +5,0 @@ "license": "MIT",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc