@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 +55 -29
- package/dist/index.cjs +205 -6016
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +151 -5964
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
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
|
|
165
|
+
An interactive avatar editor with zoom, rotation, and drag controls.
|
|
166
166
|
|
|
167
167
|
**Features:**
|
|
168
168
|
|
|
169
|
-
- Image zoom (0.
|
|
170
|
-
- Image rotation (0° - 360°)
|
|
171
|
-
-
|
|
172
|
-
- Real-time preview
|
|
173
|
-
- Customizable size
|
|
174
|
-
-
|
|
175
|
-
-
|
|
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
|
|
235
|
+
A complete avatar editing experience with preview display and edit dialog.
|
|
235
236
|
|
|
236
237
|
**Features:**
|
|
237
238
|
|
|
238
|
-
-
|
|
239
|
-
-
|
|
240
|
-
- Integrated AvatarEditor
|
|
241
|
-
-
|
|
242
|
-
-
|
|
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
|
-
|
|
251
|
-
|
|
252
|
-
onSave={(
|
|
253
|
-
|
|
258
|
+
value={avatar}
|
|
259
|
+
onChange={setAvatar}
|
|
260
|
+
onSave={async (dataUrl) => {
|
|
261
|
+
const result = await uploadAvatar(dataUrl);
|
|
262
|
+
return result.success;
|
|
254
263
|
}}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
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
|
-
|
|
267
|
-
|
|
268
|
-
onSave
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
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
|
|