@jalik/react-lightbox
Advanced tools
Comparing version 1.0.9 to 1.0.10
# Changelog | ||
## v1.0.10 | ||
- Upgraded dependencies | ||
## v1.0.9 | ||
@@ -4,0 +8,0 @@ |
@@ -37,4 +37,16 @@ "use strict"; | ||
playing = _useLightBoxContext.playing, | ||
show = _useLightBoxContext.show; // Changes image automatically. | ||
show = _useLightBoxContext.show; | ||
var handleClickImage = (0, _react.useCallback)(function () { | ||
dispatch({ | ||
type: _reducer.ACTION_CLOSE | ||
}); | ||
}, [dispatch]); | ||
var handleKeyPressImage = (0, _react.useCallback)(function (event) { | ||
if ([' ', 'Enter'].indexOf(event.key) !== -1) { | ||
dispatch({ | ||
type: _reducer.ACTION_CLOSE | ||
}); | ||
} | ||
}, [dispatch]); // Changes image automatically. | ||
@@ -148,2 +160,5 @@ (0, _react.useEffect)(function () { | ||
}, /*#__PURE__*/_react["default"].createElement("div", { | ||
onClick: handleClickImage, | ||
onKeyPress: handleKeyPressImage, | ||
role: "button", | ||
style: { | ||
@@ -155,11 +170,7 @@ flexGrow: 1, | ||
overflow: 'auto' | ||
} | ||
}, | ||
tabIndex: 0 | ||
}, /*#__PURE__*/_react["default"].createElement("img", { | ||
alt: items[activeIndex].alt, | ||
src: items[activeIndex].src, | ||
onClick: function onClick() { | ||
return dispatch({ | ||
type: _reducer.ACTION_CLOSE | ||
}); | ||
}, | ||
style: { | ||
@@ -166,0 +177,0 @@ maxHeight: '100%', |
@@ -40,11 +40,11 @@ "use strict"; | ||
function _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
function LightBoxProvider(_ref) { | ||
var children = _ref.children, | ||
duration = _ref.duration, | ||
loop = _ref.loop, | ||
playing = _ref.playing; | ||
function LightBoxProvider(props) { | ||
var children = props.children, | ||
duration = props.duration, | ||
loop = props.loop, | ||
playing = props.playing; | ||
@@ -51,0 +51,0 @@ var _useReducer = (0, _react.useReducer)(_reducer["default"], { |
@@ -20,2 +20,4 @@ "use strict"; | ||
var _excluded = ["alt", "src"]; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
@@ -70,7 +72,8 @@ | ||
src = _children$props.src, | ||
imgProps = _objectWithoutProperties(_children$props, ["alt", "src"]); | ||
imgProps = _objectWithoutProperties(_children$props, _excluded); | ||
return /*#__PURE__*/_react["default"].createElement("img", _extends({ | ||
alt: alt, | ||
src: src | ||
src: src // eslint-disable-next-line react/jsx-props-no-spreading | ||
}, imgProps)); | ||
@@ -77,0 +80,0 @@ } |
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; 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); } | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -8,3 +10,3 @@ value: true | ||
var _react = _interopRequireDefault(require("react")); | ||
var _react = _interopRequireWildcard(require("react")); | ||
@@ -17,5 +19,9 @@ var _reducer = require("../reducer"); | ||
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, 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; } | ||
/* | ||
* The MIT License (MIT) | ||
* Copyright (c) 2020 Karl STEIN | ||
* Copyright (c) 2021 Karl STEIN | ||
*/ | ||
@@ -31,2 +37,28 @@ function Thumbnails() { | ||
var handleClickImage = (0, _react.useCallback)(function (index) { | ||
return function (event) { | ||
event.preventDefault(); | ||
dispatch({ | ||
type: _reducer.ACTION_GO_TO, | ||
data: { | ||
index: index, | ||
playing: false | ||
} | ||
}); | ||
}; | ||
}, [dispatch]); | ||
var handleKeyPressImage = (0, _react.useCallback)(function (index) { | ||
return function (event) { | ||
if ([' ', 'Enter'].indexOf(event.key) !== -1) { | ||
event.preventDefault(); | ||
dispatch({ | ||
type: _reducer.ACTION_GO_TO, | ||
data: { | ||
index: index, | ||
playing: false | ||
} | ||
}); | ||
} | ||
}; | ||
}, [dispatch]); | ||
return /*#__PURE__*/_react["default"].createElement("div", { | ||
@@ -52,18 +84,11 @@ style: { | ||
}, items.map(function (item, index) { | ||
var _goto = function _goto(event) { | ||
event.preventDefault(); | ||
dispatch({ | ||
type: _reducer.ACTION_GO_TO, | ||
data: { | ||
index: index, | ||
playing: false | ||
} | ||
}); | ||
}; | ||
return /*#__PURE__*/_react["default"].createElement("img", { | ||
return /*#__PURE__*/_react["default"].createElement("div", { | ||
key: item.src, | ||
onClick: handleClickImage(index), | ||
onKeyPress: handleKeyPressImage(index), | ||
role: "button", | ||
tabIndex: 0 | ||
}, /*#__PURE__*/_react["default"].createElement("img", { | ||
alt: item.alt, | ||
src: item.src, | ||
alt: item.alt, | ||
onClick: _goto, | ||
style: { | ||
@@ -78,3 +103,3 @@ backgroundColor: '#FFFFFF', | ||
} | ||
}); | ||
})); | ||
}))); | ||
@@ -81,0 +106,0 @@ } |
{ | ||
"name": "@jalik/react-lightbox", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"description": "Light box component for React", | ||
"main": "dist/index.js", | ||
"module": "src/index.js", | ||
"esnext": "src/index.js", | ||
@@ -36,20 +37,25 @@ "sideEffects": false, | ||
"license": "MIT", | ||
"files": [ | ||
"/dist", | ||
"/src" | ||
], | ||
"devDependencies": { | ||
"@babel/cli": "^7.14.3", | ||
"@babel/core": "^7.14.3", | ||
"@babel/plugin-proposal-export-default-from": "^7.12.13", | ||
"@babel/preset-env": "^7.14.2", | ||
"@babel/preset-react": "^7.13.13", | ||
"babel-eslint": "^10.1.0", | ||
"eslint": "^7.26.0", | ||
"@babel/cli": "^7.15.7", | ||
"@babel/core": "^7.15.5", | ||
"@babel/eslint-parser": "^7.15.7", | ||
"@babel/plugin-proposal-export-default-from": "^7.14.5", | ||
"@babel/preset-env": "^7.15.6", | ||
"@babel/preset-react": "^7.14.5", | ||
"@babel/runtime": "^7.15.4", | ||
"eslint": "^7.32.0", | ||
"eslint-config-airbnb": "^18.2.1", | ||
"eslint-plugin-import": "^2.23.2", | ||
"eslint-plugin-jest": "^24.3.6", | ||
"eslint-plugin-import": "^2.24.2", | ||
"eslint-plugin-jest": "^24.4.2", | ||
"eslint-plugin-jsx-a11y": "^6.4.1", | ||
"eslint-plugin-react": "^7.23.2", | ||
"eslint-plugin-react": "^7.25.3", | ||
"eslint-plugin-react-hooks": "^4.2.0", | ||
"jest": "^26.6.3", | ||
"jest": "^27.2.1", | ||
"react": "^17.0.2", | ||
"rimraf": "^3.0.2", | ||
"typescript": "^4.2.4" | ||
"typescript": "^4.4.3" | ||
}, | ||
@@ -56,0 +62,0 @@ "peerDependencies": { |
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
45614
1050
18
20