@uploadcare/react-uploader 0.0.1-alpha.3 → 0.0.1-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,120 @@
1
+ # Uploadcare React Uploader
2
+
3
+ <a href="https://uploadcare.com/?utm_source=github&utm_campaign=uploadcare-js-api-clients">
4
+ <img align="right" width="64" height="64"
5
+ src="https://ucarecdn.com/edfdf045-34c0-4087-bbdd-e3834921f890/userpiccircletransparent.svg"
6
+ alt="">
7
+ </a>
8
+
9
+ Uploadcare React Uploader. Allows you to use Uploader in React applications according to React canons.
10
+
11
+
12
+ [![Build Status][badge-build]][build-url]
13
+ [![NPM version][npm-img]][npm-url]
14
+ [![GitHub release][badge-release-img]][badge-release-url]
15
+ [![Uploadcare stack on StackShare][badge-stack-img]][badge-stack-url]
16
+
17
+
18
+ ## Install
19
+
20
+ ```
21
+ npm i @uploadcare/react-uploader
22
+ ```
23
+
24
+ ## Usage
25
+
26
+ ```jsx
27
+ import { FileUploaderRegular } from "@uploadcare/react-uploader";
28
+
29
+ <FileUploaderRegular pubkey="YOUR_PUBLIC_KEY"/>;
30
+ ```
31
+
32
+ ## File Uploader API
33
+
34
+ It is possible to get ref on UploadCtxProvider via `ref`. In this way it is possible to additional uploader management
35
+ methods.
36
+
37
+ ```jsx
38
+ import React, { useRef } from "react";
39
+ import {
40
+ FileUploaderRegular,
41
+ UploadCtxProvider
42
+ } from "@uploadcare/react-uploader";
43
+
44
+ const uploaderRef = useRef<InstanceType<UploadCtxProvider> | null>(null);
45
+
46
+ <FileUploaderRegular refUploadCtxProvider={uploaderRef} pubkey="YOUR_PUBLIC_KEY"/>;
47
+ ```
48
+
49
+ ## Events
50
+
51
+ Events in React Uploader are the same as in blocks, see the [documentation][uc-docs-events].
52
+ The principle of converting events from blocks to React Uploader:
53
+
54
+ 1. All events in React Uploader start with `on`.
55
+ 2. All events in React Uploader in `camelCase`.
56
+
57
+ Example:
58
+
59
+ ```jsx
60
+ import { FileUploaderRegular } from "@uploadcare/react-uploader";
61
+
62
+ <FileUploaderRegular
63
+ pubkey="YOUR_PUBLIC_KEY"
64
+ onModalOpen={() => {
65
+ console.log('modal-open')
66
+ }}
67
+ />
68
+ ```
69
+
70
+ ### Table of events
71
+
72
+ | Events blocks | Events React Uploader |
73
+ |------------------------|------------------------|
74
+ | file-added | onFileAdded |
75
+ | file-removed | onFileRemoved |
76
+ | file-upload-start | onFileUploadStart |
77
+ | file-upload-progress | onFileUploadProgress |
78
+ | file-upload-success | onFileUploadSuccess |
79
+ | file-upload-failed | onFileUploadFailed |
80
+ | file-url-changed | onFileUrlChanged |
81
+ | modal-open | onModalOpen |
82
+ | modal-close | onModalClose |
83
+ | done-click | onDoneClick |
84
+ | upload-click | onUploadClick |
85
+ | activity-change | onActivityChange |
86
+ | common-upload-start | onCommonUploadStart |
87
+ | common-upload-progress | onCommonUploadProgress |
88
+ | common-upload-success | onCommonUploadSuccess |
89
+ | common-upload-failed | onCommonUploadFailed |
90
+ | change | onChange |
91
+ | group-created | onGroupCreated |
92
+
93
+ ## Security issues
94
+
95
+ If you think you ran into something in Uploadcare libraries that might have
96
+ security implications, please hit us up at
97
+ [bugbounty@uploadcare.com][uc-email-bounty] or Hackerone.
98
+
99
+ We'll contact you personally in a short time to fix an issue through co-op and
100
+ prior to any public disclosure.
101
+
102
+ ## Feedback
103
+
104
+ Issues and PRs are welcome. You can provide your feedback or drop us a support
105
+ request at [hello@uploadcare.com][uc-email-hello].
106
+
107
+ [uc-email-bounty]: mailto:bugbounty@uploadcare.com
108
+
109
+ [uc-email-hello]: mailto:hello@uploadcare.com
110
+
111
+ [badge-stack-img]: https://img.shields.io/badge/tech-stack-0690fa.svg?style=flat
112
+ [badge-stack-url]: https://stackshare.io/uploadcare/stacks/
113
+ [badge-release-img]: https://img.shields.io/github/release/uploadcare/react-components.svg
114
+ [badge-release-url]: https://github.com/uploadcare/react-components/releases
115
+ [npm-img]: http://img.shields.io/npm/v/@uploadcare/react-uploader.svg
116
+ [npm-url]: https://www.npmjs.com/package/@uploadcare/react-uploader
117
+ [badge-build]: https://github.com/uploadcare/react-components/actions/workflows/checks.yml/badge.svg
118
+ [build-url]: https://github.com/uploadcare/react-components/actions/workflows/checks.yml
119
+
120
+ [uc-docs-events]: https://uploadcare.com/docs/file-uploader/events/