react-scroll-into-view
Advanced tools
Comparing version 1.9.2 to 1.9.3
@@ -1,1 +0,1 @@ | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var React=_interopDefault(require("react"));function ownKeys(r,e){var t,n=Object.keys(r);return Object.getOwnPropertySymbols&&(t=Object.getOwnPropertySymbols(r),e&&(t=t.filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})),n.push.apply(n,t)),n}function _objectSpread2(r){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(t),!0).forEach(function(e){_defineProperty(r,e,t[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(t,e))})}return r}function _defineProperty(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _slicedToArray(e,r){return _arrayWithHoles(e)||_iterableToArrayLimit(e,r)||_unsupportedIterableToArray(e,r)||_nonIterableRest()}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _iterableToArrayLimit(e,r){var t=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null!=t){var n,o,a=[],i=!0,c=!1;try{for(t=t.call(e);!(i=(n=t.next()).done)&&(a.push(n.value),!r||a.length!==r);i=!0);}catch(e){c=!0,o=e}finally{try{i||null==t.return||t.return()}finally{if(c)throw o}}return a}}function _unsupportedIterableToArray(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(t="Object"===t&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):void 0}}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var validScrollOptions=function(e){var n={};return e instanceof Object&&Object.entries(e).forEach(function(e){var e=_slicedToArray(e,2),r=e[0],t=e[1];switch(r){case"behavior":"auto"!==t&&"smooth"!==t||(n[r]=t);case"block":case"inline":"start"!==t&&"center"!==t&&"end"!==t&&"nearest"!==t||(n[r]=t)}}),n},ScrollInto=function(e){function r(){var e=_objectSpread2({behavior:a?"smooth":"instant"},validScrollOptions(u));c&&(e.block="start",e.inline="nearest"),document.querySelector(n).scrollIntoView(e)}var t=e.children,n=e.selector,o=e.smooth,a=void 0===o||o,i=e.style,o=e.alignToTop,c=void 0!==o&&o,o=e.className,l=e.onClick,e=e.scrollOptions,u=void 0===e?{}:e;return React.createElement("div",{style:void 0===i?{}:i,className:void 0===o?"":o,onClick:function(e){"function"==typeof l?(l(e),setTimeout(r,1e3/60)):r()}},t)};module.exports=ScrollInto; | ||
"use strict";var e,t=(e=require("react"))&&"object"==typeof e&&"default"in e?e.default:e;function r(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==r)return;var n,o,i=[],c=!0,a=!1;try{for(r=r.call(e);!(c=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);c=!0);}catch(e){a=!0,o=e}finally{try{c||null==r.return||r.return()}finally{if(a)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return i(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}module.exports=function(e){var i=e.children,c=e.selector,a=e.smooth,u=void 0===a||a,l=e.style,s=void 0===l?{}:l,f=e.alignToTop,b=void 0!==f&&f,y=e.className,p=void 0===y?"":y,v=e.onClick,d=e.scrollOptions,m=void 0===d?{}:d,O=function(){var e=function(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?r(Object(o),!0).forEach((function(t){n(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}({behavior:u?"smooth":"instant"},function(e){var t={};return e instanceof Object&&Object.entries(e).forEach((function(e){var r=o(e,2),n=r[0],i=r[1];switch(n){case"behavior":"auto"!==i&&"smooth"!==i||(t[n]=i);case"block":case"inline":"start"!==i&&"center"!==i&&"end"!==i&&"nearest"!==i||(t[n]=i)}})),t}(m));b&&(e.block="start",e.inline="nearest"),document.querySelector(c).scrollIntoView(e)};return t.createElement("div",{style:s,className:p,onClick:function(e){"function"==typeof v?(v(e),setTimeout(O,1e3/60)):O()}},i)}; |
{ | ||
"name": "react-scroll-into-view", | ||
"version": "1.9.2", | ||
"version": "1.9.3", | ||
"description": "Simple React element that when clicked scrolls to any element on page", | ||
@@ -36,3 +36,3 @@ "main": "dist/index.js", | ||
"babel-plugin-transform-react-remove-prop-types": "^0.4.18", | ||
"jest": "24.9.0", | ||
"jest": "^26.6.3", | ||
"prop-types": "^15.6.1", | ||
@@ -46,3 +46,3 @@ "react": "^16.5.2", | ||
"rollup-plugin-node-resolve": "5.2.0", | ||
"rollup-plugin-uglify": "^6.0.0" | ||
"rollup-plugin-terser": "^7.0.2" | ||
}, | ||
@@ -49,0 +49,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
10930
25