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

react-modal-image

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-modal-image - npm Package Compare versions

Comparing version 2.5.0 to 2.6.0

56

es/Header.js
import React from "react";
import { ZoomInIcon, ZoomOutIcon, DownloadIcon, CloseIcon, RotateIcon } from "./icons";
function isSameOrigin(href) {
// @ts-ignore
return document.location.hostname !== new URL(href, document.location).hostname;
}
/**
* Triggers image download from cross origin URLs
*
* `<a href="..." download>foo</a> works only for same-origin URLs.
* Further info: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-download
*/
var crossOriginDownload = function crossOriginDownload(href) {
return function (event) {
if (!isSameOrigin(href)) {
// native download will be triggered by `download` attribute
return;
} // else proceed to use `fetch` for cross origin image download
event.preventDefault();
fetch(href).then(function (res) {
if (!res.ok) {
console.error("Failed to download image, HTTP status " + res.status + " from " + href);
}
return res.blob().then(function (blob) {
var tmpAnchor = document.createElement("a");
tmpAnchor.setAttribute("download", href.split("/").pop());
tmpAnchor.href = URL.createObjectURL(blob);
tmpAnchor.click();
});
})["catch"](function (err) {
console.error(err);
console.error("Failed to download image from " + href);
});
};
};
var Header = function Header(_ref) {

@@ -14,16 +53,17 @@ var image = _ref.image,

enableRotate = _ref.enableRotate;
return React.createElement("div", {
return /*#__PURE__*/React.createElement("div", {
className: "__react_modal_image__header"
}, React.createElement("span", {
}, /*#__PURE__*/React.createElement("span", {
className: "__react_modal_image__icon_menu"
}, enableDownload && React.createElement("a", {
}, enableDownload && /*#__PURE__*/React.createElement("a", {
href: image,
download: true
}, React.createElement(DownloadIcon, null)), enableZoom && React.createElement("a", {
download: true,
onClick: crossOriginDownload(image)
}, /*#__PURE__*/React.createElement(DownloadIcon, null)), enableZoom && /*#__PURE__*/React.createElement("a", {
onClick: toggleZoom
}, zoomed ? React.createElement(ZoomOutIcon, null) : React.createElement(ZoomInIcon, null)), enableRotate && React.createElement("a", {
}, zoomed ? /*#__PURE__*/React.createElement(ZoomOutIcon, null) : /*#__PURE__*/React.createElement(ZoomInIcon, null)), enableRotate && /*#__PURE__*/React.createElement("a", {
onClick: toggleRotate
}, React.createElement(RotateIcon, null)), React.createElement("a", {
}, /*#__PURE__*/React.createElement(RotateIcon, null)), /*#__PURE__*/React.createElement("a", {
onClick: onClose
}, React.createElement(CloseIcon, null))), alt && React.createElement("span", {
}, /*#__PURE__*/React.createElement(CloseIcon, null))), alt && /*#__PURE__*/React.createElement("span", {
className: "__react_modal_image__caption"

@@ -30,0 +70,0 @@ }, alt));

36

es/icons.js

@@ -6,3 +6,3 @@ /*

export var ZoomInIcon = function ZoomInIcon() {
return React.createElement("svg", {
return /*#__PURE__*/React.createElement("svg", {
fill: "#ffffff",

@@ -13,6 +13,6 @@ height: "24",

xmlns: "http://www.w3.org/2000/svg"
}, React.createElement("path", {
}, /*#__PURE__*/React.createElement("path", {
d: "M0 0h24v24H0z",
fill: "none"
}), React.createElement("path", {
}), /*#__PURE__*/React.createElement("path", {
d: "M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"

@@ -22,3 +22,3 @@ }));

export var ZoomOutIcon = function ZoomOutIcon() {
return React.createElement("svg", {
return /*#__PURE__*/React.createElement("svg", {
fill: "#ffffff",

@@ -29,6 +29,6 @@ height: "24",

xmlns: "http://www.w3.org/2000/svg"
}, React.createElement("path", {
}, /*#__PURE__*/React.createElement("path", {
d: "M0 0h24v24H0z",
fill: "none"
}), React.createElement("path", {
}), /*#__PURE__*/React.createElement("path", {
d: "M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"

@@ -38,3 +38,3 @@ }));

export var DownloadIcon = function DownloadIcon() {
return React.createElement("svg", {
return /*#__PURE__*/React.createElement("svg", {
fill: "#ffffff",

@@ -45,5 +45,5 @@ height: "24",

xmlns: "http://www.w3.org/2000/svg"
}, React.createElement("path", {
}, /*#__PURE__*/React.createElement("path", {
d: "M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"
}), React.createElement("path", {
}), /*#__PURE__*/React.createElement("path", {
d: "M0 0h24v24H0z",

@@ -54,3 +54,3 @@ fill: "none"

export var CloseIcon = function CloseIcon() {
return React.createElement("svg", {
return /*#__PURE__*/React.createElement("svg", {
fill: "#ffffff",

@@ -61,5 +61,5 @@ height: "24",

xmlns: "http://www.w3.org/2000/svg"
}, React.createElement("path", {
}, /*#__PURE__*/React.createElement("path", {
d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
}), React.createElement("path", {
}), /*#__PURE__*/React.createElement("path", {
d: "M0 0h24v24H0z",

@@ -70,3 +70,3 @@ fill: "none"

export var SpinnerIcon = function SpinnerIcon() {
return React.createElement("svg", {
return /*#__PURE__*/React.createElement("svg", {
fill: "#ffffff",

@@ -77,5 +77,5 @@ height: "48",

xmlns: "http://www.w3.org/2000/svg"
}, React.createElement("path", {
}, /*#__PURE__*/React.createElement("path", {
d: "M6 2v6h.01L6 8.01 10 12l-4 4 .01.01H6V22h12v-5.99h-.01L18 16l-4-4 4-3.99-.01-.01H18V2H6zm10 14.5V20H8v-3.5l4-4 4 4zm-4-5l-4-4V4h8v3.5l-4 4z"
}), React.createElement("path", {
}), /*#__PURE__*/React.createElement("path", {
d: "M0 0h24v24H0V0z",

@@ -86,3 +86,3 @@ fill: "none"

export var RotateIcon = function RotateIcon() {
return React.createElement("svg", {
return /*#__PURE__*/React.createElement("svg", {
fill: "#ffffff",

@@ -93,8 +93,8 @@ width: "24",

xmlns: "http://www.w3.org/2000/svg"
}, React.createElement("path", {
}, /*#__PURE__*/React.createElement("path", {
fill: "none",
d: "M0 0h24v24H0V0zm0 0h24v24H0V0z"
}), React.createElement("path", {
}), /*#__PURE__*/React.createElement("path", {
d: "M7.47 21.49C4.2 19.93 1.86 16.76 1.5 13H0c.51 6.16 5.66 11 11.95 11 .23 0 .44-.02.66-.03L8.8 20.15l-1.33 1.34zM12.05 0c-.23 0-.44.02-.66.04l3.81 3.81 1.33-1.33C19.8 4.07 22.14 7.24 22.5 11H24c-.51-6.16-5.66-11-11.95-11zM16 14h2V8c0-1.11-.9-2-2-2h-6v2h6v6zm-8 2V4H6v2H4v2h2v8c0 1.1.89 2 2 2h8v2h2v-2h2v-2H8z"
}));
};

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

function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
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); }

@@ -7,13 +7,17 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

@@ -25,10 +29,8 @@ 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 Image =
/*#__PURE__*/
function (_Component) {
var Image = /*#__PURE__*/function (_Component) {
_inherits(Image, _Component);
var _super = _createSuper(Image);
function Image() {
var _getPrototypeOf2;
var _this;

@@ -42,3 +44,3 @@

_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Image)).call.apply(_getPrototypeOf2, [this].concat(args)));
_this = _super.call.apply(_super, [this].concat(args));

@@ -71,3 +73,3 @@ _defineProperty(_assertThisInitialized(_this), "state", {

handleDoubleClick = _this$props.handleDoubleClick;
return React.createElement("div", null, this.state.loading && React.createElement(SpinnerIcon, null), React.createElement("img", {
return /*#__PURE__*/React.createElement("div", null, this.state.loading && /*#__PURE__*/React.createElement(SpinnerIcon, null), /*#__PURE__*/React.createElement("img", {
id: id,

@@ -74,0 +76,0 @@ className: className,

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

function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
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); }

@@ -7,13 +7,17 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

@@ -26,10 +30,8 @@ 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 _default =
/*#__PURE__*/
function (_Component) {
var _default = /*#__PURE__*/function (_Component) {
_inherits(_default, _Component);
var _super = _createSuper(_default);
function _default() {
var _getPrototypeOf2;
var _this;

@@ -43,3 +45,3 @@

_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(_default)).call.apply(_getPrototypeOf2, [this].concat(args)));
_this = _super.call.apply(_super, [this].concat(args));

@@ -76,3 +78,3 @@ _defineProperty(_assertThisInitialized(_this), "state", {

var modalOpen = this.state.modalOpen;
return React.createElement("div", null, React.createElement("img", {
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("img", {
className: className,

@@ -88,3 +90,3 @@ style: {

alt: alt
}), modalOpen && React.createElement(Lightbox, {
}), modalOpen && /*#__PURE__*/React.createElement(Lightbox, {
medium: medium,

@@ -91,0 +93,0 @@ large: large,

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

function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
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); }

@@ -7,13 +7,17 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

@@ -27,10 +31,8 @@ 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 Lightbox =
/*#__PURE__*/
function (_Component) {
var Lightbox = /*#__PURE__*/function (_Component) {
_inherits(Lightbox, _Component);
var _super = _createSuper(Lightbox);
function Lightbox() {
var _getPrototypeOf2;
var _this;

@@ -44,3 +46,3 @@

_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Lightbox)).call.apply(_getPrototypeOf2, [this].concat(args)));
_this = _super.call.apply(_super, [this].concat(args));

@@ -214,3 +216,3 @@ _defineProperty(_assertThisInitialized(_this), "state", {

rotationDeg = _this$state.rotationDeg;
return React.createElement("div", null, React.createElement(StyleInjector, {
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(StyleInjector, {
name: "__react_modal_image__lightbox",

@@ -220,5 +222,5 @@ css: lightboxStyles({

})
}), React.createElement("div", {
}), /*#__PURE__*/React.createElement("div", {
className: "__react_modal_image__modal_container"
}, React.createElement("div", {
}, /*#__PURE__*/React.createElement("div", {
className: "__react_modal_image__modal_content",

@@ -234,3 +236,3 @@ onMouseDown: this.handleMouseDownOrTouchStart,

}
}, zoomed && React.createElement(Image, {
}, zoomed && /*#__PURE__*/React.createElement(Image, {
id: "react-modal-image-img",

@@ -245,3 +247,3 @@ className: "__react_modal_image__large_img",

handleDoubleClick: this.toggleZoom
}), !zoomed && React.createElement(Image, {
}), !zoomed && /*#__PURE__*/React.createElement(Image, {
id: "react-modal-image-img",

@@ -257,3 +259,3 @@ className: "__react_modal_image__medium_img",

}
})), React.createElement(Header, {
})), /*#__PURE__*/React.createElement(Header, {
image: large || medium,

@@ -260,0 +262,0 @@ alt: alt,

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

function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
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); }

@@ -7,14 +7,18 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
import { Component } from "react";

@@ -32,11 +36,11 @@

var StyleInjector =
/*#__PURE__*/
function (_Component) {
var StyleInjector = /*#__PURE__*/function (_Component) {
_inherits(StyleInjector, _Component);
var _super = _createSuper(StyleInjector);
function StyleInjector() {
_classCallCheck(this, StyleInjector);
return _possibleConstructorReturn(this, _getPrototypeOf(StyleInjector).apply(this, arguments));
return _super.apply(this, arguments);
}

@@ -43,0 +47,0 @@

@@ -14,2 +14,41 @@ "use strict";

function isSameOrigin(href) {
// @ts-ignore
return document.location.hostname !== new URL(href, document.location).hostname;
}
/**
* Triggers image download from cross origin URLs
*
* `<a href="..." download>foo</a> works only for same-origin URLs.
* Further info: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-download
*/
var crossOriginDownload = function crossOriginDownload(href) {
return function (event) {
if (!isSameOrigin(href)) {
// native download will be triggered by `download` attribute
return;
} // else proceed to use `fetch` for cross origin image download
event.preventDefault();
fetch(href).then(function (res) {
if (!res.ok) {
console.error("Failed to download image, HTTP status " + res.status + " from " + href);
}
return res.blob().then(function (blob) {
var tmpAnchor = document.createElement("a");
tmpAnchor.setAttribute("download", href.split("/").pop());
tmpAnchor.href = URL.createObjectURL(blob);
tmpAnchor.click();
});
})["catch"](function (err) {
console.error(err);
console.error("Failed to download image from " + href);
});
};
};
var Header = function Header(_ref) {

@@ -25,16 +64,17 @@ var image = _ref.image,

enableRotate = _ref.enableRotate;
return _react["default"].createElement("div", {
return /*#__PURE__*/_react["default"].createElement("div", {
className: "__react_modal_image__header"
}, _react["default"].createElement("span", {
}, /*#__PURE__*/_react["default"].createElement("span", {
className: "__react_modal_image__icon_menu"
}, enableDownload && _react["default"].createElement("a", {
}, enableDownload && /*#__PURE__*/_react["default"].createElement("a", {
href: image,
download: true
}, _react["default"].createElement(_icons.DownloadIcon, null)), enableZoom && _react["default"].createElement("a", {
download: true,
onClick: crossOriginDownload(image)
}, /*#__PURE__*/_react["default"].createElement(_icons.DownloadIcon, null)), enableZoom && /*#__PURE__*/_react["default"].createElement("a", {
onClick: toggleZoom
}, zoomed ? _react["default"].createElement(_icons.ZoomOutIcon, null) : _react["default"].createElement(_icons.ZoomInIcon, null)), enableRotate && _react["default"].createElement("a", {
}, zoomed ? /*#__PURE__*/_react["default"].createElement(_icons.ZoomOutIcon, null) : /*#__PURE__*/_react["default"].createElement(_icons.ZoomInIcon, null)), enableRotate && /*#__PURE__*/_react["default"].createElement("a", {
onClick: toggleRotate
}, _react["default"].createElement(_icons.RotateIcon, null)), _react["default"].createElement("a", {
}, /*#__PURE__*/_react["default"].createElement(_icons.RotateIcon, null)), /*#__PURE__*/_react["default"].createElement("a", {
onClick: onClose
}, _react["default"].createElement(_icons.CloseIcon, null))), alt && _react["default"].createElement("span", {
}, /*#__PURE__*/_react["default"].createElement(_icons.CloseIcon, null))), alt && /*#__PURE__*/_react["default"].createElement("span", {
className: "__react_modal_image__caption"

@@ -41,0 +81,0 @@ }, alt));

@@ -6,3 +6,3 @@ "use strict";

});
exports.RotateIcon = exports.SpinnerIcon = exports.CloseIcon = exports.DownloadIcon = exports.ZoomOutIcon = exports.ZoomInIcon = void 0;
exports.ZoomOutIcon = exports.ZoomInIcon = exports.SpinnerIcon = exports.RotateIcon = exports.DownloadIcon = exports.CloseIcon = void 0;

@@ -17,3 +17,3 @@ var _react = _interopRequireDefault(require("react"));

var ZoomInIcon = function ZoomInIcon() {
return _react["default"].createElement("svg", {
return /*#__PURE__*/_react["default"].createElement("svg", {
fill: "#ffffff",

@@ -24,6 +24,6 @@ height: "24",

xmlns: "http://www.w3.org/2000/svg"
}, _react["default"].createElement("path", {
}, /*#__PURE__*/_react["default"].createElement("path", {
d: "M0 0h24v24H0z",
fill: "none"
}), _react["default"].createElement("path", {
}), /*#__PURE__*/_react["default"].createElement("path", {
d: "M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"

@@ -36,3 +36,3 @@ }));

var ZoomOutIcon = function ZoomOutIcon() {
return _react["default"].createElement("svg", {
return /*#__PURE__*/_react["default"].createElement("svg", {
fill: "#ffffff",

@@ -43,6 +43,6 @@ height: "24",

xmlns: "http://www.w3.org/2000/svg"
}, _react["default"].createElement("path", {
}, /*#__PURE__*/_react["default"].createElement("path", {
d: "M0 0h24v24H0z",
fill: "none"
}), _react["default"].createElement("path", {
}), /*#__PURE__*/_react["default"].createElement("path", {
d: "M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"

@@ -55,3 +55,3 @@ }));

var DownloadIcon = function DownloadIcon() {
return _react["default"].createElement("svg", {
return /*#__PURE__*/_react["default"].createElement("svg", {
fill: "#ffffff",

@@ -62,5 +62,5 @@ height: "24",

xmlns: "http://www.w3.org/2000/svg"
}, _react["default"].createElement("path", {
}, /*#__PURE__*/_react["default"].createElement("path", {
d: "M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"
}), _react["default"].createElement("path", {
}), /*#__PURE__*/_react["default"].createElement("path", {
d: "M0 0h24v24H0z",

@@ -74,3 +74,3 @@ fill: "none"

var CloseIcon = function CloseIcon() {
return _react["default"].createElement("svg", {
return /*#__PURE__*/_react["default"].createElement("svg", {
fill: "#ffffff",

@@ -81,5 +81,5 @@ height: "24",

xmlns: "http://www.w3.org/2000/svg"
}, _react["default"].createElement("path", {
}, /*#__PURE__*/_react["default"].createElement("path", {
d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
}), _react["default"].createElement("path", {
}), /*#__PURE__*/_react["default"].createElement("path", {
d: "M0 0h24v24H0z",

@@ -93,3 +93,3 @@ fill: "none"

var SpinnerIcon = function SpinnerIcon() {
return _react["default"].createElement("svg", {
return /*#__PURE__*/_react["default"].createElement("svg", {
fill: "#ffffff",

@@ -100,5 +100,5 @@ height: "48",

xmlns: "http://www.w3.org/2000/svg"
}, _react["default"].createElement("path", {
}, /*#__PURE__*/_react["default"].createElement("path", {
d: "M6 2v6h.01L6 8.01 10 12l-4 4 .01.01H6V22h12v-5.99h-.01L18 16l-4-4 4-3.99-.01-.01H18V2H6zm10 14.5V20H8v-3.5l4-4 4 4zm-4-5l-4-4V4h8v3.5l-4 4z"
}), _react["default"].createElement("path", {
}), /*#__PURE__*/_react["default"].createElement("path", {
d: "M0 0h24v24H0V0z",

@@ -112,3 +112,3 @@ fill: "none"

var RotateIcon = function RotateIcon() {
return _react["default"].createElement("svg", {
return /*#__PURE__*/_react["default"].createElement("svg", {
fill: "#ffffff",

@@ -119,6 +119,6 @@ width: "24",

xmlns: "http://www.w3.org/2000/svg"
}, _react["default"].createElement("path", {
}, /*#__PURE__*/_react["default"].createElement("path", {
fill: "none",
d: "M0 0h24v24H0V0zm0 0h24v24H0V0z"
}), _react["default"].createElement("path", {
}), /*#__PURE__*/_react["default"].createElement("path", {
d: "M7.47 21.49C4.2 19.93 1.86 16.76 1.5 13H0c.51 6.16 5.66 11 11.95 11 .23 0 .44-.02.66-.03L8.8 20.15l-1.33 1.34zM12.05 0c-.23 0-.44.02-.66.04l3.81 3.81 1.33-1.33C19.8 4.07 22.14 7.24 22.5 11H24c-.51-6.16-5.66-11-11.95-11zM16 14h2V8c0-1.11-.9-2-2-2h-6v2h6v6zm-8 2V4H6v2H4v2h2v8c0 1.1.89 2 2 2h8v2h2v-2h2v-2H8z"

@@ -125,0 +125,0 @@ }));

"use strict";
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); }
Object.defineProperty(exports, "__esModule", {

@@ -12,8 +14,6 @@ value: true

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -23,24 +23,26 @@

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
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 Image =
/*#__PURE__*/
function (_Component) {
var Image = /*#__PURE__*/function (_Component) {
_inherits(Image, _Component);
var _super = _createSuper(Image);
function Image() {
var _getPrototypeOf2;
var _this;

@@ -54,3 +56,3 @@

_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Image)).call.apply(_getPrototypeOf2, [this].concat(args)));
_this = _super.call.apply(_super, [this].concat(args));

@@ -83,3 +85,3 @@ _defineProperty(_assertThisInitialized(_this), "state", {

handleDoubleClick = _this$props.handleDoubleClick;
return _react["default"].createElement("div", null, this.state.loading && _react["default"].createElement(_icons.SpinnerIcon, null), _react["default"].createElement("img", {
return /*#__PURE__*/_react["default"].createElement("div", null, this.state.loading && /*#__PURE__*/_react["default"].createElement(_icons.SpinnerIcon, null), /*#__PURE__*/_react["default"].createElement("img", {
id: id,

@@ -86,0 +88,0 @@ className: className,

"use strict";
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); }
Object.defineProperty(exports, "__esModule", {

@@ -20,8 +22,6 @@ value: true

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -31,24 +31,26 @@

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
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 _default =
/*#__PURE__*/
function (_Component) {
var _default = /*#__PURE__*/function (_Component) {
_inherits(_default, _Component);
var _super = _createSuper(_default);
function _default() {
var _getPrototypeOf2;
var _this;

@@ -62,3 +64,3 @@

_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(_default)).call.apply(_getPrototypeOf2, [this].concat(args)));
_this = _super.call.apply(_super, [this].concat(args));

@@ -95,3 +97,3 @@ _defineProperty(_assertThisInitialized(_this), "state", {

var modalOpen = this.state.modalOpen;
return _react["default"].createElement("div", null, _react["default"].createElement("img", {
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("img", {
className: className,

@@ -107,3 +109,3 @@ style: {

alt: alt
}), modalOpen && _react["default"].createElement(_Lightbox["default"], {
}), modalOpen && /*#__PURE__*/_react["default"].createElement(_Lightbox["default"], {
medium: medium,

@@ -110,0 +112,0 @@ large: large,

"use strict";
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); }
Object.defineProperty(exports, "__esModule", {

@@ -18,8 +20,6 @@ value: true

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -29,24 +29,26 @@

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
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 Lightbox =
/*#__PURE__*/
function (_Component) {
var Lightbox = /*#__PURE__*/function (_Component) {
_inherits(Lightbox, _Component);
var _super = _createSuper(Lightbox);
function Lightbox() {
var _getPrototypeOf2;
var _this;

@@ -60,3 +62,3 @@

_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Lightbox)).call.apply(_getPrototypeOf2, [this].concat(args)));
_this = _super.call.apply(_super, [this].concat(args));

@@ -230,3 +232,3 @@ _defineProperty(_assertThisInitialized(_this), "state", {

rotationDeg = _this$state.rotationDeg;
return _react["default"].createElement("div", null, _react["default"].createElement(_styles["default"], {
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_styles["default"], {
name: "__react_modal_image__lightbox",

@@ -236,5 +238,5 @@ css: (0, _styles.lightboxStyles)({

})
}), _react["default"].createElement("div", {
}), /*#__PURE__*/_react["default"].createElement("div", {
className: "__react_modal_image__modal_container"
}, _react["default"].createElement("div", {
}, /*#__PURE__*/_react["default"].createElement("div", {
className: "__react_modal_image__modal_content",

@@ -250,3 +252,3 @@ onMouseDown: this.handleMouseDownOrTouchStart,

}
}, zoomed && _react["default"].createElement(_Image["default"], {
}, zoomed && /*#__PURE__*/_react["default"].createElement(_Image["default"], {
id: "react-modal-image-img",

@@ -261,3 +263,3 @@ className: "__react_modal_image__large_img",

handleDoubleClick: this.toggleZoom
}), !zoomed && _react["default"].createElement(_Image["default"], {
}), !zoomed && /*#__PURE__*/_react["default"].createElement(_Image["default"], {
id: "react-modal-image-img",

@@ -273,3 +275,3 @@ className: "__react_modal_image__medium_img",

}
})), _react["default"].createElement(_Header["default"], {
})), /*#__PURE__*/_react["default"].createElement(_Header["default"], {
image: large || medium,

@@ -276,0 +278,0 @@ alt: alt,

"use strict";
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); }
Object.defineProperty(exports, "__esModule", {

@@ -10,4 +12,2 @@ value: true

function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -17,14 +17,18 @@

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function appendStyle(id, css) {

@@ -40,11 +44,11 @@ if (!document.head.querySelector("#" + id)) {

var StyleInjector =
/*#__PURE__*/
function (_Component) {
var StyleInjector = /*#__PURE__*/function (_Component) {
_inherits(StyleInjector, _Component);
var _super = _createSuper(StyleInjector);
function StyleInjector() {
_classCallCheck(this, StyleInjector);
return _possibleConstructorReturn(this, _getPrototypeOf(StyleInjector).apply(this, arguments));
return _super.apply(this, arguments);
}

@@ -51,0 +55,0 @@

{
"name": "react-modal-image",
"version": "2.5.0",
"version": "2.6.0",
"description": "Lightweight Lightbox React Component",

@@ -15,13 +15,7 @@ "main": "lib/index.js",

"build-component": "rm -rf lib es && MODULES=commonjs babel --config-file ./babel-build-config.js src --out-dir lib && MODULES=es6 babel --config-file ./babel-build-config.js src --out-dir es",
"build": "yarn build-component && yarn build-demo",
"site": "gh-pages -d demo/dist",
"build": "npm run build-component && npm run build-demo",
"clean": "rm -rf lib es demo/dist",
"start:static": "http-server demo/dist/ -s -p 8888",
"cypress:open": "cypress open",
"cypress:run": "cypress run --browser chrome",
"test": "start-server-and-test start:static http://localhost:8888 cypress:run"
"cypress:run": "cypress run"
},
"peerDependencies": {
"react": "16.x"
},
"devDependencies": {

@@ -34,14 +28,11 @@ "@babel/cli": "^7.6.2",

"babel-loader": "^8.0.6",
"copy-webpack-plugin": "^5.0.4",
"cypress": "^3.3.1",
"gh-pages": "^1.2.0",
"html-loader": "^0.5.5",
"html-webpack-plugin": "^3.2.0",
"http-server": "^0.11.1",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"start-server-and-test": "^1.9.1",
"webpack": "^4.41.0",
"webpack-cli": "^3.3.9",
"webpack-dev-server": "^3.8.1"
"copy-webpack-plugin": "^11.0.0",
"cypress": "^10.7.0",
"html-loader": "^4.1.0",
"html-webpack-plugin": "^5.5.0",
"react": "^18",
"react-dom": "^18",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0",
"webpack-dev-server": "^4.10.1"
},

@@ -48,0 +39,0 @@ "repository": {

# react-modal-image
[![CircleCI][build-badge]][build]
[![npm package][npm-badge]][npm]

@@ -15,3 +14,3 @@

- Includes builds for CommonJS and ES modules.
- For React 15.x and 16.x.
- For React 16.x, 17.x and 18.x.
- Esc, Enter & click outside the image close the lightbox

@@ -23,3 +22,3 @@ - User can zoom & move the image or download the highest quality one

You need to bring your own `Set` polyfill if you use old Internet Explorers.
You need to bring your own `Set` and `fetch` polyfills if you use old Internet Explorers.

@@ -84,5 +83,3 @@ ## Simple API

[build-badge]: https://img.shields.io/circleci/project/github/aautio/react-modal-image.svg
[build]: https://circleci.com/gh/aautio/react-modal-image
[npm-badge]: https://img.shields.io/npm/v/react-modal-image.svg
[npm]: https://www.npmjs.org/package/react-modal-image
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