@janovix/blocks 1.0.0-rc.5 → 1.0.0-rc.7

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
@@ -162,17 +162,18 @@ interface Language {
162
162
 
163
163
  ### AvatarEditor
164
164
 
165
- An interactive avatar editor with zoom, rotation, and flip controls.
165
+ An interactive avatar editor with zoom, rotation, and drag controls.
166
166
 
167
167
  **Features:**
168
168
 
169
- - Image zoom (0.1x - 3x)
170
- - Image rotation (0° - 360°)
171
- - Horizontal/vertical flip
172
- - Real-time preview
173
- - Customizable size
174
- - Mouse wheel zoom support
175
- - Drag to reposition
169
+ - Image zoom via UI buttons and slider (0.5x - 3x)
170
+ - Image rotation in 15° increments (0° - 360°)
171
+ - Drag to reposition image
172
+ - Real-time preview with circular crop
173
+ - Customizable editor size
174
+ - Optional grid overlay for alignment
175
+ - Reset all transforms
176
+ - Touch-optimized controls for mobile
176
177
 
177
178
  **Usage:**
178
179
 
@@ -231,31 +232,49 @@ interface AvatarEditorProps {
231
232
 
232
233
  ### AvatarEditorDialog
233
234
 
234
- A dialog wrapper for the AvatarEditor component with upload functionality.
235
+ A complete avatar editing experience with preview display and edit dialog.
235
236
 
236
237
  **Features:**
237
238
 
238
- - File upload with drag & drop
239
- - Image preview
240
- - Integrated AvatarEditor
241
- - Cancel/Save actions
242
- - File type validation (image/\*)
239
+ - Large avatar display with edit button
240
+ - Opens fullscreen drawer on mobile, modal on desktop
241
+ - Integrated AvatarEditor with all controls
242
+ - Controlled component (value/onChange)
243
+ - Optional async save handler with feedback
244
+ - Success/error feedback messages
245
+ - Customizable sizes and labels
246
+ - Accessibility optimized
243
247
 
244
248
  **Usage:**
245
249
 
246
250
  ```tsx
247
251
  import { AvatarEditorDialog } from "@janovix/blocks";
248
252
 
253
+ // Basic usage with value/onChange
254
+ <AvatarEditorDialog value={avatar} onChange={setAvatar} />;
255
+
256
+ // With async save handler
249
257
  <AvatarEditorDialog
250
- isOpen={isOpen}
251
- onOpenChange={setIsOpen}
252
- onSave={(editedImage) => {
253
- console.log("Saving image:", editedImage);
258
+ value={avatar}
259
+ onChange={setAvatar}
260
+ onSave={async (dataUrl) => {
261
+ const result = await uploadAvatar(dataUrl);
262
+ return result.success;
254
263
  }}
255
- title="Edit Avatar"
256
- uploadLabel="Upload Image"
257
- cancelLabel="Cancel"
258
- saveLabel="Save"
264
+ dialogTitle="Edit Profile Picture"
265
+ acceptText="Save"
266
+ cancelText="Cancel"
267
+ successMessage="Avatar saved successfully!"
268
+ errorMessage="Failed to save avatar"
269
+ />;
270
+
271
+ // With custom sizes
272
+ <AvatarEditorDialog
273
+ value={avatar}
274
+ onChange={setAvatar}
275
+ displaySize={120}
276
+ editorSize={280}
277
+ outputSize={512}
259
278
  />;
260
279
  ```
261
280
 
@@ -263,13 +282,20 @@ import { AvatarEditorDialog } from "@janovix/blocks";
263
282
 
264
283
  ```typescript
265
284
  interface AvatarEditorDialogProps {
266
- isOpen: boolean;
267
- onOpenChange: (open: boolean) => void;
268
- onSave: (editedImage: string) => void;
269
- title?: string;
270
- uploadLabel?: string;
271
- cancelLabel?: string;
272
- saveLabel?: string;
285
+ value?: string | null;
286
+ onChange?: (dataUrl: string | null) => void;
287
+ onSave?: (dataUrl: string) => Promise<boolean> | boolean;
288
+ displaySize?: number;
289
+ editorSize?: number;
290
+ outputSize?: number;
291
+ placeholder?: string;
292
+ editLabel?: string;
293
+ dialogTitle?: string;
294
+ acceptText?: string;
295
+ cancelText?: string;
296
+ successMessage?: string;
297
+ errorMessage?: string;
298
+ className?: string;
273
299
  }
274
300
  ```
275
301