@fortawesome/react-fontawesome
Advanced tools
Comparing version 0.1.8 to 0.1.9
@@ -9,2 +9,10 @@ # Change Log | ||
## [0.1.9](https://github.com/FortAwesome/react-fontawesome/releases/tag/0.1.9) - 2020-03-05 | ||
### Fixed | ||
- Have FontAwesomeIconProps interface extend SVGAttributes, fixes #324 | ||
--- | ||
## [0.1.8](https://github.com/FortAwesome/react-fontawesome/releases/tag/0.1.8) - 2019-12-06 | ||
@@ -11,0 +19,0 @@ |
/// <reference types="react" /> | ||
import { CSSProperties, DOMAttributes } from 'react' | ||
import { CSSProperties, SVGAttributes } from 'react' | ||
import { | ||
@@ -23,3 +23,3 @@ Transform, | ||
export interface FontAwesomeIconProps extends BackwardCompatibleOmit<DOMAttributes<SVGSVGElement>, 'children' | 'mask'> { | ||
export interface FontAwesomeIconProps extends BackwardCompatibleOmit<SVGAttributes<SVGSVGElement>, 'children' | 'mask' | 'transform'> { | ||
icon: IconProp | ||
@@ -26,0 +26,0 @@ mask?: IconProp |
@@ -34,16 +34,31 @@ import { parse, icon } from '@fortawesome/fontawesome-svg-core'; | ||
function _objectSpread(target) { | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
if (Object.getOwnPropertySymbols) { | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
if (enumerableOnly) symbols = symbols.filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
}); | ||
keys.push.apply(keys, symbols); | ||
} | ||
return keys; | ||
} | ||
function _objectSpread2(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; | ||
})); | ||
if (i % 2) { | ||
ownKeys(Object(source), true).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} else if (Object.getOwnPropertyDescriptors) { | ||
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); | ||
} else { | ||
ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
} | ||
ownKeys.forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} | ||
@@ -195,2 +210,4 @@ | ||
}); | ||
/* eslint-disable dot-notation */ | ||
var mixins = Object.keys(element.attributes || {}).reduce(function (acc, key) { | ||
@@ -227,4 +244,6 @@ var val = element.attributes[key]; | ||
mixins.attrs['style'] = _objectSpread({}, mixins.attrs['style'], existingStyle); | ||
return createElement.apply(void 0, [element.tag, _objectSpread({}, mixins.attrs, remaining)].concat(_toConsumableArray(children))); | ||
mixins.attrs['style'] = _objectSpread2({}, mixins.attrs['style'], {}, existingStyle); | ||
/* eslint-enable */ | ||
return createElement.apply(void 0, [element.tag, _objectSpread2({}, mixins.attrs, {}, remaining)].concat(_toConsumableArray(children))); | ||
} | ||
@@ -247,5 +266,5 @@ | ||
// Normalize icon arguments | ||
function normalizeIconArgs(icon$$1) { | ||
function normalizeIconArgs(icon) { | ||
// if the icon is null, there's nothing to do | ||
if (icon$$1 === null) { | ||
if (icon === null) { | ||
return null; | ||
@@ -255,12 +274,12 @@ } // if the icon is an object and has a prefix and an icon name, return it | ||
if (_typeof(icon$$1) === 'object' && icon$$1.prefix && icon$$1.iconName) { | ||
return icon$$1; | ||
if (_typeof(icon) === 'object' && icon.prefix && icon.iconName) { | ||
return icon; | ||
} // if it's an array with length of two | ||
if (Array.isArray(icon$$1) && icon$$1.length === 2) { | ||
if (Array.isArray(icon) && icon.length === 2) { | ||
// use the first item as prefix, second as icon name | ||
return { | ||
prefix: icon$$1[0], | ||
iconName: icon$$1[1] | ||
prefix: icon[0], | ||
iconName: icon[1] | ||
}; | ||
@@ -270,6 +289,6 @@ } // if it's a string, use it as the icon name | ||
if (typeof icon$$1 === 'string') { | ||
if (typeof icon === 'string') { | ||
return { | ||
prefix: 'fas', | ||
iconName: icon$$1 | ||
iconName: icon | ||
}; | ||
@@ -300,3 +319,3 @@ } | ||
var mask = objectWithKey('mask', normalizeIconArgs(maskArgs)); | ||
var renderedIcon = icon(iconLookup, _objectSpread({}, classes, transform, mask, { | ||
var renderedIcon = icon(iconLookup, _objectSpread2({}, classes, {}, transform, {}, mask, { | ||
symbol: symbol, | ||
@@ -314,2 +333,3 @@ title: title | ||
Object.keys(props).forEach(function (key) { | ||
// eslint-disable-next-line no-prototype-builtins | ||
if (!FontAwesomeIcon.defaultProps.hasOwnProperty(key)) { | ||
@@ -316,0 +336,0 @@ extraProps[key] = props[key]; |
50
index.js
@@ -5,3 +5,3 @@ (function (global, factory) { | ||
(global = global || self, factory(global['react-fontawesome'] = {}, global.FontAwesome, global.PropTypes, global.React)); | ||
}(this, function (exports, fontawesomeSvgCore, PropTypes, React) { 'use strict'; | ||
}(this, (function (exports, fontawesomeSvgCore, PropTypes, React) { 'use strict'; | ||
@@ -40,16 +40,31 @@ PropTypes = PropTypes && PropTypes.hasOwnProperty('default') ? PropTypes['default'] : PropTypes; | ||
function _objectSpread(target) { | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
if (Object.getOwnPropertySymbols) { | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
if (enumerableOnly) symbols = symbols.filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
}); | ||
keys.push.apply(keys, symbols); | ||
} | ||
return keys; | ||
} | ||
function _objectSpread2(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; | ||
})); | ||
if (i % 2) { | ||
ownKeys(Object(source), true).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} else if (Object.getOwnPropertyDescriptors) { | ||
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); | ||
} else { | ||
ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
} | ||
ownKeys.forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} | ||
@@ -201,2 +216,4 @@ | ||
}); | ||
/* eslint-disable dot-notation */ | ||
var mixins = Object.keys(element.attributes || {}).reduce(function (acc, key) { | ||
@@ -233,4 +250,6 @@ var val = element.attributes[key]; | ||
mixins.attrs['style'] = _objectSpread({}, mixins.attrs['style'], existingStyle); | ||
return createElement.apply(void 0, [element.tag, _objectSpread({}, mixins.attrs, remaining)].concat(_toConsumableArray(children))); | ||
mixins.attrs['style'] = _objectSpread2({}, mixins.attrs['style'], {}, existingStyle); | ||
/* eslint-enable */ | ||
return createElement.apply(void 0, [element.tag, _objectSpread2({}, mixins.attrs, {}, remaining)].concat(_toConsumableArray(children))); | ||
} | ||
@@ -303,3 +322,3 @@ | ||
var mask = objectWithKey('mask', normalizeIconArgs(maskArgs)); | ||
var renderedIcon = fontawesomeSvgCore.icon(iconLookup, _objectSpread({}, classes, transform, mask, { | ||
var renderedIcon = fontawesomeSvgCore.icon(iconLookup, _objectSpread2({}, classes, {}, transform, {}, mask, { | ||
symbol: symbol, | ||
@@ -317,2 +336,3 @@ title: title | ||
Object.keys(props).forEach(function (key) { | ||
// eslint-disable-next-line no-prototype-builtins | ||
if (!FontAwesomeIcon.defaultProps.hasOwnProperty(key)) { | ||
@@ -369,2 +389,2 @@ extraProps[key] = props[key]; | ||
})); | ||
}))); |
{ | ||
"name": "@fortawesome/react-fontawesome", | ||
"description": "Official React component for Font Awesome 5", | ||
"version": "0.1.8", | ||
"version": "0.1.9", | ||
"main": "index.js", | ||
@@ -25,3 +25,4 @@ "module": "index.es.js", | ||
"Bill Parrott <github.com/chimericdream>", | ||
"Mike Lynch <github.com/baelec>" | ||
"Mike Lynch <github.com/baelec>", | ||
"Lukáš Rod <github.com/rodlukas>" | ||
], | ||
@@ -33,3 +34,3 @@ "license": "MIT", | ||
"lint": "eslint src", | ||
"prettier": "pretty-quick src --staged", | ||
"prettier": "pretty-quick --pattern src/** --staged", | ||
"precommit": "npm run lint && npm run prettier && lint-staged", | ||
@@ -51,39 +52,39 @@ "prepack": "npm run dist", | ||
"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/core": "^7.7.5", | ||
"@babel/plugin-external-helpers": "^7.7.4", | ||
"@babel/preset-env": "^7.7.5", | ||
"@babel/preset-react": "^7.7.4", | ||
"@babel/preset-stage-3": "^7.0.0", | ||
"@fortawesome/fontawesome-svg-core": "^1.2.0-7", | ||
"@types/react": "^16.4.8", | ||
"babel-core": "^7.0.0-0", | ||
"babel-eslint": "^10.0.0", | ||
"babel-jest": "^23.6.0", | ||
"browserslist": "^4.6.6", | ||
"caniuse-lite": "^1.0.30000987", | ||
"cross-env": "^5.1.1", | ||
"eslint": "^5.3.0", | ||
"eslint-config-standard": "^11.0.0-beta.0", | ||
"eslint-plugin-import": "^2.8.0", | ||
"eslint-plugin-jest": "^21.7.0", | ||
"eslint-plugin-node": "^7.0.1", | ||
"eslint-plugin-promise": "^3.6.0", | ||
"eslint-plugin-react": "^7.5.1", | ||
"eslint-plugin-standard": "^3.0.1", | ||
"husky": "^0.14.3", | ||
"jest": "^23.6.0", | ||
"lint-staged": "^7.2.0", | ||
"@fortawesome/fontawesome-svg-core": "^1.2.25", | ||
"@types/react": "^16.9.15", | ||
"babel-eslint": "^10.0.3", | ||
"babel-jest": "^24.9.0", | ||
"browserslist": "^4.8.2", | ||
"caniuse-lite": "^1.0.30001015", | ||
"cross-env": "^6.0.3", | ||
"eslint": "^6.7.2", | ||
"eslint-config-standard": "^14.1.0", | ||
"eslint-plugin-compat": "^3.3.0", | ||
"eslint-plugin-import": "^2.18.2", | ||
"eslint-plugin-jest": "^23.1.1", | ||
"eslint-plugin-node": "^10.0.0", | ||
"eslint-plugin-promise": "^4.2.1", | ||
"eslint-plugin-react": "^7.17.0", | ||
"eslint-plugin-standard": "^4.0.1", | ||
"husky": "^3.1.0", | ||
"jest": "^24.9.0", | ||
"lint-staged": "^9.5.0", | ||
"markdown-toc": "^1.2.0", | ||
"prettier": "^1.11.1", | ||
"pretty-quick": "^1.2.2", | ||
"prop-types": "^15.5.10", | ||
"react": "^16.2.0", | ||
"prettier": "^1.19.1", | ||
"pretty-quick": "^2.0.1", | ||
"react": "^16.4.2", | ||
"react-dom": "^16.12.0", | ||
"react-test-renderer": "^16.2.0", | ||
"rollup": "^1.0.0", | ||
"rollup-plugin-babel": "^4.2.0", | ||
"rollup-plugin-commonjs": "^9.2.0", | ||
"rollup-plugin-node-resolve": "^4.0.0" | ||
"rollup": "^1.27.8", | ||
"rollup-plugin-babel": "^4.3.3", | ||
"rollup-plugin-commonjs": "^10.1.0", | ||
"rollup-plugin-node-resolve": "^5.2.0" | ||
}, | ||
"dependencies": { | ||
"prop-types": "^15.5.10" | ||
"prop-types": "^15.7.2" | ||
}, | ||
@@ -94,3 +95,13 @@ "files": [ | ||
"index.d.ts" | ||
] | ||
], | ||
"browserslist": [ | ||
"> 1%", | ||
"last 2 versions", | ||
"ie > 10" | ||
], | ||
"jest": { | ||
"roots": [ | ||
"src" | ||
] | ||
} | ||
} |
@@ -681,2 +681,3 @@ <a href="https://fontawesome.com"> | ||
| <img src="https://github.com/baelec.png?size=72" /> | Mike Lynch | [@baelec](https://github.com/baelec) | | ||
| <img src="https://github.com/rodlukas.png?size=72" /> | Lukáš Rod | [@rodlukas](https://github.com/rodlukas) | | ||
@@ -683,0 +684,0 @@ If we've missed someone (which is quite likely) submit a Pull Request to us and we'll get it resolved. |
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
56135
668
697
Updatedprop-types@^15.7.2