@fortawesome/react-fontawesome
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -332,13 +332,43 @@ import { parse, icon } from '@fortawesome/fontawesome-svg-core'; | ||
var defaultProps = { | ||
border: false, | ||
className: '', | ||
mask: null, | ||
maskId: null, | ||
fixedWidth: false, | ||
inverse: false, | ||
flip: false, | ||
icon: null, | ||
listItem: false, | ||
pull: null, | ||
pulse: false, | ||
rotation: null, | ||
size: null, | ||
spin: false, | ||
spinPulse: false, | ||
spinReverse: false, | ||
beat: false, | ||
fade: false, | ||
beatFade: false, | ||
bounce: false, | ||
shake: false, | ||
symbol: false, | ||
title: '', | ||
titleId: null, | ||
transform: null, | ||
swapOpacity: false | ||
}; | ||
var FontAwesomeIcon = /*#__PURE__*/React.forwardRef(function (props, ref) { | ||
var iconArgs = props.icon, | ||
maskArgs = props.mask, | ||
symbol = props.symbol, | ||
className = props.className, | ||
title = props.title, | ||
titleId = props.titleId, | ||
maskId = props.maskId; | ||
var allProps = _objectSpread2(_objectSpread2({}, defaultProps), props); | ||
var iconArgs = allProps.icon, | ||
maskArgs = allProps.mask, | ||
symbol = allProps.symbol, | ||
className = allProps.className, | ||
title = allProps.title, | ||
titleId = allProps.titleId, | ||
maskId = allProps.maskId; | ||
var iconLookup = normalizeIconArgs(iconArgs); | ||
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 classes = objectWithKey('classes', [].concat(_toConsumableArray(classList(allProps)), _toConsumableArray(className.split(' ')))); | ||
var transform = objectWithKey('transform', typeof allProps.transform === 'string' ? parse.transform(allProps.transform) : allProps.transform); | ||
var mask = objectWithKey('mask', normalizeIconArgs(maskArgs)); | ||
@@ -361,6 +391,6 @@ var renderedIcon = icon(iconLookup, _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, classes), transform), mask), {}, { | ||
}; | ||
Object.keys(props).forEach(function (key) { | ||
Object.keys(allProps).forEach(function (key) { | ||
// eslint-disable-next-line no-prototype-builtins | ||
if (!FontAwesomeIcon.defaultProps.hasOwnProperty(key)) { | ||
extraProps[key] = props[key]; | ||
if (!defaultProps.hasOwnProperty(key)) { | ||
extraProps[key] = allProps[key]; | ||
} | ||
@@ -400,32 +430,4 @@ }); | ||
}; | ||
FontAwesomeIcon.defaultProps = { | ||
border: false, | ||
className: '', | ||
mask: null, | ||
maskId: null, | ||
fixedWidth: false, | ||
inverse: false, | ||
flip: false, | ||
icon: null, | ||
listItem: false, | ||
pull: null, | ||
pulse: false, | ||
rotation: null, | ||
size: null, | ||
spin: false, | ||
spinPulse: false, | ||
spinReverse: false, | ||
beat: false, | ||
fade: false, | ||
beatFade: false, | ||
bounce: false, | ||
shake: false, | ||
symbol: false, | ||
title: '', | ||
titleId: null, | ||
transform: null, | ||
swapOpacity: false | ||
}; | ||
var convertCurry = convert.bind(null, React.createElement); | ||
export { FontAwesomeIcon }; |
82
index.js
@@ -339,13 +339,43 @@ (function (global, factory) { | ||
var defaultProps = { | ||
border: false, | ||
className: '', | ||
mask: null, | ||
maskId: null, | ||
fixedWidth: false, | ||
inverse: false, | ||
flip: false, | ||
icon: null, | ||
listItem: false, | ||
pull: null, | ||
pulse: false, | ||
rotation: null, | ||
size: null, | ||
spin: false, | ||
spinPulse: false, | ||
spinReverse: false, | ||
beat: false, | ||
fade: false, | ||
beatFade: false, | ||
bounce: false, | ||
shake: false, | ||
symbol: false, | ||
title: '', | ||
titleId: null, | ||
transform: null, | ||
swapOpacity: false | ||
}; | ||
var FontAwesomeIcon = /*#__PURE__*/React__default["default"].forwardRef(function (props, ref) { | ||
var iconArgs = props.icon, | ||
maskArgs = props.mask, | ||
symbol = props.symbol, | ||
className = props.className, | ||
title = props.title, | ||
titleId = props.titleId, | ||
maskId = props.maskId; | ||
var allProps = _objectSpread2(_objectSpread2({}, defaultProps), props); | ||
var iconArgs = allProps.icon, | ||
maskArgs = allProps.mask, | ||
symbol = allProps.symbol, | ||
className = allProps.className, | ||
title = allProps.title, | ||
titleId = allProps.titleId, | ||
maskId = allProps.maskId; | ||
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 classes = objectWithKey('classes', [].concat(_toConsumableArray(classList(allProps)), _toConsumableArray(className.split(' ')))); | ||
var transform = objectWithKey('transform', typeof allProps.transform === 'string' ? fontawesomeSvgCore.parse.transform(allProps.transform) : allProps.transform); | ||
var mask = objectWithKey('mask', normalizeIconArgs(maskArgs)); | ||
@@ -368,6 +398,6 @@ var renderedIcon = fontawesomeSvgCore.icon(iconLookup, _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, classes), transform), mask), {}, { | ||
}; | ||
Object.keys(props).forEach(function (key) { | ||
Object.keys(allProps).forEach(function (key) { | ||
// eslint-disable-next-line no-prototype-builtins | ||
if (!FontAwesomeIcon.defaultProps.hasOwnProperty(key)) { | ||
extraProps[key] = props[key]; | ||
if (!defaultProps.hasOwnProperty(key)) { | ||
extraProps[key] = allProps[key]; | ||
} | ||
@@ -407,30 +437,2 @@ }); | ||
}; | ||
FontAwesomeIcon.defaultProps = { | ||
border: false, | ||
className: '', | ||
mask: null, | ||
maskId: null, | ||
fixedWidth: false, | ||
inverse: false, | ||
flip: false, | ||
icon: null, | ||
listItem: false, | ||
pull: null, | ||
pulse: false, | ||
rotation: null, | ||
size: null, | ||
spin: false, | ||
spinPulse: false, | ||
spinReverse: false, | ||
beat: false, | ||
fade: false, | ||
beatFade: false, | ||
bounce: false, | ||
shake: false, | ||
symbol: false, | ||
title: '', | ||
titleId: null, | ||
transform: null, | ||
swapOpacity: false | ||
}; | ||
var convertCurry = convert.bind(null, React__default["default"].createElement); | ||
@@ -437,0 +439,0 @@ |
{ | ||
"name": "@fortawesome/react-fontawesome", | ||
"description": "Official React component for Font Awesome 5", | ||
"version": "0.2.0", | ||
"description": "Official React component for Font Awesome", | ||
"version": "0.2.1", | ||
"main": "index.js", | ||
@@ -30,3 +30,4 @@ "module": "index.es.js", | ||
"Alexey Victorov <github.com/AliMamed>", | ||
"Calum Smith <github.com/cpmsmith>" | ||
"Calum Smith <github.com/cpmsmith>", | ||
"squiaios <github.com/squiaios>" | ||
], | ||
@@ -90,3 +91,4 @@ "license": "MIT", | ||
"react-test-renderer": "^17.0.2", | ||
"rollup": "^2.64.0" | ||
"rollup": "^2.64.0", | ||
"semver": "^7.3.7" | ||
}, | ||
@@ -93,0 +95,0 @@ "dependencies": { |
@@ -9,3 +9,3 @@ <a href="https://fontawesome.com"> | ||
> Font Awesome 5 React component using SVG with JS | ||
> Font Awesome React component using SVG with JS | ||
@@ -67,2 +67,3 @@ <!-- toc --> | ||
| Calum Smith | [@cpmsmith](https://github.com/cpmsmith) | | ||
| squiaios | [@squiaios](https://github.com/squiaios) | | ||
| Font Awesome Team | [@FortAwesome](https://github.com/orgs/FortAwesome/people)| | ||
@@ -69,0 +70,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
37667
776
74
36