Socket
Socket
Sign inDemoInstall

@fortawesome/react-fontawesome

Package Overview
Dependencies
9
Maintainers
6
Versions
52
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.4-1 to 0.1.4

12

CHANGELOG.md

@@ -9,2 +9,14 @@ # Change Log

## [0.1.4](https://github.com/FortAwesome/react-fontawesome/releases/tag/0.1.4) - 2019-01-15
### Changed
- Upgrade to Babel 7 and Rollup 1 #213
### Fixed
- Thrown error in IE11
---
## [0.1.3](https://github.com/FortAwesome/react-fontawesome/releases/tag/0.1.3) - 2018-09-06

@@ -11,0 +23,0 @@

13

index.d.ts
/// <reference types="react" />
import React from 'react'
import { CSSProperties } from 'react'
import {

@@ -14,3 +13,5 @@ Transform,

export interface Props extends React.DOMAttributes<any> {
export function FontAwesomeIcon(props: Props): JSX.Element
export interface Props {
icon: IconProp

@@ -32,5 +33,5 @@ mask?: IconProp

symbol?: FaSymbol
style?: React.CSSProperties
style?: CSSProperties
tabIndex?: number;
title?: string;
}
export function FontAwesomeIcon(props: Props): JSX.Element

@@ -1,5 +0,109 @@

import { icon, parse } from '@fortawesome/fontawesome-svg-core';
import { parse, icon } from '@fortawesome/fontawesome-svg-core';
import PropTypes from 'prop-types';
import React from 'react';
function _typeof(obj) {
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function (obj) {
return typeof obj;
};
} else {
_typeof = function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
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 _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys.forEach(function (key) {
_defineProperty(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;
}
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 _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
}
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
return arr2;
}
}
function _iterableToArray(iter) {
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance");
}
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};

@@ -143,59 +247,2 @@

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
var defineProperty = function (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;
};
var _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;
};
var objectWithoutProperties = function (obj, keys) {
var target = {};
for (var i in obj) {
if (keys.indexOf(i) >= 0) continue;
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
target[i] = obj[i];
}
return target;
};
var toConsumableArray = function (arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
return arr2;
} else {
return Array.from(arr);
}
};
function capitalize(val) {

@@ -214,5 +261,3 @@ return val.charAt(0).toUpperCase() + val.slice(1);

var value = pair.slice(i + 1).trim();
prop.startsWith('webkit') ? acc[capitalize(prop)] = value : acc[prop] = value;
return acc;

@@ -228,4 +273,6 @@ }, {});

}
var children = (element.children || []).map(convert.bind(null, createElement));
var children = (element.children || []).map(function (child) {
return convert(createElement, child);
});
var mixins = Object.keys(element.attributes || {}).reduce(function (acc, key) {

@@ -239,5 +286,7 @@ var val = element.attributes[key];

break;
case 'style':
acc.attrs['style'] = styleToObject(val);
break;
default:

@@ -249,15 +298,16 @@ if (key.indexOf('aria-') === 0 || key.indexOf('data-') === 0) {

}
}
return acc;
}, { attrs: {} });
}, {
attrs: {}
});
var _extraProps$style = extraProps.style,
existingStyle = _extraProps$style === undefined ? {} : _extraProps$style,
remaining = objectWithoutProperties(extraProps, ['style']);
existingStyle = _extraProps$style === void 0 ? {} : _extraProps$style,
remaining = _objectWithoutProperties(extraProps, ["style"]);
mixins.attrs['style'] = _extends({}, mixins.attrs['style'], existingStyle);
return createElement.apply(undefined, [element.tag, _extends({}, mixins.attrs, remaining)].concat(toConsumableArray(children)));
mixins.attrs['style'] = _objectSpread({}, mixins.attrs['style'], existingStyle);
return createElement.apply(void 0, [element.tag, _objectSpread({}, mixins.attrs, remaining)].concat(_toConsumableArray(children)));
}

