Skip to content

Commit

Permalink
New v6 sizes and animations (#466)
Browse files Browse the repository at this point in the history
  • Loading branch information
robmadole authored Jan 28, 2022
1 parent c28de56 commit 5b286b3
Show file tree
Hide file tree
Showing 10 changed files with 16,172 additions and 6,449 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:

strategy:
matrix:
node: [10.14.x]
node: [14]
react: [
16.2.x,
16.3.x,
Expand Down
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
nodejs 10.16.2
python 3.7.5
nodejs 14.17.3
python 3.10.1
137 changes: 78 additions & 59 deletions index.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,40 @@ 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;
};
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 _objectSpread2(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 _typeof(obj);
return target;
}

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);
}

function _defineProperty(obj, key, value) {
Expand All @@ -31,40 +53,6 @@ function _defineProperty(obj, key, value) {
return obj;
}

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] : {};

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));
});
}
}

return target;
}

function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
Expand Down Expand Up @@ -102,30 +90,48 @@ function _objectWithoutProperties(source, excluded) {
}

function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(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;
}
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
}

function _iterableToArray(iter) {
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
}

function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}

function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;

for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];

return arr2;
}

function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance");
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

// Get CSS class list from a props object
function classList(props) {
var _classes;

var spin = props.spin,
var beat = props.beat,
fade = props.fade,
flash = props.flash,
spin = props.spin,
spinPulse = props.spinPulse,
spinReverse = props.spinReverse,
pulse = props.pulse,
fixedWidth = props.fixedWidth,
inverse = props.inverse,
Expand All @@ -137,7 +143,12 @@ function classList(props) {
pull = props.pull; // map of CSS class names to properties

var classes = (_classes = {
'fa-beat': beat,
'fa-fade': fade,
'fa-flash': flash,
'fa-spin': spin,
'fa-spin-reverse': spinReverse,
'fa-spin-pulse': spinPulse,
'fa-pulse': pulse,
'fa-fw': fixedWidth,
'fa-inverse': inverse,
Expand Down Expand Up @@ -178,6 +189,8 @@ function camelize(string) {
return string.substr(0, 1).toLowerCase() + string.substr(1);
}

var _excluded$1 = ["style"];

function capitalize(val) {
return val.charAt(0).toUpperCase() + val.slice(1);
}
Expand Down Expand Up @@ -237,12 +250,12 @@ function convert(createElement, element) {

var _extraProps$style = extraProps.style,
existingStyle = _extraProps$style === void 0 ? {} : _extraProps$style,
remaining = _objectWithoutProperties(extraProps, ["style"]);
remaining = _objectWithoutProperties(extraProps, _excluded$1);

mixins.attrs['style'] = _objectSpread2({}, mixins.attrs['style'], {}, existingStyle);
mixins.attrs['style'] = _objectSpread2(_objectSpread2({}, mixins.attrs['style']), existingStyle);
/* eslint-enable */

return createElement.apply(void 0, [element.tag, _objectSpread2({}, mixins.attrs, {}, remaining)].concat(_toConsumableArray(children)));
return createElement.apply(void 0, [element.tag, _objectSpread2(_objectSpread2({}, mixins.attrs), remaining)].concat(_toConsumableArray(children)));
}

var PRODUCTION = false;
Expand Down Expand Up @@ -309,9 +322,10 @@ function objectWithKey(key, value) {
return Array.isArray(value) && value.length > 0 || !Array.isArray(value) && value ? _defineProperty({}, key, value) : {};
}

var _excluded = ["forwardedRef"];
function FontAwesomeIcon(_ref) {
var forwardedRef = _ref.forwardedRef,
props = _objectWithoutProperties(_ref, ["forwardedRef"]);
props = _objectWithoutProperties(_ref, _excluded);

var iconArgs = props.icon,
maskArgs = props.mask,
Expand All @@ -323,7 +337,7 @@ function FontAwesomeIcon(_ref) {
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, _objectSpread2({}, classes, {}, transform, {}, mask, {
var renderedIcon = icon(iconLookup, _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, classes), transform), mask), {}, {
symbol: symbol,
title: title,
titleId: titleId
Expand All @@ -348,8 +362,11 @@ function FontAwesomeIcon(_ref) {
}
FontAwesomeIcon.displayName = 'FontAwesomeIcon';
FontAwesomeIcon.propTypes = {
beat: PropTypes.bool,
border: PropTypes.bool,
className: PropTypes.string,
fade: PropTypes.bool,
flash: PropTypes.bool,
mask: PropTypes.oneOfType([PropTypes.object, PropTypes.array, PropTypes.string]),
fixedWidth: PropTypes.bool,
inverse: PropTypes.bool,
Expand All @@ -359,8 +376,10 @@ FontAwesomeIcon.propTypes = {
pull: PropTypes.oneOf(['right', 'left']),
pulse: PropTypes.bool,
rotation: PropTypes.oneOf([0, 90, 180, 270]),
size: PropTypes.oneOf(['lg', 'xs', 'sm', '1x', '2x', '3x', '4x', '5x', '6x', '7x', '8x', '9x', '10x']),
size: PropTypes.oneOf(['2xs', 'xs', 'sm', 'lg', 'xl', '2xl', '1x', '2x', '3x', '4x', '5x', '6x', '7x', '8x', '9x', '10x']),
spin: PropTypes.bool,
spinPulse: PropTypes.bool,
spinReverse: PropTypes.bool,
symbol: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
title: PropTypes.string,
transform: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
Expand Down
Loading

0 comments on commit 5b286b3

Please sign in to comment.