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

@tallis/react-dndp

v0.0.7

Published

React Component for upload photo with drag and drop

Downloads

6

Readme

react-dndp

A react component for drag and drop photo files

Note

This is a React Component firstly designed for private use and has been chosen to be publicly available, so the implementation details can be confusing. And so there won't be regular updates.

Installing

yarn add @tallis/react-dndp

Props & Functions

| PropFunc | Type | Required | Default | Note | Purpose | | :-----: | :-: | :-: | :-: | :-: | :-: | | React | React | true | null | Needed for the component to operate | | | NextImage | next/image | false | null | When it is a Next Project | To replace basic tag for showing uploaded photo | | formik | boolean | false | null | | To set the return data for setData prop | | clickWhole | boolean | false | null | | If it true, the whole drag and drop area will be clickable | | showIconUpload | boolean | false | null | | Used to toggle displaying placeholder for drag&drop area | | showDelete | boolean | false | null | | If true, there will be a delete icon when the photo has been uploaded | | helperText | string | false | "Select a photo from the gallery or drag and drop it here." | | Helpertext for the area | | data | base64 string | false | null | | Displayed photo | | setData | function(param1, param2) | true | null | Depends on prop "formik", there can be one or two params. If "formik", then setData(file, base64), else setData(base64) | | getFileSize | function(fileSize) | false | null | | Used to get the size of photo in Bytes | | setFileName | function(fileName) | false | null | | Used to get the name of photo | | setSize | function(sizes) | false | null | {width, height} | Get the dimensions of photo | | onError | function() | false | null | | Callback when there is an error | | CustomIcon | React Element | false | null | Must be react component | Be displayed when there is no photo | | containerProps | React Props | false | null | Props for - MUI | | | stylesImage, stylesImage2 | React Props | false | null | Props for NextImage's wrappers (see example below) |

Example

import Image from 'next/image';

import Uploader from '@tallis/react-dndp';
import Paper from '@mui/material';

import UploadIconIllustration from './UploadIconIllustration';

// other code

<Paper variant='outlined' sx={{
    position: 'relative',
    height: photoSizes?.width * 0.7,
    width: photoSizes?.width * 0.7,
    overflow: 'hidden',
    borderRadius: '10px',
    mt: 1
}}>
    <Uploader
         containerProps={{
             sx: {
                 position: 'absolute',
                 top: 0,
                 zIndex: 2,
                 width: '100%',
                 height: '100%',
                 cursor: 'pointer',
                 display: 'flex',
                 flexDirection: 'row',
                 justifyContent: 'center',
                 alignItems: 'center'
                 },
             container: true
          }}
          stylesImage={{
             style: {
                 position: 'absolute',
                 top: 0,
                 left: 0,
                 width: '100%',
                 height: '100%',
             }
          }}
          stylesImage2={{
             style: {
                 width: '100%',
                 height: '100%',
                 position: 'relative'
             }
          }}
          setData={(data, base64) => {
             photo?.set('illustration', data);
             photo?.set('photo', base64);
             setPhoto(photo);
         }}
         data={Boolean(photo?.get('photo')) ? photo?.get('photo') : null}
         CustomIcon={UploadIconIllustration}
         showIconUpload={Boolean(photo?.get('photo')) ? false : true}
         getFileSize={(data) => setIsOver10MB(data)}
         isFormik
         clickWhole
         NextImage={Image}
         React={React}
         onError={() => dispatch({ type: t.SHOW_SNACKBAR, payload: { message: 'Only image file is allowed', type: 'error' } })}
     />
 </Paper>

// other code