@@ -280,3 +330,3 @@

function objectWithKey(key, value) {
return Array.isArray(value) && value.length > 0 || !Array.isArray(value) && value ? defineProperty({}, key, value) : {};
return Array.isArray(value) && value.length > 0 || !Array.isArray(value) && value ? _defineProperty({}, key, value) : {};
}

@@ -296,4 +346,3 @@

'fa-flip-vertical': props.flip === 'vertical' || props.flip === 'both'
}, defineProperty(_classes, 'fa-' + props.size, props.size !== null), defineProperty(_classes, 'fa-rotate-' + props.rotation, props.rotation !== null), defineProperty(_classes, 'fa-pull-' + props.pull, props.pull !== null), _classes);
}, _defineProperty(_classes, "fa-".concat(props.size), props.size !== null), _defineProperty(_classes, "fa-rotate-".concat(props.rotation), props.rotation !== null), _defineProperty(_classes, "fa-pull-".concat(props.pull), props.pull !== null), _classes);
return Object.keys(classes).map(function (key) {

@@ -311,3 +360,3 @@ return classes[key] ? key : null;

if ((typeof icon$$1 === 'undefined' ? 'undefined' : _typeof(icon$$1)) === 'object' && icon$$1.prefix && icon$$1.iconName) {
if (_typeof(icon$$1) === 'object' && icon$$1.prefix && icon$$1.iconName) {
return icon$$1;

@@ -317,7 +366,13 @@ }

if (Array.isArray(icon$$1) && icon$$1.length === 2) {
return { prefix: icon$$1[0], iconName: icon$$1[1] };
return {
prefix: icon$$1[0],
iconName: icon$$1[1]
};
}
if (typeof icon$$1 === 'string') {
return { prefix: 'fas', iconName: icon$$1 };
return {
prefix: 'fas',
iconName: icon$$1
};
}

@@ -332,10 +387,7 @@ }

title = props.title;
var iconLookup = normalizeIconArgs(iconArgs);
var classes = objectWithKey('classes', [].concat(toConsumableArray(classList(props)), toConsumableArray(className.split(' '))));
var classes = objectWithKey('classes', [].concat(_toConsumableArray(classList(props)), _toConsumableArray(className.split(' '))));
var transform = objectWithKey('transform', typeof props.transform === 'string' ? parse.transform(props.transform) : props.transform);
var mask = objectWithKey('mask', normalizeIconArgs(maskArgs));
var renderedIcon = icon(iconLookup, _extends({}, classes, transform, mask, {
var renderedIcon = icon(iconLookup, _objectSpread({}, classes, transform, mask, {
symbol: symbol,

@@ -351,5 +403,3 @@ title: title

var abstract = renderedIcon.abstract;
var extraProps = {};
Object.keys(props).forEach(function (key) {

@@ -360,42 +410,23 @@ if (!FontAwesomeIcon.defaultProps.hasOwnProperty(key)) {

});
return convertCurry(abstract[0], extraProps);
}
FontAwesomeIcon.displayName = 'FontAwesomeIcon';
FontAwesomeIcon.propTypes = {
border: PropTypes.bool,
className: PropTypes.string,
mask: PropTypes.oneOfType([PropTypes.object, PropTypes.array, PropTypes.string]),
fixedWidth: PropTypes.bool,
inverse: PropTypes.bool,
flip: PropTypes.oneOf(['horizontal', 'vertical', 'both']),
icon: PropTypes.oneOfType([PropTypes.object, PropTypes.array, PropTypes.string]),
listItem: PropTypes.bool,
pull: PropTypes.oneOf(['right', 'left']),
pulse: PropTypes.bool,
rotation: PropTypes.oneOf([90, 180, 270]),
size: PropTypes.oneOf(['lg', 'xs', 'sm', '1x', '2x', '3x', '4x', '5x', '6x', '7x', '8x', '9x', '10x']),
spin: PropTypes.bool,
symbol: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
title: PropTypes.string,
transform: PropTypes.oneOfType([PropTypes.string, PropTypes.object])
};
FontAwesomeIcon.defaultProps = {

@@ -419,5 +450,4 @@ border: false,

};
var convertCurry = convert.bind(null, React.createElement);
export { FontAwesomeIcon };
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@fortawesome/fontawesome-svg-core'), require('prop-types'), require('react')) :
typeof define === 'function' && define.amd ? define(['exports', '@fortawesome/fontawesome-svg-core', 'prop-types', 'react'], factory) :
(factory((global['react-fontawesome'] = {}),global.FontAwesome,global.PropTypes,global.React));
}(this, (function (exports,fontawesomeSvgCore,PropTypes,React) { 'use strict';
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@fortawesome/fontawesome-svg-core'), require('prop-types'), require('react')) :
typeof define === 'function' && define.amd ? define(['exports', '@fortawesome/fontawesome-svg-core', 'prop-types', 'react'], factory) :
(global = global || self, factory(global['react-fontawesome'] = {}, global.FontAwesome, global.PropTypes, global.React));
}(this, function (exports, fontawesomeSvgCore, PropTypes, React) { 'use strict';
PropTypes = PropTypes && PropTypes.hasOwnProperty('default') ? PropTypes['default'] : PropTypes;
React = React && React.hasOwnProperty('default') ? React['default'] : React;
PropTypes = PropTypes && PropTypes.hasOwnProperty('default') ? PropTypes['default'] : PropTypes;
React = React && React.hasOwnProperty('default') ? React['default'] : React;
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
function _typeof(obj) {
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function (obj) {
return typeof obj;
};
} else {
_typeof = function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
return _typeof(obj);
}
var humps = createCommonjsModule(function (module) {
(function(global) {
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;
}
var _processKeys = function(convert, obj, options) {
if(!_isObject(obj) || _isDate(obj) || _isRegExp(obj) || _isBoolean(obj) || _isFunction(obj)) {
return obj;
}
return obj;
}
var output,
i = 0,
l = 0;
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if(_isArray(obj)) {
output = [];
for(l=obj.length; i<l; i++) {
output.push(_processKeys(convert, obj[i], options));
}
}
else {
output = {};
for(var key in obj) {
if(Object.prototype.hasOwnProperty.call(obj, key)) {
output[convert(key, options)] = _processKeys(convert, obj[key], options);
}
}
}
return output;
};
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
// String conversion methods
ownKeys.forEach(function (key) {
_defineProperty(target, key, source[key]);
});
}
var separateWords = function(string, options) {
options = options || {};
var separator = options.separator || '_';
var split = options.split || /(?=[A-Z])/;
return target;
}
return string.split(split).join(separator);
};
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
var camelize = function(string) {
if (_isNumerical(string)) {
return string;
}
string = string.replace(/[\-_\s]+(.)?/g, function(match, chr) {
return chr ? chr.toUpperCase() : '';
});
// Ensure 1st char is always lowercase
return string.substr(0, 1).toLowerCase() + string.substr(1);
};
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
var pascalize = function(string) {
var camelized = camelize(string);
// Ensure 1st char is always uppercase
return camelized.substr(0, 1).toUpperCase() + camelized.substr(1);
};
return target;
}
var decamelize = function(string, options) {
return separateWords(string, options).toLowerCase();
};
function _objectWithoutProperties(source, excluded) {
if (source == null) return {};
// Utilities
// Taken from Underscore.js
var target = _objectWithoutPropertiesLoose(source, excluded);
var toString = Object.prototype.toString;
var key, i;
var _isFunction = function(obj) {
return typeof(obj) === 'function';
};
var _isObject = function(obj) {
return obj === Object(obj);
};
var _isArray = function(obj) {
return toString.call(obj) == '[object Array]';
};
var _isDate = function(obj) {
return toString.call(obj) == '[object Date]';
};
var _isRegExp = function(obj) {
return toString.call(obj) == '[object RegExp]';
};
var _isBoolean = function(obj) {
return toString.call(obj) == '[object Boolean]';
};
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
// Performant way to determine if obj coerces to a number
var _isNumerical = function(obj) {
obj = obj - 0;
return obj === obj;
};
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];
}
}
// Sets up function which handles processing keys
// allowing the convert function to be modified by a callback
var _processor = function(convert, options) {
var callback = options && 'process' in options ? options.process : options;
return target;
}
if(typeof(callback) !== 'function') {
return convert;
}
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
}
return function(string, options) {
return callback(string, convert, options);
}
};
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
var humps = {
camelize: camelize,
decamelize: decamelize,
pascalize: pascalize,
depascalize: decamelize,
camelizeKeys: function(object, options) {
return _processKeys(_processor(camelize, options), object);
},
decamelizeKeys: function(object, options) {
return _processKeys(_processor(decamelize, options), object, options);
},
pascalizeKeys: function(object, options) {
return _processKeys(_processor(pascalize, options), object);
},
depascalizeKeys: function () {
return this.decamelizeKeys.apply(this, arguments);
}
};
return arr2;
}
}
if (module.exports) {
module.exports = humps;
} else {
global.humps = humps;
}
function _iterableToArray(iter) {
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
}
})(commonjsGlobal);
});
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance");
}
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
var defineProperty = function (obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
return obj;
};
var humps = createCommonjsModule(function (module) {
(function(global) {
var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
var _processKeys = function(convert, obj, options) {
if(!_isObject(obj) || _isDate(obj) || _isRegExp(obj) || _isBoolean(obj) || _isFunction(obj)) {
return obj;
}
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
var output,
i = 0,
l = 0;
return target;
};
if(_isArray(obj)) {
output = [];
for(l=obj.length; i<l; i++) {
output.push(_processKeys(convert, obj[i], options));
}
}
else {
output = {};
for(var key in obj) {
if(Object.prototype.hasOwnProperty.call(obj, key)) {
output[convert(key, options)] = _processKeys(convert, obj[key], options);
}
}
}
return output;
};
var objectWithoutProperties = function (obj, keys) {
var target = {};
// String conversion methods
for (var i in obj) {
if (keys.indexOf(i) >= 0) continue;
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
target[i] = obj[i];
}
var separateWords = function(string, options) {
options = options || {};
var separator = options.separator || '_';
var split = options.split || /(?=[A-Z])/;
return target;
};
return string.split(split).join(separator);
};
var toConsumableArray = function (arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
var camelize = function(string) {
if (_isNumerical(string)) {
return string;
}
string = string.replace(/[\-_\s]+(.)?/g, function(match, chr) {
return chr ? chr.toUpperCase() : '';
});
// Ensure 1st char is always lowercase
return string.substr(0, 1).toLowerCase() + string.substr(1);
};
return arr2;
} else {
return Array.from(arr);
}
};
var pascalize = function(string) {
var camelized = camelize(string);
// Ensure 1st char is always uppercase
return camelized.substr(0, 1).toUpperCase() + camelized.substr(1);
};
function capitalize(val) {
return val.charAt(0).toUpperCase() + val.slice(1);
}
var decamelize = function(string, options) {
return separateWords(string, options).toLowerCase();
};
function styleToObject(style) {
return style.split(';').map(function (s) {
return s.trim();
}).filter(function (s) {
return s;
}).reduce(function (acc, pair) {
var i = pair.indexOf(':');
var prop = humps.camelize(pair.slice(0, i));
var value = pair.slice(i + 1).trim();
// Utilities
// Taken from Underscore.js
prop.startsWith('webkit') ? acc[capitalize(prop)] = value : acc[prop] = value;
var toString = Object.prototype.toString;
return acc;
}, {});
}
var _isFunction = function(obj) {
return typeof(obj) === 'function';
};
var _isObject = function(obj) {
return obj === Object(obj);
};
var _isArray = function(obj) {
return toString.call(obj) == '[object Array]';
};
var _isDate = function(obj) {
return toString.call(obj) == '[object Date]';
};
var _isRegExp = function(obj) {
return toString.call(obj) == '[object RegExp]';
};
var _isBoolean = function(obj) {
return toString.call(obj) == '[object Boolean]';
};
function convert(createElement, element) {
var extraProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
// Performant way to determine if obj coerces to a number
var _isNumerical = function(obj) {
obj = obj - 0;
return obj === obj;
};
if (typeof element === 'string') {
return element;
}
var children = (element.children || []).map(convert.bind(null, createElement));
// Sets up function which handles processing keys
// allowing the convert function to be modified by a callback
var _processor = function(convert, options) {
var callback = options && 'process' in options ? options.process : options;
var mixins = Object.keys(element.attributes || {}).reduce(function (acc, key) {
var val = element.attributes[key];
if(typeof(callback) !== 'function') {
return convert;
}
switch (key) {
case 'class':
acc.attrs['className'] = val;
delete element.attributes['class'];
break;
case 'style':
acc.attrs['style'] = styleToObject(val);
break;
default:
if (key.indexOf('aria-') === 0 || key.indexOf('data-') === 0) {
acc.attrs[key.toLowerCase()] = val;
} else {
acc.attrs[humps.camelize(key)] = val;
}
}
return function(string, options) {
return callback(string, convert, options);
}
};
return acc;
}, { attrs: {} });
var humps = {
camelize: camelize,
decamelize: decamelize,
pascalize: pascalize,
depascalize: decamelize,
camelizeKeys: function(object, options) {
return _processKeys(_processor(camelize, options), object);
},
decamelizeKeys: function(object, options) {
return _processKeys(_processor(decamelize, options), object, options);
},
pascalizeKeys: function(object, options) {
return _processKeys(_processor(pascalize, options), object);
},
depascalizeKeys: function () {
return this.decamelizeKeys.apply(this, arguments);
}
};
var _extraProps$style = extraProps.style,
existingStyle = _extraProps$style === undefined ? {} : _extraProps$style,
remaining = objectWithoutProperties(extraProps, ['style']);
if (module.exports) {
module.exports = humps;
} else {
global.humps = humps;
}
})(commonjsGlobal);
});
mixins.attrs['style'] = _extends({}, mixins.attrs['style'], existingStyle);
function capitalize(val) {
return val.charAt(0).toUpperCase() + val.slice(1);
}
return createElement.apply(undefined, [element.tag, _extends({}, mixins.attrs, remaining)].concat(toConsumableArray(children)));
}
function styleToObject(style) {
return style.split(';').map(function (s) {
return s.trim();
}).filter(function (s) {
return s;
}).reduce(function (acc, pair) {
var i = pair.indexOf(':');
var prop = humps.camelize(pair.slice(0, i));
var value = pair.slice(i + 1).trim();
prop.startsWith('webkit') ? acc[capitalize(prop)] = value : acc[prop] = value;
return acc;
}, {});
}
var PRODUCTION = false;
function convert(createElement, element) {
var extraProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
try {
PRODUCTION = process.env.NODE_ENV === 'production';
} catch (e) {}
if (typeof element === 'string') {
return element;
}
function log () {
if (!PRODUCTION && console && typeof console.error === 'function') {
var _console;
var children = (element.children || []).map(function (child) {
return convert(createElement, child);
});
var mixins = Object.keys(element.attributes || {}).reduce(function (acc, key) {
var val = element.attributes[key];
(_console = console).error.apply(_console, arguments);
}
}
switch (key) {
case 'class':
acc.attrs['className'] = val;
delete element.attributes['class'];
break;
function objectWithKey(key, value) {
return Array.isArray(value) && value.length > 0 || !Array.isArray(value) && value ? defineProperty({}, key, value) : {};
}
case 'style':
acc.attrs['style'] = styleToObject(val);
break;
function classList(props) {
var _classes;
default:
if (key.indexOf('aria-') === 0 || key.indexOf('data-') === 0) {
acc.attrs[key.toLowerCase()] = val;
} else {
acc.attrs[humps.camelize(key)] = val;
}
var classes = (_classes = {
'fa-spin': props.spin,
'fa-pulse': props.pulse,
'fa-fw': props.fixedWidth,
'fa-inverse': props.inverse,
'fa-border': props.border,
'fa-li': props.listItem,
'fa-flip-horizontal': props.flip === 'horizontal' || props.flip === 'both',
'fa-flip-vertical': props.flip === 'vertical' || props.flip === 'both'
}, defineProperty(_classes, 'fa-' + props.size, props.size !== null), defineProperty(_classes, 'fa-rotate-' + props.rotation, props.rotation !== null), defineProperty(_classes, 'fa-pull-' + props.pull, props.pull !== null), _classes);
}
return Object.keys(classes).map(function (key) {
return classes[key] ? key : null;
}).filter(function (key) {
return key;
});
}
return acc;
}, {
attrs: {}
});
function normalizeIconArgs(icon) {
if (icon === null) {
return null;
}
var _extraProps$style = extraProps.style,
existingStyle = _extraProps$style === void 0 ? {} : _extraProps$style,
remaining = _objectWithoutProperties(extraProps, ["style"]);
if ((typeof icon === 'undefined' ? 'undefined' : _typeof(icon)) === 'object' && icon.prefix && icon.iconName) {
return icon;
}
mixins.attrs['style'] = _objectSpread({}, mixins.attrs['style'], existingStyle);
return createElement.apply(void 0, [element.tag, _objectSpread({}, mixins.attrs, remaining)].concat(_toConsumableArray(children)));
}
if (Array.isArray(icon) && icon.length === 2) {
return { prefix: icon[0], iconName: icon[1] };
}
var PRODUCTION = false;
if (typeof icon === 'string') {
return { prefix: 'fas', iconName: icon };
}
}
try {
PRODUCTION = process.env.NODE_ENV === 'production';
} catch (e) {}
function FontAwesomeIcon(props) {
var iconArgs = props.icon,
maskArgs = props.mask,
symbol = props.symbol,
className = props.className,
title = props.title;
function log () {
if (!PRODUCTION && console && typeof console.error === 'function') {
var _console;
(_console = console).error.apply(_console, arguments);
}
}
var iconLookup = normalizeIconArgs(iconArgs);
var classes = objectWithKey('classes', [].concat(toConsumableArray(classList(props)), toConsumableArray(className.split(' '))));
var transform = objectWithKey('transform', typeof props.transform === 'string' ? fontawesomeSvgCore.parse.transform(props.transform) : props.transform);
var mask = objectWithKey('mask', normalizeIconArgs(maskArgs));
function objectWithKey(key, value) {
return Array.isArray(value) && value.length > 0 || !Array.isArray(value) && value ? _defineProperty({}, key, value) : {};
}
var renderedIcon = fontawesomeSvgCore.icon(iconLookup, _extends({}, classes, transform, mask, {
symbol: symbol,
title: title
}));
function classList(props) {
var _classes;
if (!renderedIcon) {
log('Could not find icon', iconLookup);
return null;
}
var classes = (_classes = {
'fa-spin': props.spin,
'fa-pulse': props.pulse,
'fa-fw': props.fixedWidth,
'fa-inverse': props.inverse,
'fa-border': props.border,
'fa-li': props.listItem,
'fa-flip-horizontal': props.flip === 'horizontal' || props.flip === 'both',
'fa-flip-vertical': props.flip === 'vertical' || props.flip === 'both'
}, _defineProperty(_classes, "fa-".concat(props.size), props.size !== null), _defineProperty(_classes, "fa-rotate-".concat(props.rotation), props.rotation !== null), _defineProperty(_classes, "fa-pull-".concat(props.pull), props.pull !== null), _classes);
return Object.keys(classes).map(function (key) {
return classes[key] ? key : null;
}).filter(function (key) {
return key;
});
}
var abstract = renderedIcon.abstract;
function normalizeIconArgs(icon) {
if (icon === null) {
return null;
}
var extraProps = {};
if (_typeof(icon) === 'object' && icon.prefix && icon.iconName) {
return icon;
}
Object.keys(props).forEach(function (key) {
if (!FontAwesomeIcon.defaultProps.hasOwnProperty(key)) {
extraProps[key] = props[key];
}
});
if (Array.isArray(icon) && icon.length === 2) {
return {
prefix: icon[0],
iconName: icon[1]
};
}
return convertCurry(abstract[0], extraProps);
}
if (typeof icon === 'string') {
return {
prefix: 'fas',
iconName: icon
};
}
}
FontAwesomeIcon.displayName = 'FontAwesomeIcon';
function FontAwesomeIcon(props) {
var iconArgs = props.icon,
maskArgs = props.mask,
symbol = props.symbol,
className = props.className,
title = props.title;
var iconLookup = normalizeIconArgs(iconArgs);
var classes = objectWithKey('classes', [].concat(_toConsumableArray(classList(props)), _toConsumableArray(className.split(' '))));
var transform = objectWithKey('transform', typeof props.transform === 'string' ? fontawesomeSvgCore.parse.transform(props.transform) : props.transform);
var mask = objectWithKey('mask', normalizeIconArgs(maskArgs));
var renderedIcon = fontawesomeSvgCore.icon(iconLookup, _objectSpread({}, classes, transform, mask, {
symbol: symbol,
title: title
}));
FontAwesomeIcon.propTypes = {
border: PropTypes.bool,
if (!renderedIcon) {
log('Could not find icon', iconLookup);
return null;
}
className: PropTypes.string,
var abstract = renderedIcon.abstract;
var extraProps = {};
Object.keys(props).forEach(function (key) {
if (!FontAwesomeIcon.defaultProps.hasOwnProperty(key)) {
extraProps[key] = props[key];
}
});
return convertCurry(abstract[0], extraProps);
}
FontAwesomeIcon.displayName = 'FontAwesomeIcon';
FontAwesomeIcon.propTypes = {
border: PropTypes.bool,
className: PropTypes.string,
mask: PropTypes.oneOfType([PropTypes.object, PropTypes.array, PropTypes.string]),
fixedWidth: PropTypes.bool,
inverse: PropTypes.bool,
flip: PropTypes.oneOf(['horizontal', 'vertical', 'both']),
icon: PropTypes.oneOfType([PropTypes.object, PropTypes.array, PropTypes.string]),
listItem: PropTypes.bool,
pull: PropTypes.oneOf(['right', 'left']),
pulse: PropTypes.bool,
rotation: PropTypes.oneOf([90, 180, 270]),
size: PropTypes.oneOf(['lg', 'xs', 'sm', '1x', '2x', '3x', '4x', '5x', '6x', '7x', '8x', '9x', '10x']),
spin: PropTypes.bool,
symbol: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
title: PropTypes.string,
transform: PropTypes.oneOfType([PropTypes.string, PropTypes.object])
};
FontAwesomeIcon.defaultProps = {
border: false,
className: '',
mask: null,
fixedWidth: false,
inverse: false,
flip: null,
icon: null,
listItem: false,
pull: null,
pulse: false,
rotation: null,
size: null,
spin: false,
symbol: false,
title: '',
transform: null
};
var convertCurry = convert.bind(null, React.createElement);
mask: PropTypes.oneOfType([PropTypes.object, PropTypes.array, PropTypes.string]),
exports.FontAwesomeIcon = FontAwesomeIcon;
fixedWidth: PropTypes.bool,
Object.defineProperty(exports, '__esModule', { value: true });
inverse: PropTypes.bool,
flip: PropTypes.oneOf(['horizontal', 'vertical', 'both']),
icon: PropTypes.oneOfType([PropTypes.object, PropTypes.array, PropTypes.string]),
listItem: PropTypes.bool,
pull: PropTypes.oneOf(['right', 'left']),
pulse: PropTypes.bool,
rotation: PropTypes.oneOf([90, 180, 270]),
size: PropTypes.oneOf(['lg', 'xs', 'sm', '1x', '2x', '3x', '4x', '5x', '6x', '7x', '8x', '9x', '10x']),
spin: PropTypes.bool,
symbol: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
title: PropTypes.string,
transform: PropTypes.oneOfType([PropTypes.string, PropTypes.object])
};
FontAwesomeIcon.defaultProps = {
border: false,
className: '',
mask: null,
fixedWidth: false,
inverse: false,
flip: null,
icon: null,
listItem: false,
pull: null,
pulse: false,
rotation: null,
size: null,
spin: false,
symbol: false,
title: '',
transform: null
};
var convertCurry = convert.bind(null, React.createElement);
exports.FontAwesomeIcon = FontAwesomeIcon;
Object.defineProperty(exports, '__esModule', { value: true });
})));
}));
{
"name": "@fortawesome/react-fontawesome",
"description": "Official React component for Font Awesome 5",
"version": "0.1.4-1",
"version": "0.1.4",
"main": "index.js",

@@ -22,3 +22,4 @@ "module": "index.es.js",

"Naor Torgeman <github.com/naortor>",
"Matthew Hand <github.com/mmhand123>"
"Matthew Hand <github.com/mmhand123>",
"calvinf <github.com/calvinf>"
],

