@arbisoft/react-design-tool 1.0.23 → 1.0.24
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 +107 -56
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
# 🎨 React Design Tool (by @arbisoft)
|
|
3
2
|
|
|
4
3
|
A React component for creating and editing designs with templates, images, and customizable elements.
|
|
@@ -12,37 +11,45 @@ With this tool, you can:
|
|
|
12
11
|
- **Save** the final design data and image output
|
|
13
12
|
|
|
14
13
|
Perfect for integrating into applications that require user-driven visual content creation.
|
|
15
|
-
|
|
14
|
+
|
|
15
|
+
## 🎬 Studio Preview
|
|
16
16
|
|
|
17
17
|
**Live Walkthrough (GIF)**
|
|
18
18
|
|
|
19
19
|

|
|
20
|
+
|
|
20
21
|
## 🖥️ Demo
|
|
21
22
|
|
|
22
23
|
Check out the live demo here:
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
[](https://codesandbox.io/p/sandbox/fdftlr)
|
|
25
26
|
|
|
26
27
|
## 📦 Installation( react >= 19 )
|
|
27
28
|
|
|
28
29
|
```bash
|
|
29
30
|
npm install @arbisoft/react-design-tool
|
|
30
31
|
```
|
|
32
|
+
|
|
31
33
|
OR
|
|
34
|
+
|
|
32
35
|
```bash
|
|
33
36
|
yarn add @arbisoft/react-design-tool
|
|
34
37
|
|
|
35
38
|
```
|
|
39
|
+
|
|
36
40
|
#### ⚠️ Important: Installation Guide for React 18 and Below
|
|
37
41
|
|
|
38
42
|
```bash
|
|
39
|
-
npm install @arbisoft/react-design-tool@1.0.
|
|
43
|
+
npm install @arbisoft/react-design-tool@1.0.23
|
|
40
44
|
```
|
|
45
|
+
|
|
41
46
|
OR
|
|
47
|
+
|
|
42
48
|
```bash
|
|
43
|
-
yarn add @arbisoft/react-design-tool@1.0.
|
|
49
|
+
yarn add @arbisoft/react-design-tool@1.0.23
|
|
44
50
|
|
|
45
51
|
```
|
|
52
|
+
|
|
46
53
|
## 🚀 Quick Start
|
|
47
54
|
|
|
48
55
|
```jsx
|
|
@@ -50,151 +57,185 @@ import React, { useRef } from 'react';
|
|
|
50
57
|
import { Studio } from '@arbisoft/react-design-tool';
|
|
51
58
|
|
|
52
59
|
function MyComponent() {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
60
|
+
const studioRef = useRef(null);
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<Studio
|
|
64
|
+
ref={studioRef}
|
|
65
|
+
defaultTemplatesList={[]}
|
|
66
|
+
customTemplatesList={[]}
|
|
67
|
+
defaultImages={[]}
|
|
68
|
+
customImages={[]}
|
|
69
|
+
uploadImageCallBack={async file => {
|
|
70
|
+
// Upload logic here
|
|
71
|
+
return 'url_of_uploaded_image';
|
|
72
|
+
}}
|
|
73
|
+
elementsList={[]}
|
|
74
|
+
qrLink={'http://example.com'}
|
|
75
|
+
disableWhiteLabel={true}
|
|
76
|
+
title={'New Title'}
|
|
77
|
+
styleProps={{
|
|
78
|
+
primaryColor: 'red',
|
|
79
|
+
}}
|
|
80
|
+
defaultText={'Your Default Text'}
|
|
81
|
+
onSave={async data => {
|
|
82
|
+
console.log('Saved data:', data);
|
|
83
|
+
}}
|
|
84
|
+
saveButtonText={'Save Progress'}
|
|
85
|
+
locale={'en'}
|
|
86
|
+
/>
|
|
87
|
+
);
|
|
81
88
|
}
|
|
82
89
|
|
|
83
90
|
export default MyComponent;
|
|
84
91
|
```
|
|
92
|
+
|
|
85
93
|
## Props Configuration
|
|
86
94
|
|
|
87
95
|
#### 1. `defaultTemplatesList` (Array of templates)
|
|
96
|
+
|
|
88
97
|
Pre-loaded default templates provided by the system.
|
|
89
98
|
**Format:** Array of template objects
|
|
90
99
|
**Example:**
|
|
100
|
+
|
|
91
101
|
```js
|
|
92
102
|
defaultTemplatesList={[
|
|
93
|
-
{
|
|
94
|
-
title: 'Business Card',
|
|
95
|
-
image: 'url',
|
|
96
|
-
elements: [...]
|
|
103
|
+
{
|
|
104
|
+
title: 'Business Card',
|
|
105
|
+
image: 'url',
|
|
106
|
+
elements: [...]
|
|
97
107
|
}
|
|
98
108
|
]}
|
|
99
109
|
```
|
|
100
|
-
|
|
110
|
+
|
|
111
|
+
#### 2. `customTemplatesList` (Array of templates)
|
|
112
|
+
|
|
101
113
|
**Format:** Array of template objects
|
|
102
114
|
**Example:**
|
|
115
|
+
|
|
103
116
|
```js
|
|
104
117
|
customTemplatesList={[
|
|
105
|
-
{
|
|
106
|
-
title: 'Custom template',
|
|
107
|
-
image: 'url',
|
|
108
|
-
elements: [...]
|
|
118
|
+
{
|
|
119
|
+
title: 'Custom template',
|
|
120
|
+
image: 'url',
|
|
121
|
+
elements: [...]
|
|
109
122
|
}
|
|
110
123
|
]}
|
|
111
124
|
```
|
|
112
|
-
|
|
125
|
+
|
|
126
|
+
#### 3. `defaultImages` (Array of URLs)
|
|
127
|
+
|
|
113
128
|
System-provided stock images.
|
|
114
129
|
|
|
115
130
|
**Format:** Array of image urls
|
|
116
131
|
**Example:**
|
|
132
|
+
|
|
117
133
|
```js
|
|
118
134
|
defaultImages={[
|
|
119
135
|
"https://example.com/stock1.jpg",
|
|
120
136
|
"https://example.com/stock2.png"
|
|
121
137
|
]}
|
|
122
138
|
```
|
|
123
|
-
|
|
139
|
+
|
|
140
|
+
#### 4. `customImages` (Array of URLs)
|
|
141
|
+
|
|
124
142
|
User-uploaded or organization-specific images.
|
|
125
143
|
|
|
126
144
|
**Format:** Array of image urls
|
|
127
145
|
**Example:**
|
|
146
|
+
|
|
128
147
|
```js
|
|
129
148
|
customImages={[
|
|
130
149
|
"https://example.com/stock1.jpg",
|
|
131
150
|
"https://example.com/stock2.png"
|
|
132
151
|
]}
|
|
133
152
|
```
|
|
134
|
-
|
|
153
|
+
|
|
154
|
+
#### 5. `uploadImageCallBack` (Async function)
|
|
155
|
+
|
|
135
156
|
User-defined function to handle file uploads and return a hosted URL.
|
|
136
157
|
By default, the component handles images as base64, which may not be ideal for storage.
|
|
137
158
|
To avoid large payloads and for better performance, it's recommended to upload the file and return the hosted URL.
|
|
138
159
|
|
|
139
160
|
**Example:**
|
|
161
|
+
|
|
140
162
|
```js
|
|
141
163
|
uploadImageCallBack={async (file) => {
|
|
142
164
|
// Upload logic here
|
|
143
165
|
return 'https://yourcdn.com/uploaded-image.png';
|
|
144
166
|
}}
|
|
145
167
|
```
|
|
146
|
-
|
|
168
|
+
|
|
169
|
+
#### 6. `elementsList` (Array of elements)
|
|
170
|
+
|
|
147
171
|
An array of design elements to be rendered on the canvas by default.
|
|
148
172
|
If you pass an `elementsList`, the Studio will initialize with these elements already placed on the canvas.
|
|
149
173
|
|
|
150
174
|
**Example:**
|
|
175
|
+
|
|
151
176
|
```js
|
|
152
177
|
elementsList={[
|
|
153
178
|
{...},{...},{...}
|
|
154
179
|
]}
|
|
155
180
|
```
|
|
156
|
-
|
|
181
|
+
|
|
182
|
+
#### 7. `qrLink` (URL String)
|
|
183
|
+
|
|
157
184
|
A URL string used to generate a QR code element on the canvas.
|
|
158
185
|
When scanned, the QR will redirect to this link.
|
|
159
186
|
|
|
160
187
|
**Example:**
|
|
188
|
+
|
|
161
189
|
```js
|
|
162
190
|
qrLink={'https://somelink.com'}
|
|
163
191
|
```
|
|
164
|
-
|
|
192
|
+
|
|
193
|
+
#### 8. `disableWhiteLabel` (Boolean)
|
|
194
|
+
|
|
165
195
|
Boolean flag to hide the white-label (branding) section from the sidebar.
|
|
166
196
|
Set to `true` if you want to remove branding options from the sidebar.
|
|
167
197
|
|
|
168
198
|
**Example:**
|
|
199
|
+
|
|
169
200
|
```js
|
|
170
201
|
disableWhiteLabel={true}
|
|
171
202
|
```
|
|
172
|
-
|
|
203
|
+
|
|
204
|
+
#### 9. `title` (String)
|
|
205
|
+
|
|
173
206
|
Sets the title for the current template being edited in the Studio.
|
|
174
207
|
|
|
175
208
|
**Example:**
|
|
209
|
+
|
|
176
210
|
```js
|
|
177
211
|
title={'New Title'}
|
|
178
212
|
```
|
|
179
|
-
|
|
213
|
+
|
|
214
|
+
#### 10. `styleProps` (Object)
|
|
215
|
+
|
|
180
216
|
Use this to customize the styling of the Studio, including elements like the sidebar pills.
|
|
181
217
|
For example, by providing a `primaryColor`, you can change the color of the sidebar pills to match your branding color.
|
|
182
218
|
|
|
183
219
|
**Example:**
|
|
220
|
+
|
|
184
221
|
```js
|
|
185
222
|
styleProps={{
|
|
186
223
|
primaryColor: 'red',
|
|
187
224
|
}}
|
|
188
225
|
```
|
|
189
|
-
|
|
226
|
+
|
|
227
|
+
#### 11. `defaultText` (String)
|
|
228
|
+
|
|
190
229
|
Overrides the predefined text content in the text section of the Studio.
|
|
191
230
|
There is a list of predefined texts that can be added to the canvas by clicking on them, each with predefined fonts and styles.
|
|
192
231
|
By providing this prop, you can change the default content for these texts.
|
|
193
232
|
|
|
194
233
|
**Example:**
|
|
234
|
+
|
|
195
235
|
```js
|
|
196
236
|
defaultText={'Your Default Text'}
|
|
197
237
|
```
|
|
238
|
+
|
|
198
239
|
#### 12. `defaultQrLogo` (String)
|
|
199
240
|
|
|
200
241
|
Sets a default logo image to appear inside the QR code when the Studio loads.
|
|
@@ -204,35 +245,45 @@ Sets a default logo image to appear inside the QR code when the Studio loads.
|
|
|
204
245
|
```js
|
|
205
246
|
defaultQrLogo={'https://yourcdn.com/qr-logo.png'}
|
|
206
247
|
```
|
|
207
|
-
|
|
248
|
+
|
|
249
|
+
#### 13. `onSave` (Async function)
|
|
250
|
+
|
|
208
251
|
By providing this function, a "Save" Call-to-Action (CTA) button will appear in the Studio.
|
|
209
252
|
When the user clicks on this button, the function will be executed, and you will receive the current design data.
|
|
210
253
|
This data includes an array of elements and the image of the canvas. You can then use this data as needed, such as storing the elements and image.
|
|
211
254
|
|
|
212
255
|
**Example:**
|
|
256
|
+
|
|
213
257
|
```js
|
|
214
258
|
onSave={async (data) => {
|
|
215
|
-
console.log('Saved data:', data);
|
|
259
|
+
console.log('Saved data:', data);
|
|
216
260
|
// { elements: [array of elements],image:canvas image }
|
|
217
261
|
// You can store this data or perform any actions you'd like
|
|
218
262
|
}}
|
|
219
263
|
```
|
|
220
|
-
|
|
264
|
+
|
|
265
|
+
#### 14. `saveButtonText` (String)
|
|
266
|
+
|
|
221
267
|
Overrides the text for the Call-to-Action (CTA) button that appears in the Studio.
|
|
222
268
|
|
|
223
269
|
**Example:**
|
|
270
|
+
|
|
224
271
|
```js
|
|
225
272
|
saveButtonText={'Save Progress'}
|
|
226
273
|
```
|
|
227
|
-
|
|
274
|
+
|
|
275
|
+
#### 15. `locale` (String)
|
|
276
|
+
|
|
228
277
|
Sets the locale for the Studio to provide multilingual support.
|
|
229
278
|
You can set the `locale` prop to one of the supported languages: `"fr"`, `"en"`, `"ru"`, `"pl"`, `"de"`, `"es"`, or `"it"`.
|
|
230
279
|
The default locale is `"en"`.
|
|
231
280
|
|
|
232
281
|
**Example:**
|
|
282
|
+
|
|
233
283
|
```js
|
|
234
284
|
locale={'fr'}
|
|
235
285
|
```
|
|
286
|
+
|
|
236
287
|
#### 16. `ref` (reference)
|
|
237
288
|
|
|
238
289
|
A reference to the `Studio` component.
|
|
@@ -267,6 +318,6 @@ studioRef?.current?.setLoading(true);
|
|
|
267
318
|
const handleSave = async () => {
|
|
268
319
|
const data = await studioRef?.current?.onSave();
|
|
269
320
|
console.log('Saved data:', data);
|
|
270
|
-
|
|
321
|
+
// { elements: [array of elements], image: canvas image }
|
|
271
322
|
};
|
|
272
323
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arbisoft/react-design-tool",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.24",
|
|
4
4
|
"description": "Arbisoft design tool library",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"qrcode": "^1.5.4",
|
|
74
74
|
"react": ">=16",
|
|
75
75
|
"react-dom": ">=16",
|
|
76
|
-
"react-konva": "^
|
|
76
|
+
"react-konva": "^19.0.3",
|
|
77
77
|
"react-konva-utils": "^1.1.0",
|
|
78
78
|
"styled-components": "^6.1.17"
|
|
79
79
|
}
|