File Uploader
Installation
- yarn
- pnpm
- npm
yarn add @mercell/file-uploader-react
pnpm add @mercell/file-uploader-react
npm install --save @mercell/file-uploader-react
The FileUploader has necessary peerDependencies, please make sure that you have them in your project
"@carbon/icons-react": "^10.49.0",
"@mercell/action-menu-react": "^5.0.0",
"@mercell/alert-react": "^5.0.1",
"@mercell/button-react": "^5.0.0",
"@mercell/file-list-react": "^5.0.0",
"@mercell/input-react": "^3.0.1",
"@mercell/tailwind": "^6.0.1",
"@mercell/ui-schemes": "^1.0.11",
"@mercell/use-combined-refs-react-hook": "^2.0.6",
"@mercell/use-drag-react-hook": "^1.0.6",
"@mercell/use-state-history-react-hook": "^2.0.6",
"classnames": "^2.3.1",
"lodash": "^4.17.21",
"react": "^17.0.2"
Usage
Using the File Uploader component is as simple as importing it like this.
import { FileUploader, useFileUploader } from '@mercell/file-uploader-react';
import { FileList } from '@mercell/file-list-react';
import { Download32, TrashCan32 } from '@carbon/icons-react';
Types, definitions, etc.
- Types
- Changelog
- Figma
FileUploaderProps
interface FileUploaderProps<T = void>
extends Omit<JSX.IntrinsicElements['input'], 'onChange'> {
files?: File[];
onChange?: (files: File[]) => void | Promise<T>;
alerts?: AlertConfig[];
dragAndDropText?: string;
browseButtonText?: string;
sizeLimitText?: string;
} & MutableRefObject<HTMLInput>
Name | Type | Default | Required | Description |
---|---|---|---|---|
files | array | - | no | Array of all files |
onChange | function | - | no | Function for onChange |
alerts | AlertConfig[] | - | no | Alert config array to create alerts |
dragAndDropText | string | - | no | Text to inform about drag and drop files |
browseButtonText | string | - | no | Text for browse button |
sizeLimitText | string | - | no | Text the size limit label |
AlertProps
type AlertConfig = AlertProps & {
description: string;
actions: Action[];
};
Regarding the AlertProps
props please go to the Alert documentation.
Regarding the Action
props please go to the FileList documentation.
Change Log - @mercell/file-uploader-react
This log was last generated on Fri, 11 Nov 2022 09:18:57 GMT and should not be manually modified.
4.0.0
Fri, 11 Nov 2022 09:18:57 GMT
Breaking changes
- New styling approach - use only tailwind classes, add tailwind-merge library
3.0.1
Fri, 07 Oct 2022 14:02:49 GMT
Patches
- Change lodash for lodash.uniqueby and lodash.unionby
3.0.0
Thu, 15 Sep 2022 06:07:41 GMT
Breaking changes
- Migration to Tailwind3, React 18 and ViteJS from webpack.
2.0.6
Thu, 30 Jun 2022 10:57:49 GMT
Patches
- Package.json refactor, add test suite, more tests soon
2.0.5
Fri, 08 Apr 2022 10:19:50 GMT
Patches
- Bump dependencies
2.0.4
Mon, 28 Feb 2022 12:45:49 GMT
Patches
- Dependency update
2.0.3
Mon, 28 Feb 2022 10:55:32 GMT
Patches
- Bump typescript
2.0.2
Tue, 01 Feb 2022 13:00:55 GMT
Patches
- Package json fix
2.0.1
Wed, 26 Jan 2022 16:19:19 GMT
Patches
- Move dependencies to peerDependencies to avoid duplication in installation process in project
- Adding the same peerDependencies to devDependencies
2.0.0
Wed, 15 Dec 2021 22:20:34 GMT
Breaking changes
- Update to match figma design
1.0.5
Fri, 12 Nov 2021 13:08:30 GMT
Patches
- Add @mercell/tailwind to devDeps to be always up to date
1.0.4
Fri, 05 Nov 2021 11:10:13 GMT
Patches
- Bump peerDependency
1.0.3
Thu, 04 Nov 2021 10:10:16 GMT
Patches
- Revert tailwind version
1.0.2
Wed, 03 Nov 2021 15:28:42 GMT
Patches
- react types >=17
1.0.1
Wed, 27 Oct 2021 12:53:13 GMT
Patches
- Delete unused undo and redo methods
- Gitignore fix
1.0.0
Mon, 18 Oct 2021 07:16:21 GMT
Breaking changes
- New local build process with webpack without storybook, add npmignore and update dependencies
0.0.19
Tue, 12 Oct 2021 11:37:45 GMT
Patches
- Updated border to 1px
0.0.18
Tue, 14 Sep 2021 08:59:32 GMT
Patches
- Move tailwind to peer deps
0.0.17
Mon, 12 Jul 2021 10:50:09 GMT
Patches
- Updating dependencies
- Updating dependencies
0.0.16
Wed, 07 Jul 2021 09:56:37 GMT
Version update only
0.0.15
Wed, 24 Mar 2021 10:43:19 GMT
Patches
- Fallback text is now drag & drop instead of drop & drop
0.0.14
Wed, 24 Mar 2021 10:17:01 GMT
Patches
- Enabling eslint
0.0.13
Tue, 23 Mar 2021 13:40:42 GMT
Patches
- Adding esm module export
0.0.12
Wed, 17 Mar 2021 10:01:28 GMT
Patches
- Adding readme
0.0.11
Thu, 25 Feb 2021 15:20:45 GMT
Patches
- remove an unnecessary className
0.0.10
Thu, 25 Feb 2021 12:38:21 GMT
Patches
- adjust styling
0.0.9
Thu, 25 Feb 2021 07:02:16 GMT
Version update only
0.0.8
Wed, 24 Feb 2021 11:34:29 GMT
Version update only
0.0.7
Fri, 19 Feb 2021 09:41:17 GMT
Patches
- bump
0.0.6
Thu, 18 Feb 2021 10:26:12 GMT
Patches
- Export
0.0.5
Wed, 17 Feb 2021 10:51:42 GMT
Patches
- Changing border color
0.0.4
Mon, 15 Feb 2021 14:31:25 GMT
Version update only
0.0.3
Mon, 15 Feb 2021 10:36:20 GMT
Patches
- Now using functionScheme from tailwind
0.0.2
Tue, 09 Feb 2021 09:25:03 GMT
Patches
- bump
Sometimes it can take some time until Figma will render component inside embed iframe. Try to click plus icon to 'reset' initial loader. (Works only in Chrome)
Click me to open figma in the new card