npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, πŸ‘‹, I’m Ryan HefnerΒ  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you πŸ™

Β© 2025 – Pkg Stats / Ryan Hefner

@eduvidu/react-drag-and-drop

v0.9.6

Published

* πŸ“ Supports All File Types: Documents (pdf, docx, xlsx, pptx, txt, zip, dcm) and Images (png, jpg, jpeg, gif) * πŸ–ΌοΈ Image Previews: Displays previews for images * ❌ File Removal: Users can remove selected files before uploading * πŸ–±οΈ Click or Drag & Dro

Downloads

308

Readme

✨ Features

  • πŸ“ Supports All File Types: Documents (pdf, docx, xlsx, pptx, txt, zip, dcm) and Images (png, jpg, jpeg, gif)
  • πŸ–ΌοΈ Image Previews: Displays previews for images
  • ❌ File Removal: Users can remove selected files before uploading
  • πŸ–±οΈ Click or Drag & Drop: Supports both file selection methods
  • πŸ’‘ Customizable UI: Easy customization of drag text, accepted formats, and modal titles
  • 🎨 Professional Modal: Includes a stylish, responsive modal for file uploads
  • βš™οΈ Built with TypeScript & Rollup: Ensures type safety and optimized bundling

πŸš€ Getting Started

npm install @eduvitech/DragDrop

import React, { useState } from "react";
import { DragDrop } from "@my-organization/my-react-lib";

const handleFileUpload = (files: File[]) => {
  console.log("Uploaded Files:", files.map((file) => file.name));
  alert(`Uploaded files: ${files.map((file) => file.name).join(", ")}`);
};

const App = () => {
  const [showDragDrop, setShowDragDrop] = useState(false);

  return (
    <div style={{ padding: "20px", textAlign: "center" }}>
      <button
        onClick={() => setShowDragDrop(true)}
        style={{
          padding: "10px 20px",
          fontSize: "16px",
          borderRadius: "5px",
          backgroundColor: "#007bff",
          color: "#fff",
          border: "none",
          cursor: "pointer",
          marginBottom: "20px"
        }}
      >
        Upload Files
      </button>

      {showDragDrop && <DragDrop onFileUpload={handleFileUpload} />}
    </div>
  );
};

export default App;

🎨 Customization Options

The component comes with various props for easy customization:

| Prop | Type | Default Value | Description | | --- | --- | --- | --- | | onFileUpload | function | undefined | Callback when files are uploaded | | acceptedFormats | string[] | ['png', 'jpg', 'jpeg', 'gif', 'pdf', 'docx', 'xlsx', 'pptx', 'txt', 'zip', 'dcm'] | Allowed file formats | | maxFileSizeMB | number | 20 | Maximum file size in megabytes | |showPreview |boolean true |Display file preview| |dragText |string |"Drag & Drop files here or Click to Upload"| Text displayed in the drag area| |modalTitle| |string| "Upload Files"| Title of the upload modal|

Example with Custom Props

<DragDrop
  onFileUpload={handleFileUpload}
  acceptedFormats={["png", "jpg", "pdf", "docx", "xlsx", "zip", "dcm"]}
  maxFileSizeMB={50}
  showPreview={true}
  dragText="Drop your files here!"
  modalTitle="Custom Upload Modal"
/>

πŸ’‘ Advanced Usage

Dynamically Display Drag & Drop Component

You can conditionally render the component by managing its state:

const [showDragDrop, setShowDragDrop] = useState(false);

<button onClick={() => setShowDragDrop(true)}>Upload Files</button>

{showDragDrop && <DragDrop onFileUpload={handleFileUpload} />}

πŸ“ Supported File Types

The DragDrop component supports a wide range of file formats:

  • Documents: pdf, docx, xlsx, pptx, txt, zip, dcm
  • Images: png, jpg, jpeg, gif

You can customize the accepted file types by setting the acceptedFormats prop:

acceptedFormats={["png", "jpg", "jpeg", "gif", "pdf", "docx", "xlsx", "pptx", "txt", "zip", "dcm"]}

🎨 UI Design

  • Responsive & Modern Design: Fits perfectly in all screen sizes
  • Sleek Modal: Stylish modal with a close button (Γ—)
  • File Previews: Shows image previews, and file icons for documents
  • Error Handling: Displays error messages for unsupported or large files
  • Remove Files: Users can remove files before uploading

πŸ“¦ Build & Deployment

This library is built using:

  • TypeScript: For type safety
  • Rollup: For optimized bundling
  • React: Compatible with React versions 16, 17, 18, and 19

🎯 Roadmap

  • [ βœ… ] Basic Drag & Drop functionality
  • [ βœ… ] File previews for images
  • [ βœ… ] Support for all document types (pdf, docx, xlsx, pptx, txt)
  • [ βœ… ] Support for zip and dcm (DICOM medical images)
  • [ βœ… ] Professional modal for file uploads
  • [ βœ… ] Customizable drag text and modal title
  • [ βœ… ] File deselect functionality
  • [] Multi-language support (i18n)
  • [] Upload progress indicator
  • [] Integration with cloud storage (AWS S3, Firebase)

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.