@arbisoft/react-design-tool 1.0.23 → 1.0.25

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
@@ -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
- ## 🎬 Studio Preview
14
+
15
+ ## 🎬 Studio Preview
16
16
 
17
17
  **Live Walkthrough (GIF)**
18
18
 
19
19
  ![Studio Editor Screenshot](https://i.ibb.co/M5hZtFTG/design-tool.gif)
20
+
20
21
  ## 🖥️ Demo
21
22
 
22
23
  Check out the live demo here:
23
24
 
24
- [![Live Demo](https://img.shields.io/badge/Live-Demo-blue?style=for-the-badge)](https://codesandbox.io/p/sandbox/fdftlr)
25
+ [![Live Demo](https://img.shields.io/badge/Live-Demo-blue?style=for-the-badge)](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.21
43
+ npm install @arbisoft/react-design-tool@1.0.25
40
44
  ```
45
+
41
46
  OR
47
+
42
48
  ```bash
43
- yarn add @arbisoft/react-design-tool@1.0.21
49
+ yarn add @arbisoft/react-design-tool@1.0.25
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
- const studioRef = useRef(null);
54
-
55
- return (
56
- <Studio
57
- ref={studioRef}
58
- defaultTemplatesList={[]}
59
- customTemplatesList={[]}
60
- defaultImages={[]}
61
- customImages={[]}
62
- uploadImageCallBack={async (file) => {
63
- // Upload logic here
64
- return 'url_of_uploaded_image';
65
- }}
66
- elementsList={[]}
67
- qrLink={'http://example.com'}
68
- disableWhiteLabel={true}
69
- title={'New Title'}
70
- styleProps={{
71
- primaryColor: 'red',
72
- }}
73
- defaultText={'Your Default Text'}
74
- onSave={async (data) => {
75
- console.log('Saved data:', data);
76
- }}
77
- saveButtonText={'Save Progress'}
78
- locale={'en'}
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
- #### 2. `customTemplatesList` (Array of templates)
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
- #### 3. `defaultImages` (Array of URLs)
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
- #### 4. `customImages` (Array of URLs)
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
- #### 5. `uploadImageCallBack` (Async function)
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
- #### 6. `elementsList` (Array of elements)
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
- #### 7. `qrLink` (URL String)
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
- #### 8. `disableWhiteLabel` (Boolean)
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
- #### 9. `title` (String)
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
- #### 10. `styleProps` (Object)
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
- #### 11. `defaultText` (String)
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
- #### 13. `onSave` (Async function)
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
- #### 14. `saveButtonText` (String)
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
- #### 15. `locale` (String)
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
- // { elements: [array of elements], image: canvas image }
321
+ // { elements: [array of elements], image: canvas image }
271
322
  };
272
323
  ```
package/dist/cjs/index.js CHANGED
@@ -2863,7 +2863,7 @@ var TemplateToolBar = function TemplateToolBar(_ref) {
2863
2863
  tooltip: TEXT_DICTIONARY === null || TEXT_DICTIONARY === void 0 || (_TEXT_DICTIONARY$lang5 = TEXT_DICTIONARY[languageLocale]) === null || _TEXT_DICTIONARY$lang5 === void 0 ? void 0 : _TEXT_DICTIONARY$lang5.CUTTING_GUIDE,
2864
2864
  languageLocale: languageLocale,
2865
2865
  leftIcon: IconFrame,
2866
- max: 200
2866
+ max: 10
2867
2867
  }));
2868
2868
  };
2869
2869
  TemplateToolBar.propTypes = propTypes$v;
@@ -4932,7 +4932,8 @@ var Editor = function Editor(_ref) {
4932
4932
  stroke: cuttingGuideStrokeColor,
4933
4933
  strokeWidth: cuttingGuideStroke,
4934
4934
  strokeScaleEnabled: false,
4935
- fill: 'transparent'
4935
+ fill: 'transparent',
4936
+ dash: [10, 5] // [dash length, gap length]
4936
4937
  })))))), /*#__PURE__*/React.createElement(BottomToolBar, {
4937
4938
  disableUndo: history.length === 0,
4938
4939
  disableRedo: redoStack.length === 0,