@@ -47,11 +48,12 @@ "license": "MIT",

"devDependencies": {
"@babel/core": "^7.2.2",
"@babel/plugin-external-helpers": "^7.2.0",
"@babel/preset-env": "^7.2.3",
"@babel/preset-react": "^7.0.0",
"@babel/preset-stage-3": "^7.0.0",
"@fortawesome/fontawesome-svg-core": "^1.2.0-7",
"@types/react": "^16.4.8",
"babel-core": "^6.26.0",
"babel-eslint": "^8.2.1",
"babel-jest": "^23.4.2",
"babel-plugin-external-helpers": "^6.22.0",
"babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-3": "^6.24.1",
"babel-core": "^7.0.0-0",
"babel-eslint": "^10.0.0",
"babel-jest": "^23.6.0",
"cross-env": "^5.1.1",

@@ -67,3 +69,3 @@ "eslint": "^5.3.0",

"husky": "^0.14.3",
"jest": "^23.5.0",
"jest": "^23.6.0",
"lint-staged": "^7.2.0",

@@ -76,6 +78,6 @@ "markdown-toc": "^1.2.0",

"react-test-renderer": "^16.2.0",
"rollup": "^0.64.0",
"rollup-plugin-babel": "^3.0.2",
"rollup-plugin-commonjs": "^9.1.0",
"rollup-plugin-node-resolve": "^3.3.0"
"rollup": "^1.0.0",
"rollup-plugin-babel": "^4.2.0",
"rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-node-resolve": "^4.0.0"
},

@@ -82,0 +84,0 @@ "dependencies": {

@@ -565,2 +565,3 @@ <a href="https://fontawesome.com">

| <img src="https://github.com/mmhand123.png?size=72" /> | Matthew Hand | [@mmhand123](https://github.com/mmhand123) |
| <img src="https://github.com/calvinf.png?size=72" /> | calvinf | [@calvinf](https://github.com/calvinf) |

@@ -567,0 +568,0 @@ If we've missed someone (which is quite likely) submit a Pull Request to us and we'll get it resolved.

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc