Socket
Socket
Sign inDemoInstall

@rpldy/upload-drop-zone

Package Overview
Dependencies
Maintainers
1
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rpldy/upload-drop-zone - npm Package Compare versions

Comparing version 0.2.3 to 0.2.4

88

lib/UploadDropZone.js
"use strict";
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"; 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); }

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

function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

@@ -25,3 +29,3 @@

var UploadDropZone = (0, _react.forwardRef)(function (props, ref) {
var UploadDropZone = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
var _useWithForwardRef = (0, _sharedUi.useWithForwardRef)(ref),

@@ -53,22 +57,28 @@ containerRef = _useWithForwardRef.ref,

}, [dropHandler, htmlDirContentParams]);
var handleDropUpload = (0, _react.useCallback)(function _callee(e) {
var files;
return regeneratorRuntime.async(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return regeneratorRuntime.awrap(dropFileHandler(e));
var handleDropUpload = (0, _react.useCallback)( /*#__PURE__*/function () {
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(e) {
var files;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return dropFileHandler(e);
case 2:
files = _context.sent;
upload(files, uploadOptionsRef.current);
case 2:
files = _context.sent;
upload(files, uploadOptionsRef.current);
case 4:
case "end":
return _context.stop();
case 4:
case "end":
return _context.stop();
}
}
}
});
}, [upload, dropFileHandler, uploadOptionsRef]);
}, _callee);
}));
return function (_x) {
return _ref.apply(this, arguments);
};
}(), [upload, dropFileHandler, uploadOptionsRef]);
var onDragOver = (0, _react.useCallback)(function (e) {

@@ -81,20 +91,26 @@ e.preventDefault();

}, [onDragOverClassName, containerRef]);
var onDrop = (0, _react.useCallback)(function _callee2(e) {
return regeneratorRuntime.async(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
e.preventDefault();
e.persist();
handleEnd();
_context2.next = 5;
return regeneratorRuntime.awrap(handleDropUpload(e));
var onDrop = (0, _react.useCallback)( /*#__PURE__*/function () {
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(e) {
return regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
e.preventDefault();
e.persist();
handleEnd();
_context2.next = 5;
return handleDropUpload(e);
case 5:
case "end":
return _context2.stop();
case 5:
case "end":
return _context2.stop();
}
}
}
});
}, [handleEnd, handleDropUpload]);
}, _callee2);
}));
return function (_x2) {
return _ref2.apply(this, arguments);
};
}(), [handleEnd, handleDropUpload]);
var onDragLeave = (0, _react.useCallback)(function () {

@@ -108,3 +124,3 @@ handleEnd();

}, [handleEnd]);
return _react["default"].createElement("div", {
return /*#__PURE__*/_react["default"].createElement("div", {
id: id,

@@ -111,0 +127,0 @@ className: className,

{
"version": "0.2.3",
"version": "0.2.4",
"name": "@rpldy/upload-drop-zone",

@@ -28,13 +28,13 @@ "description": "drop zone (container) component to initiate file and folder content uploads",

"dependencies": {
"@rpldy/shared-ui": "^0.2.3",
"@rpldy/shared-ui": "^0.2.4",
"html-dir-content": "^0.3.1"
},
"devDependencies": {
"@rpldy/shared": "^0.2.3",
"@rpldy/uploady": "^0.2.3",
"@storybook/addon-knobs": "^5.3.18",
"flow-bin": "^0.123.0",
"@rpldy/shared": "^0.2.4",
"@rpldy/uploady": "^0.2.4",
"@storybook/addon-knobs": "^5.3.19",
"flow-bin": "^0.126.1",
"react-dnd": "^10.0.2",
"react-dnd-html5-backend": "^10.0.2",
"styled-components": "^4.4.1"
"styled-components": "^5.1.1"
},

@@ -48,3 +48,3 @@ "peerDependencies": {

},
"gitHead": "ae30dff0980d764282621e8fbead581ba4f1386b"
"gitHead": "8c954910416ffd3c3522807b2ea5b58d94e7e208"
}

@@ -13,3 +13,3 @@ import * as React from "react";

dropHandler?: DropHandlerMethod;
htmlDirContentParams?: object;
htmlDirContentParams?: Record<string, unknown>;
children?: JSX.Element | JSX.Element[];

@@ -16,0 +16,0 @@ }

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