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

react-flag-icon-css

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-flag-icon-css - npm Package Compare versions

Comparing version 1.0.24 to 1.0.25

18

CHANGELOG.md

@@ -0,1 +1,19 @@

<a name="1.0.25"></a>
## 1.0.25 (2019-01-16)
* chore: invert order of 'yarn' and 'npm' install ([2f8f94a](https://github.com/matteocng/react-flag-icon-css/commit/2f8f94a))
* chore: remove node 9 and add node 11 to 'travis' (ava does not support node 9) ([8c51a9e](https://github.com/matteocng/react-flag-icon-css/commit/8c51a9e))
* chore: upgrade 'babel' to version 7, 'ava' to version 1, 'react' and other modules ([7d705b3](https://github.com/matteocng/react-flag-icon-css/commit/7d705b3)), closes [#110](https://github.com/matteocng/react-flag-icon-css/issues/110)
* chore(package): update 'flow-bin' to version 0.77.0 ([b3a96d8](https://github.com/matteocng/react-flag-icon-css/commit/b3a96d8))
* chore(package): update babel-eslint to version 9.0.0 ([8cfce57](https://github.com/matteocng/react-flag-icon-css/commit/8cfce57))
* chore(package): update eslint-config-prettier to version 3.0.0 ([b21bb53](https://github.com/matteocng/react-flag-icon-css/commit/b21bb53))
* chore(package): update eslint-plugin-flowtype to version 3.0.0 ([ebd484e](https://github.com/matteocng/react-flag-icon-css/commit/ebd484e))
* chore(package): update lockfile package-lock.json ([f578807](https://github.com/matteocng/react-flag-icon-css/commit/f578807))
* chore(package): update lockfiles ([f2daf1c](https://github.com/matteocng/react-flag-icon-css/commit/f2daf1c))
* chore(package): update lockfiles ([59d9ddf](https://github.com/matteocng/react-flag-icon-css/commit/59d9ddf))
* chore(package): update postcss-cli to version 6.0.0 ([890c05f](https://github.com/matteocng/react-flag-icon-css/commit/890c05f))
* docs: add links to the 'webpack 4' example ([eb7390b](https://github.com/matteocng/react-flag-icon-css/commit/eb7390b))
<a name="1.0.24"></a>

@@ -2,0 +20,0 @@ ## <small>1.0.24 (2018-07-17)</small>

19

lib/FlagIcon/FlagIcon.js

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,4 +6,5 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = void 0;
var _functions = require('../functions');
var _functions = require("../functions");

@@ -13,13 +14,11 @@ var FlagIcon = function FlagIcon(React, options, styles) {

var _props$Component = props.Component,
Component = _props$Component === undefined ? 'span' : _props$Component,
Component = _props$Component === void 0 ? 'span' : _props$Component,
children = props.children;
return React.createElement(
Component,
{ className: (0, _functions.makeClassnames)(props, options, styles) },
children
);
return React.createElement(Component, {
className: (0, _functions.makeClassnames)(props, options, styles)
}, children);
};
};
exports.default = FlagIcon;
var _default = FlagIcon;
exports.default = _default;

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,24 +6,26 @@ Object.defineProperty(exports, "__esModule", {

});
exports.CustomFlagIconFactory = undefined;
exports.CustomFlagIconFactory = exports.default = void 0;
var _FlagIcon = require('./FlagIcon');
var _FlagIcon = _interopRequireDefault(require("./FlagIcon"));
var _FlagIcon2 = _interopRequireDefault(_FlagIcon);
var _styles = _interopRequireDefault(require("../styles"));
var _styles = require('../styles');
var _functions = require("../functions");
var _styles2 = _interopRequireDefault(_styles);
var _props = require("../functions/props");
var _functions = require('../functions');
var _styles2 = require("../functions/styles");
var _props = require('../functions/props');
var _propTypes = require("../types/propTypes");
var _styles3 = require('../functions/styles');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _propTypes = require('../types/propTypes');
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
function _toConsumableArray(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 _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
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; } }
var FlagIconFactory = function FlagIconFactory(React, options) {

@@ -33,16 +35,16 @@ var computedOptions = (0, _functions.makeFlagIconOptions)(options);

customCodes = computedOptions.customCodes;
var FlagIconComponent = null;
if (useCssModules) {
var computedStyles = (0, _functions.makeStyles)(_styles2.default, options);
var computedStyles = (0, _functions.makeStyles)(_styles.default, options);
if (process.env.NODE_ENV !== 'production') {
(0, _styles3.validateStyles)(computedStyles, computedOptions, options);
(0, _styles2.validateStyles)(computedStyles, computedOptions, options);
}
FlagIconComponent = (0, _FlagIcon2.default)(React, computedOptions, computedStyles);
FlagIconComponent = (0, _FlagIcon.default)(React, computedOptions, computedStyles);
} else {
FlagIconComponent = (0, _FlagIcon2.default)(React, computedOptions);
FlagIconComponent = (0, _FlagIcon.default)(React, computedOptions);
}
FlagIconComponent.displayName = 'FlagIcon';

@@ -63,8 +65,9 @@

exports.default = FlagIconFactory;
var _default = FlagIconFactory;
exports.default = _default;
var CustomFlagIconFactory = function CustomFlagIconFactory(React, options) {
return FlagIconFactory(React, options);
};
exports.CustomFlagIconFactory = CustomFlagIconFactory;

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,14 +6,10 @@ Object.defineProperty(exports, "__esModule", {

});
exports.makeClassesObject = undefined;
exports.default = exports.makeClassesObject = void 0;
var _classnames = require('classnames');
var _classnames = _interopRequireDefault(require("classnames"));
var _classnames2 = _interopRequireDefault(_classnames);
var _classNameToStyleName = _interopRequireDefault(require("./classNameToStyleName"));
var _classNameToStyleName = require('./classNameToStyleName');
var _constants = require("./constants");
var _classNameToStyleName2 = _interopRequireDefault(_classNameToStyleName);
var _constants = require('./constants');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -23,3 +19,3 @@

var makeClassesObject = exports.makeClassesObject = function makeClassesObject(props, options) {
var makeClassesObject = function makeClassesObject(props, options) {
var _ref;

@@ -29,7 +25,7 @@

_props$flip = props.flip,
flip = _props$flip === undefined ? '' : _props$flip,
flip = _props$flip === void 0 ? '' : _props$flip,
_props$size = props.size,
size = _props$size === undefined ? '' : _props$size,
size = _props$size === void 0 ? '' : _props$size,
_props$squared = props.squared,
squared = _props$squared === undefined ? false : _props$squared,
squared = _props$squared === void 0 ? false : _props$squared,
rotate = props.rotate,

@@ -40,27 +36,25 @@ className = props.className,

useCssModules = options.useCssModules;
return _ref = {}, _defineProperty(_ref, _constants.flagIconClassesPrefixName, true), _defineProperty(_ref, "".concat(_constants.flagIconClassesPrefix, "squared"), squared), _defineProperty(_ref, "".concat(_constants.flagIconClassesPrefix).concat(size), size), _defineProperty(_ref, "".concat(_constants.flagIconClassesPrefix).concat(code), code), _defineProperty(_ref, "".concat(_constants.flagIconClassesPrefix, "flip-").concat(flip), flip), _defineProperty(_ref, "".concat(_constants.flagIconClassesPrefix, "rotate-").concat(rotate || ''), rotate), _defineProperty(_ref, _constants.baseThemeStyleName, useCssModules && themeStyles && themeStyles[_constants.baseThemeStyleName]), _defineProperty(_ref, styleName || '', useCssModules && themeStyles && styleName && themeStyles[styleName]), _defineProperty(_ref, className || '', className), _ref;
};
exports.makeClassesObject = makeClassesObject;
return _ref = {}, _defineProperty(_ref, _constants.flagIconClassesPrefixName, true), _defineProperty(_ref, _constants.flagIconClassesPrefix + 'squared', squared), _defineProperty(_ref, '' + _constants.flagIconClassesPrefix + size, size), _defineProperty(_ref, '' + _constants.flagIconClassesPrefix + code, code), _defineProperty(_ref, _constants.flagIconClassesPrefix + 'flip-' + flip, flip), _defineProperty(_ref, _constants.flagIconClassesPrefix + 'rotate-' + (rotate || ''), rotate), _defineProperty(_ref, _constants.baseThemeStyleName, useCssModules && themeStyles && themeStyles[_constants.baseThemeStyleName]), _defineProperty(_ref, styleName || '', useCssModules && themeStyles && styleName && themeStyles[styleName]), _defineProperty(_ref, className || '', className), _ref;
};
exports.default = function (props, options, styles) {
var _default = function _default(props, options, styles) {
var useCssModules = options.useCssModules;
var classesObject = makeClassesObject(props, options);
var strClasses = (0, _classnames2.default)(classesObject);
var strClasses = (0, _classnames.default)(classesObject);
if (useCssModules) {
var className = props.className;
var aClasses = strClasses.split(' ');
var nClasses = aClasses.length;
strClasses = aClasses.map(function (c, i) {
if (className && i === nClasses - 1) return c;
return (0, _classNameToStyleName2.default)(c, styles || {});
return (0, _classNameToStyleName.default)(c, styles || {});
}).join(' ');
}
return strClasses;
};
};
exports.default = _default;

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,9 +6,12 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = void 0;
exports.default = function (className, styles) {
var _default = function _default(className, styles) {
if (!styles[className]) {
throw new Error('Could not resolve the styleName ' + className);
throw new Error("Could not resolve the styleName ".concat(className));
}
return styles[className];
};
};
exports.default = _default;

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,5 +6,10 @@ Object.defineProperty(exports, "__esModule", {

});
var baseThemeStyleName = exports.baseThemeStyleName = 'theme-base';
var flagIconClassesPrefixName = exports.flagIconClassesPrefixName = 'flag-icon';
var flagIconClassesPrefix = exports.flagIconClassesPrefix = flagIconClassesPrefixName + '-';
var flagIconModulePath = exports.flagIconModulePath = 'node_modules/flag-icon-css';
exports.flagIconModulePath = exports.flagIconClassesPrefix = exports.flagIconClassesPrefixName = exports.baseThemeStyleName = void 0;
var baseThemeStyleName = 'theme-base';
exports.baseThemeStyleName = baseThemeStyleName;
var flagIconClassesPrefixName = 'flag-icon';
exports.flagIconClassesPrefixName = flagIconClassesPrefixName;
var flagIconClassesPrefix = "".concat(flagIconClassesPrefixName, "-");
exports.flagIconClassesPrefix = flagIconClassesPrefix;
var flagIconModulePath = 'node_modules/flag-icon-css';
exports.flagIconModulePath = flagIconModulePath;

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,6 +6,3 @@ Object.defineProperty(exports, "__esModule", {

});
var _props = require('./props');
Object.defineProperty(exports, 'getCountries', {
Object.defineProperty(exports, "getCountries", {
enumerable: true,

@@ -16,3 +13,3 @@ get: function get() {

});
Object.defineProperty(exports, 'getCountryCodes', {
Object.defineProperty(exports, "getCountryCodes", {
enumerable: true,

@@ -22,2 +19,4 @@ get: function get() {

}
});
});
var _props = require("./props");

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,13 +6,9 @@ Object.defineProperty(exports, "__esModule", {

});
exports.constants = exports.countries = exports.makeStyles = exports.makeFlagIconOptions = exports.makeClassesObject = exports.makeClassnames = undefined;
var _classnames = require('./classnames');
Object.defineProperty(exports, 'makeClassnames', {
Object.defineProperty(exports, "makeClassnames", {
enumerable: true,
get: function get() {
return _interopRequireDefault(_classnames).default;
return _classnames.default;
}
});
Object.defineProperty(exports, 'makeClassesObject', {
Object.defineProperty(exports, "makeClassesObject", {
enumerable: true,

@@ -23,34 +19,32 @@ get: function get() {

});
var _options = require('./options');
Object.defineProperty(exports, 'makeFlagIconOptions', {
Object.defineProperty(exports, "makeFlagIconOptions", {
enumerable: true,
get: function get() {
return _interopRequireDefault(_options).default;
return _options.default;
}
});
var _styles = require('./styles');
Object.defineProperty(exports, 'makeStyles', {
Object.defineProperty(exports, "makeStyles", {
enumerable: true,
get: function get() {
return _interopRequireDefault(_styles).default;
return _styles.default;
}
});
exports.constants = exports.countries = void 0;
var _countries2 = require('./countries');
var _classnames = _interopRequireWildcard(require("./classnames"));
var _countries = _interopRequireWildcard(_countries2);
var _options = _interopRequireDefault(require("./options"));
var _constants2 = require('./constants');
var _styles = _interopRequireDefault(require("./styles"));
var _constants = _interopRequireWildcard(_constants2);
var _countries = _interopRequireWildcard(require("./countries"));
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
exports.countries = _countries;
var _constants = _interopRequireWildcard(require("./constants"));
exports.constants = _constants;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.countries = _countries;
exports.constants = _constants;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,12 +6,13 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = void 0;
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 _propTypes = _interopRequireDefault(require("prop-types"));
var _propTypes = require('prop-types');
var _propTypes2 = require("../types/propTypes");
var _propTypes2 = _interopRequireDefault(_propTypes);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _propTypes3 = require('../types/propTypes');
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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: 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; }

@@ -22,7 +23,10 @@ var defaultOptions = {

exports.default = function (options) {
var computedOptions = _extends({}, defaultOptions, options);
var _default = function _default(options) {
var computedOptions = _objectSpread({}, defaultOptions, options);
_propTypes2.default.checkPropTypes((0, _propTypes3.MakeFlagIconOptionsPropType)(), computedOptions, 'key', 'FlagIconFactory options');
_propTypes.default.checkPropTypes((0, _propTypes2.MakeFlagIconOptionsPropType)(), computedOptions, 'key', 'FlagIconFactory options');
return computedOptions;
};
};
exports.default = _default;

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,11 +6,13 @@ Object.defineProperty(exports, "__esModule", {

});
exports.getSizes = exports.getRotates = exports.getFlips = exports.getCountryCodes = exports.getCountries = undefined;
exports.getSizes = exports.getRotates = exports.getFlips = exports.getCountryCodes = exports.getCountries = void 0;
var _enums = require('../static/enums');
var _enums = require("../static/enums");
var getCountries = exports.getCountries = function getCountries() {
var getCountries = function getCountries() {
return _enums.countries;
};
var getCountryCodes = exports.getCountryCodes = function getCountryCodes() {
exports.getCountries = getCountries;
var getCountryCodes = function getCountryCodes() {
return _enums.countries.map(function (country) {

@@ -21,12 +23,20 @@ return country.code;

var getFlips = exports.getFlips = function getFlips() {
exports.getCountryCodes = getCountryCodes;
var getFlips = function getFlips() {
return _enums.flips;
};
var getRotates = exports.getRotates = function getRotates() {
exports.getFlips = getFlips;
var getRotates = function getRotates() {
return _enums.rotates;
};
var getSizes = exports.getSizes = function getSizes() {
exports.getRotates = getRotates;
var getSizes = function getSizes() {
return _enums.sizes;
};
};
exports.getSizes = getSizes;

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,5 +6,8 @@ Object.defineProperty(exports, "__esModule", {

});
exports.AddNoExtraPropsValidator = exports.AddThemeStylesValidator = void 0;
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 _this = void 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 (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 _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; }

@@ -15,3 +18,2 @@

customCodes = propsValues.customCodes;
if (!useCssModules) return;

@@ -22,14 +24,13 @@

if (themeStyles) {
var themeStylesClassNames = Object.keys(themeStyles);
var result = Object.keys(customCodes).filter(function (customCode) {
return !themeStylesClassNames.includes('flag-icon-' + customCode);
return !themeStylesClassNames.includes("flag-icon-".concat(customCode));
});
if (result.length > 0) {
return new Error('Invalid prop(s) `themeStyles` supplied to `' + componentName + '`, expected `.flag-icon-[' + result.join('/') + ']`.');
return new Error("Invalid prop(s) `themeStyles` supplied to `".concat(componentName, "`, expected `.flag-icon-[").concat(result.join('/'), "]`."));
}
} else {
return new Error('Missing required prop(s) `themeStyles` supplied to `' + componentName + '`.');
return new Error("Missing required prop(s) `themeStyles` supplied to `".concat(componentName, "`."));
}

@@ -39,4 +40,5 @@ }

var AddThemeStylesValidator = exports.AddThemeStylesValidator = function AddThemeStylesValidator(obj) {
var AddThemeStylesValidator = function AddThemeStylesValidator(obj) {
var validatorKeyName = '__themeStyles__';
if (Object.prototype.hasOwnProperty.call(obj, validatorKeyName)) {

@@ -46,5 +48,7 @@ return obj;

return _extends({}, obj, _defineProperty({}, validatorKeyName, fnThemeStylesValidator.bind(undefined, obj)));
return _objectSpread({}, obj, _defineProperty({}, validatorKeyName, fnThemeStylesValidator.bind(_this, obj)));
};
exports.AddThemeStylesValidator = AddThemeStylesValidator;
var fnNoExtraPropsValidator = function fnNoExtraPropsValidator(propsObject, propsValues, propName, componentName) {

@@ -57,8 +61,9 @@ var passedPropNames = Object.keys(propsValues);

if (extra.length > 0) {
return new Error('Invalid prop(s) ' + JSON.stringify(extra) + ' supplied to `' + componentName + '`, expected one of [' + passedPropNames.join(',') + '].');
return new Error("Invalid prop(s) ".concat(JSON.stringify(extra), " supplied to `").concat(componentName, "`, expected one of [").concat(passedPropNames.join(','), "]."));
}
};
var AddNoExtraPropsValidator = exports.AddNoExtraPropsValidator = function AddNoExtraPropsValidator(obj) {
var AddNoExtraPropsValidator = function AddNoExtraPropsValidator(obj) {
var validatorKeyName = '__no__extra__props__validator___';
if (Object.prototype.hasOwnProperty.call(obj, validatorKeyName)) {

@@ -68,3 +73,5 @@ return obj;

return _extends({}, obj, _defineProperty({}, validatorKeyName, fnNoExtraPropsValidator.bind(undefined, obj)));
};
return _objectSpread({}, obj, _defineProperty({}, validatorKeyName, fnNoExtraPropsValidator.bind(_this, obj)));
};
exports.AddNoExtraPropsValidator = AddNoExtraPropsValidator;

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,8 +6,12 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = exports.validateStyles = void 0;
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; };
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; }
var validateStyles = exports.validateStyles = function validateStyles(styles, computedOptions, options) {
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; }
var validateStyles = function validateStyles(styles, computedOptions, options) {
if (process.env.NODE_ENV !== 'production') {
if (!computedOptions) throw Error('Passing `computedOptions` is required.');
if (!computedOptions.useCssModules) {

@@ -22,4 +26,3 @@ throw Error('Cannot validate global CSS.');

var readmeModules = 'https://github.com/gajus/react-css-modules#usage';
console.error('Warning: Detected configuration mismatch/error: [react-flag-icon-css] FlagIconFactory tried to build FlagIcon with the option \'useCssModules\' set to true (' + (userSetUseCssModules ? 'by you' : 'default') + '), but it seems that your environment is not loading the stylesheets in the appropriate way. Two possibilities: \n\n 1. Your project is not using CSS Modules / you don\'t want to use them. Try building FlagIcon like this: \n\n\timport * as React from \'react\' \n\n\tconst FlagIcon = FlagIconFactory(React, { useCssModules: false }) \n\n\tSee the README for more info: ' + readme + ' \n\n 2. You are using CSS Modules but your module bundler e.g Webpack is not correctly set up for CSS modules. If you are using Webpack, the key modules to set up are \'style-loader\', \'css-loader\' and \'extract-text-webpack-plugin\' (\'sass-loader\' also comes into play if you are using SASS). The link below may help you:\n\n\t' + readmeModules);
console.error("Warning: Detected configuration mismatch/error: [react-flag-icon-css] FlagIconFactory tried to build FlagIcon with the option 'useCssModules' set to true (".concat(userSetUseCssModules ? 'by you' : 'default', "), but it seems that your environment is not loading the stylesheets in the appropriate way. Two possibilities: \n\n 1. Your project is not using CSS Modules / you don't want to use them. Try building FlagIcon like this: \n\n\timport * as React from 'react' \n\n\tconst FlagIcon = FlagIconFactory(React, { useCssModules: false }) \n\n\tSee the README for more info: ").concat(readme, " \n\n 2. You are using CSS Modules but your module bundler e.g Webpack is not correctly set up for CSS modules. If you are using Webpack, the key modules to set up are 'style-loader', 'css-loader' and 'extract-text-webpack-plugin' ('sass-loader' also comes into play if you are using SASS). The link below may help you:\n\n\t").concat(readmeModules));
}

@@ -29,4 +32,8 @@ }

exports.default = function (styles, options) {
return options && options.themeStyles ? _extends({}, styles, options.themeStyles) : styles;
};
exports.validateStyles = validateStyles;
var _default = function _default(styles, options) {
return options && options.themeStyles ? _objectSpread({}, styles, options.themeStyles) : styles;
};
exports.default = _default;

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,13 +6,9 @@ Object.defineProperty(exports, "__esModule", {

});
exports.functions = exports.types = exports.CustomFlagIconFactory = exports.default = undefined;
var _FlagIconFactory = require('./FlagIcon/FlagIconFactory');
Object.defineProperty(exports, 'default', {
Object.defineProperty(exports, "default", {
enumerable: true,
get: function get() {
return _interopRequireDefault(_FlagIconFactory).default;
return _FlagIconFactory.default;
}
});
Object.defineProperty(exports, 'CustomFlagIconFactory', {
Object.defineProperty(exports, "CustomFlagIconFactory", {
enumerable: true,

@@ -23,16 +19,14 @@ get: function get() {

});
exports.functions = exports.types = void 0;
var _flow = require('./types/flow');
var _FlagIconFactory = _interopRequireWildcard(require("./FlagIcon/FlagIconFactory"));
var _types = _interopRequireWildcard(_flow);
var _types = _interopRequireWildcard(require("./types/flow"));
var _functions2 = require('./functions');
exports.types = _types;
var _functions = _interopRequireWildcard(_functions2);
var _functions = _interopRequireWildcard(require("./functions"));
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
exports.functions = _functions;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.types = _types;
exports.functions = _functions;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,9 +6,10 @@ Object.defineProperty(exports, "__esModule", {

});
var sizes = exports.sizes = ['lg', '2x', '3x', '4x', '5x'];
var rotates = exports.rotates = [30, 60, 90, 180, 270];
var flips = exports.flips = ['horizontal', 'vertical'];
var countries = exports.countries = [{
exports.countries = exports.flips = exports.rotates = exports.sizes = void 0;
var sizes = ['lg', '2x', '3x', '4x', '5x'];
exports.sizes = sizes;
var rotates = [30, 60, 90, 180, 270];
exports.rotates = rotates;
var flips = ['horizontal', 'vertical'];
exports.flips = flips;
var countries = [{
name: 'Afghanistan',

@@ -781,2 +782,3 @@ code: 'af'

code: 'zw'
}];
}];
exports.countries = countries;

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,17 +6,17 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = void 0;
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 _flagIcon = _interopRequireDefault(require("flag-icon-css/css/flag-icon.css"));
var _flagIcon = require('flag-icon-css/css/flag-icon.css');
var _main = _interopRequireDefault(require("./styles/main.css"));
var _flagIcon2 = _interopRequireDefault(_flagIcon);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _main = require('./styles/main.css');
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; }
var _main2 = _interopRequireDefault(_main);
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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var finalStyles = _objectSpread({}, _flagIcon.default, _main.default);
var finalStyles = _extends({}, _flagIcon2.default, _main2.default);
exports.default = finalStyles;
var _default = finalStyles;
exports.default = _default;

@@ -1,1 +0,1 @@

'use strict';
"use strict";

@@ -1,1 +0,1 @@

'use strict';
"use strict";

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,22 +6,24 @@ Object.defineProperty(exports, "__esModule", {

});
exports.MakeFlagIconOptionsPropType = exports.MakeFlagIconPropsType = undefined;
exports.MakeFlagIconOptionsPropType = exports.MakeFlagIconPropsType = void 0;
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 _propTypes = _interopRequireDefault(require("prop-types"));
var _propTypes = require('prop-types');
var _props = require("../functions/props");
var _propTypes2 = _interopRequireDefault(_propTypes);
var _propTypes2 = require("../functions/propTypes");
var _props = require('../functions/props');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _propTypes3 = require('../functions/propTypes');
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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: 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; }
var FlagIconSizeType = _propTypes2.default.oneOf((0, _props.getSizes)());
var FlagIconRotateType = _propTypes2.default.oneOf((0, _props.getRotates)());
var FlagIconFlipType = _propTypes2.default.oneOf((0, _props.getFlips)());
var FlagIconSizeType = _propTypes.default.oneOf((0, _props.getSizes)());
var FlagIconRotateType = _propTypes.default.oneOf((0, _props.getRotates)());
var FlagIconFlipType = _propTypes.default.oneOf((0, _props.getFlips)());
var makeFlagIconCodeType = function makeFlagIconCodeType(codes) {
return _propTypes2.default.oneOf(codes);
return _propTypes.default.oneOf(codes);
};

@@ -33,7 +35,7 @@

size: FlagIconSizeType,
squared: _propTypes2.default.bool,
squared: _propTypes.default.bool,
rotate: FlagIconRotateType,
flip: FlagIconFlipType,
className: _propTypes2.default.string,
styleName: _propTypes2.default.string
className: _propTypes.default.string,
styleName: _propTypes.default.string
};

@@ -43,20 +45,23 @@ };

var makeFlagIconPropsTypeObject = function makeFlagIconPropsTypeObject(codes) {
return _extends({}, makeFlagIconClassesObject(codes), {
children: _propTypes2.default.element,
Component: _propTypes2.default.string
return _objectSpread({}, makeFlagIconClassesObject(codes), {
children: _propTypes.default.element,
Component: _propTypes.default.string
});
};
var MakeFlagIconPropsType = exports.MakeFlagIconPropsType = function MakeFlagIconPropsType(codes) {
return (0, _propTypes3.AddNoExtraPropsValidator)(makeFlagIconPropsTypeObject(codes));
var MakeFlagIconPropsType = function MakeFlagIconPropsType(codes) {
return (0, _propTypes2.AddNoExtraPropsValidator)(makeFlagIconPropsTypeObject(codes));
};
exports.MakeFlagIconPropsType = MakeFlagIconPropsType;
var flagIconOptionsType = {
customCodes: _propTypes2.default.object,
themeStyles: _propTypes2.default.object,
useCssModules: _propTypes2.default.bool
customCodes: _propTypes.default.object,
themeStyles: _propTypes.default.object,
useCssModules: _propTypes.default.bool
};
var MakeFlagIconOptionsPropType = exports.MakeFlagIconOptionsPropType = function MakeFlagIconOptionsPropType() {
return (0, _propTypes3.AddNoExtraPropsValidator)((0, _propTypes3.AddThemeStylesValidator)(flagIconOptionsType));
};
var MakeFlagIconOptionsPropType = function MakeFlagIconOptionsPropType() {
return (0, _propTypes2.AddNoExtraPropsValidator)((0, _propTypes2.AddThemeStylesValidator)(flagIconOptionsType));
};
exports.MakeFlagIconOptionsPropType = MakeFlagIconOptionsPropType;

@@ -1,2 +0,1 @@

import { makeClassnames } from '../functions';

@@ -7,10 +6,7 @@

var _props$Component = props.Component,
Component = _props$Component === undefined ? 'span' : _props$Component,
Component = _props$Component === void 0 ? 'span' : _props$Component,
children = props.children;
return React.createElement(
Component,
{ className: makeClassnames(props, options, styles) },
children
);
return React.createElement(Component, {
className: makeClassnames(props, options, styles)
}, children);
};

@@ -17,0 +13,0 @@ };

@@ -1,3 +0,9 @@

function _toConsumableArray(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 _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
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; } }
import FlagIcon from './FlagIcon';

@@ -10,3 +16,2 @@ import styles from '../styles';

var FlagIconFactory = function FlagIconFactory(React, options) {

@@ -16,4 +21,2 @@ var computedOptions = makeFlagIconOptions(options);

customCodes = computedOptions.customCodes;
var FlagIconComponent = null;

@@ -23,2 +26,3 @@

var computedStyles = makeStyles(styles, options);
if (process.env.NODE_ENV !== 'production') {

@@ -32,2 +36,3 @@ validateStyles(computedStyles, computedOptions, options);

}
FlagIconComponent.displayName = 'FlagIcon';

@@ -53,2 +58,3 @@

};
export { CustomFlagIconFactory };
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; }
import classnames from 'classnames';
import classNameToStyleName from './classNameToStyleName';
import { baseThemeStyleName, flagIconClassesPrefix, flagIconClassesPrefixName } from './constants';
export var makeClassesObject = function makeClassesObject(props, options) {

@@ -13,7 +11,7 @@ var _ref;

_props$flip = props.flip,
flip = _props$flip === undefined ? '' : _props$flip,
flip = _props$flip === void 0 ? '' : _props$flip,
_props$size = props.size,
size = _props$size === undefined ? '' : _props$size,
size = _props$size === void 0 ? '' : _props$size,
_props$squared = props.squared,
squared = _props$squared === undefined ? false : _props$squared,
squared = _props$squared === void 0 ? false : _props$squared,
rotate = props.rotate,

@@ -24,11 +22,6 @@ className = props.className,

useCssModules = options.useCssModules;
return _ref = {}, _defineProperty(_ref, flagIconClassesPrefixName, true), _defineProperty(_ref, flagIconClassesPrefix + 'squared', squared), _defineProperty(_ref, '' + flagIconClassesPrefix + size, size), _defineProperty(_ref, '' + flagIconClassesPrefix + code, code), _defineProperty(_ref, flagIconClassesPrefix + 'flip-' + flip, flip), _defineProperty(_ref, flagIconClassesPrefix + 'rotate-' + (rotate || ''), rotate), _defineProperty(_ref, baseThemeStyleName, useCssModules && themeStyles && themeStyles[baseThemeStyleName]), _defineProperty(_ref, styleName || '', useCssModules && themeStyles && styleName && themeStyles[styleName]), _defineProperty(_ref, className || '', className), _ref;
return _ref = {}, _defineProperty(_ref, flagIconClassesPrefixName, true), _defineProperty(_ref, "".concat(flagIconClassesPrefix, "squared"), squared), _defineProperty(_ref, "".concat(flagIconClassesPrefix).concat(size), size), _defineProperty(_ref, "".concat(flagIconClassesPrefix).concat(code), code), _defineProperty(_ref, "".concat(flagIconClassesPrefix, "flip-").concat(flip), flip), _defineProperty(_ref, "".concat(flagIconClassesPrefix, "rotate-").concat(rotate || ''), rotate), _defineProperty(_ref, baseThemeStyleName, useCssModules && themeStyles && themeStyles[baseThemeStyleName]), _defineProperty(_ref, styleName || '', useCssModules && themeStyles && styleName && themeStyles[styleName]), _defineProperty(_ref, className || '', className), _ref;
};
export default (function (props, options, styles) {
var useCssModules = options.useCssModules;
var classesObject = makeClassesObject(props, options);

@@ -39,13 +32,11 @@ var strClasses = classnames(classesObject);

var className = props.className;
var aClasses = strClasses.split(' ');
var nClasses = aClasses.length;
strClasses = aClasses.map(function (c, i) {
if (className && i === nClasses - 1) return c;
return classNameToStyleName(c, styles || {});
}).join(' ');
}
return strClasses;
});

@@ -1,6 +0,4 @@

export default (function (className, styles) {
if (!styles[className]) {
throw new Error('Could not resolve the styleName ' + className);
throw new Error("Could not resolve the styleName ".concat(className));
}

@@ -7,0 +5,0 @@

@@ -1,5 +0,4 @@

export var baseThemeStyleName = 'theme-base';
export var flagIconClassesPrefixName = 'flag-icon';
export var flagIconClassesPrefix = flagIconClassesPrefixName + '-';
export var flagIconClassesPrefix = "".concat(flagIconClassesPrefixName, "-");
export var flagIconModulePath = 'node_modules/flag-icon-css';

@@ -1,4 +0,2 @@

export { getCountries } from './props';
export { getCountryCodes } from './props';

@@ -1,2 +0,1 @@

export { default as makeClassnames, makeClassesObject } from './classnames';

@@ -3,0 +2,0 @@ export { default as makeFlagIconOptions } from './options';

@@ -1,13 +0,12 @@

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; };
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 _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; }
import PropTypes from 'prop-types';
import { MakeFlagIconOptionsPropType } from '../types/propTypes';
var defaultOptions = {
useCssModules: true
};
export default (function (options) {
var computedOptions = _extends({}, defaultOptions, options);
var computedOptions = _objectSpread({}, defaultOptions, options);

@@ -14,0 +13,0 @@ PropTypes.checkPropTypes(MakeFlagIconOptionsPropType(), computedOptions, 'key', 'FlagIconFactory options');

@@ -1,8 +0,5 @@

import { sizes, rotates, flips, countries } from '../static/enums';
export var getCountries = function getCountries() {
return countries;
};
export var getCountryCodes = function getCountryCodes() {

@@ -13,13 +10,10 @@ return countries.map(function (country) {

};
export var getFlips = function getFlips() {
return flips;
};
export var getRotates = function getRotates() {
return rotates;
};
export var getSizes = function getSizes() {
return sizes;
};
var _this = this;
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; };
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; }

@@ -10,3 +10,2 @@ 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; }

customCodes = propsValues.customCodes;
if (!useCssModules) return;

@@ -17,14 +16,13 @@

if (themeStyles) {
var themeStylesClassNames = Object.keys(themeStyles);
var result = Object.keys(customCodes).filter(function (customCode) {
return !themeStylesClassNames.includes('flag-icon-' + customCode);
return !themeStylesClassNames.includes("flag-icon-".concat(customCode));
});
if (result.length > 0) {
return new Error('Invalid prop(s) `themeStyles` supplied to `' + componentName + '`, expected `.flag-icon-[' + result.join('/') + ']`.');
return new Error("Invalid prop(s) `themeStyles` supplied to `".concat(componentName, "`, expected `.flag-icon-[").concat(result.join('/'), "]`."));
}
} else {
return new Error('Missing required prop(s) `themeStyles` supplied to `' + componentName + '`.');
return new Error("Missing required prop(s) `themeStyles` supplied to `".concat(componentName, "`."));
}

@@ -36,2 +34,3 @@ }

var validatorKeyName = '__themeStyles__';
if (Object.prototype.hasOwnProperty.call(obj, validatorKeyName)) {

@@ -41,3 +40,3 @@ return obj;

return _extends({}, obj, _defineProperty({}, validatorKeyName, fnThemeStylesValidator.bind(_this, obj)));
return _objectSpread({}, obj, _defineProperty({}, validatorKeyName, fnThemeStylesValidator.bind(_this, obj)));
};

@@ -52,3 +51,3 @@

if (extra.length > 0) {
return new Error('Invalid prop(s) ' + JSON.stringify(extra) + ' supplied to `' + componentName + '`, expected one of [' + passedPropNames.join(',') + '].');
return new Error("Invalid prop(s) ".concat(JSON.stringify(extra), " supplied to `").concat(componentName, "`, expected one of [").concat(passedPropNames.join(','), "]."));
}

@@ -59,2 +58,3 @@ };

var validatorKeyName = '__no__extra__props__validator___';
if (Object.prototype.hasOwnProperty.call(obj, validatorKeyName)) {

@@ -64,3 +64,3 @@ return obj;

return _extends({}, obj, _defineProperty({}, validatorKeyName, fnNoExtraPropsValidator.bind(_this, obj)));
return _objectSpread({}, obj, _defineProperty({}, validatorKeyName, fnNoExtraPropsValidator.bind(_this, obj)));
};

@@ -1,6 +0,9 @@

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; };
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 _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; }
export var validateStyles = function validateStyles(styles, computedOptions, options) {
if (process.env.NODE_ENV !== 'production') {
if (!computedOptions) throw Error('Passing `computedOptions` is required.');
if (!computedOptions.useCssModules) {

@@ -15,10 +18,8 @@ throw Error('Cannot validate global CSS.');

var readmeModules = 'https://github.com/gajus/react-css-modules#usage';
console.error('Warning: Detected configuration mismatch/error: [react-flag-icon-css] FlagIconFactory tried to build FlagIcon with the option \'useCssModules\' set to true (' + (userSetUseCssModules ? 'by you' : 'default') + '), but it seems that your environment is not loading the stylesheets in the appropriate way. Two possibilities: \n\n 1. Your project is not using CSS Modules / you don\'t want to use them. Try building FlagIcon like this: \n\n\timport * as React from \'react\' \n\n\tconst FlagIcon = FlagIconFactory(React, { useCssModules: false }) \n\n\tSee the README for more info: ' + readme + ' \n\n 2. You are using CSS Modules but your module bundler e.g Webpack is not correctly set up for CSS modules. If you are using Webpack, the key modules to set up are \'style-loader\', \'css-loader\' and \'extract-text-webpack-plugin\' (\'sass-loader\' also comes into play if you are using SASS). The link below may help you:\n\n\t' + readmeModules);
console.error("Warning: Detected configuration mismatch/error: [react-flag-icon-css] FlagIconFactory tried to build FlagIcon with the option 'useCssModules' set to true (".concat(userSetUseCssModules ? 'by you' : 'default', "), but it seems that your environment is not loading the stylesheets in the appropriate way. Two possibilities: \n\n 1. Your project is not using CSS Modules / you don't want to use them. Try building FlagIcon like this: \n\n\timport * as React from 'react' \n\n\tconst FlagIcon = FlagIconFactory(React, { useCssModules: false }) \n\n\tSee the README for more info: ").concat(readme, " \n\n 2. You are using CSS Modules but your module bundler e.g Webpack is not correctly set up for CSS modules. If you are using Webpack, the key modules to set up are 'style-loader', 'css-loader' and 'extract-text-webpack-plugin' ('sass-loader' also comes into play if you are using SASS). The link below may help you:\n\n\t").concat(readmeModules));
}
}
};
export default (function (styles, options) {
return options && options.themeStyles ? _extends({}, styles, options.themeStyles) : styles;
return options && options.themeStyles ? _objectSpread({}, styles, options.themeStyles) : styles;
});

@@ -1,2 +0,1 @@

export { default, CustomFlagIconFactory } from './FlagIcon/FlagIconFactory';

@@ -3,0 +2,0 @@ import * as _types from './types/flow';

@@ -1,8 +0,4 @@

export var sizes = ['lg', '2x', '3x', '4x', '5x'];
export var rotates = [30, 60, 90, 180, 270];
export var flips = ['horizontal', 'vertical'];
export var countries = [{

@@ -9,0 +5,0 @@ name: 'Afghanistan',

@@ -1,9 +0,10 @@

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; };
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 _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; }
import stylesFlagIcon from 'flag-icon-css/css/flag-icon.css';
import stylesMain from './styles/main.css';
var finalStyles = _objectSpread({}, stylesFlagIcon, stylesMain);
var finalStyles = _extends({}, stylesFlagIcon, stylesMain);
export default finalStyles;

@@ -1,8 +0,8 @@

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; };
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 _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; }
import PropTypes from 'prop-types';
import { getRotates, getFlips, getSizes } from '../functions/props';
import { AddNoExtraPropsValidator, AddThemeStylesValidator } from '../functions/propTypes';
var FlagIconSizeType = PropTypes.oneOf(getSizes());

@@ -29,3 +29,3 @@ var FlagIconRotateType = PropTypes.oneOf(getRotates());

var makeFlagIconPropsTypeObject = function makeFlagIconPropsTypeObject(codes) {
return _extends({}, makeFlagIconClassesObject(codes), {
return _objectSpread({}, makeFlagIconClassesObject(codes), {
children: PropTypes.element,

@@ -39,3 +39,2 @@ Component: PropTypes.string

};
var flagIconOptionsType = {

@@ -46,5 +45,4 @@ customCodes: PropTypes.object,

};
export var MakeFlagIconOptionsPropType = function MakeFlagIconOptionsPropType() {
return AddNoExtraPropsValidator(AddThemeStylesValidator(flagIconOptionsType));
};

@@ -5,3 +5,3 @@ {

"homepage": "https://github.com/matteocng/react-flag-icon-css#readme",
"version": "1.0.24",
"version": "1.0.25",
"main": "./lib",

@@ -30,18 +30,22 @@ "module": "./module",

"classnames": "^2.2.6",
"flag-icon-css": "^3.0.0",
"flag-icon-css": "^3.2.1",
"prop-types": "^15.6.2"
},
"devDependencies": {
"ava": "^0.25.0",
"babel-cli": "^6.26.0",
"babel-eslint": "^8.2.6",
"babel-plugin-istanbul": "^4.1.6",
"babel-plugin-transform-export-extensions": "^6.22.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-polyfill": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"chalk": "^2.4.1",
"@babel/cli": "^7.2.3",
"@babel/core": "^7.2.2",
"@babel/node": "^7.2.2",
"@babel/plugin-proposal-export-default-from": "^7.2.0",
"@babel/plugin-proposal-export-namespace-from": "^7.2.0",
"@babel/plugin-proposal-object-rest-spread": "^7.2.0",
"@babel/polyfill": "^7.2.5",
"@babel/preset-env": "^7.2.3",
"@babel/preset-flow": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"ava": "^1.1.0",
"babel-eslint": "^10.0.1",
"babel-plugin-istanbul": "^5.1.0",
"chalk": "^2.4.2",
"classnames": "^2.2.6",
"codecov": "^3.0.4",
"codecov": "^3.1.0",
"coveralls": "^3.0.2",

@@ -51,27 +55,28 @@ "cpy-cli": "^2.0.0",

"css-modules-require-hook": "^4.2.3",
"eslint": "^5.1.0",
"eslint-config-airbnb": "17.0.0",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-ava": "^5.0.0",
"eslint-plugin-babel": "^5.1.0",
"eslint-plugin-flowtype": "^2.50.0",
"eslint-plugin-import": "^2.12.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-react": "^7.9.1",
"flag-icon-css": "^3.0.0",
"flow-bin": "^0.76.0",
"flow-copy-source": "^2.0.1",
"eslint": "^5.12.0",
"eslint-config-airbnb": "17.1.0",
"eslint-config-prettier": "^3.4.0",
"eslint-plugin-ava": "^5.1.1",
"eslint-plugin-babel": "^5.3.0",
"eslint-plugin-flowtype": "^3.2.1",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsx-a11y": "^6.1.2",
"eslint-plugin-react": "^7.12.3",
"esm": "^3.0.84",
"flag-icon-css": "^3.2.1",
"flow-bin": "^0.77.0",
"flow-copy-source": "^2.0.2",
"mkdirp": "^0.5.1",
"nyc": "^12.0.2",
"postcss-at-rules-variables": "^0.1.5",
"postcss-cli": "^5.0.0",
"postcss-custom-properties": "^7.0.0",
"postcss-discard-comments": "^4.0.0",
"nyc": "^13.1.0",
"postcss-at-rules-variables": "^0.1.6",
"postcss-cli": "^6.1.1",
"postcss-custom-properties": "7.0.0",
"postcss-discard-comments": "^4.0.1",
"postcss-each": "^0.10.0",
"prettier": "^1.13.7",
"react": "^16.4.0",
"react-dom": "^16.4.0",
"react-test-renderer": "^16.4.0",
"rimraf": "^2.6.2",
"stylelint": "^9.0.0",
"prettier": "^1.15.3",
"react": "^16.7.0",
"react-dom": "^16.7.0",
"react-test-renderer": "^16.7.0",
"rimraf": "^2.6.3",
"stylelint": "^9.9.0",
"stylelint-config-standard": "^18.2.0"

@@ -107,30 +112,36 @@ },

"postcoverage": "npm run coverage:codecov && npm run coverage:coveralls",
"posttest": "npm run lint && npm run flow && npm run prettier:check",
"prebuild": "npm run clean",
"prebuild:module": "npm run clean:module",
"posttest:ci": "npm run lint && npm run flow && npm run prettier:check",
"prebuild": "npm run clean && npm run prebuild:common",
"prebuild:common": "npm run generate:types && npm run flow",
"prebuild:module": "npm run clean:module && npm run prebuild:common",
"precoverage": "mkdirp .nyc_output",
"prepublishOnly": "npm run test && npm run audit && npm run build && npm run build:module",
"prepublishOnly": "npm run test:ci && npm run audit && npm run build && npm run build:module",
"prettier": "cross-env BABEL_ENV=build babel-node ./scripts/tasks/prettier.js write",
"prettier:check": "cross-env BABEL_ENV=build babel-node ./scripts/tasks/prettier.js",
"styles": "postcss -o lib/styles/main.css src/styles/main.css && cpy lib/styles/main.css module/styles/",
"test": "cross-env BABEL_ENV=testing nyc ava",
"test:update:snapshots": "cross-env BABEL_ENV=testing ava --update-snapshots"
"test": "cross-env BABEL_ENV=testing ava",
"test:ci": "cross-env BABEL_ENV=testing nyc ava",
"test:update:snapshots": "npm run test -- --update-snapshots",
"watch:test": "npm run test -- --watch"
},
"license": "MIT",
"ava": {
"babel": "inherit",
"babel": {
"testOptions": {
"presets": [
[
"module:ava/stage-4",
{
"modules": false
}
]
]
}
},
"files": [
"src/__tests__/FlagIcon.js",
"src/__tests__/FlagIconFactory.js",
"src/__tests__/classNameToStyleName.js",
"src/__tests__/customCodes.js",
"src/__tests__/internals.js",
"src/__tests__/makeClassesObject.js",
"src/__tests__/makeStyles.js",
"src/__tests__/types/propTypes.js",
"src/__tests__/validateStyles.js"
"**/*.test.js"
],
"require": [
"babel-polyfill",
"babel-register",
"@babel/register",
"esm",
"./src/__tests__/index.js"

@@ -144,3 +155,2 @@ ]

"peerDependencies": {
"prop-types": "^15.6.0",
"react": "^0.14 || ^15.0 || ^16.0",

@@ -147,0 +157,0 @@ "react-dom": "^0.14 || ^15.0 || ^16.0"

@@ -38,5 +38,5 @@ A simple `React` SVG country flags component: it works with `Css Modules` (default) or standard `Css`.

We recommend using the [`webpack 4`](//github.com/webpack/webpack) module bundler and ecosystem to *assemble* your app, but this module also works with `webpack 3`, `webpack 2` and `webpack 1` and should work with other bundlers.
We recommend using the [`webpack 4`](//github.com/webpack/webpack) module bundler and ecosystem to *assemble* your app, even though this module works with `webpack >= 1` and should also work with other bundlers.
If you are using `webpack`, you will need to install and configure a few commmonly used modules (see the [webpack 3 example project](//github.com/matteocng/react-flag-icon-css-example-multi), or the [webpack 2](https://github.com/matteocng/react-flag-icon-css-example-multi/tree/webpack-2), [webpack 1](https://github.com/matteocng/react-flag-icon-css-example-multi/tree/webpack-1) versions of it):
If you are using `webpack`, you will need to install and configure a few commmonly used modules - see the [webpack 4 example project](//github.com/matteocng/react-flag-icon-css-example-multi) (also available for: [webpack 3](https://github.com/matteocng/react-flag-icon-css-example-multi/tree/webpack-3), [webpack 2](https://github.com/matteocng/react-flag-icon-css-example-multi/tree/webpack-2), and [webpack 1](https://github.com/matteocng/react-flag-icon-css-example-multi/tree/webpack-1)).

@@ -235,4 +235,8 @@ ```bash

**Static type checking**: if you use Facebook's [`flow`](https://github.com/facebook/flow) in your app (otherwise you can skip this section, unless you want to submit a pull request), it should automatically pick up this package's definitions from the `.js.flow` files that are distributed with it, checking your code accordingly when you run `yarn flow`. Using the latest `Flow` version or the version in `./package.json` is recommended. We also recommend using a `Flow`-aware editor such as [`Nuclide`](https://nuclide.io/) for [`Atom`](https://atom.io/).
**Static type checking**:
If you use Facebook's [`flow`](https://github.com/facebook/flow) in your app (otherwise you can skip this section, unless you want to submit a pull request), it should automatically pick up this package's definitions from the `.js.flow` files that are distributed with it, checking your code accordingly when you run `yarn flow`. Using the latest `Flow` version or the version in `./package.json` is recommended. We also recommend using a `Flow`-aware editor such as [`Nuclide`](https://nuclide.io/) for [`Atom`](https://atom.io/).
If you use Microsoft's [`TypeScript`](https://www.typescriptlang.org/) in your app (otherwise you can skip this section, unless you want to submit a pull request), the package that contains the type definitions for this module is: [@types/react-flag-icon-css](https://www.npmjs.com/package/@types/react-flag-icon-css).
## Contributing

@@ -239,0 +243,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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