react-unsplash-wrapper
Advanced tools
Comparing version 1.1.3 to 1.1.5
@@ -6,14 +6,15 @@ "use strict"; | ||
}); | ||
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 _react = _interopRequireDefault(require("react")); | ||
var _react = require("react"); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _react2 = _interopRequireDefault(_react); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _propTypes = require("prop-types"); | ||
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; } | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
function _objectSpread(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 _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; } | ||
@@ -44,5 +45,5 @@ // Constants | ||
margin: 0 | ||
}; // Helper to generate url for unsplash | ||
// Helper to generate url for unsplash | ||
};var generateUrl = function generateUrl(_ref) { | ||
var generateUrl = function generateUrl(_ref) { | ||
var username = _ref.username, | ||
@@ -55,7 +56,4 @@ width = _ref.width, | ||
fixed = _ref.fixed; | ||
var url = [PATH]; | ||
if (fixed) return url.push(DAILY).join("/"); | ||
if (username) url.push(USER, username); | ||
@@ -65,7 +63,4 @@ if (!username && collectionId) url.push(COLLECTION, collectionId); | ||
if (!username && !photoId && !collectionId && !keywords) url.push(RANDOM); | ||
url.push(width + "x" + height); | ||
if (keywords) url.push("?" + keywords.replace(/\s/g, "")); | ||
url.push("".concat(width, "x").concat(height)); | ||
if (keywords) url.push("?".concat(keywords.replace(/\s/g, ""))); | ||
return url.join("/"); | ||
@@ -86,9 +81,6 @@ }; | ||
height = _ref2.height; | ||
if (typeof width === "string") width = parseInt(width, 10); | ||
if (typeof height === "string") height = parseInt(height, 10); | ||
var urlWidth = style && style.width || width; | ||
var urlHeight = style && style.height || height; | ||
var url = encodeURI(generateUrl({ | ||
@@ -104,3 +96,3 @@ username: username, | ||
var imageStyles = _extends({ | ||
var imageStyles = _objectSpread({ | ||
width: width, | ||
@@ -110,10 +102,10 @@ height: height | ||
var backgroundStyles = _extends({}, DEFAULT_STYLES, { | ||
backgroundImage: "url(" + url + ")" | ||
var backgroundStyles = _objectSpread({}, DEFAULT_STYLES, { | ||
backgroundImage: "url(".concat(url, ")") | ||
}); | ||
if (expand) { | ||
backgroundStyles = _extends({}, backgroundStyles, EXPAND_STYLES); | ||
backgroundStyles = _objectSpread({}, backgroundStyles, {}, EXPAND_STYLES); | ||
} else { | ||
backgroundStyles = _extends({}, backgroundStyles, { | ||
backgroundStyles = _objectSpread({}, backgroundStyles, { | ||
width: width, | ||
@@ -124,22 +116,22 @@ height: height | ||
return img ? _react2.default.createElement("img", { src: url, style: imageStyles }) : _react2.default.createElement( | ||
"div", | ||
{ style: backgroundStyles }, | ||
children | ||
); | ||
return img ? _react.default.createElement("img", { | ||
src: url, | ||
style: imageStyles | ||
}) : _react.default.createElement("div", { | ||
style: backgroundStyles | ||
}, children); | ||
}; | ||
Unsplash.propTypes = { | ||
children: _propTypes2.default.node, | ||
collectionId: _propTypes2.default.number, | ||
username: _propTypes2.default.string, | ||
keywords: _propTypes2.default.string, | ||
expand: _propTypes2.default.bool, | ||
fixed: _propTypes2.default.bool, | ||
img: _propTypes2.default.bool, | ||
style: _propTypes2.default.object, | ||
width: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]), | ||
height: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]) | ||
children: _propTypes.default.node, | ||
collectionId: _propTypes.default.number, | ||
username: _propTypes.default.string, | ||
keywords: _propTypes.default.string, | ||
expand: _propTypes.default.bool, | ||
fixed: _propTypes.default.bool, | ||
img: _propTypes.default.bool, | ||
style: _propTypes.default.object, | ||
width: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]), | ||
height: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]) | ||
}; | ||
Unsplash.defaultProps = { | ||
@@ -152,3 +144,3 @@ expand: false, | ||
}; | ||
exports.default = Unsplash; | ||
var _default = Unsplash; | ||
exports.default = _default; |
@@ -6,9 +6,9 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
var _Unsplash = require("./components/Unsplash"); | ||
var _Unsplash = _interopRequireDefault(require("./components/Unsplash")); | ||
var _Unsplash2 = _interopRequireDefault(_Unsplash); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.default = _Unsplash2.default; | ||
var _default = _Unsplash.default; | ||
exports.default = _default; |
{ | ||
"name": "react-unsplash-wrapper", | ||
"version": "1.1.3", | ||
"version": "1.1.5", | ||
"description": "A tiny React component to effortless use placeholder images from Unsplash", | ||
@@ -10,3 +10,3 @@ "main": "dist/index.js", | ||
"scripts": { | ||
"build": "rm -rf dist && babel src -d dist", | ||
"build": "rm -rf dist && babel src -d dist --ignore src/**/*.test.js", | ||
"format": "prettier --write '**/*.js'", | ||
@@ -33,23 +33,25 @@ "test": "jest" | ||
"homepage": "https://github.com/marciobarrios/react-unsplash-wrapper#readme", | ||
"browserslist": "> 0.25%, not dead", | ||
"dependencies": { | ||
"react": "^16.2.0" | ||
"prop-types": "^15.7.2" | ||
}, | ||
"devDependencies": { | ||
"babel-cli": "^6.26.0", | ||
"babel-eslint": "^8.2.2", | ||
"babel-jest": "^22.4.0", | ||
"babel-preset-env": "^1.6.1", | ||
"babel-preset-react": "^6.24.1", | ||
"babel-preset-stage-1": "^6.24.1", | ||
"eslint": "^4.18.0", | ||
"eslint-config-unobtrusive": "^1.2.1", | ||
"eslint-plugin-react": "^7.7.0", | ||
"jest": "^22.4.0", | ||
"prettier": "1.10.2", | ||
"prop-types": "^15.6.1", | ||
"react-test-renderer": "^16.2.0" | ||
"@babel/cli": "^7.7.5", | ||
"@babel/core": "^7.7.5", | ||
"@babel/preset-env": "^7.7.6", | ||
"@babel/preset-react": "^7.7.4", | ||
"babel-eslint": "^10.0.3", | ||
"babel-jest": "^24.9.0", | ||
"eslint": "^6.7.2", | ||
"eslint-config-unobtrusive": "^1.2.5", | ||
"eslint-plugin-react": "^7.17.0", | ||
"jest": "^24.9.0", | ||
"prettier": "^1.19.1", | ||
"react": "^16.12.0", | ||
"react-test-renderer": "^16.12.0" | ||
}, | ||
"peerDependencies": { | ||
"react": "*" | ||
"react": "*", | ||
"react-dom": "*" | ||
} | ||
} |
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
11315
3
5
131
+ Addedprop-types@^15.7.2
+ Addedreact@18.3.1(transitive)
+ Addedreact-dom@18.3.1(transitive)
+ Addedscheduler@0.23.2(transitive)
- Removedreact@^16.2.0
- Removedreact@16.14.0(transitive)