@uploadcare/react-uploader 0.2.0-alpha.0 → 0.3.0

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 CHANGED
@@ -6,44 +6,120 @@
6
6
  alt="">
7
7
  </a>
8
8
 
9
- Uploadcare React Uploader. Allows you to use Uploader in React applications according to React canons.
10
-
9
+ Welcome to the Uploadcare React Uploader documentation!
10
+ This library allows you to seamlessly integrate Uploadcare file uploader into your React applications while adhering to
11
+ React principles.
11
12
 
12
13
  [![Build Status][badge-build]][build-url]
13
14
  [![NPM version][npm-img]][npm-url]
14
15
  [![GitHub release][badge-release-img]][badge-release-url]
15
16
  [![Uploadcare stack on StackShare][badge-stack-img]][badge-stack-url]
16
17
 
18
+ * [Summary about project](#summary-about-project)
19
+ * [Quick Features](#quick-features)
20
+ * [Install](#install)
21
+ * [Common](#common)
22
+ * [Usage](#usage)
23
+ * [Regular](#regular)
24
+ * [Inline](#inline)
25
+ * [Minimal](#minimal)
26
+ * [Props API](#props-api)
27
+ * [Styles](#styles)
28
+ * [File Uploader API](#file-uploader-api)
29
+ * [Events](#events)
30
+ * [Security issues](#security-issues)
31
+ * [Feedback](#feedback)
32
+
33
+ ## Summary about project
34
+
35
+ This documentation provides guidance on how to use the Uploadcare React Uploader in your projects, along with details
36
+ about its features, installation process, usage examples, customization options, event handling, and security
37
+ considerations.
38
+
39
+ ## Quick Features
40
+
41
+ - Seamless integration with React applications
42
+ - Three different upload options: Regular, Inline, and Minimal
43
+ - Customizable styles
44
+ - Access to File Uploader API
45
+ - Comprehensive event handling
17
46
 
18
47
  ## Install
19
48
 
20
- ```
49
+ ```bash
21
50
  npm i @uploadcare/react-uploader
22
51
  ```
23
52
 
24
53
  ## Usage
25
54
 
55
+ The Uploadcare React Uploader offers three main components for integration.
56
+ Each component serves specific use cases and can be easily implemented into your project.
57
+
58
+ ### Regular
59
+
26
60
  ```jsx
27
- import { FileUploaderRegular } from "@uploadcare/react-uploader";
61
+ import {FileUploaderRegular} from "@uploadcare/react-uploader";
28
62
 
29
63
  <FileUploaderRegular pubkey="YOUR_PUBLIC_KEY"/>;
30
64
  ```
31
65
 
66
+ ### Inline
67
+
68
+ ```jsx
69
+ import {FileUploaderInline} from "@uploadcare/react-uploader";
70
+
71
+ <FileUploaderInline pubkey="YOUR_PUBLIC_KEY"/>;
72
+ ```
73
+
74
+ ### Minimal
75
+
76
+ ```jsx
77
+ import {FileUploaderMinimal} from "@uploadcare/react-uploader";
78
+
79
+ <FileUploaderMinimal pubkey="YOUR_PUBLIC_KEY"/>;
80
+ ```
81
+
82
+ ## Props API
83
+
84
+ An easy way to connect React-Uploader to your project and utilize the available API props.
85
+ We provide a full set of props that are used in blocks. For review we suggest you to look at
86
+ the [documentation](uc-docs-file-uploader-options).
87
+
88
+ ## Styles
89
+
90
+ You can customize the appearance of the React uploader using the className prop, which allows you to add custom CSS
91
+ classes to the uploader `FileUploader[Regular | Minimal | Inline]` wrapper.
92
+
93
+ ```jsx
94
+ import {FileUploaderRegular} from "@uploadcare/react-uploader";
95
+
96
+ <FileUploaderRegular className="fileUploaderWrapper" pubkey="YOUR_PUBLIC_KEY"/>;
97
+ ```
98
+
99
+ ```css
100
+ .fileUploaderWrapper lr-file-uploader-regular {
101
+ }
102
+ ```
103
+
32
104
  ## File Uploader API
33
105
 
34
- It is possible to get ref on UploadCtxProvider via `ref`. In this way it is possible to additional uploader management
35
- methods.
106
+ For convenience, we provide the ability to access the File Uploader API using `apiRef`.
107
+ You can see what methods are available in `apiRef` in the [documentation][uc-docs-file-uploader-api].
108
+ It is important to note that we now pass all InstanceType from UploadCtxProvider.
36
109
 
37
110
  ```jsx
38
- import React, { useRef } from "react";
111
+ import React, {useRef, useEffect} from "react";
39
112
  import {
40
113
  FileUploaderRegular,
41
114
  UploadCtxProvider
42
115
  } from "@uploadcare/react-uploader";
43
116
 
44
- const uploaderRef = useRef<InstanceType<UploadCtxProvider> | null>(null);
117
+ const Example = () => {
118
+ const uploaderRef = useRef < InstanceType < UploadCtxProvider > | null > (null);
45
119
 
46
- <FileUploaderRegular refUploadCtxProvider={uploaderRef} pubkey="YOUR_PUBLIC_KEY"/>;
120
+
121
+ <FileUploaderRegular apiRef={uploaderRef} pubkey="YOUR_PUBLIC_KEY"/>;
122
+ }
47
123
  ```
48
124
 
49
125
  ## Events
@@ -57,7 +133,7 @@ The principle of converting events from blocks to React Uploader:
57
133
  Example:
58
134
 
59
135
  ```jsx
60
- import { FileUploaderRegular } from "@uploadcare/react-uploader";
136
+ import {FileUploaderRegular} from "@uploadcare/react-uploader";
61
137
 
62
138
  <FileUploaderRegular
63
139
  pubkey="YOUR_PUBLIC_KEY"
@@ -109,12 +185,23 @@ request at [hello@uploadcare.com][uc-email-hello].
109
185
  [uc-email-hello]: mailto:hello@uploadcare.com
110
186
 
111
187
  [badge-stack-img]: https://img.shields.io/badge/tech-stack-0690fa.svg?style=flat
188
+
112
189
  [badge-stack-url]: https://stackshare.io/uploadcare/stacks/
190
+
113
191
  [badge-release-img]: https://img.shields.io/github/release/uploadcare/react-components.svg
192
+
114
193
  [badge-release-url]: https://github.com/uploadcare/react-components/releases
194
+
115
195
  [npm-img]: http://img.shields.io/npm/v/@uploadcare/react-uploader.svg
196
+
116
197
  [npm-url]: https://www.npmjs.com/package/@uploadcare/react-uploader
198
+
117
199
  [badge-build]: https://github.com/uploadcare/react-components/actions/workflows/checks.yml/badge.svg
200
+
118
201
  [build-url]: https://github.com/uploadcare/react-components/actions/workflows/checks.yml
119
202
 
120
203
  [uc-docs-events]: https://uploadcare.com/docs/file-uploader/events/
204
+
205
+ [uc-docs-file-uploader-api]: https://uploadcare.com/docs/file-uploader/api
206
+
207
+ [uc-docs-file-uploader-options]: https://uploadcare.com/docs/file-uploader/options/