Giter Club home page Giter Club logo

files-ui / files-ui-react Goto Github PK

View Code? Open in Web Editor NEW
46.0 3.0 9.0 26.03 MB

UI components for file uploads with React js. Files UI is a complete library for handling files in the UI. You can validate and upload them. Multilanguage. Server side support.

Home Page: https://www.files-ui.com

License: MIT License

JavaScript 0.43% SCSS 13.03% TypeScript 86.54%
drag-and-drop dropzone file-upload form-data hacktoberfest hooks javascript localization react react-dropzone

files-ui-react's Introduction

fui-logo

Files ui

UI components for file uploads with React js.

Files UI is a complete library for handling files in the UI. You can validate and upload them.

license npm latest package kandi X-Ray PRs Welcome GitHub Repo stars Node.js CI

fui-logo

Installation

@files-ui/react is available as an npm package.

// with npm
npm i @files-ui/react
// with yarn
yarn add @files-ui/react

Usage and examples

Here is a quick example to get you started, it's all you need:

import * as React from "react";
import ReactDOM from "react-dom";
import { Dropzone, FileMosaic } from "@files-ui/react";

function App() {
  const [files, setFiles] = React.useState([]);
  const updateFiles = (incommingFiles) => {
    setFiles(incommingFiles);
  };
  return (
    <Dropzone onChange={updateFiles} value={files}>
      {files.map((file) => (
        <FileMosaic {...file} preview />
      ))}
    </Dropzone>
  );
}

ReactDOM.render(<App />, document.querySelector("#app"));

Yes, it's really all you need to get started as you can see in these live and interactive demos:

Basic Sample 🍰 Edit Button
Advanced Sample 🔨 Edit Button

Main Components 💠

Full Documentation 📚

You can find the complete documentation and demos for every component on files-ui.com

More Previews 👀

Image full screen preview 🖼️

Image full screen preview

Video full screen preview 🎞️

Video full screen preview

FileCard, FileInputButton and Avatar preview 🎴

Video full screen preview

DarkMode 🌙 🌞

darkmode 1 preview

darkmode 2 preview

Supporters

Special thanks to these amazing people ⭐ :

👏 Stargazers

Stargazers repo roster for @files-ui/files-ui-react

👏 Forkers

Forkers repo roster for @dropzone-ui/dropzone-ui-react

License

This project is licensed under the terms of the MIT license.

Animated footer bars


Back to top

files-ui-react's People

Contributors

jinssj3 avatar pooyahmti avatar timmfitschen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

files-ui-react's Issues

status aborted for successfull upload

Describe the bug
Getting status "Upload aborted" for successfull upload, when server response is empty.

To Reproduce
Steps to reproduce the behavior:
Using Dropzone in following way:

<Dropzone
  onChange={updateFiles}
  value={files}
  autoClean
  uploadConfig={{
    urlFromExtFile: (extFile) => replaceUrl(link, extFile),
    method: "PUT",
  }}
  actionButtons={{
    position: "after",
    uploadButton: {},
    abortButton: {},
    cleanButton: {},
    deleteButton: {},
  }}
>
  {files.map((file: ExtFile) => (
    <FileMosaic key={file.id} {...file} onDelete={removeFile} info />
  ))}
</Dropzone>

Expected behavior
Upload should be successfull for status 201 / created and no response.

Screenshots
Screenshot 2024-08-06 at 8 58 44

Desktop (please complete the following information):

  • OS: [macOS]
  • Browser [edge]
  • Version [127]

Additional context

Regarding server side template for Flask

I am using this library in one of the projects I am working in my organisation. I wanted to ask is there a server-side template for Flask also? I have used it with Node.js, but now I want to use it with flask in the backend.

addExtraData

i have code in react JS:
import {addExtraData } from '@files-ui/react'

how to using addExtraData , i want to send form data with uploading image to server.

Add `title` and `aria-*` options to ActionButtonItem

Is your feature request related to a problem? Please describe.

Currently, actionButtons are not following modern best practices for a11y (accessibility), especially WAI-ARIA out of the box and do not allow to specify the title or aria attributes manually.

Describe the solution you'd like

Add title the option explicitly and allow aria-* attributes to be passed on to the button element.

<Dropzone 
  actionButtons={{
    uploadButton: {
      ariaLabel: "Click here to upload the selected files."
      title="Click here to upload the selected files."
    }
  }}/> 

Describe alternatives you've considered

Providing good defaults first and add the customization later - however, this is much more effort and defaults should be chosen carefully. So I think customization first and defaults later is better in this case.

FEATURE REQUEST: Allow client-side processing of files before uploading

I'd like to be able to resize images on the client side before uploading them to the server. This would require some way to hook into the upload process.

I've tried Dropzone.onChange, but processing the images requires onChange to be an async handler, and it's currently not. i.e. If onChange returns a Promise, it would await that Promise before continuing on with the upload.

I've also tried the actionButtons / uploadButton with autoUpload = false. Using this prevents the automatic upload, and assigning an onClick handler to the uploadButton means I get to process the event, but I seem to have no way to initiate the upload once the processing is done. Is there a way to initiate the upload externally? That would solve the problem.

Async file validation

Is your feature request related to a problem? Please describe.
The validator function requires a synchronous function, which means I can't actually read the file in order to do the validation, given that all the browser-friendly ways to do so are async. Not being able to actually look at the contents of the file makes it incredibly hard to do any kind of validation.

Describe the solution you'd like
Accept async javascript.

Feature: enable file upload using GraphQL multipart upload

Current file upload doesn't support GraphQL.
I would like to be able to define the upload method in the UploadConfig to be GraphQL, add the GraphQL endpoint and the upload to be done using GraphQL multipart.

As an alternative, I would like to be able to provide my own custom upload function.

double click on FileMosaic opens an alert

Describe the bug
When double clicking on the FileMosaic an alert will show with the text "double click on file", I provided my own onDoubleClick to the component, but it doesn't override the default function but I'm still able to call my custom function.

To Reproduce
Steps to reproduce the behavior:

  1. Render this code
    <Dropzone onChange={updateFiles} value={files} accept=".csv" maxFiles={1} > {files.map((file: ExtFile) => ( <FileMosaic key={file.id} {...file} onDelete={removeFile} info={true} onDoubleClick={() => { console.log("hi there"); }} /> ))} </Dropzone>
  2. upload something in the dropzone
  3. double click on the FileMosaic
  4. An alert will show up with the text "double click on file"

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
image

I'm using @files-ui/react: 1.0.5

[FEAT]: Add fakeUpload customization

Add extra params to define the desired behaviour:

  1. All uploads can end in success status
  2. All uploads can end in error status
  3. All uploads will result in a random status

Group all selected files into a single request

Currently after file selection when Upload action button is clicked files are sent one after another each one in a separate request.
Is it possible to configure the component to group all files in a single request and send to server ?

Have a few suggestions

1.You want ref to be able to invoke the component default event for upload
2.You can customize the button to trigger the upload, and then add the upload progress
3.I want fakeUpload to be able to customize the upload status, progress, etc. I want every upload to be successful, not random upload success.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.