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

hidigi-uploader

v0.11.0

Published

A flexible React component for handling single and multiple image uploads with built-in image editing capabilities.

Readme

Image Uploader Component

A flexible React component for handling single and multiple image uploads with built-in image editing capabilities.

Features

  • Single Upload Mode: Traditional single image upload with preview
  • Multiple Upload Mode: Upload multiple images with grid display
  • Image Editing: Built-in image editor with crop, rotate, filters, and more
  • Drag & Drop: Support for drag and drop file uploads
  • File Validation: File type and size validation
  • Responsive Design: Mobile-friendly interface
  • Customizable: Configurable icons, texts, and styling
  • SVG Support: Special handling for SVG files

Installation

npm install your-package-name

Basic Usage

Single Upload Mode

import { ImageUploader } from 'your-package-name';

const MyComponent = () => {
  const handleUpload = async (file: File) => {
    // Your upload logic here
    const uploadedUrl = await uploadToServer(file);
    return uploadedUrl;
  };

  const handleDelete = () => {
    // Handle deletion
  };

  return (
    <ImageUploader
      onUpload={handleUpload}
      onDelete={handleDelete}
      uploadMode="single"
      texts={{
        dragDropText: 'Drag and drop your image here, or',
        selectFileText: 'select a file',
        maxFileSizeText: 'Maximum file size:',
        supportedFormatsText: 'Supported formats: JPEG, PNG, GIF, SVG, WebP',
        uploadButtonText: 'Upload',
        loadingText: 'Loading...',
        errorText: 'An error occurred during upload',
        supportedFormatsError: 'Unsupported file format',
      }}
      icons={{
        deleteIcon: '/path/to/delete-icon.svg',
        editIcon: '/path/to/edit-icon.svg',
        // ... other icons
      }}
    />
  );
};

Multiple Upload Mode

import { ImageUploader } from 'your-package-name';

const MyComponent = () => {
  const [images, setImages] = useState([]);

  const handleUpload = async (file: File) => {
    // Your upload logic here
    const uploadedUrl = await uploadToServer(file);
    return uploadedUrl;
  };

  const handleImagesChange = (newImages) => {
    setImages(newImages);
    console.log('Images updated:', newImages);
  };

  return (
    <ImageUploader
      onUpload={handleUpload}
      onDelete={() => {}} // Not used in multiple mode
      uploadMode="multiple"
      maxUploadCount={6} // Optional: limit total images
      onMultipleImagesChange={handleImagesChange}
      texts={{
        dragDropText: 'Drag and drop your images here, or',
        selectFileText: 'select files',
        maxFileSizeText: 'Maximum file size:',
        supportedFormatsText: 'Supported formats: JPEG, PNG, GIF, SVG, WebP',
        uploadButtonText: 'Upload',
        loadingText: 'Loading...',
        errorText: 'An error occurred during upload',
        supportedFormatsError: 'Unsupported file format',
      }}
      icons={{
        deleteIcon: '/path/to/delete-icon.svg',
        editIcon: '/path/to/edit-icon.svg',
        // ... other icons
      }}
    />
  );
};

Props

ImageUploaderProps

| Prop | Type | Default | Description | | ------------------------ | ------------------------------------------------- | ------------------------------------------------------------------------- | ----------------------------------------------------- | | uploadMode | 'single' \| 'multiple' | 'single' | Upload mode for single or multiple images | | maxUploadCount | number | undefined | Maximum number of images allowed (multiple mode only) | | onMultipleImagesChange | (images: UploadedImage[]) => void | undefined | Callback when multiple images change | | onUpload | (file: File, event?) => Promise<string \| null> | undefined | Upload handler function | | maxFileSizeKB | number | 1000 | Maximum file size in KB | | allowedFileTypes | string[] | ['image/jpeg', 'image/png', 'image/gif', 'image/svg+xml', 'image/webp'] | Allowed MIME types | | icons | IconProps | undefined | Custom icons for the interface | | isRectangular | boolean | false | Use rectangular instead of circular shape | | isEditable | boolean | true | Enable image editing | | initialImage | string \| null | null | Initial image URL (single mode only) | | loading | boolean | false | Show loading state | | texts | TextProps | Required | Text labels for the interface | | onDelete | () => void | Required | Delete handler (single mode only) | | id | string | undefined | Unique identifier for the component | | skipEditorForSvg | boolean | true | Skip editor for SVG files | | disabled | boolean | false | Disable the component |

IconProps

interface IconProps {
  uploadIcon?: string;
  deleteIcon: string;
  editIcon: string;
  resetRotate: string;
  xMark: string;
  cropIcon: string;
  fineTuneIcon: string;
  rotateLeft: string;
  flipHorizontally: string;
  redoIcon: string;
  undoIcon: string;
  loadingIcon?: string | React.ReactNode;
}

TextProps

interface TextProps {
  dragDropText: string;
  selectFileText: string;
  maxFileSizeText: string;
  supportedFormatsText: string;
  uploadButtonText: string;
  loadingText: string;
  errorText: string;
  supportedFormatsError?: string;
}

UploadedImage

interface UploadedImage {
  id: string;
  url: string;
  file?: File;
  isEditing?: boolean;
}

Multiple Upload Mode Features

When uploadMode is set to "multiple":

  • Grid Display: Images are displayed in a responsive grid layout
  • Individual Controls: Each image has its own edit and delete buttons
  • Add More Button: Shows an "Add More" button when under the limit
  • Upload Count Limit: Respects maxUploadCount if specified
  • Batch Processing: Can handle multiple file selections at once
  • Image Management: Individual image editing and deletion

Image Editor Features

The built-in image editor provides:

  • Crop Tool: Interactive cropping with resize handles
  • Rotation: Rotate images left/right
  • Flip: Horizontal flip functionality
  • Fine Tuning: Brightness, contrast, saturation, exposure, temperature, gamma, clarity, vignette
  • Undo/Redo: History management for all changes
  • Reset: Reset all changes to original
  • Mobile Support: Touch-friendly interface

Styling

The component uses Tailwind CSS classes and can be customized through:

  • isRectangular prop for shape
  • Custom CSS classes
  • Icon customization
  • Text customization

Browser Support

  • Modern browsers with ES6+ support
  • File API support
  • Canvas API support
  • Touch events for mobile devices

License

MIT License